8

Background

I found very interesting the Powerline project. After several attempts, I managed to get it to work correctly for Vim. Then I did proceed with enabling it for tmux, by pasting the following line in my ~/.tmux.conf.

source '{repository_root}/powerline/bindings/tmux/powerline.conf'

It doesn't work as expected. This is the way it looks at the moment (plus the line above I pasted in the configuration file).

tmux and Powerline

Question

How can I get it to work as expected?

Expectation: basically, date and time on the right side.

left side of tmux right side of tmux

These screenshots come from another project, tmux-powerline, which evolved to Powerline. Therefore I expect the new plugin to have a similar status line organisation. Furthermore, this "expectation" is supported by this configuration file for tmux.

Rewording the question

I'm trying to get Powerline work correctly for tmux. The left part (13 > 1 > bash > 2 > vim >) is fine, the right one (< Sat < 2012-06-16 < 18:51) is missing. About tmux's alternative status bars, I do have already mine, nicely polished ;) My question, here, is only about getting Powerline working properly, otherwise I believe vim-airline would do a better job as a even lighter plug-in.

Further information

Vim version: VIM - Vi IMproved 7.4
tmux version: tmux 1.8

  • From your screenshot you are editing ./.tmux.conf but it isn't clear what directory you are in. Can you verify that you are in your home directory and not accidentally somewhere else? – casey Mar 12 '14 at 4:13
  • Sure, :pwd says /home/atcold which is my ~ – Atcold Mar 12 '14 at 4:14
  • Your configuration is working (look at the changed status line). It's different from the screenshot because (1) the screenshot is taken from another program tmux-powerline and (2) that's not the default behavior. You need to add the config from the link in your quote. – phunehehe Mar 12 '14 at 6:10
  • Ok. I've already pointed (1) out in my question, and (2) I don't really know where/how to add the config (which is installed automatically with the program in ~/local/lib/python2.7/site-packages/powerline/config_files/themes/tmux/default.json and I copied to ~/config/powerline/themes/tmux/default.json as explained here). – Atcold Mar 12 '14 at 6:20
  • Thank you for your contribution! I've tried airline and quite a few suggestions; for me the real issue is just file name, so something simple such as the solution with the biggest code sample here was quite sufficient. As you've found out I've witnessed how something like tmux can also multiplex the difficulties associated with the terminal configuration. – user44370 Mar 13 '14 at 0:54
4

From your screenshot it looks like you are running into an issue with your terminal being toe narrow for everything powerline throws into the default tmux config. I ran into something similar recently¹. It seems powerline does not degrade its tmux config for narrow terminals as gracefully as its vim one. There are, however, at least two things you can adjust:

  1. Copy the powerline module configurations to your home directory if you haven't already and modify the theme for tmux. Try dropping some of the modules until what remains will fit on your line.

  2. Change the overall length allotted to the status segments. As these are set in the powerline.conf file you are including, you will need to set them in your .tmux.conf after that include:

    set -g status-left-length 20
    set -g status-right-length 150
    

    Those are the default values. Try reducing them until something fits.

Note due to the width settings as noted above, if I narrow the terminal below a few more columns, the right status segment will disappear altogether leaving just the left and window pane name segments:

tmux powerline sample

Edit: I just noticed that your tmux version is 1.8. I don't know for sure if that will effect you but I do know there were major changes to the way status bars are configured going into 1.9 and a quick look through the powerline source shows they are doing version checking for < 1.9 and using a degraded feature set for earlier versions. It looks like you should still get a right status of some sort, but that might be complicating your debug process. I highly recommend upgrading to the latest tmux.

¹ I just recently implemented powerline across my zsh, vim, tmux, and awesome configs, spent a week with it, and yesterday abandoned it. It was just too much pain for too little gain, especially with having to work across multiple distros and OSes. I have, however, implemented basically the same thing without the bulk. My tmux config for example is basically a rip-off of the output of powerline in plain tmux values that are ealies to get working on different hosts. For vim I went with airline; for my zsh prompt I wrote my own theme for prezto that uses powerline-ish features.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.