If I want to go to the next , on the line then I type t,. If I wanted to go to the previous , I could use /n, enter, N but this is a bit of a fiddle. What is the best way to go to reverse the t command and go to the previous ,?
2 Answers
You can just use T, and F, instead of t, and f,. The lowercase commands go forward; the uppercase ones go backwards.
Example:
foo, b|ar, baz
With the cursor on the first a, t, would move forward to r (the character before the next comma). Now if you use T, you will go backwards to the character after the previous comma (i.e. the space after foo,).
f and F do the same except they go to the specified character and not the character before/after it.
Also note you can use the ; and , commands to repeat the last f, F, t or T command either in a forward of backwards direction.
For more on this read :help f.
- 1,991
- 1
- 18
- 28
Just scroll down one paragraph in the help from :help t to find T, which moves
Till after [count]'th occurrence of {char} to the left.
See also :help F which is to f what T is to t.
You can repeat the fFtT motions with ; and also repeat in reverse direction with ,, so if you are already moving forward through the ,s on the line with t, and ; to repeat, then want to move back, just hit , to repeat the t motion as if it was a T motion.
- 3,489
- 1
- 14
- 19