行末で歌うとls Dir\ A/Long\ File\ Name
殺す言葉に変わりたいです。 toを修正して削除できるls Dir\ A/
ことを知っていますが、エスケープされたスペースを無視する方法が見つかりません。/
$WORDCHARS
ベストアンサー1
組み込みウィジェットに通知する方法はありませんbackward-kill-word
(次の単語は終了します)。左カーソル)を使用してこれを実行できますが、直接スクロールすることもできます。
backward-kill-word() {
# LBUFFER -- all text left of the cursor
# (z) -- split into shell words
# (A) -- force the resulting words into an array
# [-1] -- take the right-most element
# :t -- strip all path ancestors from it
# % -- remove the shortest matching substring from the right
LBUFFER=${LBUFFER%${${(zA)LBUFFER}[-1]:t}*}
zle -f kill # Tell the Zsh Line Editor that we've killed text.
}
zle -N backward-kill-word # Replace the default widget.
置換kill-word
(次の単語を削除)正しいカーソル)は非常に似ています。
kill-word() {
# RBUFFER -- all text to the right of the cursor
# [1] -- take the left-most element
# :h1 -- strip all path descendants from it
# # -- remove the shortest matching substring from the left
RBUFFER=${RBUFFER#*${${(zA)RBUFFER}[1]:h1}}
zle -f kill
}
zle -N kill-word