DEV Community

Cover image for Accelerated Vim-Provement
Ryan Palo
Ryan Palo

Posted on • Updated on • Originally published at

Accelerated Vim-Provement

I'm currently working on practicing and learning to use Vim as an editor. After a few sorry attempts to learn it quickly by sitting down and doing a few tutorials, I've learned that the road to Vim mastery for me will consist of a slow, steady grind of practice, learning and conquering one thing at a time, letting the Vim philosophy soak in as I go.

Slow and steady

Learning to take the pressure off of myself to learn quickly and move on the the next thing has been difficult, but I'm glad for it. It's turned the hiccups, small frustrations, and the disappointment of having to Google the same thing for the umpty-seventh time into a weirdly relaxing and enjoyable journey. Instead of "I'm so dumb, I can't believe I can never remember how to delete a word", it has become, "Oh Vim, you little rascal, you got me again. We'll see who has the last laugh."

Oh, Vim...

I did come up with one thing that helped me speed things up a little bit, which I thought I could share.

Take the Training Wheels Off

One of the first things you learn when learning Vim is how to move around using h, j, k, l keys instead of the arrow keys. In theory, it's more efficient and keeps your hands in an ideal typing position. I don't think that using the arrow keys makes you a bad person, but there is one additional benefit to using these keys instead of the arrow keys:

You have exactly as much practice using h, j, k, and l to move around as you have with any of the other motion/command keys in Vim.

The arrow keys are sort of a crutch, because, if you want, you can ignore all of the commands and keys that make Vim extra useful and stick to just using the arrow keys and staying in Insert mode all the time. If this is how you're using Vim, you're essentially just using an obnoxious version of Nano.

All the features of Nano, with the added joy of continuously forgetting you're in Normal mode and trying to start typing, only to have your cursor do crazy things all over the screen.

If that's the way you like it, I have no problem with that. You do you. If you're trying to break that habit and convert your brain to the Vim way of doing things (via Vimception, maybe?), then I've found it is super helpful to actually throw away the crutch entirely and turn off your arrow keys.

Add these lines to your .vimrc file.

nnoremap <Up> <Nop>
nnoremap <Down> <Nop>
nnoremap <Left> <Nop>
nnoremap <Rigth> <Nop>
Enter fullscreen mode Exit fullscreen mode

Mapping a key to <Nop> (or no-op, or no-operation) causes it to do nothing.

But Why?

This is actually pretty common advice, but most articles will tell you only that it's to help get you more comfortable with h, j, k, l. This seemed dumb to me because... why would I want to learn a new set of keys that just do the same thing if I'm already efficient with arrow keys? I would say the benefit is not that I got more comfortable with h, j, k, l, but that I quickly got tired of pushing these keys. Without the arrow keys to fall back on, but with a desire to be more efficient, I've had a much larger incentive to learn keys like w, e, $, 0, G, gg and others!

You don't take the training wheels off of a bike so that you can say you're not using training wheels -- while continuing to ride slowly. You take the training wheels off of a bike so that you can quickly learn that it's actually much easier when you go faster.

Hard Mode Enabled

This works well, but there's still the temptation to just drop into Insert mode and use the arrow keys there, which defeats the entire purpose. To circumvent this, You can also disable the arrows in Insert mode as well by adding the following to your .vimrc:

inoremap <Up> <Nop>
inoremap <Down> <Nop>
inoremap <Left> <Nop>
inoremap <Right> <Nop>
Enter fullscreen mode Exit fullscreen mode

This will make your life frustrating at times. "But I just want to move over two characters! I don't want to have to drop out of Insert mode, move over and go back in!"

Tough. Cookies.

You're a tough cookie.

Stick with it! It'll pay off. I've only been doing that for like a week and I'm seeing huge improvements.


For extra encouragement, replace all of the <Nop>'s above with this:

:echo 'STAHP.'<CR>
Enter fullscreen mode Exit fullscreen mode

Wrap Up

If you've got any Vim pro-tips, let me know. Vim is a fairly popular tutorial topic and everybody's got lots of opinions about it, but I'm always on the lookout for cool resources, books, guides, games, ways to practice, etc. I know there's a lot of people with a lot of knowledge to share, so share away!

Originally posted on assert_not magic?

Discussion (21)

papey profile image
Jean Michel Functional Programming • Edited

This is also the setup I used. No arrow keys. After 6 years without it I used hjkl for my configs (zsh, xmonad, web browers, weechat etc...).

If you want to reduce finger travel here is another tip :

