Browse Source

Fish functions

red-hat-laptop
Kevin Mok 5 years ago
parent
commit
69bb713ff4
Signed by: Kevin-Mok GPG Key ID: AEA75288DC135CF5
  1. 29
      aliases/key_aliases
  2. 2
      fish/.config/fish/config.fish
  3. 8
      fish/.config/fish/functions/drop-grocery.fish
  4. 4
      fish/.config/fish/functions/grep-kuhn.fish
  5. 4
      fish/.config/fish/functions/grep-pdf-file.fish
  6. 2
      fish/.config/fish/functions/grep-pdf.fish
  7. 3
      fish/.config/fish/functions/pastebin.fish
  8. 3
      fish/.config/fish/functions/redshift-set.fish
  9. 3
      fish/.config/fish/functions/shred-rm.fish
  10. 14
      i3/.config/i3/config
  11. 10
      mpv/.config/mpv/input.conf
  12. 4
      scripts/sync-shortcuts
  13. 12
      txt/key_dirs.txt
  14. 10
      txt/key_files.txt
  15. 20
      vim/.vimrc
  16. 2
      x/.Xresources

29
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 #

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

8
fish/.config/fish/functions/drop-grocery.fish

@ -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

4
fish/.config/fish/functions/grep-kuhn.fish

@ -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

4
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

2
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

3
fish/.config/fish/functions/pastebin.fish

@ -0,0 +1,3 @@
function pastebin
cat $argv[1] | curl -F 'sprunge=<-' http://sprunge.us
end

3
fish/.config/fish/functions/redshift-set.fish

@ -0,0 +1,3 @@
function redshift-set
redshift -x && redshift -O (math "$argv[1] * 100")
end

3
fish/.config/fish/functions/shred-rm.fish

@ -0,0 +1,3 @@
function shred-rm
shred $argv && rm $argv
end

14
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 "

10
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

4
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;

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

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

20
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 <F8> :LivedownToggle<CR>
autocmd Filetype markdown inoremap <Tab> <Esc>>>A
autocmd Filetype markdown inoremap <S-Tab> <Esc><<A
autocmd Filetype javascript set updatetime=1000
autocmd Filetype json nnoremap <leader>j :%!python -m json.tool<CR>
autocmd Filetype json set foldmethod=marker
autocmd FileType sh map <F8> :!clear && shellcheck %<CR>
@ -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 >> <Esc>>>A
inoremap << <Esc><<A
" function keys {{{ "
map <F3> :wa<CR>
map <F4> :xa<CR>
@ -280,7 +289,8 @@ nnoremap <leader>fi :YcmCompleter FixIt<CR>
nnoremap <leader>ft /TODO<CR>
nnoremap <leader>g :YcmCompleter GoTo<CR>
" vimdiff split
nnoremap <leader>gd :Gvdiff HEAD~
nnoremap <leader>gd :Gvdiff
nnoremap <leader>gdh :Gvdiff HEAD~
nnoremap <leader>gdm :Gvdiff master<CR>
" toggle search highlighting
nnoremap <leader>h :set hlsearch! hlsearch?<CR>
@ -328,6 +338,8 @@ nnoremap <leader>sol q:i.,.+sort<ESC>Fsi
" set syntax to shell (for dotfiles)
nnoremap <leader>sys :set syn=sh<CR>
vnoremap <leader>t :!tac<CR>
" capitalize letter
nnoremap <leader>u vU
" open vimrc in vertical split
nnoremap <leader>vv :vsp ~/.vimrc<CR>
" copy next thing to system clipboard

2
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

Loading…
Cancel
Save