在使用 Vim 时,在可视模式下,选择文本然后调用冒号命令会显示 : '<,'>
而不仅仅是 :
正如我在做其他事情(例如打开文件)时所显示的那样。
什么是'<,'>
什么意思?
使用 linux (debian)
, gnome-terminal
, vim7.2
最佳答案
这意味着您在:'<,'>
之后键入的命令将对您选择的文件部分进行操作。
例如,:'<,'>d
将删除选定的 block ,而 :d
删除光标下的行。
同样,:'<,'>w fragment.txt
会将选定的 block 写入名为 fragment.txt
的文件.
两个逗号分隔的东西('<
和'>
)是对应于所选区域的开始和结束的标记。从帮助页面 (:help '<
):
*'<* *`<*
'< `< To the first line or character of the last selected
Visual area in the current buffer. For block mode it
may also be the last character in the first line (to
be able to define the block). {not in Vi}.
*'>* *`>*
'> `> To the last line or character of the last selected
Visual area in the current buffer. For block mode it
may also be the first character of the last line (to
be able to define the block). Note that 'selection'
applies, the position may be just after the Visual
area. {not in Vi}.
以这种方式使用时,标记只是指定后面命令的范围(参见 :help range
)。它们当然可以与其他行号说明符混合和匹配。例如,以下命令将删除从所选区域开始到文件末尾的所有行:
:'<,$d
Vim Wiki 有 more information在 Vim 范围上。
关于linux - 使用 vim,什么是 "' < ,'>"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8898115/