Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zle insert problems



2011/8/2 Pascal Wittmann <PascalWittmann@xxxxxxx>:
>  9 replace-pacman-command() {
> 10   if [[ $LBUFFER = "pacman"* ]]; then
> 11      zle beginning-of-line
> 12      zle forward-word
> 13      zle delete-word
> 14      zle -U -- $@
> 15      zle end-of-line
> 16   fi
> 17 }
> 18
> 19 replace-pacman-command-insert() {
> 20   replace-pacman-command "-S"
> 21 }
> 22
> 23 zle -N replace-pacman-command-insert
> 24 bindkey "^[i" replace-pacman-command-insert
>
> I think doing this directly via BUFFER gets quickly unreadable.

replace-pacman-command() {
  BUFFER=${BUFFER/pacman [-a-zA-Z]#/pacman $@}
}

?

Best regards,

-- 
Jérémie



Messages sorted by: Reverse Date, Date, Thread, Author