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.
export PATH=$HOME/bin:/usr/local/bin:$HOME/.local/bin/:$HOME/.cargo/bin/:$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/:$home/.atuin/bin/:$path
# Path to your Zinit installation.
export ZSH="${XDG_DATE_HOME:-${HOME}/.local/share}/zinit/zinit.git"
# path to your zinit installation.
export zsh="${xdg_date_home:-${home}/.local/share}/zinit/zinit.git"
# Download and install Zinit if it's not already installed
if [ ! -d $ZSH ]; then
git clone https://github.com/zdharma-continuum/zinit.git $ZSH
# download and install zinit if it's not already installed
if [ ! -d $zsh ]; then
git clone https://github.com/zdharma-continuum/zinit.git $zsh
fi
source $ZSH/zinit.zsh
source $zsh/zinit.zsh
# Theme ---------------------------------------------------------------- {{{
# theme ---------------------------------------------------------------- {{{
# Set the theme to use with Oh My Posh
eval "$(oh-my-posh init zsh --config $HOME/.config/ohmyposh/prompt.json)"
# set the theme to use with oh my posh
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.
# CASE_SENSITIVE="true"
# uncomment the following line to use case-sensitive completion.
# case_sensitive="true"
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# uncomment the following line if pasting urls and other text is messed up.
# disable_magic_functions="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# uncomment the following line to disable auto-setting terminal title.
# disable_auto_title="true"
# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="true"
# uncomment the following line to enable command auto-correction.
enable_correction="true"
# 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.
# 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)
COMPLETION_WAITING_DOTS="true"
# 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.
# 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)
completion_waiting_dots="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# uncomment the following line if you want to disable marking untracked files
# under vcs as dirty. this makes repository status check for large repositories
# 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.
# 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"
# or set a custom format using the strftime function format specifications,
# 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-autosuggestions
@ -75,49 +75,49 @@ zinit ice from'gh-r' as'program'
zinit light sei40kr/fast-alias-tips-bin
zinit light sei40kr/zsh-fast-alias-tips
zinit snippet OMZP::git
zinit snippet OMZP::zoxide
zinit snippet omzp::git
zinit snippet omzp::zoxide
# }}}
# History ---------------------------------------------------------------- {{{
# history ---------------------------------------------------------------- {{{
HISTSIZE=5000 # The number of commands to remember in the command history
HISTFILE=~/.zsh_history # The file to save the command history to
SAVEHIST=$HISTSIZE # The number of commands to save in the history file
HISTDUP=erase # Erase duplicates in the history file
setopt appendhistory # Append history to the history file
setopt sharehistory # Share history between all sessions
setopt hist_ignore_space # Ignore commands that start with a space
setopt hist_ignore_dups # Ignore duplicate commands
setopt hist_ignore_all_dups # Ignore all duplicate commands
setopt hist_save_no_dups # Do not save duplicate commands
setopt hist_find_no_dups # Do not display duplicate commands
histsize=5000 # the number of commands to remember in the command history
histfile=~/.zsh_history # the file to save the command history to
savehist=$histsize # the number of commands to save in the history file
histdup=erase # erase duplicates in the history file
setopt appendhistory # append history to the history file
setopt sharehistory # share history between all sessions
setopt hist_ignore_space # ignore commands that start with a space
setopt hist_ignore_dups # ignore duplicate commands
setopt hist_ignore_all_dups # ignore all duplicate commands
setopt hist_save_no_dups # do not save duplicate commands
setopt hist_find_no_dups # do not display duplicate commands
# Key bindings
bindkey "^p" history-search-backward # Search backward in history
bindkey "^n" history-search-forward # Search forward in history
# key bindings
bindkey "^p" history-search-backward # search backward in history
bindkey "^n" history-search-forward # search forward in history
# }}}
# Completion ---------------------------------------------------------------- {{{
# completion ---------------------------------------------------------------- {{{
# Zsh allows command completion.
# The completion is very modifiable, here are some options
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no results'
# zsh allows command completion.
# the completion is very modifiable, here are some options
zstyle ':completion:*' matcher-list 'm:{a-z}={a-za-z}'
zstyle ':completion:*:descriptions' format '%u%b%d%b%u'
zstyle ':completion:*:warnings' format '%bsorry, no results'
zstyle ':completion:*' menu select=2
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' list-colors '${(s.:.)LS_COLORS}'
zstyle ':completion:*' select-prompt %sscrolling active: current selection at %p%s
zstyle ':completion:*' list-colors '${(s.:.)ls_colors}'
# Load bash completion functions
autoload -Uz +X compinit && compinit
autoload -Uz +X bashcompinit && bashcompinit
# load bash completion functions
autoload -uz +x compinit && compinit
autoload -uz +x bashcompinit && bashcompinit
# -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' 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')
zinit cdreplay -q
@ -125,21 +125,21 @@ zinit cdreplay -q
# }}}
# User configuration ---------------------------------------------------------------- {{{
# user configuration ---------------------------------------------------------------- {{{
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='nvim'
# preferred editor for local and remote sessions
if [[ -n $ssh_connection ]]; then
export editor='nvim'
else
export EDITOR='vim'
export editor='vim'
fi
# Set the ssh-agent if it is not already running
if ! pgrep -u "$USER" ssh-agent > /dev/null; then
# 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
export SSH_AUTH_SOCK=$(ssh-agent -s | grep -oP '(?<=SSH_AUTH_SOCK=)[^;]+')
# Add the keys to the agent
export ssh_auth_sock=$(ssh-agent -s | grep -op '(?<=ssh_auth_sock=)[^;]+')
# add the keys to the agent
if [ -f ~/.ssh/id_ed25519 ] && ! ssh-add -l | grep -q id_ed25519; then
ssh-add ~/.ssh/id_ed25519 > /dev/null 2>&1
fi
@ -147,32 +147,35 @@ if [ -f ~/.ssh/hexasec ] && ! ssh-add -l | grep -q hexasec; then
ssh-add ~/.ssh/hexasec > /dev/null 2>&1
fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# compilation flags
# export archflags="-arch x86_64"
# Aliases ---------------------------------------------------------------- {{{
# aliases ---------------------------------------------------------------- {{{
# Set personal aliases
# For a full list of active aliases, run `alias`.
# set personal aliases
# for a full list of active aliases, run `alias`.
alias ls='lsd'
alias ll='ls -alF'
alias ll='ls -alf'
alias rm='rip'
alias cat='bat'
alias grep='rg'
alias find='fd -H'
alias find='fd -h'
alias sed='sd'
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 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 vi='\vim'
alias vi=$(which vim)
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)"
# initialize atuin
eval "$(atuin init zsh)"
# }}}