I install YCM(You complete me), and when I coding, I found the command $ is not work right. It doesn't jump to the end of line, but the last one . For exampl, a line in a.cpp:
#include| <sys/socket.h>
now the cursor is after the include, then I type $, try jump to the end of line, but I get the following as a result:
#include <sys/socket.h|>
How can I do to make it work right?
CodePudding user response:
That is what $
does, it jumps onto the last character on the line. Then you can either press i
to insert text before this last character or a
to insert after.
I would recommend to have block cursor enabled in your terminal, it makes a
,i
more clear. At least for me.
It should not have anything to do with YCM or other plugins.
CodePudding user response:
It looks like your cursor shape is causing some confusion.
In normal mode, the cursor is on a character, not between two characters, which is pretty clear and obvious if your cursor shape is a "block":
With a "vertical bar" shape, the bar has to be on one side or the other of the character, usually the left side:
In both cases, the cursor actually ends up on the same character—the >
, as expected—but the "bar" cursor shape makes it harder than necessary to reason about the current cursor position.
If that's indeed the cause of the confusion, I would suggest setting your cursor shape to a "block", which makes a lot more sense in Vim.