Article summary
Vim motions are incredibly useful. No matter what editor I’m using, the first thing I reach for during setup on a new project is installing a plugin or extension that enables Vim motions. It’s muscle memory to me. For instance, I find gd for jumping to definition or just hjkl for moving one character at a time are powerful tools, noticeable when they aren’t there.
Some examples are the VSCode Vim Extension, IdeaVim for JetBrains editors, or even the built-in “Vim Key Bindings” setting in Obsidian.
Fragmented Configs
A pain point I’ve noticed is that I have a few small config options that I reach for no matter the editor. These would normally exist in my .vimrc, but each editor has its own specific setup requirements and configuration formats. Instead, my .vimrc is extremely lightweight.
""""""""" GENERIC CONFIG
set re=0
set nocompatible
syntax on
" Add file line numbers
set number
""""""""" PLUGINS
call plug#begin()
Plug 'easymotion/vim-easymotion'
call plug#end()
"""""""""" KEYBIND REPLACEMENTS
source ~/.vim/.vim_easymotion.vim
This minimal setup lets me use the same Vim config everywhere. For each editor, I layer an editor specific .{editor}vimrc file to customize each environment.
Modular Configs
This year I had to switch from using VSCode to using Rider and DataGrip for a client project. Both are Jetbrains products that support IdeaVim. I was able to hook in my base .vimrc, and then add IdeaVim specific plugins within this .rc.
Here is what my .ideavimrc looks like currently:
".ideavimrc is a configuration file for IdeaVim plugin. It uses
" the same commands as the original .vimrc configuration.
" --- Enable IdeaVim plugins https://jb.gg/ideavim-plugins
Plug 'machakann/vim-highlightedyank'
"
" Source your .vimrc
source ~/.vimrc
By sourcing my base .vimrc, I bring in my keybind replacements and plugins. If I want to change something with my Vim config, I can modify it system wide, or only within the JetBrains editor ecosystem.
Why This Matters
Having a consistent setup means I spend less brain cycles thinking about navigation or editing. Instead, I can focus on solving problems.
There are limits to having a modular Vim config like this. Some editors don’t support plugins or certain Vim bindings. Obsidian’s Vim motions are pretty barebones, for example, not supporting registers or window management commands from ctrl+w. A majority of the time, however, the shared config works perfectly.
If you use Vim motions and jump between editors often, treat your Vim config like a shared library. Keep an easy to read .vimrc and have smaller files held within your .vim directory that follow the Single Responsibility Principle which are then imported into your .vimrc. Doing this should reduce the overwhelming feeling of customization available with Vim combined with modern IDEs.