Problem with pressing e key in vim
迷茫
迷茫 2017-05-16 16:40:12
0
1
775

When I used vimtutor to learn vim, I came to this section, as shown below. I found that when I pressed the e key, it did not jump to the end of the word, but to the second letter from the last letter of the word. Is this different from what it says above?

ps: After pressing i to enter insert mode, pressing esc again will jump forward one letter. But most people won’t use it this way, and I just happened to test it. But pressing e above cannot get to the end of the word, which bothers me. Is this the case for everyone? (My testing colleague’s vim under ubuntu has the same situation as me)

environment

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 19 2014 14:10:23)
Contains patches: 1-525
Compiled by Arch Linux
Jumbo version with GTK2 graphical interface.

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(1)
小葫芦

e The key performance should be correct. The reason for this situation is probably due to the appearance of your cursor~
Normally, the cursor will highlight the last word at this time:

Not just why your cursor is a vertical line in normal mode. But the position should be correct, because if you press i to enter editing mode, the cursor will be inserted before the last letter.


The performance in

ps is also normal. If you are not used to it, you can use a instead of i, so that the cursor will be inserted after the current letter, and pressing esc will return to the original position.


The question is so true...
We know that vim has many modes. In normal mode, the cursor is located on a character, and in insert mode, the cursor is located on the left or right of a character. The cursor will definitely move when switching modes. When moving from normal to insert, i can be moved to the left and a can be moved to the right. When insert goes to normal, it basically only passes esc. For simplicity, you can only choose between moving left and moving right.
Generally speaking, the most common situation for switching to normal mode is when you have finished inputting a paragraph of text. At this time, the cursor is at the end of the line, and it is obviously more reasonable to move to the left.
Source
If you don’t like this, you can add: .vimrc inside

inoremap <silent> <Esc> <C-O>:stopinsert<CR>

Prevent escape from moving the cursor one character to the left

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template