zsh fix bug

This commit is contained in:
thek4n 2024-10-09 22:22:23 +03:00
parent 0c3baa45d4
commit 9ab0d024a6
5 changed files with 47 additions and 60 deletions

View File

@ -0,0 +1,43 @@
# Activate vim mode.
bindkey -v
bindkey -M viins 'jf' vi-cmd-mode
bindkey ' ' magic-space # history expansion on space
bindkey '^K' up-line-or-history # C-k
bindkey -M vicmd '^K' up-line-or-history # C-k
bindkey '^J' down-line-or-history # C-j
bindkey -M vicmd '^J' down-line-or-history # C-j
bindkey -M vicmd '^U' kill-whole-line # C-u
bindkey -M viins '^U' kill-whole-line # C-u
bindkey -M viins '\e.' insert-last-word # M-.
bindkey '^[[Z' reverse-menu-complete # S-Tab
insert-sudo() {
local sudo_template="${SUDO:=sudo} "
local template_len="${#sudo_template}"
if [ -z "${LBUFFER}${RBUFFER}" ]; then
zle up-history
fi
if [ "${LBUFFER::$template_len}" = "$sudo_template" ]; then
LBUFFER="${LBUFFER:$template_len}"
else
LBUFFER="${sudo_template}${LBUFFER}"
fi
}
zle -N insert-sudo
bindkey -M vicmd '^S' insert-sudo # C-s
bindkey -M viins '^S' insert-sudo # C-s
bindkey '`' autosuggest-accept
bindkey '^?' backward-delete-char
bindkey '^W' backward-delete-word

View File

@ -44,44 +44,4 @@ precmd_functions+=(_fix_cursor)
# 6 -> steady bar, xterm.
# Activate vim mode.
bindkey -v
bindkey -M viins 'jf' vi-cmd-mode
bindkey ' ' magic-space # history expansion on space
bindkey '^K' up-line-or-history # C-k
bindkey -M vicmd '^K' up-line-or-history # C-k
bindkey '^J' down-line-or-history # C-j
bindkey -M vicmd '^J' down-line-or-history # C-j
bindkey -M vicmd '^U' kill-whole-line # C-u
bindkey -M viins '^U' kill-whole-line # C-u
bindkey -M viins '\e.' insert-last-word # M-.
bindkey '^[[Z' reverse-menu-complete # S-Tab
zle_highlight=('paste:bg=24,fg=15', 'region:bg=24,fg=15') # colors of visual select
insert-sudo() {
local sudo_template="${SUDO:=sudo} "
local template_len="${#sudo_template}"
if [ -z "${LBUFFER}${RBUFFER}" ]; then
zle up-history
fi
if [ "${LBUFFER::$template_len}" = "$sudo_template" ]; then
LBUFFER="${LBUFFER:$template_len}"
else
LBUFFER="${sudo_template}${LBUFFER}"
fi
}
zle -N insert-sudo
bindkey -M vicmd '^S' insert-sudo # C-s
bindkey -M viins '^S' insert-sudo # C-s
zle_highlight=('paste:bg=24,fg=15', 'region:bg=24,fg=15') # colors of visual select

View File

@ -14,19 +14,4 @@ if [ -x /usr/bin/dircolors ]; then
# Take advantage of $LS_COLORS for completion as well
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
fi
# enable auto-suggestions based on the history
if [ -f /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]; then
. /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
# change suggestion color
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#999'
fi
if [ -n "$(command -v pyenv >/dev/null)" ]; then
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
fi

View File

@ -11,7 +11,6 @@ _so "$XDG_CONFIG_HOME/bash/functions"
_so "$XDG_CONFIG_HOME/bash/hosts/$HOST"
_so /etc/zsh_command_not_found
_so "$ZDOTDIR/options"
_so "$ZDOTDIR/completion"
_so "$ZDOTDIR/history"
@ -21,8 +20,8 @@ _so "$ZDOTDIR/aliases"
_so "$ZDOTDIR/plugin"
_so "$ZDOTDIR/mappings"
_so "$ZDOTDIR/calculator"
bindkey '`' autosuggest-accept
_sod "$ZDOTDIR/zshrc.d"

View File

@ -1,5 +1,5 @@
#!/usr/bin/env zsh
for zfile in .zshenv .config/zsh/.zshrc .config/zsh/.zprofile .config/zsh/.zlogout .config/zsh/aliases .config/zsh/completion .config/zsh/history .config/zsh/options .config/zsh/other .config/zsh/plugin .config/zsh/calculator .config/zsh/prompt .config/zsh/sourcer; do
for zfile in .zshenv .config/zsh/.zshrc .config/zsh/.zprofile .config/zsh/.zlogout .config/zsh/aliases .config/zsh/completion .config/zsh/history .config/zsh/options .config/zsh/other .config/zsh/plugin .config/zsh/calculator .config/zsh/prompt .config/zsh/mappings .config/zsh/sourcer; do
zcompile "$HOME/$zfile"
done