VIM Shortcuts in Linux: An Easy Guide for High Productivity

Wanna pace up your productivity then follow this VIM Shortcuts in Linux guide for quick help.

Updated: 05 Mar, 23 by Susith Nonis 8 Min

List of content you will read in this article:

Vim is the most recent version of Vi Editor that supports text and graphical interfaces; also runs on any platform. The problem with learning Vim is, You should keep practicing and working on it. 
This guide will help you increase your productivity and chances of learning VIM by working with VIM Shortcuts. Let’s quickly move to the website and learn more about it.

Vim stands for "Vi IMproved." It is a Unix text editor with Linux, BSD, and macOS. It's known for being quick and powerful, thanks to its simple application that can operate in a terminal (although it has a graphical interface). 

It's mainly because it can be operated totally without the use of menus or a mouse. However, Vim is not how current computer users expect to edit text. Yet it's how Unix administrators worldwide update config files, changelogs, scripts, and more.

Features of Vim

  • It has a small memory footprint.
  • It's a command-based system. With just a few commands, you can complete difficult text-related activities.
  • It is very configurable and stores its settings in a simple text file.
  • There are numerous Vim plug-ins available. These plug-ins can greatly increase the usefulness of the program.
  • Multiple windows are supported. This function allows you to split your screen into numerous windows.
  • It has many tabs that allow you to work on multiple files simultaneously.
  • It has recording tools that allow you to record and play Vim commands repeatedly.

Because Vim's developers know how straightforward it is, they built vimtutor, a short, interactive explanation of the essentials. Although Vim has a lot of power, there are just a few controls you need to master to utilize it effectively. 

  • Start Vim by entering Vim in a terminal or running gvim on your desktop.
  • To enter input text mode, press I. You can only type text into your document while in insert mode. In insert mode, there are no commands.
  • Enter normal mode by pressing Esc, which is used for commands.
  • You can move your cursor with h (left), j (down), k (up), and l (left) in regular mode (right). It could be easier to remember that j is down if you visualize it as a Down arrow.
  • To exit Vim, type :wq to save your work :q! to discard any changes that haven't been saved.

Other than these fundamentals, all other Vim commands are arguably for convenience and efficiency.

Cursor Movements 

  1. h - moving the cursor to the left
  2. j - moving the cursor down
  3. k - moving the cursor up
  4. l - moving the cursor to the right right
  5. H - Jumping directly on the top of the screen
  6. M - Jumping in the middle of the screen
  7. L - Jumping directly to the bottom of the screen
  8. w - Jumping on the start of a written word
  9. e - Jumping toward the end of a written word
  10. Ctrl + e - Moving the screen down by one line without the use of a cursor
  11. Ctrl + y - Moving the screen up by one line without making use of the cursor
  12. Ctrl + b - Moving one fullscreen forward
  13. Ctrl + f - Moving one fullscreen backward
  14. Ctrl + d - Moving ½ fullscreen forward 
  15. Ctrl + u -  Moving ½ fullscreen backward

Insert mode - inserting/appending text

  1. i - Inserting before the cursor 
  2. I - inserting at the beginning of a line 
  3. a - inserting after the cursor
  4. A - inserting at the end of the line
  5. o - Opening new lines below the selected line
  6. O - Opening new lines above the selected line
  7. ea - inserting at the end of the selected word
  8. Ctrl + h - deleting characters before the cursor 
  9. Ctrl + w - deleting words before the cursor 
  10. Ctrl + j - Creating a new line while inserting a new mode
  11. Ctrl + t - Moving right with one line shift width
  12. Ctrl + d - Moving left with one line shift width
  13. Ctrl + ox - Quickly access normal mode for executing any normal mode command
  14. Esc - Exiting the insert mode 

