Skip to content

Instantly share code, notes, and snippets.

@caub
Last active March 29, 2024 07:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caub/f1017721a5fd079980ab313f61af261e to your computer and use it in GitHub Desktop.
Save caub/f1017721a5fd079980ab313f61af261e to your computer and use it in GitHub Desktop.
.inputrc
$include /etc/inputrc
# may need export INPUTRC=~/.inputrc note: use ctrl+v to debug readline
# set echo-control-characters off
set show-all-if-ambiguous on
# set history-preserve-point on
"\e[5~": beginning-of-history
"\e[B": history-search-forward
"\e[A": history-search-backward
TAB: menu-complete
# "\t": menu-complete
# "\C-i": menu-complete
"\e[5~": history-search-backward
"\e[6~": history-search-forward
"\e[1;3C": vi-forward-bigword
"\e[1;3D": vi-backward-bigword
"\e[3C": vi-forward-bigword
"\e[3D": vi-backward-bigword
"\C-A": kill-whole-line
$if bash
Space:magic-space
$endif
# preload them
source /usr/share/bash-completion/completions/git
## for `c` alias autocomplete
complete -W '$(git for-each-ref --sort=-committerdate --format="%(refname:short)" refs/heads)' -o bashdefault -o default c
## for `g` git alias (`complete -p git` output)
complete -o bashdefault -o default -o nospace -F __git_wrap__git_main g
set_prompt() {
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWCOLORHINTS=1
GIT_PS1_SHOWUNTRACKEDFILES=1
PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \[\033[01;36m\]$(__git_ps1 '(%s)')$DOCKER_HOST\[\033[00m\]\$ "
history -a
}
PROMPT_COMMAND=set_prompt
set_prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment