Thomas Step

This is where I share my thoughts and experiences that I encounter developing software.

Home


Blog


3 May 2021

Vim Keystrokes That Helped Me Transition From VS Code

by Thomas

NOTE: If you want my list of commands and keystrokes, scroll down to the bottom. If you want to know more about my motivation behind switching to vim and compiling this list, read on.

I like VS Code. I have nothing against it and I still use it from time to time. My VS Code setup used to have a color scheme, keybindings, linters, different syntax highlighting, and the like. Most people probably end up with something similar after using it for a while. Then one day my computer decided it didn’t want to start anymore. All of that was lost. I’m sure that there is a plugin that would have exported my settings and synced them across devices, but I didn’t want to set that up. When I got my new computer I felt like I was starting from ground zero and that I didn’t even know what software I needed to download first. I had wanted to give vim a try for a while. Since it has such a cult-like following, I figured there must be some redeeming qualities about it that I wanted to benefit from.

My move was less about dissatisfaction with VS Code and more about wanting to learn something new. I had the chance to not download VS Code and force myself into using vim, so I did just that. I started by reading a few guides, referencing a few cheatsheets, and searching for commands whenever I needed them. While I had done this in the past, the difference this time around was that I couldn’t simply fall back on VS Code being there since I had never downloaded it. At the end of the day, the best way to learn is to throw yourself in the fire. I committed to only use vim and reference new keys as the need arose. Only using vim for a few days had me feeling pretty efficient with keystrokes and combinations.

Learning vim was similar to when I learned German; I lived in Germany so I had no other choice. Similarly, I lived in vim-land now so I had no other choice than learn the commands. Language learning communities like to bring up the X most used words or something similar to kickstart a journey to fluency and that’s my motivation behind this list. I hope that by sharing my X most commonly used commands in vim, I can help kickstart someone else’s journey into vim-land. In addition to looking over the commands, I suggest using them today. If you truly want to learn something new, putting knowledge to good use is just as important as that knowledge.

One final note I wanted to make about learning vim was windows and tabs. Windows and tabs made vim click for me as a reasonable alternative to a modern text editor. I realized that a majority of my time in VS Code was flipping through open tabs and leaving those tabs open to annoy myself later. Once I learned how I could view multiple files simultaneously in vim, I felt much more motivated to continue using it. In vim, there are two main ways to open multiple files being windows and tabs. Windows are tiled in the current screen and tabs are separated. I tend to open up to four windows in a tab before I start opening tabs. I also try to keep separate tabs open for different projects instead of cram too many windows on the same tab for different things. By keeping the number of windows to a max of four, I have found that I rarely need as many files open as I used to keep open in VS Code.

There are also a few commands I listed about buffers. Windows are an open buffer. After a window is closed with :q they only disappear from memory if that was the last open window. Vim will keep track of any file that is opened through buffers. This means that we can reopen a recently opened file in a vim session by looking at the open buffers :ls and reopening the desired buffer in the current window :#b.

I have had fun learning vim and I feel like I have completed a rite of passage of sorts by using it. If there are any particular components that you are interested in learning more about, feel free to drop me a line. Remember that this is just a starter list to vim commands. There are more intricate commands, but I omitted them for simplicity’s sake. Have fun learning!

movements:

commands:

visual:

windows:

buffers:

tabs:

netrw (default file explorer):

favorite combos:

Categories: dev | meta