inoremap jj <esc>

Remap jj to is the second best thing i did in my vim life.

maestromac profile image
Mac Siri

Can you tell me how you are using hjkl in terminal and on other applications?

rpalo profile image
Ryan Palo Author

I found this post that has some good resources. Also, they link to their fork of oh-my-zsh that makes allowances for vi-mode while still letting you do history searching and stuff. Looks pretty legit, I'll have to check it out when I get home.

Thread Thread
maestromac profile image
Mac Siri

Thanks for that! I'll check that out.

papey profile image
Jean Michel Functional Programming • Edited

I used personal keybinds, inspired by vim in my xmonad config and weechat config. For web browsers i recommend Vimium (For Firefox and Chrome/Chromium). For zsh there is a vim plugin available. A lot terminal apps works well out of the box with hjkl, so I always give it a try.

eljayadobe profile image

I map CAPSLOCK to ESC. Not in Vim, but in the OS.

CAPSLOCK is a worthless key in a prime real estate location.

maxdevjs profile image

I do not remap CAPSLOCK only because I like to have this module active in polybar

long live to the capslock

bhilburn profile image
Ben Hilburn • Edited

Leaving this here for anyone who hasn't heard of it, yet. It's great way to learn Vim by playing a game in your browser:

Once you've learned a bit, Vim Golf is an interesting game for advanced users looking to improve their efficiency:

Here are some other neat tips / snippets I like. Note that many of these were originally authored by Steve Losh, who wrote "Learn Vimscript the Hard Way".

" "Uppercase word" mapping.
" This mapping allows you to press <c-u> in insert mode to convert the current
" word to uppercase.  It's handy when you're writing names of constants and
" don't want to use Capslock.
" To use it you type the name of the constant in lowercase.  While your
" cursor is at the end of the word, press <c-u> to uppercase it, and then
" continue happily on your way:
"                            cursor
"                            v
"     max_connections_allowed|
"     <c-u>
"                            ^
"                            cursor
" It works by exiting out of insert mode, recording the current cursor location
" in the z mark, using gUiw to uppercase inside the current word, moving back to
" the z mark, and entering insert mode again.
" Note that this will overwrite the contents of the z mark.  I never use it, but
" if you do you'll probably want to use another mark.
inoremap <C-u> <esc>mzgUiw`za

Here's another favorite, also from Steve:

" Highlight Word {{{
" This mini-plugin provides a few mappings for highlighting words temporarily.
" Sometimes you're looking at a hairy piece of code and would like a certain
" word or two to stand out temporarily.  You can search for it, but that only
" gives you one color of highlighting.  Now you can use <leader>N where N is
" a number from 1-6 to highlight the current word in a specific color.

function! HiInterestingWord(n) " {{{
    " Save our location.
    normal! mz

    " Yank the current word into the z register.
    normal! "zyiw

    " Calculate an arbitrary match ID.  Hopefully nothing else is using it.
    let mid = 86750 + a:n

    " Clear existing matches, but don't worry if they don't exist.
    silent! call matchdelete(mid)

    " Construct a literal pattern that has to match at boundaries.
    let pat = '\V\<' . escape(@z, '\') . '\>'

    " Actually match the words.
    call matchadd("InterestingWord" . a:n, pat, 1, mid)

    " Move back to our original location.
    normal! `z
endfunction " }}}

" Mappings {{{

nnoremap <silent> <leader>1 :call HiInterestingWord(1)<cr>
nnoremap <silent> <leader>2 :call HiInterestingWord(2)<cr>
nnoremap <silent> <leader>3 :call HiInterestingWord(3)<cr>
nnoremap <silent> <leader>4 :call HiInterestingWord(4)<cr>
nnoremap <silent> <leader>5 :call HiInterestingWord(5)<cr>
nnoremap <silent> <leader>6 :call HiInterestingWord(6)<cr>

" }}}
" Default Highlights {{{

hi def InterestingWord1 guifg=#000000 ctermfg=16 guibg=#ffa724 ctermbg=214
hi def InterestingWord2 guifg=#000000 ctermfg=16 guibg=#aeee00 ctermbg=154
hi def InterestingWord3 guifg=#000000 ctermfg=16 guibg=#8cffba ctermbg=121
hi def InterestingWord4 guifg=#000000 ctermfg=16 guibg=#b88853 ctermbg=137
hi def InterestingWord5 guifg=#000000 ctermfg=16 guibg=#ff9eb8 ctermbg=211
hi def InterestingWord6 guifg=#000000 ctermfg=16 guibg=#ff2c4b ctermbg=195

