Wrapper for Vim servers
- Perl 5.10 or later
- Vim (compiled with
+clientserversupport) - tmux (optional)
x-terminal-emulator(optional)
svim.pl [options] server name [Vim arguments]
svim.pl +a [Vim arguments]
svim.pl +A [Vim arguments]
svim.pl
- +t - Run a Vim server in a new terminal window.
- +T - Run a Vim server in a new tmux window.
- +h - Split the current tmux window horizontally and run a Vim server.
- +v - Split the current tmux window vertically and run a Vim server.
- +a - Select a server from a list.
- +A - Similar to +a, but automatically selects the server if there is only one. If there are no servers, a server named A is started.
Specifies the Vim executable. The default is vim.
Specifies the terminal emulator executable. The default is
x-terminal-emulator.
Specifies the tmux executable. The default is tmux.
Specifies the lock file used to prevent concurrent instances. The
default is $XDG_RUNTIME_DIR/svim.lock, or /var/lock/svim.lock
if $XDG_RUNTIME_DIR is not set.
svim.pl FOO hello-world
Run the FOO Vim server and edit hello-world file on it.
svim.pl +t BAR
Run the BAR Vim server in a new terminal window.
svim.pl BAR "+call cursor(34,1)" baz.md
Edit file baz.md on BAR Vim server and position the cursor on line 34.
svim.pl +A qux.pl
Select a server on which to edit qux.pl.
If there is only one running server, it is selected automatically.
If there are no running servers, server A is started.
mkdir -p ~/.zsh/functions
cp zsh-completion/_svim.pl ~/.zsh/functions/
alias svils='vim --serverlist'
alias svimls='svils'
alias svi='svim.pl'
alias svim='svi'
alias wsvi='svim +t'
alias wsvim='wsvi'
alias savi='svim +A'
alias savim='savi'
alias wsavi='svim +tA'
alias wsavim='wsavi'
alias tsvi='svim.pl +T'
alias tvsvi='svim.pl +v'
alias thsvi='svim.pl +h'
alias tsvim='tsvi'
alias tvsvim='tvsvi'
alias thsvim='thsvi'
Handling desktop files for Vim servers. (Can work without svim.pl.)
Add the following lines to your .vimrc:
if has("autocmd")
augroup SVIM
autocmd!
autocmd VimEnter * silent execute "!update-desktop-vi-server.pl&" | redraw!
autocmd VimLeave * !update-desktop-vi-server.pl 1
augroup END
endif
