Update bashrc to moduler
This commit is contained in:
parent
3981663c7c
commit
4bacf7f45e
9 changed files with 122 additions and 70 deletions
96
.bashrc
96
.bashrc
|
@ -8,35 +8,6 @@ case $- in
|
|||
*) return;;
|
||||
esac
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
#shopt -s globstar
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
if [ ! -f /etc/gentoo-release ]; then
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
fi
|
||||
|
||||
# set variable identifying the chroot you work in (used in the prompt below)
|
||||
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
fi
|
||||
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color|*-256color) color_prompt=yes;;
|
||||
|
@ -59,45 +30,21 @@ if [ -n "$force_color_prompt" ]; then
|
|||
fi
|
||||
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
|
||||
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
|
||||
else
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
PS1='\u@\h:\w\$ '
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||
PS1="\[\e]0;\u@\h: \w\a\]$PS1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# colored GCC warnings and errors
|
||||
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# some more ls aliases
|
||||
alias ll='ls -alF'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
|
||||
# Add an "alert" alias for long running commands. Use like so:
|
||||
# sleep 10; alert
|
||||
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
|
@ -110,6 +57,14 @@ test -r ~/.shell-env && . ~/.shell-env
|
|||
test -r ~/.shell-aliases && . ~/.shell-aliases
|
||||
test -r ~/.shell-common && . ~/.shell-common
|
||||
|
||||
# User specific environment
|
||||
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]; then
|
||||
export PATH="$HOME/.local/bin:$HOME/bin:$PATH"
|
||||
fi
|
||||
|
||||
# Uncomment the following line if you don't like systemctl's auto-paging feature:
|
||||
# export SYSTEMD_PAGER=
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
|
@ -121,22 +76,23 @@ if ! shopt -oq posix; then
|
|||
fi
|
||||
fi
|
||||
|
||||
test -r ~/.bashrc_local && ~/.bashrc.local
|
||||
|
||||
|
||||
eval "$(direnv hook bash)"
|
||||
eval "$(starship init bash)"
|
||||
|
||||
if [[ -d "$HOME/.tmuxifier/bin" ]]; then
|
||||
export PATH="$PATH:$HOME/.tmuxifier/bin"
|
||||
eval "$(tmuxifier init -)"
|
||||
elif [[ -d "$HOME/.tmux/plugins/tmuxifier/bin" ]]; then
|
||||
export PATH="$PATH:$HOME/.tmux/plugins/tmuxifier/bin"
|
||||
eval "$(tmuxifier init -)"
|
||||
# Source global definitions
|
||||
if [ -f /etc/bashrc ]; then
|
||||
. /etc/bashrc
|
||||
fi
|
||||
|
||||
alias protontricks='flatpak run com.github.Matoking.protontricks'
|
||||
alias protontricks-launch='flatpak run --command=protontricks-launch com.github.Matoking.protontricks'
|
||||
# User specific aliases and functions
|
||||
if [ -d ~/.bashrc.d ]; then
|
||||
for rc in ~/.bashrc.d/*; do
|
||||
if [ -f "$rc" ]; then
|
||||
. "$rc"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
unset rc
|
||||
|
||||
test -r ~/.bashrc_local && ~/.bashrc.local
|
||||
|
||||
|
||||
if [[ -n "$KONSOLE_VERSION" ]]; then
|
||||
if [[ "$KONSOLE_DBUS_SESSION" == "/Sessions/1" ]]; then
|
||||
|
|
2
.bashrc.d/archlinux
Normal file
2
.bashrc.d/archlinux
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Pacman Aliases
|
||||
#alias pkgq="pacman -Qq | fzf --preview 'pacman -Qil {}' --layout=reverse --bind 'enter:execute(pacman -Qil {} | less)'"
|
15
.bashrc.d/colors
Normal file
15
.bashrc.d/colors
Normal file
|
@ -0,0 +1,15 @@
|
|||
# enable color support of ls and also add handy aliases
|
||||
if [[ -x /usr/bin/dircolors ]]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
#alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# colored GCC warnings and errors
|
||||
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
31
.bashrc.d/commands
Normal file
31
.bashrc.d/commands
Normal file
|
@ -0,0 +1,31 @@
|
|||
# vim: set ft=sh sw=2 et :
|
||||
alias dos2unix='sed "s/%//"'
|
||||
|
||||
alias tmux='tmux -2'
|
||||
|
||||
if command -v tmuxinator >/dev/null 2>&1; then
|
||||
alias mux='tmuxinator'
|
||||
fi
|
||||
|
||||
alias ls='ls --color=auto'
|
||||
alias ll='\ls -l'
|
||||
alias lla='\ls -la'
|
||||
alias lt='\ls --color=auto -lhFart'
|
||||
if command -v lsd >/dev/null 2>&1; then
|
||||
alias ls='lsd'
|
||||
alias ll='lsd -l'
|
||||
alias lla='lsd -la'
|
||||
fi
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
|
||||
if [[ -n "$TMUX" ]]; then
|
||||
alias fzf='fzf-tmux'
|
||||
fi
|
||||
|
||||
# Add an "alert" alias for long running commands. Use like so:
|
||||
# sleep 10; alert
|
||||
if [[ "$OSTYPE" == "linux-gnu" ]]; then
|
||||
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
||||
fi
|
||||
|
8
.bashrc.d/editor
Normal file
8
.bashrc.d/editor
Normal file
|
@ -0,0 +1,8 @@
|
|||
if command -v vim >/dev/null 2>&1; then
|
||||
alias vi=vim
|
||||
fi
|
||||
if command -v nvim >/dev/null 2>&1; then
|
||||
alias vim=nvim
|
||||
alias vi=nvim
|
||||
fi
|
||||
|
11
.bashrc.d/history
Normal file
11
.bashrc.d/history
Normal file
|
@ -0,0 +1,11 @@
|
|||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
|
5
.bashrc.d/protontricks
Normal file
5
.bashrc.d/protontricks
Normal file
|
@ -0,0 +1,5 @@
|
|||
if [[ "$OSTYPE" == "linux-gnu" ]]; then
|
||||
alias protontricks='flatpak run com.github.Matoking.protontricks'
|
||||
alias protontricks-launch='flatpak run --command=protontricks-launch com.github.Matoking.protontricks'
|
||||
fi
|
||||
|
8
.bashrc.d/tuning
Normal file
8
.bashrc.d/tuning
Normal file
|
@ -0,0 +1,8 @@
|
|||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
#shopt -s globstar
|
||||
|
16
.bashrc.d/zzextensions
Normal file
16
.bashrc.d/zzextensions
Normal file
|
@ -0,0 +1,16 @@
|
|||
if command -v direnv >/dev/null 2>&1; then
|
||||
eval "$(direnv hook bash)"
|
||||
fi
|
||||
|
||||
if command -v starship >/dev/null 2>&1; then
|
||||
eval "$(starship init bash)"
|
||||
fi
|
||||
|
||||
if [[ -d "$HOME/.tmuxifier/bin" ]]; then
|
||||
export PATH="$PATH:$HOME/.tmuxifier/bin"
|
||||
eval "$(tmuxifier init -)"
|
||||
elif [[ -d "$HOME/.tmux/plugins/tmuxifier/bin" ]]; then
|
||||
export PATH="$PATH:$HOME/.tmux/plugins/tmuxifier/bin"
|
||||
eval "$(tmuxifier init -)"
|
||||
fi
|
||||
|
Loading…
Reference in a new issue