zsh:keys: Add normal . behaviour on Ctrl-.

Having bound `.` to `rationalize_dots` makes typing paths with multiple
`../` segments super easy. This gets cumbersome in some situations
though.

Typing a path like `../.local` is only possible by either typing
`../.<BS><BS>local` (as it is expanded to `../../` on the third dot) or
`..//.local` which is not as annoying but somehow breaks completion on
further path segments.

Bind `Ctrl-.` (i.e. `^N`) to insert a normal dot.
This commit is contained in:
2022-09-22 14:31:24 +02:00
parent 7666086dba
commit 72a8cfbcb0

View File

@@ -100,6 +100,11 @@ function rationalize_dots {
zle -N rationalize_dots
bindkey . rationalize_dots
# Keep the normal dot self-insert on Ctrl-. (e.g. for typing `../.local`)
function default_dot { LBUFFER+=. }
zle -N default_dot
bindkey '^N' default_dot
CMDS_ON_ENTER=(ll gs)
REQUIREMENTS_CMDS_ON_ENTER=(true "git rev-parse")
function cmd-on-enter {