Is is possible to search for a regexp in only the current line.
Here is an example line:
This is some text that I have written. Can you find this word?
^
This line contains many t
's. I would like to search forward for this
so the cursor ends up at the caret (the ^
character).
The problem with using /
is that if the pattern does not match in the line the cursor will jump to another part of the buffer. I do not want that behavior. I want the search to stop if there is no match in the line.
I can of course search forward using ft
and press ;
repeatedly but if I were to record macro that would make the macro inconsistent when executed at different locations.
The most obvious solution would be :./this
but that did not work for me (it finds matches at other lines in the buffer). So it appears to me that Vim is lacking this feature.
Do you know of a way to do what I am describing?