aboutsummaryrefslogtreecommitdiff
path: root/linux/home/.config/zsh
diff options
context:
space:
mode:
Diffstat (limited to 'linux/home/.config/zsh')
-rw-r--r--linux/home/.config/zsh/.zshrc101
1 files changed, 76 insertions, 25 deletions
diff --git a/linux/home/.config/zsh/.zshrc b/linux/home/.config/zsh/.zshrc
index ececf24..acb1225 100644
--- a/linux/home/.config/zsh/.zshrc
+++ b/linux/home/.config/zsh/.zshrc
@@ -6,52 +6,93 @@
# ███████╗███████║██║ ██║██║ ██║╚██████╗
# ╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝
-for zsh_source in "$HOME"/.config/zsh/user/*.zsh; do
- source $zsh_source
-done
+# Profile zsh time
+#zmodload zsh/zprof
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
+# Terminal key bindings
+#stty intr '^q' # Free Ctrl+C for copy use Ctrl+Q instead for Interrupt
+stty lnext '^-' # Free Ctrl+V for paste use Ctrl+- instead for Literal next
+stty stop undef # Disable Ctrl+S to freeze terminal
+stty start undef # Disable Ctrl+Q nfreeze terminal
+
+# Set the current prompt file (e.g., prompt, or prompt_minimal)
+ZSH_PROMPT="${ZSH_PROMPT:-prompt}"
+#ZSH_PROMPT="${ZSH_PROMPT:-prompt_minimal}"
+#ZSH_PROMPT="${ZSH_PROMPT:-prompt_new}"
+#ZSH_PROMPT="${ZSH_PROMPT:-prompt_simple}"
+
+# Source common Zsh files (excluding any that start with 'prompt')
+ZSH_SOURCES=()
+
+for zsh_source in "$HOME"/.config/zsh/user/*.zsh; do
+ if [[ $(basename "$zsh_source") == prompt* && $(basename "$zsh_source" .zsh) != "$ZSH_PROMPT" ]]; then
+ continue
+ fi
+ ZSH_SOURCES+=("$zsh_source")
+done
+
+# Faster SSH
if [[ -n "$SSH_CLIENT" ]]; then
export KEYTIMEOUT=10
else
export KEYTIMEOUT=15
fi
-# Tmux default session
-if command -v tmux &> /dev/null && [ -n "$PS1" ] && [ -z "$DISPLAY" ] && [ -z "$TMUX" ]; then
- if ! tmux list-sessions | grep -q '^tmux:'; then
- tmux new -s tmux
- fi
+# Prevent non-login shell anomalies or toolchain misidentification in VS Code
+#[[ "$TERM_PROGRAM" == "vscode" ]] && unset ARGV0
+#[[ -n "$TERM_PROGRAM" && "$TERM_PROGRAM" == "vscode" ]] && unset ARGV0
+if [[ "${TERM_PROGRAM:-}" == "vscode" ]]; then
+ unset ARGV0
fi
-# Enable various options
-setopt interactive_comments beep extendedglob nomatch notify completeinword prompt_subst
+# Tmux default session
+#if [ "$TERM_PROGRAM" != "vscode" ] && command -v tmux &> /dev/null && [ -n "$PS1" ] && [ -n "$DISPLAY" ] && [ -z "$TMUX" ]; then
+# if ! tmux list-sessions | grep -q '^tmux:'; then
+# tmux new -s tmux
+# fi
+#fi
+
+# Enable various options for Zsh behavior
+setopt interactive_comments # Allow comments to appear in interactive mode
+unsetopt BEEP # Disable the system beep (to prevent annoying beeps)
+setopt extendedglob # Enable extended globbing for complex pattern matching
+setopt nomatch # Prevent errors when a glob pattern doesn't match any files
+setopt notify # Notify when background jobs complete
+setopt completeinword # Allow tab completion within words
+setopt prompt_subst # Allow prompt variables to be substituted
-# Some other useful functionalities
-setopt autocd # Automatically cd into typed directory.
-setopt AUTO_PUSHD # More history for cd and use "cd -TAB"
-stty intr '^q' # free Ctrl+C for copy use Ctrl+q instead
-stty lnext '^-' # free Ctrl+V for paste use ^- instead
-stty stop undef # Disable ctrl-s to freeze terminal.
-stty start undef
-#COMPLETION_WAITING_DOTS="false"
-#unsetopt BEEP
+# Enable automatic directory navigation
+setopt autocd # Automatically change to a directory if the directory name is typed alone
+setopt AUTO_PUSHD # Save more directory history, and use "cd -" with tab completion
+
+# Optional: Uncomment to disable waiting dots on completion
+# COMPLETION_WAITING_DOTS="false"
+
+# Hide history of commands starting with a space
+setopt histignorespace # Do not save commands that start with a space in the history
+
+# Source ZSH files
+for zsh_source in "${ZSH_SOURCES[@]}"; do
+ source "$zsh_source"
+done
########## Source Plugins, should be last ##########
#source /usr/share/nvm/init-nvm.sh
# Load fzf keybindings and completion if fzf is installed
-if command -v fzf > /dev/null 2>&1; then
- #FZF_BASE="/usr/share/fzf"
+if command -v fzf >/dev/null 2>&1; then
FZF_BASE="/usr/local/bin/fzf/shell"
- source "${FZF_BASE}/key-bindings.zsh"
- source "${FZF_BASE}/completion.zsh"
-else
- echo "fzf not found, please install it to use fzf keybindings and completion."
+ [[ -f "${FZF_BASE}/key-bindings.zsh" ]] && source "${FZF_BASE}/key-bindings.zsh"
+ [[ -f "${FZF_BASE}/completion.zsh" ]] && source "${FZF_BASE}/completion.zsh"
fi
+
+
+#source $(which virtualenvwrapper.sh)
+
# Suggest aliases for commands
source ~/.config/zsh/plugins/zsh-you-should-use/you-should-use.plugin.zsh
@@ -61,3 +102,13 @@ source ~/.config/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Load fish like auto suggestions
source ~/.config/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
source ~/.config/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
+
+DISABLE_MAGIC_FUNCTIONS=true
+
+# Zoxide (cd alternative)
+if command -v zoxide >/dev/null 2>&1; then
+ eval "$(zoxide init zsh)"
+fi
+
+# Profile zsh time
+#zprof # At the end of .zshrc