Add .e command and completionsrc
This commit is contained in:
		
							parent
							
								
									5c1bfe5b3c
								
							
						
					
					
						commit
						0dbe93759a
					
				
					 5 changed files with 46 additions and 5 deletions
				
			
		
							
								
								
									
										1
									
								
								.bashrc
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								.bashrc
									
										
									
									
									
								
							|  | @ -87,6 +87,7 @@ shopt -s checkwinsize | |||
| 
 | ||||
| 
 | ||||
| source "$HOME/.config/environment" | ||||
| source "$HOME/.config/completionsrc" | ||||
| [ -f "$HOME/.config/aliasrc" ] && source "$HOME/.config/aliasrc" | ||||
| [ -x "$(command -v thefuck)" ] && eval $(thefuck --alias) | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										29
									
								
								.bin/.e
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										29
									
								
								.bin/.e
									
										
									
									
									
										Executable 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 | ||||
|  | @ -1,10 +1,5 @@ | |||
| #!/bin/sh | ||||
| 
 | ||||
| alias .evim='$EDITOR $HOME/.config/vim/vimrc' | ||||
| alias .ebspwm='$EDITOR $HOME/.config/bspwm/bspwmrc' | ||||
| alias .eqb='$EDITOR $HOME/.config/qutebrowser/config.py' | ||||
| alias .esxhkd='$EDITOR $HOME/.config/sxhkd/sxhkdrc' | ||||
| alias .ezsh='$EDITOR $HOME/.config/zsh/.zshrc' | ||||
| alias .f='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME' | ||||
| 
 | ||||
| alias aliases='$EDITOR ~/.config/aliasrc && . ~/.config/aliasrc' | ||||
|  |  | |||
							
								
								
									
										15
									
								
								.config/completionsrc
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								.config/completionsrc
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | |||
| #!/usr/bin/env bash | ||||
| 
 | ||||
| _dote_completions() | ||||
| { | ||||
| 	if [ "${#COMP_WORDS[@]}" != "2" ]; then | ||||
| 		return | ||||
| 	fi | ||||
| 
 | ||||
| 	COMPREPLY=() | ||||
| 	while IFS='' read -r line | ||||
| 	do | ||||
| 		COMPREPLY+=("$line") | ||||
| 	done < <(compgen -W "$(.e -l)" "${COMP_WORDS[1]}") | ||||
| } | ||||
| complete -F _dote_completions ".e" | ||||
|  | @ -95,6 +95,7 @@ source $ZSH/oh-my-zsh.sh | |||
| # User configuration | ||||
| 
 | ||||
| source "$HOME/.config/environment" | ||||
| source "$HOME/.config/completionsrc" | ||||
| [ -f "$HOME/.config/aliasrc" ] && source $HOME/.config/aliasrc | ||||
| [ -x "$(command -v thefuck)" ] && eval $(thefuck --alias) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue