0

Title says is all:

  • start Screen (as in GNU Screen, the screen multiplexer)
  • open file in Vim
  • create a new Screen window
  • open file in that window
  • switch back to first Screen window, and have Vim recongnise the contents of the file in the other Screen window, and use it in autocomplete actions.

So kind of like Vim recognising content in all it's buffers for use in autocomplete, but instead of buffers, Screen windows.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
klokop
  • 2,414
  • 2
  • 18
  • 22

1 Answers1

1

There's no built-in way to achieve this (how could it? Vim doesn't know anything about where its been launched from.) But you could (with quite some effort) implement something like this. Here's just an outline; I hope that's enough to discourage you from it:

Vim allows to implement custom insert-mode completion via 'completefunc', cp. :help complete-functions. To get the sources from the other Vim(s) running in the other screen session(s), you could use the Vim client-server communication :help remote.txt to ask them for their open buffers. Then it's "just" a matter of opening those and parsing them for completion matches (either in your Vim or the remote one).

But why go all the way? I'd rather open those related files in a single Vim instance; after all, Vim allows very flexible layouts with window splits and tab pages itself. (And you can still use the system clipboard for occasional sharing of text snippets.)

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
  • Thanks! Using screen icm Vim is my current workflow, but you're right, I'd be better of using Vim 'windowing' capabilities. – klokop Jun 27 '13 at 10:50