5 ms·
A Powerline-style prompt for Bash
- mikeroher 14y agoAnybody else having problems getting it to work? It's just flashing for me. I've installed a patched version of Inconsolata but still no luck.
- milkbikis 14y agoNote: showing colors in terminals is done through ANSI codes which have varying levels of compatibility with different terminals. For me, this works on an iTerm terminal, with $TERM set to xterm-256color.
- mikeroher 14y agoYeah that was the problem. I realized that Snow Leopard's default terminal doesn't have support for ANSI colors..I think. Anyways, if you're on Snow Leopard or earlier versions of Mac OSX, you need to use iTerm2. Also, to make the PS1 smaller, you can delete the two lines in the last method (the constructor I think) that prints the hostname and user. So, delete or comment: p.append(' \u ', 250, 240) p.append(' \h ', 250, 238)
- milkbikis 14y agoYup, just remove/comment out any portions (Powerline calls it segments) you don't like.
- JulianWasTaken 14y agoOh, boy, props for getting this working, but this looks really distracting to actually use as a prompt for my tastes.
- milkbikis 14y agoYeah, I also have one that fixes the prompt to the top so you only see a small '$' at the current line, but it messes up the terminal history.
- pdenya 14y agoBy messes up terminal history do you mean when you push up in terminal the previous lines that show up are rendered badly or that your actual history is effected in some way?
- milkbikis 14y agoI used the ANSI control codes for moving the cursor, which seems to overwrite previous lines. Not sure if there's another way to achieve that without overwriting lines though.
- ericbb 14y agoMaybe use \033[L (ANSI for insert-line). Edit: If I understand what you're doing, then maybe you can use this: tput ind; tput home; tput il1; echo -n "header"; tput el; tput cup $LINES 0 Use "man terminfo" to lookup things like "il1" and use "infocmp" to see what they translate to in your terminal.
- ralph 14y agoI too prefer just PS1='$ ', I want the cursor to be the same distance from the margin every time, to have maximum length for typing without wrapping, and the ability to put in a few separator lines between command output by just tapping Return. However, for your problem, have you considered the terminal's title instead of the top line of the tty? printf '\033]0;foo\007'
- milkbikis 14y agoHmm, that wouldn't let me keep the colors etc. I'm on iTerm btw, perhaps you mean the title in a screen/tmux session?
- yankcrime 14y agoClever, but Powerline-themed context around your current shell environment seems more suited to implementation in something like tmux - see https://github.com/erikw/tmux-powerline https://github.com/erikw/tmux-powerline or http://www.drbunsen.org/text-triumvirate.html http://www.drbunsen.org/text-triumvirate.html
- oelmekki 14y agoI defenitely like the "make previous return status obvious" thing. Will use that idea in my prompt, thanks.
- cellularmitosis 14y agoHere's what I use: https://gist.github.com/3686357 https://gist.github.com/3686357 It looks like this: http://i.imgur.com/523PD.png http://i.imgur.com/523PD.png
- oelmekki 14y agoThanks. After reading the post, I turned my prompt into that : https://gist.github.com/648a75ec821acff10749 https://gist.github.com/648a75ec821acff10749 which looks like that : http://i.imgur.com/Qc86I.png http://i.imgur.com/Qc86I.png I like having an uri directly pastable to scp. Also, as mentioned in other comments, Having a fixed length prompt on the command line is quite appreciable. I'm unsatisfied, though, with the need of subshells to draw a single prompt. It's ok for the git part, but I feel like the PROMPT_COMMAND part is a hack, I just can't succeed in making it displays colors (rather than escaped characters) without a subshell.
- shell0x 14y agoI don't like the powerline style for displaying the path, but I like it in tmux. It looks really awesome compared to the defaults(green background for the status line).
- davorb 14y agoThe same thing for zsh https://github.com/jeremyFreeAgent/oh-my-zsh-powerline-theme https://github.com/jeremyFreeAgent/oh-my-zsh-powerline-theme
- sdfjkl 14y agoPatching my fonts seems a bit excessive just for a fancy prompt.
- Evbn 14y agoWhy are the colors broken (in ' Library') in the riced up vim?
- milkbikis 14y agoThat's the CtrlP vim plugin, which runs a fuzzy search. In the screenshot I'm in the middle of a search so the matched part is partially highlighted.
- Evbn 14y agoPowrlbe is nifty. How do I subscribe to news about new tech stuff like that? I don't remember seeing it here.
- milkbikis 14y agoI'd like to know too. Just saw it in a dotfile.