From e5456c8f52b8d2d73330b0d090ebbb55faab36a1 Mon Sep 17 00:00:00 2001 From: Kevin Mok Date: Wed, 30 Jan 2019 03:30:41 -0500 Subject: [PATCH] Some fish functions --- aliases/key_aliases | 16 ++++++++++------ fish/.config/fish/config.fish | 13 ++++++++++--- fish/.config/fish/functions/git-amend-push.fish | 5 +++++ .../functions/{gx.fish => grep-aliases.fish} | 2 +- fish/.config/fish/functions/scan-history.fish | 5 +++++ fish/.config/fish/functions/unix-timestamp.fish | 4 ++++ fish/.config/fish/functions/vsnp.fish | 2 ++ fish/.config/fish/functions/zathura-silent.fish | 3 +++ txt/key_dirs.txt | 6 +++--- vim/.vimrc | 2 ++ 10 files changed, 45 insertions(+), 13 deletions(-) create mode 100644 fish/.config/fish/functions/git-amend-push.fish rename fish/.config/fish/functions/{gx.fish => grep-aliases.fish} (81%) create mode 100644 fish/.config/fish/functions/scan-history.fish create mode 100644 fish/.config/fish/functions/unix-timestamp.fish create mode 100644 fish/.config/fish/functions/zathura-silent.fish diff --git a/aliases/key_aliases b/aliases/key_aliases index 2790808..dd9387c 100644 --- a/aliases/key_aliases +++ b/aliases/key_aliases @@ -53,7 +53,8 @@ rsy "rsync -Pr" # list all (un)mounted drives lhd "sudo fdisk -l" # get disc space for mounted drives -ds "df -h | tee >(head -n 1) >(grep sd) >/dev/null" +# ds "df -h | tee >(head -n 1) >(grep sd) >/dev/null" +ds "df -h | head -n 1 && df -h | grep sd" chownw "sudo chown -R kevin:wheel" chwnm "sudo chown -R kevin:wheel /run/media/kevin" # cd into backup folder and show backup sizes @@ -91,7 +92,7 @@ xpc "pacman -Qqe > ~/linux-config/txt/nzxt-pkgs.txt" tri "trizen -S" # internet -pg "ping -c 3 8.8.8.8" +pgo "ping -c 3 8.8.8.8" dh "sudo dhcpcd" rdh "sudo killall dhcpcd && sudo dhcpcd" @@ -201,8 +202,8 @@ gstp "git stash pop" gc "git commit -S" gcu "git commit" -gcam "ga && git commit --amend --no-edit -S" -gcamp "ga && git commit --amend --no-edit -S && gpsf" +gcam "git add -A . && git commit --amend --no-edit -S" +# gcamp "git add -A . && git commit --amend --no-edit -S && gpsf" psgi "git add . && git commit -m '.' -S && git push" gps "git push" @@ -254,7 +255,8 @@ gunc "git update-index --assume-unchanged" # svscs "f $spv_dir/src/static/scss" # svcss "f $spv_dir/src/spotifyvis/static/scss" # start spv server from dir -ssv "source ../bin/activate && python manage.py runserver" +pg "sudo systemctl start postgresql.service && systemctl status postgresql.service" +ssv "bash ../bin/activate && python manage.py runserver" # start spv server outside dir sssv "sv && ssv" # open spv db in psql @@ -271,7 +273,7 @@ ureq "pip freeze > requirements.txt" # show last history scan hlg "cat $spv_dir/src/api/management/commands/update-history.log | tail -n 1" # scan history -hs "$spv_dir/src/update-history.sh && cat $spv_dir/src/api/management/commands/update-history.log | tail -n 1" +# hs "$spv_dir/src/update-history.sh && cat $spv_dir/src/api/management/commands/update-history.log | tail -n 1" # scan cron log for hs cmd crnl "grep \"(kevin) CMD\" /var/log/syslog | tail -n 1 && hlg" # removes all but newest file @@ -287,6 +289,8 @@ tcl "tex-clean" mfs "nvim /home/kevin/coding/best-mf-site-personal/index.html" +ss "ssh kevin@192.168.0.100" + # }}} coding projs # # school {{{ # diff --git a/fish/.config/fish/config.fish b/fish/.config/fish/config.fish index e985d41..fc2e62d 100644 --- a/fish/.config/fish/config.fish +++ b/fish/.config/fish/config.fish @@ -5,15 +5,15 @@ if status is-login exec startx -- -keeptty end end -set -x GPG_TTY=$(tty) +set -x GPG_TTY (tty) # }}} login to X # # input xset r rate 200 60 fish_vi_key_bindings -set -x EDITOR /usr/bin/nvim -set -x VISUAL /usr/bin/nvim +set -x EDITOR nvim +set -x VISUAL nvim builtin cd $last_dir @@ -30,3 +30,10 @@ source $spv_dir/src/api-keys.sh # set -U PATH /usr/local/sbin /usr/local/bin /usr/bin /usr/bin/site_perl /usr/bin/vendor_perl /usr/bin/core_perl /home/kevin/linux-config/scripts set -x PATH $PATH /home/kevin/linux-config/scripts set -x PASSWORD_STORE_CLIP_TIME 120 + +# fxn abbr's +abbr ag "grep-aliases" +abbr gcamp "git-amend-push" +abbr hs "scan-history" +abbr ut "unix-timestamp" +abbr z "zathura-silent" diff --git a/fish/.config/fish/functions/git-amend-push.fish b/fish/.config/fish/functions/git-amend-push.fish new file mode 100644 index 0000000..84d7861 --- /dev/null +++ b/fish/.config/fish/functions/git-amend-push.fish @@ -0,0 +1,5 @@ +function git-amend-push + git add -A . + and git commit --amend --no-edit -S + and git push --force +end diff --git a/fish/.config/fish/functions/gx.fish b/fish/.config/fish/functions/grep-aliases.fish similarity index 81% rename from fish/.config/fish/functions/gx.fish rename to fish/.config/fish/functions/grep-aliases.fish index 9dfa6dc..0cf78b2 100644 --- a/fish/.config/fish/functions/gx.fish +++ b/fish/.config/fish/functions/grep-aliases.fish @@ -1,4 +1,4 @@ -function gx +function grep-aliases set key_aliases /home/kevin/linux-config/aliases/key_aliases grep $argv[1] $key_aliases end diff --git a/fish/.config/fish/functions/scan-history.fish b/fish/.config/fish/functions/scan-history.fish new file mode 100644 index 0000000..4a2cc86 --- /dev/null +++ b/fish/.config/fish/functions/scan-history.fish @@ -0,0 +1,5 @@ +function scan-history + sudo systemctl start postgresql.service + and $spv_dir/src/update-history.sh + and cat $spv_dir/src/api/management/commands/update-history.log | tail -n 1 +end diff --git a/fish/.config/fish/functions/unix-timestamp.fish b/fish/.config/fish/functions/unix-timestamp.fish new file mode 100644 index 0000000..2f16855 --- /dev/null +++ b/fish/.config/fish/functions/unix-timestamp.fish @@ -0,0 +1,4 @@ +# convert unix timestamp +function unix-timestamp + date -d @$argv[1] +end diff --git a/fish/.config/fish/functions/vsnp.fish b/fish/.config/fish/functions/vsnp.fish index cbf2388..e781496 100644 --- a/fish/.config/fish/functions/vsnp.fish +++ b/fish/.config/fish/functions/vsnp.fish @@ -1,2 +1,4 @@ function vsnp + set snips_dir "/home/kevin/.vim/plugged/vim-snippets/UltiSnips" + echo $EDITOR $snips_dir/$argv[1] end diff --git a/fish/.config/fish/functions/zathura-silent.fish b/fish/.config/fish/functions/zathura-silent.fish new file mode 100644 index 0000000..d1d0f3b --- /dev/null +++ b/fish/.config/fish/functions/zathura-silent.fish @@ -0,0 +1,3 @@ +function zathura-silent + zathura $argv[1] > /dev/null 2>&1& +end diff --git a/txt/key_dirs.txt b/txt/key_dirs.txt index 397d3df..06507e6 100644 --- a/txt/key_dirs.txt +++ b/txt/key_dirs.txt @@ -5,7 +5,8 @@ cf /home/kevin/.config lc /home/kevin/linux-config/ d /home/kevin/Downloads D /home/kevin/Documents -ff /home/kevin/.config/fish +fc /home/kevin/.config/fish +ff /home/kevin/linux-config/fish/.config/fish/functions fs /home/kevin/linux-config/fish/.config/fish k /home/kevin/ lc /home/kevin/linux-config/ @@ -29,7 +30,7 @@ snp /home/kevin/.vim/plugged/vim-snippets/UltiSnips sv /home/kevin/coding/spotify-lib-vis/src swa /home/kevin/.local/share/nvim/swap tx /home/kevin/linux-config/txt -wa /home/kevin/.config/watson +wd /home/kevin/.config/watson wo /home/kevin/Documents/workout-logs/11 # }}} cdn * @@ -42,7 +43,6 @@ e1 /home/kevin/school/309/e1 6 /home/kevin/school/369 a1 /home/kevin/school/369/a1/ hp /home/kevin/school/hps -ph /home/kevin/school/phl lt /home/kevin/school/latex-notes # }}} sch * diff --git a/vim/.vimrc b/vim/.vimrc index 5e63c6e..afbe5bb 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -316,4 +316,6 @@ autocmd Filetype tex inoremap tx $t(x)$ autocmd Filetype md inoremap x 0f[lRX +autocmd Filetype fish inoremap 1 $argv[1] + " }}} Local Mappings "