From 882d8c75fa6fb63fe0d6ae1116d2fd5010ff6022 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sat, 8 May 2021 17:39:52 -0400 Subject: [PATCH] reduce fish functions --- fish.configlink/functions/abbrs.fish | 9 +++++++-- fish.configlink/functions/awsc.fish | 3 --- fish.configlink/functions/brewinfo.fish | 9 --------- fish.configlink/functions/brewsearch.fish | 2 +- fish.configlink/functions/fcd.fish | 4 ++++ fish.configlink/functions/fuck.fish | 9 --------- fish.configlink/functions/moon.fish | 3 --- fish.configlink/functions/psf.fish | 2 +- fish.configlink/functions/weather.fish | 3 --- homebrew/fun.Brewfile | 1 + homebrew/learning.Brewfile | 1 - scripts/setup_cheatsheet | 6 ++++++ scripts/setup_cht.sh | 6 ------ 13 files changed, 20 insertions(+), 38 deletions(-) delete mode 100644 fish.configlink/functions/awsc.fish delete mode 100644 fish.configlink/functions/brewinfo.fish create mode 100644 fish.configlink/functions/fcd.fish delete mode 100644 fish.configlink/functions/fuck.fish delete mode 100644 fish.configlink/functions/moon.fish delete mode 100644 fish.configlink/functions/weather.fish create mode 100755 scripts/setup_cheatsheet delete mode 100755 scripts/setup_cht.sh diff --git a/fish.configlink/functions/abbrs.fish b/fish.configlink/functions/abbrs.fish index 379cad5..9a47a4c 100644 --- a/fish.configlink/functions/abbrs.fish +++ b/fish.configlink/functions/abbrs.fish @@ -8,9 +8,11 @@ function abbrs --description 'All abbreviations' abbr -a ll 'ls -alhF' abbr -a lf 'ls -lh | fzf' abbr -a c 'cd' + abbr -a fcd 'cd (fd -t d . ~ | fzf)' abbr -a -- - 'cd -' abbr -a proj 'cd $PROJ' abbr -a mkd 'mkdir -pv' + alias --save fcd 'set jump (fd -t d . ~ | fzf); and cd $jump' # Tmux abbr -a ta 'tmux attach-session' @@ -42,7 +44,6 @@ function abbrs --description 'All abbreviations' abbr -a gr 'git reset' abbr -a grh 'git reset --hard' abbr -a gm 'git merge' - abbr -a gmf 'git-merge-fuzzy' abbr -a gcp 'git cherry-pick' abbr -a ghr 'gh repo view -w' abbr -a gha 'gh run list | head -1 | awk \'{ print $NF }\' | xargs gh run view' @@ -58,7 +59,6 @@ function abbrs --description 'All abbreviations' abbr -a v 'vim' abbr -a vl 'vim -c "normal! `0"' abbr -a vll 'vim -c "Hist"' - abbr -a vh 'vim -c "Hist"' # Notes abbr -a qn 'quicknote' @@ -71,6 +71,8 @@ function abbrs --description 'All abbreviations' # Fun CLI Tools abbr goo 'googler' abbr gooj 'googler -j' + abbr weather 'curl wttr.in/$WEATHER_CITY' + abbr moon 'curl wttr.in/Moon' # Dotfile and config shortcuts abbr -a s 'sudo' @@ -109,6 +111,9 @@ function abbrs --description 'All abbreviations' abbr -a dash 'kube-dashboard' abbr -a ks 'k9s' + # Cloud + abbr -a awsc 'vim ~/.aws/credentials' + # Python abbr -a py 'python' abbr -a po 'poetry' diff --git a/fish.configlink/functions/awsc.fish b/fish.configlink/functions/awsc.fish deleted file mode 100644 index 54841a3..0000000 --- a/fish.configlink/functions/awsc.fish +++ /dev/null @@ -1,3 +0,0 @@ -function awsc --description "Open AWS credentials file" - vim ~/.aws/credentials -end diff --git a/fish.configlink/functions/brewinfo.fish b/fish.configlink/functions/brewinfo.fish deleted file mode 100644 index 25fe437..0000000 --- a/fish.configlink/functions/brewinfo.fish +++ /dev/null @@ -1,9 +0,0 @@ -function brewinfo --description "Lookup brew plugins" - set -l inst (brew formulae | eval "fzf $FZF_DEFAULT_OPTS -m --header='[brew:info]'") - - if not test (count $inst) = 0 - for prog in $inst - brew info "$prog" - end - end -end diff --git a/fish.configlink/functions/brewsearch.fish b/fish.configlink/functions/brewsearch.fish index 391ce60..c716297 100644 --- a/fish.configlink/functions/brewsearch.fish +++ b/fish.configlink/functions/brewsearch.fish @@ -1,5 +1,5 @@ function brewsearch --description "Install brew plugins" - set -l inst (brew formulae | eval "fzf $FZF_DEFAULT_OPTS -m --header='[brew:install]'") + set -l inst (brew formulae | eval "fzf $FZF_DEFAULT_OPTS -m --header='[press ctrl-i for info, enter to install]' --bind 'ctrl-i:preview(brew info {})'") if not test (count $inst) = 0 for prog in $inst diff --git a/fish.configlink/functions/fcd.fish b/fish.configlink/functions/fcd.fish new file mode 100644 index 0000000..be2753f --- /dev/null +++ b/fish.configlink/functions/fcd.fish @@ -0,0 +1,4 @@ +# Defined via `source` +function fcd --wraps='set jump (fd -t d . ~ | fzf); and cd $jump' --description 'alias fcd set jump (fd -t d . ~ | fzf); and cd $jump' + set jump (fd -t d . ~ | fzf); and cd $jump $argv; +end diff --git a/fish.configlink/functions/fuck.fish b/fish.configlink/functions/fuck.fish deleted file mode 100644 index 90d4f19..0000000 --- a/fish.configlink/functions/fuck.fish +++ /dev/null @@ -1,9 +0,0 @@ -function fuck -d "Correct your previous console command" - set -l fucked_up_command $history[1] - env TF_SHELL=fish TF_ALIAS=fuck PYTHONIOENCODING=utf-8 thefuck $fucked_up_command THEFUCK_ARGUMENT_PLACEHOLDER $argv | read -l unfucked_command - if [ "$unfucked_command" != "" ] - eval $unfucked_command - builtin history delete --exact --case-sensitive -- $fucked_up_command - builtin history merge ^ /dev/null - end -end diff --git a/fish.configlink/functions/moon.fish b/fish.configlink/functions/moon.fish deleted file mode 100644 index 55b2be0..0000000 --- a/fish.configlink/functions/moon.fish +++ /dev/null @@ -1,3 +0,0 @@ -function moon --description "See lunar status" - curl wttr.in/Moon -end diff --git a/fish.configlink/functions/psf.fish b/fish.configlink/functions/psf.fish index 5c58e36..95c1f2c 100644 --- a/fish.configlink/functions/psf.fish +++ b/fish.configlink/functions/psf.fish @@ -1,3 +1,3 @@ -function psf +function psf --description "Search for open process" -a "process" ps aux | rg -v "$USER.*rg $argv" | rg $argv end diff --git a/fish.configlink/functions/weather.fish b/fish.configlink/functions/weather.fish deleted file mode 100644 index 96cbdbe..0000000 --- a/fish.configlink/functions/weather.fish +++ /dev/null @@ -1,3 +0,0 @@ -function weather --description "Check weather" - curl wttr.in/$WEATHER_CITY -end diff --git a/homebrew/fun.Brewfile b/homebrew/fun.Brewfile index b1af51c..2dcc67e 100644 --- a/homebrew/fun.Brewfile +++ b/homebrew/fun.Brewfile @@ -2,6 +2,7 @@ tap "nmasur/repo" +brew "ffmpeg" # Convert videos brew "nmasur/repo/bid" # Look up stock tickers brew "nmasur/repo/bee" # Cheat on NYTimes Spelling Bee brew "tickrs" # Interactive stock tickers diff --git a/homebrew/learning.Brewfile b/homebrew/learning.Brewfile index 82946ef..8f68511 100644 --- a/homebrew/learning.Brewfile +++ b/homebrew/learning.Brewfile @@ -4,7 +4,6 @@ tap "superfly/tap" tap "nmasur/repo" tap "cjbassi/ytop" -brew "thefuck" # Fix terminal mistakes brew "superfly/tap/flyctl" # Fly.io CLI brew "haskell-stack" # Latest version of Haskell brew "xsv" # CSV manipulation diff --git a/scripts/setup_cheatsheet b/scripts/setup_cheatsheet new file mode 100755 index 0000000..e10058c --- /dev/null +++ b/scripts/setup_cheatsheet @@ -0,0 +1,6 @@ +#!/bin/sh + +echo "downloading cheatsheet" +curl https://cht.sh/:cht.sh > ~/.local/bin/cheat +chmod 755 ~/.local/bin/cheat +echo "cheatsheet ✓" diff --git a/scripts/setup_cht.sh b/scripts/setup_cht.sh deleted file mode 100755 index 9346316..0000000 --- a/scripts/setup_cht.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -echo "downloading cheatsheet" -curl https://cht.sh/:cht.sh > ~/.local/bin/cht.sh -chmod 755 ~/.local/bin/cht.sh -echo "cht.sh ✓"