Created
November 16, 2016 16:36
-
-
Save dmsmidt/d77ad49e17852d080db48afbc295aa0a to your computer and use it in GitHub Desktop.
Fish Settings | Drupal + Git Prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set binary paths. | |
set PATH /usr/local/bin $PATH | |
set PATH ~/bin $PATH | |
set PATH ~/.config/composer/vendor/bin $PATH | |
set PATH echo (ruby -e 'print Gem.user_dir')/bin $PATH | |
set -x COMPOSER_DISABLE_XDEBUG_WARN 1 | |
# Start X at login on TTY1 | |
if status --is-login | |
if test -z "$DISPLAY" -a $XDG_VTNR -eq 1 | |
exec startx -- -keeptty | |
end | |
end | |
################# | |
## LESS colors ## | |
################# | |
set -xg LESS_TERMCAP_mb (printf "\e[01;31m") # begin blinking | |
set -xg LESS_TERMCAP_md (printf "\e[01;31m") # begin bold | |
set -xg LESS_TERMCAP_me (printf "\e[0m") # end mode | |
set -xg LESS_TERMCAP_se (printf "\e[0m") # end standout-mode | |
set -xg LESS_TERMCAP_so (printf "\e[01;44;33m") # begin standout-mode - info box | |
set -xg LESS_TERMCAP_ue (printf "\e[0m") # end underline | |
set -xg LESS_TERMCAP_us (printf "\e[01;32m") # begin underline | |
################## | |
## Git settings ## | |
################## | |
# See: https://github.com/fish-shell/fish-shell/pull/880 and https://github.com/fish-shell/fish-shell/blob/2.2.0/share/functions/__fish_git_prompt.fish | |
# Characters (can override defaults of show_informative_status) | |
#set -g __fish_git_prompt_char_upstream_ahead "↑" | |
#set -g __fish_git_prompt_char_upstream_behind "↓" | |
#set -g __fish_git_prompt_char_upstream_prefix "" | |
#set -g __fish_git_prompt_char_stagedstate "●" | |
#set -g __fish_git_prompt_char_dirtystate "✚" | |
#set -g __fish_git_prompt_char_untrackedfiles "…" | |
#set -g __fish_git_prompt_char_conflictedstate "✖" | |
#set -g __fish_git_prompt_char_cleanstate "✔" | |
# Colors | |
set -g __fish_git_prompt_color_branch magenta | |
set -g __fish_git_prompt_color_dirtystate yellow | |
set -g __fish_git_prompt_color_stagedstate yellow | |
set -g __fish_git_prompt_color_invalidstate red | |
set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal | |
set -g __fish_git_prompt_color_cleanstate green | |
# Settings | |
#set -g __fish_git_prompt_showupstream "informative" | |
set -g __fish_git_prompt_showdirtystate 1 | |
set -g __fish_git_prompt_showstashstate 1 | |
set -g __fish_git_prompt_showuntrackedfiles 1 | |
set -g __fish_git_prompt_describe_style "contains" | |
set -g __fish_git_prompt_showcolorhints 1 | |
set -g __fish_git_prompt_show_informative_status 1 | |
######################### | |
## Drush current alias ## | |
######################### | |
function _drush_alias_name | |
set -l pid %self | |
if test -f "/tmp/drush-env/drush-drupal-site-$pid" | |
echo (command cat /tmp/drush-env/drush-drupal-site-$pid) | |
end | |
end | |
################# | |
## Fish prompt ## | |
################# | |
function fish_prompt --description 'Write out the prompt' | |
set -l last_status $status | |
if not set -q __fish_prompt_normal | |
set -g __fish_prompt_normal (set_color normal) | |
end | |
# PWD | |
set_color $fish_color_cwd | |
echo -n (prompt_pwd) | |
set_color normal | |
printf '%s ' (__fish_git_prompt) | |
if not test $last_status -eq 0 | |
set_color $fish_color_error | |
end | |
# Drush current alias | |
if [ (_drush_alias_name) ] | |
echo -n (_drush_alias_name) | |
end | |
echo -n '$ ' | |
set_color normal | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment