From 745b716b410b50410157707f2a1a8ec6d28c92ec Mon Sep 17 00:00:00 2001 From: Alison Watson Date: Mon, 24 Jun 2019 09:23:58 -0400 Subject: [PATCH] fish: split config into several files --- applications/fish | 52 +++------------------------------------------ copy-files.fish | 2 +- scripts/cheat.fish | 7 ++++++ scripts/prompt.fish | 14 ++++++++++++ scripts/ql.fish | 32 ++++++++++++++++++++++++++++ 5 files changed, 57 insertions(+), 50 deletions(-) create mode 100644 scripts/cheat.fish create mode 100644 scripts/prompt.fish create mode 100644 scripts/ql.fish diff --git a/applications/fish b/applications/fish index fa97f40..4df1b27 100644 --- a/applications/fish +++ b/applications/fish @@ -5,58 +5,12 @@ if status is-interactive exec tmux new-session end -function fish_prompt - echo (set_color purple)"$hostname% " -end - -function fish_right_prompt - echo (set_color green)(pwd) -end - -function fish_greeting - echo "Word of the moment: "(shuf -n1 /usr/share/dict/words) | - awk -f ~/src/scripts/mid.awk col=$COLUMNS -end - function rebuild $HOME/src/scripts/rebuild.rkt $argv end -function cheat.sh -d 'Grabs a sheet from cheat.sh' -a arg - curl cheat.sh/$arg -end - -complete -c cheat.sh -xa '(curl -s cheat.sh/:list)' - -function ql -d 'Changes directory to a quicklink' -a name - if not set -q quicklink_$name name - echo (set_color red)"error: no quicklink named $name"(set_color normal) - return - end - - set name quicklink_$name - - cd $$name -end - -function ql-r -w ql -d 'Removes a quicklink' -a name - if not set -q name - echo (set_color red)"error: not enough arguments"(set_color normal) - return - end - - set -Ue quicklink_$name -end - -function ql-s -d 'Saves the working directory as a quicklink' -a name - if not set -q name - echo (set_color red)"error: not enough arguments"(set_color normal) - return - end - - set -U quicklink_$name $PWD -end - -complete -c ql -xa '(set -U | rg -or \'$1\' \'^quicklink_(.+) \')' +source ~/src/scripts/prompt.fish +source ~/src/scripts/cheat.fish +source ~/src/scripts/ql.fish ## EOF diff --git a/copy-files.fish b/copy-files.fish index 13db720..f92e0c7 100755 --- a/copy-files.fish +++ b/copy-files.fish @@ -13,7 +13,7 @@ tree -dL 3 ~/.vim/pack > vim/packages while read f t eval set t $t - cp (find $t) $f + cp -r $t $f end < files sed -i 's/password>.*<\//password>password removed<\//g' network/icecast.xml diff --git a/scripts/cheat.fish b/scripts/cheat.fish new file mode 100644 index 0000000..e11146f --- /dev/null +++ b/scripts/cheat.fish @@ -0,0 +1,7 @@ +function cheat.sh -d 'Grabs a sheet from cheat.sh' -a arg + curl cheat.sh/$arg +end + +complete -c cheat.sh -xa '(curl -s cheat.sh/:list)' + +## EOF diff --git a/scripts/prompt.fish b/scripts/prompt.fish new file mode 100644 index 0000000..a2867d5 --- /dev/null +++ b/scripts/prompt.fish @@ -0,0 +1,14 @@ +function fish_prompt + echo (set_color purple)"$hostname% " +end + +function fish_right_prompt + echo (set_color green)(pwd) +end + +function fish_greeting + echo "Word of the moment: "(shuf -n1 /usr/share/dict/words) | + awk -f ~/src/scripts/mid.awk col=$COLUMNS +end + +## EOF diff --git a/scripts/ql.fish b/scripts/ql.fish new file mode 100644 index 0000000..30560ad --- /dev/null +++ b/scripts/ql.fish @@ -0,0 +1,32 @@ +function ql -d 'Changes directory to a quicklink' -a name + if not set -q quicklink_$name name + echo (set_color red)"error: no quicklink named $name"(set_color normal) + return + end + + set name quicklink_$name + + cd $$name +end + +function ql-r -w ql -d 'Removes a quicklink' -a name + if not set -q name + echo (set_color red)"error: not enough arguments"(set_color normal) + return + end + + set -Ue quicklink_$name +end + +function ql-s -d 'Saves the working directory as a quicklink' -a name + if not set -q name + echo (set_color red)"error: not enough arguments"(set_color normal) + return + end + + set -U quicklink_$name $PWD +end + +complete -c ql -xa '(set -U | rg -or \'$1\' \'^quicklink_(.+) \')' + +## EOF