
How to Learn Vim: A Four Week Plan - peterxjang
https://medium.com/@peterxjang/how-to-learn-vim-a-four-week-plan-cd8b376a9b85
======
maligree
I've had a completely different approach to learning vim, which I
wholeheartedly recommend:

\- learn the bare minimum: up, down, left, right, deleting words and lines,
stuff you do everyday

\- DON'T just look for tutorials learn stuff out in the void, you'll waste
time since you'll end up forgetting 95% of it. don't distract yourself. Screw
four week plans, the basics you can get in an hour.

\- work. write code/stuff. whenever you catch yourself pressing a button > 3
times (you know, left-left-left-left or something like that) THEN look for a
better solution. you'll discover plenty ways to navigate around the code
you're working with. find a new way, stop looking, start using it.

\- happy? no pain points? good. keep using vim, wait until you find something
you'd like to improve. look for a solution.

The point is... just because vim can do something, doesn't mean you need to
know it. It doesn't mean you need to use it. It's a tool, it's optional.

The other point I guess is... stop worrying so much about if you're using
something "right". Are you happy with your workflow? Good! That's what we're
aiming for.

These plans and intros and guides... it's almost like they're meant to
overwhelm. It's a damn text editor, you can use 4 commands and be happy. There
are no rewards and no raises for "knowing" 60%+ of vim's feature set. And
after the basic what, 20%? it's diminishing returns anyway.

~~~
antouank
One thing I don't get, how do you navigate with hjkl when you're in insert
mode?

I've switched to neovim as my main editor months ago. I like it, but I still
use the arrows to navigate, or sometimes the `w` to jump words and `10j` to go
10 lines down for example.

But I go in and out of insert mode all the time, and hjkl is not useful at all
there. So I never use hjkl to navigate. Never. So how come most people use
those as the main navigation?

Am I missing something?

~~~
jen729w
I found remapping Esc to ‘jk’ (as a right-hander) to be solid gold. Index-
middle fingers. Practically instantaneous: they’re already on the keys if
you’re doing it right.

~~~
hlammers
But don't do that when you plan to use Vim to write in Dutch. I've also tried
'jk' for a while and it worked great until I started writing some texts in my
native language: 'ijk' appears to be a pretty common ending for a lot of Dutch
words :)

These days I've mapped CAPSLOCk to ESC and super happy with it.

------
vram22
For anyone who is looking for a smaller vi tutorial (vi is the predecessor of
vim), or just to dip their toes into the water initially:

Here's a _short free vi quickstart tutorial_ that I wrote a while ago:

