Update fish config for 3.1.0
This commit is contained in:
parent
b59c4cf08c
commit
fa3797e7c6
9 changed files with 69 additions and 50 deletions
|
@ -1,51 +1,66 @@
|
|||
function cd --description 'Change directory'
|
||||
set -l MAX_DIR_HIST 25
|
||||
#
|
||||
# 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 1
|
||||
printf "%s\n" (_ "Too many args for cd command")
|
||||
return 1
|
||||
end
|
||||
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
|
||||
# Skip history in subshells.
|
||||
if status --is-command-substitution
|
||||
builtin cd $argv
|
||||
return $status
|
||||
end
|
||||
|
||||
# Avoid set completions.
|
||||
set -l previous $PWD
|
||||
# Avoid set completions.
|
||||
set -l previous $PWD
|
||||
|
||||
if test "$argv" = "-"
|
||||
if test "$__fish_cd_direction" = "next"
|
||||
nextd
|
||||
else
|
||||
prevd
|
||||
end
|
||||
return $status
|
||||
end
|
||||
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
|
||||
# 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
|
||||
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 -a "$PWD" != "$previous"
|
||||
set -q dirprev
|
||||
or set -l dirprev
|
||||
set -q dirprev[$MAX_DIR_HIST]
|
||||
and set -e dirprev[1]
|
||||
|
||||
if test $cd_status -eq 0
|
||||
ls
|
||||
end
|
||||
# If dirprev, dirnext, __fish_cd_direction
|
||||
# are set as universal variables, honor their scope.
|
||||
|
||||
return $cd_status
|
||||
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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function fgrep
|
||||
if which ggrep >/dev/null ^&1
|
||||
if type -q ggrep
|
||||
command ggrep -F --color=auto $argv
|
||||
else
|
||||
command fgrep --color=auto $argv
|
||||
|
|
|
@ -2,7 +2,7 @@ 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
|
||||
|
|
|
@ -7,7 +7,7 @@ function fish_right_prompt
|
|||
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
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function grep
|
||||
if which ggrep >/dev/null ^&1
|
||||
if type -q ggrep
|
||||
command ggrep --color=auto $argv
|
||||
else
|
||||
command grep --color=auto $argv
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
|
|
|
@ -4,7 +4,7 @@ function make
|
|||
# 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
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
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!"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue