vimux
vimux copied to clipboard
Send more keys with VimuxSendKeys
This patch addresses issue #44, where @gberenfield says:
I can't seem to paste in around 30-40 lines of code into my vimux repl. Anything less works fine.
I write the selected text to a temporary file, read the file with tmux, and paste the contents into the appropriate window.
Caveats:
- When sending the text, vim prompts you with a
more
screen in which you must press Enter repeatedly to scroll to the end. The text is actually sent after you're done mashing the Enter button. I haven't found a way around this -- I'm new to Vimscript.
After applying c1c4e3a, I use this function to send code chunks over to my ipython session in an adjacent tmux pane:
" Send selected text to an adjacent tmux pane.
function! VimuxSlime()
" Automatically register a tmux pane.
if !exists("g:VimuxRunnerIndex")
call VimuxOpenRunner()
endif
" Suppress the `more` screen with "Press Enter".
silent call VimuxSendText("%cpaste\n".@v."\n--\n")
endfunction
" Yank the selection into the v register and call the function.
vmap <Leader>g "vy :call VimuxSlime() <CR>
See #115 for what looks like a much more elegant fix to the same problem. I'm not sure why it got closed, possible because the author was frustrated with the inactivity, but I think it needs to be reviewed again in light of the issue and compared to this solution.