
Vim After 11 Years (2013) - mparramon
http://statico.github.io/vim.html
======
btipling
I'd add to that to try and start using neovim. I've switched to it on Mac
without a hitch and we (Floobits) have already moved our vim plugin to use the
new neovim python-client plugin for much better async behavior. Making an
async plugin for NeoVim is pretty trivial, here's a clock in your status bar:

[https://gist.github.com/btipling/0d6faa80b24ccee5caea](https://gist.github.com/btipling/0d6faa80b24ccee5caea)

Note this requires +python, :he nvim-python for how to get that (involves pip
install neovim)

You can't do something like this clock in vim without the feed keys cursorhold
hack that breaks using leader keys. Otherwise I'm still using vundle and have
made 0 changes in my .vimrc other than move it all to .nvim and .nvimrc. All
my plugins and vundle worked out of the box.

~~~
sooheon
I had put neovim out of mind and settled for emacs/evil, but seeing an actual
use case for the new plugin system makes me hopeful for it's fast growth and
adoption.

~~~
teacup50
Remember that floobits are the people that threw a tantrum when upstream vim
wouldn't accept their patches, and have a vested ego interest in pushing a vim
fork.

~~~
avidal
Source?

~~~
StevePerkins
Eh... unless there's more to the story that I'm missing out on, I don't think
it's fair to say they "threw a tantrum".

Basically, that company has a service that lets developers do real-time
collaboration. Like working on a Google Docs document... except that it's for
code, and collaborators can all use whatever supported editors they like. When
they went to add support for Vim, they ran into problems with the "real-time
collaboration" part... because Vim is single-threaded and doesn't have a non-
blocking event loop:

[https://news.floobits.com/2013/09/16/adding-realtime-
collabo...](https://news.floobits.com/2013/09/16/adding-realtime-
collaboration-to-vim/)

So they kinda hacked together the means for a non-blocking event loop, and
submitted it as a patch to Vim:

[https://news.floobits.com/2013/09/17/adding-settimeout-to-
vi...](https://news.floobits.com/2013/09/17/adding-settimeout-to-vim/)

The Vim maintainers kept rejecting it, for different reasons each time. After
two months of back-and-forth, the Floobits guys asked the Vim guys to either
give a comprehensive list of things in the patch that need to be different...
or else acknowledge that they simply don't want the event loop thingy merged
at all, and that Floobits should move forward with their own fork of Vim
instead:

[https://groups.google.com/forum/#!topic/vim_dev/-4pqDJfHCsM[...](https://groups.google.com/forum/#!topic/vim_dev/-4pqDJfHCsM\[1-25-false\])

Personally, I don't have an opinion one way or the other on the merits of that
patch. However, I think the Floobits guys were justified in feeling frustrated
about the Vim guys dragging their feet and not being completely forthcoming.

Either way, if you do some quick web searching, you'll notice that Floobits
became pretty big fans and online promoters of NeoVim from that time forward!
So much so that you kinda have to take it with a grain of salt.

I'm not exactly sure what to even think about NeoVim. They've been plugging
away for over a year, their GitHub repo has over a hundred contributors and
two-thousand commits, and yet it's still pre-alpha? Also, the primary purpose
seems to be allowing people to write Vim plugins in any programming language.
However, it's not like the Vim ecosystem is hurting for plugins today.
Besides, the whole point of "vimscript" is that it's self-contained and baked-
in as part of the editor. Totally cross-platform, and always there. If I
install a NeoVim plugin, then I have to make sure I have the right version of
Ruby or Python or whatever on my box to support it? Yuck, no thanks.

As near as I can tell, any real value-prop for NeoVim is using it as an
embeddable component. Like the Cloud9 guys' cloud-based Ace editor
([http://ace.c9.io](http://ace.c9.io)), or as something that IDE makers could
bake into their desktop IDE apps. I don't really see what's compelling about
it head-to-head with standard Vim, assuming it ever fully ships.

~~~
ggreer
That is an excellent summary.

teacup50 has an axe to grind. See:

[https://news.ycombinator.com/item?id=7279358](https://news.ycombinator.com/item?id=7279358)

[https://news.ycombinator.com/item?id=7287939](https://news.ycombinator.com/item?id=7287939)

[https://news.ycombinator.com/item?id=7288699](https://news.ycombinator.com/item?id=7288699)

~~~
teacup50
You're the one whose bad patches were rejected, you just dug through a year's
worth of my comment history, and you're constantly and heavily promoting a
terrible-design-and-still-no-beta-even-after-a-year-and-a-lot-of-donated-money
fork of someone else's open source project ...

... and _I 'm_ the one with an axe to grind?

------
pmoriarty
_" It’s so useful that I’ve bound it to ; (and nobody remembers what ; does
anyway)."_

The original binding of ; is super useful, and I would argue it should not be
rebound.

; repeats the last f, t, F or T command.

There's also , which is the same as ; but in the opposite direction.

~~~
sooheon
I agree. I initially found many recommendations to bind "," as leader, and it
_was_ convenient, but after learning what ";" and "," do, I've changed my
leader to <space>.

~~~
lucb1e
What's a leader?

Googling some, it seems to mean a backslash in the vimrc... but I don't really
understand what you mean.

~~~
tsm
It's a way of namespacing commands—if you install NERDCommenter, for example,
<leader>cc comments out the current line (whereas cc by itself changes the
current line). It's traditionally bound to backspace, which is actually-free,
but many people bind it to keys that are free but never used personally.

------
agersant
I have a hard time understanding vim users. All the cool features listed in
this article exist in any modern text editor. I personally use Notepad++, but
I'm sure the same goes for Textmate, Sublime Text and many others.

The only advantage I can see in Vim over a modern solution is that it runs in
the terminal (which I guess is useful if you like to remotely modify files in
your production environment?). Is it that after they have spent so many years
learning the arcane controls, users feel obligated to stick with it in order
to justify all the time they've already invested?

I must say I've only spent ~2 months of my life using vim before giving up,
which I think is already pretty long for an evaluation. I have never
experienced or even witnessed the productivity gains you're supposed to get
from mastering vim. All I've seen is very unintuitive shortcuts for
Ctrl+Backspace advertised as unique features in the world of text editing.

I would be very happy if someone could point out to me the elephant that I am
not seeing here.

~~~
brandonmenc
Former longtime emacs (and previous to that, vi) user here.

vi and emacs seem like magic if you're coming from something like SublimeText.
Compared to modern IDEs like VisualStudio or IntelliJ products, however - not
so much.

vi users tout the rapid text editing features, but you can generate and
navigate code just as fast with an IDE - out of the box - no configuration
incantations or third party packages required.

Until very recently (early to mid-2000s), IDEs for open source web frameworks
were non-existent, unaffordable, or slow. Once you have a working vi or emacs
setup, there's a lot of inertia in place that discourages switching.

That explains the continued popularity of vi, imo.

~~~
mercurial
> vi users tout the rapid text editing features, but you can generate and
> navigate code just as fast with an IDE - out of the box - no configuration
> incantations or third party packages required.

You can navigate code and you benefit from powerful autocompletion (well,
depending on your language, because it may quickly degrade to "laughable" with
something a bit dynamic). However, the pure text editing experience with
vanilla Eclipse/VS is rubbish compared to Vim. In addition, there are
languages for which IDE-based code generation/autocompletion is not that
interesting due to the language being a lot more compact. And with something
like syntastic + the right language plugin, a strongly-typed language gets
syntax checking, a description of the type of a variable, and possibly
autocompletion. I use both Eclipse (with a Vim plugin) and the real Vim, and
it feels much nicer not have to deal with the resource and mental overhead of
a full-blown IDE. I think the only feature I really miss when working
OCaml/Merlin in Vim is being able to get a list of call sites of a given
function in the current project.

~~~
e12e
This. Java with a great IDE is like a half-assed Smalltalk environment (with
the notable exception that editing Smalltalk as text is trivially simple
compared to java). Java+IDE gives you a kinda-sorta-macros (were macros are
defined as code that write code - only the IDEs use some form of simplistic
text-replacement code-generating stuff, not true macros), and kinda-sorta
"smart" code (but you're not _actually_ modifying objects in memory via a text
view, like Smalltalk).

So the IDEs make it feasible to manage all the poor horizontal "abstractions"
(complections, really) with all the different files and paths and whatnot. But
they're much inferior to vi(m) for _editing text_.

Granted, if you don't do much _text editing_ (writing, modifying, moving lines
around) - the work you actually do do ("programming") - won't benefit much
from a great text editor.

I used vim for small java projects before inner classes (massive spill of
code/classes across files and folders) -- and it was pretty painful. When I
changed to use Literate Programming - and could easily _work_ on one file,
letting the system generate the arbitrary structure java needed -- things went
much more smoothly.

So, yes, YMMV - but if what you do is write/edit stuff that fits in a sane
text format, a great editor is a great help. If what you're doing is composing
objects from a large standard library of objects, you probably want an object
editor like a visual, image-storage (as in vm image) based system like
Smalltalk.

------
krick
There're things I agree or disagree on with author (for example, I still have
NerdTree installed, but find myself almost never using it, instead I use tree
-f in separate terminal window) but probably only one thing I'm still not sure
about:

I don't use buffers explicitly at all, only tabs instead, like in any IDE.
Sometimes vsplit. I even have custom mappings for ctags to open stuff in new
tabs instead of buffers. I treat hidden buffers as legacy needed mostly for
technical reasons. Yet I keep seeing other people using multiple buffers,
switching between them. So, should I reconsider, maybe? And why?

~~~
fsloth
I used tabs, but nowadays I don't seem to need them. One day I thought I could
try if I could survive by just using buffers, and apparently I do. Might
depend on the way you want to navigate the project and so on. For me
personally the most common buffer switch is between two or three documents at
a time and for those needs split windows are absolutely the best for me (which
removes any needs for tabs, naturally).

------
krick
> backslash isn’t bound to anything by default

Actually it is. That thing is called "leader" and is used exactly for the same
purpose as author uses backslash. So better way to write

    
    
        :nmap \o :set paste!<CR>
    

would be

    
    
        :nmap <leader>o :set paste!<CR>
    

Reasons to use "leader" are discussed more than once, so I'll leave reading
the docs/blogposts to you.

------
shocks
Why do you advocate using vim in a terminal?

I prefer unite[1] to ctrl-p[2], it's much more flexible.

1: [https://github.com/Shougo/unite.vim](https://github.com/Shougo/unite.vim)
2: [https://github.com/kien/ctrlp.vim](https://github.com/kien/ctrlp.vim)

~~~
swartkrans
I also prefer cntrlp, it's much more performant in my experience.

~~~
sooheon
This is true (something like junegunn's fzf is even faster than either), but I
think the tradeoff is between performance and consistency of interface. Unite
can provide the same interactions for recent files, buffers, file navigation,
grep results, etc.

~~~
tomjakubowski
You can do this with ctrlp too. The standard sources are files, buffer, and
MRU files, but it comes with extensions for things like the quickfix list
(grep results), tags, and scripts in the runtime path. You can also write your
own:
[https://github.com/kien/ctrlp.vim/tree/extensions](https://github.com/kien/ctrlp.vim/tree/extensions)

------
virtualwhys
I've found split windows and buffers in vanilla vim to be somewhat lacking --
CtrlSpace [1] and GoldenView [2] plugins are truly awesome enhancements. The
latter I wish I could have at the OS level, just incredibly efficient usage of
screen real estate, and the former makes buffer management a breeze.

[1] [https://github.com/szw/vim-ctrlspace](https://github.com/szw/vim-
ctrlspace) [2]
[https://github.com/zhaocai/GoldenView.Vim](https://github.com/zhaocai/GoldenView.Vim)

~~~
e12e
Not familiar with goldenview - but it looks like something similar could be
achieved with eg xmonad? Or are you not using Xorg and a tiling wm?

~~~
virtualwhys
I do use a tiling WM, just not Xmonad ;-)

With i3[1] you get split windows out of the box, but the splits are fixed by
1/2s (kind of a Russian Doll box model) that you can then incrementally resize
via hotkey by some percentage of your choosing.

That's different than GoldenView which automatically gives the _focused_
window the lion's share of screen real estate, thus providing a kind of
distraction free mode with the added ergonomic benefit of not having to crane
one's neck to left and right when working with split windows on a 27" monitor.

Maybe Xmonad, Awesome, and other highly programmable TWMs provide such
functionality (or are trivial to pull off), although haven't heard mention of
it (spent a couple of months with Awesome before switching to i3).

[1] [http://i3wm.org/screenshots/](http://i3wm.org/screenshots/)

~~~
e12e
Right. I generally just make do with fewer windows (typically Firefox with a
gazillion tabs w/vimperator, and a terminal or two, each running screen with a
few screens) -- so I rarely need to do much jockying around with windows. A
little more shifting around on my laptop (14"), a little more on my desktop
(20"@2048x1152).

I can see the need for more windows on a 27" (or 30") though. Maybe xmonad
with "Spiral" or "Spiral Golden Ratio" does something similar (although
probably not quite the same)?

[https://www.haskell.org/haskellwiki/Xmonad/Screenshots](https://www.haskell.org/haskellwiki/Xmonad/Screenshots)

Generally I just use a standard tiled layout, with 2/3 of the screen for the
"main" window (vertical split, works best on a 16:9/16:10 display), and bring
witch ever window I want there with alt+enter.

But then, I find that things that change "automatically" end up being
distracting (eg: relative line numbers in vim) -- so odds are we just have
different preferences.

------
krick
> Emacs has a useful mode which highlights hexidecimal colors in CSS and SASS

There's plugin for it in vim. Even several of them, as always. I don't
remember which one I used and if it was completely ok, but I can find
[https://github.com/skammer/vim-css-color](https://github.com/skammer/vim-css-
color) right away.

~~~
tuhdo
Emacs can highlight colors in ANY text buffer if you activate it.

------
statico
Thanks for reading! Don't forget to check out the follow-up to this article,
"Everything I Missed in Vim After 11 Years" \-
[http://statico.github.io/vim2.html](http://statico.github.io/vim2.html)

------
snarfy
The author mentions a lack of good smart completion, but if you use C# there
is omnisharp, which works quite well.

[https://github.com/OmniSharp/omnisharp-
vim](https://github.com/OmniSharp/omnisharp-vim)

------
TheDong
Another person who recommends pathogen... There's multiple better plugin
managers now including Neobundle and vundle... I find neobundle to be
unquestionably superior and well worth using.

~~~
jqm
Just curiously, what do you find superior?

pathogen loads the plugins which is all I need. Does Neobundle do something
else?

~~~
TheDong
Here's a vimrc that showcases some of its features:
[https://github.com/bling/dotvim/blob/master/vimrc#L324](https://github.com/bling/dotvim/blob/master/vimrc#L324)

Pathogen loads plugins, but it doesn't manage them. Neobundle lets me list
some plugins in my vimrc and it'll take care of installing them, updating
them, and even only loading them on filetypes where they're useful.

Pathogen does none of that and I find every one of those features useful. One
of the big ones, honestly, is just the simplicity of listing a new bundle in
my vimrc, syncing it to all computers, and having it deal with getting it.
Much better than syncing large git repos across computers.

------
eridius
Why is iTerm2 being suggested for OS X when the built-in Terminal.app also
supports 256 colors?

Also, I find MacVim to be a better experience than Vim in the terminal.

~~~
ChristianBundy
iTerm 2 has _way_ more options than Terminal.app, my favorite being the
ability to set your color scheme.

~~~
yen223
The killer feature for me is Hotkey Windows - I set it up so that pressing
Ctrl+Space from anywhere will slide out a terminal. So convenient.

[http://apple.stackexchange.com/questions/48796/iterm-as-a-
sl...](http://apple.stackexchange.com/questions/48796/iterm-as-a-slide-out-
terminal-from-the-top-of-the-screen)

~~~
klmr
To be fair, you can do the same for iTerm (or _any_ application, really) by
using other tools. Quicksilver, for instance, allows you to define system-wide
hotkeys.

------
to3m
Apropos of nothing in particular: a good way of spotting vim hipsters is that
they don't know what ; does, because they never used t or f. They do however
very carefully use hjkl to move around, because the cursor keys are for
squares ;)

~~~
function_seven
I remapped ; a long time ago (to ":", because I can't be bothered to hold down
the shift key) because I rarely need to repeat a t/T/f/F motion. I typically
already know how many times I need to invoke it (and use "3f)" for example),
or I use a quick "/" followed by a couple of letters in the word I want to
jump to.

~~~
hrjet
That's a great idea; never thought of it before. The only worry is that it is
not going to work on remote systems out of the box, confusing my muscle
memory.

~~~
function_seven
Yeah that's true. I have a lot of remappings and shortcuts in my vimrc file,
and I struggle a bit when I'm using vanilla vim on another server. Thankfully,
I'm usually able to snyc my ~/.vim/ and ~/.vimrc files to that machine if I'll
be using it for more than just a one-off.

But it is frustrating otherwise.

~~~
e12e
The main thing I've yet to figure out wrt vim is _good_ keybindings with a
Norwgian key layout. We have ø where ; lives, æ in place of ', no single (non-
shift ) [ and ] due to å. and a composing accent/single/back quote. Loosing
three full keys to actual letters is a though break ;) I know a lot of people
simply switch to a US layout, but it's not really a great solution when freq
uently also typing in Norwegian.

------
Gonzih
In my experience nerdtree is bad. You loose a lot of goodnes that splits can
offer you. Netrw or netrw+vinegar is more vim friendly way to do file
navigation.

