zsh:keys: Use (A) flag instead of hack to split LBUFFER
This way better solution using the `(A)` flag was given to me in the zsh-users mailing list back in 2022 but I forgot to apply it. See zshexpn(1): > Convert the substitution into an array expression, even if it > otherwise would be scalar. Thanks Mikael! Link: https://www.zsh.org/mla/users/2022/msg00668.html
This commit is contained in:
@@ -159,13 +159,9 @@ function rationalize_dots {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# NOTE: This is a hack to fix the (z) expansion flag if the path is the only
|
|
||||||
# word in LBUFFER, as then [:-1] treats the expansion as a scalar and
|
|
||||||
# returns the last character (i.e. always `/`).
|
|
||||||
local lbuffer_words="x $LBUFFER"
|
|
||||||
# Print currently typed path as absolute path with "collapsed"/reversed
|
# Print currently typed path as absolute path with "collapsed"/reversed
|
||||||
# filename expansion.
|
# filename expansion.
|
||||||
zle -M "${(D)${(z)lbuffer_words}[-1]:a}"
|
zle -M "${(D)${(Az)LBUFFER}[-1]:a}"
|
||||||
}
|
}
|
||||||
zle -N rationalize_dots
|
zle -N rationalize_dots
|
||||||
bindkey . rationalize_dots
|
bindkey . rationalize_dots
|
||||||
|
|||||||
Reference in New Issue
Block a user