Add Mac OS X compatibility for ranger feature of syl20bnr theme

This commit is contained in:
syl20bnr 2014-07-15 22:39:52 -04:00
parent 59ada029a4
commit ba780ef93f
2 changed files with 21 additions and 3 deletions

View File

@ -13,6 +13,7 @@ Sylvain Benner personal, compact (hmmm...) yet complete (almost :-)) oh-my-fish
- [end](#end)
- [where](#where)
- [Functions](#functions)
- [Mac compatibility](#mac-compatibility)
- [Cygwin compatibility](#cygwin-compatibility)
## Segments
@ -101,12 +102,18 @@ This segment is displayed in the right prompt.
Some functions come with the theme:
- `toggle_right_prompt` will... toggle the right prompt! (alias: `trp`)
## Mac compatibility
In order to make this theme work correctly with all the features make sure to
install the following packages via MacPorts or Homebrew:
-`pstree` (used in ranger detection)
## Cygwin compatibility
In order to make this theme work on [Cygwin][cygwin], make sure to install the following
packages:
- `bc` for `math` fish function
- `psmisc` for `pstree`
- `psmisc` for `pstree` (used in ranger detection)
- `git` if you want to use the `git` segment.
[git]: http://git-scm.com/

View File

@ -166,8 +166,19 @@ function fish_prompt -d "Write out the left prompt of the syl20bnr theme"
# the current shell process and get back to the ranger process.
set -l ps_end ">"
# indicator for ranger parent process
set ranger ""
if pstree -p -l | grep "fish("(echo %self)")" | grep 'ranger([0-9]*)' > /dev/null
set -l ranger ""
set -l os (uname)
if test "$os" = "Darwin"
if pstree -s ranger | grep (echo %self) | grep -v grep > /dev/null
set ranger 1
end
end
if test "$os" = "Linux"
if pstree -p -l | grep "fish("(echo %self)")" | grep 'ranger([0-9]*)' > /dev/null
set ranger 1
end
end
if test -n "$ranger"
set ps_end $ps_end$ps_end
end
# last status give the color of the right arrows at the end of the prompt