Update .zshrc

This commit is contained in:
Thomas Brasdefer 2024-12-20 19:02:20 +01:00
parent 7a3e0b3fba
commit 9d173571d1
Signed by: tombdf
GPG Key ID: A047E76CC4582988

167
dot_zshrc
View File

@ -9,64 +9,64 @@
# #
########################################################################## ##########################################################################
# Zsh and Zinit configuration ---------------------------------------------------------------- {{{ # zsh and zinit configuration ---------------------------------------------------------------- {{{
# If you come from bash you might have to change your $PATH. # if you come from bash you might have to change your $path.
export PATH=$HOME/bin:/usr/local/bin:$HOME/.local/bin/:$HOME/.cargo/bin/:$PATH export path=$home/bin:/usr/local/bin:$home/.local/bin/:$home/.cargo/bin/:$home/.atuin/bin/:$path
# Path to your Zinit installation. # path to your zinit installation.
export ZSH="${XDG_DATE_HOME:-${HOME}/.local/share}/zinit/zinit.git" export zsh="${xdg_date_home:-${home}/.local/share}/zinit/zinit.git"
# Download and install Zinit if it's not already installed # download and install zinit if it's not already installed
if [ ! -d $ZSH ]; then if [ ! -d $zsh ]; then
git clone https://github.com/zdharma-continuum/zinit.git $ZSH git clone https://github.com/zdharma-continuum/zinit.git $zsh
fi fi
source $ZSH/zinit.zsh source $zsh/zinit.zsh
# Theme ---------------------------------------------------------------- {{{ # theme ---------------------------------------------------------------- {{{
# Set the theme to use with Oh My Posh # set the theme to use with oh my posh
eval "$(oh-my-posh init zsh --config $HOME/.config/ohmyposh/prompt.json)" eval "$(oh-my-posh init zsh --config $home/.config/ohmyposh/prompt.json)"
# }}} # }}}
# General options ---------------------------------------------------------------- {{{ # general options ---------------------------------------------------------------- {{{
# Uncomment the following line to use case-sensitive completion. # uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true" # case_sensitive="true"
# Uncomment the following line if pasting URLs and other text is messed up. # uncomment the following line if pasting urls and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true" # disable_magic_functions="true"
# Uncomment the following line to disable auto-setting terminal title. # uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true" # disable_auto_title="true"
# Uncomment the following line to enable command auto-correction. # uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="true" enable_correction="true"
# Uncomment the following line to display red dots whilst waiting for completion. # uncomment the following line to display red dots whilst waiting for completion.
# You can also set it to another string to have that shown instead of the default red dots. # you can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" # e.g. completion_waiting_dots="%f{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) # caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
COMPLETION_WAITING_DOTS="true" completion_waiting_dots="true"
# Uncomment the following line if you want to disable marking untracked files # uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories # under vcs as dirty. this makes repository status check for large repositories
# much, much faster. # much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true" # disable_untracked_files_dirty="true"
# Uncomment the following line if you want to change the command execution time # uncomment the following line if you want to change the command execution time
# stamp shown in the history command output. # stamp shown in the history command output.
# You can set one of the optional three formats: # you can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications, # or set a custom format using the strftime function format specifications,
# see 'man strftime' for details. # see 'man strftime' for details.
HIST_STAMPS="dd.mm.yyyy" hist_stamps="dd.mm.yyyy"
# }}} # }}}
# Plugins and snippets ---------------------------------------------------------------- {{{ # plugins and snippets ---------------------------------------------------------------- {{{
zinit light zsh-users/zsh-syntax-highlighting zinit light zsh-users/zsh-syntax-highlighting
zinit light zsh-users/zsh-autosuggestions zinit light zsh-users/zsh-autosuggestions
@ -75,49 +75,49 @@ zinit ice from'gh-r' as'program'
zinit light sei40kr/fast-alias-tips-bin zinit light sei40kr/fast-alias-tips-bin
zinit light sei40kr/zsh-fast-alias-tips zinit light sei40kr/zsh-fast-alias-tips
zinit snippet OMZP::git zinit snippet omzp::git
zinit snippet OMZP::zoxide zinit snippet omzp::zoxide
# }}} # }}}
# History ---------------------------------------------------------------- {{{ # history ---------------------------------------------------------------- {{{
HISTSIZE=5000 # The number of commands to remember in the command history histsize=5000 # the number of commands to remember in the command history
HISTFILE=~/.zsh_history # The file to save the command history to histfile=~/.zsh_history # the file to save the command history to
SAVEHIST=$HISTSIZE # The number of commands to save in the history file savehist=$histsize # the number of commands to save in the history file
HISTDUP=erase # Erase duplicates in the history file histdup=erase # erase duplicates in the history file
setopt appendhistory # Append history to the history file setopt appendhistory # append history to the history file
setopt sharehistory # Share history between all sessions setopt sharehistory # share history between all sessions
setopt hist_ignore_space # Ignore commands that start with a space setopt hist_ignore_space # ignore commands that start with a space
setopt hist_ignore_dups # Ignore duplicate commands setopt hist_ignore_dups # ignore duplicate commands
setopt hist_ignore_all_dups # Ignore all duplicate commands setopt hist_ignore_all_dups # ignore all duplicate commands
setopt hist_save_no_dups # Do not save duplicate commands setopt hist_save_no_dups # do not save duplicate commands
setopt hist_find_no_dups # Do not display duplicate commands setopt hist_find_no_dups # do not display duplicate commands
# Key bindings # key bindings
bindkey "^p" history-search-backward # Search backward in history bindkey "^p" history-search-backward # search backward in history
bindkey "^n" history-search-forward # Search forward in history bindkey "^n" history-search-forward # search forward in history
# }}} # }}}
# Completion ---------------------------------------------------------------- {{{ # completion ---------------------------------------------------------------- {{{
# Zsh allows command completion. # zsh allows command completion.
# The completion is very modifiable, here are some options # the completion is very modifiable, here are some options
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' zstyle ':completion:*' matcher-list 'm:{a-z}={a-za-z}'
zstyle ':completion:*:descriptions' format '%U%B%d%b%u' zstyle ':completion:*:descriptions' format '%u%b%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no results' zstyle ':completion:*:warnings' format '%bsorry, no results'
zstyle ':completion:*' menu select=2 zstyle ':completion:*' menu select=2
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s zstyle ':completion:*' select-prompt %sscrolling active: current selection at %p%s
zstyle ':completion:*' list-colors '${(s.:.)LS_COLORS}' zstyle ':completion:*' list-colors '${(s.:.)ls_colors}'
# Load bash completion functions # load bash completion functions
autoload -Uz +X compinit && compinit autoload -uz +x compinit && compinit
autoload -Uz +X bashcompinit && bashcompinit autoload -uz +x bashcompinit && bashcompinit
# -q is for quiet; actually run all the `compdef's saved before `compinit` call # -q is for quiet; actually run all the `compdef's saved before `compinit` call
# (`compinit' declares the `compdef' function, so it cannot be used until # (`compinit' declares the `compdef' function, so it cannot be used until
# `compinit' is ran; Zinit solves this via intercepting the `compdef'-calls and # `compinit' is ran; zinit solves this via intercepting the `compdef'-calls and
# storing them for later use with `zinit cdreplay') # storing them for later use with `zinit cdreplay')
zinit cdreplay -q zinit cdreplay -q
@ -125,21 +125,21 @@ zinit cdreplay -q
# }}} # }}}
# User configuration ---------------------------------------------------------------- {{{ # user configuration ---------------------------------------------------------------- {{{
# Preferred editor for local and remote sessions # preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then if [[ -n $ssh_connection ]]; then
export EDITOR='nvim' export editor='nvim'
else else
export EDITOR='vim' export editor='vim'
fi fi
# Set the ssh-agent if it is not already running # set the ssh-agent if it is not already running
if ! pgrep -u "$USER" ssh-agent > /dev/null; then if ! pgrep -u "$user" ssh-agent > /dev/null; then
eval "$(ssh-agent -s)" > /dev/null eval "$(ssh-agent -s)" > /dev/null
fi fi
export SSH_AUTH_SOCK=$(ssh-agent -s | grep -oP '(?<=SSH_AUTH_SOCK=)[^;]+') export ssh_auth_sock=$(ssh-agent -s | grep -op '(?<=ssh_auth_sock=)[^;]+')
# Add the keys to the agent # add the keys to the agent
if [ -f ~/.ssh/id_ed25519 ] && ! ssh-add -l | grep -q id_ed25519; then if [ -f ~/.ssh/id_ed25519 ] && ! ssh-add -l | grep -q id_ed25519; then
ssh-add ~/.ssh/id_ed25519 > /dev/null 2>&1 ssh-add ~/.ssh/id_ed25519 > /dev/null 2>&1
fi fi
@ -147,32 +147,35 @@ if [ -f ~/.ssh/hexasec ] && ! ssh-add -l | grep -q hexasec; then
ssh-add ~/.ssh/hexasec > /dev/null 2>&1 ssh-add ~/.ssh/hexasec > /dev/null 2>&1
fi fi
# Compilation flags # compilation flags
# export ARCHFLAGS="-arch x86_64" # export archflags="-arch x86_64"
# Aliases ---------------------------------------------------------------- {{{ # aliases ---------------------------------------------------------------- {{{
# Set personal aliases # set personal aliases
# For a full list of active aliases, run `alias`. # for a full list of active aliases, run `alias`.
alias ls='lsd' alias ls='lsd'
alias ll='ls -alF' alias ll='ls -alf'
alias rm='rip' alias rm='rip'
alias cat='bat' alias cat='bat'
alias grep='rg' alias grep='rg'
alias find='fd -H' alias find='fd -h'
alias sed='sd' alias sed='sd'
alias c='clear' alias c='clear'
alias prolog='~/.config/scryer-prolog/target/release/scryer-prolog' # À remplacer par prolog='scryer-prolog' alias prolog='~/.config/scryer-prolog/target/release/scryer-prolog' # à remplacer par prolog='scryer-prolog'
alias csc='sudo cytech-site-change' alias csc='sudo cytech-site-change'
alias quit='exit' alias quit='exit'
alias compresse='echo "tar -cv [nomDuFichieràCompresser] -f [nomArchive].tar"' alias compresse='echo "tar -cv [nomdufichieràcompresser] -f [nomarchive].tar"'
alias maj='~/./miseajour.sh' alias maj='~/./miseajour.sh'
alias vi='\vim' alias vi=$(which vim)
alias vim='nvim' alias vim='nvim'
# }}} # }}}
# Allow zoxide to work and to replace cd # allow zoxide to work and to replace cd
eval "$(zoxide init --cmd cd zsh)" eval "$(zoxide init --cmd cd zsh)"
# initialize atuin
eval "$(atuin init zsh)"
# }}} # }}}