
Learning Vim incrementally (2010) - m3at
https://yehudakatz.com/2010/07/29/everyone-who-tried-to-convince-me-to-use-vim-was-wrong/
======
dusted
Oh, can I resist.. Nope, sorry. Everyone who tried to convince me to use vim
plugins was wrong. Keep it clean :) Vim is my daily driver for programming,
which is my job, in my office we're 2 using vim, we exchange tips and tricks
sometimes, and ask questions that are exceedingly specific, and it just
becomes nicer and nicer to work with text as I get better. I do need to
experiment with multi-line cursor, that I mess from vscode studio.

The article is well written, and the authors has a good point. I don't think
there are that many situations where "dive in head first" is that good of an
idea.. Slip in where you can find ground, and work your way out until you
learn to swim. I'd never switch off my cursor keys, I don't CARE if it's
supposed to be more efficient. That's how I feel right now, maybe one day,
I'll feel different, but if I do, I won't recommend any new users to do the
same, that's just silly.. I mean, that'd do nothing but scare them away and
make their lives miserable.

~~~
tomcooks
No idea why you're getting downvoted

I'm very much against plugins as well, being able to reliably work on a
vanilla vim install allows me to productive everywhere.

But yes, I do miss the multicursors I've learned to love on Sublime Text.

~~~
dhagz
Who needs multicursors when you have macros?

~~~
tomcooks
How would you use macros to simulate multicursors?

------
melvinroest
The following has been repeated quite a lot on HN, but for people who are new
to vim or new to reading HN it bears repeating.

1\. Go to your terminal.

2\. Type in vimtutor.

3\. Spend half an hour.

4\. Congratulations! You are now able to survive in vim, while you're by no
means a master yet, you're probably around 80 to 90% as productive in vim as
with a general text-editor without plugins.

IMO it's 30 minutes well spent.

~~~
YeGoblynQueenne
I think the point of the OP was that they don't want to have to memorise a
whole bunch of new commands before they can be productive with their new
editor.

This makes a lot of sense btw. Think of all the commands and shortcuts you
need to know to be productive and quick in everyday programming work: OS
shortcuts; terminal commands; git commands; IDE shortcuts; and now, a whole
bunch of editor shortcuts _and_ commands.

And, does vim's interface help you very much with remembering what you should
type in to do what? Sometimes, yes (:w(rite); :q(uit);: x(it); :w/q/x/a(ll);
etc). Sometimes, not so much, no (hjkl wtf? :y? :o? Is that a smily face?).

And how much of that stuff in vimtutor are you going to use in the first week
of use? 10%? 20%? 50%? The rest, you'll just forget immediately anyway. So
that's half an hour that you probably can't afford and that you definitely
don't need.

So taking it easy and not trying to learn a whole bunch of stuff you're not
sure you need is very good advice.

~~~
melvinroest
Apologies for the long comment, succinct writing is tough.

I have a different opinion, but do understand your scepticism. If people
would've told me this before "just type in vimtutor and 30 min. and boom
you're ready" I'd have laughed at them.

As a big proponent of vimtutor, I daresay that vimtutor is taking it easy. It
took me 30 minutes during a subway ride and I've tried to learn vim a couple
of times, and I _think_ I even read this article among one of those failed
tries.

Yes, you learn a lot of commands, but the tutorial structures it relatively
nicely. Also, they're grouped: hjkl are 4 different commands, but if you know
one, you can infer the other three. The same goes for w and q. Yank and what I
prefer to call "Open new line" were quite intuitive for me at the get go, but
then again I had the habit of creating mnemonics.

The first 4 chapters (I think it was the first 4) already give you the super
powers to survive.

Vim is indeed very unforgiving, which is why people need a tutorial.

How much stuff did I use in the first week? Well since I did the tutorial
several times, I can tell from memory what I remembered initially:

The 5 essential commands:

i - Insert

ESC - Escape (aka please get me out of insert mode or whatever mode I'm in!
:'( )

w - write

q - quit

q! - I really want to quit, I don't care what you do now! (and then
immediately redoing the vim command with sudo vim filename.txt)

