From 88f6831798ea641eab81c663fb1b56075868bd06 Mon Sep 17 00:00:00 2001 From: Bartek Stalewski Date: Sun, 1 Aug 2021 22:35:13 +0200 Subject: [PATCH] Better completion with up-arrow. --- zsh/.zshrc | 4 +--- zsh/keys.zsh | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 zsh/keys.zsh diff --git a/zsh/.zshrc b/zsh/.zshrc index e1fd393..6b9a501 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,6 +1,3 @@ -# key mode -bindkey -e - # global exports and options export HISTSIZE=10000 export SAVEHIST=$HISTSIZE @@ -18,6 +15,7 @@ mkdir -p $XDG_CACHE_HOME/zsh zstyle ':completion:*' menu select zstyle ':completion:*' list-colors '' + source $ZDOTDIR/keys.zsh # fancy stuff only in X or ssh if [[ ! $(tty) =~ /dev/tty[0-9] ]]; then # aliases diff --git a/zsh/keys.zsh b/zsh/keys.zsh new file mode 100644 index 0000000..cc9eef1 --- /dev/null +++ b/zsh/keys.zsh @@ -0,0 +1,22 @@ +# key mode +bindkey -e + +# proudly stolen from oh-my-zsh +if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then + function zle-line-init() { + echoti smkx + } + function zle-line-finish() { + echoti rmkx + } + zle -N zle-line-init + zle -N zle-line-finish +fi +if [[ -n "${terminfo[kcuu1]}" ]]; then + autoload -U up-line-or-beginning-search + zle -N up-line-or-beginning-search + + bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search + bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search + bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search +fi