After incorporating Powerline into my dotfiles I got a very good looking prompt for Bash and Zsh, plus a nice status line for Tmux and Vim. I quickly noticed some performance problems, but they didn’t seem serious and I considered that an acceptable trade-off for features.
Two weeks into Powerline, I still felt the ugly spots that I pointed out:
- High prompt generation time
- Unhandled
Ctrl+c
argparse
needs to be installed for Python older than 2.7
Unfortunately I did find more bad news.
More Performance Problems
Resource usage is not a problem on my hefty laptop, but it really takes toll on e.g. a VPS with 512 MB of RAM. Waiting for a few seconds to see the prompt was a normal sight on my Raspberry Pi. On remote servers I could occasionally overwhelm the whole system just by starting Tmux.1
The first time that happened I suspected something else, tried to figure out what caused all the thrashing, and was surprised to see a lot of Powerline processes. Apparently Powerline had started some task in the background, and started a second task when the first hadn’t finished yet. Consequently the system slowed down even more, and the third and forth tasks were started shortly afterwards, none of which stands a chance to finish.2
The “fix” for the overwhelming problem required me to ultimately remove the informational section from Tmux’s status line. I didn’t find a reasonable way to improve general performance.
But that wasn’t a fix. Without the informational section, Powerline’s role in my Tmux is just eye candy. I suppose I can do that with a little RTFM, maybe stealing the styles from Powerline along the way if I need to.
On Ease of Integration
Let me get this right: Powerline is super simple to use. The documentation is also crystal clear and very detailed. With my dotfiles, it becomes a part of my other configurations, and using it is just a matter of one copy-and-paste. The problem is not with Powerline, but rather with the assortment of systems that I work with.
The requirement of argparse
is the first sad thing. I support quite a few
servers running Ubuntu 10.04 and Centos 5 and they don’t come with Python 2.7.
On the one hand, I can see that Powerline is a thriving project that wish to
use the best technology available. One the other hand, Ubuntu 10.04 and Centos
5 haven’t reached their end of life yet, and thus it makes sense for me to
support them.
The second sad thing is with Arch Linux. I use Arch Linux ARM on my
Raspberry Pi. Arch Linux comes with Python 3 so it doesn’t need argparse
.
However, Vim in Arch Linux isn’t built with Python support, so I can’t use
Powerline there. I could still can try to install another version of Vim or
build one myself, but that leads to the next problem.
I don’t feel comfortable using a set of dotfiles that is more complicated than useful. The many issues with Powerline aren’t impossible to resolve, but they keep reminding me what I have done to my dotfiles:
- I included some modified fonts with special Unicode glyphs
- I have a nice prompt, but if I copy something from my terminal that contains the prompt to someone else, they see garbage instead
- I occasionally need to install a Python package using admin permissions
- I might have to install a custom-built version of Vim
In retrospect, almost every time I “fixed” something in my Powerline setup, I also added something into my dotfiles, that I don’t consider good for dotfiles. That’s a step in the wrong direction.
Peace of Mind
So I decided to write my own prompts and status lines again, learning from the way Powerline works. The result is very pleasing and well worth the time.
Here are the features added to my Bash/Zsh prompt, compared to my previous prompt:
- Use the same code for both Bash and Zsh
- Be smart when printing current working directory3
- Show the exit code of the previous command, but only if it’s non-zero
- Use hand-picked colors4
For Tmux, I make it exactly what it should be: a color theme.
As for Vim, I should do the same thing as I did to Tmux, but now I’m feeling that the default status line is pretty enough. Yes that’s right I don’t even revert to vim-powerline, now that I have realized it’s the contents that should get the emphasis, not the status line.
Questions or comments can go to Google+ :)
-
And I use Tmux all the time, so this is a big deal. ↩
-
I’m almost sure there is a name for this situation, but what is it? ↩
-
Print at most 3 slashes, so
/home/phunehehe
becomes/home/phunehehe
, but/home/phunehehe/.config/autostart
becomesphunehehe/.config/autostart
. ↩ -
Many thanks to 256 xterm colors and their equivalent RGB. ↩