Home Explore Blog CI



neovim

2nd chunk of `runtime/doc/usr_02.txt`
52b25fa4eb961b2623e601b7e18665847c81e1f0918534930000000100000fa2
 to stop Insert mode and go back to Normal mode.  You
now have two lines of text in your Vim window:
>
	+---------------------------------------+
	|A very intelligent turtle		|
	|Found programming Unix a hurdle	|
	|~					|
	|~					|
	|					|
	+---------------------------------------+
<

WHAT IS THE MODE?

To be able to see what mode you are in, type this command: >

	:set showmode

You will notice that when typing the colon Vim moves the cursor to the last
line of the window.  That's where you type colon commands (commands that start
with a colon).  Finish this command by pressing the <Enter> key (all commands
that start with a colon are finished this way).
   Now, if you type the "i" command Vim will display --INSERT-- at the bottom
of the window.  This indicates you are in Insert mode.
>
	+---------------------------------------+
	|A very intelligent turtle		|
	|Found programming Unix a hurdle	|
	|~					|
	|~					|
	|-- INSERT --				|
	+---------------------------------------+
<
If you press <Esc> to go back to Normal mode the last line will be made blank.


GETTING OUT OF TROUBLE

One of the problems for Vim novices is mode confusion, which is caused by
forgetting which mode you are in or by accidentally typing a command that
switches modes.  To get back to Normal mode, no matter what mode you are in,
press the <Esc> key.  Sometimes you have to press it twice.  If Vim beeps back
at you, you already are in Normal mode.

==============================================================================
*02.3*	Moving around

After you return to Normal mode, you can move around by using these keys:

	h   left						*hjkl*
	j   down
	k   up
	l   right

At first, it may appear that these commands were chosen at random.  After all,
who ever heard of using l for right?  But actually, there is a very good
reason for these choices: Moving the cursor is the most common thing you do in
an editor, and these keys are on the home row of your right hand.  In other
words, these commands are placed where you can type them the fastest
(especially when you type with ten fingers).

	Note:
	You can also move the cursor by using the arrow keys.  If you do,
	however, you greatly slow down your editing because to press the arrow
	keys, you must move your hand from the text keys to the arrow keys.
	Considering that you might be doing it hundreds of times an hour, this
	can take a significant amount of time.
	   Also, there are keyboards which do not have arrow keys, or which
	locate them in unusual places; therefore, knowing the use of the hjkl
	keys helps in those situations.

One way to remember these commands is that h is on the left, l is on the
right and j points down.  In a picture: >

		       k
		   h     l
		     j

The best way to learn these commands is by using them.  Use the "i" command to
insert some more lines of text.  Then use the hjkl keys to move around and
insert a word somewhere.  Don't forget to press <Esc> to go back to Normal
mode.  |:Tutor| is also a nice way to learn by doing.

For Japanese users, Hiroshi Iwatani suggested using this:

			Komsomolsk
			    ^
			    |
	   Huan Ho	<--- --->  Los Angeles
	(Yellow river)	    |
			    v
			  Java (the island, not the programming language)

==============================================================================
*02.4*	Deleting characters

To delete a character, move the cursor over it and type "x".  (This is a
throwback to the old days of the typewriter, when you deleted things by typing
xxxx over them.)  Move the cursor to the beginning of the first line, for
example, and type xxxxxxx (seven x's) to delete "A very ".  The result should
look like this:
>
	+---------------------------------------+
	|intelligent turtle			|
	|Found programming Unix a hurdle	|
	|~					|
	|~					|
	|					|
	+---------------------------------------+
<
Now you can insert new text, for example by typing: >

	iA young <Esc>

This begins an insert (the i), inserts the words "A young", and then exits
insert

Title: Navigating Modes and Basic Movement & Deletion in Vim
Summary
This section covers handling mode confusion in Vim by using the Esc key to return to Normal mode. It then introduces basic cursor movement using the 'h', 'j', 'k', and 'l' keys for left, down, up, and right, respectively, emphasizing their placement on the home row for efficient typing. It also covers deleting characters using the 'x' command.