vim-tbone icon indicating copy to clipboard operation
vim-tbone copied to clipboard

Python needs newlines until the final line in the selection

Open r-zip opened this issue 6 years ago • 2 comments

When sending text to an IPython REPL in tmux, the interpreter needs the \rs at the end of each line. Because the plugin converts newlines to carriage returns, it's only possible to send one line at a time.

Is there some way to configure the plugin to only replace the newline at the end of the range with <CR> if it's a Python file?

r-zip avatar Aug 11 '18 16:08 r-zip

The interpreter needs carriage returns and the interpreter gets carriage returns. Not seeing a problem there. Is it the removal of leading whitespace that is tripping you up?

tpope avatar Aug 14 '18 02:08 tpope

Hi @rzpilgrim,

Sorry for bumping this quite-old issue. For your use case, you could use one of iPython's magic commands: %cpaste lets you enter raw input while %paste executes the content of the system clipboard. You can check iPython docs for more info. You can write a wrapper around @tpope 's plugin or set something like this in your .vimrc:

vnoremap <leader>p "+y :silent execute "!tmux send-keys -t top-right \\\%paste C-J"<CR><C-L>

mickaelseznec avatar Jan 18 '19 17:01 mickaelseznec