zsh-users
 help / color / mirror / code / Atom feed
From: Jesse Hathaway <jesse@mbuki-mvuki.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: ZSH Users Mailing List <zsh-users@zsh.org>
Subject: Re: Duplicating TRANSIENT_RPROMPT for left PROPMT?
Date: Fri, 25 Oct 2013 10:50:56 -0500	[thread overview]
Message-ID: <CANSNSoUB6pJ=6++7yL=2BUrYLyjDvZ7y6cDERfe_zYWtot9WHQ@mail.gmail.com> (raw)
In-Reply-To: <131023064759.ZM9762@torch.brasslantern.com>

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

On Wed, Oct 23, 2013 at 8:47 AM, Bart Schaefer <schaefer@brasslantern.com>wrote:

> On Oct 22,  4:22pm, Jesse Hathaway wrote:
> }
> } The unusual part of my prompt is the vi mode at the bottom of my screen.
> } Does anyone have thoughts on the best way to clear the prompt before the
> } command is entered?
>
> The best solution to this is to NOT put the vi mode in the prompt, but
> instead use "zle -M" to display it.  Simplest way is like this:
>
> PS1='%~ '
> vim_ins_mode="-- INSERT --"
> vim_cmd_mode=""
>
> function zle-keymap-select {
>
> vim_mode="${${KEYMAP/vicmd/${vim_cmd_mode}}/(main|viins)/${vim_ins_mode}}"
>   zle -M -- "$vim_mode"
> }
> zle -N zle-keymap-select
> zle -N zle-line-init zle-keymap-select
>

Thanks for your suggestions Bart

I tried the zle -M approach, but it seemed to result in my cursor sometimes
being at the bottom of the output, and them sometimes the vim_mode prompt
appearing, i.e. my cursor was jumping up and down.

I ended up adding a preexec which solves the problem:

# Clear vim_mode prompt before executing command, as the command output
will be
# written to same line as the vim_mode prompt on the terminal
function preexec {
  echo -n "$terminfo[el]"
}


> This and your original scheme both seem to suffer from the problem that
> any completion listing covers up the "mode message" and it doesn't return
> until you toggle through command/insert again.


Yeah this is definitively not great, I spent some time trying to determine
how to solve the problem, but I haven't come up with anything yet. I would
love suggestions. I couldn't find any hooks to use when suggestions fire. I
am also considering diving into the zsh source and look into adding proper
support for a BOTTOM_PROMPT.

Thanks, Jesse

  reply	other threads:[~2013-10-25 15:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22 21:22 Jesse Hathaway
2013-10-23 13:47 ` Bart Schaefer
2013-10-25 15:50   ` Jesse Hathaway [this message]
2013-10-25 17:23     ` Bart Schaefer
2013-10-29 18:11       ` Jesse Hathaway
2013-10-30  6:19         ` Bart Schaefer
2013-10-30 18:01           ` Jesse Hathaway
2013-10-30 18:51             ` Bart Schaefer
2013-10-31 14:07               ` Jesse Hathaway
2013-10-31 15:09                 ` Bart Schaefer
2013-10-31 18:01                   ` Jesse Hathaway
2013-11-01  1:33                     ` Bart Schaefer
2013-11-01 20:10                       ` Jesse Hathaway

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='CANSNSoUB6pJ=6++7yL=2BUrYLyjDvZ7y6cDERfe_zYWtot9WHQ@mail.gmail.com' \
    --to=jesse@mbuki-mvuki.org \
    --cc=schaefer@brasslantern.com \
    --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).