- Bash: config file - Zsh: config file - Fish: config file and fish plugins - Nvim: config files - Kitty: config files
160 lines
5.0 KiB
Plaintext
160 lines
5.0 KiB
Plaintext
##########################################################################
|
|
#
|
|
# ██████╗ █████╗ ███████╗██╗ ██╗██████╗ ██████╗
|
|
# ██╔══██╗██╔══██╗██╔════╝██║ ██║██╔══██╗██╔════╝
|
|
# ██████╔╝███████║███████╗███████║██████╔╝██║
|
|
# ██╔══██╗██╔══██║╚════██║██╔══██║██╔══██╗██║
|
|
# ██████╔╝██║ ██║███████║██║ ██║██║ ██║╚██████╗
|
|
# ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝
|
|
#
|
|
##########################################################################
|
|
|
|
# bash configuration ------------------------------------------------------ {{{
|
|
|
|
# if not running interactively, don't do anything
|
|
case $- in
|
|
*i*) ;;
|
|
*) return;;
|
|
esac
|
|
|
|
export path="$home/.atuin/bin:$path"
|
|
|
|
# history ------------------------------------------------------------------ {{{
|
|
|
|
# don't put duplicate lines or lines starting with space in the history.
|
|
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
|
|
|
|
# }}}
|
|
|
|
# general options ---------------------------------------------------------------- {{{
|
|
|
|
# check the window size after each command and, if necessary,
|
|
# update the values of lines and columns.
|
|
shopt -s checkwinsize
|
|
|
|
# make less more friendly for non-text input files
|
|
[ -x /usr/bin/lesspipe ] && eval "$(shell=/bin/sh lesspipe)"
|
|
|
|
# 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"
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
|
|
# 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).
|
|
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
|
|
|
|
# setup custom completions
|
|
mkdir -p "$home/.completions"
|
|
|
|
# check if the command exists and if the completion file does not exist, generate it
|
|
generate_completion() {
|
|
local cmd=$1
|
|
local out_file="$home/.completions/$2"
|
|
local gen_cmd=$3
|
|
|
|
if command -v "$cmd" >/dev/null 2>&1 && [ ! -f "$out_file" ]; then
|
|
eval "$gen_cmd"
|
|
echo "generated completion for $cmd"
|
|
fi
|
|
}
|
|
|
|
generate_completion "atuin" "atuin.bash" "atuin gen-completions --shell bash --out-dir \$home/.completions"
|
|
generate_completion "chezmoi" "chezmoi.bash" "chezmoi completion bash --output=\$home/.completions/chezmoi.bash"
|
|
generate_completion "rip" "rip.bash" "rip completions bash > \$home/.completions/rip.bash"
|
|
|
|
source "$home/.completions/atuin.bash"
|
|
source "$home/.completions/chezmoi.bash"
|
|
source "$home/.completions/rip.bash"
|
|
|
|
# }}}
|
|
|
|
# }}}
|
|
|
|
# user configuration ------------------------------------------------------------------ {{{
|
|
|
|
# aliases ------------------------------------------------------------------ {{{
|
|
|
|
alias ls='lsd'
|
|
alias ll='ls -alf'
|
|
alias rm='rip'
|
|
alias cat='bat'
|
|
alias grep='rg'
|
|
alias find='fd -h'
|
|
alias c='clear'
|
|
alias quit='exit'
|
|
alias vi=$(which vim)
|
|
alias vim='nvim'
|
|
alias csc='sudo cytech-site-change'
|
|
alias compresse='echo "tar -cv [nomdufichieràcompresser] -f [nomarchive].tar"'
|
|
alias cps='cp ~/desktop/programme/script-c/script.sh ./script.sh'
|
|
alias sql='mysql -u thomas -p'
|
|
|
|
# }}}
|
|
|
|
# ssh configuration ---------------------------------------------------------------- {{{
|
|
|
|
# preferred editor for local and remote sessions
|
|
if [[ ! -n $ssh_connection ]]; then
|
|
export editor='nvim'
|
|
else
|
|
export editor='vim'
|
|
fi
|
|
|
|
# set the ssh-agent if it is not already running
|
|
if ! pgrep -u "$user" ssh-agent > /dev/null; then
|
|
eval "$(ssh-agent -s)" > /dev/null
|
|
fi
|
|
|
|
# function to add ssh keys to the agent
|
|
add_ssh_key() {
|
|
local key_path=$1
|
|
local key_name=$(basename "$key_path")
|
|
if [ -f "$key_path" ] && ! ssh-add -l | grep -q "$key_name"; then
|
|
ssh-add "$key_path" > /dev/null 2>&1
|
|
fi
|
|
}
|
|
|
|
# add personal ssh keys
|
|
add_ssh_key ~/.ssh/id_ed25519
|
|
add_ssh_key ~/.ssh/hexasec
|
|
|
|
# }}}
|
|
|
|
# }}}
|
|
|
|
# shell enhancements initialization ---------------------------------------------------------------- {{{
|
|
|
|
# allow zoxide to work and to replace cd
|
|
eval "$(zoxide init --cmd cd bash)"
|
|
|
|
# set the theme to use with oh my posh
|
|
eval "$(oh-my-posh init bash)"
|
|
|
|
# or use starship
|
|
# eval "$(starship init bash)"
|
|
|
|
# initialize atuin
|
|
[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh
|
|
eval "$(atuin init bash --disable-up-arrow)"
|
|
|
|
# }}}
|