Vim (or neovim) Server In A Tmux Pane
Because vsiatp (Vim Server In A Tmux Pane) is so hard to pronounce.
If you are using tmux
and you like to split your windows into panes
so that, for example, you have a shell running in the left pane and
a vim
instance in the right plane, vispat will allow you to open a
file in the already running vim
on the right.
- Of course you need
tmux
- You need a version of
vim
that was compiled with server support. Depending on your environment, you will have to find the correct vim-package to install. E.g., on Fedora you need to installvim-X11
. - To be able to load Perl modules by their package name, install
Module::Path
cd somedir
git clone https://github.com/mannih/vispat.git
Then, in your .bashrc or .zshrc, add the line
source somedir/vispat/vispat.sh
for use with vim or
source somedir/vispat/nvispat.sh
for use with neovim.
vispat gives you a couple of shell functions to use from the command line:
ws
Create a vertical split and start vim
in the right pane. "ws" as in "work space".
select_vim_pane
(aliased tovp
)
Activate the tmux
pane that contains the vim
instance.
v
Takes one or more file names as arguments and opens those files in the vim instance that can be found in some pane of your current tmux window. If no running vim instance can be found, a new one will be started.
Configuration is optional, but you might want to read on if you are
developing in Perl or like to use vim
's tab feature.
export vispat_for_perl=1
If you want to be able to edit perl modules by package name:
v IO::All
will then find the file implementing IO::All
(you will have to install
Module::Path
for this to work). Also:
v Moo
This works by detecting two colons or by matching arguments that start with a capital letter and do not contain a dot.
export vispat_use_tabs=1
If you prefer using vim
's tabs feature. Every file you load with v will then
open in a new tab.