在vim(和vi)中,如果我处于命令模式并且我键入[[
它似乎会转到文件的开头,如果我键入]]
它似乎会转到文件的末尾。但我认为这是文件命令gg
的开始/结束,G
所以做一些不同的事情? [[
]]
我的猜测是,[[
并且]]
会转到下一个实例,但我不知道是什么。
尝试:help ]]
:
]]
[count] 节向前或到第一列中的下一个“{”。
延伸阅读::help section
。
专业提示:了解如何查找命令和导航内置:help
; 它很全面,并提供了许多提示。你不会像其他编辑器那样快速学习 Vim,但如果你致力于持续学习,它将证明是一个非常强大和高效的编辑器。
我从来没有发现默认行为[[
和]]
有用的直到我看到这个提示:help section
If your '{' or '}' are not in the first column, and you would like to use "[["
and "]]" anyway, try these mappings:
:map [[ ?{<CR>w99[{
:map ][ /}<CR>b99]}
:map ]] j0[[%/{<CR>
:map [] k$][%?}<CR>
从:help [[
,
[[ [count] sections backward or to the previous '{' in
the first column. |exclusive|
Note that |exclusive-linewise| often applies.
AFAIK,
[[ : jump to function start
]] : jump to function end
编辑:我还找到了一份备忘单,其中定义了:
( [count] : sentences backward
) [count] : sentences forward
{ [count] : paragraphs backward
} [count] : paragraphs forward
]] [count] : sections forward or to the next '{' in the first column. When used after an operator, then the '}' in the first column.
][ [count] : sections forward or to the next '}' in the first column
[[ [count] : sections backward or to the previous '{' in the first column
]] [count] : sections backward or to the previous '}' in the first column