在 Vim 中,有没有办法将当前行号复制到缓冲区中? [英] In Vim, is there a way to copy the current line number into a buffer?
本文介绍了在 Vim 中,有没有办法将当前行号复制到缓冲区中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在使用 gdb 和 Vim 时,我经常想停在特定的行上.通常在 Vim 中,我将规则区域上显示的行号复制粘贴到 gdb 会话中.如果我可以使用诸如 "+
之类的东西将当前光标位置的行号复制到 xclipboard 缓冲区中,我会省去很多麻烦.这可能吗?
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?
推荐答案
把它放到你的 vimrc 中
put this in your vimrc
map ,n <Esc>:let @*=line(".")<CR>
然后使用,n将当前行号复制到剪贴板
then using ,n will copy the current line number into the clipboard
这篇关于在 Vim 中,有没有办法将当前行号复制到缓冲区中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文