Vim - naviga tra i paragrafi (con linee vuote)


10

Ci sono comandi integrati in VIM che passano alle righe vuote successive / precedenti?


9
{ed }è quello che vuoi.
cuonglm

^ sopra commento più al punto per la domanda.
Brain90,

se scopri che non si fermano su quelle che sembrano linee vuote è probabilmente perché hanno degli spazi bianchi su di esse. Puoi rimuovere usando un sostituto come questo::%s/^\s\+$//
JonnyRaa,

Risposte:


10

Andando alla guida sulla navigazione ( :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 motionssembra essere il candidato più probabile (o sarebbe Jumps?). Sposta in object-motionse premi <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.

Bingo!


Il sistema di testo di aiuto di Vim ( :help) è uno dei migliori documenti online (come "all'interno del programma") che ho incontrato.
Kusalananda

4

Uso successivo della riga vuota (parentesi graffa destra):

}

Uso precedente di una riga vuota (parentesi graffa sinistra):

{

Digitare quanto sopra in modalità comando

Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.