molirr.weebly.com
Open in
urlscan Pro
74.115.51.9
Public Scan
URL:
https://molirr.weebly.com/blog/vim-gotofile
Submission: On October 27 via api from US — Scanned from US
Submission: On October 27 via api from US — Scanned from US
Form analysis
0 forms found in the DOMText Content
molirr * Blog VIM GOTOFILE 3/11/2023 0 Comments If you are interested in learning more than just the Vim Basics, I highly recommend using this program by Jovica Ilic. This article covers how you can move your cursor to a specific line in the Vim editor. It is case-sensitive, so make sure they are in lowercase. Then you make some edits and want to move to the first line how do you do that? To do that, press the 'gg' combination. To jump back to the first line of the file, you can use either one of the following commands: 1G This command tells vim to move the cursor to line 1, as specified in the command. Since these are Vim commands, make sure that you are in Normal mode (use Esc key) before pressing any keys. If you want to move to the last line of a text file in Vim, the 'G' key will move the cursor to the last line in the file.īy default, when you open a file in Vim, the cursor will be on the first line. There are several ways you can jump to the first line in Vim. Several keyboard shortcuts are used for navigation. Besides undo with as many levels as you like, Vim also offers storing the undo information in a file. A feature I enjoy using myself is not known to many users, as I found out last weekend. The same can be done by using the 'gg' instead of 'G'. The last news item on vim.org talks about using the undofile to save your history and undo changes even after a reboot. Press the 'Enter' key and voila, you are on the 30th line of that file. So I will type the line number that I want to go to, '30', and follow it with a single uppercase 'G'. Let's say that I want to move my cursor to line 30. Please make sure you are either in Visual or Normal mode. What matters is the line number of the line that you want to move your cursor to. In this method, the line that your cursor is on does not matter. In an instance where you have a sure/faint idea of what is on line 'x', there are 2 ways you can move your cursor to line 'x'. If you press the 'j' key after typing a number 'x' (in normal mode), the cursor will move 'x' lines down. Now, type any number In our case, we want to move our cursor up by 10 lines, so type '10' and then press the 'k' key. Make sure that you are in Normal mode you can do that by pressing the Escape (Esc) Key. Move the cursor relatively to the line you are onĪssume that you are on line 54 and you want to move the cursor up 10 lines here is how you can achieve that. If you already have a file opened for editing and you have enabled line numbers in Vim, you can try one of the following ways of moving the cursor up or down. If you know the total number of lines in a particular file, you can specify a number that is greater than the number of lines in a file while opening the file in Vim and the cursor will be at the bottom-most line. vim +5 foo.rsĪs you can see in the video, the 'main.rs' file opened with the cursor at line 30 instead of line 1. Simply type 'vim', with a line number specified after '+' sign and followed by the filename. You can make Vim open a file with your cursor at a particular line. Whenever you open a file in Vim, the cursor will be on line 1. When you blaze through your work in Vim efficiently, you will feel higher than anyone.īut for that to happen, you need to master the navigation in Vim. Vim is a powerful editor that, at worst, will only feel fast. 0 Comments LEAVE A REPLY. AUTHOR Write something about yourself. No need to be fancy, just an overview. ARCHIVES March 2023 CATEGORIES All RSS Feed * Blog Powered by Create your own unique website with customizable templates. Get Started