Index: config/fish/fish_variables ================================================================== --- config/fish/fish_variables +++ config/fish/fish_variables @@ -4,31 +4,35 @@ SETUVAR --export LS_COLORS:di\x3d34\x3aow\x3d44\x3b37\x3atw\x3d44\x3b37\x3ast\x3d44\x3b37\x3aex\x3d31\x3asu\x3d7\x3b31\x3asg\x3d7\x3b31\x3aln\x3d33\x3aor\x3d7\x3b33\x3api\x3d32\x3ado\x3d32\x3abd\x3d35\x3acd\x3d35\x3aso\x3d32\x3a\x2a\x2ebz2\x3d36\x3a\x2a\x2edmg\x3d36\x3a\x2a\x2egz\x3d36\x3a\x2a\x2egpg\x3d36\x3a\x2a\x2erar\x3d36\x3a\x2a\x2etar\x3d36\x3a\x2a\x2etbz2\x3d36\x3a\x2a\x2etgz\x3d36\x3a\x2a\x2exz\x3d36\x3a\x2a\x2ezip\x3d36\x3a\x2a\x2eorig\x3d90\x3a\x2a\x7e\x3d90 SETUVAR --export MAKEFLAGS:\x2dj\x2016 SETUVAR __fish_init_2_39_8:\x1d SETUVAR __fish_init_2_3_0:\x1d SETUVAR __fish_init_3_x:\x1d +SETUVAR __fish_initialized:3100 SETUVAR _fish_abbr_gpg:gpg2 SETUVAR _fish_abbr_vi:vim SETUVAR fish_color_autosuggestion:303030 SETUVAR fish_color_cancel:normal SETUVAR fish_color_command:205cb3 SETUVAR fish_color_comment:6600cc SETUVAR fish_color_cwd:209060 +SETUVAR fish_color_cwd_root:red SETUVAR fish_color_end:730099 SETUVAR fish_color_error:ff0000 SETUVAR fish_color_escape:00a6b2 SETUVAR fish_color_history_current:normal SETUVAR fish_color_host:176945 -SETUVAR fish_color_jobs:ffff00 +SETUVAR fish_color_host_remote:yellow +SETUVAR fish_color_jobs:yellow SETUVAR fish_color_match:normal SETUVAR fish_color_normal:normal SETUVAR fish_color_operator:cc6fdf SETUVAR fish_color_param:3377cf SETUVAR fish_color_quote:ff751a SETUVAR fish_color_redirection:bf4080 SETUVAR fish_color_search_match:ffff00 SETUVAR fish_color_selection:c0c0c0 +SETUVAR fish_color_status:red SETUVAR fish_color_suffix:29bc7d SETUVAR fish_color_user:00ff00 SETUVAR fish_color_valid_path:normal SETUVAR fish_color_vcs:43d696 SETUVAR fish_color_vcs_braces:29bc7d Index: config/fish/functions/cd.fish ================================================================== --- config/fish/functions/cd.fish +++ config/fish/functions/cd.fish @@ -1,51 +1,66 @@ -function cd --description 'Change directory' - set -l MAX_DIR_HIST 25 - - if test (count $argv) -gt 1 - printf "%s\n" (_ "Too many args for cd command") - return 1 - end - - # Skip history in subshells. - if status --is-command-substitution - builtin cd $argv - return $status - end - - # Avoid set completions. - set -l previous $PWD - - if test "$argv" = "-" - if test "$__fish_cd_direction" = "next" - nextd - else - prevd - end - return $status - end - - # allow explicit "cd ." if the mount-point became stale in the meantime - if test "$argv" = "." - cd "$PWD" - return $status - end - - builtin cd $argv - set -l cd_status $status - - if test $cd_status -eq 0 -a "$PWD" != "$previous" - set -q dirprev - or set -l dirprev - set -q dirprev[$MAX_DIR_HIST] - and set -e dirprev[1] - set -g -a dirprev $previous - set -e dirnext - set -g __fish_cd_direction prev - end - - if test $cd_status -eq 0 - ls - end - - return $cd_status +# +# Wrap the builtin cd command to maintain directory history. +# +function cd --description "Change directory" + set -l MAX_DIR_HIST 25 + + if test (count $argv) -gt (test "$argv[1]" = "--" && echo 2 || echo 1) + printf "%s\n" (_ "Too many args for cd command") + return 1 + end + + # Skip history in subshells. + if status --is-command-substitution + builtin cd $argv + return $status + end + + # Avoid set completions. + set -l previous $PWD + + if test "$argv" = "-" + if test "$__fish_cd_direction" = "next" + nextd + else + prevd + end + return $status + end + + # allow explicit "cd ." if the mount-point became stale in the meantime + if test "$argv" = "." + cd "$PWD" + return $status + end + + builtin cd $argv + set -l cd_status $status + + if test $cd_status -eq 0 -a "$PWD" != "$previous" + set -q dirprev + or set -l dirprev + set -q dirprev[$MAX_DIR_HIST] + and set -e dirprev[1] + + # If dirprev, dirnext, __fish_cd_direction + # are set as universal variables, honor their scope. + + set -U -q dirprev + and set -U -a dirprev $previous + or set -g -a dirprev $previous + + set -U -q dirnext + and set -U -e dirnext + or set -e dirnext + + set -U -q __fish_cd_direction + and set -U __fish_cd_direction prev + or set -g __fish_cd_direction prev + end + + if test $cd_status -eq 0 + ls + end + + return $cd_status end Index: config/fish/functions/fgrep.fish ================================================================== --- config/fish/functions/fgrep.fish +++ config/fish/functions/fgrep.fish @@ -1,7 +1,7 @@ function fgrep - if which ggrep >/dev/null ^&1 + if type -q ggrep command ggrep -F --color=auto $argv else command fgrep --color=auto $argv end end Index: config/fish/functions/fish_prompt.fish ================================================================== --- config/fish/functions/fish_prompt.fish +++ config/fish/functions/fish_prompt.fish @@ -1,10 +1,10 @@ function fish_prompt --description 'Write out the prompt' set -l suffix switch "$USER" case root toor - set suffix (set_color ff0000)'#' + set suffix (set_color $fish_color_cwd_root)'#' case '*' set suffix '>' end set -l branch (git symbolic-ref HEAD 2>/dev/null) Index: config/fish/functions/fish_right_prompt.fish ================================================================== --- config/fish/functions/fish_right_prompt.fish +++ config/fish/functions/fish_right_prompt.fish @@ -5,11 +5,11 @@ test $jobs -gt 0 and set -a prompt (set_color $fish_color_jobs)$jobs test $code -gt 0 - and set -a prompt (set_color $fish_color_error)$code + and set -a prompt (set_color $fish_color_status)$code echo $prompt set_color normal end Index: config/fish/functions/grep.fish ================================================================== --- config/fish/functions/grep.fish +++ config/fish/functions/grep.fish @@ -1,7 +1,7 @@ function grep - if which ggrep >/dev/null ^&1 + if type -q ggrep command ggrep --color=auto $argv else command grep --color=auto $argv end end Index: config/fish/functions/ls.fish ================================================================== --- config/fish/functions/ls.fish +++ config/fish/functions/ls.fish @@ -1,7 +1,7 @@ function ls --description 'List contents of directory' - if which gls >/dev/null ^&1 + if type -q gls command gls --color=auto $argv else command ls --color=auto $argv end end Index: config/fish/functions/make.fish ================================================================== --- config/fish/functions/make.fish +++ config/fish/functions/make.fish @@ -2,14 +2,14 @@ function make if string match -q -r '/pkgsrc$|/pkgsrc/' $PWD # pkgsrc does not like MAKEFLAGS including -j set -lx MAKEFLAGS - if which bmake >/dev/null ^&1 && \ + if type -q bmake command bmake $argv else command make $argv end else command make $argv end end Index: config/fish/functions/pw.fish ================================================================== --- config/fish/functions/pw.fish +++ config/fish/functions/pw.fish @@ -1,13 +1,13 @@ function pw set -l clipboard - if which pbcopy >/dev/null ^&1 + if type -q pbcopy set clipboard pbcopy - else if which xclip >/dev/null ^&1 + else if type -q xclip set clipboard xclip else echo "No clipboard handler found!" return 1 end cryptopassphrase -k ~/.scrypt-pwgen.key $argv | tr -d '\n' | $clipboard end