tags:

views:

4902

answers:

11

I am somewhat clumsy in my vi knowledge. I know how to generally move around in command mode, specifically, jumping to lines, etc. But what is the command to jump to the end of the line that I am currently on?

+1  A: 

The dollar sign: $

David Singer
+23  A: 

Just the $ key. You can use 'A' to move to the end of the line and switch to editing mode.

dvorak
Thanks , I'm looking for this :)
nXqd
+1  A: 

per this: Press A to enter edit mode starting at the end of the line.

brian
+11  A: 
$

Checkout this VIM cheat sheet

Terrapin
Why use a cheat sheet? I know all commands by heart.AaBbCcDdEeFfGgHhIiJjKkLl... :-)
Ludvig A Norin
+2  A: 

Or there's the obvious answer: use the 'End' key to go to the end of the line.

davr
+2  A: 

The advantage of the 'End' key is it works in both normal and insert modes.

'$' works in normal/command mode only but it also works in the classic vi editor (good to know when vim is not available).

Diastrophism
What's you hanging around insert mode for ?! No ordinary decent citizen goes there after daylight. You know what happens in there, don't you ? Code disappears there, y'know ? It disappears, and is never heard from again.
ldigas
+8  A: 

As lots of people have said:

  • $ - gets you to the end of the line

but also:

  • ^ - gets you to the first non-whitespace character in the line, and
  • 0 (zero) - gets you to the beginning of the line incl. whitespace
Rob Wells
+5  A: 

If your current line wraps around the visible screen onto the next line, you can use g$ to get to the end of the screen line.

Commodore Jaeger
A: 

Possibly unrelated, but if you want to start a new line after the current line, you can use o anywhere in the line.

graywh
A: 

'$' jumps to the end of the line and selects the last non-whitespace character 'A' jumps to the last whitespace character

D C
A: 
  • $ moves to the last character on the line.
  • g _ goes to the last non-whitespace character.
Paul Ruane