Vim as a lifestyle
I have been using Ubuntu since 2018 , but I have never heard about VIM till the summer of 2019. I clearly remember this day when I had a pair programming session with my Team Lead where we tried to solve some config bug in production server.The server didn't have nano(console based text editor that I used before).So consequently I asked how am I supposed to edit this file through ssh session in terminal.And at this point of time I met an awful editor called Vim which took me 50 minutes to change one line of code(Team Lead didn't help and asked to figure this out by my own) and I never regret about it because it completely changed the way I use my environment in a daily basics.
Best text editor
Since then , I have been
learning Vim and still I
could find a thousand of
features that I'm not
aware of.
But if it is as awful as
I said before then why
did I decide to use it
in the first place? To
be honest I didn't. I
hated this editor
because I thought about
it as a cumbersome
software which is hard
to use and it doesn't
worst it. Just for
curiosity , I googled
how people usually use
it and I was shocked. I
didn't see black screen
that I saw in the first
time. I saw
autosuggestion and
syntax highlighting
inside the editor with a
beautiful theme. And
then I started my
journey with Vim(Right
now I use
Neovim).So why Vim and how it
changed the way I think
and use the software.
VIM?
According to WikipediaVim is the editor of choice for many developers and power users. It’s a “modal” text editor based on the vi editor written by Bill Joy in the 1970s for a version of UNIX. It inherits the key bindings of vi, but also adds a great deal of functionality and extensibility that are missing from the original vi.
Configuration
Vim is super configurable. You could customize every keyboard or combination of keyboards to do whatever you want.The best advise that I want to share: Don't copy paste a whole config from other people.Don't do it. Every person who knows how to use Vim configure it for own purposes. Learn how to configure Vim and then check how other people do it in order to take some ideas. But never blindly copy paste it(I did once and it took me a lot time to understand why all keys that I knew didn't work as I expected).BTW here is mine config if you need some inspiration. It's configured to work with js,python and golang.
Plugins
I don't know much about VSCode but IntellijIdea doesn't have the variety of plugins that Vim has.All of them are opensourced and managed by people for free(The power of Open source community). But be careful , sometimes those plugins reconfigure your key bindings(always check documentation in advance).
Language server protocol support
If you don't know what that means, it's basically code completion and error highlighting that you have in your favorite Idea.Vim has a plugin for it as well so you could configure Vim to be as smart as something like Intellij(Check coc as an example).
What is wrong with GUI editors?
My favorite editor is
Intellij.It really
increases my
productivity working
with huge Java
codebases.However it has
two huge disadvantages.
First of all, the
version that I use is
not free and Community
version doesn't include
all the plugins that I
need.
Secondly, it's bloated.
It consumes a lot of RAM
and CPU in my machine which is not the
most powerful one(BTW if
you use Language server
as Coc then it will
consume CPU as well
because it uses Nodejs
under the hood, I had
this problem , upgrading
Node from 12 to 14 fixed
it).
Thirdly, it has a bloated ui
with thousands of
buttons that I don't
use and can't
remove.Lastly it
consumes a battery too
fast so it's not a good
idea to work with it out
of your home.In Vim you
configure everything by
yourself and if you are
not happy about
performance or view then
it's easy to fix it
within your
configuration.
How vim changed the way I think about a software
Watching and reading
tutorials about vim I
always heard the same
idea: GUI makes you
slow.And it's partly
true. It is much faster
to open terminal(I use
Alacritty
BTW) and type what you
want instead of waiting
for GUI window to
appear(Yes my laptop is
really slow) and
then pressing bunch of
buttons to finally get
an option that you
want.The point is:
Terminal with keyboard
is faster then GUI with
mouse.But it's not
always possible to
replace GUI program with
something which is as
keyboard driven as Vim
or is it?
I found a bunch of
opensource software that
helped me to speed up my
workflow.And here is the
list of some of them:
-
Browser?
I use firefox as my main one and I found an awesome plugin called Vimium that brings Vim key bindings to the browser.
-
File manager?
As a file manager I would recommend ranger which is A VIM-inspired filemanager for the console.
-
Terminal?
Yes even terminal. I found it annoying to use arrow keys in order to edit a command in my terminal. Bash has a vi mode that allows you to move cursor in the terminal using Vim bindings but it doesn't allow you to delete or modify words using shortcuts. That is one of the reasons why I changed my shell from bash to zsh that has a whole Vim bindings support (I also modified zsh to have more vim bindings, you can find my config here ).
-
Editor?
I think in the beginning of your Vim journey you won't be happy using vim as your main editor at work because instead of solving real business problems you will penetrate your brain with all those vim bindings and configurations.It happened to me as well so I recommend you to find Vim plugin for your editor to start with and disable it if you have to concentrate on tasks. For example I still use IntellijIdea to work with Java but I use IdeaVim plugin that brings vim functionality into the editor(Here is my IdeaVim config).For the first time I used to disable this plugin when I worked and enabled it when I wrote some open source code.Now I use it constantly and mostly replaced all Intellij mappings with Vim mappings.
Final words
Vim and Vim inspired software made my workflow much easier and faster.I didn't mention all Vim based programs that I use ,probably I will do another post about it where I will explain how awful some programs are(Yes Adobe I'm talking about you) and how to replace them with lightweight, vim based ,open source solutions(Zathura is my best friend to with pdfs).
And lastly. Here is how Vim looks like using my config(pure and elegant).