Есть несколько способов решить эту проблему:
Вы можете удалить _
и /
из$WORDCHARS
(или любой другой символ, который вы не хотите рассматривать как часть слова для тех виджетов, которые работают с словами)и определяют виджет, который удаляет последовательности слов или не -словесных символов для привязки к Alt+Del
delete-word-or-non-word() {
emulate -L zsh # restore default zsh options locally to the function
set -o extendedglob # extended glob needed for the ## operator (locally)
# ${var##pattern} ksh operator to remove the longest string that matches
# the pattern off the start of $var. Here applied to $RBUFFER which in a
# zle widget is the part of the line editor buffer to the right of the
# cursor. [[:WORD:]] matches a *word* character (alnums + $WORDCHARS),
# ## is *one or more* (like ERE's + or ksh's +(...))
RBUFFER=${RBUFFER##([[:WORD:]]##|[^[:WORD:]]##)}
}
zle -N delete-word-or-non-word # define a new zle widget using that function
# bind that new widget
bindkey '\ed' delete-word-or-non-word # Alt+D
bindkey '^[[3;3~' delete-word-or-non-word # Alt+Del on xterm at least
WORDCHARS=${WORDCHARS//[\/_]} # remove _ and / from WORDCHARS
# using the ${var//pattern/replacement} ksh
# operator
WORDCHARS= # or make it empty so that the only *word*
# characters are alphanumerics
(не требуетselect-word-style
)