Relocate the file in the current Vim buffer to a Vim instance in an adjacent tmux pane.
For people who prefer to use tmux panes over Vim windows.
- Shunt files between Vim instances spatially (up, down, left, right)
- Automatically create a new tmux pane when moving into a window edge
- Preserves cursor position when moving files
- Focus follows the file
Using vim-plug:
Plug 'sturob/vim-outsiders'
Using Vundle:
Plugin 'sturob/vim-outsiders'
outsiders.vim provides four mappings in normal mode:
<Leader>mw
- Move file to pane above<Leader>ms
- Move file to pane below<Leader>ma
- Move file to pane on the left<Leader>md
- Move file to pane on the right
- If a tmux pane exists in that direction:
- With Vim: Opens the file in that Vim instance
- With a shell: Launches Vim with the file
- If no tmux pane exists in that direction:
- Creates a new pane + opens the file in a new Vim instance
The plugin works out of the box with default mappings. To change the mappings, add to your .vimrc
:
nnoremap <silent> <Leader>mk :call outsiders#move_file('up')<CR>
nnoremap <silent> <Leader>mh :call outsiders#move_file('left')<CR>
nnoremap <silent> <Leader>mj :call outsiders#move_file('down')<CR>
nnoremap <silent> <Leader>ml :call outsiders#move_file('right')<CR>
outsiders.vim uses tmux to:
- Detect existing panes, their positions, and whether Vim is running in them
- Create new panes when needed
- Send commands to target panes to open files
- Manage focus between panes
MIT