From 841188439b1b93031b4d4cb195d50958fe88d6a4 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Wed, 5 Aug 2020 16:47:45 +0200 Subject: 47306: edit-command-line: add editor style --- Functions/Zle/edit-command-line | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Functions') diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line index 1103ca556..8aaeb738e 100644 --- a/Functions/Zle/edit-command-line +++ b/Functions/Zle/edit-command-line @@ -22,8 +22,12 @@ fi (( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[2] # Open the editor, placing the cursor at the right place if we know how. - local editor=( "${(@Q)${(z)${VISUAL:-${EDITOR:-vi}}}}" ) - case $editor in + local -a editor + zstyle -a :zle:$WIDGET editor editor + if (( ! $#editor )); then + editor=( "${(@Q)${(z)${VISUAL:-${EDITOR:-vi}}}}" ) + fi + case $editor in (*vim*) integer byteoffset=$(( $#PREBUFFER + $#LBUFFER + 1 )) "${(@)editor}" -c "normal! ${byteoffset}go" -- $1;; -- cgit 1.4.1