Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: In Vi mode, show whether "insert" or "command" state is active
On Dec 26, 12:32pm, Oliver Kiddle wrote:
}
} Do we really want the whole prompt redrawn? It's annoying if conditional
} parts of the prompt evaluate differently causing it to change size.
}
} Would a feature be somehow possible where a fixed set of characters are
} marked for dynamic updating and made easy to update.
This would probably have to be handled like RPROMPT, that is, a separate
expansion. Without doing a lot more screen management/mapping than we
already do, it's not practical to mark a range of PS1 and update only
that ... but if there were a separate "mode prompt" then it could be up
to the user to manage it properly.
(In fact this could probably be hacked by using RPS1 with some %{...%}
sections.)
The question would be where to put the "mode prompt" by default, whether
to allow it to be covered up by multi-line input or completion listings,
etc.
} I'm not sure the keymap name is the most useful indicator for the vi
} mode. local keymaps are not going to be indicated and keymaps like
} menuselect have a longer name.
I think local keymaps would in fact show up if the value were recomputed
upon zle-keymap-select.
My vague idea was to have the value of N in %N(z..) refer to something
about the keymap (where the example I gave is that %0(z) is true if the
"main" keymap is selected and false otherwise). Assign 1 to the emacs
keymap, 2 to viins, 3 to vicmd, etc.; %0(z) and %2(z) might both be true
when main is an alias for viins. Obviously this is not perfect, but I
haven't come up with a less grotesque alternative.
In any case you could then program your prompt to always use a fixed
width string for the mode. The other issue of course is that the mode
is not entirely distinguished by the keymap name; you might also want
to know whether you are in overwrite mode, etc.
} Subtler indicators like cursor shape/colour or something like the
} readline feature are perhaps more useful.
If you have a test like %2(z) then you can program the prompt to change
the color or cursor or whatever instead of inserting the keymap name.
Perhaps having an additional "mode prompt" (PS5 ?) that is output when
something significant (keymap, overwrite, what else?) changes is enough,
leaving it up to the user to include necessary motion escapes if the
string is not simply a color or cursor-shape change. There is still
the flexibility to fiddle around with zle-keymap-select instead if more
complexity is desired.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author