59 lines
1.3 KiB
Bash
59 lines
1.3 KiB
Bash
# ~/.bashrc
|
|
|
|
# if not running interactively, don't do anything
|
|
[ -z "$PS1" ] && return
|
|
|
|
# check the window size after each command and, if necessary,
|
|
# update the values of LINES and COLUMNS.
|
|
shopt -s checkwinsize
|
|
|
|
# history
|
|
shopt -s histappend
|
|
PROMPT_COMMAND="history -a"
|
|
|
|
# set the title to user@host:dir
|
|
PS1="\[\e]0;\u@\h:\w\a\]$PS1"
|
|
|
|
# readline
|
|
bind "set editing-mode vi"
|
|
bind "set keyseq-timeout 50"
|
|
bind "set show-mode-in-prompt on"
|
|
bind "set vi-ins-mode-string \1\e[35m\2+\1\e[0m\2"
|
|
bind "set vi-cmd-mode-string :"
|
|
|
|
bind "set keymap vi-command"
|
|
bind "j:history-substring-search-forward"
|
|
bind "k:history-substring-search-backward"
|
|
bind "set keymap vi-insert"
|
|
bind '"\e[A":history-substring-search-backward'
|
|
bind '"\e[B":history-substring-search-forward'
|
|
|
|
bind "set show-all-if-ambiguous on"
|
|
bind "set completion-display-width 0"
|
|
bind "set colored-stats on"
|
|
bind "set visible-stats on"
|
|
|
|
# aliases
|
|
# exit
|
|
alias q="exit"
|
|
alias :q="exit"
|
|
|
|
# grep
|
|
alias grep="grep --color"
|
|
|
|
# ls
|
|
alias ls="ls --color"
|
|
alias ll="ls -AFv1 --group-directories-first"
|
|
|
|
# nvim
|
|
alias :e="nvim"
|
|
|
|
# enable bash completion in interactive shells
|
|
if ! shopt -oq posix; then
|
|
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
|
. /usr/share/bash-completion/bash_completion
|
|
elif [ -f /etc/bash_completion ]; then
|
|
. /etc/bash_completion
|
|
fi
|
|
fi
|