Vim as IDE. Are you getting the wrong parts?

There are a lot of discussion about how to make Vim “an IDE”. Vim is a great text editor, but when we are developing, there are lots of extra tools that are very useful. Code completion. Easy navigation through files and classes. Source control integration. Syntax checking. Navigation that understand the semantics. Integrated debugger.

My problem with IDEs (and I have used a few over the years) is that they give you a lot of support, but at the cost of increasing the complexity. They are slow for a lot of common operations and they use a lot of resources. Code completion, the good kind that will allow you to get the types of a method, not just finish your words (which most of the time is trivial), is useful when developing on a static language, but since I  program in Python is something that I can’t find good use of it. I just don’t use all that stuff, so I don’t feel I can justify to pay the price.

Another problem with IDEs is that they tend to be designed, by default, to the newbie. That’s not necessarily a bad thing, Vim is a pretty intimidating tool because is totally crazy for the rookie. But it generates a bloated environment to start with. If you open Eclipse, a popular IDE (and one I’ve used for some years), you’ll get a relatively small frame for the code, and a lot of extra stuff surrounding it. Logs, file navigation, class definition, a huge toolbar, maybe even a TO DO list…

This is a lot of stuff!

This is a lot of stuff!

For example, think about file navigation. Sure, it’s useful to move around. But it is used only at certain points in time. Most of the time, it’s just used as an entry point to code, and then the navigation can be achieved, either just moving around in the same file, by a referral from the code (like going to a method definition), or just searching on the whole project. In case you need to go to an specific file, you can then show the navigation window, or even better, search by filename. That only happens during small periods of time, so the rest of the time the window is just wasted space on screen. The same thing happen for a task list. It is useful to know the next step. But not while you’re working in one task.

Hey, it is possible to hide the navigation window, and display it only at the proper moment, to save space. I have done that. But it’s not there by default, so most of the people I know just keep it open “just in case, giving context”. They just get used to it, and don’t perceive it as a problem, But having half of your screen full of information that is irrelevant 95% of the time is a huge price to pay. And certainly not a good use of an IDE. The good parts of an IDE are things like automatic compilation and deployment, refactoring tools (not just renaming), debugging, help with the types in static languages, automatic generation of code, etc. Not showing everything, all the time.

Mimicking the wrong parts of an IDE

Mimicking the wrong parts of an IDE You can do better.

Vim is a text editor, but it is also sort of a philosophy. It is not about showing stuff, but about having stuff available at the right moment, with a quick command. It is not just about using hjkl to move around and having an insert mode. It’s about being precise. It is difficult at first, because you can’t simply discover what are the available options, but it also pays off in terms of focus and clean environment. When programming, the most important part is to keep as few things into mind as possible. Keeping all relevant information, which is already enough, but nothing more than can distract you for the task. It is also about doing one thing, and not a hundred. I use other tools for things like source control and debugging. After all, we have the whole OS to work as our IDE.

I use a small number of plugins in Vim. When you learn a little about it, you find out that it’s amazing the number of features and stuff that can be achieved “out of the box”, and how little extra is actually needed to have a really productive environment. It’s just that we need to move from the usual “browse through menus” world that most of software uses, and devout some time to, well, study and learn. It’s really worth it.

8 Comments on “Vim as IDE. Are you getting the wrong parts?

  1. “I use other tools for things like source control”
    Let me introduce you to fugitive “https://github.com/tpope/vim-fugitive”

    • I know fugitive. and it’s an awesome tool. But I still prefer the CLI for git. I use the command line for lots of stuff, so it fits quite well my workflow…

      • It’s not that the features that I use are not available in fugitive, but that I use the command line and I get “out” of editing a file and to “source control” model better with command line. I also use command line for other stuff, like search, scripts, debug code (using pdb), etc…

        About diff, I use ‘git diff’ for small changesets and Kaleidoscope (http://www.kaleidoscopeapp.com/) for more complex things like merges, etc. I never had a taste for vimdiff.

  2. Hello, I liked your vim configuration. I’m new to VIM. Would it be possible for you to post your vimrc or a least post the sections that make these plugins work with in Vim. Thank you in advance.

    • Hi Rob:

      If you’re referring to this (that I put as example of what NOT not do), I don’t know what plugins are being used there.

      My Vim configuration is pretty minimalistic, I use Command-T to move to files, Syntastic to check syntax and errors, and minibuffexp to keep track of opened buffers (I use it less these days, anyway, I may remove it). That’s it from plugin point of view.
      I have a couple of settings on .vimrc, like remapping cursors (as I navigate through hjkl) to move lines and characters, highlighting characters over 80 in a line, setting stuff like tabs and so, and removing trailing spaces on save.

      (I’ve also removed your duplicated comment)

    • If you are new to vim, I recommend not using plugins until you are comfortable with vim’s out-of-the-box functionality. However, the plugins in the photo above are as named in the picture: tagbar, tabbar, powerline, nerdtree, and ctrlp. When and if you do decide to begin experimenting with these plugins, I recommend Vundle, which is essentially a vim plugin manager.

  3. Pingback: Visual Programming and Mental Constructs | Wrong Side of Memphis

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: