vim - Scrolling around

vim - Scrolling around

請自己記住

很基本,但常常忘記,都浪費很多時間up/down

應該用 CTRL+E / CTRL+Y 取代 或是 zz 也不錯!

自勉之...

http://vimdoc.sourceforge.net/htmldoc/usr_03.html

*03.7* Scrolling around

The CTRL-U command scrolls down half a screen of text. Think of looking

through a viewing window at the text and moving this window up by half the

height of the window. Thus the window moves up over the text, which is

backward in the file. Don't worry if you have a little trouble remembering

which end is up. Most users have the same problem.

The CTRL-D command moves the viewing window down half a screen in the file,

thus scrolls the text up half a screen.

+----------------+

| some text |

| some text |

| some text |

+---------------+ | some text |

| some text | CTRL-U --> | |

| | | 123456 |

| 123456 | +----------------+

| 7890 |

| | +----------------+

| example | CTRL-D --> | 7890 |

+---------------+ | |

| example |

| example |

| example |

| example |

+----------------+

To scroll one line at a time use CTRL-E (scroll up) and CTRL-Y (scroll down).

Think of CTRL-E to give you one line Extra. (If you use MS-Windows compatible

key mappings CTRL-Y will redo a change instead of scroll.)

To scroll forward by a whole screen (except for two lines) use CTRL-F. The

other way is backward, CTRL-B is the command to use. Fortunately CTRL-F is

Forward and CTRL-B is Backward, that's easy to remember.

A common issue is that after moving down many lines with "j" your cursor is at

the bottom of the screen. You would like to see the context of the line with

the cursor. That's done with the "zz" command.

+------------------+ +------------------+

| some text | | some text |

| some text | | some text |

| some text | | some text |

| some text | zz --> | line with cursor |

| some text | | some text |

| some text | | some text |

| line with cursor | | some text |

+------------------+ +------------------+

The "zt" command puts the cursor line at the top, "zb" at the bottom. There

are a few more scrolling commands, see |Q_sc|. To always keep a few lines of

context around the cursor, use the 'scrolloff' option.

convert from Thomas blog post id 651 old convert log: ./093325/tag%3E2010%2003)

@2010 @03

Comments