Working with multiple files

  1. :e[dit] file - Editing files in new buffer
  2. :bn[ext] - Jumping to the next buffer
  3. :bp[revious] - Jumping back to the previous buffer 
  4. :bd[elete] - Deleting a buffer 
  5. :b[uffer]# - Hoping directly to a buffer through the index 
  6. :b[uffer] file - Hopping to a buffer through the file 
  7. Ctrl + ws - Splitting the Window
  8. Ctrl + wv - Vertical splitting of the Window 
  9. Ctrl + ww - Switching between the windows
  10. Ctrl + wq - Quitting Window
  11. Ctrl + wx - Exchanging the current Window with the next Window
  12. Ctrl + w= - Adjusting the height and width of all the Windows as the same
  13. Ctrl + wh - Jumping the cursor to the next Window
  14. Ctrl + wl - Jumping the cursor to the next Window
  15. Ctrl + wj - Jumping the cursor to the Window present below
  16. Ctrl + wk - Jumping the cursor to the Window present above 
  17. Ctrl + wH - Making selected Window expand to the full screen 
  18. Ctrl + wJ - Making selected Window expand to the full screen at the right bottom

Cut and paste

  1. yy - (Copy command) pull a single line
  2. 2yy - (Copy command) pull two lines
  3. yw - (Copy command) pull the characters of the words below the cursor to start the next position 
  4. yiw - (Copy command) Pull the words below the cursor 
  5. yaw - (Copy command) Pull the words selected with the cursor and add space 
  6. p - (paste command) paste from clipboard after the cursor position
  7. P - (paste command) paste from the clipboard before the cursor position
  8. gP - (paste command) paste content before cursor and leave cursor after newly added text
  9. dd - (cut command) deleting a line
  10. 2dd - (cut command) deleting two lines
  11. dw - (cut command) deleting the characters of the word selected from the cursor 
  12. diw - (cut command) deleting words selected through the cursor 
  13. D - (cut command) deleting text at the end of the selected line
  14. x - (cut command) deleting characters

Editing 

  1. r - replacing only one character 
  2. R - replacing more a single characters
  3. J - Joining below the line with the current one, along with adding one-line space between them 
  4. gJ - Joining below the line with the current one without adding any space 
  5. cc - Changing the entire line 
  6. C - Changing at the end of a line
  7. ciw - Replacing an entire word
  8. cw or ce - Replacing at the end of a word
  9. s - deleting characters along with substituting its text
  10. S - Deleting lines along with substituting their text
  11. xp - Trasposing 2 letters 
  12. u - Undo

Search and replace 

  1. /pattern - Quickly search patterns
  2. ?pattern - Quickly search backward for a pattern
  3. n - Repeating search in a similar direction 
  4. N - Repeating searches in different directions 
  5. :%s/old/new/g - Replacing old contents with the new ones all over the file
  6. :noh[lsearch] - Removing highlights from search matches 

If you want to know more about the VIM search command, check out this post,

Tabs

  1. :tabnew or :tabnew {page.words.file} - Opening a new file in a new tab
  2. Ctrl + wT - Moving the current split Window into an old tab
  3. gt or :tabn[ext] - Moving to a next tab
  4. gT or :tabp[revious] - Moving back to the previous tab
  5. :tabm[ove] # - Moving selected tab to a pointed location 
  6. :tabc[lose] - Closing the current tab
  7. :tabo[nly] - Closing every tab except the selected one

You can write code at incredible speed with the VIM editor. Just get begun, and the rest will take care of itself. Use a vim plug-in for your text editor if you wish to integrate into the vim universe gradually. A vim plug-in is available for all popular text editors (here's one for VsCode). So there you have it, the best of all worlds! When you're sure you're ready, make the complete transition.

This is all about VIM shortcuts command in Linux that will improve your performance.

People also read: 

Susith Nonis

Susith Nonis

I'm fascinated by the IT world and how the 1's and 0's work. While I venture into the world of Technology, I try to share what I know in the simplest way with you. Not a fan of coffee, a travel addict, and a self-accredited 'master chef'.