Vim-在段落之间导航(通过空白行)


10

VIM中是否有内置命令可导航到下一个/上一个空白行?


9
{而且}是你想要的。
cuonglm 2015年

上面的^评论更多地指向了问题所在。
Brain90 '17

如果您发现它们没有停在看起来像空白行的地方,可能是因为它们上面有空格。您可以使用以下替代方法删除::%s/^\s\+$//
JonnyRaa

Answers:


10

转到导航帮助(:h navigation):

Cursor motions                                  cursor-motions navigation

These commands move the cursor position.  If the new position is off of the
screen, the screen is scrolled to show the cursor (see also 'scrolljump' and
'scrolloff' options).

1. Motions and operators        operator
2. Left-right motions           left-right-motions
3. Up-down motions              up-down-motions
4. Word motions                 word-motions
5. Text object motions          object-motions
6. Text object selection        object-select
7. Marks                        mark-motions
8. Jumps                        jump-motions
9. Various motions              various-motions

Text object motions似乎是最有可能的候选人(或Jumps?)。移至object-motions并按<c-]>Ctrl ]):

5. Text object motions                                  object-motions

                                                        (
(                       [count] sentences backward.  exclusive motion.

                                                        )
)                       [count] sentences forward.  exclusive motion.

                                                        {
{                       [count] paragraphs backward.  exclusive motion

                                                        }
}                       [count] paragraphs forward.  exclusive motion.

答对了!


Vim帮助文本系统(:help)是我遇到的最好的在线(在“程序内”)软件文件之一。
Kusalananda

4

下一个空白行的使用(右大括号):

}

先前的空白行用途(左花括号):

{

在命令模式下输入以上内容

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.