Add .e command and completionsrc

This commit is contained in:
Tobias Reisinger 2022-08-01 15:59:07 +02:00
parent 5c1bfe5b3c
commit 0dbe93759a
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
5 changed files with 46 additions and 5 deletions

29
.bin/.e Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env bash
declare -A mapper=(
["bash"]="$HOME/.bashrc"
["bspwm"]="$HOME/.config/bspwm/bspwmrc"
["qb"]="$HOME/.config/qutebrowser/config.py"
["sxhkd"]="$HOME/.config/sxhkd/sxhkdrc"
["vim"]="$HOME/.config/vim/vimrc"
["zsh"]="$HOME/.config/zsh/.zshrc"
)
if [[ -z "$1" ]]
then
echo "No argument given. Use --list (-l) to show all options."
exit
fi
if [[ "$1" == "-l" ]] || [[ "$1" == "--list" ]]
then
echo "${!mapper[@]}"
exit
fi
target="${mapper["$1"]}"
if [[ -n "$target" ]]
then
$EDITOR "$target"
else
echo "Dotfile not found. Use --list (-l) to show all options."
fi