239 lines
5.2 KiB
Plaintext
239 lines
5.2 KiB
Plaintext
# Start configuration added by Zim install {{{
|
|
#
|
|
# User configuration sourced by interactive shells
|
|
#
|
|
|
|
# -----------------
|
|
# Zsh configuration
|
|
# -----------------
|
|
|
|
#
|
|
# History
|
|
#
|
|
|
|
# Remove older command from the history if a duplicate is to be added.
|
|
setopt HIST_IGNORE_ALL_DUPS
|
|
|
|
#
|
|
# Input/output
|
|
#
|
|
|
|
# Set editor default keymap to emacs (`-e`) or vi (`-v`)
|
|
bindkey -v
|
|
|
|
# Prompt for spelling correction of commands.
|
|
setopt CORRECT
|
|
|
|
# Customize spelling correction prompt.
|
|
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
|
|
|
|
# Remove path separator from WORDCHARS.
|
|
WORDCHARS=${WORDCHARS//[\/]}
|
|
|
|
|
|
# --------------------
|
|
# Module configuration
|
|
# --------------------
|
|
|
|
#
|
|
# completion
|
|
#
|
|
|
|
# Set a custom path for the completion dump file.
|
|
# If none is provided, the default ${ZDOTDIR:-${HOME}}/.zcompdump is used.
|
|
#zstyle ':zim:completion' dumpfile "${ZDOTDIR:-${HOME}}/.zcompdump-${ZSH_VERSION}"
|
|
|
|
#
|
|
# git
|
|
#
|
|
|
|
# Set a custom prefix for the generated aliases. The default prefix is 'G'.
|
|
#zstyle ':zim:git' aliases-prefix 'g'
|
|
|
|
#
|
|
# input
|
|
#
|
|
|
|
# Append `../` to your input for each `.` you type after an initial `..`
|
|
zstyle ':zim:input' double-dot-expand yes
|
|
|
|
#
|
|
# termtitle
|
|
#
|
|
|
|
# Set a custom terminal title format using prompt expansion escape sequences.
|
|
# See http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes
|
|
# If none is provided, the default '%n@%m: %~' is used.
|
|
#zstyle ':zim:termtitle' format '%1~'
|
|
|
|
#
|
|
# zsh-autosuggestions
|
|
#
|
|
|
|
# Customize the style that the suggestions are shown with.
|
|
# See https://github.com/zsh-users/zsh-autosuggestions/blob/master/README.md#suggestion-highlight-style
|
|
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10'
|
|
|
|
#
|
|
# zsh-syntax-highlighting
|
|
#
|
|
|
|
# Set what highlighters will be used.
|
|
# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md
|
|
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
|
|
|
|
# Customize the main highlighter styles.
|
|
# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/main.md#how-to-tweak-it
|
|
#typeset -A ZSH_HIGHLIGHT_STYLES
|
|
#ZSH_HIGHLIGHT_STYLES[comment]='fg=10'
|
|
|
|
# ------------------
|
|
# Initialize modules
|
|
# ------------------
|
|
|
|
if [[ ${ZIM_HOME}/init.zsh -ot ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
|
|
# Update static initialization script if it's outdated, before sourcing it
|
|
source ${ZIM_HOME}/zimfw.zsh init -q
|
|
fi
|
|
source ${ZIM_HOME}/init.zsh
|
|
|
|
# ------------------------------
|
|
# Post-init module configuration
|
|
# ------------------------------
|
|
|
|
#
|
|
# zsh-history-substring-search
|
|
#
|
|
|
|
# Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init
|
|
bindkey '^[[A' history-substring-search-up
|
|
bindkey '^[[B' history-substring-search-down
|
|
|
|
# Bind up and down keys
|
|
zmodload -F zsh/terminfo +p:terminfo
|
|
if [[ -n ${terminfo[kcuu1]} && -n ${terminfo[kcud1]} ]]; then
|
|
bindkey ${terminfo[kcuu1]} history-substring-search-up
|
|
bindkey ${terminfo[kcud1]} history-substring-search-down
|
|
fi
|
|
|
|
bindkey '^P' history-substring-search-up
|
|
bindkey '^N' history-substring-search-down
|
|
bindkey -M vicmd 'k' history-substring-search-up
|
|
bindkey -M vicmd 'j' history-substring-search-down
|
|
# }}} End configuration added by Zim install
|
|
|
|
|
|
|
|
#
|
|
# zoxide
|
|
#
|
|
eval "$(zoxide init --cmd cd zsh)"
|
|
|
|
|
|
|
|
#
|
|
# starship
|
|
#
|
|
eval "$(asdf exec starship init zsh)"
|
|
|
|
|
|
|
|
#
|
|
# atuin
|
|
# eval "$(asdf exec atuin init zsh)"
|
|
|
|
|
|
|
|
#
|
|
# direnv
|
|
#
|
|
setopt PROMPT_SUBST
|
|
|
|
show_virtual_env() {
|
|
if [[ -n "$CONDA_DEFAULT_ENV" && -n "$DIRENV_DIR" ]]; then
|
|
echo "($(basename $CONDA_DEFAULT_ENV))"
|
|
fi
|
|
}
|
|
PS1='$(show_virtual_env)'$PS1
|
|
|
|
|
|
|
|
#
|
|
# tmux
|
|
#
|
|
if [ -z "$TMUX" ]; then
|
|
# we're not in a tmux session
|
|
|
|
if [ ! -z "$SSH_TTY" ]; then
|
|
# We logged in via SSH
|
|
|
|
# if ssh auth variable is missing
|
|
if [ -z "$SSH_AUTH_SOCK" ]; then
|
|
export SSH_AUTH_SOCK="$HOME/.ssh/.auth_socket"
|
|
fi
|
|
|
|
# if socket is available create the new auth session
|
|
if [ ! -S "$SSH_AUTH_SOCK" ]; then
|
|
`ssh-agent -a $SSH_AUTH_SOCK` > /dev/null 2>&1
|
|
echo $SSH_AGENT_PID > $HOME/.ssh/.auth_pid
|
|
fi
|
|
|
|
# if agent isn't defined, recreate it from pid file
|
|
if [ -z $SSH_AGENT_PID ]; then
|
|
export SSH_AGENT_PID=`cat $HOME/.ssh/.auth_pid`
|
|
fi
|
|
|
|
# Add all default keys to ssh auth
|
|
ssh-add 2>/dev/null
|
|
|
|
# start tmux
|
|
tmux attach
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
# ocaml
|
|
#
|
|
test -r /home/jeff/.opam/opam-init/init.zsh && . /home/jeff/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true
|
|
|
|
|
|
|
|
#
|
|
# conda
|
|
#
|
|
# !! Contents within this block are managed by 'conda init' !!
|
|
__conda_setup="$('/home/jeff/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
|
|
if [ $? -eq 0 ]; then
|
|
eval "$__conda_setup"
|
|
else
|
|
if [ -f "/home/jeff/miniconda3/etc/profile.d/conda.sh" ]; then
|
|
. "/home/jeff/miniconda3/etc/profile.d/conda.sh"
|
|
else
|
|
export PATH="/home/jeff/miniconda3/bin:$PATH"
|
|
fi
|
|
fi
|
|
unset __conda_setup
|
|
|
|
|
|
|
|
#
|
|
# gnome-keyring-daemon
|
|
#
|
|
if [[ $(command -v gnome-keyring-daemon) ]]; then
|
|
eval $(gnome-keyring-daemon --start) 2>/dev/null
|
|
export SSH_AUTH_SOCK
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
# passwordstore
|
|
#
|
|
if [[ $(curl -s -w "%{http_code}\n" -L "https://git.jefflance.me/" -o /dev/null) = "200" ]]; then
|
|
echo -ne "\npasswordstore: " && pass git pull
|
|
else
|
|
echo -ne "\npasswordstore: serveur hors ligne"
|
|
fi
|