
Vim: Takeaways from One Year of Typing - sankho
http://sankho.github.io/web_log/2015/08/02/vim-8-takeaways-from-one-year-of-typing.html
======
DarkTree
The thing about Vim is that I cannot imagine creating it and thinking, "This
will be much faster and easier than a mouse eventually". But, I also wouldn't
think that I could learn how to type fast without looking at the keys if I
just stumbled across a keyboard, but both are undoubtedly true. Like anything
physical, it requires practice and muscle memory. Would you rather go back to
looking at every single key to type? That's how vim users feel about regular
text editors. Try it out.

~~~
ethanbond
Doesn't vim (or similar schemas) predate the mouse?

~~~
farresito
Yes, it does. Well, actually vi, which is its predecessor.

------
farresito
vim overhyped as an editor? It might be overhyped as a programming tool (you
won't write 2x the same amount of lines in a day; you will not be 5x more
productive), but as an editor, it deserves every single bit of hype that it
has.

No other editor stands next to vim. A lot of people dislike editors. It's
fine. There are a million tools out there that help people become more
productive programmers. You might enjoy IntelliJ or you might not. You might
like cscope or hate it. Tt doesn't matter. One needs to find the tools that
helps him in their day to day job. But if you need an editor, vim is no doubt
the single best out there.

~~~
melling
The great think about VIM is that it lets you do the same about of work with
less effort. Over your lifetime, you might type half as many keystrokes to do
the same amount of work. Look at VimGolf and the following video to see what I
mean.

