Friday, September 12, 2014

Vim: My Experience as a New User

Many of you have heard of Vim, a lot of people call it the greatest text editor ever "second to none". While that claim seems like a bit of a mouthful and purely driven by the fans there are reasons why Vim is great, as well as there are reasons for you not to use it.

I started learning Vim this week. Let's make this clear, Vim is not an IDE, you can make it look like an IDE but it won't behave like one. As I searched through the web for plugins to empower my Vim editor I noticed one thing: Everyone wants Vim to be an IDE. Oh, the many out there. I don't mind them, but it puzzled me as a new user.

Don't get me wrong, I love Vim. I love all the amazing text editing keymaps you can do with it. I love how you can use Visual Block and replace whatever text with the same name in just a matter of 2-3 keys. I love how you can just ci" and magically delete. I love plugins like YouCompleteMe, how well NERDTree works even though I'm looking at something like Sauce but bookmarks do just fine, how AMAZING is python-mode, tagbar is a must, vim-airline, and oh so many plugins out there that even in 2014 it maintains Vim relevant.

Vim is an investment. As a new user it took me a couple of days to fully get it to where I wanted it. Just like Emacs if you want to be its user, then you'll know that you need to install plenty of plugins for it too.

But see, Vim is a great tool. Let me show you the first screenshot:

My .vimrc is a mess so I'm not going to post it here today but let's take a look at semantic completion provided by YouCompleteMe, it also uses omni-completion. This is just one of my random projects. 

Here is a more IDE-like screenshot that shows you tagbar.

It looks great, doesn't it? As a new user I should have waited a bit before getting into plugins but at the same time I wanted to do some C++ already. My reason to choose Vim was because Eclipse just keep crashing over and over again and it also froze several times. Netbeans didn't even want to work. 

So, I chose Vim because it was THE text editor I needed. The world whispered in my ears and said "Use vim, use vim! You won't regret it!" I don't regret it. I like it, I haven't worked on a REAL project with it but I know that it'll be a delight to work with. 

Now, all my praises for it so far ends here. Let's go on to why you might not want to deal with vim. 

  • Setting up a project with virtualenv and YouCompleteMe is a pain. No matter how you look at it, you don't get a predefined workspace like you do in Eclipse or Netbeans. There's no ROOT PROJECT folder to use. It causes YCM not look up the libraries set with virtualenv. And it's just awkward hard to make it work. Since YCM looks at your system libraries, what I did was just install the framework I wanted to use to get the semantic support. It's sad. 
  • ctags? Manual generation of something that should be automated? Well, yea it's like that. Apparently you gotta freshen up your ctags if you want to navigate your source files. 
  • No way to jump around headers/sources file. I can't for the life of me find a way to JUMP at the standard header I just included. In Emacs, this is done oh so easily, it makes me sad. 
  • It takes time to deal with buffers/windows/tabs. If you are new like me, chances you are going to be nuts jumping from buffer to buffer, or tab to tab. 

Listen, if I were to choose between PyCharm and vim, my answer would be PyCharm. It removes a lot of the hassle that is introduced by vim. But see, vim is a text editor and such it cannot be blamed for not working as one. 

So where's the investment exactly? Text editing. No, really. Once you learn the flow of vim you will be fast to get that source written. At first, you will feel slow, frustrated because the workflow is really different. I know I have. Heck, I have started typing while it was in Normal Mode and I've screwed up plenty of files due to that. It happens because we are just new to vim.

Is it worth the pain? That's for you to choose. I'm sticking with it for a while because it doesn't hurt. 

No comments:

Post a Comment