Skip to content

Instantly share code, notes, and snippets.

@andrewcsmith
Created December 30, 2014 03:11
Show Gist options
  • Save andrewcsmith/99b1446c64b5a0fb29bc to your computer and use it in GitHub Desktop.
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.
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