Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move to last instance of a given character in the line in vim?

Tags:

vim

Is there a quick way to move to the last instance of a given character in the current line? For example, go to the last close paren in the line. I don't want to type f) fifteen times to go there, and using / isn't restricted to the current line (I'm writing in Scheme).

like image 635
Anomaly Avatar asked Dec 16 '15 15:12

Anomaly


People also ask

How do I go to a specific character in Vim?

You can type f<character> to put the cursor on the next character and F<character> for the previous one. You can also use ; to repeat the operation and use , to repeat it in opposite direction.

How do I go back to the last line in Vim?

Example. To jump back to line # 300 or previous position press CTRL-O (press and hold Ctrl key and press letter O). To jump back forwards press CTRL-I (press and hold Ctrl key and press letter I).

How do I go to previous in Vim?

Press Ctrl-O to jump back to the previous (older) location. Press Ctrl-I (same as Tab) to jump forward to the next (newer) location.


1 Answers

Just do:

$F)
  • $ to jump to the end of the line,
  • F) to jump to the first ) backward.
like image 175
romainl Avatar answered Oct 13 '22 01:10

romainl