diff --git a/.gitmodules b/.gitmodules index 4e874c1..dfc4568 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,18 +1,9 @@ -[submodule "root/usr/share/zsh/site-functions/zsh-autosuggestions"] - path = root/usr/share/zsh/site-functions/zsh-autosuggestions - url = https://github.com/zsh-users/zsh-autosuggestions -[submodule "root/usr/share/zsh/site-functions/zsh-syntax-highlighting"] - path = root/usr/share/zsh/site-functions/zsh-syntax-highlighting - url = https://github.com/zsh-users/zsh-syntax-highlighting -; [submodule "root/usr/share/zsh/site-functions/zsh-you-should-use"] -; path = root/usr/share/zsh/site-functions/zsh-you-should-use -; url = https://github.com/MichaelAquilina/zsh-you-should-use -[submodule "root/usr/local/src/z.lua"] - path = root/usr/local/src/z.lua - url = https://github.com/skywind3000/z.lua [submodule "root/usr/local/src/Hyprland"] path = root/usr/local/src/Hyprland url = https://github.com/hyprwm/Hyprland [submodule "root/usr/local/src/eww"] path = root/usr/local/src/eww url = https://github.com/elkowar/eww +[submodule "home/.config/zsh/.zgenom"] + path = home/.config/zsh/.zgenom + url = https://github.com/jandamm/zgenom diff --git a/home/.config/shell/environment b/home/.config/shell/environment index 44212d1..3c0f973 100755 --- a/home/.config/shell/environment +++ b/home/.config/shell/environment @@ -26,6 +26,9 @@ export XDG_RUNTIME_DIR="/run/user/$uid" # Per-Application XDG settings export ZDOTDIR="$XDG_CONFIG_HOME/zsh" +export ZSH_CACHE="$HOME/.cache/zsh" +export HISTFILE="$ZSH_CACHE/history" +export ZSH_COMPDUMP="$ZSH_CACHE/zcompdump-$ZSH_VERSION" export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc" #export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs. export LESSHISTFILE="-" diff --git a/home/.config/zsh/.zgenom b/home/.config/zsh/.zgenom new file mode 160000 index 0000000..86f3681 --- /dev/null +++ b/home/.config/zsh/.zgenom @@ -0,0 +1 @@ +Subproject commit 86f3681d2b151b3c2acbb386890b4984cc5ffd86 diff --git a/home/.config/zsh/.zshrc b/home/.config/zsh/.zshrc index 69742c4..ee86d1a 100755 --- a/home/.config/zsh/.zshrc +++ b/home/.config/zsh/.zshrc @@ -1,6 +1,71 @@ #!/usr/bin/zsh -# ZSH Options +######################### +# Zgenom Plugin Manager # +######################### + +# Load zgenom (plugin manager for ZSH) +source "${ZDOTDIR}/.zgenom/zgenom.zsh" + +# Check for zgenom updates +# This does not increase startup time +zgenom autoupdate + +# If the init script doesn't exist yet +if ! zgenom saved; then + zgenom load zdharma-continuum/fast-syntax-highlighting + zgenom load zsh-users/zsh-autosuggestions + zgenom load skywind3000/z.lua + + # Generate the init script from plugins above + zgenom save +fi + +######################### +# History Configuration # +######################### +export HISTSIZE=12000 +export SAVEHIST=10000 + +# If the internal history needs to be trimmed to add the current command line, setting this +# option will cause the oldest history event that has a duplicate to be lost before losing a +# unique event from the list. You should be sure to set the value of HISTSIZE to a larger +# number than SAVEHIST in order to give you some room for the duplicated events, otherwise +# this option will behave just like HIST_IGNORE_ALL_DUPS once the history fills up with unique +# events. +setopt hist_expire_dups_first + +# When searching for history entries in the line editor, do not display duplicates of a line +# previously found, even if the duplicates are not contiguous. +setopt hist_find_no_dups + +# If a new command line being added to the history list duplicates an older one, the older +# command is removed from the list (even if it is not the previous event). +setopt hist_ignore_all_dups + +# Remove command lines from the history list when the first character on the line is a space, +# or when one of the expanded aliases contains a leading space. Only normal aliases (not +# global or suffix aliases) have this behaviour. Note that the command lingers in the internal +# history until the next command is entered before it vanishes, allowing you to briefly reuse +# or edit the line. If you want to make it vanish right away without entering another command, +# type a space and press return. +setopt hist_ignore_space + +# When writing out the history file, older commands that duplicate newer ones are omitted. +setopt hist_save_no_dups + +# This option works like APPEND_HISTORY except that new history lines are added to the $HISTFILE +# incrementally (as soon as they are entered), rather than waiting until the shell exits. +setopt inc_append_history + +# When using history expansion (such as with sudo !!), on enter, first show the expanded command +# and only run it after confirmation (another enter press) +setopt hist_verify + +############### +# ZSH Options # +############### + setopt auto_cd # cd by typing directory name if it's not a command setopt auto_list # automatically list choices on ambiguous completion setopt auto_menu # automatically use menu completion @@ -10,48 +75,23 @@ setopt magicequalsubst # enable filename expansion for arguments of form `x setopt notify # report the status of background jobs immediately setopt numericglobsort # sort filenames numerically when it makes sense setopt auto_pushd # Make cd act as pushd +setopt globdots # Match files starting with . without specifying it (cd ) #setopt correct_all # autocorrect commands -# oh-my-zsh configuration (DISABLED by default, if you want oh-my-zsh, uncomment these) -#export ZSH="/usr/share/oh-my-zsh" -#ZSH_THEME="af-magic" -#UPDATE_ZSH_DAYS=8 -#ENABLE_CORRECTION="false" -#source $ZSH/oh-my-zsh.sh # Run oh-my-zsh +################## +# Autocompletion # +################## -# ZSH files setup (don't clutter home) -export ZSH_CACHE="$HOME/.cache/zsh" -export HISTFILE="$ZSH_CACHE/history" -export ZSH_COMPDUMP="$ZSH_CACHE/zcompdump-$ZSH_VERSION" -mkdir -p "$ZSH_CACHE" - -# Auto-remove home clutter -[ -f ~/.zsh-update ] && mv ~/.zsh-update $ZSH_CACHE/.zsh-update -[ -f ~/.sudo_as_admin_sucessful ] && rm ~/.sudo_as_admin_successful -[ -f ~/.bash_history ] && rm ~/.bash_history - -# History configuration -export HISTSIZE=10000 -export SAVEHIST=10000 -setopt appendhistory # save history entries as soon as they are entered -setopt hist_ignore_space # ignore commands that start with space -setopt hist_verify # show commands with history expansion to user before running it -setopt extended_history # record command start time -#setopt hist_ignore_dups # ignore duplicated commands history list -#setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTFILE -#setopt share_history # share command history data between terminals - -# Completion features (tab) autoload -Uz compinit zmodload -i zsh/complist # load completion list compinit -d $ZSH_COMPDUMP # Specify compdump file -comp_options+=(globdots) # Enable completion on hidden files. zstyle ':completion:*' menu select # select completions with arrow keys zstyle ':completion:*' group-name '' # group results by category zstyle ':completion:::::' completer _expand _complete _ignored _approximate #enable approximate matches for completion -# Color support -#autoload -U colors && colors +################# +# Custom config # +################# # Setup aliases [ -f ~/.config/shell/aliases ] && source ~/.config/shell/aliases @@ -62,14 +102,29 @@ zstyle ':completion:::::' completer _expand _complete _ignored _approximate #ena # Load prompt [ -f ~/.config/shell/prompt ] && source ~/.config/shell/prompt +##################### +# Automatic Cleanup # +##################### + +[ -f ~/.zsh-update ] && mv ~/.zsh-update $ZSH_CACHE/.zsh-update +[ -f ~/.sudo_as_admin_sucessful ] && rm ~/.sudo_as_admin_successful +[ -f ~/.bash_history ] && rm ~/.bash_history + +# Make sure ZSH_CACHE dir exists, avoiding zsh to create it's cache files +# in $HOME +mkdir -p "$ZSH_CACHE" + +######## +# Misc # +######## + +# Color support +#autoload -U colors && colors + # Define TMOUT timeout for TTY and root # [ -z "$DISPLAY" ] && export TMOUT=800 # [ $UID -eq 0 ] && export TMOUT=600 -# Load extensions (should be last) -source /usr/share/zsh/site-functions/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -source /usr/share/zsh/site-functions/zsh-autosuggestions/zsh-autosuggestions.zsh -source /usr/local/src/z.lua/z.lua.plugin.zsh if command -v pyenv >/dev/null 2>&1; then eval "$(pyenv init -)" fi diff --git a/root/usr/share/zsh/site-functions/zsh-autosuggestions b/root/usr/share/zsh/site-functions/zsh-autosuggestions deleted file mode 160000 index a411ef3..0000000 --- a/root/usr/share/zsh/site-functions/zsh-autosuggestions +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a411ef3e0992d4839f0732ebeb9823024afaaaa8 diff --git a/root/usr/share/zsh/site-functions/zsh-syntax-highlighting b/root/usr/share/zsh/site-functions/zsh-syntax-highlighting deleted file mode 160000 index 122dc46..0000000 --- a/root/usr/share/zsh/site-functions/zsh-syntax-highlighting +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 122dc464392302114556b53ec01a1390c54f739f diff --git a/root/usr/share/zsh/site-functions/zsh-you-should-use b/root/usr/share/zsh/site-functions/zsh-you-should-use deleted file mode 160000 index 13c8635..0000000 --- a/root/usr/share/zsh/site-functions/zsh-you-should-use +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 13c86356553b80e0e0cbf1ecf6d82cfa79751b5a