zsh-users
 help / color / mirror / code / Atom feed
* Some questions (menu completion and two-line prompts)
@ 2015-02-18  0:36 Adrian
  2015-02-18  4:04 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Adrian @ 2015-02-18  0:36 UTC (permalink / raw)
  To: zsh-users

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

Hi,

I've finally given ZSH a try and like it so far, but I've noticed a
few things where I wonder if it's possible to change some config
options to improve them.

- I'm using AUTO_MENU so I first get a list of completion candidates
  and then menu selection by pressing tab once again. That's fine, but
  in cases where the candidate list is very long (i.e. doesn't fit on
  the screen), I'd rather get menu selection mode immediately instead
  of having the spam (even with a list-prompt message set it's not
  very helpful information, especially if I'm likely to use
  menu-select afterwards to select something) first.

- I'm using the adam2 prompt style. When resizing my terminal window
  (making it smaller), the pretty horizontal line in the first line of
  the prompt is not redrawn, keeping the old width. When making the
  terminal window larger this is just a minimal annoyance, but when
  making it smaller, this actually deletes the line right before the
  prompt. That feels like a bug to me...


Cheers
Adrian

[-- Attachment #2: Type: application/pgp-signature, Size: 830 bytes --]

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

* Re: Some questions (menu completion and two-line prompts)
  2015-02-18  0:36 Some questions (menu completion and two-line prompts) Adrian
@ 2015-02-18  4:04 ` Bart Schaefer
  2015-02-18 21:12   ` Re[2]: " Adrian
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2015-02-18  4:04 UTC (permalink / raw)
  To: zsh-users

On Feb 18,  1:36am, Adrian wrote:
}
} - I'm using AUTO_MENU so I first get a list of completion candidates
}   and then menu selection by pressing tab once again. That's fine, but
}   in cases where the candidate list is very long (i.e. doesn't fit on
}   the screen), I'd rather get menu selection mode immediately instead

Try something like

    zstyle ':completion:*' menu yes=long select=long

} - I'm using the adam2 prompt style. When resizing my terminal window
}   (making it smaller), the pretty horizontal line in the first line of
}   the prompt is not redrawn, keeping the old width.

There are two factors here.  (1) each prompt style is responsible for
creating its own WINCH trap (the [win]dow [ch]ange signal) and (2) not
all terminal emulators send the signal.  adam2 doesn't define the trap.

The following probably does more work than necessary, but adam2 isn't
factored well for performing just the width computations.

    TRAPWINCH() {
       zle && echo '' && prompt_adam2_precmd && zle reset-prompt
    }

(Without the "echo ''" the prompt climbs the window until it's the only
thing visible.  With it, one blank line is added at the bottom.)


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

* Re[2]: Some questions (menu completion and two-line prompts)
  2015-02-18  4:04 ` Bart Schaefer
@ 2015-02-18 21:12   ` Adrian
  0 siblings, 0 replies; 3+ messages in thread
From: Adrian @ 2015-02-18 21:12 UTC (permalink / raw)
  To: zsh-users

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

Hi

> TRAPWINCH() {
>     zle && echo '' && prompt_adam2_precmd && zle reset-prompt
> }

Thanks, that works perfectly fine!

> } - I'm using AUTO_MENU so I first get a list of completion candidates
> }   and then menu selection by pressing tab once again. That's fine, but
> }   in cases where the candidate list is very long (i.e. doesn't fit on
> }   the screen), I'd rather get menu selection mode immediately instead

> Try something like
>     zstyle ':completion:*' menu yes=long select=long

with that setting I get the correct behavior for cases with a long
list, but in other cases I don't get any menu completion (instead of
the automenu-style completion I was expecting).

In case it matters, thse are my completion-related shellopts:

setopt          ALWAYS_LAST_PROMPT
setopt          AUTO_LIST
setopt          AUTO_MENU
setopt          AUTO_NAME_DIRS
setopt          AUTO_PARAM_KEYS
setopt          AUTO_PARAM_SLASH
unsetopt        AUTO_REMOVE_SLASH
unsetopt        BASH_AUTO_LIST
unsetopt        COMPLETE_ALIASES
setopt          COMPLETE_IN_WORD
unsetopt        GLOB_COMPLETE
setopt          HASH_LIST_ALL
setopt          LIST_AMBIGUOUS
unsetopt        LIST_BEEP
setopt          LIST_PACKED
setopt          LIST_ROWS_FIRST
setopt          LIST_TYPES
unsetopt        MENU_COMPLETE
unsetopt        REC_EXACT

Also, another thing I've noticed, with the following zstyles that
should give me a prettier process list:

zstyle ':completion:*:*:*:*:processes' force-list always
zstyle ':completion:*:*:*:*:processes' menu yes select
zstyle ':completion:*:*:*:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,args -w -w"

This works fine for `kill` or `renice`, but for some reason `strace -p`
uses the custom command , force-list and immediately goes into a menu.
However, it doesn't use the colors. This is the full completion debug
log from ^X? for the strace completion:
https://gist.github.com/ThiefMaster/f8ffa55988e075e4dc10


--
Adrian

[-- Attachment #2: Type: application/pgp-signature, Size: 830 bytes --]

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

end of thread, other threads:[~2015-02-18 21:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-18  0:36 Some questions (menu completion and two-line prompts) Adrian
2015-02-18  4:04 ` Bart Schaefer
2015-02-18 21:12   ` Re[2]: " Adrian

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).