[http://www.vimgolf.com](http://www.vimgolf.com)

[https://vimeo.com/53144573](https://vimeo.com/53144573) \- Precision editing
at the speed of thought

All editors should place an emphasis on minimal typing.

Emacs has a few cool precision features too:

[http://emacsrocks.com/e10.html](http://emacsrocks.com/e10.html) \- AceJump

~~~
farresito
The thing I appreciate the most about vim is not the fact that you can be a
little bit faster with a lot of things; it's the fact that you can edit code
for hours and you won't get tired at all. At least you won't get even close to
as tired as you would were you using a mouse. It's simply the least painful of
all the ways out there. I guess it's the main reason I use it.

Thank you for the links. I do use the AceJump equivalent for vim, and I have
it mapped to <space>. It's quite nice, actually :). The only difference is
that instead of pressing <space> and getting all the jumps available for each
word out there, I press <space> followed by two letters, and it jumps directy
to the word which starts with those two letters, or it simply shows me links
to words that start with said letters if there's more than a word starting
with those letters.

------
overgard
Here's the thing: when you're coding, how much time is spent on reading vs
writing? For me it's probably 90/10\. Since most my time is spent
concentrating on understanding code, the last thing I want is an editor that
forces me to consciously think about text operations. "d[downkey]4" might be
theoretically more efficient, but I spend way less cognitive energy holding
down the shift key and pressing the down arrow 4 times.

The other thing is efficient navigation within one file isn't super useful to
me. I spend most my time doing find-in-files or jump-to-definition or rename-
across-this-project. Vim kind of sucks for all those use cases. There are
plugins of course, but that just brings it up to par with popular IDE's,
except with a clunkier interface.

I say this as a person that knows vim well. If I'm SSH'd into a server and I
need to edit a config file, vim is the first thing I'll reach for, but for
coding, I'm pretty much only using it if I'm using a language that doesn't
have a nice IDE already.

~~~
savanaly
>Since most my time is spent concentrating on understanding code, the last
thing I want is an editor that forces me to consciously think about text
operations. "d[downkey]4" might be theoretically more efficient, but I spend
way less cognitive energy holding down the shift key and pressing the down
arrow 4 times.

The point is well taken, but don't forget that for most people that downside
of increased cognitive pressure goes away after a few days or weeks of regular
vim usage. I've been using it for about a year and all the combos I normally
use are second nature to me (and have been for months). Don't underestimate
the human brain's ability to grow and adapt and for incredibly complicated
things to quickly turn into routine.

For the record, I almost never use vim's much touted hit a number key then an
action to do it n times feature. I have modified it so j and k do the normal
down/up one line and J K go down/up seven lines or so for scrolling. [1] If
I'm doing something like deleting a line and have to delete a bunch (common
case), then I'll "dd" to delete line and then hit "." (which repeats the last
action) three or four times until satisfied. Way easier than counting the
number of lines to delete then typing "4dd" imo.

[1] Note for anyone who wants to duplicate this: it was still unbearably slow
to just hold down J or K to scroll because the default delay between
depressing a key and when OSX decides you are actually holding it down and not
just pressing it once is too long. Decrease it in the native settings of your
OS for a smoother experience.

~~~
overgard
I used it as my primary editor for two months, which IMO is more than enough
time to give to a project like that. I was efficient in it, but none of the
supposed productivity gains came about. On the other hand, in my IDE I can
control-click on a method name to jump to it, or hit ctrl-r to rename
something across the entire project, or hit alt-enter to automatically import
a symbol when I know the name of a class I want but I can't quite remember the
namespace it's in. Those things really do save me a lot of time; but the
efficiency comes from the development environment being able to understand the
code structure, not from being able to stack key commands.

If someone wants to use vim I'm not saying they shouldn't, I just think it's
vastly overhyped.

------
mixedmath
For what it's worth, the author (sankho) mentions that he uses other editors
for project-wide find and replace. This _can_ be done in vim too (although I
do not --- I'll return to this). You can check out the typically great
vimcasts post on this: [http://vimcasts.org/episodes/project-wide-find-and-
replace/](http://vimcasts.org/episodes/project-wide-find-and-replace/)

For whatever reason, I find it easier to use commandline tools to do large
search and replaces. I do embrace the vim-as-text-editor within the larger
Linux-program-composability philosophy, but I understand that not everyone
else does. So I use ack and perl, as mentioned in this StackOverflow post:
[http://stackoverflow.com/a/8744108/1141805](http://stackoverflow.com/a/8744108/1141805)

(Actually, sometimes I distinctly do things the _wrong_ way. I open a scratch
buffer, `:r! ls` to get my file names, restrict to those that I want, create a
macro that does what I want on the file under the cursor, and then repeat the
macro. I am not proud.)

~~~
olalonde
It's possible to run a macro on a list of files? I usually just open the files
one by one and @@:wq (oops)

~~~
rav
Yes, it's quite possible:

    
    
      :args *.cpp  " or any other list of files
      :set autowrite
      :argdo normal @@
      :wq

------
towb
The key to learning vim for me was to create my own vimrc from the ground up.
I decided to not add anything to that file that I didn't understand what it
was for. That and time. As long as you can open a file in vim, add a couple of
lines of code and save it, you're good to go. Just keep using it and that vim
magic will come to you ;)

------
JD557
> Relax! No other text editor has as many developers working on plugins than
> VIM.

What about emacs?

~~~
mixedmath
I thought this too when I read the article. Then it occurred to me that I
don't have any idea how many developers work on plugins for either. Looking
naively at github files by type is unreliable, since so many people do things
like keep their .vimrc and .vim files on github which artificially inflates
the number of .vimL repositories.

What I do know is that if there's something I want done, I suspect there is a
plugin that does it. So at least morally, there are sufficiently developers
for both emacs and vim (in my experience).

~~~
JD557
> What I do know is that if there's something I want done, I suspect there is
> a plugin that does it.

Maybe it's just my anecdotal evidence, but I've looked for alternatives to
certain emacs plugins used by my co-workers (such as org-mode and ensime) and
couldn't find a suitable replacement (I know there are some alternatives for
vim, but they pale in comparison to their emacs counterparts).

------
viebel
The great advantage of vim is that it forces you to use only the keyboard. No
mouse at all! Mouse is slow. Keyboard is fast (once you get used to it).

~~~
stephengillie
I've wanting to move keyboard keys onto the mouse for decades. The closest
I've got is with a Razer Naga Epic - the gaming mouse with the 12 thumb
buttons:

    
    
      F5    Up    F2
      Left  Down  Right
      Tab   Del   Backspace
      Enter Space ESC
    

This speeds me up greatly. Especially in mixed GUI/keyboard input situations.

~~~
lewisl9029
That's beautiful.

I might just get one to try out something similar. I'm thinking it might also
be useful to have a different mode on the mouse that have the buttons map to
keys on the numpad for calculations.

------
tachion
I've tried switching to VIM (from few years of using Sublime) few times
already, but failed every single time: bare VIM is too dysfunctional to my
taste and ways of working with text editor (missing tabs, file/folder treee
view, easy switching documents, easy visual copy/paste and so on, missing code
expanding/completion...).

Last time I tried spf-vim[0] but while it looked 'cool' (it has colors, it
does code completion, it somwhere have the folder/file tree view and maybe eve
tabs/panels...) yet it is overly complicated, quite badly documented (there is
no intro like tutorial on getting you up to speed with what you may want from
a text editor, just some strange sounding plugin list with few shortcuts here
and there) and overloaded with plugins I am not interested in (PHP related
ones) not to mention having few strange issues requiring googling and writing
additional configuration just to make VIM behave...

So, while I'd love to use VIM for its speed, the fact its easily portable with
the configuration and is available on almost every OS (BSD, Mac, Windows,
Linux, you name it) I still write 99% of my code in Sublime, and only use VIM
on servers to change this and that. Perhaps another time ;)

[0] [http://vim.spf13.com/](http://vim.spf13.com/)

~~~
nemild
One thing I'd stress: Start with Vim for side tasks, not to replace Sublime.
Once you have the basics down, you can then layer on the IDE features (addons
like Ag, NerdTree, CtrlP) that make Vim comparable to what you are used to in
Sublime.

I'm happy to act as a coach for you (and anyone else), if it's helpful. If you
have a good plan of attack, you can get Sublime-like functionality pretty
quickly.

~~~
deepaksurti
+10 to the suggestion to layer IDE features progressively.

My setup is after trial and error: vim + (nerd tree, command-T, tagbar, Gundo)
inside a tmux session. On another tmux window, I use 'find ... exec...' to
search. So far excellent for me, I feel Zen like coding with this setup with
no IDE noise :-).

------
homulilly
I use vim on a daily basis and think it's a great editor, but it's definitely
overhyped. Plugins in particularly are pretty disappointing if you're coming
from an editor like sublime. Off the top of my head, syntax checking, fuzzy
searching and multicursor options are all perfectly usable but very limited
compared to sublime's offerings.

------
kev6168
There is another element in using Vim that's not mentioned -- it's a super fun
journey, full of surprising discoveries, handsome rewards for a little effort,
and generally the happy experience in continuous getting nice things from a
seemingly inexhaustible source.

As an example, having used Vim for ten years, just within the last few weeks I
started to seriously learn and use Ultisnips, SkyBison, Vim-swoop, etc. It has
been pure fun and rewarding.

To be clear, I don't use that many plugins. Often time I discover something
already built into Vim proper which can replace a plugin (after some light
scripting/configurations), then I usually uninstall that plugin. This has
happened more frequently in recent years, possibly because of my improved Vim-
fu (still a mediocre user I am sure). So both productivity and portability get
improved while I am having fun learning new things.

------
jastanton
Does anyone know if Vim has the power of multi line editing / multiple cursors
like w/ Sublime Text? The large majority of my productivity involved copying
and pasting with multi line select, and jumping words and different boundaries
on multiple lines at once. Anything that matches ST for Vim?

~~~
Yzupnick
There is a plugin for that: [https://github.com/terryma/vim-multiple-
cursors](https://github.com/terryma/vim-multiple-cursors)

But I find that I can usually accomplish the same thing with macro or a
targeted search and replace.

------
chousuke
I don't actually program all that much, but I find that for text editing, vim
(or even vi) is hard to beat.

As a sysadmin, I appreciate the fact that some form of vi exists on _any_
vaguely unix-like machine I log into. Even without a .vimrc, the basic
commands for line editing and searching work and they match with tools like
less (or does less match vi?) and using vi has become second nature over time
because it's everywhere and it tends to be the default (I hate it when someone
makes nano the default $EDITOR so that eg. sudoedit doesn't do the right
thing)

I wish Windows servers shipped with vi, too. A decent text editor is the one
thing I consistently find myself missing. Notepad most definitely does not
count.

------
lewisl9029
Eventually, I'm hoping for some keyboard/mouse hybrid like this to catch on:

[https://www.kickstarter.com/projects/1666150716/keymousetm-t...](https://www.kickstarter.com/projects/1666150716/keymousetm-
the-keyboard-and-mouse-re-invented/description)

I didn't end up backing it though because I didn't want to dump $250 on a v1
product would likely have many issues to sort out. That and the ergonomics of
the typing didn't look that great.

~~~
anotherevan
Personally, I think this one looks better:
[http://www.combimouse.com/](http://www.combimouse.com/)

------
ixtli
I agree with everything here except the idea that you shouldn't start with
MacVIM. The main issue with new users getting into modal editors is the
learning curve. If you can reduce the upfront difficulty by accepting OS-
specific hotkeys and mouse events, why not?

Using VIM saves you time and a smart user will search out the ways the editor
can help her, but there's no value in making the user go cold turkey.

~~~
tthayer
The main problem I have with suggesting starting with MacVim is that using it
doesn't translate well when you're SSH'd into another system running a
different OS. I've been using Vim for a while (and now neovim) and recently
tried out MacVim and it just didn't make any sense to me. The menus are
totally non-intuitive if you're used to doing everything from the keyboard.
Conversely, I wouldn't expect someone who started by using MacVim to be
comfortable with the keyboard shortcuts either.

Opening up a virgin vim session on a new system kind of makes you realize how
much you'll miss out on if you don't know about :set number, :set wrap, :set
syntax <whatever>.

~~~
pyre
> The menus are totally non-intuitive if you're used to doing everything from
> the keyboard

You can disable the menus, and using MacVim doesn't require you to use the
menus. I use Vim 100% with the keyboard, and I still use MacVim.

------
chrisguilbeau
If anyone is looking for a good book on using vim effectively, this one is
great:

[https://pragprog.com/book/dnvim/practical-
vim](https://pragprog.com/book/dnvim/practical-vim)

------
amelius
Any tips on learning the internal configuration/control language? I've been
using vim for quit some time now (I like it a lot), but never have been able
to grok anything about it besides entering code :)

------
tygorius

      No other text editor has as many developers working on
      plugins than VIM. Virtually anything that exists in
      another text editor which isn’t mouse driven has some 
      very popular, very supported, very documented plugin 
      you can use.
    

And the Vim equivalent of org mode is what again? I'm a Steve Litt fan, but
Vim Outliner isn't even in the same league as org mode.

As a Vim user of many years I still believe it to be superior to emacs when it
comes to editing text. That said, emacs is a vastly superior programming
environment. And like many people I find org mode to be indispensible.

Happily, these things aren't either/or situations. I still use Vim for quick
text editing tasks, but for other matters evil+org mode lets me have the best
of both worlds.

Edit: typos

~~~
falcolas
> And the Vim equivalent of org mode is what again?

VimWiki:
[https://github.com/vimwiki/vimwiki](https://github.com/vimwiki/vimwiki)

Not 100% of the same functionality, but close enough for me as to not matter.
For the missing features, I have the rest of the OS.

------
imakesnowflakes
One year? That is like "Takeaways from riding a Superbike in first gear, for
one minute - Verdict. Super bikes are way overhyped!"

~~~
Karunamon
So let's assume that, by using vim as the primary editor as a coder, the
author used it roughly 8 hours a day for 5 days a week. That's 1,920 hours.

I daresay it's impossible for someone to not use a tool, however complicated,
for nearly 2000 hours and not become quite familiar with its operation.

This is also 1/5th of the (disputed) "magic number" of 10,000 hours to master
a skill.

~~~
segmondy
It's very possible to use a tool for a year or 10 and not be quite familiar
with it's operation. You have to actively make the effort to learn new things
to learn new things.

------
gernerz
SublimeText has a vim mode called "vintage" that allows vim commands to work.

~~~
pacomerh
Yeah, and its not as good. Try VIM's block selection in sublime, it doesn't
exist. Also, the whole point is getting your hands off the mouse, and sublime
still needs it.

------
iLemming
now you should try Spacemacs

~~~
mnazim
+1 for Spacemacs. Former vim user, now using smacemacs for past few months.

I found a number of things just work way better in emacs than in vim. For
example, web-mode was a revelation for me. I could never get vim to get syntax
right in mixed HTML-JS files.

Ability to edit very large files with ease was another one in favour of emacs.
Vim would freeze up for a seconds or two while saving even half a megabyte
file.

helm and family blew my mind away.

Another win spacemacs is it does not hide default emacs functionality. All
default emacs keyboard shortcuts would always work, so learning vanilla emacs
is still helpful.

Once I got to know spacemacs shortcut layout, it was surprisingly intutive.

(YMMV)

