From 2c20c72b1a7153add592e6ae9e41ee2ab27ad639 Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Mon, 1 Aug 2022 18:04:11 +0200 Subject: [PATCH] add shortcuts and aliasses --- .config/lf/lfrc | 2 ++ .config/lf/shortcutrc | 29 +++++++++++++++++++++++++++++ .config/shell/aliasrc | 17 +++++++++++++---- .config/shell/bm-dirs | 1 - .config/shell/shortcutrc | 30 +++++++++++++++--------------- .config/shell/zshnameddirrc | 3 +-- .local/bin/shortcuts | 9 +-------- 7 files changed, 61 insertions(+), 30 deletions(-) create mode 100644 .config/lf/shortcutrc diff --git a/.config/lf/lfrc b/.config/lf/lfrc index f2802092..0e94c159 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -8,6 +8,8 @@ set period 1 set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml" set previewer ~/.config/lf/preview set cleaner ~/.config/lf/clean +# source directory shortcuts +source "~/.config/lf/shortcutrc" cmd open ${{ case $(file --mime-type "$(readlink -f $f)" -b) in diff --git a/.config/lf/shortcutrc b/.config/lf/shortcutrc new file mode 100644 index 00000000..4827fce8 --- /dev/null +++ b/.config/lf/shortcutrc @@ -0,0 +1,29 @@ +map Ccac cd "/home/luca/.cache" +map Ccf cd "/home/luca/.config" +map CD cd "/home/luca/Downloads" +map Cd cd "/home/luca/Documents" +map Cdt cd "/home/luca/.local/share" +map Crr cd "/home/luca/.local/src" +map Ch cd "/home/luca" +map Cm cd "/home/luca/Music" +map Cmn cd "/mnt" +map Cpp cd "/home/luca/Pictures" +map Csc cd "/home/luca/.local/bin" +map Csrc cd "/home/luca/.local/src" +map Cvv cd "/home/luca/Videos" +map Ebf $$EDITOR "/home/luca/.config/shell/bm-files" +map Ebd $$EDITOR "/home/luca/.config/shell/bm-dirs" +map Ecfx $$EDITOR "/home/luca/.config/x11/xresources" +map Ecfb $$EDITOR "~/.local/src/dwmblocks/config.h" +map Ecfv $$EDITOR "/home/luca/.config/nvim/init.vim" +map Ecfz $$EDITOR "/.zshrc" +map Ecfa $$EDITOR "/home/luca/.config/shell/aliasrc" +map Ecfp $$EDITOR "/home/luca/.config/shell/profile" +map Ecfm $$EDITOR "/home/luca/.config/mutt/muttrc" +map Ecfn $$EDITOR "/home/luca/.config/newsboat/config" +map Ecfu $$EDITOR "/home/luca/.config/newsboat/urls" +map Ecfmb $$EDITOR "/home/luca/.config/ncmpcpp/bindings" +map Ecfmc $$EDITOR "/home/luca/.config/ncmpcpp/config" +map Ecfl $$EDITOR "/home/luca/.config/lf/lfrc" +map EcfL $$EDITOR "/home/luca/.config/lf/scope" +map EcfX $$EDITOR "/home/luca/.config/sxiv/exec/key-handler" diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 219d6d13..2c93a8fb 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -4,7 +4,7 @@ [ -f "$XINITRC" ] && alias startx="startx $XINITRC" # sudo not required for some system commands -for command in mount umount sv pacman updatedb su shutdown poweroff reboot ; do +for command in mount umount sv pacman apt updatedb su shutdown poweroff reboot ; do alias $command="sudo $command" done; unset command @@ -18,20 +18,29 @@ alias \ ffmpeg="ffmpeg -hide_banner" \ exa="exa -abghHliS" \ duf="duf -all" \ - lock='slock -m "$(cowsay "$(fortune)" | lolcat -ft)"' + lock='slock -m "$(cowsay "$(fortune)" | lolcat -ft)"' \ + ls="ls -hN --color=auto --group-directories-first" \ + grep="grep --color=auto" \ + diff="diff --color=auto" \ + # Colorize commands when possible. alias \ ls="ls -hN --color=auto --group-directories-first" \ grep="grep --color=auto" \ diff="diff --color=auto" \ - ccat="highlight --out-format=ansi" + ccat="highlight --out-format=ansi" \ + ip="ip -color=auto" # These common commands are just too long! Abbreviate them. alias \ ka="killall" \ e="$EDITOR" \ - p="pacman" + z="zathura" \ + p="pacman" \ + au="apt uninstall" \ + ar="apt reinstall" \ + ai="apt install" \ # Misc. alias \ diff --git a/.config/shell/bm-dirs b/.config/shell/bm-dirs index f9279f36..9d212ec5 100644 --- a/.config/shell/bm-dirs +++ b/.config/shell/bm-dirs @@ -1,5 +1,4 @@ # You can add comments to these files with # -tr ${XDG_DATA_HOME:-$HOME/Trash} cac ${XDG_CACHE_HOME:-$HOME/.cache} cf ${XDG_CONFIG_HOME:-$HOME/.config} D ${XDG_DOWNLOAD_DIR:-$HOME/Downloads} diff --git a/.config/shell/shortcutrc b/.config/shell/shortcutrc index 25229d36..45a90c0d 100644 --- a/.config/shell/shortcutrc +++ b/.config/shell/shortcutrc @@ -1,24 +1,24 @@ # vim: filetype=sh -alias tr="cd /home/luca/.local/share && ls -a" \ -cac="cd /home/luca/.cache && ls -a" \ -cf="cd /home/luca/.config && ls -a" \ -D="cd /home/luca/Downloads && ls -a" \ -d="cd /home/luca/Documents && ls -a" \ -dt="cd /home/luca/.local/share && ls -a" \ -rr="cd /home/luca/.local/src && ls -a" \ -h="cd /home/luca && ls -a" \ -m="cd /home/luca/Music && ls -a" \ -mn="cd /mnt && ls -a" \ -pp="cd /home/luca/Pictures && ls -a" \ -sc="cd /home/luca/.local/bin && ls -a" \ -src="cd /home/luca/.local/src && ls -a" \ -vv="cd /home/luca/Videos && ls -a" \ +alias \ +cac="cd /home/luca/.cache" \ +cf="cd /home/luca/.config" \ +D="cd /home/luca/Downloads" \ +d="cd /home/luca/Documents" \ +dt="cd /home/luca/.local/share" \ +rr="cd /home/luca/.local/src" \ +h="cd /home/luca" \ +m="cd /home/luca/Music" \ +mn="cd /mnt" \ +pp="cd /home/luca/Pictures" \ +sc="cd /home/luca/.local/bin" \ +src="cd /home/luca/.local/src" \ +vv="cd /home/luca/Videos" \ bf="$EDITOR /home/luca/.config/shell/bm-files" \ bd="$EDITOR /home/luca/.config/shell/bm-dirs" \ cfx="$EDITOR /home/luca/.config/x11/xresources" \ cfb="$EDITOR ~/.local/src/dwmblocks/config.h" \ cfv="$EDITOR /home/luca/.config/nvim/init.vim" \ -cfz="$EDITOR /home/luca/.config/zsh/.zshrc" \ +cfz="$EDITOR /.zshrc" \ cfa="$EDITOR /home/luca/.config/shell/aliasrc" \ cfp="$EDITOR /home/luca/.config/shell/profile" \ cfm="$EDITOR /home/luca/.config/mutt/muttrc" \ diff --git a/.config/shell/zshnameddirrc b/.config/shell/zshnameddirrc index 07389c2d..cefe361f 100644 --- a/.config/shell/zshnameddirrc +++ b/.config/shell/zshnameddirrc @@ -1,4 +1,3 @@ -hash -d tr=/home/luca/.local/share hash -d cac=/home/luca/.cache hash -d cf=/home/luca/.config hash -d D=/home/luca/Downloads @@ -17,7 +16,7 @@ hash -d bd=/home/luca/.config/shell/bm-dirs hash -d cfx=/home/luca/.config/x11/xresources hash -d cfb=~/.local/src/dwmblocks/config.h hash -d cfv=/home/luca/.config/nvim/init.vim -hash -d cfz=/home/luca/.config/zsh/.zshrc +hash -d cfz=/.zshrc hash -d cfa=/home/luca/.config/shell/aliasrc hash -d cfp=/home/luca/.config/shell/profile hash -d cfm=/home/luca/.config/mutt/muttrc diff --git a/.local/bin/shortcuts b/.local/bin/shortcuts index 253aff05..abea99ff 100755 --- a/.local/bin/shortcuts +++ b/.local/bin/shortcuts @@ -21,12 +21,8 @@ printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts" # Format the `directories` file in the correct syntax and sent it to all three configs. eval "echo \"$(cat "$bmdirs")\"" | \ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); - printf(\"%s=\42cd %s && ls -a\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; + printf(\"%s=\42cd %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ; - printf(\"abbr %s \42cd %s; and ls -a\42\n\",\$1,\$2) >> \"$fish_shortcuts\" ; - printf(\"map g%s :cd %s\nmap t%s :cd %s\nmap M%s :cd %s:mo\nmap Y%s :cd %s:co \n\",\$1,\$2, \$1, \$2, \$1, \$2, \$1, \$2) >> \"$vifm_shortcuts\" ; - printf(\"config.bind(';%s', \42set downloads.location.directory %s ;; hint links download\42) \n\",\$1,\$2) >> \"$qute_shortcuts\" ; - printf(\"map g%s cd %s\nmap t%s tab_new %s\nmap m%s shell mv -v %%s %s\nmap Y%s shell cp -rv %%s %s \n\",\$1,\$2,\$1,\$2, \$1, \$2, \$1, \$2) >> \"$ranger_shortcuts\" ; printf(\"map C%s cd \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" }" # Format the `files` file in the correct syntax and sent it to both configs. @@ -34,7 +30,4 @@ eval "echo \"$(cat "$bmfiles")\"" | \ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ; - printf(\"abbr %s \42\$EDITOR %s\42 \n\",\$1,\$2) >> \"$fish_shortcuts\" ; - printf(\"map %s :e %s \n\",\$1,\$2) >> \"$vifm_shortcuts\" ; - printf(\"map %s shell \$EDITOR %s \n\",\$1,\$2) >> \"$ranger_shortcuts\" ; printf(\"map E%s \$\$EDITOR \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" }"