loading...

Finally switching to vim

peterfication profile image Peter Gundel ・3 min read

This article is just a selection of things I found helpful when switching to vim. So when someone asks for help because he or she wants to switch to vim, I just pass him or her the link to this article. Some of the links in this article also describe why you should switch to vim. So I won't get into this here.


Before I started using vim, I thought switching would be just a timeframe of 2-4 weeks of being less productive and learning vim and then I would have it all set up and I am used to the vim style of doing things. But then I realized switching to vim is more like a long and ongoing journey.

The most important thing about vim is that you can't just start with a complete-guide-to-vim and then you're good to go. It is a steady process of learning new things (and be overwhelmed by them). The secret in the beginning is to give yourself some time to get up to speed and understand the brilliance behind the concepts of vim.


I recommend to start by watching this introduction talk to vim by Mike Coutermash. He describes really good what I was experience as well when starting with vim. Here are also his blog article and his slides for the talk.

In order to get a first impression I started with an interactive online tutorial. This tutorial provides a very good interactive introduction to the principles of vim. And this is a very good read about the why of vim.

After that I realized that I need a list of all these movement commands. Here is a cheat sheet to start with. Or even better you print out a more complete vim cheat sheet: This or this. The vim wiki has a getting started page that I found quite useful.

In order to train the basic movements you can start playing VIM Adventures.

This Github repository provides a long guide to vim.

Here are 68 free screencasts about vim and here are two more free ones and other paid ones.

You also might wanna have a look at neovim.

Vim has a very rich ecosystem of plugins. There are multiple ways of installing plugins. I started with pathogen.vim and it was ok. But my coworkers showed me the advantages of vim-plug and as they are using vim-plug I switched, too.

Then you have to decide which plugins to use (and not to use 😉) and how to customize your settings and keymaps. As a starting point I will list some plugins someone might have a look at. The most important thing here is: read through the documentation of each plugin and decide whether you need it or not!

Here are some plugins that I found useful for the start:

And every programming language normally has a vim plugin on its own.

Finally, start playing vimgolf from the beginning. It's never too early to start (I had that thought). Just look at the other solutions and try to understand what they did.


After one week of vim I'm not as productive as with RubyMine. If I really need to get something done fast I still open RubyMine. But most of the time I use vim now and I enjoy working with it. Two more weeks and RubyMine stays closed. What I miss the most is the awesome multi cursor implementation of RubyMine. But I already have been told that in vim you do things differently 😉


Hi there, we’re store2be, a Berlin based startup that builds a SaaS enabled marketplace for short term retails space. If you like what we are posting you might wanna check out the store2be tech page or follow our Medium channel.

Posted on by:

peterfication profile

Peter Gundel

@peterfication

CTO at store2be.com in Berlin, Ruby ninja with JS experience, interested in Rust and Kubernetes.

Discussion

pic
Editor guide
 

There are two ways to think of VIM: As a text editor, and as a set of common modes and keybindings.

Switching to VIM doesn't need to be about making the switch from a fully-featured IDE to a text editor—IDEs have a lot of great functionality that text editors don't, so you're really giving up a lot for the sake of using VIM for everything.

The alternative to using VIM (the text editor) for everything, is to leverage VIM plugins for whatever tool is best fit for the job. You mention you use RubyMine; JetBrains vends an excellent VIM plugin for all their IDEs. There are excellent VIM plugins for Visual Studio, Sublime, Atom, VSCode, etc.

While VIM (the text editor) is great in its own right, and there are a lot of really great plugins, VIM is really about being able to navigate and edit text efficiently. You don't need to give up your existing tools to leverage VIM's efficiency!

 

I confirm that VIM plugin is a good way to go if you want the best of both worlds power of VIM and IDEs. Doing this for over a year with Visual Studio and VsVim and it works great for me (I have tried switching fully to VIM but lack of IDE features made me consider mix of IDE and VIM).
Also it is true that sometimes those plugins miss things that VIM has. But I just made a command to open current file for editing in VIM with hitting single key. So whenever I need smth. complex that plugin still doesn't have I just switch to VIM edit and return back.
Also eventually I found out that I want VIM editing everywhere :). So I made an AutoHotKey script that allows me to edit text from any input in vim (I just hit shortcut selected text loads in vim I edit it hit shortcut again and new text replaces previously selected) find this to be very handy.

 

Do you have a special list of plugins for working with Visual Studio ?

I use VsVim for Visual Studio. No other plugins.

How does your crafted .vimrc work within Visual Studio ? Did you need to make any curious adjustment ?

I have separate configs for vim (_vimrc) and VsVIM (.vimrc) because VsVIM does not support all of the vim features. Both files are placed in default vim installation directory at C:\Program Files (x86)\Vim. VSVim picks it up automatically when you load visual studio. There is also a manual way to load it just type :s {path to your .vimrc}

 

Agreed, I recommend this approach - I got started though using plugins too. Another area where plugins shine is being able to easily toggle them on and off with a button or keyboard shortcut. This really helped me when I had got confident enough to start using Vim editing at work, but sometimes wanted an escape hatch to get back to "normal" editing for more complex things that I hadn't learnt the Vim way for yet.

Plugins are also useful for if you work on Windows. There are things like gVim or installing Vim on a Cygwin terminal, but to me they always feel a bit unnatural somehow compared to the experience on a *nix box, and so plugins avoid this issue.

 

