
Turning vim into an IDE through vim plugins - sds111
https://www.safaribooksonline.com/blog/2014/11/23/way-vim-ide/
======
59nadir
While I would never sell it as "turning vim into an IDE", I use most of these
plugins. ctrl-P is great, but I would probably switch to fzf if I was
bothering to update my vimrc and plugins lately.

Fundamentally, I think people trying to sell emacs/vim with plugins as "turn X
into an IDE" are sort of not getting what people see and get from IDEs,
though. There's quite a bit more integration that goes into IDEs and what
you're making is a pretty barebones/poor IDE with these plugins.

Most languages, though, don't need an actual IDE for them to be great. You
need the auto-completion, automatic compilation/error checking, jump to
definition, easy-to-reach documentation, etc., for them to instantly be super
productive while coding.

Spacemacs with Haskell plugins is one of the best coding experiences I've had
and it even taught me some patterns that I didn't know about. Another
highlight is OCaml tooling that works really great with both Emacs and vim.

~~~
rjzzleep
And what exactly is it that you're getting from an IDE?

You get refactoring, jump to def, auto completion, linting, code snippets,
documentation, depending on the languages you use. For Java there are more
lightweight alternatives which lack refactoring features that IntelliJ has,
but there has been eclim for ages. But that's using eclipse in the background
you say? Well, at some point you're bound to use a language native component
to use reflection.

What about Omnisharp? How was Monosharp an IDE and vim with Omnisharp
integration, which was based on the same components wasn't?

I feel like the discussion has degraded to peoples perceptions of what an IDE
should be. And for most people that perception is: "It should look like
IntelliJ" or "It should look like Visual Studio".

Maybe what you really mean is:

It should have refactoring.

It should have auto completion.

It should do performance instrumentation.

It should allow debugger integration.

And then there's the question of how far each feature has to be integrated.
For most IDEs performance instrumentation is really just a seperate tool that
you can launch form the IDEs toolbar.

~~~
contingencies
_debugger integration ... performance instrumentation ... really just a
separate tool that you can launch from the IDEs toolbar._

Which is actually awfully close in usability terms to <hotkey to next
terminal> \+ <full featured shell> # just sayin'

------
bechap
Having seen this article when I first started using vim seriously, I'd
recommend fzf.vim in place of ctrl-p and ALE in place of Syntastic. The former
I find is much more performant, and the latter takes advantage of Vim8 /
neovim's asynchronous features. Plus, fzf.vim comes with Ag, which effectively
replaces Ack.vim (albeit, with a little bit of tweaking).

~~~
javitury
That is the reason I chose neomake, because syntastic was dragging vim down.
I'm curious, how does ALE compare to neomake?

~~~
lloeki
Using ALE right now. By design: Syntastic runs synchronously on save, Neomake
runs asynchronously on save, ALE runs asynchronously as you type. Neomake is
good but I see no reason to go back from ALE which works brilliantly.