[https://gumroad.com/l/vi_quick](https://gumroad.com/l/vi_quick)

With this tutorial you can learn some basics of vi (which is the predecessor
of vi) and get up and running with it in an hour or two of practice. Learning
vi commands (the subset that does not belong to vim as well) is useful because
vi is probably more widely available than vim (since it is more lightweight
and also comes installed by default with many Unix and Unix-like systems, and
even some non-Unix-like systems. So, having vi skills in your toolkit, makes
it possible for you to edit text files with ease on a very wide range of
operating systems, without needing to learn a new editor for each one or every
few ones.

I first created it for some colleagues of mine at a company where I worked
earlier. They were Windows system administrators who had been given additional
charge of a few Unix business server boxes. I wrote it at their request. They
used the tutorial, and then told me it helped them to come up to speed with
the basics of vi quickly, which helped them manage those Unix boxes.

I later published the tutorial in Linux For You magazine (now Open Source For
You), an Indian print-format computer magazine.

Enjoy, and feel free to give me feedback via Gumroad or the email in my HN
profile.

------
Syssiphus
How to learn ViM: Stop reading articles about how to learn ViM, and start
using ViM.

~~~
Zhyl
While I agree with this to an extent, I really feel that adopting any new
tech/tool/language needs at least _some_ motivation.

To that ends, I think the best programming tutorial for the absolute-stone-
cold "what even _is_ computer code" is 'Automate the Boring stuff' [1] as it
gives clear examples of where a computer doing something is better than
manually doing something. The best vim 'motivator' is this stack overflow post
[2].

[1] [http://automatetheboringstuff.com](http://automatetheboringstuff.com)

[2] [https://stackoverflow.com/questions/1218390/what-is-your-
mos...](https://stackoverflow.com/questions/1218390/what-is-your-most-
productive-shortcut-with-vim)

------
sleepychu
I've been using Vim as my primary editor (and vim mode in all my IDEs for
something like 8 years)

In my opinion knowing what lots of keys do in a modal editor is not that
different to learning all the shortcuts in say an IDE. I learned all the
shortcuts to use Eclipse very quickly when I stopped using a mouse (I've never
really liked using them and avoid them at all costs)

Pick a week where not getting a lot of typing out for time in won't hurt you.

Stop using other editors. You'll forge the necessary pathways to use it with
the proficiency you have in other editors and then you can look up the 1%
subset of the enormous features that will actually improve your workflow.

~~~
rando444
Isn't it difficult or limiting for you to try to navigate the internet without
a mouse?

~~~
padthai
Not OP, but 99% of the time it is faster and it feels better.

The only cases where I need the mouse are continuous interfaces (eg selecting
an specific time in a video player) or restrictive and dumb webpage
configurations (eg WhatsApp Web does noes not allow you to deselect the input
box with the keyboard)

I use VimFX and I would recommend it. It takes 2 min to learn.

~~~
btschaegg
I've come to the same conclusions (I'm using Qutebrowser though).

Interestingly, I found that my tolerance for the inefficient ways of most
browser UIs now stands out to me as much as editors without Vim-bindings
annoyed me after a couple of weeks. Once I got a hang of the controls, I
started missing them everywhere else (unfortunately I can't choose my tools at
work).

------
yAnonymous
There's an abundance of good vim tutorials, but as a moderate user, it would
be much more useful if there was a plugin that reminded me how to do things
more efficiently. I know how powerful vim is, but forget the shortcuts or how
to use them.

For example, when I navigate words using H-L, remind me to use W-E-B instead.
When I navigate many lines with J-K, remind me to use number shortcuts or
G/gg. You get the point.

~~~
throwawayvimmy
For me I'd like there to be some "convention over configuration" package for
Vim, especially with some modern shortcuts.

I don't have Vim muscle memory so the aged shortcuts don't really offer
anything for me. For example 0 goes to the beginning of the line, while ^ goes
to the first character in the line. Why can't 0 be the "default" first
character shortcut?

Anyways I know there is a lot of Vim veteran out there that wouldn't want to
use a package like this, and already have their own shortcuts made through
years of configuration. It's just that there are hundreds of papercuts that
would take years upon years for me to figure out and solve, instead of just
learning.

I'll just continue to use Sublime...

~~~
icc97
I kind of felt the same way about Vim. I was very happy with Sublime. I still
am and most of what I've done with Vim is replicate the functionality from ST.

If you're not curious enough to dive in full time then stay with ST.

I had the following reasons for switching:

* it's open source

* even if it is just 1-2% improvement that's a benefit you'll have every day for years - there's no guarantee but I wanted to see if it does help

* as it's a command line tool it feels like you're closer to your code

* you obviously get benefits in your SSH sessions

* it does kind of feel like wearing a tailored suit, you set it up exactly the way you want it

* I should be able to do everything that I could do in ST in Vim but I don't think it's the other way round

------
teolandon
> Week 4: Compose Vim commands with verbs and nouns

Really? I discovered and abused this week 1, it's way too good, and the main
reason I switched and stayed in vim. I would think "delete around word" and
hit the keys, or "yank inside (", it works too well to be a week 4 feature to
use.

------
sevensor
Being able to do more with your text editor is one reason to learn vim, and
it's the theme I see over and over in these "learn vim" posts. But it's also
responsible for the idea that, in the words of the article, "learning vim is a
lot of work." It's just not true that learning vim is a lot of work --
learning to do a lot of things with vim is a lot of work. But basic hjkl
navigation, switching between normal and insert mode with i and ESC, saving
and exiting with :w and :q, deleting text with x and dw, these take a day to
learn, tops. Learning the basics pays off right away, but it doesn't pay off
in terms of being able to use advanced features. There's an alternative reason
to learn vim that I never see anybody mention.

Vim allows you to think less about your text editor. Once the basic editing
commands become automatic, vim puts the least friction between your brain and
your text. No mouse, no arrow keys, your fingers mostly don't stray from the
home row. (Especially if you learn to use ^[ for ESC.) It's as big a gain as
learning to touch-type. The productive insights accumulate with time. It
really doesn't matter to the beginner that dw composes a command and a motion.
It deletes to the start of the next word, and that's enough for now. The idea
that you don't actually know vim if you don't understand its grammar is
ridiculous. It's like saying that kids can't speak English because they
haven't learned how to diagram a sentence.

The whole "learning vim is super-productive but super-hard" narrative is just
condescending ego-stroking from people who already know how to use it. I
suspect it's actually discouraging people from learning vim, which isn't
actually very hard. Half a dozen commands, and one crucial concept -- normal
mode -- and you're off to the races.

~~~
icc97
It is super hard because everything you're used to from your regular editor or
browser commands don't apply. So all your muscle memory is useless.

That might sound like it's easy to overcome but it's not and it's super
frustrating until you get out of one groove into the other.

~~~
sevensor
I think a huge reason people find this difficult is that it's being presented
alongside a whole bunch of other ideas. Even the fairly minimalistic vimtutor
goes off the rails after lesson 1. Most of the stuff in that tutorial could
wait until you've been using vim for a month or longer. Learn the movement
keys, learn to enter and exit insert mode, learn to delete text, and learn to
save and quit. Trying to learn that and at the same time trying to learn about
how commands are composed of actions and motions, or how to use plugins, or
buffers, or regex, or anything else, is going to cause you to stumble over the
basics.

------
JoshMnem
I learned Vim by taping cheat sheets on the wall next to my desk. Whenever I
wanted to reach for the arrow keys or do something new, I would look over to
the cheat sheets and find the right command. Avoiding the use of arrow keys
helps speed up the learning.

------
southphillyman
I work with several "Vim masters" who do about 50% of their development in Vim
and 100% of their file editing there. It's extremely embarrassing to have to
sneak and do repetitious file edits by hand in Notepad++ because I never
invested the time into learning Vim. I tried reading a Vim book but became
bored and quit after a chapter or two. Honestly I never worked with people who
use Vim everyday before so it doesn't seem to be THAT common where it's a
requirement to know it but I guess it's worth giving it another try.

~~~
SadWebDeveloper
Vim productivity has been overblown by the fanboys of terminal-based text
editors, vim et al are sorta on the verge of being irrelevant even deprecated
because there are two things that are getting better: modern languages and
IDE's.

Vim/emacs existed solely because there wasn't anything better (lookup for ed,
that's a real man editor) to develop on the old-days plus old-school languages
have this trend of including tons of "ceremony" and "duck-tape" code for
handling data that vim was good because the repetitive nature of those things
while coding but those days are over, there are less jr's learning vim/emacs
and those "Vim masters" you talk are becoming less and less irrelvant with
every year, i expected that in the next 5 years vim will be talked as a thing
of the past.

~~~
zeveb
To some extent what you write is true of vi (there was nothing better when it
was written), and vim exists for folks who are used to vi to get some features
of an extensible editor (i.e., vim is an emacs for vi-users, just with a far
worse extension language and fewer decades of debugging), but what you write
is _false_ when it comes to emacs.

The benefit of emacs is that it is a completely extensible environment for
editing text. It turns out that just about everything we do on computers
involves text: source code, sure, but also web pages, git, email, shells,
configuration, UIs &c. All of that stuff is _text_ , and emacs can handle it
all, and it can be extended to handle the next thing which comes down the pike
too[0]. emacs is the forever editor: decades after SublimeText and Atom are
dead & gone, emacs will continue.

vi & vim will continue, too, because the textual language of vi is still more
powerful than any of those GUI editors. It's more powerful than the default
keybindings of emacs (although note that with things like evil-mode or viper,
emacs takes on vi keybindings). Even GUI apps which try to implement vi(m)
bindings generally fall down because they implement so few (in the same way
that apps which try to implement emacs-style extensibility fall down because
they use insufficiently powerful languages).

I don't know what editor the hip young kids of 2067 will be using, but I know
that the folks getting stuff down will be using vi & emacs.

[0] vim can also be extended to handle anything, but compare:

    
    
        function! ToggleSyntax()
           if exists("g:syntax_on")
              syntax off
           else
              syntax enable
           endif
        endfunction
        
        nmap <silent>  ;s  :call ToggleSyntax()<CR>
    

vs:

    
    
        (defun toggle-syntax ()
               (setf syntax (not syntax)))
        
        (global-set-key "\C-cs" 'toggle-syntax)
    

Which would you rather write?

~~~
SadWebDeveloper
> I don't know what editor the hip young kids of 2067 will be using, but I
> know that the folks getting stuff down will be using vi & emacs.

I have yet to met a developer that blame his inability to "get stuff
down/done" because his editor don't let him write fast enough.

Developing isn't a who-can-type-faster contest is who can solve a problem in a
fast and simple way, typing/coding is the thing you do _after_ you solve the
problem.

~~~
zeveb
> Developing isn't a who-can-type-faster contest is who can solve a problem in
> a fast and simple way, typing/coding is the thing you do _after_ you solve
> the problem.

You're right, and that's the thing: emacs isn't better because it enables one
to type more quickly; it's better because it enables one to _do more_. With
emacs, a developer can build out his own environment, and he can share that
customisation with others. As an example, magit is by far the best way to
interact with git. Another example is org-mode. Another is gnus. Another is
notmuch. And on and on.

Indeed, it's this emphasis on extensibility which is why I prefer emacs (which
is better-extensible) to vim (which, frankly, has a better text-manipulation
language).

There's simply no competitor to emacs when it comes to extensibly interacting
with text.

Even if SublimeText, Atom, IntelliJ, Eclipse, Visual Studio got perfect vi
keybindings, I do not believe that they'd be as extensible as vim, let alone
emacs. Since extensibility is the quality which enables a tool to be used for
more than its designer imagines, and since no designer can imagine all his
users' use-cases, I think that this means that SublimeText et al. will never
be all one needs.

------
majewsky
I'll echo the recommendation for surround.vim, commentary.vim and repeat.vim
in the "Week 4" section. These are my most valuable Vim plugins. I'd add
[https://github.com/ciaranm/detectindent](https://github.com/ciaranm/detectindent)
and
[https://github.com/scrooloose/syntastic](https://github.com/scrooloose/syntastic)
to the list, but esp. Syntastic may already be to fat for some people's taste.

~~~
icc97
All of Tim Pope's plugins are brilliant. One that saved me a ton of pain was
his Obsession plugin which stores sessions that don't conflict as much with
other plugins.

------
cup-of-tea
Four weeks is a lot of time. One could learn many things in four weeks. Why
would someone decide to invest so much time in a text editor. And,
specifically, why this text editor?

~~~
baldfat
[https://www.norfolkwinters.com/vim-
creep/](https://www.norfolkwinters.com/vim-creep/)

------
cujic9
Just switched to Vim after a decade of using Emacs. The switch was one part of
a larger life goal to simplify and embrace minimalism.

I think this shift in mindset was an essential part of being able to learn
Vim.

In Emacs, I had dozens of plugins, and I could do everything so fast that I
almost went on autopilot. This was great for boilerplate code that's 90%
typing and 10% thinking, but not great for complicated code (Haskell, low
level machine learning stuff) that is 10% typing and 90% thinking.

~~~
cup-of-tea
I don't understand why vim facilitates that workflow better than emacs. I have
thousands of lines of elisp in my configuration files, but it'a all completely
invisible if I don't call for it.

~~~
cujic9
True, I could run a barebones [1] Emacs. But I want to align my use of the
tool with the underlying ethos of the tool itself.

I think of it as being similar to CISC [2] vs. RISC [3], or Chinese characters
vs. the Latin alphabet.

Emacs is CISC. It starts with a huge vocabulary of functions. If you intend to
use it right, then you create new functions to add to the vocabulary.
Eventually, it morphs into something that not even other power Emacs users can
use. (The programmable editor.)

Vim is RISC. It starts with a small vocabulary of compose-able commands. If
you intend to use it right, then you learn to make increasingly complicated
sentences out of that vocabulary.

1: For some definition of "barebones" \-- Emacs ships with Tetris inside!

2: CISC - Complex Instruction Set Computer

3: RISC - Reduced Instruction Set Computer

------
konart
Now we need article explaining the 'why' part.

I'm usring cVim for Chrome because that's a great wey to navigate pages.

And I've got a VS Code plugin for more or less same reasons. Just a couple of
'shortcuts' for when I need to work on a large csv file or something like
that. But coding? No. Still can't get it.

------
mettamage
Hmm, I might just take this approach at face value and do exactly as he said.
I only did vimtutor a couple of times and nothing else. It only gets you so
far. I really appreciate the survivability that vimtutor gives me though, I
feel comfortable editing text in a terminal nowadays :)

------
mannanali413
I have felt that learning Vim, does have a direct relation to productivity,
especially if you are more comfortable with keyboard interactions as compared
to a GUI. And yes, the learning of this editor can be viewed as a developers
investment into improving his/her productivity.

------
atmosx
Everybody is bashing plugins but vim without:

\- YCM \- airline (I use inconsolata patched to have nice icons) \- fugitive
\- Nerdtree \- CtrlP \- Utilsnips (I have some customs here too) \- Syntastic
(saved multiple times)

And other plugins (ruby, go, latex, gist) would drop my productivity
considerably.

------
isatty
I believe that what helped me the most (I've been using vim for 4+ years now,
but still not an expert by any means) is buying a keyboard without arrow keys
and also, getting used to vim motions.

Vim motions are amazing. People don't use them. If they did, it doesn't matter
what the plugins did, you can use motions with fancy stuff that plugins
provide.

Also your argument against not installing an autocompleter is without basis.
Just because vim can do it natively does not mean its good. The native
suggestions are alright when I'm editing on a remote server but I use
YouCompleteMe when possible on my own systems. People who are used to
intellisense etc kinda need this to do their job and still use vim.

------
u801e
Back when I was in college in my intro to Unix class, I was introduced to vim
as a text editor as part of the course and learned the basics. Over the next
several months, I read through the getting started and editing effectively
sections of the main vim help page and got up to speed.

In my opinion, just reading through the documentation and practicing is really
all that you need. If you want to become an advanced user, then you need to
always think if there's a more efficient way of doing something in the editor
that's currently rather tedious and, once you learn it, practice and commit it
to memory.

------
wruza
>Consider installing auto-pairs.vim

Personally I don’t like when editor puts something into buffer without my
explicit command. Moreover, if you need autopairing, there is no need to
depend on external script, just :imap ( ()<Esc>i

~~~
devnonymous
/Rant

Oh come off it! I hate this kind of elitist bull crap. Don't like editor
putting something into buffer, do you? Do you have set ai in your vimrc? 3
guesses to what that does. How about set et? 'consent' you say? How is
explicitly installing a plugin not expression of consent?

And as for your dismissive jibe about 'just imap' \- auto-pairs is a bit more
nuanced than that. For example it handles pairing quotes as well. Let's see
your quick dismissive solution for that which handles closing quotes as well.

Why am I so angry? Well, because there are so many of these 'gurus' who go
around being dismissive of other peoples _preferences_ as tho their's is the
only one true way. The comment could easily just have been, "I like to be
explicit about entering my parentheses and even if I wasn't here's how I'd do
it without a plugin ", instead of all that consent nonsense.

/End rant

~~~
wruza
Btw, I tried to use autopairing yesterday in sublime text 3. What I noticed
that it is easy to get used to autopairing on entering lines, but when line is
edited again, it often leads to unbalanced parethesis. Happened to me every
time unless attention was paid, because it works not a like what your finger-
memory expects from new line entering. Do you experience this? Does
autopairing.vim solve this issue?

------
blonky
I learned vim by trying to learn Ruby/Rails(my first experience with
programming). It got tedious to open files by looking them up in the Mac Os
Finder. Then one day, someone showed me how to tell an application to open a
file via the command line. I'm a noob. Vim found its way into my workflow, and
I haven't looked back.

------
taw55
If you need 4 weeks to learn a text editor, this might not shine the best
light on your editor’s ui.

------
baldfat
Making your mouse a dust collector is key.

I use qutebrowser for internet

Ranger.py for file manager

I also use a tiled window manager (i3)

The only time I use the mouse is when I am doing creative work (video editing,
graphics or music production)

I use VIM bindings in R Studio and VS Code and I am actually using less of VIM
and more of VS Code strangely.

------
hashkb
For me it was just a week until I was as good as I had been in sublime; all
uphill from there. Now I have to use all the time I save to mop people's drool
off the floor behind me.

------
hestefisk
The only real way of learning vim is starting with nvi (the real BSD Unix vi)
for basic editing before going anywhere near vim.

~~~
nameless912
....why? Nearly every server has real, honest to goodness ViM installed on it
these days, and nvi is extremely limited in its capabilities by comparison.

------
rocqua
I'd add the recommendation to disable arrow keys in .vimrc

It forces you to learn hjkl, and thus helps keep your hands on the home row.

------
emivvv
I love this vim comeback.

------
diskape
Honest question: why?

~~~
jmcqk6
[https://stackoverflow.com/questions/597077/what-are-the-
bene...](https://stackoverflow.com/questions/597077/what-are-the-benefits-of-
learning-vim)

------
bolololo12
Why should I learn VIM? I still don't get it, a sudden waterfall of articles
about VIM>

~~~
corpMaverick
IMHO.

You need to know the basic vim commands in the case you are stranded in a
remote server and need to modify a file. It is also handy to do quick changes
to a file when you are in the command line.

I used to do software development in vim back in the day, but I don't do that
anymore. Now days I use sublime for scripts and an IDE for larger projects.

My recommendation. Commit the basic commands to muscle memory but you don't
need to be a power user.

~~~
bolololo12
Ok, so it's not that the dev community is moving from VS Code, Sublime to VIM,
uff...

In case I'm stuck I used to use nano. but like you say might be worth learning
vim vasic commands.

