I would like to yank -
I would also like to paste it to my system clipboard so i will use '+' register for this.
can you suggest me possible way to do this?
Press y to copy, or d to cut the selection. Move the cursor to the location where you want to paste the contents. Press P to paste the contents before the cursor, or p to paste it after the cursor.
How to Copy to System's Clipboard. In Vim, you can copy, cut, and paste texts using the yank commands provided by the y, d, and p keys, respectively. However, by default, vim will store the copied text into an internal register called the unnamed register.
If you are trying to yank c:\foo\bar\file.txt:94
when you are on line 94 of c:\foo\bar\file.txt
you can use the following statement to set the +
register to<file_path>:<line_number>
:let @+=expand("%") . ':' . line(".")
expand("%")
- is the current file nameline(".")
- is the current line number
An example mapping is
nnoremap <leader>y :let @+=expand("%") . ':' . line(".")<CR>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With