Today we’re trying out vim-airline, the statusline plugin.
vim-airline improves upon Vim’s existing statusline.
Out of the box, vim-airline adds a mode indicator (
INSERT), a current status indicator with e.g. version control change numbers (
+0 ~0 -0), the file path and unsaved status indicator, the file format (
markdown), the file encoding (
utf-8[unix]), the total word count (
150 words), a relative position indicator (
17%), a current line/total lines indicator (
16/20), a current column indicator, and a section for external plugins. The Readme provides more exact descriptions of each section.
Install the plugin and re-open Vim to see your new status bar. That’s it!
In my estimation, few if any parts of a terminal-based app UI attract more customization than the statusline. Only the terminal prompt itself might compete. (I’ve added both 🍔 and 🦊 emoji to mine over the years.) vim-airline, naturally, offers extensive customization.
Where better to start than with themes? I went with the plugin project’s official themes.
bubblegum caught my eye, as did minimalist, deus, and solarized dark. I prefer a minimum of distraction and brightness, in keeping with my white-on-black “dark mode” theme for Vim as a whole, and all of these fit that criteria.
This was when I realized something was off about my terminal: I didn’t see any of the arrows I saw in the screenshots! And I had been looking forward to those, too.
(In Debian/Ubuntu) $ sudo apt-get install fonts-powerline
(In the Vim config) let g:airline_powerline_fonts = 1
Unfortunately, I encountered a subtle alignment issue with the arrows:
I tried the Fira Code font instead.
Fira Code Regular at size
11 seemed to do the trick. I’m not 100% sold on this particular font but I’m giving it a try. I did go with the Ubuntu default font out of pure inertia, after all, and what better time to adjust other parts of my interface than while I’m customizing Vim?
With those issues resolved, I settled on the
Unlike other themes, its colors remain the same when switching between
insert, and other editor modes. I found that much less distracting.
Even with a subtle theme, I still found the contents of the statusline too cluttered for my taste. Note: I tend towards narrow windows so your mileage may vary.
Note: You can refresh the vim-airline status bar from inside of Vim with:
y didn’t feel especially useful to me so I emptied them out:
let g:airline_section_x = '' let g:airline_section_y = ''
I found the word count section distracting, as well, so I disabled it. (A habit from my NaNoWriMo days, when I would avoid visible word counts or timer countdowns in order to focus on the act of drafting to the exclusion of progress tracking.)
let g:airline#extensions#wordcount#enabled = 0
I also adjusted section
let g:airline_section_z = '🦊 %2p%% ☰ %3l/%3L %3c'
vim-airline uses the standard Vim statusline format. To illustrate with the last part:
- A Unicode character from the default format string
%3c- A field (
%), specifically the column under the cursor (
c), with a minimum size of three characters (
I added a minimum length to all these numbers in order to minimize the frequency of section width changes (e.g. from line
99 to line
100). This reduces one otherwise pernicious distraction.
I added the 🦊 emoji at the start as a personal touch. Isn’t she adorable?
After all that, I feel content with my statusline. I look forward to tweaking it for specific filetypes, projects, and environments going forward. How might you change your status line?
vim-airline doesn’t seem to play nice with Goyo so I wrote this post with only the former enabled. That said, combining the two does defeat the purpose of Goyo so that was no great less.
I loved writing this series on Vim plugins. Researching this plugin, in particular, pointed me to many, many other plugins worth checking out. I hope that you find more useful plugins there and that you enjoyed reading this. Now go out there and have some Vim fun!