zsh move with dots

This commit is contained in:
Christoph J. Scherr 2023-09-07 10:51:27 +02:00
parent 84aa3c7dcd
commit 9791b73f51
1 changed files with 24 additions and 0 deletions

24
.zshrc
View File

@ -74,6 +74,30 @@ bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word bindkey "^[[1;5D" backward-word
bindkey -s "^X" 'n^M' bindkey -s "^X" 'n^M'
### ---- EXPAND DOTS -------------------------------------
function expand-dots() {
local MATCH
if [[ $LBUFFER =~ '(^| )\.\.\.+' ]]; then
LBUFFER=$LBUFFER:fs%\.\.\.%../..%
fi
}
function expand-dots-then-expand-or-complete() {
zle expand-dots
zle expand-or-complete
}
function expand-dots-then-accept-line() {
zle expand-dots
zle accept-line
}
zle -N expand-dots
zle -N expand-dots-then-expand-or-complete
zle -N expand-dots-then-accept-line
bindkey '^I' expand-dots-then-expand-or-complete
bindkey '^M' expand-dots-then-accept-line
### ---- THEMES ----------------------------------- ### ---- THEMES -----------------------------------
PS1='%B%F{red}%n@%m%k %B%F{cyan}%(4~|...|)%3~%F{white} %# %b%f%k' PS1='%B%F{red}%n@%m%k %B%F{cyan}%(4~|...|)%3~%F{white} %# %b%f%k'