preservim / vimux

easily interact with tmux from vim
MIT License
2.2k stars 159 forks source link

Send more keys with VimuxSendKeys #108

Open slowkow opened 10 years ago

slowkow commented 10 years ago

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:

slowkow commented 10 years ago

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>
alerque commented 3 years ago

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.