diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2008-06-24 11:18:39 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2008-06-24 11:18:39 +0000 |
commit | 86b8b5eaa346583300fa6f14fe1d0fe5beb096ba (patch) | |
tree | ddf9f1b4e90b6dd06d24a0b58e03ae6fcaf800fc /Functions/Zle/select-word-style | |
parent | a440669201fcaaefe7a83d901e18dbdd57cf9d0a (diff) | |
download | zsh-86b8b5eaa346583300fa6f14fe1d0fe5beb096ba.tar.gz zsh-86b8b5eaa346583300fa6f14fe1d0fe5beb096ba.tar.xz zsh-86b8b5eaa346583300fa6f14fe1d0fe5beb096ba.zip |
users/12987: add subword capability to word-style
Diffstat (limited to 'Functions/Zle/select-word-style')
-rw-r--r-- | Functions/Zle/select-word-style | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/Functions/Zle/select-word-style b/Functions/Zle/select-word-style index afea5b193..9c0fdb5cc 100644 --- a/Functions/Zle/select-word-style +++ b/Functions/Zle/select-word-style @@ -10,7 +10,7 @@ word_functions=(backward-kill-word backward-word [[ -z $1 ]] && autoload read-from-minibuffer -local REPLY detail f +local REPLY detail f wordstyle if ! zle -l $word_functions[1]; then for f in $word_functions; do @@ -25,6 +25,7 @@ while true; do if [[ -n $WIDGET && -z $1 ]]; then read-from-minibuffer -k1 "Word styles (hit return for more detail): (b)ash (n)ormal (s)hell (w)hitespace (d)efault (q)uit +(B), (N), (S), (W) as above with subword matching ${detail}? " || return 1 else REPLY=$1 @@ -33,31 +34,31 @@ ${detail}? " || return 1 detail= case $REPLY in - (b*) + ([bB]*) # bash style - zstyle ':zle:*' word-style standard + wordstyle=standard zstyle ':zle:*' word-chars '' ;; - (n*) + ([nN]*) # normal zsh style - zstyle ':zle:*' word-style standard + wordstyle=standard zstyle ':zle:*' word-chars "$WORDCHARS" ;; - (s*) + ([sS]*) # shell command arguments or special tokens - zstyle ':zle:*' word-style shell + wordstyle=shell ;; - (w*) + ([wW]*) # whitespace-delimited - zstyle ':zle:*' word-style space + wordstyle=space ;; (d*) # default: could also return widgets to builtins here - zstyle -d ':zle:*' word-style + wordstyle= zstyle -d ':zle:*' word-chars ;; @@ -84,5 +85,12 @@ $detail" >&2 continue ;; esac + + if [[ -n $wordstyle ]]; then + if [[ $REPLY = [[:upper:]]* ]]; then + wordstyle+=-subword + fi + zstyle ':zle:*' word-style $wordstyle + fi return done |