Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Vim, is there a way to copy the current line number into a buffer?

Tags:

vim

x11

When using gdb and Vim, often I want to stop on a particular line. Normally in Vim I copy-paste the line number showing on the rule area to the gdb session. It'd save me a lot of hassle if I could use something like "+<magic-incantation> to copy the line number of the current cursor position into the xclipboard buffer. Is this possible?

like image 564
richq Avatar asked Nov 17 '08 11:11

richq


1 Answers

put this in your vimrc

map ,n <Esc>:let @*=line(".")<CR>

then using ,n will copy the current line number into the clipboard

like image 69
Gowri Avatar answered Oct 27 '22 00:10

Gowri