From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2782 invoked by alias); 25 Dec 2014 20:46:45 -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: 34051 Received: (qmail 15296 invoked from network); 25 Dec 2014 20:46:41 -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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, T_FSL_HELO_BARE_IP_2 autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1419539683; bh=Dz2H4XV3YvVy8Im2qVGhC10ZFG0shpaGf5dH9sRPZ1s=; h=From:To:Cc:In-Reply-To:References:Subject:Date; b=YzJK/ojsYIqZsQkHb+OV2uQNMeX3WupLkrujDQ1h/fOL532fhOa3clP0wW+hMd+eW JYP6YbHDBjZ+tZDnyoamPkkYrPg9oLUbETg+FZ0I8rHKs3QabODe/J1PT6dV0v2Y6S /4fvS0l6wExMJmz5sekHjlVU+KvLRlJulllEPfpU= From: ZyX To: Jason Spiro Cc: "zsh-workers@zsh.org" In-Reply-To: References: <141221175723.ZM5756@torch.brasslantern.com> <8569631419273880@web5h.yandex.ru> Subject: Re: In Vi mode, show whether "insert" or "command" state is active MIME-Version: 1.0 Message-Id: <1441071419539683@web21o.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Thu, 25 Dec 2014 23:34:43 +0300 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=koi8-r 25.12.2014, 07:16, "Jason Spiro" : > On Mon, Dec 22, 2014 at 1:44 PM, ZyX wrote: >> šAnd this should be changed prompt/rprompt, not changing >> šcursor because changing cursor shape is less likely to work > > OK. šYou could do things the same way Bash's brand-new > 'show-mode-in-prompt' feature does things: šyou could add one extra > character to the beginning of the prompt. šA colon in vicmd mode; a > plus sign in viins mode. > > This should work reliably in every terminal emulator. I have read that this is readline 6.3 feature that has nothing to do with bash except that bash is using readline. Also [vicmd]/[viins] variant is clearer then colon and plus and also in case of %z one should not assume only vicmd/viins: zle is not as limited as readline and theoretically allows any number of modes (have never seen them actually implemented though). --- Also regarding %z minimal implementation: in my example code $KEYMAP is checked for being an alias to something. Most likely your variant will make %z disappear in `viins` mode (as it is linked to main and if I am not mistaking exiting vicmd will bring up the main keymap) and in my variant it definitely (I have tested this with `zsh -f`) will show either `vicmd` or `viins` effectively avoiding changing prompt width which may be confusing.