Browse Source

Some fish functions

red-hat-laptop
Kevin Mok 6 years ago
parent
commit
e5456c8f52
Signed by: Kevin-Mok GPG Key ID: AEA75288DC135CF5
  1. 16
      aliases/key_aliases
  2. 13
      fish/.config/fish/config.fish
  3. 5
      fish/.config/fish/functions/git-amend-push.fish
  4. 2
      fish/.config/fish/functions/grep-aliases.fish
  5. 5
      fish/.config/fish/functions/scan-history.fish
  6. 4
      fish/.config/fish/functions/unix-timestamp.fish
  7. 2
      fish/.config/fish/functions/vsnp.fish
  8. 3
      fish/.config/fish/functions/zathura-silent.fish
  9. 6
      txt/key_dirs.txt
  10. 2
      vim/.vimrc

16
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 {{{ #

13
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"

5
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

2
fish/.config/fish/functions/gx.fish → 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

5
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

4
fish/.config/fish/functions/unix-timestamp.fish

@ -0,0 +1,4 @@
# convert unix timestamp
function unix-timestamp
date -d @$argv[1]
end

2
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

3
fish/.config/fish/functions/zathura-silent.fish

@ -0,0 +1,3 @@
function zathura-silent
zathura $argv[1] > /dev/null 2>&1&
end

6
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 *

2
vim/.vimrc

@ -316,4 +316,6 @@ autocmd Filetype tex inoremap <localleader>tx $t(x)$
autocmd Filetype md inoremap <localleader>x 0f[lRX
autocmd Filetype fish inoremap <localleader>1 $argv[1]
" }}} Local Mappings "
Loading…
Cancel
Save