Why I'm using vim
Sorry, this is going to be more technical than the previous post: feel free to skip this post if you’re not into geeky details.
What’s vim?
Let’s get in the context: a program to edit files. But a program that have really old roots and working well when you don’t want to touch your mouse. It even works in the console as the interface is all text.
The project home page is here: https://www.vim.org/
There are a lot of text editors, I’ve used a few: Emacs, VSCode, neovim, IntelliJ, Eclipse, nano or even Notepad++. But vim is the one that’s working great for me.
Why I use and love it
When I discovered Linux, somewhere around 1997, I didn’t manage to have a graphical environement, X11 was so hard to configure. The only text editor that my mother found in the default console was vim. I was really annoyed when she explained to me what I actually had to type to edit my X11 configuration file. And I couldn’t event use the mouse. Don’t even think about quitting vi!
Fast forward a few years and I enjoyed using other GNU/Linux distributions.
This time I tried to understand a few commands and it saved me a bit of time
while trying to fix things. When I started working, every Unix I worked on had
this editor. So I had to learn to use it. The documentation is good, you can
start with vimtutor
and there is the :help
command inside.
In 2015, I tried to improve my typing and I switched my keyboard layout. It was a great time to revisit my usage. I read a lot of articles and documentation to improve my skills in this editor. I discovered the blockwise visual mode and insert mode completion. I never supposed this kind of features before.
Settings
Default settings can change, it can vary depending on your Linux distribution.
In my case, in almost all the places I use this editor, it’s a Debian GNU/Linux
context. Even between versions you can have surprises such as the 'mouse'
setting.
Here are a few settings that I come to appreciate on my local machine, in the
~/.vim/vimrc
file:
set list listchars=nbsp:⎵,eol:↲
set number
set smartindent
set textwidth=80
:filetype plugin indent on
As I like to use unbreakable spaces, very handy in French before punctuation, I want to see them. And nothing fancy, that’s almost all.
For format specific options, I use the
ftplugin-overrule
capability. As a mutt
user, I like to set a few options, but just for this
usage. That’s why I have a ~/.vim/after/ftplugin/mail.vim
file with this
content:
set linebreak
set formatoptions+=w
set number
set spell
set spelllang=fr,en
I don’t want to go into details with all those settings, if you want more info,
read the manual: :help
in
vim
.
I don’t use any additional plugins and I try to learn and, at least, know what features it can do. As a production/DevOps engineer, under any conditions, in the middle of the night on an emergency for example, I know I’ll have to use it. I don’t want to rely on a personal macro or setting that I won’t find on one of the hundreds of environments (I have to share with my colleagues) that I couldn’t tweak or prepare.
Beyond the editor
As I’m a long time (almost 20 years) vim user, a lot of the key bindings and logic feel natural to me. That’s why sometimes I’m looking for relatives in the free software world. Just to list a few of them:
newsboat
as an RSS readermutt
as an email reader where vim is a first time citizen to compose your messagestridactyl
to browse the web with your keyboard in Firefox with vim-style key bindings
And to finish this post, I’ll give a huge thanks to Bram and all the project contributors. Also thank you everyone sharing your tips and tricks anywhere. Sometimes I like to visit the VIM Community on Reddit and find really interesting points of view and new commands.