ADDED config/fish/fish_variables Index: config/fish/fish_variables ================================================================== --- config/fish/fish_variables +++ config/fish/fish_variables @@ -0,0 +1,40 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR EDITOR:vim +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_abbr_gpg:gpg2 +SETUVAR _fish_abbr_vi:vim +SETUVAR fish_color_autosuggestion:4e4e4e +SETUVAR fish_color_cancel:normal +SETUVAR fish_color_command:5f87d7 +SETUVAR fish_color_comment:ff8787 +SETUVAR fish_color_cwd:c0b090 +SETUVAR fish_color_cwd_root:800000 +SETUVAR fish_color_end:afffd7 +SETUVAR fish_color_error:ff6060 +SETUVAR fish_color_escape:00a6b2 +SETUVAR fish_color_history_current:normal +SETUVAR fish_color_host:a08080 +SETUVAR fish_color_jobs:ffff60 +SETUVAR fish_color_match:normal +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:8fdf3f +SETUVAR fish_color_param:87afd7 +SETUVAR fish_color_quote:ffaf5f +SETUVAR fish_color_redirection:f090d0 +SETUVAR fish_color_search_match:ffff00 +SETUVAR fish_color_selection:c0c0c0 +SETUVAR fish_color_suffix:ffffe0 +SETUVAR fish_color_user:00ff00 +SETUVAR fish_color_valid_path:normal +SETUVAR fish_color_vcs:cfffb0 +SETUVAR fish_greeting: +SETUVAR fish_key_bindings:hybrid_bindings +SETUVAR fish_pager_color_completion:normal +SETUVAR fish_pager_color_description:B3A06D\x1eyellow +SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline +SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan ADDED config/fish/functions/bmake.fish Index: config/fish/functions/bmake.fish ================================================================== --- config/fish/functions/bmake.fish +++ config/fish/functions/bmake.fish @@ -0,0 +1,7 @@ +# pkgsrc does not like MAKEFLAGS being set +function bmake + if string match -q -r '/pkgsrc$|/pkgsrc/' $PWD + set -lx MAKEFLAGS + end + command bmake $argv +end ADDED config/fish/functions/cd.fish Index: config/fish/functions/cd.fish ================================================================== --- config/fish/functions/cd.fish +++ config/fish/functions/cd.fish @@ -0,0 +1,51 @@ +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 +end ADDED config/fish/functions/fgrep.fish Index: config/fish/functions/fgrep.fish ================================================================== --- config/fish/functions/fgrep.fish +++ config/fish/functions/fgrep.fish @@ -0,0 +1,7 @@ +function fgrep + if which ggrep >/dev/null + command ggrep -F --color=auto $argv + else + command fgrep --color=auto $argv + end +end ADDED config/fish/functions/fish_prompt.fish Index: config/fish/functions/fish_prompt.fish ================================================================== --- config/fish/functions/fish_prompt.fish +++ config/fish/functions/fish_prompt.fish @@ -0,0 +1,28 @@ +function fish_prompt --description 'Write out the prompt' + set -l color_cwd + set -l suffix + switch "$USER" + case root toor + if set -q fish_color_cwd_root + set color_cwd $fish_color_cwd_root + else + set color_cwd $fish_color_cwd + end + set suffix '#' + case '*' + set color_cwd $fish_color_cwd + 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 "($branch)" + end + + echo -n -s (set_color $fish_color_host) (prompt_hostname) ':' \ + (set_color $color_cwd) (prompt_pwd) \ + (set_color $fish_color_vcs) "$vcs" \ + (set_color $fish_color_suffix) "$suffix " +end ADDED config/fish/functions/fish_right_prompt.fish Index: config/fish/functions/fish_right_prompt.fish ================================================================== --- config/fish/functions/fish_right_prompt.fish +++ config/fish/functions/fish_right_prompt.fish @@ -0,0 +1,14 @@ +function fish_right_prompt + set -l code $status + set -l jobs (jobs | wc -l) + + if test $jobs -gt 0 + set_color $fish_color_jobs + echo "$jobs " + end + + if test $code -gt 0 + set_color $fish_color_error + echo "$code " + end +end ADDED config/fish/functions/gpgssh.fish Index: config/fish/functions/gpgssh.fish ================================================================== --- config/fish/functions/gpgssh.fish +++ config/fish/functions/gpgssh.fish @@ -0,0 +1,4 @@ +function gpgssh + set -x SSH_AUTH_SOCK $HOME/.gnupg/S.gpg-agent.ssh + ssh $argv +end ADDED config/fish/functions/grep.fish Index: config/fish/functions/grep.fish ================================================================== --- config/fish/functions/grep.fish +++ config/fish/functions/grep.fish @@ -0,0 +1,7 @@ +function grep + if which ggrep >/dev/null + command ggrep --color=auto $argv + else + command grep --color=auto $argv + end +end ADDED config/fish/functions/hybrid_bindings.fish Index: config/fish/functions/hybrid_bindings.fish ================================================================== --- config/fish/functions/hybrid_bindings.fish +++ config/fish/functions/hybrid_bindings.fish @@ -0,0 +1,7 @@ +function hybrid_bindings --description 'Vi bindings with a bit of Emacs bindings' + for mode in default insert visual + fish_default_key_bindings -M $mode + end + + fish_vi_key_bindings --no-erase +end ADDED config/fish/functions/ixio.fish Index: config/fish/functions/ixio.fish ================================================================== --- config/fish/functions/ixio.fish +++ config/fish/functions/ixio.fish @@ -0,0 +1,3 @@ +function ixio + curl -F 'f:1=<=' ix.io +end ADDED config/fish/functions/ls.fish Index: config/fish/functions/ls.fish ================================================================== --- config/fish/functions/ls.fish +++ config/fish/functions/ls.fish @@ -0,0 +1,7 @@ +function ls --description 'List contents of directory' + if which gls >/dev/null + command gls --color=auto $argv + else + command ls --color=auto $argv + end +end ADDED config/fish/functions/mpv.fish Index: config/fish/functions/mpv.fish ================================================================== --- config/fish/functions/mpv.fish +++ config/fish/functions/mpv.fish @@ -0,0 +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 +end ADDED config/fish/functions/prompt_pwd.fish Index: config/fish/functions/prompt_pwd.fish ================================================================== --- config/fish/functions/prompt_pwd.fish +++ config/fish/functions/prompt_pwd.fish @@ -0,0 +1,16 @@ +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 + + 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) + + basename $tmp +end ADDED config/fish/functions/pw.fish Index: config/fish/functions/pw.fish ================================================================== --- config/fish/functions/pw.fish +++ config/fish/functions/pw.fish @@ -0,0 +1,13 @@ +function pw + set -l clipboard + if which pbcopy >/dev/null + set clipboard pbcopy + else if which xclip >/dev/null + set clipboard xclip + else + echo "No clipboard handler found!" + return 1 + end + + cryptopassphrase -k ~/.scrypt-pwgen.key $argv | tr -d '\n' | $clipboard +end ADDED config/fish/functions/url2pkg.fish Index: config/fish/functions/url2pkg.fish ================================================================== --- config/fish/functions/url2pkg.fish +++ config/fish/functions/url2pkg.fish @@ -0,0 +1,5 @@ +# pkgsrc does not like MAKEFLAGS being set +function url2pkg + set -lx MAKEFLAGS + command url2pkg $argv +end Index: create_symlinks.sh ================================================================== --- create_symlinks.sh +++ create_symlinks.sh @@ -14,10 +14,11 @@ mkdir -p $HOME/.gnupg link_file gpg.conf .gnupg/gpg.conf ../ link_file tmux.conf .tmux.conf link_file vim .vim link_file vimrc .vimrc +link_file config/fish .config/fish ../ mkdir -p $HOME/.config/youtube-dl link_file config/youtube-dl/config .config/youtube-dl/config ../../ link_file zshrc .zshrc if test x"$(uname -s)" = x"Darwin"; then