29 votes
Accepted

Can I open a file in an existing Vim instance from an external command?

You need vim compiled with +clientserver, and then you can use the command: vim --servername SERVER to start a vim instance, and vim --servername SERVER --remote FILE to open the file in the named ...
  • 2,361
25 votes

What are practical uses of the client-server mode?

Before the channel/job recent feature of Vim 7.4, the client-server feature was the only way to do a decent background compilation -- without any dependency to Python. We start compilation as a ...
  • 16.6k
18 votes

What are practical uses of the client-server mode?

My use of this is a little more simplistic (and perhaps commonplace) than Luc Hermitte's. If you start an instance of gvim with this compiled in (and it is, and has been for a long time, on, e.g., ...
14 votes
Accepted

How can I use --servername and --remote in neovim?

Neovim remote is a python script for controlling neovim processes. It has the vim style --servername and --remote options. This is what I use now for my multiple-terminal work environment.
11 votes

How can I use --servername and --remote in neovim?

As far as I know vim has this feature because the GUI vim (gvim) uses the graphical X server. I am aware that non GUI Vim can also use the --servername argument but only when X11 is running and also ...
9 votes

How can I use --servername and --remote in neovim?

As mentioned, all of the clientserver features were removed in Neovim. This is because they use the X11 shared memory and Neovim removed X11 support. However, if I use :help --servername in Neovim I ...
7 votes

Can I open a file in an existing Vim instance from an external command?

While @craigp's answer is correct, I found it most convenient to simply add --remote-silent without worrying about server names,(this assumes you don't want to address named vim instances). This will ...
  • 3,583
7 votes
Accepted

Is it possible to use vim's clientserver functionality to keep settings synchronized?

You can tell a Vim server to reload the vimrc file like so: $ vim --servername MARTIN --remote-send '<Esc>:source $MYVIMRC<CR>' And you can get a list of all servers with: $ vim --...
6 votes

In neovim, how can I share registers between editor instances?

No idea about the clientserver feature, the simplest way I can think of would be to use the system clipboard by default when yanking or pasting which can be done with: set clipboard=unnamedplus ...
  • 1,556
5 votes
Accepted

How to send literal form of special key sequences with --remote-send

In any context where a "keycode" is expected, use <lt> to represent a literal <. vim --remote-send "<lt>C-t>" See also :help keycodes.
5 votes

What are practical uses of the client-server mode?

Embedded development. A lot of times in embedded development you have a IP socket, but limited local hard drive space, or no non-volatile memory, or any number of other things. You can start a server ...
  • 151
4 votes
Accepted

Discard command-line contents when receiving remote keys

One solution (not perfect) is to use Ctrl-C instead, for example: vim --remote-send '<c-c>:echo "test"<cr>' This seems to work in command-line, normal, insert and visual mode, but not in ...
  • 9,490
4 votes

Vim not starting server

I had exactly the same problem when trying to get vimtex working with Skim. That is, I had vim 8 installed with --with-client-server (showing as +clientserver) and XQuartz running but --servername ...
  • 141
4 votes
Accepted

In neovim, how can I share registers between editor instances?

LEI is right; and the neovim help instructions give this as a specific use case for that feature: Two commands can be used to read and write the ShaDa file manually. This can be used to exchange ...
4 votes

How to install vim with +clientserver on debian?

As explained in this 2004 bug report: sudo apt install vim-gtk Adds +clientserver support to vim.
3 votes

What are practical uses of the client-server mode?

I wrote my masters thesis using Vim, LaTeX and BibTeX. To manage my BibTeX references, I used a program called JabRef. JabRef has a neat little feature where you can connect it to a Vim server ...
3 votes

Exit when only one empty window remains

The way I understood your question, you have a script which opens several tabs in a vim instance, you do stuff and end with 2 tabs opened in vim, and one of these tabs is empty. When you close the non ...
  • 48.1k
2 votes
Accepted

Share completions between running vim instances

Vim is able to use the same completion database if the database is external to each vim instance. For example, completion will be somewhat 'shared' if you use ctags completion or youcompleteme or any ...
2 votes
Accepted

How to redirect the output of a command as the quickfix list to a vim server / function?

You cannot use --remote with -q, any arguments after --remote are treated as filenames: --remote Connect to a Vim server and make it edit the files given in the rest of the arguments. ...
  • 24.4k
2 votes

How can I use --servername and --remote in neovim?

An update to the answers. Neovim now supports some limited use of --remote and friends. I think more will be coming in the future. See https://neovim.io/doc/user/remote.html
2 votes

How can I use --servername and --remote in neovim?

For Windows I propose the following solution: Add the following line to you ginit.vim file: silent execute "!echo " . v:servername . " > servername.txt" Remark: The ginit.vim file is to be found ...
2 votes

Externally query a vim server to list the open buffers in it

You could use your own code to list the buffers, instead of execute "silent buffers": for i in range(1, bufnr('$')) if buflisted(i) echo i . ' ' . fnamemodify(bufname(i), ':p') endif endfor ...
  • 3,532
2 votes

What are practical uses of the client-server mode?

My workflow is similar to what goldilocks said in his answer. I use vim8's :terminal feature in combination with --remote option. I maintain 2 window layout in vim. Code in left window and terminal on ...
2 votes
Accepted

Is there a workflow to preview javascript/html/css projects inside the browser?

What you are looking for has nothing to do with Vim or any editor you are using, you want a tool like grunt.js. Grunt is a task runner that you can configure to do a lot of things automatically, ...
  • 48.1k
2 votes
Accepted

Why is :execute required in this --remote-silent command?

I haven't looked deeply into it, but reading :help --remote, it mentions this about +{cmd}: This must be an Ex command that can be followed by "|". Your :normal interprets the remainder as normal ...
  • 17.3k
2 votes
Accepted

Modify syntax highlighting dynamically

As far as I know :h text-properties were designed with this in mind. The main use for text properties is to highlight text. This can be seen as a replacement for syntax highlighting. Instead of ...
  • 12k
1 vote

Is there a workflow to preview javascript/html/css projects inside the browser?

Atom is the only editor I know of that has that capability built-in. You'll need to bring in third party tools. I did some research on a related topic some time back as I was looking for real-time ...
  • 19k
1 vote

Vim not starting server

clientserver needs X11 for working. So on OSX, you have to run XQuartz. Also, be sure that your vim is not a symlink to mvim with the -v option (mvim -v would run vim in terminal mode without X11 ...
  • 11
1 vote
Accepted

Vim's remote-send, without intermediate redraws?

one workaround is to write an tempfile with the command(s) in them. Then send a command to source this file. like in > vim --server "<servername>" --remote-send "so /path/to/tempfile"
  • 2,699
1 vote

Read, compose and send zimbra emails from vim

Try mutt which can open mails in vim.
  • 2,808

Only top scored, non community-wiki answers of a minimum length are eligible