* Multiline prompts and vi editing mode
@ 2011-06-01 22:28 Michael Grubb
2011-06-02 2:39 ` Bart Schaefer
0 siblings, 1 reply; 5+ messages in thread
From: Michael Grubb @ 2011-06-01 22:28 UTC (permalink / raw)
To: zsh-users
I'm a brand new user of zsh, I'm thinking of converting from ksh which I'v used for many years now.
I also have used vi editing mode for so long that it is simply second nature and I don't really care to try
and form a new habit. I've also been tinkering with some of the features from oh-my-zsh, specifically some
of the themes that feature multiline prompts. I have noticed however that when hitting Esc to go into command
mode that I'm loosing the last line of output from the previous command. Is this a limitation with multiple line prompts, a setting I need to change, or a bug? Also in ksh I can use Esc-\ to invoke command completion, though that doesn't seem to work with zsh, any tips on getting that configured would also be very much appreciated.
Thanks in advance,
Michael Grubb
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Multiline prompts and vi editing mode
2011-06-01 22:28 Multiline prompts and vi editing mode Michael Grubb
@ 2011-06-02 2:39 ` Bart Schaefer
2011-06-02 4:27 ` Michael Grubb
0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2011-06-02 2:39 UTC (permalink / raw)
To: Michael Grubb, zsh-users
On Jun 1, 5:28pm, Michael Grubb wrote:
} Subject: Multiline prompts and vi editing mode
}
} I've also been tinkering with some of the features from oh-my-zsh,
} specifically some of the themes that feature multiline prompts. I have
} noticed however that when hitting Esc to go into command mode that I'm
} loosing the last line of output from the previous command.
This probably means that there's something in the prompt that should be
wrapped in %{ and %} but is not. Or it may mean that there's a newline
wrapped in %{ and %} that should not be. Zsh generally deals quite well
with multiline prompts.
} Also in ksh I can use Esc-\ to invoke command completion, though that
} doesn't seem to work with zsh, any tips on getting that configured
} would also be very much appreciated.
I suspect you want
bindkey -M viins '\e\\' complete-word
but I'm not certain because no ksh to which I have access behaves that
way, at least not by default.
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Multiline prompts and vi editing mode
2011-06-02 2:39 ` Bart Schaefer
@ 2011-06-02 4:27 ` Michael Grubb
2011-06-02 15:29 ` Michael Grubb
0 siblings, 1 reply; 5+ messages in thread
From: Michael Grubb @ 2011-06-02 4:27 UTC (permalink / raw)
To: Bart Schaefer; +Cc: zsh-users
On 6/1/11 9:39 PM, Bart Schaefer wrote:
> On Jun 1, 5:28pm, Michael Grubb wrote:
> } Subject: Multiline prompts and vi editing mode
> }
> } I've also been tinkering with some of the features from oh-my-zsh,
> } specifically some of the themes that feature multiline prompts. I have
> } noticed however that when hitting Esc to go into command mode that I'm
> } loosing the last line of output from the previous command.
>
> This probably means that there's something in the prompt that should be
> wrapped in %{ and %} but is not. Or it may mean that there's a newline
> wrapped in %{ and %} that should not be. Zsh generally deals quite well
> with multiline prompts.
>
Here is what my PROMPT/PS1 variable looks like:
PROMPT='%m %~
> '
I stripped out all the extra stuff (colors/etc) to make sure that nothing hinky
was happening between the %{ %}. Incidentally, if I do put the newline between
the %{ and %} I get the opposite problem, I get an extra 'top line' instead of
it eating a line.
> } Also in ksh I can use Esc-\ to invoke command completion, though that
> } doesn't seem to work with zsh, any tips on getting that configured
> } would also be very much appreciated.
>
> I suspect you want
>
> bindkey -M viins '\e\\' complete-word
>
> but I'm not certain because no ksh to which I have access behaves that
> way, at least not by default.
>
That bindkey did the trick, thanks! You may have to 'set -o vi ; set -o viraw' to get that to work.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Multiline prompts and vi editing mode
2011-06-02 4:27 ` Michael Grubb
@ 2011-06-02 15:29 ` Michael Grubb
2011-06-02 15:50 ` Bart Schaefer
0 siblings, 1 reply; 5+ messages in thread
From: Michael Grubb @ 2011-06-02 15:29 UTC (permalink / raw)
To: zsh-users
Ok, I found the problem, though I'm not entirely sure what's going on.
As I said before I was using oh-my-zsh, and I was using a plugin called vi-mode.
At the top of this plugin file were these lines:
function zle-line-input zle-keymap-select {
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
bindkey -v
So I remove the plugin from being loaded and do these steps one at a time manually and it turns out
that the 'zle -N zle-keymap-select' line is what is causing my issue.
So now the question is, do I really need these settings? What do I get by setting these over just
doing a set -o vi?
Thanks again for the assistance,
Michael
On 6/1/11 11:27 PM, Michael Grubb wrote:
>
>
> On 6/1/11 9:39 PM, Bart Schaefer wrote:
>> On Jun 1, 5:28pm, Michael Grubb wrote:
>> } Subject: Multiline prompts and vi editing mode
>> }
>> } I've also been tinkering with some of the features from oh-my-zsh,
>> } specifically some of the themes that feature multiline prompts. I have
>> } noticed however that when hitting Esc to go into command mode that I'm
>> } loosing the last line of output from the previous command.
>>
>> This probably means that there's something in the prompt that should be
>> wrapped in %{ and %} but is not. Or it may mean that there's a newline
>> wrapped in %{ and %} that should not be. Zsh generally deals quite well
>> with multiline prompts.
>>
>
> Here is what my PROMPT/PS1 variable looks like:
>
> PROMPT='%m %~
> > '
>
> I stripped out all the extra stuff (colors/etc) to make sure that nothing hinky
> was happening between the %{ %}. Incidentally, if I do put the newline between
> the %{ and %} I get the opposite problem, I get an extra 'top line' instead of
> it eating a line.
>
>> } Also in ksh I can use Esc-\ to invoke command completion, though that
>> } doesn't seem to work with zsh, any tips on getting that configured
>> } would also be very much appreciated.
>>
>> I suspect you want
>>
>> bindkey -M viins '\e\\' complete-word
>>
>> but I'm not certain because no ksh to which I have access behaves that
>> way, at least not by default.
>>
> That bindkey did the trick, thanks! You may have to 'set -o vi ; set -o viraw' to get that to work.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Multiline prompts and vi editing mode
2011-06-02 15:29 ` Michael Grubb
@ 2011-06-02 15:50 ` Bart Schaefer
0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2011-06-02 15:50 UTC (permalink / raw)
To: Michael Grubb, zsh-users
On Jun 2, 10:29am, Michael Grubb wrote:
}
} function zle-line-input zle-keymap-select {
} zle reset-prompt
} }
I presume "input" there should be "init"? Otherwise this --
} zle -N zle-line-init
-- throws an error?
} zle -N zle-keymap-select
}
} bindkey -v
}
} So I remove the plugin from being loaded and do these steps one at a
} time manually and it turns out that the 'zle -N zle-keymap-select'
} line is what is causing my issue.
I'm still not able to reproduce this. The reason for reset-prompt
called via the keymap select hook is to update the prompt to, for
example, display the current vi editing mode, though I don't know
anything about oh-my-zsh or about what plugin you might be trying
to use so I can't say what the exact reason is in this case.
I tend to suspect that this plugin (or some other one) is actually
assigning a new value to PROMPT or PS1 and it's a problem with that
new prompt, displayed when reset-prompt is run, that is causing the
behavior you see.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-06-02 15:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-01 22:28 Multiline prompts and vi editing mode Michael Grubb
2011-06-02 2:39 ` Bart Schaefer
2011-06-02 4:27 ` Michael Grubb
2011-06-02 15:29 ` Michael Grubb
2011-06-02 15:50 ` Bart Schaefer
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).