diff --git a/home/user/.config/zsh/mappings b/home/user/.config/zsh/mappings new file mode 100644 index 0000000..7d56053 --- /dev/null +++ b/home/user/.config/zsh/mappings @@ -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 diff --git a/home/user/.config/zsh/options b/home/user/.config/zsh/options index ebf1d55..eebe618 100644 --- a/home/user/.config/zsh/options +++ b/home/user/.config/zsh/options @@ -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 \ No newline at end of file +zle_highlight=('paste:bg=24,fg=15', 'region:bg=24,fg=15') # colors of visual select \ No newline at end of file diff --git a/home/user/.config/zsh/other b/home/user/.config/zsh/other index 19d91d5..cc071de 100644 --- a/home/user/.config/zsh/other +++ b/home/user/.config/zsh/other @@ -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 \ No newline at end of file diff --git a/home/user/.config/zsh/sourcer b/home/user/.config/zsh/sourcer index a20df98..524aa63 100644 --- a/home/user/.config/zsh/sourcer +++ b/home/user/.config/zsh/sourcer @@ -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" \ No newline at end of file diff --git a/install-hooks/zsh/post-install b/install-hooks/zsh/post-install index 07cf0f4..d785db9 100755 --- a/install-hooks/zsh/post-install +++ b/install-hooks/zsh/post-install @@ -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 \ No newline at end of file