7 ms·
A thing that nobody ever seems to mention which unsettles me far more than learning key commands or modal behaviour in my brief tryouts with Vim is how its curs
by CmdrKrool 15y ago
A thing that nobody ever seems to mention which unsettles me far more than learning key commands or modal behaviour in my brief tryouts with Vim is how its cursor visually highlights a current character rather than a point between characters like every other editor I've ever used.
Say I have a line as follows:
abcdef
In other editors:
to delete "abc" from the left:
put the cursor on the a
C-d C-d C-d
to delete "abc" from the right:
put the cursor on the character after the c (the d)
C-h C-h C-h
to delete "def" from the left:
put the cursor on the d
C-d C-d C-d
to delete "def" from the right:
put the cursor on the character after the f (the EOL)
C-h C-h C-h
Symmetrical and consistent, to my mind.
In Vim:
to delete "abc" from the left:
put the cursor before the a
xxx
to delete "abc" from the right:
put the cursor on the character after the c (the d)
XXX
to delete "def" from the left:
put the cursor on the d
xxx
to delete "def" from the right:
put the cursor on the f
xxx
The last case there is exceptional. It's a small thing, but not being able to put the cursor on a real or virtual 'end-of-line' character in Vim makes me feel constricted.
I think that the between chars cursor model is simpler because you then have two choices: act on the preceding chars (thus, delete with C-h or <Backspace>) or act on the succeeding chars (thus, delete with C-d or <Delete>). By contrast Vim is more complicated because from the current character you have three choices: act on the preceding chars (thus, delete with X), act on the current char (thus, delete with x), and the principle of 'completeness' suggests a third: act on the succeeding chars - which AFAIK is not available in Vim and so it feels lop-sided to me.
Ironically I think that it's my 'programmer head' which makes the between chars model appeal to me more, as I think of the file as a bunch of bytes (well, maybe multibyte characters) and the text editor as a glorified hex editor, and I just want to choose a position and insert or delete chars regardless of whether they're alphanumeric, LFs, or whatever. Whereas Vim's model of manipulating words, lines and sentences suggests to me a fit with people writing in human languages. Why, non-geeks should love Vim, perhaps except for all the key commands to learn; one imagines an alternate universe where the common keyboard evolved with two Return keys instead of one, labelled "Open new line above" and "Open new line below", and other Vim-inspired niceties - and I wonder whether your archetypal 'grandmother' might find it easier to write letters on the computer in that world than her current futzing about in Microsoft Word.
- num1 15y agoI think from a programmer standpoint, I'd prefer to deal with the text directly instead of with some abstract space between characters. I see your point though, it is different. It does take a little getting used to, but if you slowly teach yourself the motions you'll learn it unconsciously. As for your example, you're running into this problem because you are manually placing your cursor. If you watch someone who uses vim, they almost never use the keys hjkl, or even x. When you type w to get to the next word, or when you search for something, the cursor will be conveniently placed for whatever kind of deletion you plan on doing. x is for deleting one character, if you ever want to delete more, you move to where you want to start, then use a motion and delete. For more precise control enter visual mode and delete. But never hit x three times in a row and stop to think about whether the cursor is going to shift left or right after the first x. Vim does have a concept of words, sentences, and paragraphs, but that's because it's not a programming editor, it's a text editor. It also has a concept of lines, braces, parens, and angle brackets. That's because programming is a common text editing exercise :)
- nokcha 15y agoAre you using vim from inside a terminal? If you use the graphical version of vim (gvim), the "between two characters" cursor is used in Insert mode and the "highlight the current character" cursor is used in so-called "Normal" mode. (In a terminal-based vim's Insert mode, visually the cursor highlight a single character, but it acts as if it were between the highlighted character and the character to the its left.)
- losvedir 15y agoYes! I know what you mean and it annoys me sometimes, too. Particularly: 1) Hitting escape pops you out and left. So insert - escape - insert - escape, etc, gradually moves the cursor left. This feels weird to me. Everyone calls it "insert mode", but perhaps it would be better called "append" mode, because append is the exact opposite of command mode, in the sense that a - ESC - a - ESC, etc, leaves you in place. 2) It makes it annoying to delete the last n words I typed. I want to go, "oh, mistake! ESC db..." but that leaves the last letter hanging around. I recently realized you can do "ESC daw...", at least.
- 15y ago