From 7b74f9d8c2c658399596ac0babbd4fe1c1d10506 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 19 Feb 2019 13:13:05 -0500 Subject: [PATCH] bm* files, shortcuts and alias to .config --- .bashrc | 4 ++-- .aliasrc => .config/aliasrc | 2 +- .bmdirs => .config/bmdirs | 0 .bmfiles => .config/bmfiles | 0 .config/vifm/vifmrc | 2 +- .readme.mom | 10 +++++----- .scripts/SCRIPTS.md | 2 +- .scripts/tools/shortcuts | 10 +++++----- 8 files changed, 15 insertions(+), 15 deletions(-) rename .aliasrc => .config/aliasrc (95%) rename .bmdirs => .config/bmdirs (100%) rename .bmfiles => .config/bmfiles (100%) diff --git a/.bashrc b/.bashrc index 8569865..9338a0c 100644 --- a/.bashrc +++ b/.bashrc @@ -4,5 +4,5 @@ shopt -s autocd #Allows you to cd into directory merely by typing the directory HISTSIZE= HISTFILESIZE= # Infinite history. export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]" -[ -f "$HOME/.shortcuts" ] && source "$HOME/.shortcuts" # Load shortcut aliases -[ -f "$HOME/.aliasrc" ] && source "$HOME/.aliasrc" +[ -f "$HOME/.config/shortcutrc" ] && source "$HOME/.config/shortcutrc" # Load shortcut aliases +[ -f "$HOME/.config/aliasrc" ] && source "$HOME/.config/aliasrc" diff --git a/.aliasrc b/.config/aliasrc similarity index 95% rename from .aliasrc rename to .config/aliasrc index 111d3b5..022b067 100644 --- a/.aliasrc +++ b/.config/aliasrc @@ -19,7 +19,7 @@ alias ka="killall" \ yt="youtube-dl --add-metadata -i -o '%(upload_date)s-%(title)s.%(ext)s'" \ yta="yt -x -f bestaudio/best" \ YT="youtube-viewer" \ - ref="shortcuts >/dev/null; source ~/.shortcuts" \ + ref="shortcuts >/dev/null; source ~/.config/shortcutrc" \ upc="sudo pacman -Syu; pkill -RTMIN+8 i3blocks" \ lsp="pacman -Qett --color=always | less" \ ffmpeg="ffmpeg -hide_banner" diff --git a/.bmdirs b/.config/bmdirs similarity index 100% rename from .bmdirs rename to .config/bmdirs diff --git a/.bmfiles b/.config/bmfiles similarity index 100% rename from .bmfiles rename to .config/bmfiles diff --git a/.config/vifm/vifmrc b/.config/vifm/vifmrc index 59ec1a9..bf82bc0 100644 --- a/.config/vifm/vifmrc +++ b/.config/vifm/vifmrc @@ -1,5 +1,5 @@ " vim: filetype=vim -source ~/.vifmshortcuts +source ~/.config/vifm/vifmshortcuts map h map j diff --git a/.readme.mom b/.readme.mom index 1bc801f..ed09185 100644 --- a/.readme.mom +++ b/.readme.mom @@ -305,7 +305,7 @@ buttons, screen brightness, email, web browsing buttons, etc.) to what you would expect. .HEADING 1 "Bookmarking Files and Directories" .PP -Note the files \f(CW~/.bmdirs\fP and \f(CW~/.bmfiles\fP. +Note the files \f(CW~/.config/bmdirs\fP and \f(CW~/.config/bmfiles\fP. These files hold bookmarked directories and files respectively, along with shortcut keys to their left. LARBS, specfically the \f(CWshortcuts\fP script, will automatically read these files and autogenerate aliases and shortcuts for bash/zsh and ranger from them. .PP @@ -326,11 +326,11 @@ Create a new tab in \f(CW~/Documents\fP \f(CWYd\fP \(en Copy/yank (cp) a copy of the selected file(s) to \f(CWDocuments\fP .LIST OFF -Shortcuts like these are generated for all key sequence/directory pairs in \f(CW~/.bmdirs\fP. -Additionally, you may also add editable files to \f(CW~/.bmfiles\fP. +Shortcuts like these are generated for all key sequence/directory pairs in \f(CW~/.config/bmdirs\fP. +Additionally, you may also add editable files to \f(CW~/.config/bmfiles\fP. Each key sequence you pair with a file will become an alias to edit it in either bash or ranger. .PP -Whenever you edit and save one of the bookmark files, vim will automatically rerun the shortcut script, thus uupdating the shortcuts that will be used in new instances of bash and ranger. +Whenever you edit and save one of the bookmark files, vim will automatically rerun the shortcut script, thus updating the shortcuts that will be used in new instances of bash and ranger. It just werks. Note that it is your responsibility to ensure that none of the bindings you add conflict with another necessary function or command. .HEADING 1 "Frequently Asked Questions (FAQs)" @@ -366,7 +366,7 @@ Install \f(CWneomutt\fP, \f(CWofflineimap\fP and \f(CWmsmtp\fP if you haven't al Create a GPG private/public key pair if you haven't already. Type \f(CWmod+shift+e\fP and you can select a tutorial for how to do this. .ITEM Download the mutt-wizard repository to the mutt config directory: -\f(CWgit clone https://github.com/lukesmithxyz/mutt-wizard ~/.config/mutt\fP +\f(CWgit clone https://github.com/lukesmithxyz/mutt-wizard ~/.config/mutt\fP. \fBREAD THE README.\fP .PP .ITEM diff --git a/.scripts/SCRIPTS.md b/.scripts/SCRIPTS.md index 34bb01b..a99e35e 100644 --- a/.scripts/SCRIPTS.md +++ b/.scripts/SCRIPTS.md @@ -54,7 +54,7 @@ in vim or another program. - `opout` -- "Open output", opens the corresponding `.pdf` file if run on a `.md`, `.tex` or `.rmd` file, or if given an `.html` file, will open it in the browser. Bound to `p` in my vim config to reveal typical output. - `pauseallmpv` -- Pauses all mpv instances by sending the `,` key to each. Used by several scripts, but can be used alone as well. It will not pause an audio only mpv instance. If you know how to add a hack to do this, feel free to PR it or email me an addition. - `remaps` -- Remaps capslock to escape when pressed and super/mod when held. Maps the menu key to super as well. Runs the US international keyboard setup. If you want another keyboard setup, edit this fine. -- `shortcuts` -- For updating bash and ranger shortcuts. Reads `~/.key_directories` and `~/.key_files` for pairs of keypresses and directories and files, then autoproduces bash aliases and ranger shortcuts for them which output to `~/.shortcuts` and `~/.config/ranger/shortcuts.conf` respectively. These are read automatically by my bash and ranger configs. You don't have to run this script manually though, as it's run by vim whenever you edit one of the `~/.key_*` files. +- `shortcuts` -- For updating bash and ranger shortcuts. Reads `~/.config/bmdirs` and `~/.config/bmfiles` for pairs of keypresses and directories and files, then autoproduces bash aliases and ranger shortcuts for them which output to `~/.config/shortcutrc` and `~/.config/ranger/shortcuts.conf` respectively. These are read automatically by my bash and ranger configs. You don't have to run this script manually though, as it's run by vim whenever you edit one of the `~/.bm*` files. - `speedvid` -- Speed up a given video file (`$1`) by a given ammount (`$2`). - `tpb` -- Search Pirate Bay for the certain search terms given as arguments. - `texclear` -- Remove all `.tex` related build files. This is run by my vim when I stop editing any `.tex` file. diff --git a/.scripts/tools/shortcuts b/.scripts/tools/shortcuts index cb4cc6e..3ac0bbd 100755 --- a/.scripts/tools/shortcuts +++ b/.scripts/tools/shortcuts @@ -1,10 +1,10 @@ #!/bin/bash # Output locations. Unactivated progs should go to /dev/null. -shell_shortcuts="$HOME/.shortcuts" +shell_shortcuts="$HOME/.config/shortcutrc" ranger_shortcuts="$HOME/.config/ranger/shortcuts.conf" qute_shortcuts="/dev/null" -fish_shortcuts="$HOME/.config/fish/shortcuts.fish" -vifm_shortcuts="$HOME/.vifmshortcuts" +fish_shortcuts="/dev/null" +vifm_shortcuts="$HOME/.config/vifm/vifmshortcuts" # Remove, prepare files rm -f "$ranger_shortcuts" "$qute_shortcuts" 2>/dev/null @@ -13,14 +13,14 @@ printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts" printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts" # Format the `bmdirs` file in the correct syntax and sent it to all three configs. -sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.bmdirs" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \ +sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmdirs" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \ >(awk '{print "abbr", $1, "\"cd " $2 "; and ls -a\""}' >> "$fish_shortcuts") \ >(awk '{print "map g" $1, ":cd", $2 "\nmap t" $1, ":cd", $2 "\nmap M" $1, ":cd", $2 ":mo\nmap Y" $1, ":cd", $2 ":co" }' >> "$vifm_shortcuts") \ >(awk '{print "config.bind(\";"$1"\", \"set downloads.location.directory "$2" ;; hint links download\")"}' >> "$qute_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/\s*#.*$//;/^\s*$/d" "$HOME/.bmfiles" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \ +sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmfiles" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \ >(awk '{print "abbr", $1, "\"$EDITOR "$2"\""}' >> "$fish_shortcuts") \ >(awk '{print "map", $1, ":e", $2 "" }' >> "$vifm_shortcuts") \ | awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts"