Consistent indenting for .fish files
This commit is contained in:
parent
ce52fc5aff
commit
d5b9a71d71
18 changed files with 106 additions and 93 deletions
|
@ -1,7 +1,7 @@
|
||||||
function fgrep
|
function fgrep
|
||||||
if type -q ggrep
|
if type -q ggrep
|
||||||
command ggrep -F --color=auto $argv
|
command ggrep -F --color=auto $argv
|
||||||
else
|
else
|
||||||
command fgrep --color=auto $argv
|
command fgrep --color=auto $argv
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
function fish_prompt --description 'Write out the prompt'
|
function fish_prompt --description 'Write out the prompt'
|
||||||
set -l suffix
|
set -l suffix
|
||||||
switch "$USER"
|
switch "$USER"
|
||||||
case root toor
|
case root toor
|
||||||
set suffix (set_color $fish_color_cwd_root)'#'
|
set suffix (set_color $fish_color_cwd_root)'#'
|
||||||
case '*'
|
case '*'
|
||||||
set suffix '>'
|
set suffix '>'
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l branch (git symbolic-ref HEAD 2>/dev/null)
|
set -l branch (git symbolic-ref HEAD 2>/dev/null)
|
||||||
set branch (string replace -r "^refs/heads/" "" $branch)
|
set branch (string replace -r "^refs/heads/" "" $branch)
|
||||||
set -l vcs
|
set -l vcs
|
||||||
if test -n "$branch" -a "$branch" != "master"
|
if test -n "$branch" -a "$branch" != "master"
|
||||||
set vcs (set_color $fish_color_vcs_braces)"(" \
|
set vcs (set_color $fish_color_vcs_braces)"(" \
|
||||||
(set_color $fish_color_vcs)"$branch" \
|
(set_color $fish_color_vcs)"$branch" \
|
||||||
(set_color $fish_color_vcs_braces)")"
|
(set_color $fish_color_vcs_braces)")"
|
||||||
end
|
end
|
||||||
|
|
||||||
echo -n -s (set_color $fish_color_host) (prompt_hostname) ' ' \
|
echo -n -s (set_color $fish_color_host) (prompt_hostname) ' ' \
|
||||||
(set_color $fish_color_cwd) (prompt_pwd) (string join '' $vcs) \
|
(set_color $fish_color_cwd) (prompt_pwd) (string join '' $vcs) \
|
||||||
(set_color $fish_color_suffix) $suffix (set_color normal) ' '
|
(set_color $fish_color_suffix) $suffix (set_color normal) ' '
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
function fish_right_prompt
|
function fish_right_prompt
|
||||||
set -l code $status
|
set -l code $status
|
||||||
set -l jobs (jobs | wc -l)
|
set -l jobs (jobs | wc -l)
|
||||||
set -l prompt
|
set -l prompt
|
||||||
|
|
||||||
test $jobs -gt 0
|
test $jobs -gt 0
|
||||||
and set -a prompt (set_color $fish_color_jobs)$jobs
|
and set -a prompt (set_color $fish_color_jobs)$jobs
|
||||||
|
|
||||||
test $code -gt 0
|
test $code -gt 0
|
||||||
and set -a prompt (set_color $fish_color_status)$code
|
and set -a prompt (set_color $fish_color_status)$code
|
||||||
|
|
||||||
echo $prompt
|
echo $prompt
|
||||||
|
|
||||||
set_color normal
|
set_color normal
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
function fish_title
|
function fish_title
|
||||||
echo (status current-command) · (prompt_pwd) · (prompt_hostname)
|
echo (status current-command) · (prompt_pwd) · (prompt_hostname)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
function gpg-sftp
|
function gpg-sftp
|
||||||
set -lx SSH_AUTH_SOCK $HOME/.gnupg/S.gpg-agent.ssh
|
set -lx SSH_AUTH_SOCK $HOME/.gnupg/S.gpg-agent.ssh
|
||||||
sftp $argv
|
sftp $argv
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
function gpg-ssh-add
|
function gpg-ssh-add
|
||||||
set -lx SSH_AUTH_SOCK $HOME/.gnupg/S.gpg-agent.ssh
|
set -lx SSH_AUTH_SOCK $HOME/.gnupg/S.gpg-agent.ssh
|
||||||
ssh-add $argv
|
ssh-add $argv
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
function gpg-ssh
|
function gpg-ssh
|
||||||
set -lx SSH_AUTH_SOCK $HOME/.gnupg/S.gpg-agent.ssh
|
set -lx SSH_AUTH_SOCK $HOME/.gnupg/S.gpg-agent.ssh
|
||||||
ssh $argv
|
ssh $argv
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
function grep
|
function grep
|
||||||
if type -q ggrep
|
if type -q ggrep
|
||||||
command ggrep --color=auto $argv
|
command ggrep --color=auto $argv
|
||||||
else
|
else
|
||||||
command grep --color=auto $argv
|
command grep --color=auto $argv
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
function ixio
|
function ixio
|
||||||
curl -F 'f:1=<-' ix.io
|
curl -F 'f:1=<-' ix.io
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
function ls --description 'List contents of directory'
|
function ls --description 'List contents of directory'
|
||||||
if type -q gls
|
if type -q gls
|
||||||
command gls --color=auto $argv
|
command gls --color=auto $argv
|
||||||
else
|
else
|
||||||
command ls --color=auto $argv
|
command ls --color=auto $argv
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
# Automatically use bmake instead of make when using pkgsrc, if necessary
|
# Automatically use bmake instead of make when using pkgsrc, if necessary
|
||||||
function make
|
function make
|
||||||
if string match -q -r '/pkgsrc$|/pkgsrc/' $PWD
|
if string match -q -r '/pkgsrc$|/pkgsrc/' $PWD
|
||||||
# pkgsrc does not like MAKEFLAGS including -j
|
# pkgsrc does not like MAKEFLAGS including -j
|
||||||
set -lx MAKEFLAGS
|
set -lx MAKEFLAGS
|
||||||
|
|
||||||
if type -q bmake
|
if type -q bmake
|
||||||
command bmake $argv
|
command bmake $argv
|
||||||
else
|
else
|
||||||
command make $argv
|
command make $argv
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
command make $argv
|
command make $argv
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# To work around mpv not liking locales that use , as a decimal separator
|
# To work around mpv not liking locales that use , as a decimal separator
|
||||||
function mpv
|
function mpv
|
||||||
set -x LC_ALL C
|
set -lx LC_ALL C
|
||||||
command mpv $argv
|
command mpv $argv
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
function pkg_chk
|
function pkg_chk
|
||||||
set -lx MAKEFLAGS
|
set -lx MAKEFLAGS
|
||||||
command pkg_chk $argv
|
command pkg_chk $argv
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
function pkg_rolling-replace
|
function pkg_rolling-replace
|
||||||
set -lx MAKEFLAGS
|
set -lx MAKEFLAGS
|
||||||
command pkg_rolling-replace $argv
|
command pkg_rolling-replace $argv
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,20 +1,19 @@
|
||||||
function prompt_pwd --description 'Print the current working directory'
|
function prompt_pwd --description 'Print the current working directory'
|
||||||
set -l options 'h/help'
|
set -l options 'h/help'
|
||||||
argparse -n prompt_pwd --max-args=0 $options -- $argv
|
argparse -n prompt_pwd --max-args=0 $options -- $argv
|
||||||
or return
|
or return
|
||||||
|
|
||||||
if set -q _flag_help
|
if set -q _flag_help
|
||||||
__fish_print_help prompt_pwd
|
__fish_print_help prompt_pwd
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
# Replace $HOME with "~"
|
# Replace $HOME with "~"
|
||||||
set realhome ~
|
set realhome ~
|
||||||
set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD)
|
set -l tmp (basename (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD))
|
||||||
set tmp (basename $tmp)
|
|
||||||
|
|
||||||
test $PWD = "/$tmp"
|
test $PWD = "/$tmp"
|
||||||
and set tmp $PWD
|
and set tmp $PWD
|
||||||
|
|
||||||
echo $tmp
|
echo $tmp
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
function pw
|
function pw
|
||||||
set -l clipboard
|
set -l clipboard
|
||||||
if type -q pbcopy
|
if type -q pbcopy
|
||||||
set clipboard pbcopy
|
set clipboard pbcopy
|
||||||
else if type -q xclip
|
else if type -q xclip
|
||||||
set clipboard xclip
|
set clipboard xclip
|
||||||
else
|
else
|
||||||
echo "No clipboard handler found!"
|
echo "No clipboard handler found!"
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
cryptopassphrase -k ~/.scrypt-pwgen.key $argv | tr -d '\n' | $clipboard
|
cryptopassphrase -k ~/.scrypt-pwgen.key $argv | tr -d '\n' | $clipboard
|
||||||
end
|
end
|
||||||
|
|
14
config/fish/functions/pws.fish
Normal file
14
config/fish/functions/pws.fish
Normal 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
|
|
@ -1,5 +1,5 @@
|
||||||
# pkgsrc does not like MAKEFLAGS being set
|
# pkgsrc does not like MAKEFLAGS being set
|
||||||
function url2pkg
|
function url2pkg
|
||||||
set -lx MAKEFLAGS
|
set -lx MAKEFLAGS
|
||||||
command url2pkg $argv
|
command url2pkg $argv
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue