From 69bb713ff459651d96e8a8e6c3f4f45e00e01245 Mon Sep 17 00:00:00 2001 From: Kevin Mok Date: Sun, 14 Apr 2019 22:39:48 -0400 Subject: [PATCH] Fish functions --- aliases/key_aliases | 29 ++++++++++++++----- fish/.config/fish/config.fish | 2 ++ fish/.config/fish/functions/drop-grocery.fish | 8 ----- fish/.config/fish/functions/grep-kuhn.fish | 4 --- .../.config/fish/functions/grep-pdf-file.fish | 4 +++ fish/.config/fish/functions/grep-pdf.fish | 2 +- fish/.config/fish/functions/pastebin.fish | 3 ++ fish/.config/fish/functions/redshift-set.fish | 3 ++ fish/.config/fish/functions/shred-rm.fish | 3 ++ i3/.config/i3/config | 14 +++++---- mpv/.config/mpv/input.conf | 10 +++---- scripts/sync-shortcuts | 4 +-- txt/key_dirs.txt | 12 ++------ txt/key_files.txt | 10 +++++-- vim/.vimrc | 20 ++++++++++--- x/.Xresources | 2 ++ 16 files changed, 82 insertions(+), 48 deletions(-) delete mode 100644 fish/.config/fish/functions/drop-grocery.fish delete mode 100644 fish/.config/fish/functions/grep-kuhn.fish create mode 100644 fish/.config/fish/functions/grep-pdf-file.fish create mode 100644 fish/.config/fish/functions/pastebin.fish create mode 100644 fish/.config/fish/functions/redshift-set.fish create mode 100644 fish/.config/fish/functions/shred-rm.fish diff --git a/aliases/key_aliases b/aliases/key_aliases index 0c71d06..1390c9a 100644 --- a/aliases/key_aliases +++ b/aliases/key_aliases @@ -65,7 +65,7 @@ fnd "find . -type f -name" rmr "rm -rf" rmd "rm ~/Downloads/*" -rmsw "rm ~/.local/share/nvim/swap/" +rmw "rm ~/.local/share/nvim/swap/" md "mkdir -p" rsy "rsync -Pr" @@ -162,6 +162,7 @@ mp "mpv --volume=50" mra "man ranger" n "nvim" p3 "python3" +pdft "pdftotext" pipes "pipes.sh -t 3" py "python" r "ranger" @@ -187,6 +188,7 @@ psc "pass -c" pse "pass edit" psi "pass insert -m" psg "pass generate -c" +pss "pass show" xc "xclip -selection clipboard" yh "echo 'kevin.mok@live.ca' | xclip -selection clipboard" @@ -209,6 +211,7 @@ ww "watson log" wr "watson report --day" wrw "watson report" wre "watson restart" +wree "watson restart && watson edit" ws "watson status && watson stop" wse "watson stop && watson edit" wsc "watson cancel" @@ -251,6 +254,7 @@ grm "git rm" grmf "git rm -f" grmc "git rm --cached" grmfc "git rm -f --cached" +grmor "rm (fd -e orig --no-ignore -H)" # }}} add # @@ -387,6 +391,9 @@ rt "python ~/coding/rt-scraper/rt-scraper.py" # school {{{ # +wlf "watson log --all --tag=final" +wrf "watson report --all --tag=final" + # 369 {{{ # ssc "ssh mokkar@teach.cs.utoronto.ca" @@ -422,24 +429,32 @@ hl "valgrind --tool=helgrind ./carsim light 10 20" # }}} 369 # -# 309 -# wl0 "watson log --all --project=309 --tag=e3" -# wr0 "watson report --all --project=309 --tag=e3" +# 309{{{ + +wl0 "watson log --all --project=309 --tag=phase2" +wr0 "watson report --all --project=309 --tag=phase2" +# apps nd "node" ndm "nodemon" knd "killall node" mg "mongo" +# server 0ht "cd ~/school/309-proj && python3 -m http.server" mgd "mongod --dbpath mongo-data" -nds "killall node && nodemon server.js" +# nds "killall node && nodemon server.js" +nds "nodemon server.js" +# heroku hr "heroku" +hrs "heroku local web" hrt "heroku ps" hrl "heroku logs --dyno web -n 1500 | rg up | awk '{ system(\"date -d \" \$1); \$1 = \"\"; print \$0 }' | paste -s -d' \n'" +gpsh "git push heroku" + +0c "node collections.js" -wlh "watson log --all --project=hps --tag=essay" -wrh "watson report --all --project=hps --tag=essay" +# }}} # }}} school # diff --git a/fish/.config/fish/config.fish b/fish/.config/fish/config.fish index db81821..e478b80 100644 --- a/fish/.config/fish/config.fish +++ b/fish/.config/fish/config.fish @@ -79,6 +79,8 @@ abbr grmb "git-delete-branch" abbr hs "scan-history" abbr hst "$EDITOR ~/.local/share/fish/fish_history" abbr pgr "grep-pdf" +abbr pgrf "grep-pdf-file" +abbr rs "redshift-set" abbr ut "unix-timestamp" abbr uzr "unzip-rm" diff --git a/fish/.config/fish/functions/drop-grocery.fish b/fish/.config/fish/functions/drop-grocery.fish deleted file mode 100644 index 82e0e3b..0000000 --- a/fish/.config/fish/functions/drop-grocery.fish +++ /dev/null @@ -1,8 +0,0 @@ -function drop-grocery - set collection 'stores' - switch $argv[1] - case f - set collection 'foods' - end - mongo GroceryAPI --eval "db.$collection.drop()" -end diff --git a/fish/.config/fish/functions/grep-kuhn.fish b/fish/.config/fish/functions/grep-kuhn.fish deleted file mode 100644 index ddcaf47..0000000 --- a/fish/.config/fish/functions/grep-kuhn.fish +++ /dev/null @@ -1,4 +0,0 @@ -function grep-kuhn - pdfgrep -n $argv[1] -B $argv[2] -A $argv[3] /home/kevin/school/hps/w5-6-historicism/*/kuhn*.pdf > $argv[1].txt - and nvim $argv[1].txt -c "/$argv[1]" -end diff --git a/fish/.config/fish/functions/grep-pdf-file.fish b/fish/.config/fish/functions/grep-pdf-file.fish new file mode 100644 index 0000000..3d774f2 --- /dev/null +++ b/fish/.config/fish/functions/grep-pdf-file.fish @@ -0,0 +1,4 @@ +function grep-pdf-file + pdfgrep -n $argv[1] -B $argv[2] -A $argv[3] (fd -e pdf --no-ignore-vcs) > grep-$argv[1].txt + and nvim grep-$argv[1].txt -c "/$argv[1]" +end diff --git a/fish/.config/fish/functions/grep-pdf.fish b/fish/.config/fish/functions/grep-pdf.fish index d5538f1..48e6a5a 100644 --- a/fish/.config/fish/functions/grep-pdf.fish +++ b/fish/.config/fish/functions/grep-pdf.fish @@ -1,3 +1,3 @@ function grep-pdf - pdfgrep -n $argv[1] -B $argv[2] -A $argv[3] (fd -e pdf --no-ignore-vcs) + pdfgrep -n $argv[1] (fd -e pdf --no-ignore-vcs) end diff --git a/fish/.config/fish/functions/pastebin.fish b/fish/.config/fish/functions/pastebin.fish new file mode 100644 index 0000000..703d4b5 --- /dev/null +++ b/fish/.config/fish/functions/pastebin.fish @@ -0,0 +1,3 @@ +function pastebin + cat $argv[1] | curl -F 'sprunge=<-' http://sprunge.us +end diff --git a/fish/.config/fish/functions/redshift-set.fish b/fish/.config/fish/functions/redshift-set.fish new file mode 100644 index 0000000..5153148 --- /dev/null +++ b/fish/.config/fish/functions/redshift-set.fish @@ -0,0 +1,3 @@ +function redshift-set + redshift -x && redshift -O (math "$argv[1] * 100") +end diff --git a/fish/.config/fish/functions/shred-rm.fish b/fish/.config/fish/functions/shred-rm.fish new file mode 100644 index 0000000..75e6039 --- /dev/null +++ b/fish/.config/fish/functions/shred-rm.fish @@ -0,0 +1,3 @@ +function shred-rm + shred $argv && rm $argv +end diff --git a/i3/.config/i3/config b/i3/.config/i3/config index ee532f4..ff4c31d 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -27,13 +27,15 @@ set $mod Mod1 set $sch_dir "$HOME/Documents/School" # app shortcuts {{{ # -bindsym Mod4+a exec studio -# bindsym Mod4+1 exec xdotool click --repeat 5 --delay 100 1 -# bindsym Mod4+2 exec xdotool click --repeat 10 --delay 100 1 -# bindsym Mod4+3 exec xdotool click --repeat 20 --delay 100 1 + # bindsym $mod+control+Return exec i3-sensible-terminal # bindsym $mod+control+Return exec $def_term bindsym control+Return exec $def_term +# bindsym Mod4+1 exec xdotool click --repeat 5 --delay 100 1 +# bindsym Mod4+2 exec xdotool click --repeat 10 --delay 100 1 +# bindsym Mod4+3 exec xdotool click --repeat 20 --delay 100 1 +bindsym Mod4+a exec studio +bindsym Mod4+b layout tabbed; exec zathura bindsym Mod4+c exec $browser bindsym Mod4+e exec notify-send "HPS Word Count" "$(pdftotext /home/kevin/school/latex-notes/hps/essay.pdf - | wc -w)" bindsym Mod4+f exec firefox @@ -68,7 +70,7 @@ bindsym control+Print --release exec "scrot -u /tmp/screenshot-$(date +%F_%T).pn # redshift {{{ # -bindsym $mod+Mod4+1 exec redshift -x && redshift -O 1250 +bindsym $mod+Mod4+1 exec redshift -x && redshift -O 1100 bindsym $mod+Mod4+2 exec redshift -x && redshift -O 2000 bindsym $mod+Mod4+3 exec redshift -x && redshift -O 3000 bindsym $mod+Mod4+4 exec redshift -x && redshift -O 4000 @@ -233,7 +235,7 @@ set $ws5 "5 " workspace $ws5 output $samsung assign [class="Steam"] $ws5 bindsym $mod+F5 workspace $ws5; exec $browser -# bindsym Mod4+g workspace $ws5; layout stacking; exec urxvt -e steam +bindsym Mod4+g workspace $ws5; layout stacking; exec urxvt -e steam bindsym Mod4+t workspace $ws5; exec thunderbird set $ws6 "6 " diff --git a/mpv/.config/mpv/input.conf b/mpv/.config/mpv/input.conf index 4479c39..e767dca 100644 --- a/mpv/.config/mpv/input.conf +++ b/mpv/.config/mpv/input.conf @@ -4,15 +4,15 @@ WHEEL_DOWN add volume -1 # speed r set speed 1.0 -g set speed 1.5 -s add speed -.25 -d add speed .25 +g set speed 1.6 +s add speed -.2 +d add speed .2 # seek Shift+RIGHT seek 1 Shift+LEFT seek -1 -RIGHT seek 5 -LEFT seek -5 +RIGHT seek 3 +LEFT seek -3 UP seek 10 DOWN seek -10 Shift+UP seek 60 diff --git a/scripts/sync-shortcuts b/scripts/sync-shortcuts index ea8eae5..d8f1934 100755 --- a/scripts/sync-shortcuts +++ b/scripts/sync-shortcuts @@ -41,8 +41,8 @@ printf "# vim: filetype=sh\\nalias " > "$aliases" # Format the key file in the correct syntax and sent it to all configs. sed "s/\s*#.*$//;/^\s*$/d" "$key_dirs" | tee \ - >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$aliases") \ - >(awk '{print "abbr", $1, "\"cd " $2 "\""}' >> "$fish_abbr") \ + >(awk '{print $1"=\"cd "$2" && lsd -a\" \\"}' >> "$aliases") \ + >(awk '{print "abbr", $1, "\"cd", $2, "\""}' >> "$fish_abbr") \ | awk '{print "map f"$1, "cd", $2; print "map t"$1, "tab_new", $2; print "map m"$1, "shell mv -v %f", $2; diff --git a/txt/key_dirs.txt b/txt/key_dirs.txt index 1876cee..a1e072e 100644 --- a/txt/key_dirs.txt +++ b/txt/key_dirs.txt @@ -15,6 +15,7 @@ me /run/media/kevin o / p /home/kevin/.password-store P /home/kevin/Pictures +sw ~/.local/share/nvim/swap/ tm /tmp lfv /mnt/linux-files/Videos @@ -49,23 +50,16 @@ lt /home/kevin/school/latex-notes sc /home/kevin/school 0c /home/kevin/school/309-proj/css 0d /home/kevin/school/309 +0j /home/kevin/school/309-proj/public/js 0l /home/kevin/school/309/l 0p /home/kevin/school/309-proj +0m /home/kevin/school/309-proj/mongo e4 /home/kevin/school/309/e4 # }}} -# 369{{{ 6 /home/kevin/school/369 6l /home/kevin/school/369/notes/lectures -6m /mnt/369-a4 - -6f /home/kevin/linux-config/fish/.config/fish/functions/369/a3 -a4d /home/kevin/school/369/a4/a4 -a43 /home/kevin/school/369/a4-3/fs3 -#}}} hp /home/kevin/school/hps -hpe /home/kevin/school/latex-notes/hps -hper /home/kevin/school/hps/w5-6-historicism # }}} sch * diff --git a/txt/key_files.txt b/txt/key_files.txt index 2cf7eb1..a34b5d8 100644 --- a/txt/key_files.txt +++ b/txt/key_files.txt @@ -40,11 +40,17 @@ wt /home/kevin/.config/watson/state.tmp # sch {{{ * +# 309 {{{ * + 0c /home/kevin/school/309-proj/sass/main.scss -0h /home/kevin/school/309-proj/public/index.html +0h /home/kevin/school/309-proj/public/js/helpers.js +0i /home/kevin/school/309-proj/public/index.html 0m /home/kevin/school/309-proj/public/js/main.js 0f /home/kevin/school/309-proj/public/js/food.js -0s /home/kevin/school/309-proj/public/js/stores.js +0s /home/kevin/school/309-proj/server.js +0t /home/kevin/school/309-proj/public/js/stores.js 0k /home/kevin/school/309-proj/json/kevin.md +# }}} 309 * + # }}} sch * diff --git a/vim/.vimrc b/vim/.vimrc index ba9dad5..176eaca 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -26,13 +26,13 @@ set timeoutlen=350 set tw=75 set undodir=~/.vim/undo set undofile -set updatetime=5000 +set updatetime=2000 autocmd VimResized * wincmd = filetype plugin on filetype indent on syntax on -au CursorHold,CursorHoldI * checktime +au CursorHold * checktime " cursor indicator {{{ " @@ -50,9 +50,12 @@ au CursorHold,CursorHoldI * checktime autocmd BufNewFile,BufRead .* set syntax=sh autocmd FileType *css,htmldjango,html,javascript,json,markdown,tex,text,yaml set tabstop=2 shiftwidth=2 " autocmd BufNewFile,BufRead *.md set filetype=markdown -autocmd Filetype markdown set textwidth=0 +" autocmd Filetype markdown set textwidth=0 " autocmd Filetype html set foldmarker=0 autocmd Filetype markdown map :LivedownToggle +autocmd Filetype markdown inoremap >>A +autocmd Filetype markdown inoremap <j :%!python -m json.tool autocmd Filetype json set foldmethod=marker autocmd FileType sh map :!clear && shellcheck % @@ -215,6 +218,7 @@ Plug 'shime/vim-livedown' Plug 'tpope/vim-fugitive' " auto reload file Plug 'djoshea/vim-autoread' +" Plug 'mustache/vim-mustache-handlebars' call plug#end() @@ -225,6 +229,11 @@ colorscheme wal " Mappings {{{ " +nnoremap > >> +nnoremap < << +inoremap >> >>A +inoremap << < :wa map :xa @@ -280,7 +289,8 @@ nnoremap fi :YcmCompleter FixIt nnoremap ft /TODO nnoremap g :YcmCompleter GoTo " vimdiff split -nnoremap gd :Gvdiff HEAD~ +nnoremap gd :Gvdiff +nnoremap gdh :Gvdiff HEAD~ nnoremap gdm :Gvdiff master " toggle search highlighting nnoremap h :set hlsearch! hlsearch? @@ -328,6 +338,8 @@ nnoremap sol q:i.,.+sortFsi " set syntax to shell (for dotfiles) nnoremap sys :set syn=sh vnoremap t :!tac +" capitalize letter +nnoremap u vU " open vimrc in vertical split nnoremap vv :vsp ~/.vimrc " copy next thing to system clipboard diff --git a/x/.Xresources b/x/.Xresources index a58400c..45f542b 100644 --- a/x/.Xresources +++ b/x/.Xresources @@ -19,6 +19,8 @@ URxvt*shading: 40 /* }}} transparency */ URxvt.scrollBar: false +! URxvt.scrollBar: true +! URxvt*scrollBar_right: true ! Clickable URLs {{{ */ URxvt.perl-ext-common: default,matcher