Created
December 30, 2014 03:11
-
-
Save andrewcsmith/99b1446c64b5a0fb29bc to your computer and use it in GitHub Desktop.
Command to send whatever line you're on to the right tmux pane. Great for complicated ipython/pry work.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! g:SendRight(...) range | |
if a:0 > 0 | |
let start = a:1 | |
let end = a:1 | |
else | |
let start = a:firstline | |
let end = a:lastline | |
endif | |
for line in getline(start, end) | |
" every quote with a slash in front of it gets double-slashed | |
let line = substitute(line, '\\"', '\\\\"', 'g') | |
let line = substitute(line, '"', '\\"', 'g') | |
execute('silent !tmux send-keys -l -t right "' . line . '"') | |
execute("silent !tmux send-keys -t right C-m") | |
endfor | |
redraw! | |
endfunction | |
vmap <F7> :call g:SendRight()<CR> | |
nmap <F7> :call g:SendRight(".")<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment