Developer productivity with the keyboard - My most used vim key bindings

Published Sep 11, 2021

The content here is under the Attribution 4.0 International (CC BY 4.0) license

As a developer I am often looking ways for improving the way I write code, and also, texts in general, like this post for example. Throughout the years I tried different editors and IDE’s. In this journey, I found that each tool focus on one side of the equation.

For example, IDE’s tend to focus on the integration as a way to improve developer’s workflow, one single place to do everything: accessing terminal, writing code, runnings test, accessing the database and so on. On the other hand, text editors are focused on a specific task, editing texts. Which doesn’t mean that it can be used for other things. Usually text editors have a plugin system to power them up.

I have tried both approaches and I couldn’t keep with one or the other. I wrote my journey on vim, registering it as I went through the challenge, starting from with the idea of using vim for 30 days, then one week after and finally the last part after 30 days when the challenge has finished.

The goal of this post is to share the most used features that I kept from vim and other features that I use in IDE’s. In the end I use a mix of IDE’s and text editors.

NOTE: Keybindings used in this post have been tested in jetbrains based IDE’s and with ideavim installed as well as vim and neovim.

NOTE 2: I wrote about the setup I am using for the time of this writing.

Moving around

One of the first things to get familiar with is how to move around, list files, split windows (vertically and horizontally), close window, move a window and so son.

Moving based on vim

command Description
:vs Split vertically
:sp Split horizontally
ctrl + w + w Navigate between splits
:q Exit vim, or split

Editing code

In this section I try to list the most used keys that I use for editing code (and sometimes text as well).

command Description
d + w  
c + w  
c + s + ‘ + “ Replaces the surrounding ‘ with “, both can be replaced by any character

Text transformation

command Description
g + u Changes text to lowercase
g + U Changes text to uppercase

Searching for files

Search depends on what you are searching for and which program you are using, searching for files across jetbrains based IDE’s if as simple as hitting shift twice. On the other hand I use fzf with vim.

Searching based on vim

command Description
+ , Enables fuzzy search based on the current directory

Searching based on jetbrains

command Description
shift + shift Enables fuzzy search based on the current project, it’s possible to filter by directory or file extensions

Information

command Description
g + h Shows the same information as if it were hovering over a suggestion. refs: stackoverflow

Information based on vscode

ctrl + shift + M Shows problems tab in the editor (arrow keys are used to navigate between them)