If you’re using a custom color scheme (why wouldn’t you?) in conjunction with a terminal mode in Vim (again, why wouldn’t you?), you may have noticed that the terminal status bar has no respect for your color scheme.

Run :term, and you’ll be greeted to the default status bar:

Since terminal mode is still in beta in Vim 8.1, we have to manually set the highlighting groups. It’ll require a bit of digging.

Navigate to the directory containing your current color scheme. Depending on the plugin manager, the color schemes are located in different places. On Linux, default color schemes often live in /usr/share/vim/vimcurrent/colors. In this example, I’m using PaperColor scheme, and I have it installed using vim-plug in ~/.vim/plugged/papercolor-theme, and colors/PaperColor.vim is the file we’re looking for.

Search for StatusLine and StatusLineNC (tip: you can do a whole word search in Vim by running /\<StatusLine\>), and note the values used (you might have to jump through a few variables if the color scheme author decided to be fancy). You’re interested in ctermbg, ctermfg, guibg, and guifg.

You might find something like this:

hi StatusLine ctermbg=24 ctermfg=254 guibg=#004f87 guifg=#e4e4e4
hi StatusLineNC ctermbg=252 ctermfg=238 guibg=#d0d0d0 guifg=#444444

Copy those lines to your ~/.vimrc. Change StatusLine to StatusLineTerm, and change StatusLineNC to StatusLineTermNC:

" Manually set the status line color.
hi StatusLineTerm ctermbg=24 ctermfg=254 guibg=#004f87 guifg=#e4e4e4
hi StatusLineTermNC ctermbg=252 ctermfg=238 guibg=#d0d0d0 guifg=#444444

Reload ~/.vimrc (:w | so %), and the terminal mode status line should have the same colors as your color scheme:

Above, hi is a shorthand for highlight, which is used to define highlight group colors. StatusLineTerm and StatusLineTermNC define the highlight groups for terminal mode status line (in active and inactive windows respectively). Options ctermbg and guibg define the background color, and ctermfg and guifg are responsible for the foreground (text) color.

Over the past six to nine months I’ve been working on a book - Mastering Vim. Mastering Vim is a passion project which is meant to take the reader (you) from zero to a hero (future you): from knowing nothing about Vim, to becoming a power user. I cover many of Vim’s mysterious commands, philosophy behind the beloved editor, configuration tips, a plethora of community created plugins, as well as creating your own plugins.

A picture of a &#34;Mastering Vim&#34; cover.

Mastering Vim was written with support from Packt Publishing and was kindly reviewed by Bram Moolenaar (website) - the creator of Vim. Many people made this book possible, including VimConf Japan crew, who kindly hosted me earlier this year. Thank you to everyone for making Mastering Vim happen!

Give it a read and let me know what you think, Mastering Vim is available on Amazon!

P.S: This post, like many others, is written in Vim.

I’ve recently switch to vim-plug, a lightweight Vim plugin manager.

It comes with a little .vimrc snippet which downloads the plugin, but it only works for Unix. I use Vim across all three platforms regularly, so I updated the snippet:

" Download and install vim-plug (cross platform).
if empty(glob(
    \ '$HOME/' . (has('win32') ? 'vimfiles' : '.vim') . '/autoload/plug.vim'))
  execute '!curl -fLo ' .
    \ (has('win32') ? '\%USERPROFILE\%/vimfiles' : '$HOME/.vim') . 
    \ '/autoload/plug.vim --create-dirs ' .
    \ 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif

The above should work across all three major OSes, since Windows 10 recently received curl support.

For the past few years I’ve been trying to focus on having more mindful experiences in my life. I find it rewarding to be present in the moment, without my thoughts rushing onto whatever awaits me next.

I present to you the biggest distraction: my phone.

I use to get in touch with people I love. I’m more productive at work because I have access to information on the go. I also use my phone to browse Reddit, YouTube, and every other media outlet imaginable. Even worse, sometimes I just waste time tinkering with the settings or mindlessly browsing through the apps I have installed.

It’s an attention sink.

Nearly a year ago as I was browsing the Google Play Store I bumped into a new launcher: KISS. The tag line caught my attention: “Keep It Simple, Stupid”. I went ahead and downloaded the launcher. I haven’t changed to another launcher since.

Here’s how my home screen looks today:

There’s nothing besides a single search bar. The search bar takes me to the apps I need, web searches I’m interested in, or people I’m trying to reach out to.

It’s simple to use. Start typing an app or a contact name, and the results show up above the search bar:

This simple concept has been responsible for cutting hours upon hours from my phone usage. Opening an app becomes a more deliberate experience, I open my phone with a purpose (granted this purpose might be to kill hours looking at cat videos). There’s no more scrolling through everything I have installed just to find something to stimulate my attention for a few more seconds.

