Hacker News new | ask | show | jobs
by otikik 2769 days ago
I have been using Vim for several years now and I still struggle with basic-level movement commands. Like, I never remember if f-h will move me to |hello or to h|ello. If those are working for you, that is great, but I appreciate some alternatives there. The usual Vim approaches ("do vimtutor!" or "practice one new command a week!") are not working for me.
1 comments

> I never remember if f-h will move me to |hello or to h|ello.

…Isn't the answer "neither"?

If the cursor is somewhere before that `h`, then doing `fh` will put the cursor on that `h`. If you want to enter insert mode before that `h`, you would press `i`, or `a` to enter insert mode after the `h`.

You are probably right. Which is my point. Vim movement commands remain unintuitive to me, even after using the thing for years.
It’s extremely intuitive to me. It’s more like muscle memory than logical thinking, I think you might be thinking too analytically.
If it works for you, that is great. It doesn't work for me.
That's half-right, I think. The question is, when using a command like "change until" or "change forward", i.e. 'ct' or 'cf', what will the effect be?

In the case of 'ct', you're going to delete up until the letter, whereas in 'cf', it will include the letter you're targetting.

It's definitely exactly right, but I tried to word it in a way which didn't make me look like a know-it-all.

> The question is, when using a command like "change until" or "change forward", i.e. 'ct' or 'cf', what will the effect be?

Is this a question? You answered it accurately. The behaviour is consistent here too, though the mnemonics people often use don't always make total sense.

> "change forward" [...] 'cf'

"change find", you mean.

Interesting! I'd always thought of it as "f"orward.

Is there any official reference to it standing for find? Googling has found a few unofficial references, but help doesn't appear to say either way.

In vim's usr_03.txt manual file, it says:

> One of the most useful movement commands is the single-character search command. The command "fx" searches forward in the line for the single character x. Hint: "f" stands for "Find".

That seems official.

Interesting. I always tend to think cursor is on top of character, not before or after it.