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

Re: zle: vi mode: wrong undo handling on fresh lines



Bart wrote:
> The obvious reason is that "new completion" has already re-bound
> complete-word to the _main_complete function.  You can't override the
> .complete-word form, so you're always going to bypass new completion when
> running "zle .complete-word".

Oh, of course. That makes sense. Thanks.

> To get what I think you're after here, you'd more likely want
> 
> complete_word() {
>   _main_complete "$@"
> }
> zle -C complete-word .complete-word complete-word

I was trying to find a way to call split-undo before completion without
binding tab to something that isn't named complete-word. This tends to
help for older parts of the shell like incremental history searches
that don't use their own keymap and I theorised that it might help on
the second problem mentioned by Jun. However, menuselect and listscroll
actually have their own keymaps so perhaps not.

Anyway with the help of your hint, perhaps this:
  zle -C undo-complete-word .complete-word _main_complete
  complete-word() {
    zle split-undo
    zle undo-complete-word
  }
  zle -N complete-word

Or perhaps the same but with a custom name for the function that is
then aliased to complete-word with zle -A.

With that, split-undo is interfering with AUTO_MENU. The following patch
seems to sort that out. At least in my setup, it now seems to work.

Oliver

diff --git a/Src/Zle/iwidgets.list b/Src/Zle/iwidgets.list
index 7872745..95cdca2 100644
--- a/Src/Zle/iwidgets.list
+++ b/Src/Zle/iwidgets.list
@@ -102,7 +102,7 @@
 "self-insert-unmeta", selfinsertunmeta, ZLE_MENUCMP | ZLE_KEEPSUFFIX
 "send-break", sendbreak, 0
 "set-mark-command", setmarkcommand, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL
-"split-undo", splitundo, ZLE_MENUCMP | ZLE_KEEPSUFFIX
+"split-undo", splitundo, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_NOTCOMMAND
 "spell-word", spellword, 0
 "set-local-history", setlocalhistory, 0
 "transpose-chars", transposechars, 0





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