Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
vi-mode: editor function
- X-seq: zsh-users 18808
- From: Sepp Tannhuber <sepp.tannhuber@xxxxxxxx>
- To: "zsh-users@xxxxxxx" <zsh-users@xxxxxxx>
- Subject: vi-mode: editor function
- Date: Wed, 14 May 2014 21:18:02 +0100 (BST)
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1400098683; bh=jx0UYpKTJYg0FpEYyufPojeyeVA9azOP9T/LoSG2mEo=; h=Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=E7tJpmZ047Vuka+gJBxIc6g7LHCj4CKxJVlv95zYLXRJHUBusIk72+NXCIqk7DXbtYW9tMsUlbD0H9xx4YT4qZMrT6Hu+InaLRrPyjizQkmzK9SxTS04DHKz4jbgO89hBEDS3gofkUqiHOYu33+bpVak3gq5pCGfl6zeAKLspcI=
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Reply-to: Sepp Tannhuber <sepp.tannhuber@xxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author