vimux icon indicating copy to clipboard operation
vimux copied to clipboard

Send more keys with VimuxSendKeys

Open slowkow opened this issue 10 years ago • 2 comments

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.

slowkow avatar May 23 '14 05:05 slowkow

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>

slowkow avatar May 23 '14 16:05 slowkow

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.

alerque avatar Feb 14 '21 07:02 alerque