Move everything possible into XDG directories
With the help of xdg-ninja (https://github.com/b3nj5m1n/xdg-ninja) we move all kinds of config/cache files into the XDG directories
This commit is contained in:
parent
7ceed45a28
commit
13b8724696
27 changed files with 131 additions and 42 deletions
1622
.config/zsh/.p10k.zsh
Normal file
1622
.config/zsh/.p10k.zsh
Normal file
File diff suppressed because it is too large
Load diff
3
.config/zsh/.zlogout
Normal file
3
.config/zsh/.zlogout
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Executed by zsh when a login shell exits
|
||||
|
||||
source "$HOME/.config/shell/logout.sh"
|
||||
5
.config/zsh/.zprofile
Normal file
5
.config/zsh/.zprofile
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Executed by zsh when a login shell starts
|
||||
|
||||
# Unify ~/.profile and ~/.zprofile conceptually
|
||||
# (~/.zlogin is skipped here as it is sourced after ~/.zshrc)
|
||||
source "$HOME/.profile"
|
||||
40
.config/zsh/.zshenv
Normal file
40
.config/zsh/.zshenv
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# This file is sourced by zsh before ~/.zprofile and ~/.zshrc
|
||||
# (it's kind of a zsh-only ~/.profile file)
|
||||
|
||||
|
||||
export XDG_CONFIG_HOME="$HOME/.config"
|
||||
export XDG_DATA_HOME="$HOME/.local/share"
|
||||
|
||||
|
||||
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
|
||||
export ZSH="$XDG_DATA_HOME/oh-my-zsh"
|
||||
export ZPLUG_HOME="$XDG_DATA_HOME/zplug"
|
||||
export _Z_DATA="$XDG_DATA_HOME/z"
|
||||
|
||||
|
||||
# Use <Up> key to auto-complete a partially typed command
|
||||
# TODO: the coloring does not work when zsh-syntax-highlighting is loaded simultaniously
|
||||
# Source: https://github.com/zsh-users/zsh-history-substring-search/issues/131
|
||||
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="fg=#ffffff,bg=#38761d,bold"
|
||||
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND="fg=#ffffff,bg=#990000,bold"
|
||||
|
||||
|
||||
# Notify about shorter aliases for typed commands
|
||||
# Source: https://github.com/MichaelAquilina/zsh-you-should-use
|
||||
export YSU_MESSAGE_POSITION="before"
|
||||
export YSU_MODE="BESTMATCH"
|
||||
|
||||
|
||||
# Suggest commands as one types
|
||||
# Source: https://github.com/zsh-users/zsh-autosuggestions
|
||||
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#666666,bg=bold"
|
||||
export ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
||||
|
||||
|
||||
# Temporary files should go into ~/.cache
|
||||
export ZSH_COMPDUMP="${XDG_CACHE_HOME:-$HOME/.cache}/.zcompdump-$HOST-$ZSH_VERSION"
|
||||
|
||||
|
||||
# Automatically source ".env" files in folders
|
||||
# Source: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dotenv
|
||||
export ZSH_DOTENV_FILE=".env"
|
||||
181
.config/zsh/.zshrc
Normal file
181
.config/zsh/.zshrc
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
# Executed by zsh when a (non-)login shell starts
|
||||
|
||||
|
||||
# Ensure zsh is running interactively
|
||||
[[ $- != *i* ]] && return
|
||||
|
||||
|
||||
# Check if a command can be found on the $PATH
|
||||
_command_exists() {
|
||||
command -v "$1" 1>/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Enable Powerlevel10k instant prompt
|
||||
if [ -r "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/p10k-instant-prompt-${(%):-%n}.zsh" ]; then
|
||||
source "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/p10k-instant-prompt-${(%):-%n}.zsh"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Enable XON/XOFF software flow control
|
||||
stty -ixon
|
||||
|
||||
# Enable colors and change prompt
|
||||
autoload -Uz colors
|
||||
colors
|
||||
|
||||
# Enable VI mode
|
||||
bindkey -v
|
||||
|
||||
# If an entered command does not exist per se
|
||||
# but is the name of a folder instead, go there
|
||||
setopt AUTO_CD
|
||||
|
||||
# Treat "#", "~", and "^" as part of patterns for filename generation
|
||||
setopt EXTENDED_GLOB
|
||||
# Warn if there are no matches
|
||||
setopt NO_MATCH
|
||||
|
||||
# Silence the shell
|
||||
setopt NO_BEEP
|
||||
|
||||
# Report status of background jobs immediately
|
||||
setopt NOTIFY
|
||||
|
||||
# Remove all "built-in" aliases
|
||||
unalias -a
|
||||
|
||||
|
||||
|
||||
# Set these environment variables here (and not in ~/.profile)
|
||||
# due to conflict/overlap with bash
|
||||
|
||||
# Note: This file is NOT synced by mackup as zsh destroys the symbolic link
|
||||
export HISTFILE="$XDG_STATE_HOME/zsh/history"
|
||||
|
||||
export HISTSIZE=999999 # number of lines kept in memory
|
||||
export SAVEHIST=999999 # number of lines kept in $HISTFILE
|
||||
|
||||
# Append to the $HISTFILE rather than overwrite it
|
||||
setopt APPEND_HISTORY
|
||||
setopt INC_APPEND_HISTORY
|
||||
|
||||
|
||||
|
||||
# Initialize oh-my-zsh's plugins
|
||||
|
||||
plugins=(
|
||||
command-not-found
|
||||
dirhistory
|
||||
dotenv # config in ~/.zshenv; `_update_repositories` temporarily disables this
|
||||
git-escape-magic
|
||||
invoke # completions for invoke
|
||||
jsontools
|
||||
pip # completions for pip
|
||||
poetry # completions for poetry
|
||||
z
|
||||
)
|
||||
|
||||
source "$ZSH/oh-my-zsh.sh"
|
||||
|
||||
|
||||
|
||||
# Initialize zplug's plugins
|
||||
|
||||
source "$XDG_DATA_HOME/zplug/init.zsh" # config in ~/.config/zsh/.zshenv
|
||||
|
||||
# Must use double quotes in this section
|
||||
# Source: https://github.com/zplug/zplug#example
|
||||
|
||||
# Make zplug manage itself like a plugin
|
||||
# Source: https://github.com/zplug/zplug#let-zplug-manage-zplug
|
||||
zplug "zplug/zplug", hook-build:"zplug --self-manage"
|
||||
|
||||
zplug "MichaelAquilina/zsh-you-should-use" # config in ~/.zshenv
|
||||
|
||||
zplug "zsh-users/zsh-autosuggestions" # config in ~/.zshenv
|
||||
zplug "zsh-users/zsh-history-substring-search" # config in ~/.zshenv; there are key bindings below
|
||||
zplug "zsh-users/zsh-syntax-highlighting"
|
||||
|
||||
zplug "romkatv/powerlevel10k", as:theme, depth:1
|
||||
|
||||
zplug load
|
||||
|
||||
|
||||
|
||||
# Initialize various utilities and aliases
|
||||
source "$HOME/.config/shell/init.sh"
|
||||
|
||||
|
||||
|
||||
# Initialize zsh's completions
|
||||
|
||||
# This is already done via ~/.oh-my-zsh.sh above
|
||||
# autoload -Uz compinit
|
||||
# compinit -u -d "$ZSH_COMPDUMP"
|
||||
|
||||
# Enable match highlighting and scrolling through long lists,
|
||||
# and provide a different style of menu completion
|
||||
zmodload zsh/complist
|
||||
|
||||
# Include hidden files in tab completion
|
||||
_comp_options+=(GLOB_DOTS)
|
||||
|
||||
# Enable arrow-key driven interface
|
||||
zstyle ':completion:*' menu select
|
||||
|
||||
# Make compinit find new executables right away
|
||||
zstyle ':completion:*' rehash true
|
||||
|
||||
# Enable grouping and group headers
|
||||
zstyle ':completion:*:descriptions' format '%B%d%b'
|
||||
zstyle ':completion:*:messages' format '%d'
|
||||
zstyle ':completion:*:warnings' format 'No matches for: %d'
|
||||
zstyle ':completion:*' group-name ''
|
||||
|
||||
|
||||
# Enable completions for various tools
|
||||
|
||||
# invoke -> see plugins above; alternatively use
|
||||
# _command_exists invoke && eval "$(invoke --print-completion-script=zsh)"
|
||||
|
||||
_command_exists nox && eval "$(register-python-argcomplete nox)"
|
||||
|
||||
# pip -> see plugins above; alternatively use
|
||||
# _command_exists pip && eval "$(pip completion --zsh)"
|
||||
|
||||
_command_exists pipx && eval "$(register-python-argcomplete pipx)"
|
||||
|
||||
# poetry -> see plugins above; no alternative here
|
||||
|
||||
|
||||
|
||||
# Define key bindings
|
||||
|
||||
# zsh-autosuggestions plugin
|
||||
bindkey "^ " autosuggest-accept
|
||||
|
||||
# Enable Ctrl-R
|
||||
bindkey "^R" history-incremental-search-backward
|
||||
|
||||
# Use VI keys to navigate the completions in the menu
|
||||
bindkey -M menuselect 'h' vi-backward-char
|
||||
bindkey -M menuselect 'k' vi-up-line-or-history
|
||||
bindkey -M menuselect 'l' vi-forward-char
|
||||
bindkey -M menuselect 'j' vi-down-line-or-history
|
||||
|
||||
# history-substring-search plugin
|
||||
# Source: https://github.com/zsh-users/zsh-history-substring-search#usage
|
||||
# Normal mode
|
||||
bindkey "$terminfo[kcuu1]" history-substring-search-up
|
||||
bindkey "$terminfo[kcud1]" history-substring-search-down
|
||||
# VI mode
|
||||
bindkey -M vicmd 'k' history-substring-search-up
|
||||
bindkey -M vicmd 'j' history-substring-search-down
|
||||
|
||||
|
||||
|
||||
# Enable Powerlevel10k "full" prompt
|
||||
[[ ! -f $XDG_CONFIG_HOME/zsh/.p10k.zsh ]] || source $XDG_CONFIG_HOME/zsh/.p10k.zsh
|
||||
Loading…
Add table
Add a link
Reference in a new issue