From 8ca4661cb2685b548dd2bfb9afd144159012066b Mon Sep 17 00:00:00 2001 From: Kevin Mok Date: Fri, 30 Nov 2018 00:03:55 -0500 Subject: [PATCH] Set key dirs --- aliases/zsh_aliases | 37 +------------------- configs/ranger/bookmarks | 2 +- configs/ranger/rc.conf | 6 ++-- configs/ranger/shortcuts.conf | 64 +++++++++++++++++++++++++++++++++++ key_dirs.txt | 34 +++++++++++++++++-- shortcuts.sh | 6 ++-- 6 files changed, 103 insertions(+), 46 deletions(-) diff --git a/aliases/zsh_aliases b/aliases/zsh_aliases index a9b2b12..d9cd00f 100644 --- a/aliases/zsh_aliases +++ b/aliases/zsh_aliases @@ -64,12 +64,7 @@ function rmr() { rm -rf $1 ; } alias "f."="f .." alias "f.."="f ..." -alias fd="f ~/Downloads" function mvd() { mv $1 ~/Downloads ; } -alias fds="f ~/Downloads/sch" -alias doc="f ~/Documents" -alias wo="f ~/Documents/workout-logs/11" -alias cfg="f ~/.config" # }}} directory-related # @@ -116,7 +111,6 @@ alias aptu="sudo apt upgrade" # }}} system # # config files {{{ # -alias lc="f ~/linux-config/" function glc() { grep $1 ~/linux-config/aliases/zsh_aliases ; } alias lca="f ~/linux-config/aliases" @@ -133,12 +127,10 @@ alias v3b="ni ~/.config/i3blocks/i3blocks.conf" alias i3b="f ~/i3blocks" alias pipes="pipes.sh -t 2" -alias bg="f ~/Pictures/Backgrounds" # }}} i3 # # UltiSnips {{{ # usnp_dir="~/.vim/plugged/vim-snippets/UltiSnips" -alias snp="f $usnp_dir" function vsnp() { ni ~/.vim/plugged/vim-snippets/UltiSnips/"$1".snippets ; } alias tm="ni $usnp_dir/texmath.snippets" # }}} # @@ -148,7 +140,7 @@ alias tm="ni $usnp_dir/texmath.snippets" # applications {{{ # silent="> /dev/null 2>&1& " -alias ran="ranger" +alias rn="ranger" # okular # function ok() { nohup okular $1 > /dev/null 2>&1& ; } # zathura @@ -158,7 +150,6 @@ function xv() { nohup xviewer $1 > /dev/null 2>&1& ; } function chr() { google-chrome $1 ; } function ni() { nvim $1 ; } function sni() { sudo nvim $1 ; } - alias nisw="f ~/.local/share/nvim/swap" # function mrk() { pandoc -o ${1%.*}.html $1 && chr ${1%.*}.html ; } function mrk() { pandoc -o ${1%.*}.html $1 ; } function auc() { xdotool click --repeat 1000000 --delay $1 1 ; } @@ -285,25 +276,11 @@ function grmb() { git push origin --delete $1 && git branch -D $1 ; } # coding projs {{{ # coding_dir="~/coding" -cd_coding_dir="f $coding_dir" alias cdn="$cd_coding_dir" -alias ans="f /usr/local/android-studio/bin && ./studio.sh" alias gx="ni ~/Documents/csgo-config/autoexec.cfg" -alias jnd="f ~/Documents/journal" alias jn="ni ~/Documents/journal/todo/11.md" alias jnt="ni ~/Documents/journal/todo/todo.md" -# alias rs="f ~/Documents/runescape" - -# ideas {{{ # - -# ideas_dir="$coding_dir""/ideas" -# alias ids="f $ideas_dir" -# alias lci="f $ideas_dir/general" -# alias vli="ni $ideas_dir/general/ideas.md" -# alias fyn="f $ideas_dir/yes-no" - -# }}} ideas # # trapbot {{{ # alias tb="$cd_coding_dir/trapbot" @@ -315,7 +292,6 @@ alias tb="$cd_coding_dir/trapbot" # spotify-lib-vis {{{ # spv_dir="$coding_dir""/spotify-lib-vis" -alias sv="f $spv_dir/src" alias svl="f $spv_dir/src/login" alias sva="f $spv_dir/src/api" alias svg="f $spv_dir/src/graphs" @@ -339,7 +315,6 @@ alias upip="pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 alias ureq="pip freeze > requirements.txt" # scan history -alias slh="f ~/Music/spotify-history" alias hlg="cat $spv_dir/src/api/management/commands/update-history.log | tail -n 1" alias hlgf="ni $spv_dir/src/api/management/commands/update-history.log" alias crnl="grep \"(kevin) CMD\" /var/log/syslog | tail -n 1 && hlg" @@ -363,17 +338,7 @@ alias hs="$spv_dir/src/update-history.sh && hlg" # school {{{ # -alias sch="f ~/Documents/school" -alias sta="f ~/Documents/school/sta" - -# 236 -alias 236="f ~/Documents/school/236" -alias a3="f ~/Documents/school/latex-notes/236/a3" - # 343 -alias 343="f ~/Documents/school/343" -# alias a1="f ~/Documents/school/latex-notes/343/a1" - alias ij="sudo ~/Downloads/idea/bin/idea.sh $silent" alias a2="f ~/Documents/school/343/a2" alias a2j="f ~/Documents/school/343/a2/java/src" diff --git a/configs/ranger/bookmarks b/configs/ranger/bookmarks index d960c95..fc4af56 100644 --- a/configs/ranger/bookmarks +++ b/configs/ranger/bookmarks @@ -1 +1 @@ -':/home/kevin/Downloads +':/home/kevin/linux-config/configs/ranger diff --git a/configs/ranger/rc.conf b/configs/ranger/rc.conf index b689ae0..a39c07f 100644 --- a/configs/ranger/rc.conf +++ b/configs/ranger/rc.conf @@ -658,6 +658,8 @@ tmap taskview_close copytmap q Q w # }}} # +source /home/kevin/.config/ranger/shortcuts.conf + # preview images set preview_images_method urxvt @@ -666,12 +668,10 @@ map R chain shell nvim -p ~/.config/ranger/rc.conf %rangerdir/config/rc.conf; so map rr source ~/.config/ranger/rc.conf # backgrounds -map fd cd ~/Downloads -map bg cd ~/Pictures/Backgrounds map w shell ~/.local/bin/wal -i %f map md shell mv %f dim map mb shell mv %f vibrant # bulk rename map cw eval fm.execute_console("bulkrename") if fm.thisdir.marked_items else fm.open_console("rename ") -source /home/kevin/.config/ranger/shortcuts.conf + diff --git a/configs/ranger/shortcuts.conf b/configs/ranger/shortcuts.conf index 7db0801..f6caca3 100644 --- a/configs/ranger/shortcuts.conf +++ b/configs/ranger/shortcuts.conf @@ -1,4 +1,68 @@ +map gbg cd ~/Pictures/Backgrounds +map tbg tab_new ~/Pictures/Backgrounds +map mbg shell mv -v %s ~/Pictures/Backgrounds +map Ybg shell cp -rv %s ~/Pictures/Backgrounds map gd cd ~/Downloads map td tab_new ~/Downloads map md shell mv -v %s ~/Downloads map Yd shell cp -rv %s ~/Downloads +map gD cd ~/Documents +map tD tab_new ~/Documents +map mD shell mv -v %s ~/Documents +map YD shell cp -rv %s ~/Documents +map gho cd ~/ +map tho tab_new ~/ +map mho shell mv -v %s ~/ +map Yho shell cp -rv %s ~/ +map glc cd ~/linux-config/ +map tlc tab_new ~/linux-config/ +map mlc shell mv -v %s ~/linux-config/ +map Ylc shell cp -rv %s ~/linux-config/ +map gcd cd ~/coding +map tcd tab_new ~/coding +map mcd shell mv -v %s ~/coding +map Ycd shell cp -rv %s ~/coding +map gjnd cd ~/Documents/journal +map tjnd tab_new ~/Documents/journal +map mjnd shell mv -v %s ~/Documents/journal +map Yjnd shell cp -rv %s ~/Documents/journal +map glh cd ~/Music/spotify-history +map tlh tab_new ~/Music/spotify-history +map mlh shell mv -v %s ~/Music/spotify-history +map Ylh shell cp -rv %s ~/Music/spotify-history +map gsnp cd ~/.vim/plugged/vim-snippets/UltiSnips +map tsnp tab_new ~/.vim/plugged/vim-snippets/UltiSnips +map msnp shell mv -v %s ~/.vim/plugged/vim-snippets/UltiSnips +map Ysnp shell cp -rv %s ~/.vim/plugged/vim-snippets/UltiSnips +map gsv cd ~/coding/spotify-lib-vis/src +map tsv tab_new ~/coding/spotify-lib-vis/src +map msv shell mv -v %s ~/coding/spotify-lib-vis/src +map Ysv shell cp -rv %s ~/coding/spotify-lib-vis/src +map gswa cd ~/.local/share/nvim/swap +map tswa tab_new ~/.local/share/nvim/swap +map mswa shell mv -v %s ~/.local/share/nvim/swap +map Yswa shell cp -rv %s ~/.local/share/nvim/swap +map gwo cd ~/Documents/workout-logs/11 +map two tab_new ~/Documents/workout-logs/11 +map mwo shell mv -v %s ~/Documents/workout-logs/11 +map Ywo shell cp -rv %s ~/Documents/workout-logs/11 +map gsc cd ~/Documents/school +map tsc tab_new ~/Documents/school +map msc shell mv -v %s ~/Documents/school +map Ysc shell cp -rv %s ~/Documents/school +map gst cd ~/Documents/school/sta +map tst tab_new ~/Documents/school/sta +map mst shell mv -v %s ~/Documents/school/sta +map Yst shell cp -rv %s ~/Documents/school/sta +map g2 cd ~/Documents/school/236 +map t2 tab_new ~/Documents/school/236 +map m2 shell mv -v %s ~/Documents/school/236 +map Y2 shell cp -rv %s ~/Documents/school/236 +map ga3 cd ~/Documents/school/latex-notes/236/a3 +map ta3 tab_new ~/Documents/school/latex-notes/236/a3 +map ma3 shell mv -v %s ~/Documents/school/latex-notes/236/a3 +map Ya3 shell cp -rv %s ~/Documents/school/latex-notes/236/a3 +map g3 cd ~/Documents/school/343 +map t3 tab_new ~/Documents/school/343 +map m3 shell mv -v %s ~/Documents/school/343 +map Y3 shell cp -rv %s ~/Documents/school/343 diff --git a/key_dirs.txt b/key_dirs.txt index 5142a72..2bd2303 100644 --- a/key_dirs.txt +++ b/key_dirs.txt @@ -1,3 +1,31 @@ -D ~/Documents -d ~/Downloads -ho ~/ +# sys {{{ * + +bg ~/Pictures/Backgrounds +d ~/Downloads +D ~/Documents +ho ~/ +lc ~/linux-config/ + +# }}} sys * + +# cdn {{{ * + +cd ~/coding +jnd ~/Documents/journal +lh ~/Music/spotify-history +snp ~/.vim/plugged/vim-snippets/UltiSnips +sv ~/coding/spotify-lib-vis/src +swa ~/.local/share/nvim/swap +wo ~/Documents/workout-logs/11 + +# }}} cdn * + +# sch {{{ * + +sc ~/Documents/school +st ~/Documents/school/sta +2 ~/Documents/school/236 +a3 ~/Documents/school/latex-notes/236/a3 +3 ~/Documents/school/343 + +# }}} sch * diff --git a/shortcuts.sh b/shortcuts.sh index 8f2b9dc..f8e27c4 100755 --- a/shortcuts.sh +++ b/shortcuts.sh @@ -22,9 +22,9 @@ ensure "source $shell_shortcuts" "$shellrc" ensure "source $HOME/.config/ranger/shortcuts.conf" "$HOME/.config/ranger/rc.conf" # Format the `folders` file in the correct syntax and sent it to all three configs. -sed "s/#.*$//;/^$/d" "$folders" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \ +sed "s/#.*$//;/^$/d" "$folders" | tee >(awk '{print $1"=\"f "$2"\" \\"}' >> "$shell_shortcuts") \ | awk '{print "map g"$1" cd "$2"\nmap t"$1" tab_new "$2"\nmap m"$1" shell mv -v %s "$2"\nmap Y"$1" shell cp -rv %s "$2}' >> "$ranger_shortcuts" # Format the `configs` file in the correct syntax and sent it to both configs. -sed "s/#.*$//;/^$/d" "$configs" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \ - | awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts" +# sed "s/#.*$//;/^$/d" "$configs" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \ + # | awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts"