Is there a short cut for going back to the beginning of a file by vi editor?
When reading a long file by vi editor, it would be very nice to get back to the beginning of the file by some short cuts when you really need to do so. Even ctrl+B sometimes is too slow. Does anyone know such a tool?
After opening a file using vi
1) You can press Shift + g to go the end of the file
and
2) Press g twice to go to the beginning of the file
NOTE : - g is case-sensitive (Thanks to @Ben for pointing it out)
using :<line number>
you can navigate to any line, thus :1
takes you to the first line.
Key in 1G
and it will take you to the beginning of the file. Converserly, G
will take you to the end of the file.
- Shift + g ---> Go to the bottom of the file.
- gg ---> Go to the top of the file.
Well, you have [[
and ]]
to go to the start and end of file. This works in vi.
To go end of the file: press ESC
1) type capital G (Capital G)
2) press shift + g (small g)
To go top of the file there are the following ways: press ESC
1) press 1G (Capital G)
2) press gg (small g) or 1gg
3) You can jump to the particular line number,e.g wanted to go 1 line number, press 1G
:1 will take you to first line
Typing in 0%
takes you to the beginning.
100%
takes you to the end.
50%
takes you half way.
'Nice programing' 카테고리의 다른 글
jQuery의 숫자에 쉼표 추가 (0) | 2020.09.25 |
---|---|
uitableview의 업데이트 시작, 업데이트 종료 블록에서 애니메이션을 원하지 않습니까? (0) | 2020.09.25 |
Visitor pattern's purpose with examples [duplicate] (0) | 2020.09.25 |
how to delete the content of text file without deleting itself (0) | 2020.09.25 |
How to enter ssh password using bash? [duplicate] (0) | 2020.09.25 |