From b5deb6e21f1e8be44d3f241728fed4ef901ee98a Mon Sep 17 00:00:00 2001 From: crater2150 Date: Mon, 21 Aug 2023 11:53:57 +0200 Subject: [PATCH] Fix edit-command-line-split --- bindings.zsh | 4 +++- completion.zsh | 8 ++++---- widgets/edit-command-line-split | 28 ++++++++++++++-------------- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/bindings.zsh b/bindings.zsh index c3a76ef..2726458 100644 --- a/bindings.zsh +++ b/bindings.zsh @@ -32,6 +32,8 @@ bindkey " " magic-space # Do history expansion on space. bindkey $'\177' backward-delete-char # backspace bindkey $'\10' backward-delete-word # C-backspace +autoload -U edit-command-line-split +zle -N edit-command-line-split bindkey -M vicmd ! edit-command-line-split #unicode input @@ -55,7 +57,7 @@ local function zle-line-finish () { echoti rmkx 2> /dev/null } zle -N zle-line-init -zle -N zle-line-finish +zle -N zle-line-finish insert_sudo () { LBUFFER="sudo ${LBUFFER}" } zle -N insert-sudo insert_sudo diff --git a/completion.zsh b/completion.zsh index 0f4a3b2..9aa001c 100644 --- a/completion.zsh +++ b/completion.zsh @@ -1,5 +1,5 @@ # autoload completions -fpath=( "${ZDOTDIR:+$ZDOTDIR/compdef}" "/etc/zsh/compdef" $fpath ) +fpath=( "${XDG_DATA_HOME:-$HOME/.local/share}/zsh/site-functions" "${ZDOTDIR:+$ZDOTDIR/compdef}" "/etc/zsh/compdef" $fpath ) fpath=("$XDG_DATA_HOME/scalacli/completions/zsh" $fpath) [[ -n $(echo /etc/zsh/compdef/*(N:t)) ]] && autoload -U /etc/zsh/compdef/*(N:t) @@ -21,13 +21,13 @@ autoload -U +X bashcompinit && bashcompinit zstyle ':completion:*:descriptions' format ‘%B%d%b’ zstyle ':completion:*:messages' format ‘%d’ zstyle ':completion:*:warnings' format ‘No matches for: %d’ -zstyle ':completion:*' use-cache on +zstyle ':completion:*' use-cache on zstyle ':completion:*' cache-path ~/.cache/zsh -zstyle ':completion:*' completer _complete _ignored _match _approximate _correct +zstyle ':completion:*' completer _complete _ignored _match _approximate _correct zstyle ':completion:*:match:*' original only zstyle ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)' zstyle ':completion:*:functions' ignored-patterns '_*' -zstyle ':completion:*' squeeze-slashes true +zstyle ':completion:*' squeeze-slashes true zstyle ':completion:*' expand prefix suffix zstyle ':completion:*' group-name '' zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} diff --git a/widgets/edit-command-line-split b/widgets/edit-command-line-split index 7ef82e1..43c8a85 100644 --- a/widgets/edit-command-line-split +++ b/widgets/edit-command-line-split @@ -1,16 +1,16 @@ -edit-command-line-tmux() { - local tmpfile=${TMPPREFIX:-/tmp/zsh}ecl$$ +local tmpfile=${TMPPREFIX:-/tmp/zsh}ecl$$ - print -R - "$PREBUFFER$BUFFER" >$tmpfile - exec $tmpfile +exec /dev/null +else + ${=${VISUAL:-${EDITOR:-vi}}} $tmpfile +fi +print -Rz - "$(<$tmpfile)" - command rm -f $tmpfile - zle send-break # Force reload from the buffer stack -} +command rm -f $tmpfile +zle send-break # Force reload from the buffer stack + +# vim:ft=zsh