1
1
Fork 0

Consistent indenting for .fish files

This commit is contained in:
Jonathan Schleifer 2020-02-19 21:46:19 +00:00
parent ce52fc5aff
commit d5b9a71d71
18 changed files with 106 additions and 93 deletions

View file

@ -1,7 +1,7 @@
function fgrep
if type -q ggrep
command ggrep -F --color=auto $argv
else
command fgrep --color=auto $argv
end
if type -q ggrep
command ggrep -F --color=auto $argv
else
command fgrep --color=auto $argv
end
end

View file

@ -1,22 +1,22 @@
function fish_prompt --description 'Write out the prompt'
set -l suffix
switch "$USER"
case root toor
set suffix (set_color $fish_color_cwd_root)'#'
case '*'
set suffix '>'
end
set -l suffix
switch "$USER"
case root toor
set suffix (set_color $fish_color_cwd_root)'#'
case '*'
set suffix '>'
end
set -l branch (git symbolic-ref HEAD 2>/dev/null)
set branch (string replace -r "^refs/heads/" "" $branch)
set -l vcs
if test -n "$branch" -a "$branch" != "master"
set vcs (set_color $fish_color_vcs_braces)"(" \
(set_color $fish_color_vcs)"$branch" \
(set_color $fish_color_vcs_braces)")"
end
set -l branch (git symbolic-ref HEAD 2>/dev/null)
set branch (string replace -r "^refs/heads/" "" $branch)
set -l vcs
if test -n "$branch" -a "$branch" != "master"
set vcs (set_color $fish_color_vcs_braces)"(" \
(set_color $fish_color_vcs)"$branch" \
(set_color $fish_color_vcs_braces)")"
end
echo -n -s (set_color $fish_color_host) (prompt_hostname) ' ' \
(set_color $fish_color_cwd) (prompt_pwd) (string join '' $vcs) \
(set_color $fish_color_suffix) $suffix (set_color normal) ' '
echo -n -s (set_color $fish_color_host) (prompt_hostname) ' ' \
(set_color $fish_color_cwd) (prompt_pwd) (string join '' $vcs) \
(set_color $fish_color_suffix) $suffix (set_color normal) ' '
end

View file

@ -1,15 +1,15 @@
function fish_right_prompt
set -l code $status
set -l jobs (jobs | wc -l)
set -l prompt
set -l code $status
set -l jobs (jobs | wc -l)
set -l prompt
test $jobs -gt 0
and set -a prompt (set_color $fish_color_jobs)$jobs
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_status)$code
test $code -gt 0
and set -a prompt (set_color $fish_color_status)$code
echo $prompt
echo $prompt
set_color normal
set_color normal
end

View file

@ -1,3 +1,3 @@
function fish_title
echo (status current-command) · (prompt_pwd) · (prompt_hostname)
echo (status current-command) · (prompt_pwd) · (prompt_hostname)
end

View file

@ -1,4 +1,4 @@
function gpg-sftp
set -lx SSH_AUTH_SOCK $HOME/.gnupg/S.gpg-agent.ssh
sftp $argv
set -lx SSH_AUTH_SOCK $HOME/.gnupg/S.gpg-agent.ssh
sftp $argv
end

View file

@ -1,4 +1,4 @@
function gpg-ssh-add
set -lx SSH_AUTH_SOCK $HOME/.gnupg/S.gpg-agent.ssh
ssh-add $argv
set -lx SSH_AUTH_SOCK $HOME/.gnupg/S.gpg-agent.ssh
ssh-add $argv
end

View file

@ -1,4 +1,4 @@
function gpg-ssh
set -lx SSH_AUTH_SOCK $HOME/.gnupg/S.gpg-agent.ssh
ssh $argv
set -lx SSH_AUTH_SOCK $HOME/.gnupg/S.gpg-agent.ssh
ssh $argv
end

View file

@ -1,7 +1,7 @@
function grep
if type -q ggrep
command ggrep --color=auto $argv
else
command grep --color=auto $argv
end
if type -q ggrep
command ggrep --color=auto $argv
else
command grep --color=auto $argv
end
end

View file

@ -1,3 +1,3 @@
function ixio
curl -F 'f:1=<-' ix.io
curl -F 'f:1=<-' ix.io
end

View file

@ -1,7 +1,7 @@
function ls --description 'List contents of directory'
if type -q gls
command gls --color=auto $argv
else
command ls --color=auto $argv
end
if type -q gls
command gls --color=auto $argv
else
command ls --color=auto $argv
end
end

View file

@ -1,15 +1,15 @@
# Automatically use bmake instead of make when using pkgsrc, if necessary
function make
if string match -q -r '/pkgsrc$|/pkgsrc/' $PWD
# pkgsrc does not like MAKEFLAGS including -j
set -lx MAKEFLAGS
if string match -q -r '/pkgsrc$|/pkgsrc/' $PWD
# pkgsrc does not like MAKEFLAGS including -j
set -lx MAKEFLAGS
if type -q bmake
command bmake $argv
else
command make $argv
end
else
command make $argv
end
if type -q bmake
command bmake $argv
else
command make $argv
end
else
command make $argv
end
end

View file

@ -1,5 +1,5 @@
# To work around mpv not liking locales that use , as a decimal separator
function mpv
set -x LC_ALL C
command mpv $argv
set -lx LC_ALL C
command mpv $argv
end

View file

@ -1,4 +1,4 @@
function pkg_chk
set -lx MAKEFLAGS
command pkg_chk $argv
set -lx MAKEFLAGS
command pkg_chk $argv
end

View file

@ -1,4 +1,4 @@
function pkg_rolling-replace
set -lx MAKEFLAGS
command pkg_rolling-replace $argv
set -lx MAKEFLAGS
command pkg_rolling-replace $argv
end

View file

@ -1,20 +1,19 @@
function prompt_pwd --description 'Print the current working directory'
set -l options 'h/help'
argparse -n prompt_pwd --max-args=0 $options -- $argv
or return
set -l options 'h/help'
argparse -n prompt_pwd --max-args=0 $options -- $argv
or return
if set -q _flag_help
__fish_print_help prompt_pwd
return 0
end
if set -q _flag_help
__fish_print_help prompt_pwd
return 0
end
# Replace $HOME with "~"
set realhome ~
set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD)
set tmp (basename $tmp)
# Replace $HOME with "~"
set realhome ~
set -l tmp (basename (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD))
test $PWD = "/$tmp"
and set tmp $PWD
test $PWD = "/$tmp"
and set tmp $PWD
echo $tmp
echo $tmp
end

View file

@ -1,13 +1,13 @@
function pw
set -l clipboard
if type -q pbcopy
set clipboard pbcopy
else if type -q xclip
set clipboard xclip
else
echo "No clipboard handler found!"
return 1
end
set -l clipboard
if type -q pbcopy
set clipboard pbcopy
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
cryptopassphrase -k ~/.scrypt-pwgen.key $argv | tr -d '\n' | $clipboard
end

View file

@ -0,0 +1,14 @@
function pws
set -l clipboard
if type -q pbcopy
set clipboard pbcopy
else if type -q xclip
set clipboard xclip
else
echo "No clipboard handler found!"
return 1
end
cryptopassphrase -k ~/.scrypt-pwgen-server.key $argv \
| tr -d '\n' | $clipboard
end

View file

@ -1,5 +1,5 @@
# pkgsrc does not like MAKEFLAGS being set
function url2pkg
set -lx MAKEFLAGS
command url2pkg $argv
set -lx MAKEFLAGS
command url2pkg $argv
end