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?
If you're already in vi, you can use the goto command. To do this, press Esc , type the line number, and then press Shift-g . If you press Esc and then Shift-g without specifying a line number, it will take you to the last line in the file.
Just pressing o then Esc whenever you need it isn't bad. This will just insert a new line above or below the current line.
Use CTRL + o while in insert mode to temporarily enter normal mode for the next command, and then $ to go to the end of the line (after which you will be returned to insert mode) Use ESC to return to normal mode, and then A which both moves the cursor to the end of the line and enters insert mode.
As lots of people have said:
but also:
Just the $ (dollar sign) key. You can use A to move to the end of the line and switch to editing mode (Append). To jump the last non-blank character, you can press g then _ keys.
The opposite of A is I (Insert mode at beginning of line), as an aside. Pressing just the ^ will place your cursor at the first non-white-space character of the line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With