Some text editing commands (not sorted on if I'm insert or browsing mode):

dd - delete and copy (or delete and pop)

$ - goes up or down or end of line? (I still forget that)

gg - goes up or down or end of line? (I still forget that)

G - goes up or down or end of line? (I still forget that)

A - append (or small letter a)

hjkl - Home row movement, not needing to lift the finger

y - yank aka copy (as a non-native English speaker it was fun to learn that
"yank" can mean copy)

x - cut

e - end of word

b - beginning of word

r - replace (not that I ever use it)

From the top of my mind, I learned about 80% of these commands back then. IMO
knowing these commands makes you survivable.

Later on, I also learned a thing or two with vim visual mode. I kind of forgot
that now. I vaguely remember it was something with CTRL + V or Shift + V and
that you can select a block and indent it with Shift + I. I remember I went
even into the vimrc file, or whatever it was called. But I decided to stick
with Sublime Text and simply use this skill when I quickly need a terminal
editor (oh, and also to not be annoyed by git).

As you can see, in the demonstration of my very humble knowledge, I only
vaguely know what the commands do as I don't use vim every day (more like
every month to touch a line quickly). But I kind of know what they do and with
some quick experimentation I figured it out again.

I have the suspicion you already know vim. For other people, my suggestion is:
just try vimtutor, you'd probably already have finished chapter 1 and 2 by now
if you would have done vimtutor instead of reading my long comment.

~~~
neoncontrails
One of the nice, well-thought things about $ (end of line) and its inverse, ^
(beginning of line), is they have exactly the same meaning in normal mode as
they do in regular expressions (with a small caveat that ^ ignores whitespace,
so it's not so much the beginning of the line as it is the beginning of text
on that line).

~~~
melvinroest
I never thought about that. Thanks!

------
alfonsodev
The post is from 2010, today in 2019, I'd say that first step could be to
install a vim extension in your already existing IDE/editor, VSCode and Idea
have good enough vim plugins to start learning insert mode and moving around,
and even allow you to search and replace :%s/termA/termB/g You can also play
Vim Adventures[1] if you want to be even more playful.

