Split off bash completion.
Signed-off-by: Jacob Kiers <jacob@jacobkiers.net>
This commit is contained in:
parent
646138bb6b
commit
fb10240506
14
includes/bash_completion.bash
Normal file
14
includes/bash_completion.bash
Normal file
@ -0,0 +1,14 @@
|
||||
# If possible, add tab completion for many commands
|
||||
[ -f /etc/bash_completion ] && source /etc/bash_completion
|
||||
|
||||
# Bash completion (installed via Homebrew; source after `brew` is added to PATH)
|
||||
command -v brew >/dev/null 2>&1 && [ -r "$(brew --prefix)/etc/bash_completion" ] && source "$(brew --prefix)/etc/bash_completion"
|
||||
|
||||
# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards
|
||||
function _ssh_reload_autocomplete() {
|
||||
[ -e "~/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2)" scp sftp ssh
|
||||
}
|
||||
_ssh_reload_autocomplete
|
||||
|
||||
# Add AWS CLI Completion.
|
||||
complete -C aws_completer aws
|
@ -69,23 +69,11 @@ NOCOLOR="$(tput sgr0)"
|
||||
export EDITOR=`which vim`
|
||||
|
||||
# Load prompt and aliases
|
||||
for file in ~/dotfiles/includes/bash_{prompt,aliases,functions,git}.bash; do
|
||||
for file in ~/dotfiles/includes/bash_{prompt,aliases,functions,git,completion}.bash; do
|
||||
[ -r "$file" ] && source "$file"
|
||||
done
|
||||
unset file
|
||||
|
||||
# If possible, add tab completion for many commands
|
||||
[ -f /etc/bash_completion ] && source /etc/bash_completion
|
||||
|
||||
# Bash completion (installed via Homebrew; source after `brew` is added to PATH)
|
||||
command -v brew >/dev/null 2>&1 && [ -r "$(brew --prefix)/etc/bash_completion" ] && source "$(brew --prefix)/etc/bash_completion"
|
||||
|
||||
# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards
|
||||
function _ssh_reload_autocomplete() {
|
||||
[ -e "~/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2)" scp sftp ssh
|
||||
}
|
||||
_ssh_reload_autocomplete
|
||||
|
||||
# Tell ls to be colourful
|
||||
export CLICOLOR=1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user