zsh: fix completion duplication, remove dead code and duplicates

This commit is contained in:
Dmitry
2026-05-13 18:46:48 +03:00
parent a87c41ddd8
commit 462dc51247
5 changed files with 31 additions and 65 deletions
+8 -7
View File
@@ -144,19 +144,16 @@ alias wakemac='ssh vps "wakeonlan -i 192.168.1.255 FC:34:97:E1:08:E9"'
alias zshrc='${EDITOR} ~/.config/zsh/.zshrc'
alias reload='source ~/.config/zsh/.zshrc'
alias path='echo $PATH | tr ":" "\n"'
# Использовать bat вместо cat, если установлен
if command -v bat &>/dev/null; then
alias cat='bat'
fi
alias h='history'
alias c='clear'
alias x='exit'
alias rsend='sudo rsync -avhP --stats'
alias wakemac='ssh vps "wakeonlan -i 192.168.1.255 FC:34:97:E1:08:E9"'
# Использовать bat вместо cat, если установлен
if command -v bat &>/dev/null; then
alias cat='bat'
fi
# Быстрое обновление системы (для разных дистрибутивов)
if command -v apt &>/dev/null; then
@@ -204,3 +201,7 @@ alias ua-update-all='export TMPFILE="$(mktemp)"; \
&& sudo mv $TMPFILE /etc/pacman.d/mirrorlist \
&& paru -Syyu --noconfirm \
&& ua-drop-caches'
alias codex='proxy-on && codex'
alias claude='proxy-on && claude'
alias opencode='proxy-on && opencode'
+4 -12
View File
@@ -39,7 +39,6 @@ zstyle ':completion:*' matcher-list \
# ═══ Цвета ═════════════════════════════════════════════════
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
# ═══ Процессы ══════════════════════════════════════════════
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
@@ -60,17 +59,11 @@ zstyle ':completion:*' list-dirs-first true
zstyle ':completion:*:cd:*' ignore-parents parent pwd
# ═══ Хосты ═════════════════════════════════════════════════
zstyle ':completion:*:ssh:*' hosts off
zstyle ':completion:*:scp:*' hosts off
# Читать хосты из ~/.ssh/config
if [[ -f ~/.ssh/config ]]; then
h=()
if [[ -r ~/.ssh/config ]]; then
h=(${${${(@M)${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*})
fi
zstyle ':completion:*:ssh:*' hosts $h
zstyle ':completion:*:scp:*' hosts $h
if [[ -r ~/.ssh/config ]]; then
local _ssh_hosts=(${${${(@M)${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*})
zstyle ':completion:*:ssh:*' hosts $_ssh_hosts
zstyle ':completion:*:scp:*' hosts $_ssh_hosts
fi
# ═══ Man страницы ══════════════════════════════════════════
@@ -91,4 +84,3 @@ zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
# ═══ Расширения ════════════════════════════════════════════
zstyle ':completion:*' squeeze-slashes true
zstyle ':completion:*' expand yes
+5 -1
View File
@@ -63,6 +63,7 @@ export PATH="${CARGO_HOME}/bin:${PATH}"
# ═══ Локальные бинарники ═══════════════════════════════════
export PATH="${HOME}/.local/bin:${PATH}"
export PATH="${HOME}/.opencode/bin:${PATH}"
# ═══ Цвета ═════════════════════════════════════════════════
export CLICOLOR=1
@@ -93,4 +94,7 @@ if command -v direnv >/dev/null 2>&1; then
eval "$(direnv hook zsh)"
fi
export SSH_AUTH_SOCK='/home/ada/.bitwarden-ssh-agent.sock'
# export SSH_AUTH_SOCK='/home/ada/.bitwarden-ssh-agent.sock'
export SAL_USE_VCLPLUGIN=gtk3
export GDK_SCALE=1
+1 -7
View File
@@ -64,12 +64,6 @@ if command -v fzf &>/dev/null; then
zstyle ':fzf-tab:complete:*:*' fzf-preview 'less ${(Q)realpath} 2>/dev/null || eza -1 --color=always ${(Q)realpath} 2>/dev/null || ls -1 --color=always ${(Q)realpath}'
fi
# ═══ Навигация ═════════════════════════════════════════════
# zoxide - умный cd с историей
if command -v zoxide &>/dev/null; then
eval "$(zoxide init zsh)"
fi
# ═══ Git ═══════════════════════════════════════════════════
# Быстрые git алиасы и функции
zinit ice wait lucid
@@ -103,5 +97,5 @@ fi
# ═══ Подсветка синтаксиса (ПОСЛЕДНИЙ плагин) ═══════════════
# zsh-syntax-highlighting - ОБЯЗАТЕЛЬНО загружать последним
# Это гарантирует, что все виджеты уже определены
zinit ice wait lucid atinit'zpcompinit; zpcdreplay'
zinit ice wait lucid atinit'zpcdreplay'
zinit light zsh-users/zsh-syntax-highlighting
+13 -38
View File
@@ -3,59 +3,34 @@
# ════════════════════════════════════════════════════════════
# ═══ Powerlevel10k Instant Prompt ══════════════════════════
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Путь к конфигурации zsh
export ZDOTDIR="${ZDOTDIR:-${HOME}/.config/zsh}"
ZSH_CONFIG_DIR="${ZDOTDIR}/config"
# ═══ Zinit (Plugin Manager) ════════════════════════════════
# Автоматическая установка zinit при первом запуске
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
if [[ ! -d "$ZINIT_HOME" ]]; then
print -P "%F{blue}▓▒░ Установка zinit...%f"
mkdir -p "$(dirname $ZINIT_HOME)"
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
fi
# Загрузка zinit
source "${ZINIT_HOME}/zinit.zsh"
# ═══ Загрузка модулей ══════════════════════════════════════
# Порядок загрузки важен!
source "${ZSH_CONFIG_DIR}/env.zsh" # Переменные окружения
source "${ZSH_CONFIG_DIR}/options.zsh" # Настройки оболочки
source "${ZSH_CONFIG_DIR}/plugins.zsh" # Плагины через zinit
source "${ZSH_CONFIG_DIR}/completion.zsh" # Автодополнение
source "${ZSH_CONFIG_DIR}/aliases.zsh" # Алиасы
source "${ZSH_CONFIG_DIR}/functions.zsh" # Пользовательские функции
source "${ZSH_CONFIG_DIR}/keybindings.zsh" # Горячие клавиши
source "${ZSH_CONFIG_DIR}/prompt.zsh" # Настройка промпта (starship)
ZSH_CONFIG_DIR="${ZDOTDIR}/config"
source "${ZSH_CONFIG_DIR}/env.zsh"
source "${ZSH_CONFIG_DIR}/options.zsh"
source "${ZSH_CONFIG_DIR}/plugins.zsh"
source "${ZSH_CONFIG_DIR}/completion.zsh"
source "${ZSH_CONFIG_DIR}/aliases.zsh"
source "${ZSH_CONFIG_DIR}/functions.zsh"
source "${ZSH_CONFIG_DIR}/keybindings.zsh"
source "${ZSH_CONFIG_DIR}/prompt.zsh"
# ═══ Локальные настройки (опционально) ═════════════════════
# Для машинно-специфичных настроек
# ═══ Локальные настройки ═══════════════════════════════════
[[ -f "${ZSH_CONFIG_DIR}/local.zsh" ]] && source "${ZSH_CONFIG_DIR}/local.zsh"
# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
[[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh
[[ -f "${ZDOTDIR}/.p10k.zsh" ]] && source "${ZDOTDIR}/.p10k.zsh"
# To customize prompt, run `p10k configure` or edit /home/ada/.config/zsh/.p10k.zsh.
[[ ! -f /home/ada/.config/zsh/.p10k.zsh ]] || source /home/ada/.config/zsh/.p10k.zsh
export NVM_DIR="$HOME/.config/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# . "$HOME/.local/share/../bin/env"
# To customize prompt, run `p10k configure` or edit ~/.dotfiles/zsh/.config/zsh/.p10k.zsh.
[[ ! -f ~/.dotfiles/zsh/.config/zsh/.p10k.zsh ]] || source ~/.dotfiles/zsh/.config/zsh/.p10k.zsh
# ═══ Fastfetch ══════════════════════════════════════════════
[[ -z "$TMUX" && "$TERM_PROGRAM" == "kitty" ]] && fastfetch