~~~
FBT
Neomake can do that too:
[https://github.com/neomake/neomake#setup](https://github.com/neomake/neomake#setup)

------
127
I tried very hard to get used to Vim. I just feel compared to something like
Visual Studio Code it's still very clunky.

I can understand why people who have used it for a decade prefer Vim over
other text editors. They already know how to use it and how to integrate it
into their workflow. For a newcomer this task, it seems, is nigh
insurmountable.

Are there people who recently got into it and think it's the superior way to
code and why?

For me, it was a lot of wasted time trying to learn Vim and finding out that
other editors that I already use are as good or better.

~~~
executesorder66
> Are there people who recently got into it and think it's the superior way to
> code and why?

I started coding with Visual Studio, and then later Eclipse. I like both IDEs.
I only learned about vi/vim about a year after I started programming, and it
looked intimidating.

2 years after that, I decided, fuck it, let's see if I can do this. It took me
one day to learn how to comfortably navigate with the hjkl keys, as well as
how to copy/paste and save/exit. Which was all I needed at first. Over the
next two weeks I learned a few more things that you could do, and I never
looked back.

It wasn't difficult at all to learn vim. The only thing that I can think of
that would make it difficult to learn, is if you don't know how to touch type.

As for why I think it is superior:

The . (repeat) action is so insanely useful and saves you so much time.

Most actions are blazingly fast compared to a gui text editor. e.g. To delete
a whole line just press dd instead of home + shift + end + delete

Memorizing all these shortcuts is easy, becuase they are based on a 'grammar'
that makes new command combinaitons easy to guess.

There hasn't been one feature that and IDE has that I used, which can't be
achieved in vim (or via a plugin)

vim doesn't take up crazy resources, and is installed on most systems by
default anyway. And the startup time is almost instant.

~~~
rootlocus
> Most actions are blazingly fast compared to a gui text editor. e.g. To
> delete a whole line just press dd instead of home + shift + end + delete

Ctrl + X works on most 'gui text editors'

> There hasn't been one feature that and IDE has that I used, which can't be
> achieved in vim (or via a plugin)

How does "find references" work in vim? If i want to find all usages of a
method called "getName", does it know how to differentiate between calls on an
object of the class I'm searching from, or usages from all classes that have a
"getName" method (aka dumb text search)?

~~~
executesorder66
> Ctrl + X works on most 'gui text editors'

Really? Even if you haven't selected the line? Because if you haven't selected
the line then you'll have to use your mouse first or do the home + shift + end
+ Ctrl + X to delete the line.

I remember Ctrl + D does this (without needing to select the line) in Eclipse.
But it's still faster to type dd than Ctrl + D

> How does "find references" work in vim?

[https://stackoverflow.com/a/9616315](https://stackoverflow.com/a/9616315)

~~~
user5994461
Ctrl + D is delete the line on some editors, duplicate the line on some
editors. Prepare to be surprised when trying to to use it across environments.

Ctrl + X is the shortcut for cut (as in cut then paste). It cuts the current
selection. It doesn't auto select the line if there is no selection.

~~~
IChrisI
Every editor is different, including vim. In Sublime Text 3, it's Shift+Delete
to delete a line, and whether it goes to your clipboard or not depends on a
config setting. There's a shortcut to duplicate a line too, but I don't
remember the default because I've customized it.

------
mythrwy
Surprised they recommend a single colorscheme (jellybeans) at bottom of
article.

Moving between machines and terminals different colorschemes seem to work
better than others. This has like a million colorschemes (OK, slight
exaggeration but it does have more than I've been able to review. Usually pick
from 5 or 6 favorites commented out in .vimrc).

[https://github.com/flazz/vim-colorschemes](https://github.com/flazz/vim-
colorschemes)

Also they recommend
[https://github.com/Shougo/neocomplcache.vim](https://github.com/Shougo/neocomplcache.vim)
(which I've used for years). Reviewing some vim plugins the other day I
noticed that github hasn't been updated in 3 years and recommends another
plugin now. (Don't plan on switching until it breaks though).

Guessing this article may be a few years old?

<edit>Yes, it says 2014 at top

~~~
Insanity
Might be good if the date could be mentioned in the title:-)

------
suprfnk
This is from [2014] and contains outdated information. Can someone update the
headline?

As posted elsewhere, we now have vim 8, ALE instead of Syntastic, fzf/fzy
instead of ctrl-p, and more.

------
Lio
That article seems somewhat out of date now.

For a more up to date approach I'd suggest Drew Neil's Modern Vim book (still
in beta)[1] and using async language server plugins[2]

[1] [https://pragprog.com/book/modvim/modern-
vim](https://pragprog.com/book/modvim/modern-vim)

[2] [https://langserver.org/](https://langserver.org/)

------
bgrohman
"NERDTree satisfies this need of mine, replacing vim’s built-in netrw file
navigator with a nicer-looking, less buggy, more fully featured alternative."

Wait, what's wrong with the built-in netrw? I actually started with NERDTree
before I knew netrw existed. After discovering netrw, I switched to it
instead. I think it looks just fine and prefer it to the more complex
NERDTree.

~~~
icc97
I agree, it's better to work with the internal tools if possible. I did
install Tim Pope's vinegar plugin [0] as it adds some nice tweaks to netrw.

But I've since switched to using FZF [1] and hardly use netrw anymore.

[0]: [https://github.com/tpope/vim-vinegar](https://github.com/tpope/vim-
vinegar) [1]: [https://github.com/junegunn/fzf/blob/master/README.md#as-
vim...](https://github.com/junegunn/fzf/blob/master/README.md#as-vim-plugin)

~~~
bgrohman
Cool, thanks for the recommendations. I've tried ctrlp for fuzzy finding, and
it works ok. Might give FZF a try though.

------
bgrohman
I'm surprised the author didn't mention vim's sessions feature. The ability to
close the editor/IDE and pick up right where you left off can save a lot of
time when working with multiple large projects. It's easy enough to use on its
own, but I have a small wrapper plugin that adds a few features for ease of
use: [https://github.com/bgrohman/vim-bg-
sessions](https://github.com/bgrohman/vim-bg-sessions).

~~~
icc97
For which Tim Pope's Obsession plugin [0] is fantastic. It solved a whole
bunch of weird conflicts that I had with plugins.

[0]: [https://github.com/tpope/vim-obsession](https://github.com/tpope/vim-
obsession)

~~~
bgrohman
Cool, I haven't used that one. I'm sure it's great coming from Tim Pope.
Mine's working fine for me at the moment, though.

------
jmsmistral
Good list! Also, if you work with databases (particularly PostgreSQL) and want
to work with them from Vim, check out dbext:
[http://jonathansacramento.com/posts/20160122-improve-
postgre...](http://jonathansacramento.com/posts/20160122-improve-postgresql-
workflow-vim-dbext.html)

Link to dbext here: [https://github.com/vim-
scripts/dbext.vim](https://github.com/vim-scripts/dbext.vim)

------
tzhenghao
I'll add one more suggestion:

[https://github.com/airblade/vim-gitgutter](https://github.com/airblade/vim-
gitgutter)

"A Vim plugin which shows a git diff in the gutter (sign column) and
stages/undoes hunks."

~~~
fourseventy
Thats a cool plugin but I had performance problems with it once a file gets
above about 1k lines of code so I had to uninstall it :(

------
chewz
I recommend vim-workspace for IDE-like tabs. Helped me a lot in working with
Vim buffers.

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

------
taternuts
I'll be honest, the only time I try to tweak my VIM setup to be close to an
IDE is when I have no other options (developing on a remote box). It's always
a pretty frustrating experience IMO.

------
sfifs
Why not just use an IDE if that's what you need with a Vim mode plugin rather
than shoe horning Vim into something it is not really meant to be. Virtually
every major IDE has a Vim mode.

~~~
pfranz
Speaking for myself:

* Vim mode in IDEs often only implement the most basic vim commands

* I'm able to work remotely over a slow/spotty connection

* I really hate waiting 10-30 seconds for my editor to start. Often I want to peek at code, then change my mind and want to edit it. I can remotely login and start my editor in less time than most IDEs take to load.

* I like dropping to my shell (not just a shell)

Who says what vim is meant to be? A lot of example vim setups I see are too
much for me (too much to set up, too fickle to maintain, too slow in
practice)...many of those apply to IDEs for me. But it's nice to see what's
out there and how other people fit the pieces together.

------
rimher
There'll always be a part of me that wants to learn vim better and set
something like this up. Then there's the other part of me, that just uses
Sublime instead.

~~~
Rainymood
The learning curve is steep but learning Vim is worth it.

~~~
geowwy
Subjectively I think it's worth it because vim feels more comfortable to me
but I'd be surprised if Textmate/Sublime/Atom are any less productive. They're
all pretty good editors.

------
erikb
This should be only an experiment at best. Please don't waste so much time
trying to turn a tool into something that it is explicitely not.

If you just want an IDE experience use one that already exists. If you want to
build your own out of plugins, use something like Emacs that has something
like that as a core feature.

If you really want to learn vim though, then please learn the IDE that it is
already integrated in: Linux. Linux based OSes are the most extensive IDEs
because in the past nobody thought there would be a difference between a
programmer and a computer user. So it's the most complete system that you can
find. And additionally to solving all your programmer problems you also learn
an OS and its components on the way.

