but she's a girl...

[Femina geekoides]

Tmuxline and Promptline

tmuxline and promptline

Sometimes, tinkering begets more tinkering. Writing about my most recent tinkering session in Tinkering with Vim, I found myself wanting to tweak one or two things a little further. This was partly because I came across a couple of very interesting Vim plugins (tmuxline.vim and promptline.vim) that – oddly – act to alter the appearance and function of the tmux status bar and the shell prompt respectively.

While I liked my previous powerline setup, a few things niggled me a little about it:

  1. It was a little CPU intensive on older machines. This is partly my fault because I was using a few features like checking the weather, displaying the current track, mailbox count and so on. Even so, you want your terminal to be snappy, even if nothing else is.
  2. The setup was rather complex, as I found when someone asked me how I got powerline to look the way I did, and I had some trouble tracking down all the relevant settings files.
  3. The colour scheme didn’t match the nice Solarized one I had for Vim. I know: “Mercy me! My terminal colour schemes don’t match, what will the neighbours say?”

tmuxline.vim tackles point 3 by setting the tmux status line to the same colour scheme that you are using with airline within Vim (it’s also compatible with lightline if you use that). You can also configure the tmux status line more easily with ‘segments’ which get automatically styled, which helps a lot with point 2. The odd thing is that you do this within Vim. You can either use the included themes and presets (layouts), or you can use simple configuration within your .vimrc to set the theme and/or the layout to your preference. You then run a command (again within Vim) that generates a file with the code tmux needs to configure itself. All you need to do then is source the generated file in your .tmux.conf to have everything set up the way you want it even before you have launched Vim. It feels a little odd doing it this way, but in practice, it works well and keeps the configuration neat and easy to modify. I’m really happy with my new status bar, which gives me all the information I need without being over the top, and is very fast and light, solving point 1.

promptline.vim applies the same principle to constructing a shell prompt. You set it up the same way, with optional configuration in your .vimrc, use the command within Vim to generate the code in a file, then source that file in your .bashrc or .zshrc. What I’ve done is move some of the git branch and status info from the tmux status bar to my promptline. My prompt shows the truncated path, and if in a git repository, the branch, current sha, and on the right side, symbols show the status (uncommitted changes, commited changes to push etc.), all in a style matching the Vim status line and the tmux status bar. In addition, if I’m in a Python virtualenv, it gives the name of the virtualenv.

I’ve updated the gist with my new config if you’re curious to try it out.


review films View comments

Last weekend, we finally finished watching one of the best films I have seen in weeks: Nebraska. I say finally because we had to return the first DVD to Lovefilm because it was scratched so badly it wouldn’t play. To divert from my subject for a moment, what the ...

Continue reading

LaunchBar 6

I know from bitter experience of using other people’s Macs that I find it very hard to use a computer without a launcher of some kind installed. Having to mouse around to launch applications or files (let alone all the other things that launchers let you accomplish) feels positively ...

Continue reading

New turntable

hifi geekery View comments

Full view of turntable

Last weekend my brother brought me a wonderful turntable. It was one that he had made himself about 15 years ago. Since it was now surplus to requirements, he asked if I would like to use it. I’ve mentioned before that I tend to do very well out of ...

Continue reading

Surfing spring waves

mumblings View comments

My favourite time for cycling to work is in the spring. Everything feels new and fresh. The timing of my commute is such that in spring it coincides neatly with a frenzy of birdsong. I ride on cycle paths through little fragments of nature reserve, parks, and scruffy, forgotten bits ...

Continue reading

Activity elsewhere
Social media