agkozak / agkozak-zsh-prompt

A fast, asynchronous Zsh prompt with color ASCII indicators of Git, exit, SSH, virtual environment, and vi mode status. Framework-agnostic and customizable.
MIT License
289 stars 26 forks source link

Ctrl + Left/Right to jump between words instead of vi/normal mode? #35

Open mitomeo opened 3 years ago

mitomeo commented 3 years ago

Before applying the theme, I could use Ctrl Left/Right or Alt B/F to jump between words. How can I achieve the same now? Thx

agkozak commented 3 years ago

The prompt is not intended to affect keybindings. Can you share your .zshrc with me? I might be able to identify what's going wrong.

mitomeo commented 3 years ago

Sure, here my zshrc run on urxvt

# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
bindkey -v
bindkey '^R' history-incremental-search-backward
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/ken/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall

# antibody bundle < ~/.config/zsh_plugins.txt > ~/.config/zsh_plugins.sh
source ~/.config/zsh_plugins.sh

[[ -s /etc/profile.d/autojump.sh ]] && source /etc/profile.d/autojump.sh

# create a zkbd compatible hash;
# to add other keys to this hash, see: man 5 terminfo
typeset -g -A key

key[Home]="${terminfo[khome]}"
key[End]="${terminfo[kend]}"
key[Insert]="${terminfo[kich1]}"
key[Backspace]="${terminfo[kbs]}"
key[Delete]="${terminfo[kdch1]}"
key[PageUp]="${terminfo[kpp]}"
key[PageDown]="${terminfo[knp]}"
key[Shift-Tab]="${terminfo[kcbt]}"

# setup key accordingly
[[ -n "${key[Home]}"      ]] && bindkey -- "${key[Home]}"       beginning-of-line
[[ -n "${key[End]}"       ]] && bindkey -- "${key[End]}"        end-of-line
[[ -n "${key[Insert]}"    ]] && bindkey -- "${key[Insert]}"     overwrite-mode
[[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}"  backward-delete-char
[[ -n "${key[Delete]}"    ]] && bindkey -- "${key[Delete]}"     delete-char
[[ -n "${key[PageUp]}"    ]] && bindkey -- "${key[PageUp]}"     beginning-of-buffer-or-history
[[ -n "${key[PageDown]}"  ]] && bindkey -- "${key[PageDown]}"   end-of-buffer-or-history
[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}"  reverse-menu-complete

# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
    autoload -Uz add-zle-hook-widget
    function zle_application_mode_start { echoti smkx }
    function zle_application_mode_stop { echoti rmkx }
    add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
    add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
fi

AGKOZAK_CMD_EXEC_TIME=0
AGKOZAK_PROMPT_DIRTRIM=0
AGKOZAK_PROMPT_CHAR=( $ %# : )
AGKOZAK_MULTILINE=0
agkozak commented 3 years ago

I suspect the real culprit is in your ~/.config/zsh_plugins.txt file. You might need to post that as well.

Do you really use Vim editing mode (bindkey -v)? Alt+F and Alt+B for forward-word and backward-word come from Emacs editing mode (bindkey -e), though there's nothing to stop you from using keybindings from both.

mitomeo commented 3 years ago

You are right, I should not have expected Alt + B/F to move between words in vim mode. So my concern now is Ctrl + Left/Right not working. I use antibody as my plugin manager, so basically my zsh_plugins.txt:

zsh-users/zsh-autosuggestions
zsh-users/zsh-completions
agkozak/agkozak-zsh-prompt
zsh-users/zsh-syntax-highlighting

zsh_plugins.sh:

source /home/ken/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
fpath+=( /home/ken/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions )
source /home/ken/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-completions/zsh-completions.plugin.zsh
fpath+=( /home/ken/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-completions )
source /home/ken/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-agkozak-SLASH-agkozak-zsh-prompt/agkozak-zsh-prompt.plugin.zsh
fpath+=( /home/ken/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-agkozak-SLASH-agkozak-zsh-prompt )
source /home/ken/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh
fpath+=( /home/ken/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting )
AndydeCleyre commented 2 years ago

@mitomeo Can you try removing autosuggestions? That one is sometimes extra funky.