diff options
Diffstat (limited to 'Functions/Zle')
-rw-r--r-- | Functions/Zle/backward-kill-word-match | 2 | ||||
-rw-r--r-- | Functions/Zle/edit-command-line | 10 | ||||
-rw-r--r-- | Functions/Zle/kill-word-match | 2 | ||||
-rw-r--r-- | Functions/Zle/match-words-by-style | 6 | ||||
-rw-r--r-- | Functions/Zle/transpose-words-match | 11 | ||||
-rw-r--r-- | Functions/Zle/url-quote-magic | 2 |
6 files changed, 25 insertions, 8 deletions
diff --git a/Functions/Zle/backward-kill-word-match b/Functions/Zle/backward-kill-word-match index ded4db2b5..f04614c87 100644 --- a/Functions/Zle/backward-kill-word-match +++ b/Functions/Zle/backward-kill-word-match @@ -32,4 +32,6 @@ while (( count-- )); do done=1 done +zle -f 'kill' + return 0 diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line index 103a1c1a5..353f2609a 100644 --- a/Functions/Zle/edit-command-line +++ b/Functions/Zle/edit-command-line @@ -1,8 +1,8 @@ # Edit the command line using your usual editor. -# Binding this to 'v' in the vi command mode map, +# Binding this to '!' in the vi command mode map, # autoload -Uz edit-command-line # zle -N edit-command-line -# bindkey -M vicmd v edit-command-line +# bindkey -M vicmd '!' edit-command-line # will give ksh-like behaviour for that key, # except that it will handle multi-line buffers properly. @@ -10,7 +10,9 @@ exec </dev/tty # Compute the cursor's position in bytes, not characters. - setopt localoptions nomultibyte + setopt localoptions nomultibyte noksharrays + + (( $+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=${${VISUAL:-${EDITOR:-vi}}} @@ -24,6 +26,8 @@ (*) ${=editor} $1;; esac + (( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[1] + # Replace the buffer with the editor output. print -Rz - "$(<$1)" } =(<<<"$PREBUFFER$BUFFER") diff --git a/Functions/Zle/kill-word-match b/Functions/Zle/kill-word-match index 30db5ab35..ffc5be72b 100644 --- a/Functions/Zle/kill-word-match +++ b/Functions/Zle/kill-word-match @@ -31,4 +31,6 @@ while (( count-- )); do done=1 done +zle -f 'kill' + return 0 diff --git a/Functions/Zle/match-words-by-style b/Functions/Zle/match-words-by-style index b387828f3..54e019d23 100644 --- a/Functions/Zle/match-words-by-style +++ b/Functions/Zle/match-words-by-style @@ -111,20 +111,20 @@ done case $wordstyle in (*shell*) local bufwords # This splits the line into words as the shell understands them. - bufwords=(${(z)LBUFFER}) + bufwords=(${(Z:n:)LBUFFER}) nwords=${#bufwords} wordpat1="${(q)bufwords[-1]}" # Take substring of RBUFFER to skip over $skip characters # from the cursor position. - bufwords=(${(z)RBUFFER[1+$skip,-1]}) + bufwords=(${(Z:n:)RBUFFER[1+$skip,-1]}) wordpat2="${(q)bufwords[1]}" spacepat='[[:space:]]#' # Assume the words are at the top level, i.e. if we are inside # 'something with spaces' then we need to ignore the embedded # spaces and consider the whole word. - bufwords=(${(z)BUFFER}) + bufwords=(${(Z:n:)BUFFER}) if (( ${#bufwords[$nwords]} > ${#wordpat1} )); then # Yes, we're in the middle of a shell word. # Find out what's in front. diff --git a/Functions/Zle/transpose-words-match b/Functions/Zle/transpose-words-match index c1db310c1..4d2ac71f1 100644 --- a/Functions/Zle/transpose-words-match +++ b/Functions/Zle/transpose-words-match @@ -11,14 +11,23 @@ # on X would be turned into `barXfoo' with the cursor still on the X, # regardless of what the character X is. +emulate -L zsh autoload -Uz match-words-by-style -local curcontext=":zle:$WIDGET" skip +local curcontext=":zle:$WIDGET" local -a matched_words integer count=${NUMERIC:-1} neg (( count < 0 )) && (( count = -count, neg = 1 )) +if [[ $WIDGET == transpose-words ]]; then + # default is to be a drop-in replacement, check styles for change + zstyle -m $curcontext skip-chars \* || + zstyle -m $curcontext word-style '*subword*' || + { [[ $LBUFFER[-1] != [[:space:]] && $RBUFFER[1] != [[:space:]] || + -z ${RBUFFER//[[:space:]]/} ]] && zle backward-word } +fi + while (( count-- > 0 )); do match-words-by-style diff --git a/Functions/Zle/url-quote-magic b/Functions/Zle/url-quote-magic index 0e49573db..7ee281ea4 100644 --- a/Functions/Zle/url-quote-magic +++ b/Functions/Zle/url-quote-magic @@ -115,7 +115,7 @@ alias globurl='noglob urlglobber ' function url-quote-magic { setopt localoptions noksharrays extendedglob local qkey="${(q)KEYS}" - local -a reply + local -a reply match mbegin mend if [[ "$KEYS" != "$qkey" ]] then local lbuf="$LBUFFER$qkey" |