From: Sepp Tannhuber <sepp.tannhuber@yahoo.de>
To: "zsh-users@zsh.org" <zsh-users@zsh.org>
Subject: vi-mode: editor function
Date: Wed, 14 May 2014 21:18:02 +0100 (BST) [thread overview]
Message-ID: <1400098682.27302.YahooMailNeo@web172703.mail.ir2.yahoo.com> (raw)
[-- 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
next reply other threads:[~2014-05-14 20:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-14 20:18 Sepp Tannhuber [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1400098682.27302.YahooMailNeo@web172703.mail.ir2.yahoo.com \
--to=sepp.tannhuber@yahoo.de \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).