From 72a8cfbcb0ab782f3266bd8485f999781ff1a513 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Thu, 22 Sep 2022 14:31:24 +0200 Subject: [PATCH] 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 `../.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. --- .config/zsh/zshrc.d/60-keys.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.config/zsh/zshrc.d/60-keys.zsh b/.config/zsh/zshrc.d/60-keys.zsh index a880e1d..e981477 100644 --- a/.config/zsh/zshrc.d/60-keys.zsh +++ b/.config/zsh/zshrc.d/60-keys.zsh @@ -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 {