" }}}


rossijonas profile image
Jonas B. R. • Edited

Well here is more tips on learning Vim, I hope it helps anyone:

First of all hit you terminal and type :vimtutor ...this is the first step! Take 30mins to 1 hr to practice relaxed, no rush! 👨‍💻

There's a nice book called Mastering Vim Quickly by Jovica Ilic, that is a pretty good one, and If you can't invest right now, you can subscribe to get chapters for free and newsletter tips. is a free good resource with videos and articles.

I started to write quick tips and tutorials for Vim beginners too, to help them deal with specific configs and get excited with tricks you can use.

You can check it on! has a cheatsheet embedded on the search bar... you can type vim cheatsheet and you get:


maestromac profile image
Mac Siri

This is a nice tip! What stopped me from doing this in the past is that I still rely on arrow keys when I'm in command-line mode (when you press : or /). My personal tip is to learn about leader keys and really make use of it 😃.

rpalo profile image
Ryan Palo Author

Cool! What are some of your most frequently used leader commands?

maestromac profile image
Mac Siri

My most used are saving, quiting, and save&quit in below. Reducing keystrokes are always a plus!

let mapleader = ","
noremap <leader>w :w<cr>
noremap <leader>q :q<cr>
noremap <leader><Tab> :wq<cr>
noremap <leader>f :tab split<CR>:Ack ""<Left>
noremap <leader>F :tab split<CR>:Ack <C-r><C-w><CR>
noremap <leader>3 :NERDTreeToggle<CR>
Thread Thread
rpalo profile image
Ryan Palo Author

Awesome. I'll definitely have to do more leader-ing. Thanks!

niorad profile image
Antonio Radovcic

The biggest eye-opener for me was embracing the difference between Tabs and Buffers.

Coming from UI-Based editors like Sublime, learning the difference was an important step in understanding Vim (and also Emacs, similar principles).

Also, a more general tip for people considering Vim: Learn it anyways. The skillset you build by learning modular editing can be applied in any major editor/IDE via plugins.

rpalo profile image
Ryan Palo Author

Cool, thanks for the tips! I’ll give that post a look.

stsewd profile image
Santos Gallegos

I think this method is the best for stop using the arrow keys 😅


Seriously, taked me a while to stop using them, I did it in this way:

  • Always keep my fingers on the home row
  • Navigate a lot of text using h, j, k, l (:tutorial is a good place).
  • Whenever I wanted to read some text/code I opened it on vim.
  • Keep doing that till feels natural, but be careful, you will try to use hjkl on everything!
awkravchuk profile image
Andrew Kravchuk

Neat! Here's the snippet I've just made for Spacemacs (which is mostly like Vim, but, erm, is in fact Emacs) to do the same thing:
I'm thrilled to start using it though, even writing this snippet in Spacemacs with half of rules activated made my brain tingle :D

eljayadobe profile image

I've been using Vim for about 20 years. Before that I used Emacs for 2 years.

After a particularly interesting "my editor is better than your editor" flamewar with a coworker, we made a deal: I'd use Vim for 6 months, and he'd use Emacs for 6 months.

At the end of the 6 months, he switched back to Vim, and I never went back to Emacs. (I'm not saying Vim is better than Emacs. I'm saying that Vim is better for me.)

So for anyone thinking of using Vim my response is simply, "It's too late for me! Save yourself!" That's a "ha-ha only serious... well, only slightly serious."

Vim let's me become one with the keyboard. The editor gets out of the way. My fingers know it tacitly. I never have to reach for the mouse.

Bill Joy, the creator of vi, said that vi was made in the day of 300 baud modems and every character of very limited bandwidth was precious. These days, we have gigabit internet connections. The reason that vi is the way it is is no longer is a factor.

Yet I still use Vim, every day. I also use Visual Studio and Xcode... but when I want to do serious coding* I hop over to Vim.

* which is in C++... another "It's too late for me! Save yourself!"

papey profile image
Jean Michel Functional Programming

Visual Studio Code vim plugin is awesome ! Even if I like VSCode, I can't get away from my neovim config and all the plugins I have.

voyeg3r profile image
Sérgio Araújo

Talking about movements recently I discovered g_ to jump to the last non-blank char in the line and _ to jump to the first non-blank.

I also became amazed, long time ago with gf gi and gv

andy profile image
Andy Zhao (he/him)

Obligatory @maestromac mention