re-locate some files to clean up the home directory

try to follow the XDG base directory standard
This commit is contained in:
Mohammad Rasim 2019-02-07 20:51:54 +03:00
parent 10aab85f8e
commit d2808d1c5a
No known key found for this signature in database
GPG Key ID: 4AFC78A385397206
17 changed files with 25 additions and 25 deletions

View File

@ -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/larbs/shortcuts" ] && source "$HOME/.config/larbs/shortcuts" # Load shortcut aliases
[ -f "$HOME/.config/larbs/aliasrc" ] && source "$HOME/.config/larbs/aliasrc"

View File

@ -280,7 +280,7 @@ for_window [title="mpvfloat"] border pixel 0
no_focus [title="mpvfloat"]
# #---Function Buttons---# #
bindsym $mod+F1 exec --no-startup-id groff -kejpt -mom ~/.readme.mom -Tpdf | zathura -
bindsym $mod+F1 exec --no-startup-id groff -kejpt -mom ~/.local/share/larbs/readme.mom -Tpdf | zathura -
bindsym $mod+F2 restart
bindsym $mod+F3 exec --no-startup-id displayselect
bindsym $mod+F4 exec --no-startup-id prompt "Hibernate computer?" "$hibernate"

View File

@ -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/larbs/shortcuts" \
upc="sudo pacman -Syu; pkill -RTMIN+8 i3blocks" \
lsp="pacman -Qett --color=always | less"

View File

@ -1,7 +1,7 @@
bf ~/.bmfiles
bd ~/.bmdirs
bf ~/.config/larbs/bmfiles
bd ~/.config/larbs/bmdirs
cfb ~/.bashrc
cfa ~/.aliasrc
cfa ~/.config/larbs/aliasrc
cfz ~/.zshrc
cfv ~/.config/nvim/init.vim
cfr ~/.config/ranger/rc.conf

View File

@ -92,7 +92,7 @@ set clipboard=unnamedplus
autocmd BufWritePre * %s/\s\+$//e
" When shortcut files are updated, renew bash and ranger configs with new material:
autocmd BufWritePost ~/.bmdirs,~/.bmfiles !shortcuts
autocmd BufWritePost ~/.config/larbs/bmdirs,~/.config/larbs/bmfiles !shortcuts
" Run xrdb whenever Xdefaults or Xresources are updated.
autocmd BufWritePost ~/.Xresources,~/.Xdefaults !xrdb %

View File

@ -33,7 +33,7 @@ These "verbs" take "nouns" or "arguments," like these:
+ d -- "~/Documents"
+ D -- "~/Downloads"
+ cf -- "~/.config"
+ And many others, including those you add to `~/.bmdirs`.
+ And many others, including those you add to `~/.config/larbs/bmdirs`.
Press any "verb" followed by any "argument" to perform a folder operation. "gd" will cd to ~/Documents, for example. "mD" will move the selected file(s) to ~/Downloads. "tcf" will create a new tab in ~/.config, etc. etc.

View File

@ -4,12 +4,12 @@ do
case "$1" in
"w") setbg "$file" & ;;
"c")
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.bmdirs | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.config/larbs/bmdirs | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && exit
cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." &
;;
"m")
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.bmdirs | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.config/larbs/bmdirs | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && exit
mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." &
;;

View File

@ -1,5 +1,5 @@
" vim: filetype=vim
source ~/.vifmshortcuts
source ~/.config/larbs/vifmshortcuts
map <C-h> <C-w>h
map <C-j> <C-w>j

View File

@ -306,7 +306,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/larbs/bmdirs\fP and \f(CW~/.config/larbs/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
@ -327,8 +327,8 @@ 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/larbs/bmdirs\fP.
Additionally, you may also add editable files to \f(CW~/.config/larbs/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.

View File

@ -23,7 +23,7 @@ export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
export LESS_TERMCAP_ue=$'\E[0m' # reset underline
[ ! -f ~/.shortcuts ] && shortcuts >/dev/null 2>&1
[ ! -f ~/.config/larbs/shortcuts ] && shortcuts >/dev/null 2>&1
echo "$0" | grep "bash$" >/dev/null && [ -f ~/.bashrc ] && source "$HOME/.bashrc"

View File

@ -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 `<leader>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 `~/.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 `~/.config/larbs/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.
- `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.

View File

@ -5,7 +5,7 @@
# Must have xclip installed to even show menu.
xclip -h >/dev/null || exit
chosen=$(grep -v "#" ~/.emoji | dmenu -i -l 20 -fn Monospace-18)
chosen=$(grep -v "#" $HOME/.local/share/larbs/emoji | dmenu -i -l 20 -fn Monospace-18)
[ "$chosen" != "" ] || exit

View File

@ -1,7 +1,7 @@
#!/bin/sh
case $BLOCK_BUTTON in
1) groff -mom ~/.readme.mom -Tpdf | zathura - ;;
1) groff -mom ~/.local/share/larbs/readme.mom -Tpdf | zathura - ;;
3) pgrep -x dunst >/dev/null && notify-send "<b>❓ Help module:</b>
- Left click to open LARBS guide.";;
esac

View File

@ -1,10 +1,10 @@
#!/bin/bash
# Output locations. Unactivated progs should go to /dev/null.
shell_shortcuts="$HOME/.shortcuts"
shell_shortcuts="$HOME/.config/larbs/shortcuts"
ranger_shortcuts="$HOME/.config/ranger/shortcuts.conf"
qute_shortcuts="/dev/null"
fish_shortcuts="$HOME/.config/fish/shortcuts.fish"
vifm_shortcuts="$HOME/.vifmshortcuts"
vifm_shortcuts="$HOME/.config/larbs/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/larbs/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 "<CR>\nmap t" $1, "<tab>:cd", $2 "<CR><tab>\nmap M" $1, "<tab>:cd", $2 "<CR><tab>:mo<CR>\nmap Y" $1, "<tab>:cd", $2 "<CR><tab>:co<CR>" }' >> "$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/larbs/bmfiles" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \
>(awk '{print "abbr", $1, "\"$EDITOR "$2"\""}' >> "$fish_shortcuts") \
>(awk '{print "map", $1, ":e", $2 "<CR>" }' >> "$vifm_shortcuts") \
| awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts"

View File

@ -30,8 +30,8 @@ The command `getkeys` will also show basic key binds for different programs.
## Dynamic Configuration Files
Store your favorite or high-traffic directories in `~/.bmdirs` or your most
important config files in `~/.bmfiles` with keyboard shortcuts. When you add
Store your favorite or high-traffic directories in `~/.config/larbs/bmdirs` or your most
important config files in `~/.config/larbs/bmfiles` with keyboard shortcuts. When you add
things to theses files my vimrc will automatically run `shortcuts` which will
dynamically generate shortcuts for these in bash, ranger and optionally
qutebrowser and fish.