DEV Community

Heiker
Heiker

Posted on • Updated on

My journey to vim

Apparently everything started around october 2018, for some reason I found myself sshing (a lot) into a test server at work. As you might have guessed when I wanted to look at the content of a file my options were basically cat, nano and vim. When cat wasn't enough I chose vim but I knew vim was basically a trap so every time I opened a file I made sure I had cheatsheet close to me. That was good enough for awhile until it wasn't, and I decided to learn vim for good. And so the story begins...

Okay Ben, but I'm gonna tell you the whole story.

I started learning Vim in october because apparently I had nothing better to do. It started out like a nice hobby, every few days I would open up a file, tried to move things around, delete stuff, learn a new command or something and it was nice until I said "Guess it's time to make my own vimrc". Oh boy. It turns out that it was way more entertaining than I was expecting.

The plugin hunting didn't last very long. I found a post about Vim that had a phrase that stuck with me "let sublime be sublime, let Vim be Vim", that was enough to convince me to not try and make Vim behave like Sublime text. But there was still one thing I wanted and that was a good fuzzy finder, and my friend google had the answer for that, fzf. FZF it's best thing ever, it's the only plugin that I would consider essential (even though Vim has a search feature already).

The real time sink was the keymap. It was so dificult to "get it right". I spent an afternoon (on a week day) browsing in github repositories looking for vimrc configs. I'm really happy with the "final result".

The next stage of the journey was trying to find a way of using Vim outside of a terminal. I tried a few Neovim frontends and other editors emulation. In the Neovim GUI department I gotta say that I really liked Onivim and nvim-gtk.

  • What I liked about Onivim was the integration with language servers, it enables features like goto definition and autocomplete like in VSCode. It consumes like half of the resources that VSCode requires it is still an electron app that takes quite a bit of RAM.

  • Nvim-gtk is my favorite way of using Neovim, is basically like a terminal except that it provides a few widgets that I appreciate like a file explorer, "real tabs" with a closing button, a plugin manager menu and other stuff. It's written in Rust so is cross-platform, and fast. The only thing that is a bit annoying is the fact that I can't make the cursor stop blinking.

And so now that I have a Vim setup that makes me happy I've decided to go back to Sublime text and see if can get some of that modal editing that I liked about Vim. So far I have tried the NeoVintageous plugin (If anyone wants to learn vim but don't want to use it yet that plugin is a good place to start). I have to say that is a good vim mode, but I stopped using it because it was missing some features and a few others do not behave like I would expect, is like that off by one error that you just can't fix.

Since modal editing is still posible within Sublime text I'm making my own keymap settings (I keep them here) in the form of a package so I can disable everything when I don't need it. The keymap is inspired by Vim but instead of trying to be exactly like Vim I remap Sublime's built-in commands to get a more consistent behavior. I don't get the composable commands that Vim has but I still get a little bit of the modal editing that I wanted.

Fast forward to december 2019, I was still using my homemade Sublime Text plugin but at this point my .vimrc was almost good enough to start using vim fulltime in my job. There was only one thing missing: a "guess indentation" feature. I looked around for plugins for that but they didn't work exactly like I wanted. The one that came close enough was vim-sleuth, so I basically took their main function and pasted it on a file I called custom-commands.vim (Now it's called guess-indentation.vim). After that I was ready to stay in vim-land.

Fast forward to december 2020 (the world almost ended like 10 times [each day]). I'm using neovim + tmux and I'm happy with this. Maybe in 2021 Onivim 2 can reach a stable status and I can use that fulltime (it seriously looks good).

Update july 2021 (still no onivim 2), Neovim 0.5 was released and with it came better support for lua based configs. I now have a new config written in lua: it's here.

Top comments (2)

Collapse
 
kosich profile image
Kostia Palchyk

"I started learning Vim [...] because apparently I had nothing better to do" — Ha 😅

A great story, thanks Heiker!

My gateway to vim was this amazing and hilarious intro that I would still recommend to everyone!

"Welcome to Vim" by Derek Wyatt, 30min

Me, like everyone else, I started with vim that soon got fzf and other plugins (the community is amazing, btw!) and I worked with this setup for about a year. Simultaneously trying sublime and webstorm vim overlays (later is super heavy). Nowadays I switched to vscode+vim overlay. It doesn't have a lot of native vim features, while the upside is that you get all the vscode features out of the box with a plug-n-play vim-like experience. Yep, I'm cowardly running away from .vimrc, I admit 😔

And thanks for sharing the OniVim — will keep an eye on it!

P.S.: Dear random reader, note that Heiker also mentions tmux — a very handy tool! Do take a look at it if you haven't yet.

Collapse
 
vonheikemen profile image
Heiker • Edited

Thank you for taking the time to read it and also for sharing that video.

Yep, I'm cowardly running away from .vimrc, I admit 😔

My current vim config has 700+ lines of code (~786), uses 25 plugins (26 if you count the plugin manager itself), depends on 4 external commands (5 if you would like to count tmux), and it took me like 14 months to get it in the "right state" to be able to use it for work. I cannot judge anyone who wants to keep using their favorite IDE/text editor with a vim emulation plugin. It is safe to say you made the right decision.