Vim operator to send text from one window to another.
Main use case is sending code to and from the REPL running inside :terminal
buffer.
- Sending lines using motions
- Sending parts of a line using motions
- Sending paragraphs using text objects
- Sending text using visual selections
- Sending commands back - from REPL to script
With your favorite plugin manager. In my case it's vim-plug:
Plug 'karoliskoncevicius/vim-sendtowindow'
Or manually copy the contents of the plugin folder to your ./vim/plugin/ directory.
- Can send text between any two adjacent vim windows.
- Text can be defined by visual selection, motions and text objects.
- Tries to position the cursor in a convenient place after each call.
- Dot repeatable.
By default it uses the following maps:
<space>l
sends to the right window<space>k
sends to the top window<space>j
sends to the bottom window<space>h
sends to the left window
In order to change the above key maps add the following to your vimrc:
let g:sendtowindow_use_defaults=0
And then remap the commands as you see fit. For example this would map all the commands to L, H, K and J respectively:
nmap L <Plug>SendRight
xmap L <Plug>SendRightV
nmap H <Plug>SendLeft
xmap H <Plug>SendLeftV
nmap K <Plug>SendUp
xmap K <Plug>SendUpV
nmap J <Plug>SendDown
xmap J <Plug>SendDownV
If instead you are looking for a plugin with more features and auto-magic, here is a list to choose from: