Home Explore Blog CI



neovim

4th chunk of `runtime/doc/usr_03.txt`
8295421fcad92230a35f690a396752943f5f77504632da6e0000000100000fa1
 of the way through
    the file and the column of the cursor.
       Sometimes you will see a split column number.  For example, "col 2-9".
    This indicates that the cursor is positioned on the second character, but
    because character one is a tab, occupying eight spaces worth of columns,
    the screen column is 9.

2.  Set the 'number' option.  This will display a line number in front of
    every line: >

	:set number
<
    To switch this off again: >

	:set nonumber
<
    Since 'number' is a boolean option, prepending "no" to its name has the
    effect of switching it off.  A boolean option has only these two values,
    it is either on or off.
       Vim has many options.  Besides the boolean ones there are options with
    a numerical value and string options.  You will see examples of this where
    they are used.

3.  Set the 'ruler' option.  This will display the cursor position in the
    lower right corner of the Vim window: >

	:set ruler

Using the 'ruler' option has the advantage that it doesn't take much room,
thus there is more space for your text.

==============================================================================
*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.  To
scroll backwards, use CTRL-B.  These should be easy to remember: F for
Forwards and B for Backwards.

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.

	+------------------+		 +------------------+
	| earlier text	   |		 | earlier text	    |
	| earlier text	   |		 | earlier text	    |
	| earlier text	   |		 | earlier text	    |
	| earlier text	   |   zz  -->	 | line with cursor |
	| earlier text	   |		 | later text	    |
	| earlier text	   |		 | later text	    |
	| line with cursor |		 | later 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.

==============================================================================
*03.8*	Simple searches

To search for a string, use the "/string" command.  To find the word include,
for example, use the command: >

	/include

You will notice that when you type the "/" the cursor jumps to the last line
of the Vim window, like with colon commands.  That is where you type the word.
You can press the backspace key (backarrow or <BS>) to make corrections.  Use
the <Left> and <Right> cursor keys when necessary.
   Pressing <Enter> executes the command.

	Note:
	The characters .*[]^%/\?~$ have special meanings.  If you want to use
	them in a search you

Title: Vim: Displaying Cursor Position and Scrolling Through Text
Summary
This section explains how to display cursor position information using CTRL-G and how to show line numbers with the ':set number' option. It also details how to use the ':set ruler' option to show cursor position in the lower right corner. Furthermore, the section covers scrolling commands like CTRL-U (up), CTRL-D (down), CTRL-E (scroll up one line), CTRL-Y (scroll down one line), CTRL-F (forward one screen), CTRL-B (backward one screen), "zz" (center the cursor line), "zt" (cursor line at the top), and "zb" (cursor line at the bottom) for navigation, as well as searching using the "/string" command.