I have installed this vim plugin to have identation lines in vim: GitHub - Yggdroot/indentLine: A vim plugin to display the indention levels with thin vertical lines
Now I have noticed that if I copy and paste something from vim to the REPL, the identation characters are copied and pasted as well, of course invalidating the code:
if x == 1
│ println(x) # < the | was pasted here...
Anyone had a similar experience with that? Do you use this with some workaround, or any other alternative to get identation lines in vim without this issue?
It uses conceal feature of the vim, so the question is how do you copy? Usual
yank operations should copy original text instead of the overlay. Mouse selection on the other hand copies visual text.
By the way, vim beautifier is rather good, so usual
ggVG= should work just fine to fix all idents.
Indeed, I am not copying within the same file, so either I am using a mouse selection, or “shift-control-c”.
(copying with the standard yanking of vim to the same file is fine).
You can use
"*y (depends on your OS) to copy to mouse buffer and than use it in another window.
Thanks, that helps, won’t be bad to finger-memorize those as well. Yet I will still search for a solution that allows me to use the mouse selection/middle-click, which is very handy many times.
(for instance this one does not have that issue, yet it looks horrible in my terminal)
I doubt that it is possible, since mouse selection and conceal-like things are orthogonal to each other.
You can either try to setup proper colors in
nathanaelkane/vim-indent-guides. It’ll work properly with mouse selection, since it doesn’t change text, only colouring, and colours are not copied in mouse buffer.
Or you can set hotkey to toggle lines on and off and switch them back and forth when you need to copy text.
This question is tangential to the topic, but have you tried iron.nvim? It has embedded support of REPL, so there is no need to copy text to another window. Or alternatively vim-slime. I am using both and I never had a need to copy paste code somewhere.
Yes, I have vim-slime installed and use it some times. But I could not naturalize it enough to not get distracted by yet another command… I will try to setup the colors of that plugin.
I am using
iron.nvim and have these hotkeys:
vmap <F2> <Plug>(iron-visual-send)
nmap <F2> <Plug>(iron-send-line)
nnoremap <leader>is :IronRepl<CR>
nnoremap <leader>ir :IronRestart<CR><C-w>p<C-W>L<C-w>p
\is I can start new julia REPL and with
F2 send either line or visual selection to REPL. It is very convenient, I even made small ascii video about it: untitled - asciinema
This is easy to setup and easy to use. No need for IDE anymore
Indeed, with vim-slime and gnu-screen (which are the things I’m used to) I can do something like that. I guess I can use it more often now and disable the identation lines when needed (customizing the colors of the other plugin to something I like I noticed that will take me one day of work… so I will leave that option for now).