You can download the KISS Launcher for Android from Google Play Store.

Being the unique person I am, I love traveling. Oftentimes I end up getting deep into trying to optimize my packing methods. There are dozens of tools online designed to help with this exact thing (services like Lighterpack or GearGrams). But, being handy with code, I decided to dabble in the subject on my own.

One of the most important things in packing is the overall weight of the pack, and I always want to know what type of things are the heaviest. I also want to be able to run random queries on my data, whatever it is that I’m trying to learn. I want to have an inventory of items (backpacks, clothes, storage solutions) which I can plug in and out of a spreadsheet to see how the resulting picture changes on the go. Working with software as my day job, I’d also like for the solution to be automated whenever possible.

Google Spreadsheets turned out to be the perfect solution, providing the ability to quickly sum up the weight of my things and output insights about the data.

Final Result

Here’s a link to the spreadsheet, I encourage the reader to copy and play around with in anyway you see fit.

Here’s the final result for a multi-day trip I will have for this year. As you can see, my pack weighs around 3 kilograms or a bit over 6 freedom units (not including water). My recently purchased Nintendo Switch is the heaviest item (and it’s worth every gram as it makes flying tolerable), but clothes take up most of the weight:

I use indentation levels to show that some items are contained within other items. This also lets me calculate the absolute and relative weights of a whole container with everything inside of it (see fields labeled “Container” and “Percentage”).

The “Weight” and the “Breakdown” fields indicate absolute and relative item weight respectively, which accounts for quantity of the item (quantity defaults to 1 if not explicitly set). Weight-related fields are color coded from lightest items in green to heaviest items in red.

Categories are used to group items and execute queries on the data and learn insights like these:

There’s a separate sheet where I enter item names, categories, and weights, which I then use to automatically populate values above and autofill item names in the primary sheet:

The Technical Details

I haven’t worked with Google Spreadsheets (or Excel for that matter) a lot in the past, but with an access to clear documentation (and a hundred of web searches later) it was straightforward to get the hang of the it.

I started off by manually populating the final result sheet, manually adjusting formulas for Container/Percentage cells, as I had no idea how I would detect the indentation yet. I like when things look pretty, so I applied conditional formatting rules right away, and the looks of the sheet really haven’t changed throughout the process.

Next, I created an inventory sheet, which I wanted to use as a source of data in the resulting sheet. A few Google searches and some trial & error resulted in a lookup formula:

=ArrayFormula(
 IF(
   NOT(ISBLANK($B2)),
   INDEX(InventoryCategories, MATCH($B2, InventoryItems, 0)),
   IF(
     NOT(ISBLANK($C2)),
     INDEX(InventoryCategories, MATCH($C2, InventoryItems, 0)),
     INDEX(InventoryCategories, MATCH($D2, InventoryItems, 0))
   )
  )
)

ArrayFormula is necessary in order to create arrays on the fly without printing intermediate results in the spreadsheet. InventoryItems and InventoryCategories are named ranges referring to item names and categories in the inventory sheet. MATCH finds an index of a first occurrence of the item name in the sheet, and retrieves corresponding category name. An item weight is retrieved by the exact same principle.

Trying to find the container weight took a lot more time, and resulted in a lot more headache. Solution for handling indentation in Google Spreadsheets wasn’t as elegant as I would have hoped for, but it got the job done:

=ArrayFormula(
     SUM(
       $I2:INDIRECT(
         CONCATENATE(
           "$I",
           ROW() + IF(
             NOT(ISBLANK($B2)),
             MATCH(FALSE, ISBLANK($B3:$B), 0),
             MATCH(FALSE, ISBLANK($C3:$C), 0)
           ) - 1
         )
       )
     )

The formula above finds the first non-empty cell in a column. It starts searching from the next row (for example, for an item on a second row, we look at the third row and below). After it knows which row first non-empty cell is in, the formula turns it into a string (column $I contains item weights) and use it as an upper bound of a sum of the weights. Finished formula is a bit longer (it adds sugar to only display the number when needed), and if you’re interested - you can look it up in the spreadsheet.

For example, in the screenshot above, the formula will start looking at cells in a column right after the “Packing cube”. As soon as it finds a non-empty cell (“Nintendo Switch case”), the formula will determine this row to be an upper boundary. The formula then will sum weights starting with a “Packing cube” row, and up to but not including “Nintendo Switch case” row.

The rest involved many small tweaks, adding pretty colors, hiding N/A errors and zeroes, and trying to find the perfect shade for column borders.

And, since you made it this far, here’s how the numbers above look in the real world:

Hopefully you found this useful, or at least somewhat entertaining. There’s a lot of room for improvement, and I aimed to provide a framework and a few basic ideas for building a spreadsheet to accommodate one’s twisted ultralight needs.