zsh-users
 help / color / mirror / code / Atom feed
* vi-mode: editor function
@ 2014-05-14 20:18 Sepp Tannhuber
  2014-05-15  1:48 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Sepp Tannhuber @ 2014-05-14 20:18 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 1560 bytes --]

Dear all,

I have written a theme for the oh-my-zsh prompt from robbyrussel because I was 
sometimes confused about the different vi modes. My prompt shows, at a glance,
which vi mode is active, similar to the vim airline plugin.

For the indicators, the theme uses functions like the following:
    vi-insert() {
      MODE="INSERT"                                                                                                           
      builtin zle .vi-insert
    }   
    zle -N vi-insert
    bindkey -M vicmd "i" vi-insert

    vi-replace() {
      MODE="REPLACE"
      builtin zle .vi-replace
    }   
    zle -N vi-replace
    bindkey -M vicmd "R" vi-replace

The MODE variable finally sets the indicator for the prompt.
This works very well, except in the following case. When I call the editor with
    [ESC] [v] 
I can edit the command line with vi, as expected. But after closing the editor,
the zsh prompt is in INSERT mode. It has been in NORMAL mode before. And this is
not considered in my script. Thus, I would like to know, whether there is a
function, equivalent to the ones above. I am looking for something like this:
    vi-editor() {
      MODE="INSERT"                    # prompt is in INSERT mode after editing
      builtin zle .vi-editor
    }   
    zle -N vi-editor
    bindkey -M vicmd "v" vi-editor

Unfortunately I could not find something like vi-editor it in the zshzle manual.
Has anybody an idea what I can use instead? Or what is the default vicmd for [v]?

Best regards
Joseph

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-05-15 14:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-14 20:18 vi-mode: editor function Sepp Tannhuber
2014-05-15  1:48 ` Bart Schaefer
2014-05-15  9:50   ` vi-mode: editor function [solved] Sepp Tannhuber
2014-05-15 11:18     ` Julien Jehannet
2014-05-15 14:32       ` Sepp Tannhuber

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).