:: home : bio : blog
A storm in the distance, hopefully receding.
August
Sun Mon Tue Wed Thu Fri Sat
   
   

Contact


 

Archives

Recent Posts

Wed, 30 Aug 2023
WILL : Change Vim Tab Colours
# 16:02 in ./tech

What I learnt Lately no. 2 : How to change the colour Vim uses for its tabs.

The editor Vim has "tabs" similar to tabs in other applications (text editors, browsers), or at least can be made similar. I use a plugin called buftabline for my Vim tabs. Vim buffers are shown as classic-style tabs along the top of the window.

One thing I didn't like was the fact that the empty space on this tab bar was shown as white :

To change this, use the "highlight" command and apply different colours to the tab elements :

That's much better and a lot clearer to see what buffer/tab I'm looking at with a glance.

This is what I have in my .vimrc settings file :

highlight TabLineFill term=bold cterm=bold ctermbg=0
highlight TabLineSel ctermfg=0 ctermbg=LightYellow

Note that the vim plugin buftabline has its own set of colour (highlight) groups e.g. BufTabLineActive (these are linked to the built-in tab groups). See the github page.

Reference :

This page was very useful :


Tue, 29 Aug 2023
What I've Learnt Lately: WILL
# 16:14 in ./tech

I love tinkering around with the computer and digging into some of the aspects of running Linux, or the more interesting applications it can host. Take the editor Vim. Not a text editor for the masses (to say the least) but it does have an extremely broad and deep set of features and also a whole swathe of settings for them. I've not done much painting recently and have spent some time sorting out my computing experience. For this, I've learnt quite a few new things and it's made me remember how pleasurable learning stuff is.

So : What I have learnt lately a.k.a. WILL. Maybe I will try and document some of these things, if only for my own reference later.

Vim Lookaround

Viewing some old server backup logs (something else I've been "fixing"), I wanted to jump to the next line not starting with a word ("deleting").

I use the Vim text editor and to find a line that starts with a string, use the "^" regex anchor. Press "/" and :

/\v^deleting<cr>

The "<cr>" means press the return/enter key. So "^deleting" matches the word deleting at the start of a line.

The "/v" means interpret the pattern used as "very magic", so no need to quote brackets etc. See vimdoc for an explanation.

Now for the good stuff (and new to me) : to find a line not starting with "deleting", press "/" and :

/\v^(deleting)@!<cr>

This is similar to before but we wrap the pattern in brackets and end with "@!". The "@!" is a negative lookaround (i.e. "lookbehind") i.e. looks for no matching pattern behind us. The "^" means "at start of line" (behind us).

To help retain a piece of knowledge, it's usually useful to write it down somewhere.

Reference :


© Alastair Sherringham 2023
Powered by Blosxom.
Still going after all these years.