commit f2118b605e7c721dfc4623eeacc508a1e88a403c Author: Jeff LANCE Date: Sat Jan 6 20:37:43 2024 +0100 First commit. diff --git a/.chezmoiexternal.toml b/.chezmoiexternal.toml new file mode 100644 index 0000000..f1012f3 --- /dev/null +++ b/.chezmoiexternal.toml @@ -0,0 +1,5 @@ +[".zim/zimfw.sh"] + type = "file" + url = "https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh" + exact = true + refreshPeriod = "168h" diff --git a/dot_zim/modules/alacritty/.keep b/dot_zim/modules/alacritty/.keep new file mode 100644 index 0000000..e69de29 diff --git a/dot_zim/modules/buku/.keep b/dot_zim/modules/buku/.keep new file mode 100644 index 0000000..e69de29 diff --git a/dot_zim/modules/debian/.keep b/dot_zim/modules/debian/.keep new file mode 100644 index 0000000..e69de29 diff --git a/dot_zim/modules/jl-helper/.keep b/dot_zim/modules/jl-helper/.keep new file mode 100644 index 0000000..e69de29 diff --git a/dot_zim/modules/manjaro/.keep b/dot_zim/modules/manjaro/.keep new file mode 100644 index 0000000..e69de29 diff --git a/dot_zim/modules/sudo/.keep b/dot_zim/modules/sudo/.keep new file mode 100644 index 0000000..e69de29 diff --git a/dot_zimrc b/dot_zimrc new file mode 100644 index 0000000..0af8652 --- /dev/null +++ b/dot_zimrc @@ -0,0 +1,68 @@ +# Start configuration added by Zim install {{{ +# ------- +# Modules +# ------- + +# Environment +# +# Sets sane Zsh built-in environment options. +zmodule environment +# Applies correct bindkeys for input events. +zmodule input + +# Completion +# +# Additional completion definitions for Zsh. +zmodule zsh-users/zsh-completions +# Buku completions modules +zmodule buku +# Enables and configures smart and extensive tab completion. +# completion must be sourced after zsh-users/zsh-completions +zmodule completion +# Fish-like autosuggestions for Zsh. +zmodule zsh-users/zsh-autosuggestions + +# Productivity +# +# Provides handy git aliases and functions. +zmodule git +# Sets a custom terminal title. +zmodule termtitle +# Provides archive and unarchive functions for easy archive manipulation. +zmodule archive +# Manjaro aliases and functions. +zmodule manjaro +# Personal aliases +zmodule jl-helper +# sudo module +zmodule sudo +# z module +zmodule https://github.com/rupa/z.git +# zsh-kitty completion +zmodule https://github.com/redxtech/zsh-kitty.git +# Utility aliases and functions. Adds colour to ls, grep and less. +zmodule utility +# exa +zmodule exa +# fzf +zmodule fzf + +# Syntx highlighting +# +# Fish-like syntax highlighting for Zsh. +# zsh-users/zsh-syntax-highlighting must be sourced after completion +zmodule zsh-users/zsh-syntax-highlighting +# Fish-like history search (up arrow) for Zsh. +# zsh-users/zsh-history-substring-search must be sourced after zsh-users/zsh-syntax-highlighting +zmodule zsh-users/zsh-history-substring-search + +# Prompt +# +# Exposes git repository status information to prompts. +zmodule git-info +# A customizable version of steeef's prompt theme. +zmodule steeef +# The minimal, blazing-fast, and infinitely customizable prompt for any shell! +zmodule joke/zim-starship + +# }}} End configuration added by Zim install diff --git a/dot_zlogin b/dot_zlogin new file mode 100644 index 0000000..13d6c5d --- /dev/null +++ b/dot_zlogin @@ -0,0 +1,8 @@ +# Start configuration added by Zim install {{{ +# +# User configuration sourced by login shells +# + +# Initialize Zim +source ${ZIM_HOME}/login_init.zsh -q &! +# }}} End configuration added by Zim install diff --git a/dot_zshenv b/dot_zshenv new file mode 100644 index 0000000..e65772c --- /dev/null +++ b/dot_zshenv @@ -0,0 +1,35 @@ +# Start configuration added by Zim install {{{ +# +# User configuration sourced by all invocations of the shell +# + +# Define Zim location +: ${ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim} +# }}} End configuration added by Zim install + +# >>> define PATH variable as an array +typeset -U path +# <<< define PATH variable as an array + +# >>> set PATH so it includes user's private bin if it exists >>> +path=(~/bin ~/.local/bin $path[@]) +# <<< set PATH so it includes user's private bin if it exists <<< + +# >>> environment variables >>> +export BROWSER=qutebrowser +export EDITOR=$([[ $(command -v lvim) ]] && echo lvim || echo vim) +export TERMINAL=alacritty +# export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!.git/*"' +export GEM_HOME="$(ruby -e 'puts Gem.user_dir')" +export PATH="$PATH:$GEM_HOME/bin" +export MYVIMRC="${HOME}/.vimrc" +export PASSWORD_STORE_DIR="${HOME}/Private/.password-store" +export PASSWORD_STORE_ENABLE_EXTENSIONS=True +export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus +export ZK_NOTEBOOK_DIR="${HOME}/Notes" +export OPENAI_API_KEY="$(pass _api_keys/openai_perso-1)" +export IPINFO_API_KEY="$(pass _api_keys/ipinfo_perso-0)" +# <<< environment variables <<< + +# }}} End personnal configuration directives + diff --git a/dot_zshrc b/dot_zshrc new file mode 100644 index 0000000..a6747c5 --- /dev/null +++ b/dot_zshrc @@ -0,0 +1,238 @@ +# 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 + + + +# +# nvm +# +source /usr/share/nvm/init-nvm.sh + + + +# +# 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 + + + +# +# fuzzy file search +# +# [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh + + + +# +# 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 + + + +# +# 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 + +eval "$(direnv hook zsh)" + + + +# +# starship +eval "$(starship init zsh)" + + + +# +# gnome-keyring-daemon +# +eval $(gnome-keyring-daemon --start) 2>/dev/null +export SSH_AUTH_SOCK + + + +# +# 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 diff --git a/run_onchange_configure-zim.sh b/run_onchange_configure-zim.sh new file mode 100644 index 0000000..a375227 --- /dev/null +++ b/run_onchange_configure-zim.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +ZIMDIR=${HOME}/.zim + +echo "Installing Zim Framework" +$(which zsh) ${ZIMDIR}/zimfw.zsh install + +exit 0 +