在vim(和vi)中,如果我处于命令模式,并且输入[[
,它似乎转到文件的起始位置,如果输入]]
,它会显示到文件末尾。但我认为gg
和G
是文件命令的开始/结束,那么[[
和]]
做了什么不同?[[和]]在vim中做什么?
我的猜测是,[[
和]]
会去的东西下一个实例,但我想不出什么。
在vim(和vi)中,如果我处于命令模式,并且输入[[
,它似乎转到文件的起始位置,如果输入]]
,它会显示到文件末尾。但我认为gg
和G
是文件命令的开始/结束,那么[[
和]]
做了什么不同?[[和]]在vim中做什么?
我的猜测是,[[
和]]
会去的东西下一个实例,但我想不出什么。
尝试:help ]]
:
]]
[count]部分向前或到 第一列中的下一个'{'。
延伸阅读::help section
。
专业提示:了解如何查找命令并浏览内置的:help
;它是全面的,并提供许多技巧。你不会像其他编辑一样学习Vim,但如果你承诺不断学习,它将证明它是一个非常强大和高效的编辑器。
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
]没有跳转到FUNC结束 – Kent 2013-03-26 12:33:24
:help [[
从,
[[ [count] sections backward or to the previous '{' in
the first column. |exclusive|
Note that |exclusive-linewise| often applies.
我从来没有发现的[[
和]]
有用的默认行为,直到我看到这个提示从: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'。 – Tom 2013-03-26 11:55:51