From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22073 invoked by alias); 26 Dec 2014 19:20:49 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34056 Received: (qmail 18644 invoked from network); 26 Dec 2014 19:20:37 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=PYxIXZlY c=1 sm=1 tr=0 a=FT8er97JFeGWzr5TCOCO5w==:117 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=A92cGCtB03wA:10 a=m127er_-1mTL4a09SdUA:9 a=CjuIK1q_8ugA:10 From: Bart Schaefer Message-id: <141226112101.ZM17094@torch.brasslantern.com> Date: Fri, 26 Dec 2014 11:21:01 -0800 In-reply-to: <27275.1419593532@thecus.kiddle.eu> Comments: In reply to Oliver Kiddle "Re: In Vi mode, show whether "insert" or "command" state is active" (Dec 26, 12:32pm) References: <141221175723.ZM5756@torch.brasslantern.com> <8569631419273880@web5h.yandex.ru> <1441071419539683@web21o.yandex.ru> <141225151837.ZM15719@torch.brasslantern.com> <27275.1419593532@thecus.kiddle.eu> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: "zsh-workers@zsh.org" Subject: Re: In Vi mode, show whether "insert" or "command" state is active MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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.