[1] [https://vim-adventures.com/](https://vim-adventures.com/)

~~~
StavrosK
Unfortunately I've found that vim modes for various editors are good enough to
fool you so you keep using them, but not good enough to not frustrate you with
the differences. In PyCharm, for example, I have no idea how to use any
keyboard shortcuts with vim mode on, since vim then absorbs the keys pressed
and I lose all keyboard access to the functionality.

~~~
JNRowe
I have the same experience, but I'm yet to decide what is worse: weak vi-mode
where it collapses straight away(no count support fex), or strong support
where it fools you for long enough to catch you out when you're fully in the
flow.

My go-to example for strong support is emacs' evil-mode¹, it takes a lot for
it to break down. For example, it even supports things like the expression
register² but then requires an elisp expression.

1\.
[https://bitbucket.org/lyro/evil/wiki/Home](https://bitbucket.org/lyro/evil/wiki/Home)
2\. [https://vimhelp.org/insert.txt.html#i_CTRL-
R_%3D](https://vimhelp.org/insert.txt.html#i_CTRL-R_%3D)

Edit: I'm pointing out where it has fallen down for me, not complaining that
the devs haven't implemented a full vimscript interpreter to attach to that
binding. I _love_ evil.

~~~
jplayer01
The great thing about spacemacs/evil is that generally all the standard emacs
bindings work how you'd expect them to. I can still M-x and get access to
everything emacs.

------
elagost
I'm convinced that people who use solely vim/emacs started off before there
were any good GUI editors and now have too much momentum. I'm not that old,
but I frequently spend time on headless *nix boxes, so I use vim all the time
and love it. I have a portable .vimrc that I take around with me because I
have spent so much time that I want to configure things the way I like them.

Despite my love of vim, on the desktop, I fall back to gedit or Notepad++.

Vim and Emacs are great editors when you're SSH'd to a headless server, but
they will not replace an IDE (or even TextMate). That is completely
ridiculous.

~~~
lunchables
Really curious to hear why vim cannot replace an IDE or TextMate? Maybe it
depends on your very specific use case? I certainly replaced my IDE(s) with
vim and some plugins.

I'm a vim user, certainly one who was alive long after "good GUI editors." My
first programming was done in Visual Basic over 20 years ago.

~~~
elagost
Using Eclipse, any jetbrains stuff, android studio, and xcode (even GNOME
builder!) is super helpful for me. They have completion features, a robust set
of build tools, and everything in one window with all the controls visible. I
love the autocompletion, console, build environment, and when I think about
the time it took me to get my .vimrc to where it is now, just for writing text
and basic scripts, I shudder to think of how much I'd have to add to make it
even close to something like Eclipse.

I am hobbyist programmer and a parent, so I don't get a lot of time to do
programming these days. When I do I don't like fiddling my half-baked tmux/vim
setup. I just wanna write code. So I use IDEs.

~~~
lunchables
>I shudder to think of how much I'd have to add to make it even close to
something like Eclipse.

It depends on what you use in Eclipse, really. But vim has plugins to do
things like autocompletion, there's many ways to access console (:term), etc.
It's all done through plugins, you just use whatever plugin manager to add
them. It's very simple.

>I am hobbyist programmer and a parent, so I don't get a lot of time to do
programming these days. When I do I don't like fiddling my half-baked tmux/vim
setup. I just wanna write code. So I use IDEs.

Me too, but the day or two it took to get vim setup to function as an IDE also
meant I had all the power that comes along with vim. For me it is well worth
the time investment of a few hours for something I'll use for years and years
and be more productive than using Eclipse. And allows me to go between my
normal text editor and IDE and share all my keybindings and workflows.

I think a good trade off would be something like a vim plugin for Eclipse.
PyCharm for example has IdeaVIM which is a plugin that brings a lot of the
power of vim to that IDE.

I just couldn't give up all the power of vim just for the out-of-the-box IDE
features like autocomplete when I can just add them to vim.

------
Phenix88be
I started learning Vim keybindings (on Spacemacs) when my extensive 8h/day use
of the mouse had becoming painful. Some days I could barely move some of my
right hand fingers.

One day I had enough, I started the Vimtutor process and never looked back. No
more pain since.

------
majewsky
I agree with the article, but I'd like to add another early step: Understand
that Vim's normal-mode commands are like a language with nouns and verbs. You
can mix and match most nouns (motions) with most verbs (actions). So when you
already know 5 motions, learning a new action actually means learning 5
action-motion combinations at once.

With this in mind, observe yourself as you work and notice which motions and
actions you need most (like `ci"` in the article). Focus on these at first for
those sweet sweet quick wins.

------
DictumMortuum
I keep reading about productivity on vi vs other browsers. That's cool,
however the thing that makes me want to use vi with proficiency is another
though: availability. I spend a lot of time in ssh or docker sessions and not
knowing vi can severely hinder my job.

~~~
nineteen999
The thing is, if you were a user of multiple different UNIX systems the
previous century, it was much the same - vi was the only editor installed out
of the box on all of Solaris, BSD, Tru64, AIX, HP-UX, Linux etc. So if you
were frequently moving between them as some of us were, you wouldn't get very
far if you didn't know at least the basics of vi.

------
UI_at_80x24
There are two (non-exclusive) camps for vim use. Developer and Admin.

Most of the discussion here focuses on the dev-side of things naturally; but I
want to touch on the Admin/sysop side.

If you are just starting out editing config files there is very little benefit
to using vim over some more simple (i.e. nano)

Example: Editing an sshd_config file. Scenerio: You want to change the default
port number that sshd is listening to. Both nano and vim make this singular
task very easy and quick. As far as speed goes, I'd say they are close or
equal to each other to finish this task.

Where vim really shines is for larger and more 'annoying' tasks.

Example: You need to iterate out a list of incrementing IPs for another
service.

    
    
      e.g.  
      192.168.0.1
      192.168.0.2
      192.168.0.3
      ...etc...
      192.168.0.254
    

In nano, you need to manually edit/add each line which is combersome; however
with vim there are multiple ways of doing the same thing (recorded macros are
amazing!).

But in my experience the hands-down "it doesn't get better then this" 'Admin
use' of vim is this: editing YAML files (whitespace is evil, OMG why?!?) vim
can be configured to convert your tabs to spaces and all pain is ended in the
universe.

Little things add up. For the odd small job, you might not see an improvement
over a 'dumb' editor like nano; but the skills you learn on the small things
translate into big improvements on the big jobs.

P.S. Being able to edit your editor is a HUGE benefit too. My company wants us
to keep detailed track of our time-spent on each project. So I added a hotkey
(F5) to input the date/time-stamp whenever I start/stop a task.

Consider this analogy, nobody needs to modify their .bashrc file or create
custom aliases. But look at how much you suffer when your customizations are
not there. You don't need to use anything more then nano, but the improvements
scale exponentially when you do.

~~~
wodenokoto
> vim can be configured to convert your tabs to spaces and all pain is ended
> in the universe.

Every editor more advanced than notepad can be set up to do this.

Personally I don't want to do this for every single text file format I might
come across.

Being able to add weird, personal features does sound cool though.

------
golergka
When I switched to Vim, I was at 1/3 of my usual productivity for the first
week, and I think at about 1/2 for the first month - author is completely true
about that. However, since then, I've been so much more productive over next 7
years that it had definetly been a good decision.

And I don't even use Vim now! Visual Studio, VS Code, all JetBrain editors
have competent vim emulation plugins, so the core of my ehnanced productivity,
the core and most important feature of Vim, is still paying off.

I just wish I had a spare year to learn and configure Emacs. (Yes, I have
tried Spacemacs and other options, many times, and it was so confusing every
time that I only believe in learning Emacs from absolute basics withut any
plugins now).

~~~
nineteen999
Wait, VS/Code both have vi emulation plugins? I wish I knew this a couple of
years ago ...

~~~
golergka
Any modern editor with a decent plugin ecosystem has one, and while VS/Code is
not ideal, it's certainly workable.

~~~
nineteen999
Good to know, thankyou. I usually only use VS on Windows for C++ with Unreal
Engine, usually I'm a Linux/BSD minimalist who uses vim.

I wonder how well the vi plugin for VS works alongside Visual Assist X, which
is the only plugin I currently use for VS. I'll have to give it a shot when I
get some time.

~~~
golergka
Never used Virtual Assist X, but the plugin for VS (not VS Code, just the good
old VS) is one of the best Vim plugins out there.

------
raverbashing
> To those who would say "that's obvious; of course you learn vim
> incrementally", I would simply say that having spoken to a number of vim
> users in the past, I never got that advice. Instead, I got a lot of advice
> about turning off my arrow keys, disallowing the use of the mouse, and
> learning the (MORE EFFICIENT!!!) vim ways to do everything, all at once

Ugh, this.

Arrow keys have been invented for a reason, they're good and intuitive and
there's _absolutely nothing wrong_ with using them. Same with the mouse.

The "pure" VIM ways are more efficient than ed. They're maybe more efficient
some 10% of times you actually need some specific thing. But they're not
better than a visual editor.

~~~
Lio
"Pure" vim supports cursor keys, mouse, windows, syntax highlighting, fuzzy
searching for files, filetree and a whole host of other features without the
need for plugins.

In what way is Vim not a "visual editor"?

The main problem with using Vim is that you will spend a bit of time
explaining to those that don't know it very well that it's actually perfectly
capable of doing the thing they are using as justification that you should
switch to their current favourite IDE/editor... :P

------
Pimpus
Learning a good editor is an investment. You sacrifice some productivity and
time now for a massive return on your investment later. Stating the obvious, I
know, but so is this article.

~~~
megous
True. I was using mcedit for quite a while, until I one day had a short
contract with one of the better known Czech programers and saw vim in action
in skilled hands. It looked like magic.

I started learning it shortly after, despite being in time press at the time.
It helped immensly. Just navigating around the code was amazing. Macros,
repetition of the last edit action, increment/decrement a first number after
the cursor, block editing, lot of tiny stuff that is just so good when
combined.

I even wrote a bunch of vim code to help writing GObject C code, when it was
still boilerplate heavy back in 2006.

------
YeGoblynQueenne
>> Turn off your arrow keys.

This has gotta be the worse piece of advice I've ever heard in my life, second
only to "why don't you march towards my line?" [1]. I've been using Vim for
umm, eight years? Thereabouts. I never turn off my arrow keys. How much time
are you supposed to save like that? Milliseconds? You go much faster with B,
E, Crl+Y, Crl+D anyway.

Just misguided advice from otherwise well-meaning folks, that's all.

Edit: btw, how do you go through your recent command history on vim without up
and down arrow? Do you have to q: and navigate with hjkl every single time? Is
that more productive than pressing up arrow three or four times?

_____________

[1] Sorry guys, Warhammer Fantasy Battles reference there. See, I got a shooty
Dwarf army, he's got a shooty Empire army, so we're standing just outside each
other's range and scream insults at each other. His light cav mauls itself on
my Slayers trying to flank my Thunderers (yeah, I don't know what he was
thinking, either). He's got a Steam Tank, but I got a Lord on a shield (with a
metric shitton of runes) protected by a regiment of Ironbreakers (with a
metric shitton of runes) on the Tank's side. So noone's going anywhere in a
hurry. So, by way of friendly advice, he says "why don't you march towards my
line?". Yeah, right. So your Sniper can pick out my Lord and your Tank and
Knights can sanswich my guys? You kiddin'?

Btw, he did win anyway. It turns out you gotta make _a lot_ of saves against a
well-designed Steam Tank. Also, I suck at aiming artillery. But, come on.
"Walk towards my line"? Do I look like an Elf or something?

~~~
OskarS
I read that piece of advice when I started using Vim, and I'm very happy i did
exactly that. If you're skittish about using Vim in the first place, then
sure, it's a pretty bad idea to tell someone to disable arrow keys, but for
someone that's determined to learn how to use Vim, it's great advice.

The point isn't to save time (though using hjkl does that for sure), it's to
make sure your hands never leave the home row, which they ideally shouldn't do
very often when using vim. It makes them more natural to use for composition:
"c3h" is much cleaner than "c3<left arrow key>".

Also: if you become an "intermediate/advanced" user, you use these keys much
more rarely anyway: I use "w" and "b" far more often than "h" and "l" to move
inside of a line, as an example. Breaking your dependency on arrow keys makes
this transition easier.

Besides, it frees up four arrow keys on your keyboard up to do all sorts of
fun stuff with! I have mine bound to switching windows (so "left arrow key" is
moves focus one window to the left), and with modifiers they create window
splits. Makes using windows in Vim a breeze!

~~~
YeGoblynQueenne
Thanks - bu I don't get the "never leave the home row" point. My fingers
constantly leave the home row- to press backspace, to press Alt-tab, to press
Fn and a function key to turn volume or brightness up or down on my laptop, to
scratch my nose, to grab my coffee cup etc etc.

Anyway if you've bound your arrow keys to switching windows (and if you're
anything like me you have a two or three windows per tab, and a bazillion of
tabs, open at any one time) then your fingers do leave the home row to go to
the arrow keys anyway. So what's the point?

So, sorry but I don't agree that most users would save any significant time
with disabling their arrow keys. Perhaps some users would - but that should be
left to each individual user. Me, I'm used to navigating around lines with the
arrow keys, I abhor hkjl navigation (I even use the arrow keys on my numpad in
Nethack) and I'm perfectly comfortable using vim as my only text editor since
2011 or thereabouts, when I first picked it up.

~~~
OskarS
The idea is that your fingers should leave the home row as little as possible
_while editing_. I'm not saying that you should glue your hands to your desk,
I'm saying that while in the flow of editing, your hands should remain in one
place.

Regular typing provides an instructive example here. Try typing a long
sentence right now. If you're a touch typist, you can notice that your fingers
very rarely leave the home row. Even if you're pressing shift or enter, you
can basically just stretch your hand a little bit, but you can reach all the
letter keys and the spacebar without moving your hands. You get into a flow
where your hands remain basically fixed and the typing just flows out of you
very comfortably (I'm doing it right now).

However, if you decide you need to use the arrow keys, you need to move your
right hand quite a distance, and it interrupts the "typing" flow. Keyboards
are designed to make this comfortable, that's why there's those little nubbins
on F and J so that you always know where your home row is and where your hands
are inside of it.

One of the ideas with Vim's editing commands is that editing text should
become as natural as typing text is, since that's what you're doing most of
the time as a coder. Imagine typing regularly and having to move your entire
right hand every fifth keystroke. It would be pretty terrible.

I can personally attest that it works, and that I've very glad I rid myself of
those arrow keys for regular editing. Moving to a different window doesn't
happen in the middle of the "flow" (just like Alt-Tab, or changing volume or
whatever doesn't), so it's fine to use them for that.

I can tell you're pretty set in your ways of how to use Vim, and that's fine:
if you want to use the arrow keys, go ahead! There's no law against it, use
Vim however you like. But what you're saying is essentially "all those people
who say it's helpful not to use the arrow keys are lying or delusional!" I'm
here to tell you that we're not. It really does work really well for us.

------
pesarkhobeee
One of the possibilities for people who already used sublime or vscode is
giving a try "Oni Editor", it is based on neovim and Also have a really nice
tutorial section which you can collect some achievements :
[https://github.com/onivim/oni](https://github.com/onivim/oni)

------
roland35
The best part of learning Vim is being able to load it into almost all IDEs
such as Eclipse and VS Code. Even though those implementations are incomplete
and slow versus stock vim, it makes navigating and modifying text much easier.

I just wish there were better guides managing plug ins for Vim in Windows! I
have trouble with the new Vim 8 plug in system.

~~~
ShteiLoups
You could install WSL and have native VIM in bash in a distro, with the normal
Linux package management solution.

~~~
monadz
I have tried this, and it was very slow. I have had better luck with gvim or
neovim-qt

------
meuk
Vim is quite nice, but also quite... old-fashioned?

I use vanilla vim as my main editor. Today I had to search for some text
verbatim, and I don't think there's a way to do this in vim: It treats
everything as a regex. I'll also happily use mouse support, and really _hate_
the bad support for the clipboard in vim. I have spend multiple afternoons on
getting this to work properly and it still doesn't. So sometimes you just have
to take your loss and use another editor for something.

~~~
ej12n
treats everything as a regex by default but you can turn it off easily...
/\Vwhatever... see :help \V

you can also use \< and \> (beginning of word, end of word) for easier phrase
matching... /\<my phrase\>

------
ptah
ok, i'll bite: you need to learn vim if you are ever going to edit stuff
remotely on a vanilla unix/linux/bsd server

------
denton-scratch
I never knew you could use a mouse with vim. I've only ever used it in a
terminal session. I can't understand why anyone would use an editor designed
for a terminal if they have a GUI.

[Actually I mainly use vi, but I believe it's the same program]

~~~
grandep
Many people, myself included, prefer to work from the command line over
navigating through highly constrained, clumsy GUIs. For those people, an
editor designed for the terminal is a feature, not a bug.

~~~
denton-scratch
Point taken; I'll start a terminal to launch vi over using a GUI-based editor.

I like many of the Jetbrains editors; but for a small job, if I don't have
Idea running, it's quicker to launch a terminal.

------
kanokun
I switched to vim I was unproductive for days and frustrated. Then I realised
I don't have to go thorough this pain there are so many great IDE's out there.
10 years later I am still super productive and don't use vim.

~~~
noobiemcfoob
Vim isn't a silver bullet to productivity. Here's a parallel story:

I tried Emacs. I was frustrated and confused and felt stupid. Then I realized
I had so many other tools at my disposal, I'd just use those instead. Here I
am, 10 years later, happy and not feeling stupid at all! ...but I don't know
Emacs.

And don't feel compelled to offer my experience on Emacs other than I
struggled to learn it, but plenty seem to find it amazingly powerful. Good for
them.

------
badsavage
vim is still the best text editor, our whole family uses it for daily work

~~~
xtiansimon
Haha! I love it! Family that VIMs together...

------
Zelphyr
I've been using Vim for over 20 years yet every time I read an article like
this I learn something new. How did I not know about `ci "` until now?!

------
collyw
I can do the very basics of VIM (like exit it).

Can anyone tell me what I would gain over Pycharm (when most of my work is
done there) as the learning curve seems steep?

~~~
kace91
As for what do you gain, it's basically the same jump as copypasting by using
ctrl+c/ ctrl+v vs. using your mouse to go to the top bar and clicking edit->
copy then edit->paste.

What I mean is that it's one of those computer skills that, after you learn
it, even watching over the shoulder of someone who doesn't use it is painful.

As for vim vs pycharm, I wouldn't advise to switch. I would advice to find vim
emulation for your current editor (vscode's is superb).

------
ptah
flame bait

~~~
seren
The content of the article itself is not that shocking, it only says instead
of learning all commands & tricks at once, it recommends to learn gradually.

~~~
jplayer01
I assume he means the title. It's clearly clickbait at the very least.

