Live data from Hacker News

Turning vim into an IDE through vim plugins

safaribooksonline.com

41–50 of 63 posts

Re: Turning vim into an IDE through vim plugins

#41

Earlier quoted context omitted.

> 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 di…

> 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://stackoverfl…

> Really? Even if you haven't selected the line?

Absolutely, works for the entire line, no matter where you are.

> But it's still faster to type dd than Ctrl + D

Don't be overly pedantic. I could say Ctrl + D is faster because dd means: 'press d' + 'release d' + 'press d' while Ctrl + d means 'press Ctrl' + 'press d', or I could say that you don't have to change modes to use Ctrl + D, but you could say your finger is already on d, you're more comfortable, etc. The difference in speed is quite negligible.

> https://stackoverflow.com/a/9616315

Using cscopes sure is better than dumb text search, but apparently doesn't know the difference I asked about. From the comments:

> Now that I've spent a bit of time with cscope, it seems to me that cscope does not differentiate variables of the same name that belong to different classes. class_b::var may be returned even though I'm only looking for class_a::var. I'm using C++. Am I doing anything wrong?

Maybe it works better for other languages. However, my point is: if you think "There hasn't been one feature that and IDE has that I used, which can't be achieved in vim (or via a plugin)", then I don't think you've used JetBrains IDEs.

Re: Turning vim into an IDE through vim plugins

#42
post #10

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 wha…

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…

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 + # just sayin'

Re: Turning vim into an IDE through vim plugins

#43
post #29

Earlier quoted context omitted.

Have you found a plug-in that handlea autocompletion/find references/go to definition as well as SlickEdit or Eclipse? I tried ctags and a few others for autocompletion, etc. They were super complicated to install and use. Also they do not find references properly, having a bunch of misses or false positives. I like Vi style editing, but I found it better to use a real IDE and find a Vi plug-in for it.

There are a whole bunch of plugins for autocompletion (depends on the language you are using) Find references : try [0] or [1] go to definition (I haven't searched for this functionality, so I don't know if it exists) [0] https://github.com/asenac/vim-opengrok [1] https://stackoverflow.com/a/9616315

> go to definition (I haven't searched for this functionality, so I don't know if it exists)

It's a pretty fundamental code navigation feature. You said "There hasn't been one feature that and IDE has that I used, which can't be achieved in vim (or via a plugin)", but it seems you haven't used any significant IDE features. Have you tried refactors like "rename" (method, class, variable, field) or "extract method"? Have you tried searching for overriding methods? Have you tried inlining variables or extracting expressions to variables? Have you tried debugging? Evaluating expressions during debug is something you can do in Java and Eclipse [1] / IDEA [2].

Or, if you want something really impressive, how about Async stacktraces?[3] It shows all the frames for both the spawning thread and the spawned thread in the same stack during debug.

There are a lot of really cool features in IDEs like IntelliJ IDEA have which are impossible to achieve with plugins in VIM, simply because IDEA parses the code and works at AST level. Not only that, but there are hundreds of inspections, automatic fixes and refactors which work perfectly (or almost perfectly) on top of that AST.

[1] http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse....

[2] https://www.jetbrains.com/help/idea/evaluating-expressions.h...

[3] https://blog.jetbrains.com/idea/2017/10/intellij-idea-2017-3...

Re: Turning vim into an IDE through vim plugins

#44
post #6

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.

Most of these plugins make Vim more like ST. Having switched from ST to Vim I have spent lots of time trying to add in the bits I miss.

But there are benefits of Vim that ST are ever likely to have fully:

* Open Source

* Editing inside ssh

* The programmable way of editing which you'll never teach yourself if you don't dive in. I can't even quantify if this is better, but it feels better and you only need a few percent improvement over your editing/refactoring speed to be worth it over the years

* fully custom, you set it up exactly the way you want it. I never felt tempted to create shortcuts in ST, but it's much more standard in Vim

* it's good to understand Vim's way of editing even if you go back to other editors

* in theory you can pretty much do everything that ST can do in Vim but I don't think you'll get the full power of Vim if you try to recreate it in ST

Re: Turning vim into an IDE through vim plugins

#45
post #17

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…

I coded in vi for years using a vt100 terminal. I used emacs for a couple of years. Went back to vi when vim came out. I still use vi when I need to make a quick change from the command line. It is very useful when you log remotely. But I would hate to use vi for software development when we have IDEs, and modern programming editors like sublime.

Re: Turning vim into an IDE through vim plugins

#46
post #10

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 wha…

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…

Sorry, but I really don't understand this. What of these can you not get in emacs?

Re: Turning vim into an IDE through vim plugins

#48
post #36

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 .

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

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.

Re: Turning vim into an IDE through vim plugins

#49
post #39

"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.

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 [1]: https://github.com/junegunn/fzf/blob/master/README.md#as-vim...

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

Re: Turning vim into an IDE through vim plugins

#50
post #17

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…

> 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 wel…

Funny thing, learning programming (and in particular, learning vim) taught me touch typing.

I was a 80WPM hunt-n-peck typist, and my typing/"business computing" teacher in High School was a 25WPM touch typist. She couldn't convince me it was worth learning, so I never did. I'd fake it and other bs until we finally moved on after about 2-3 months.

However, after programming for about 3 years, I realised that I had subconciously learned how to touch type, and with about a month of concentrating on better finger usage, I achieved a more "proper" touch typing form.

My one complaint about vim: muscle memory. After using vim for years, you'll find random :w's and :q's at the end of so many emails or documents in other programs!

Post reply on HN