How do I jump to the beginning of line in vim?
Asked Answered
E

5

52

How do I go to the beginning of the line in vim editor in normal mode?

Is it possible to using my Home key on keyboard on Linux?

Explore answered 7/3, 2017 at 17:58 Comment(3)
I don't mean to be rude, but did you actually try to look it up on the Internet? Last time I checked, there were dozens of vi/vim tutorials and cheat sheets.Eurythermal
Given that StackOverflow is the premier q+a forum for programming and related questions, it makes a lot of sense to have this question, and some good answers, here. I found this page via a web search and picked it above others because I prefer the SO format to several of the other major Vim resources.Marymarya
The good thing to ask this kind of question is that later when a user search for this question (vim property) he first will see the stack overflow website in google list, but it's better to google before because it's faster to get the answer.Officinal
L
86

Press 0 to go to the beginning of a line, or ^ to go to the first non-blank character in a line.

Lura answered 7/3, 2017 at 18:1 Comment(0)
T
25

Assuming there is text in your file, while in normal mode:

  1. Press $(shift + 4) to go to end of a line
  2. Press ^(shift + 6) to go to beginning of a line
Tuppeny answered 28/2, 2022 at 23:36 Comment(2)
This question is nearly 5 years old and already has two answers, both of which already mention using ^ to go to the beginning of the line. The question doesn't ask about going to the end of the line. Please read How to Answer.Pyroxene
@Pyroxene I searched for (begin of line) and then I wondered about the end of line. So, this answer helped me.Rudich
C
10

Add this line to .vimrc

map <Home> 0

this maping or change key Home to 0

Jump to begining of actual line 0

Jumping to first characten but not white space in actual line ^.

Culley answered 9/3, 2017 at 10:31 Comment(1)
Here are more examples for remap vim.wikia.com/wiki/Disable_F1_built-in_help_keyZerelda
R
6

The other answers already say that you can move to the beginning of the line with 0 or ^.

However they do not mention that you can instead use capital I to directly enter INSERT mode at the beginning of the line, so you don't have to press 0 and then lowercase i seperately. The end-of-line equivalent is capital A.

Reputation answered 19/2 at 13:22 Comment(1)
I came looking for this exact question but searching for it was a bit finicky. Good to see thanks!Titrate
L
-1

Shift + Home -> Beginning of the line
Shift + End -> End of the line

Least answered 22/5 at 8:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.