mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-08 04:34:00 +02:00
Merge 34a1cf821f into 5667161d49
This commit is contained in:
commit
3e7ad567bf
1 changed files with 70 additions and 0 deletions
70
plugins/virtual-insert/virtual-insert.plugin.zsh
Normal file
70
plugins/virtual-insert/virtual-insert.plugin.zsh
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
zle -N user-complete
|
||||
bindkey "\t" user-complete
|
||||
|
||||
zle -N user-ret
|
||||
bindkey "\r" user-ret
|
||||
|
||||
zle -N user-del
|
||||
bindkey "^W" user-del
|
||||
|
||||
cdpath=".."
|
||||
|
||||
user-complete()
|
||||
{
|
||||
case $BUFFER in
|
||||
"" )
|
||||
BUFFER="cd "
|
||||
zle end-of-line
|
||||
zle expand-or-complete
|
||||
;;
|
||||
cd\ \ * )
|
||||
BUFFER=${BUFFER/\ \ /\ ~}
|
||||
zle end-of-line
|
||||
zle expand-or-complete
|
||||
;;
|
||||
" " )
|
||||
BUFFER="z "
|
||||
zle end-of-line
|
||||
zle expand-or-complete
|
||||
;;
|
||||
"cd --" )
|
||||
BUFFER="cd +"
|
||||
zle end-of-line
|
||||
zle expand-or-complete
|
||||
;;
|
||||
"cd +-" )
|
||||
BUFFER="cd -"
|
||||
zle end-of-line
|
||||
zle expand-or-complete
|
||||
;;
|
||||
* )
|
||||
zle expand-or-complete
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
user-ret()
|
||||
{
|
||||
if [[ $BUFFER = "" ]] ;then
|
||||
BUFFER="ls"
|
||||
zle end-of-line
|
||||
zle accept-line
|
||||
elif [[ $BUFFER =~ "^cd\ \.\.\.+$" ]] ;then
|
||||
BUFFER=${${BUFFER//\./\.\.\/}/\.\.\//}
|
||||
zle end-of-line
|
||||
zle accept-line
|
||||
else
|
||||
zle accept-line
|
||||
fi
|
||||
}
|
||||
|
||||
user-del()
|
||||
{
|
||||
if [[ $BUFFER = "" ]] ; then
|
||||
BUFFER="cd .."
|
||||
zle end-of-line
|
||||
zle accept-line
|
||||
else
|
||||
zle backward-kill-word
|
||||
fi
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue