News for hackers. Stuff that matters.
Re:Why, oh why, do those nutheads use vi? (2007) by Illniyar on Sunday April 12, 2015 @08:02AM (#9363056)
Frankly I find vim an hindrance to the type of projects I work on.

One of the most common things I use an IDE for is navigation (between files) and vim is not very good at it compared to IDEs, here's why:

* no tabs

* no project structure

* in my IDE (eclipse based or intellij based) I can ctrl-click a class/object/other to navigate into that object's definition

* in my IDE I can search for classnames, I can press ctrl-T to find who inherits from something, ctrl-alt-H to find who uses something etc...

when I find myself actually writing code, it's usually a line or two in each of several files (because modern programming paradigms tell us we should split code as much as possible), or modifying some copy pasted snippet I found on google - so navigation is extremely important even when editing.

beyond that, there are simply some things that help writing code that a text editor cannot do:

* auto-complete(with annotation to tell you what the function variables are)

* debug inside your IDE

* run code-lint, auto-build on typing to detect errors, etc...

* auto refactor (I.E. extract method, move variable, extract class etc...)

* format all your files according to your pre-specified project guideline.

* sharing you IDE configuration with other contributors

* showing when files are/aren't in version control and integrating version control so that you view history in your IDE.

There are probably projects out there where a full-featured text editor is a real game-changer and is worth the days/weeks it'll take to use it intuitively, but I never worked or know anyone who worked on such a project (even when I started projects from scratch);

Re:Why, oh why, do those nutheads use vi? (2007) by StevePerkins on Sunday April 12, 2015 @09:54AM (#9363346)
Eh, half of this list actually IS possible with Vim, either through a plugin or simply out-of-the-box keyboard shortcuts. The other half are features that separate IDE's from text editors in general.

I do agree that I'm infinitely more productive in an IDE than I ever would be with any plain text editor (e.g. autocomplete-hints, refactoring support, etc etc). After discovering the JetBrains suite of IDE's some years ago, I can't imagine using anything else for application development.

However, the point of vi/Vim is not so much the editor application itself... but rather its keybindings and modal editing approach in the abstract. Those concepts are decoupled from the actual editor, because every major IDE has plugins which make them available in its environment as well. The "IdeaVim" plugin for JetBrains IDE's is amazing, letting you mix-and-match between Vim commands and normal JetBrains shortcuts in a very intuitive way (or at least intuitive if you're familiar with Vim).

If you're happy with your current working environment, then rock on. But if you're fluent with vi/Vim (and it is a significant learning curve), then you can absolutely have the best of both worlds. To me, arguing about whether to use an IDE or an editor is pretty silly. But the question of whether or not to use modal editing and a suite of standard shortcut commands within an IDE is a much more interesting matter.

Re:Why, oh why, do those nutheads use vi? (2007) by lfowles on Sunday April 12, 2015 @10:38AM (#9363469)
My biggest problem with vim is that I can get it configured with all of the plugins to emulate a GUI IDE, but it does nothing to help if I can't remember the shortcuts. Off by one character? Whoops, you activated the RootNuker Plugin on Buffer 3. Discoverability is terrible, one of the few things that I feel is actually faster with a mouse.
Re:Why, oh why, do those nutheads use vi? (2007) by aidos on Sunday April 12, 2015 @05:53PM (#9364872)
There's no doubt, vim isn't big on making it easy to find your way around.

I don't think that matters so long as you're methodical in your approach to learning it. It's important to master the basics and then add new tools one at a time.

The amazing thing about vim is that each new command can be composed with your existing knowledge set, so just learning what, say, 's' does gives you a whole lot more power.

Also, while the discoverability might suck, the built in manual is just incredible.

Re:Why, oh why, do those nutheads use vi? (2007) by lfowles on Monday April 13, 2015 @10:32AM (#9367817)
This doesn't apply to plugins however, which constitute most of what would make Vim an IDE. Most of the core commands are pretty well thought out and I have a nice keyboard map printed out just in case.
Re:Why, oh why, do those nutheads use vi? (2007) by MetaCosm on Sunday April 12, 2015 @05:16PM (#9364762)
Absolutely. That said, I think modern IDEs suffer from huge discoverability problems as well. The truth is, when you have thousands of features, discoverability had to give way to documentation.
Re:Why, oh why, do those nutheads use vi? (2007) by MetaCosm on Sunday April 12, 2015 @05:14PM (#9364753)
Way more than half, everything except great refactoring support really.
Re:Why, oh why, do those nutheads use vi? (2007) by wz1000 on Sunday April 12, 2015 @08:12AM (#9363074)
Most if not all of of these can be achieved using plugins.

Some are present by default.

> no tabs

It does have tabs, they're just called buffers instead(there is something called "tabs" too, but they're not what you expect tabs to be)

> sharing you IDE configuration with other contributors

Sharing your vim configuration is as simple as sharing your .vimrc

Re:Why, oh why, do those nutheads use vi? (2007) by Illniyar on Sunday April 12, 2015 @08:26AM (#9363100)
I think the major benefit I derive from what I mentioned is the constant visual cues and the immediate availability.

With buffers (unless I'm missing something) you need to type a command to list all your 'tabs' and another command to get to the tab in question. Project structure is similar - it's always visible, and you can always see what other files are close by.

I don't think that can be achieved with plugins, though I never knew there were plugins until now.

Do people who use vim regularly install plugins for it?

Re:Why, oh why, do those nutheads use vi? (2007) by wz1000 on Sunday April 12, 2015 @08:31AM (#9363115)
Yes, all of this can be achieved using plugins, including immediate visibility of tabs and project structure. Check out powerline(https://github.com/powerline/powerline) or vim-airline(https://github.com/bling/vim-airline).

A nice configuration for Haskell which I often use to bootstrap new machines is haskell-vim-now(https://github.com/begriffs/haskell-vim-now). That includes almost all the features you mention.

Re:Why, oh why, do those nutheads use vi? (2007) by Saekano on Sunday April 12, 2015 @09:32AM (#9363286)
Is there a screencast / youtube video that showcase VIM with most or all the features mentioned by Illniyar ?
Re:Why, oh why, do those nutheads use vi? (2007) by wz1000 on Sunday April 12, 2015 @09:37AM (#9363304)
Re:Why, oh why, do those nutheads use vi? (2007) by qubitcoder on Sunday April 12, 2015 @12:03PM (#9363746)
Yes, I'd wager that regular Vim users employ a variety of plugins. Vim is a powerful editor out of the box, but it falls short of many IDE capabilities without leveraging plugins.

There are many packages on GitHub that will install and configure Vim for you with a variety of useful plugins and keyboard shortcuts out of the box--so after the installation is complete, you'll have a fully fledged Vim IDE ready to use.

One of my favorites is Joe Nelson's setup [0]. It's specific to Haskell development, but even if that's not relevant to your use-case, it's a very sleek demonstration of what Vim can do as an IDE--and a good starting point for customizing your setup (i.e. a very clean .vimrc file for inspiration). I use it basically as-is for my default Vim config and as a full IDE. Check out the keyboard shortcuts for quickly switching buffers, Git integration, and the shortcuts for visualizing project structure & quickly navigating files.

[0] https://github.com/begriffs/haskell-vim-now

Re:Why, oh why, do those nutheads use vi? (2007) by woogley on Sunday April 12, 2015 @08:37AM (#9363130)
You can use :tabe to open a new tab, and then `gt` and `gT` to switch tabs.

This is somehow controversial to some[1] but it never bothered me.

As far as file navigation though, I just use crtlp[2]

[1]: https://stackoverflow.com/a/103590

[2]: https://github.com/kien/ctrlp.vim

Re:Why, oh why, do those nutheads use vi? (2007) by wampus on Sunday April 12, 2015 @10:00AM (#9363361)
Add this[1] to .vimrc for easy navigation between multiple files in each tab:

    map <C-J> <C-W>j<C-W>_
    map <C-K> <C-W>k<C-W>_
    set wmh=0
Load a new file with the split command:

    :sp <file>
and use Ctrl+j or Ctrl+k to switch between the splits. It's a handy way to organize and edit multiple files.

[1] http://vim.wikia.com/wiki/Switch_between_Vim_window_splits_e...

Re:Why, oh why, do those nutheads use vi? (2007) by Anthony-G on Sunday April 12, 2015 @04:06PM (#9364580)
I read that StackOverflow answer before and given the amount of upvotes it received, I presumed that it had something going for it.

I was already regularly comfortably using `Ctrl-^` to switch back and forth between the current and alternate buffers but I was also used to having different buffers open in different tabs and selecting them using either the `gt` family of commands or the `:tabfirst` family.

I like having the tab-bar provide visual cues for each of the buffers that I’m working with rather than having to type `:ls` to see the list of buffers (which can sometimes be very large as I often leave Vim running for a long time and if I do close, I usually restore it from a session).

Like you, I’ve yet to encounter any problems with this way of working. It’s possibly because I’ve never used any commands which utilise the quickfix buffer (`:make`, `:grep`, and `:helpgrep`) but maybe, there’s something else I’m missing?

Re:Why, oh why, do those nutheads use vi? (2007) by je42 on Sunday April 12, 2015 @09:42AM (#9363318)
* No tabs.

-> multiple vim plugins provide really confortable tabs.

* No project structure.

-> plugin. if you want that kind of tree next to your editor. (i.e. Nerdtree)

* in my IDE (eclipse based or intellij based) I can ctrl-click a class/object/other to navigate into that object's definition

-> tag search plugin. Haven't played with it much though.

* in my IDE I can search for classnames, I can press ctrl-T to find who inherits from something, ctrl-alt-H to find who uses something etc...

-> I believe there are some plugins for but here i haven't seen anything good so far.

* auto-complete(with annotation to tell you what the function variables are)

-> you complete me. plugin.

* debug inside your IDE

-> good point. have to wait for Neovim for this - I believe. Installing current WIP version from neovim is on my todolist. ;)

* run code-lint, auto-build on typing to detect errors, etc...

-> syntastic.

* auto refactor (I.E. extract method, move variable, extract class etc...)

-> good point. don't know any good plugin.

* format all your files according to your pre-specified project guideline.

-> plugin.;)

* sharing you IDE configuration with other contributors

-> here truly most IDEs suck. For vim you find lots of shared vimconfig on github.

* showing when files are/aren't in version control and integrating version control so that you view history in your IDE.

-> if you need to do in the editor... there is plugin for that. However, i found git command line is usually find. and for more serious committing I use GitX (L).

Re:Why, oh why, do those nutheads use vi? (2007) by MetaCosm on Sunday April 12, 2015 @05:20PM (#9364773)
> * in my IDE I can search for classnames, I can press ctrl-T to find who inherits from something, ctrl-alt-H to find who uses something etc...

>> -> I believe there are some plugins for but here i haven't seen anything good so far.

Language dependent, Go has "Oracle" for example, for finding callers, etc.

> * debug inside your IDE

>> -> good point. have to wait for Neovim for this - I believe. Installing current WIP version from neovim is on my todolist. ;)

Clewn.

> * auto refactor (I.E. extract method, move variable, extract class etc...)

>> -> good point. don't know any good plugin.

Language specific, Go has multiple and lots of people write small bits of script to do this -- but it is a place IDEs are far ahead of Vim.

> * showing when files are/aren't in version control and integrating version control so that you view history in your IDE.

>> -> if you need to do in the editor... there is plugin for that. However, i found git command line is usually find. and for more serious committing I use GitX (L).

Nerdtree & git-nerdtree.

Re:Why, oh why, do those nutheads use vi? (2007) by weaksauce on Sunday April 12, 2015 @10:19AM (#9363407)
I used to use Gitx but source tree is considerably better.
Re:Why, oh why, do those nutheads use vi? (2007) by je42 on Sunday April 12, 2015 @12:59PM (#9363941)
i found source tree to be very slow for the repositories that I have to deal with. GitX (L) dealt with them much better.
Re:Why, oh why, do those nutheads use vi? (2007) by threatofrain on Sunday April 12, 2015 @02:44PM (#9364336)
In my view, Vim is no longer just a program that people use, but a way to do things. In this view, I am hopeful for the NeoVim project to bring Vim-the-way to other editors, including your favorite IDE.

One of my pains was that Vim-the-program was not ready to go, and that configuring or adding plugins to Vim was a real nuisance, and I think due to terminal limitations, Vim-the-program could never have some of the features other programs had.

Re:Why, oh why, do those nutheads use vi? (2007) by jqm on Sunday April 12, 2015 @01:27PM (#9364062)
-No tabs? How about :tabedit?

-No project structure? Well, there is nerdtree. Or a separate terminal window open to the file system which is usually the way I do it.

-Autocomplete with annotation? Nice plugin for that.

-Debug? I'm running in separate terminal window anyway. I can debug there.

-Auto refactor? No thanks. I'd rather do that myself.

-Format according to guidlines? There is probably a plugin, but for the once or twice that happens third party tools work just fine. Don't need that in the editor.

-Sharing your configuration? Very easy. Just copy your .vim and .vimrc files over.

-Showing files in that aren't in version control? Remember my separate terminal window that's open? I don't want everything in the editor. But there is probably a plugin if you really need it.

____________

Here are the advantages: Cost, Ubiquity, works over SSH the same way. Takes two seconds to move my config files and I'm right back in the environment. Plus I know it and it is fast as heck. There probably some others I'm forgetting.

Honestly, it sounds like you haven't taken the time to get to know Vim. And that's ok... if you have something that work for you then no need. But lots of the things you claim are advantages of your setup really aren't.

Re:Why, oh why, do those nutheads use vi? (2007) by snarfy on Sunday April 12, 2015 @08:55AM (#9363170)
The only one of those things I don't have inside vim is debugging, and mostly because I haven't tried.

Plugins have come a long way. For C# I use OmniSharp for Vim.

Re:Why, oh why, do those nutheads use vi? (2007) by wz1000 on Sunday April 12, 2015 @08:58AM (#9363179)
I use tmux and vim-slime for that. It works pretty well.
Re:Why, oh why, do those nutheads use vi? (2007) by MetaCosm on Sunday April 12, 2015 @05:21PM (#9364779)
Clewn for GDB.
Re:Why, oh why, do those nutheads use vi? (2007) by DennisP on Sunday April 12, 2015 @08:30AM (#9363111)
The author of the article wrote an excellent vim emulator for Visual Studio, so I suspect he agrees with your points on the merits of IDEs :)
Re:Why, oh why, do those nutheads use vi? (2007) by merger on Sunday April 12, 2015 @10:29AM (#9363440)
It becomes a lot harder to switch programming languages and tools once you are dependent on some of these IDE features. Switching from using Eclipse for Java to using Closure without quite the tooling you've had before could be pretty hard if you join a new team.
Re:Why, oh why, do those nutheads use vi? (2007) by thomasahle on Sunday April 12, 2015 @08:43AM (#9363137)
I recently started using IntelliJ, and at install it suggested using the vim emulator. Being able to use vim shortcuts together with IntelliJ features has been one of my best editing experiences to date.
Re:Why, oh why, do those nutheads use vi? (2007) by callahad on Sunday April 12, 2015 @09:07AM (#9363212)
> sharing you IDE configuration with other contributors

Check out http://editorconfig.org/

Re:Why, oh why, do those nutheads use vi? (2007) by MetaCosm on Sunday April 12, 2015 @05:11PM (#9364743)
There have been a lot of replies addressing a few of your concerns, I will attempt to hit all of them. The only one that really has any no great solution is the refactoring support.

> * no tabs

There actually are tabs, but they probably don't work the way you expect, they are closer to viewports or workspaces, but they are there. You can also use assorted plugins to improve tabs and/or emulate them.

> * no project structure

Not sure I understand this way -- no enforced structure? Neither to IDEs, no tree viewer -- there are bunches of tree based file viewers.

> * in my IDE (eclipse based or intellij based) I can ctrl-click a class/object/other to navigate into that object's definition

This is supported by the tags system in Vim, which depends on ctags. :tselect, C-], lots more -- this exists out of the box.

> * in my IDE I can search for classnames, I can press ctrl-T to find who inherits from something, ctrl-alt-H to find who uses something etc...

This obviously very specific to some language you have in your head, as many of those things don't make sense in some languages. That said, this is supported in various languages by various plugins (In Go, Oracle for example).

> when I find myself actually writing code, it's usually a line or two in each of several files (because modern programming paradigms tell us we should split code as much as possible), or modifying some copy pasted snippet I found on google - so navigation is extremely important even when editing.

Agreed, which is why Vim has so many ways from jump-to-def to jump-to-file to various smart plugins for rails and C and <X>.

> * auto-complete(with annotation to tell you what the function variables are)

Gobs of plugins do this for Vim -- normally language specific and they tend to work rather great.

> * debug inside your IDE

See Clewn, full gdb support integrated with vim.

> * run code-lint, auto-build on typing to detect errors, etc...

Vim has all of that, syntastic will show errors in the left bar as you type, setting things to autorun is trivial, all major languages already have this.

> * auto refactor (I.E. extract method, move variable, extract class etc...)

Language specific (as is your IDE's features, because to do requires understand the language), but this exists in limited form for Go and C++ -- and I am sure others. The level isn't up to major IDEs. That said, many of these things are easily scriptable in vim.

> * format all your files according to your pre-specified project guideline.

Tons of vim support for this, even supporting standard 3rd party like EditorConfig.

> * sharing you IDE configuration with other contributors

I think you will find far more vimrc files shared in the wild than any IDE.

> * showing when files are/aren't in version control and integrating version control so that you view history in your IDE.

Fugitive has great time travel features for flipping through versions of files and seeing differences. Use git-nerdtree to add git status to nerdtree.