
Vim after 15 Years - statico
https://statico.github.io/vim3.html
======
tonyhb
I'm an avid tmux+neovim user, too, though working with Reason is a lot easier
in VS Code. Making the switch from _actual_ vim to _fake_ vim (ie JS
emulation) sucks.

Recently, VSCodeVim merged #1725 to add _actual_ neovim as an editor - it's
using NeoVim's embedding API so you're using neovim to edit the text file
inside of VSCode's chrome, including all of VSCode's type hints and popups.
Info here:
[https://github.com/VSCodeVim/Vim/issues/1735](https://github.com/VSCodeVim/Vim/issues/1735)

There's an ongoing rewrite to make neovim also work with your existing .vimrc
file:
[https://github.com/VSCodeVim/Vim/pull/1897](https://github.com/VSCodeVim/Vim/pull/1897)

I'm really stoked that we get the best of both - for languages with first-
class VSCode support we don't have to decide between a half-baked VIM plugin
or using VSCode without vim... you get both!

~~~
chillee
To be clear (as the guy behind these efforts), what was merged was a PR to let
Neovim handle Ex-commands. This by itself was already pretty cool. In <200
lines of code, we were able to obtain full Ex-mode support, an aspect that had
already taken 2000+ lines of code for much more limited support.

The PR for full neovim integration is the one you linked. It's more than just
making it work with your existing .vimrc file: it's making it work with most
vim plugins, leveraging the neovim runtime to make macros run faster, etc.

~~~
tonyhb
Thanks so much, really, really appreciate it.

------
shabbyrobe
"The vim-surround plugin is so useful that it should probably be built into
Vim."

I couldn't agree with this more. Also undotree [1] should be built into Vim as
well. Vim represents undo/redo under the hood as a tree, which is absolutely
incredible once you have a plugin that unlocks it, but the built-in facilities
for traversing that tree could be charitably described as "dismal".

Vim's undo tree makes a solved problem out of the old "undo undo undo undo
undo... ok what did this file used to look like... redo redo y... oops did I
just press 'y' by accident instead of redo and blow away a bunch of my later
edits... next time I should remember to commit before I do that (even though I
totally won't)" situation, but without the plugin, it's effectively
inaccessible.

    
    
      [1] https://github.com/mbbill/undotree

~~~
unkown-unknowns
Clickable link for [1]

[1]: [https://github.com/mbbill/undotree](https://github.com/mbbill/undotree)

~~~
dmix
And [https://github.com/tpope/vim-surround](https://github.com/tpope/vim-
surround)

------
lillesvin
Interesting read, I've been using Vim for some 18 years myself and I was
completely unaware of fzf.

However, I'm curious if you know `rg` (aka. ripgrep):
[https://github.com/BurntSushi/ripgrep](https://github.com/BurntSushi/ripgrep)
In my experience it's markedly faster than `ag` (which is markedly faster than
`grep`).

~~~
octref
I work at VS Code and we recently switched to ripgrep for quick open and
search. Even searching in Chromium source takes only a few seconds. Pretty
impressive speed.

~~~
zild3d
off topic, but why do you say you work "at VS Code", isn't it "at microsoft" /
"on VS Code"?

------
lucaspiller
An interest plugin I've found recently (Neovim only) is Deoplete, which is
basically Ctrl-n on steroids. As you type, it shows a list of completions
without any kind of slowdown (on my 4 yo MBA). For some languages, such as
TypeScript, it even shows type definitions. It's close to being on-par with
the smart completion in IntelliJ.

[https://github.com/Shougo/deoplete.nvim](https://github.com/Shougo/deoplete.nvim)

~~~
Spiritus
There's a bunch of plugins like that, here's a couple of the most popular
ones:

\-
[https://github.com/prabirshrestha/asyncomplete.vim](https://github.com/prabirshrestha/asyncomplete.vim)

\- [https://github.com/lifepillar/vim-
mucomplete](https://github.com/lifepillar/vim-mucomplete)

\- [https://github.com/roxma/nvim-completion-
manager](https://github.com/roxma/nvim-completion-manager)

\-
[https://github.com/Valloric/YouCompleteMe](https://github.com/Valloric/YouCompleteMe)

~~~
auscompgeek
You missed
[https://github.com/maralla/completor.vim](https://github.com/maralla/completor.vim)
\- one of the first async ones targeting vim8, later gaining neovim support.
It doesn't look like it's easily extensible though, aside from using
omnicompletion, which negates the async benefits.

Note that mucomplete isn't async, it's intended to be simple.

------
snarfy
I've been using vim about 20 years now.

Maybe I'm weird but I don't use any plugins. When I want more than what Vim
does I use something else. Autocomplete, find usages, etc? I'll use an IDE for
that. When I need to refactor a 500MB text file without hanging my machine,
I'll use vim.

~~~
falcolas
> I'll use an IDE for that.

These are usually attempts at reducing the need for IDEs, while keeping the
familiar vim editing. With no exceptions so far, no IDE plugin (or emacs
plugin, for that matter) has been able to emulate vim editing well enough to
replace vim as my primary editor.

Perhaps when neovim (or anything else) is able to give me native vim
capabilities in a more extensible or powerful editor, I'll switch. But we're
just not there yet.

~~~
ghjnut
It sounds like you haven't given it a whirl. I've been on neovim for about
about 3 years now after 5 years of native vim and it's been a complete drag-
and-drop.

~~~
falcolas
Sorry for the confusion, but I'm talking about moving out of the vim ecosystem
into Visual Studio or one of the Jetbrains IDEs or Eclipse when they can
integrate an actual vim environment; not about moving from vim to neovim.

------
regulation_d
tmux send-keys is fantastic. I recently added a shortcut to run the test that
my cursor is on in a different pane.

This changed my life.

I thought I had to decide between having a separate pane to run my tests in
and having a convenient and precise way to run to exactly the test or test
file I want to run. But because of send-keys, I can have both!

~~~
hyperpallium
Sounds cool! Could you share that shortcut please? I'm _sure_ I could work it
out, but there's always a bit of trial and error, and looking up docs without
knowing the name in vim (for me, anyway).

~~~
regulation_d
For sure! There was definitely some trial and error as I was writing it. :)
The specific use case I have is for running Elixir tests, but I'm sure
adapting it wouldn't present too much of a challenge:

[https://gist.github.com/ddresselhaus/98b022e295bc27e9264dece...](https://gist.github.com/ddresselhaus/98b022e295bc27e9264dece7823e74e8)

I haven't done a ton of Vim scripting and found this resource to be super
helpful! [https://devhints.io/vimscript](https://devhints.io/vimscript)

------
rav
I would not remap , and ; as the article suggests, since those keys are
already used in Vim for repeating f/F/t/T.

~~~
Graziano_M
I have not heard any good argument for a leader key better than <space>.
<space>f, t, b for fzf (and t is not a stretch on my keyboard layout)

~~~
grive
The only thing preventing me from using <space> is the slight lag it introduce
each time <space> is used in insert mode.

It is bearable with ',', but I cannot stand it with <space>.

If it is possible to remove completely this lag (not simply reduce it), then
it would be awesome.

~~~
lucidstack
Apologies if this is incorrect (on my phone atm) but I've been using <space>
as leader for two years now, and have never ever noticed lag in insert mode.

Perhaps it's a setting you have enabled/disabled, or unrelated to vim?

~~~
grive
This lag is introduced by vim, to wait for the next keys and see if you are
actually inserting them or using mapped key sequence.

It is configurable in vim, but then either you have a lag and you are able to
use your key sequence, or you don't and <leader> sequences cannot be used.

So maybe I have something configured that sets it wrong, but I do not see how
to reconcile both things.

~~~
robenkleene
Unless you’re deliberately enabling certain key mappings in insert mode, then
yes you’ve configured something wrong. And if you have deliberately enabled
these bindings, you’re probably misunderstanding Vim.

The whole point of Vim’s normal mode is to free up “modifier-free” key
mappings for commands rather than inserting characters. So by extension, using
“modifier-free” key mappings for commands in insert mode is a Vim anti-pattern
(if you want custom mapping’s in insert mode, use mappings for them with
modifier keys).

Regarding your issue, I suspect your defining your bindings with the `map`
keyword when you should be using `nmap` (or better yet `nnoremap‘).

------
ujal
For people working on smaller screens Golden Ratio is a godsend -
[https://github.com/roman/golden-ratio](https://github.com/roman/golden-ratio)

------
TheYumasi
As a former Vim user I'm happy to see a post like that ! Some old problems
mentionned in the post like asynchronous processes mostly, but also the lack
of smart indentation with the TAB key that also takes into account the type of
file you're editing really drove me out of Vim. I've since switched to Emacs
(with Evil mode because modal editors rocks), and I haven't looked back since.

~~~
colordrops
Smart indentation in VIM has been solved by plugins for a long time now.

------
incomplete
Vim, apparently, is the new emacs.

/me ducks and runs out of the room

~~~
eadmund
That's what I don't get: for years, vi (and vim) mocked the emacs community
(with some justification) for throwing everything and the kitchen sink into
our editor. We were building an entire operating environment, while vi was
providing a nice, solid, fast text editor.

But with vim & neovim, people are building a complex operating environment in
a terrible language, and ignoring the man-centuries of effort which have gone
into emacs.

Why not just switch over? In what ways is a tricked-out vim or neovim
preferable to emacs? In what ways is tricking out vim or neovim preferable to
emacs?

~~~
nextlevelwizard
I've given emacs 3 tries. First just main emacs, then with Evil mode, and last
time as Spacemacs. Every time the issue is the same: there is won't be any
significant improvement to justify the re-learning curve of everything.

Imo fuzzy finding and git plugins isn't a huge stretch for a editor. I still
wouldn't like to read my email from vim.

~~~
reirob
I'm using Spacemacs with evil mode only for note taking and work tracking with
org-mode. For the rest I'm still using Vim, but the org-mode was for me
absolute worth it - now doing it for almost three years. Still for development
still using Vi(m), because it's on every (remote) machine, is so much more
responsive. Just to say, org-mode alone is worth emacs with evil mode.

~~~
eadmund
> Still for development still using Vi(m), because it's on every (remote)
> machine, is so much more responsive.

Try TRAMP, which enables you to edit remote files in a local (spac)emacs (and
also local files with sudo or su). It's pretty awesome.

------
tombh
I made a Vim plugin to use 'normal' sublime/atom-like keybindings:
[https://github.com/tombh/novim-mode](https://github.com/tombh/novim-mode)

I have an almost identical setup as that described in this post. Being in the
terminal and integrating with tmux is a wonderful environment - lightweight
and immersive. And all these Vim plugins are of such good quality - are Vim
plugin authors perhaps of a different, geekier, ilk? So it's a shame that
vanilla Vim is restricted to its special modal editing paradigm, there's so
much more to it than that.

BTW I post this on HN everytime I see a gushing Vim thread, apologies if
you've seen it before.

PS I'm also working on refactoring my tmux keybindings that do a similar thing
- SHIFT+ARROW to select, CTRL+C to copy, CTRL+D to select the current word,
etc, etc.

~~~
dotsh
Many newcomers using your plugin will have a huge problem when using vanilla
VIM. The same problem exist with Spacemacs, Spacevim or other weird things.

If someone don't want to use VIM modal editing why not to stay with
Sublime/Atom/VSCode or any other editor? They also have very rich plugins
ecosystem. Not mentioning that Sublime is like crazy fast...

To clarify it's not an attack on anyone. For instance evil mode in emacs is
also a heart breaking plugin for me. Every editor is made for different
workflow, why on earth mix them up? And in most cases it does not work very
well.

~~~
icc97
I agree that you can't just use all the old keys otherwise you'll never learn.
But what I am looking for is kind of a translation guide from ST to Vim.

For Vim learners I really think that GVim is a great tool because eg it
doesn't do bad things when hit some keys you're used to with muscle memory
such as copy/paste and Ctrl+arrow.

It has dropdown menus with the commands on so you can learn from them.

Once you're comfortable in GVim it's easy to switch to regular Vim.

Plus I use it on Windows as handles fonts and syntax highlighting better.

------
dmix
I spent forever tweaking my plugins, now I just use SpaceVim and love it.

[http://spacevim.org/](http://spacevim.org/)

The default settings required very little changes for me and I've adjusted to
their (clever) default key shortcut scheme.

------
dagi3d
I'm so in with fzf. I discovered it recently, after using CtrlP for several
years and I couldn't be happier. maybe there was a workaround, but with CtrlP
I had to clear its cache everytime I added a new file to be listed in the
search results. With fzf it just works out of the box and it's blazing fast <3

------
santix
Obligatory video:
[https://www.youtube.com/watch?v=XA2WjJbmmoM](https://www.youtube.com/watch?v=XA2WjJbmmoM)
\- _How to Do 90% of What Plugins Do (With Just Vim)_

------
afarrell
Does anyone know of a good approach to debugging .vim files? I've not been
able to find an interactive debugger or really even a good source of
information about the program model of the vimscript interpreter.

------
monkmartinez
Problems with macOS and iTerm2... that is too bad. I am going to do a 30 day
challenge with a Thinkpad from Costco next month. Full linux install with
Ubuntu 17.10!

I have wanted to try i3wm for as long as I can remember. Unfortunately, it is
a PITA to get working on a VM with the Mac as the key chords don't play nicely
intersystem. Super excited to give it a go... what is awesome is that I can
have an IDE like Pycharm right next to VIM and my shell in a tiling window
manager with Linux. I hope I can ditch macOS...

~~~
jingwen
Switched to i3 a few weeks back and I absolutely love it. Switching between
applications and workspaces is incredibly fast, and the _only_ time I need the
mouse is for web browsing. It's amazing.

~~~
suprfnk
Firefox? Check out something like VimFX. No need for the mouse on 80% of the
webpages.

~~~
majewsky
Unfortunately, it'll also be obsolete in a few weeks when Firefox 57 comes.
I've switched to Saka Key, but it's not yet a viable replacement (esp. because
clipboard interactions are broken in FF 56 on my Linux systems).

------
cup-of-tea
> TextMate and Sublime Text showed us that the fastest way to find a file is
> by fuzzy finding

Stopped reading here. This is from emacs and those other editors copied it.
Emacs had this in about 1996, a full decade before those other editors
existed. Oh, and the emacs versions are way more flexible than fzf due to
supporting tab completion as well. All this other stuff has been in emacs for
decades as well.

I know about the Holy War etc.. but seriously, credit where credit is due.

------
Philipp__
I was split between using Emacs and Vim for last 2 years (I used Vim for last
6, and learned Emacs 2 years ago). But what made Vim my main editor is fzf and
ag, and smooth workflow that I had in terminal. But I have to say, ivy and
counsel made my Emacs experience much, much nicer. But I guess that I got too
deep into Vim already that I kinda got used to it so much, that I appreciated
more that "terminal" workflow.

~~~
criddell
> I was split between using Emacs and Vim for last 2 years

You're going to have to pick a side. You can't be an atheist that dabbles in
Catholicism.

~~~
majewsky
A friend of mine is an avid Spacemacs user (which, as far as I understand, is
a Vim distribution running on Emacs or something like that). He has both a Vim
and an Emacs sticker on his notebook next to each other, and they've been
carefully applied so that they overlap each other both ways.

Some men just want to watch the world burn.

~~~
jaux
I had tried spacemacs for a few months, it was nice overall, but everything
seemed to be a little bit slower there than in vim, so I eventually switched
back to vim.

------
chewz
Regarding buffers in Vim I am fond of using vim-workspaces plugin.

With Tab mapped to :WSNext (and C-Tab to :WSPrev) I can see all open buffers
and cycle through them. And close unnecessary with :WSClose.

[https://github.com/bagrat/vim-workspace](https://github.com/bagrat/vim-
workspace)

~~~
icc97
FZF with `:Buffers` gives you a fuzzy search on your buffers. Plus there's
unimpaired which gives `[b` and `]b`.

I did try to get tabbing through buffers working and yours looks like a good
solution, but I find my buffers are rarely next to each other.

------
hyperpallium
I had another pane autorunning something when it detected src file changes
(inotify). So you just :w, and it happens.

The method in this blog could do this: just add :w to the mapping. The blog
method might seem hacky in using up and enter, but this makes it easy to
modify the command you want to run.

~~~
flukus
Lately I've been going the other way, from a complex vim setup to using the
terminal and tools like inotify, tmux, and bash, so far I've found this a much
better solution. Keeping my vim configuration and plugins synced between
environments (windows, cygwin and linux) was getting to be a compatibility
nightmare.

I also wanted to try using kakoune
([http://kakoune.org/](http://kakoune.org/)) but found that for day to day
stuff I was far to reliant on my vim setup. Since beomming more reliant on the
shell this is now more feasible and I've got a lot more flexibility.

~~~
sevensor
Highly recommend kakoune. I've been using it since January or so, and its
selection-oriented approach is really nice. I was a heavy user of visual mode
in vim, so switching to kak, which has a much richer notion of selections, was
a breeze.

------
nunez
I avoid using too many plugins because the biggest advantage of using vim is
its ubiquity on every *nix and BSD-based OS. I don’t want my workflow to
become reliant on things I might not be able to use. Also, vim on its own is
really damn powerful.

------
dghf
If you're going to use buffers (which you should), make sure to

    
    
        set hidden
    

otherwise you'll get an error message when you try to swap to a different
buffers when you have unsaved changes in your current buffer,

~~~
Walf
Great for helping lose unsaved changes, too.

~~~
dghf
But the whole point of 'set hidden' is that the current buffer is hidden
(rather than unloaded/closed) when you switch to a different one, so there's
no prospect of losing unsaved changes -- unless you :qa! without checking your
buffer list first.

------
philippeback
Amen to tmux+vim. Best combo, especially when doing things on remote boxes.

------
ryanpcmcquen
Still awesome.

------
eradicatethots
Vim is the best lightweight single file editor there is. That’s all it should
be. If you’re heavily configuring it, you should be able to answer “why is
this better than an ide?” Without saying “vim makes me cool”. Also, if you can
answer that, please let me know! To me, an IDE is better for everything but
what default vim is good at.

And if you tell me that typing is faster, please also tell me why that’s
relevant!

~~~
oelmekki
> And if you tell me that typing is faster, please also tell me why that’s
> relevant!

Clearly the less understood thing about vim. People keep thinking this means
"typing more words", while what it means is "having the change you have in
mind faster on your screen". It's not about writing more code, it's about not
having your code lagging compared to your brain.

Anyway, to me, this is not even the best feature of vim. The best feature is
what vim creator mentioned : its ability to automate repetitive tasks,
possibly short living (with macros). It's easy with vim to convert a file
without writing a parser, just with macros. So yeah, I prefer to add IDE stuff
on top of vim rather than using an other editor.

~~~
eradicatethots
That’s true, vims automation is great. I’ve had some success with multiple
cursors in sublime text for instance, but vim really is the king here.

