I was recently watching a more advanced vim tutorial on youtube. One of the commands used was
_f. This was actually just part of a longer macro being demonstrated and the underscore wasn't commented on.
Using the letter e as an example: I tried it on a long line of text and there is indeed a difference between
_fe but I can't understand what is happening.
_fe doesn't go to the first, second, or last occurrence of e on the line.
_f doing? Bonus points for why is it doing it!
EDIT to add example
The following is a single line of random text. With my curser at the beginning of the line
fe arrives at the first e, which I have highlighted and demarcated.
2:5 Now no shrub of th
**e** field had yet grown on the earth, and no plant of the field had yet sprouted, for the Lord God had not caused it to rain on the earth, and there was no man to cultivate the ground. 2:6 Springs would well up from the earth and water the whole surface of the ground. 2:7 The Lord God formed the man from the soil of the ground and breathed into his nostrils the breath of life, and the man became a living being.
However if I use
_fe it skips over the first two instances of e and lands in the third instance.
2:5 Now no shrub of the field had y
**e**t grown on the earth, and no plant of the field had yet sprouted, for the Lord God had not caused ...
I have tried it with other letters, with the similar result of not hitting the first occurrence of that letter.
vim -u NONEand put your paragraph in (as a single long line) as the only line in a document, wherever I start the cursor off at
_fetakes me to the first e. Can you confirm that skipping to the third e is the case when you start with
-u NONEyields the expected result for
_fe. I assume that means there is something in my
.vimrcfile causing the issue.
:verbose map _to get an idea of where that mapping might be.
nnoremap _ 3on line 185 of my
.vimrc. (The reason for this is that I use vim for both Thai and English and when in the Thai keyboard the "3" key produces an underscore. I've fixed the mapping usingLeader` and we are good to go until the next conflict!) `