Vim拉线范围 [英] Vim yanking range of lines
问题描述
我是C#开发人员,最近刚刚决定扩大我对可用工具的了解.我决定学习的第一个工具是Vi/Vim.到目前为止,一切进展顺利,但是有几个问题似乎无法找到答案:
I'm a C# developer who has just recently decided to expand my knowledge of the tools available to me. The first tool I've decided to learn is Vi/Vim. Everything has been going well so far, but there are a couple of questions I can't seem to find the answer to:
-
可以说我想拉一些行.我知道这样做的方法很多,但我想按行号进行.我认为这与替代命令的工作方式类似,例如
81,91y
.有办法吗?
我对普通模式下的g
命令有些困惑.它似乎做很多事情,但我无法真正确定g命令的核心功能.我对它是运动命令还是通过常规模式运行的其他命令全部捕获"感到困惑.有人可以解释一下还是给我指出一个可以很好地解释g
命令的参考文献?
I'm a little confused about the g
command in normal mode. It seems to do a myriad of things and I can't really determine what the g command does at its core. I'm confused on whether or not it's a motion command or a kind of "catch all" for other commands ran through normal mode. Can someone please explain this or point me to a reference that gives a good explanation of the g
command?
推荐答案
Y行81-91
:81,91y<enter>
如果您的手指不喜欢找到:
和,
键,也可以使用(转到第81行,拉11行)
If your fingers don't like to find the :
and ,
keys, this would work as well (go to line 81, yank 11 lines)
81gg11yy
我对g
的唯一使用是5gg
.转到第五行. 22gg
:第22行.正如金宝所说,它实际上只是其他一些命令的修饰符.
My only use of g
is 5gg
. To go to the 5th line. 22gg
: 22nd line. As jimbo said, it's really only a modifier for some other commands.
出于完整性考虑,( http://vim.wikia.com/wiki/Power_of_g )解释了g
在命令模式下的工作原理.
For completeness, (http://vim.wikia.com/wiki/Power_of_g) explains a lot of how g
works in command mode.
这篇关于Vim拉线范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!