182 lines
6.8 KiB
Plaintext
182 lines
6.8 KiB
Plaintext
##########################################################################
|
|
#
|
|
# ███████╗███████╗██╗ ██╗██████╗ ██████╗
|
|
# ╚══███╔╝██╔════╝██║ ██║██╔══██╗██╔════╝
|
|
# ███╔╝ ███████╗███████║██████╔╝██║
|
|
# ███╔╝ ╚════██║██╔══██║██╔══██╗██║
|
|
# ███████╗███████║██║ ██║██║ ██║╚██████╗
|
|
# ╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝
|
|
#
|
|
##########################################################################
|
|
|
|
# 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/:$home/.atuin/bin/:$path
|
|
|
|
# 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
|
|
fi
|
|
|
|
source $zsh/zinit.zsh
|
|
|
|
# theme ---------------------------------------------------------------- {{{
|
|
|
|
# set the theme to use with oh my posh
|
|
eval "$(oh-my-posh init zsh --config $home/.config/ohmyposh/prompt.json)"
|
|
|
|
# }}}
|
|
|
|
# general options ---------------------------------------------------------------- {{{
|
|
|
|
# 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 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 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
|
|
# much, much faster.
|
|
# disable_untracked_files_dirty="true"
|
|
|
|
# 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:
|
|
# "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"
|
|
|
|
# }}}
|
|
|
|
# plugins and snippets ---------------------------------------------------------------- {{{
|
|
|
|
zinit light zsh-users/zsh-syntax-highlighting
|
|
zinit light zsh-users/zsh-autosuggestions
|
|
zinit light zsh-users/zsh-completions
|
|
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
|
|
|
|
# }}}
|
|
|
|
# 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
|
|
|
|
# key bindings
|
|
bindkey "^p" history-search-backward # search backward in history
|
|
bindkey "^n" history-search-forward # search forward in history
|
|
|
|
# }}}
|
|
|
|
# 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'
|
|
zstyle ':completion:*' menu select=2
|
|
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
|
|
|
|
# -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
|
|
# storing them for later use with `zinit cdreplay')
|
|
zinit cdreplay -q
|
|
|
|
# }}}
|
|
|
|
# }}}
|
|
|
|
# user 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
|
|
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
|
|
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"
|
|
|
|
# aliases ---------------------------------------------------------------- {{{
|
|
|
|
# set personal aliases
|
|
# for a full list of active aliases, run `alias`.
|
|
alias ls='lsd'
|
|
alias ll='ls -alf'
|
|
alias rm='rip'
|
|
alias cat='bat'
|
|
alias grep='rg'
|
|
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 csc='sudo cytech-site-change'
|
|
alias quit='exit'
|
|
alias compresse='echo "tar -cv [nomdufichieràcompresser] -f [nomarchive].tar"'
|
|
alias maj='~/./miseajour.sh'
|
|
alias vi=$(which vim)
|
|
alias vim='nvim'
|
|
|
|
# }}}
|
|
|
|
# allow zoxide to work and to replace cd
|
|
eval "$(zoxide init --cmd cd zsh)"
|
|
|
|
# initialize atuin
|
|
eval "$(atuin init zsh)"
|
|
|
|
# }}}
|