From 462dc512472be8e0185af7d042394ef5b8b4b871 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Wed, 13 May 2026 18:46:48 +0300 Subject: [PATCH] zsh: fix completion duplication, remove dead code and duplicates --- dot_config/zsh/config/aliases.zsh | 15 ++++---- dot_config/zsh/config/completion.zsh | 16 +++------ dot_config/zsh/config/env.zsh | 6 +++- dot_config/zsh/config/plugins.zsh | 8 +---- dot_config/zsh/dot_zshrc | 51 +++++++--------------------- 5 files changed, 31 insertions(+), 65 deletions(-) diff --git a/dot_config/zsh/config/aliases.zsh b/dot_config/zsh/config/aliases.zsh index e209261..e0dd659 100644 --- a/dot_config/zsh/config/aliases.zsh +++ b/dot_config/zsh/config/aliases.zsh @@ -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' diff --git a/dot_config/zsh/config/completion.zsh b/dot_config/zsh/config/completion.zsh index 62e480b..c46a660 100644 --- a/dot_config/zsh/config/completion.zsh +++ b/dot_config/zsh/config/completion.zsh @@ -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 diff --git a/dot_config/zsh/config/env.zsh b/dot_config/zsh/config/env.zsh index eb143ab..4231ada 100644 --- a/dot_config/zsh/config/env.zsh +++ b/dot_config/zsh/config/env.zsh @@ -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 \ No newline at end of file diff --git a/dot_config/zsh/config/plugins.zsh b/dot_config/zsh/config/plugins.zsh index 5f1a912..af0594b 100644 --- a/dot_config/zsh/config/plugins.zsh +++ b/dot_config/zsh/config/plugins.zsh @@ -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 diff --git a/dot_config/zsh/dot_zshrc b/dot_config/zsh/dot_zshrc index 1acde69..5fa0aff 100644 --- a/dot_config/zsh/dot_zshrc +++ b/dot_config/zsh/dot_zshrc @@ -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