improve bashrc layout and performance
This commit is contained in:
81
.bashrc
81
.bashrc
@@ -7,28 +7,49 @@
|
|||||||
[[ $- != *i* ]] && return
|
[[ $- != *i* ]] && return
|
||||||
[[ -z "${PS1-}" ]] && return
|
[[ -z "${PS1-}" ]] && return
|
||||||
|
|
||||||
# check the window size after each command (and if necessary, the values of LINES and COLUMNS)
|
# set PS1
|
||||||
shopt -s checkwinsize
|
PS1=
|
||||||
|
PS1="$PS1"'\[\033[01;35m\]\u@\h' # user@host
|
||||||
|
PS1="$PS1"'\[\033[00m\]:' # seperator
|
||||||
|
PS1="$PS1"'\[\033[01;34m\]\w' # working directory
|
||||||
|
PS1="$PS1"'\[\033[01;93m\]$(_lazy_git_ps1)' # github branch
|
||||||
|
PS1="$PS1"'\[\033[00m\]\$ ' # shell sign
|
||||||
|
|
||||||
# history settings
|
# history settings
|
||||||
HISTCONTROL=ignoreboth # don't put duplicate lines or lines starting with space in the history.
|
HISTCONTROL=ignoreboth # don't put duplicate lines or lines starting with space in the history.
|
||||||
HISTSIZE=1000
|
HISTSIZE=1000
|
||||||
HISTFILESIZE=2000
|
HISTFILESIZE=2000
|
||||||
|
|
||||||
source /usr/share/bash-completion/completions/git
|
export MANPAGER='nvim +Man!' # use neovim as a manual pager
|
||||||
source /usr/share/git/completion/git-prompt.sh
|
|
||||||
|
|
||||||
PS1=
|
|
||||||
PS1="$PS1"'\[\033[01;35m\]\u@\h' # user@host
|
|
||||||
PS1="$PS1"'\[\033[00m\]:' # seperator
|
|
||||||
PS1="$PS1"'\[\033[01;34m\]\w' # working directory
|
|
||||||
PS1="$PS1"'\[\033[01;93m\]$(__git_ps1)' # github branch
|
|
||||||
PS1="$PS1"'\[\033[00m\]\$ ' # shell sign
|
|
||||||
|
|
||||||
export EDITOR=nvim
|
|
||||||
|
|
||||||
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' # coloured GCC warnings and errors
|
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' # coloured GCC warnings and errors
|
||||||
eval "$(_AUTO_CPUFREQ_COMPLETE=bash_source auto-cpufreq)"
|
export EDITOR=nvim # use neovim as an editor
|
||||||
|
export VISUAL=nvim # use neovim for visual-based editors
|
||||||
|
|
||||||
|
# export Microsoft's bullshit outta here
|
||||||
|
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||||
|
export VCPKG_DISABLE_METRICS=1
|
||||||
|
|
||||||
|
# vcpkg shit
|
||||||
|
export VCPKG_ROOT=$HOME/.local/share/vcpkg
|
||||||
|
export PATH=$VCPKG_ROOT:$PATH
|
||||||
|
source /home/user/.local/share/vcpkg/scripts/vcpkg_completion.bash &>/dev/null
|
||||||
|
|
||||||
|
# check the window size after each command (and if necessary, the values of LINES and COLUMNS)
|
||||||
|
shopt -s checkwinsize
|
||||||
|
|
||||||
|
# wrapper for lazily loading __git_ps1 whenever it is actually needed
|
||||||
|
_lazy_git_ps1() {
|
||||||
|
if [[ -z $__GIT_PROMPT_SOURCED ]]; then
|
||||||
|
if [[ -d .git || $(git rev-parse --is-inside-work-tree 2>/dev/null) == true ]]; then
|
||||||
|
source /usr/share/bash-completion/completions/git &>/dev/null
|
||||||
|
source /usr/share/git/completion/git-prompt.sh &>/dev/null
|
||||||
|
export __GIT_PROMPT_SOURCED=1
|
||||||
|
__git_ps1 "$@"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
__git_ps1 "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# aliases
|
# aliases
|
||||||
@@ -56,34 +77,6 @@ alias mv='mv -i'
|
|||||||
alias :qa='exit'
|
alias :qa='exit'
|
||||||
alias :q='exit'
|
alias :q='exit'
|
||||||
alias py3='python3'
|
alias py3='python3'
|
||||||
alias hgit='git --git-dir=$HOME/.home-conf.git --work-tree=$HOME'
|
|
||||||
|
|
||||||
__git_complete hgit __git_main
|
|
||||||
|
|
||||||
# vcpkg shit
|
|
||||||
export VCPKG_ROOT=$HOME/.local/share/vcpkg
|
|
||||||
export PATH=$VCPKG_ROOT:$PATH
|
|
||||||
source /home/user/.local/share/vcpkg/scripts/vcpkg_completion.bash
|
|
||||||
|
|
||||||
# opt out of Microsoft's telemetry bullshit
|
|
||||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
|
||||||
export VCPKG_DISABLE_METRICS=1
|
|
||||||
|
|
||||||
# customise less
|
|
||||||
# Have less display colours
|
|
||||||
# from: https://wiki.archlinux.org/index.php/Color_output_in_console#man
|
|
||||||
export LESS_TERMCAP_mb=$'\e[1;31m' # begin bold
|
|
||||||
export LESS_TERMCAP_md=$'\e[1;33m' # begin blink
|
|
||||||
export LESS_TERMCAP_so=$'\e[01;44;37m' # begin reverse video
|
|
||||||
export LESS_TERMCAP_us=$'\e[01;37m' # begin underline
|
|
||||||
export LESS_TERMCAP_me=$'\e[0m' # reset bold/blink
|
|
||||||
export LESS_TERMCAP_se=$'\e[0m' # reset reverse video
|
|
||||||
export LESS_TERMCAP_ue=$'\e[0m' # reset underline
|
|
||||||
|
|
||||||
# customise man pager to use the correct parameters
|
|
||||||
export MANPAGER='less -s -M +Gg'
|
|
||||||
|
|
||||||
# cute lil hyfetch :3
|
# cute lil hyfetch :3
|
||||||
if [[ $TERM == "xterm-kitty" ]]; then
|
[[ $TERM == "xterm-kitty" ]] && hyfetch
|
||||||
hyfetch
|
|
||||||
fi
|
|
||||||
|
|||||||
Reference in New Issue
Block a user