From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2393 invoked by alias); 17 Dec 2014 08:23:21 -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: 33989 Received: (qmail 27173 invoked from network); 17 Dec 2014 08:23:11 -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=HYshxDoSAAAA:8 a=r1kVeiXe2APqkyyGALgA:9 a=CjuIK1q_8ugA:10 a=DjvaZ0A_qZ8A:10 From: Bart Schaefer Message-id: <141217002322.ZM32216@torch.brasslantern.com> Date: Wed, 17 Dec 2014 00:23:22 -0800 In-reply-to: Comments: In reply to Jason Spiro "Fwd: In Vi mode, show whether "insert" or "command" state is active" (Dec 17, 2:13am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Jason Spiro , zsh-workers@zsh.org Subject: Re: Fwd: In Vi mode, show whether "insert" or "command" state is active MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Dec 17, 2:13am, Jason Spiro wrote: } } ---------- Forwarded message ---------- } } Zsh's Vi emulation does not show the user which mode is active. This } is frustrating and confusing. (It's like an electric oven with no } indicator to show whether the oven is on or off.) } } It would be very good if zsh, too, would show the user which mode was } active. You can do this any way you like. I would like it if you did } this by setting the cursor style, just as gVim does. Check out this thread: http://www.zsh.org/mla/users/2013/msg00534.html (Requires ZSH_VERSION > 5.0.3 to avoid an infinite loop bug.) } Here is how to set the cursor style (in supported terminals): } } Set cursor to blinking bar: echo -en "\e[5 q" } Set cursor to blinking block: echo -en "\e[1 q" This should do it for you (note that I don't have a terminal that supports the #5 cursor so this is only partly tested): zle-keymap-select() { case $KEYMAP in (vicmd) print -nR $'\e[5 q';; (viins) print -nR $'\e[1 q';; (*) print -nR $'\e[2 q';; esac } zle -N zle-keymap-select You will also need to run zle-keymap-select from zle-line-init to set up the cursor properly on entry to the editor. } The above commands definitely work in recent versions of iTerm2 (for } Mac OS) and xterm. I haven't tested them in any other terminal } emulators. Surely some terminal emulators do nothing at all in } response to the above control sequences. Gnome-terminal displays garbage characters, so this is not something one can do in general. As far as I can tell even gVim does not have this feature built in, you have to supply some .vimrc coding.