I agree. Using vim keystrokes saves lots of time when one uses emulator across multiple IDEs and editors. I use VS 15/17, several Jetbrains products, Sublime, VS Code, and everywhere I use vim emulators, keeping me comfortable across all these.

 

Oh that's really cool! I should definitely check this out!

Another problem with RubyMine though is that it is so slow. So I thought it is better to have a really fast text editor instead of all the IDE features from which I only use some.

 

Ah, yeah. I've never had performance issues with JetBrains IDEs, but I've also never used RubyMine specifically.

 

And what I also like about vim is that you are encouraged to adjust it to your needs. That's a really strange thing because you can do the same in the JetBrains IDEs but I never really did it. Maybe because it's already that good out of the box.

 

While I agree that all Vim plugins eventually fall short somewhere, to say that "If you think that, then you never actually used vim" is unnecessarily harsh. For a Vim beginner a plugin is plenty, and lets them focus on the basic motions etc while still staying within a familiar environment.

 

As many others have mentioned, it doesn't have to be all or nothing to make good use of Vim. I use vim-mode-plus in Atom, and it works great for me (though I wouldn't say by any stretch that I'm a vim power user). I use it in the areas that I feel it makes me a bit faster and more productive.

I do want to point out one other reason that makes it useful to learn Vim (modes and keybindings): Working on different machines, or VMs, where your favorite editor is not necessarily readily available, or GUI-less servers. For basic text editing it has been invaluable to learn to use Vim to do quick edits (at least for *nix machines).

 

Currently using sublime, although I am quite well versed with vim.

The main reason, was that I just cannot figure out a good way to combine, Filezilla and Vim.

But you've inspired me to take another shot at it.

I think using Gvim as an option on Filezilla should work.

Thanks for this.

 

nice post!
for the multiple cursor look here github.com/terryma/vim-multiple-cu...

but I actually never used it.

 

Thanks for the link. Unfortunately, this one does not work like the JetBrains one. You can only select a whole word and find for next occurrences. In JetBrains products you can select an arbitrary amount of chars and then find the next occurrences. So when you want to select a few words that have the same prefix or suffix, you can't use this vim plugin.

 

Oh sorry, I installed it when I had your same feeling, but after a while I stop using it in favour of regex search/substitution or rectangular selection with .

Take a look to medium.com/@schtoeffel/you-don-t-n..., some interesting ideas there.

Good luck !

Thanks for the link, I already had it in my last sentence ;)

sorry, I didn't catch that!

 

The most important thing about vim is that you can't just start with a complete-guide-to-vim and then you're good to go.

I've heard or read that countless of times. And my answer is still the same: I'm not paid to learn an editor, I'm paid to produce code. I don't want to lose time in an editor, I want an interface with a high discoverability that makes me feel at home right from the start. Because I need to be productive right from the start.

People are always joking about exiting Vim - but if you think about it, it's just nuts that you need to tell an editor that you want to edit the file. You say that I have to take my time - actually it's Vim that'd take my time!

I have to deal with Vim on a daily basis for the too many terminal commands that force you to use it - starting from Git - I just don't want to deal with it any second more than necessary.

 
  1. I think you didn't understand the real value of an editor like Vim or Emacs. If you really take the time to learn it, it can make you more productive in the long term. So being less productive for 3 months is paying out a lot after that. But in the end everybody has to decide it for him/herself of course.

  2. You can change the terminal editor to the editor of your choice ;) (google.de/search?q=change+terminal...)

 

If you really take the time to learn it, it can make you more productive in the long term.

Huh, I've heard that. As nauseam.

But guess what? I actually know hardcore Vim users. And while they're usually quite productive indeed, I can't say they're more than me... and they can't either. (The opposite holds too, by the way.)

The point is that your tools can increase your productivity that much, the rest is up to you and how good you are.

And I'm fine with VS Code and my multi cursor-fu.

It's about your personal productivity, not about the comparison with others. So if vim isn't a fit for you, it's fine. It does not mean that this also accounts for others ;) I for my part can just say that it was worth it :)

 

Thanks for the article.

For me it finally clicked when I started using buffers directly instead of tabs.

This article helped, maybe someone might find it helpful:
joshldavis.com/2014/04/05/vim-tab-...

For OSX-Users I highly recommend VimR, which is MacVim but using NeoVim.

 

Thanks for this article! This also helped me a lot now :) I have to admit I was using tabs the wrong way ;) But this will change now :)

 

There is vim-multiple-cursors which is really useful.

I would suggest working with vim for a bit without plugins though to learn what it can do on its own

 

That's a good suggestion. Playing vimgolf helps a lot in finding out features of vim (when working with one file only though).

 

Do you recommend starting with something like vim-bootstrap.com/ ?

 

I think it is a good thing to look at, but you should just add the things to your vim config that are really relevant to you. So check it out, read about the plugins and then decide if you would like to use them. You don't need to use all plugins and configs from the beginning.

 

Do try out spacemacs in evil mode. You'll like it better.

 
 

Hey, take a look at this repo:

github.com/taq/workshop-vim

Some nice plugins there. :-)

 

Thanks :) I will have a look at them :)

 
 

Yes I use neovim.

I didn't have look at emacs so far. But I will maybe have a look at it as soon as I am more familiar with vim.

 

Too much work just to feel "pro" or "hipster"