Open In App

Vim – Go to End of File

Last Updated : 01 Apr, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

In this article you will get to know many ways to go to the end of any file opened using Vim (Vi Improved) which is a open source text editor. You will get to know what vim is and many shortcuts and key combinations in the entire article to navigate to the end of the file and after that, you can decide which is best suitable for you and which will make your workflow fast.

What is Vim?

Vim which stands for Vi Improved is an open source text editor developed by Bram Moolenaar. It is the improved version of the Vi editor which was developed by Bill Joy and thus got its name Vi Improved (Vim). It comes default installed by mostly with every UNIX system. Vim is a highly efficient and fast editor with a very small size, which current version is just 7kb in size and is suitable for complex editing tasks. It supports many programming languages. It is also highly customizable as you can add extra features to it by using many plugins and extensions.

How to Go to the End of File in Vim Editor?

The End of File can be interpreted in 2 ways –

Note: Please check that you are in normal mode , if not the first press ‘Esc‘ key to be in normal mode to run commands

1. Last Line with Cursor at the Beginning

begin

Cursor at start of file’s end

• Shift + g ➨ If you are in normal mode then press ‘Shift + g’ , or if you are in Insert mode then press ‘Esc + Shift + g’. The ‘Esc‘ key exits you from the insert mode and shift is used to capitalize the letter ‘g‘.

Shift + g

• G (with Caps Lock on) ➨ If you have your Caps Lock ON, then simply press the ‘G’ key or if in insert mode then exit by pressing ‘Esc‘ then press G key – ‘Esc + G’

Caps Lock ON + G

• :$ ➨ First press Esc to ensure be in normal mode the type ‘:$’ and then hit enter.

:$ + Enter

screenshot-3699dac9

:$ + Enter

• ]] (Double Square Brackets) ➨ First ensure to be in normal mode the press ‘]]’ (square brackets twice).

]]

2. Last Line with Cursor at the End

last

Cursor at end of file’s end line

• Shift + (g + $) ➨ Hold the ‘Shift’ key and then press ‘g’ and then ‘$’ . ‘Shift + g’ will move you to the last line as you have seen in above cases , and the ‘Shift + $’ will move your cursor to the end of the line.

SHIFT + g + $

• G + Shift + $ (with Caps Lock on) ➨ If your Caps Lock is on the only press ‘G’ and then press ‘Shift‘ and ‘$’ .

Caps Lock ON + G + SHIFT +$

• Ctrl + End (if supported) ➨ Press ‘Control’ and ‘End’ key at the same time, if your keyboard have Ctrl key.

Ctrl + End

• Shift + (g + a) ➨ Hold the ‘Shift‘ key and then press ‘g‘ and then ‘a‘ . ‘Shift + g‘ will move you to the last line as you have seen in above cases , and the ‘ Shift + a‘ will move your cursor to the end of the line with enabling the insert mode. Normally ‘Shift + a’ is used to go in insert mode with moving to the end of the line.

SHIFT + g + a

• G + A (with Caps Lock on) ➨ If your Caps Lock is on the only press ‘G’ and ‘A’ .

Caps Lock + G + A

• } (Curly Bracket) ➨ You have to press the Curly Bracket ‘ } ‘, to use curly bracket you have to press the ‘Shift + ]’ ( the key that have both } and ] icon)

}

Vim Go to End of File -FAQs

What is Vim?

Vim stands for Vi Improved is a open source text editor developed by Bram Moolenaar which is the improved version of Vi editor. It is very famous editor, mainly comes installed by default in UNIX systems.

Is Vim available for using on CLI only ?

No, Vim also have a Graphical User Interface know as gvim. You can download it from the Vim’s Official site : https://www.vim.org/download.php

Is there any specific shortcut/command which are most used by developers?

Yes, the Shift + G and : + $ are most widely used by the developers all around the world for navigate to the end of the file.

What are some alternatives to vim ?

Some famous alternatives to vim are VS Code, Sublime, Emacs, nano, Atom etc.

Is Vim difficult to learn?

We can say that Vim has a large learning curve due to its vast and unique features and set of unique commands. So yes, it is difficult than other editors and will take time and practice to be proficient in using it.

Conclusion

Now you know many ways and key combinations to reach to the end of your file in Vim editor. You need to choose one for navigating the vim file in order to be productive and for fast working. And remember to be in normal mode always to use keys combinations and shortcuts.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads