zsh-users
 help / color / mirror / code / Atom feed
* Always display prefix, even if unambiguous?
@ 2014-12-27 21:37 Aleksandrina Nikolova
  2014-12-29  3:55 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Aleksandrina Nikolova @ 2014-12-27 21:37 UTC (permalink / raw)
  To: Zsh Users

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

Greetings! I don't know if this counts as a bug or I've overlooked 
something, but I can't figure out how to make zsh's compsys to always 
display the full path when completing filenames, for example:

ls /usr/s/l<TAB> generates:
*files:**
**sbin/ldattach* sbin/lpadmin*             sbin/lshw* 
share/libbluray/          share/liblangtag/ share/llvm/               
src/linux@ **
**sbin/locale-gen* sbin/lpc*                 sbin/lspci* 
share/libexttextcat/      share/libquvi-scripts/ 
share/locale/             src/linux-3.17.7-gentoo/**
**sbin/logoutd* sbin/lpinfo*              share/lcdf-typetools/ 
share/libidn/             share/librarian/ share/log4j/ **
**sbin/logrotate* sbin/lpmove*              share/lftp/ 
share/libjpeg-turbo/      share/libtool/            share/lshw/ *

which is fine. If I add the file-pattern style:
zstyle ':completion:*' file-patterns '*(-^/):files:file 
*(-/):directories:directory' to separate files from dirs, I get:
*file:**
**ldattach*         locale-gen* logoutd*          logrotate*        
lpadmin* lpc*              lpinfo*           lpmove* lshw*             
lspci* **
**
**directory:**
**share/lcdf-typetools/ share/libexttextcat/      share/liblangtag/ 
share/libtool/            share/log4j/ src/linux-3.17.7-gentoo/ **
**share/lftp/ share/libidn/             share/libquvi-scripts/ 
share/llvm/ share/lshw/ **
**share/libbluray/ share/libjpeg-turbo/      share/librarian/ 
share/locale/             src/linux@ *

i.e. it does not list the directory of the files, because they are all 
in sbin and zsh seems to treat the dirs and files completion separately 
now. If I complete something like
ls /etc//a<TAB> I get:*
**file:**
**acpi/ati-powermode.sh* ati/amdpcsdb.default        conf.d/acpid 
conf.d/atieventsd           init.d/atd* mail/aliases.db             
pam.d/atd **
**at/at.deny ati/authatieventsd.sh*      conf.d/alsasound 
init.d/acpid*               init.d/atieventsd* 
modprobe.d/aliases.conf     security/access.conf **
**ati/amdpcsdb at-spi2/accessibility.conf  conf.d/atd 
init.d/alsasound*           mail/aliases modprobe.d/alsa.conf **
**
**directory:**
**acpi/actions/ lvm/archive/ ssl/apache2/ 
terminfo/a/                            xdg/autostart/*

the full path (relative to the unambiguous prefix /etc) is listed for 
both files and dirs, since the paths are ambiguous in both cases.

I hope I made myself clear. How can I "fix this"?

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

* Re: Always display prefix, even if unambiguous?
  2014-12-27 21:37 Always display prefix, even if unambiguous? Aleksandrina Nikolova
@ 2014-12-29  3:55 ` Bart Schaefer
  2014-12-29  8:56   ` Aleksandrina Nikolova
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2014-12-29  3:55 UTC (permalink / raw)
  To: Zsh Users

On Dec 27, 11:37pm, Aleksandrina Nikolova wrote:
}
} I hope I made myself clear. How can I "fix this"?

You haven't made yourself entirely clear because there must be some
zstyle values or other settings that get you to the situation you have
so far.  For example, I can't get anything even close to your example
output without at least "setopt globcomplete".

However, I *think* the answer to your question is "you can't."  The
_path_files completion function unconditionally passes the -p (hide
prefix) option to "compadd" with the longest unambiguous directory
path of every file name that it finds.  

I thought perhaps the "fake" style could be caused to create a false
ambiguity that would get you what you wanted, but I haven't managed
to formulate a working example.


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

* Re: Always display prefix, even if unambiguous?
  2014-12-29  3:55 ` Bart Schaefer
@ 2014-12-29  8:56   ` Aleksandrina Nikolova
  0 siblings, 0 replies; 3+ messages in thread
From: Aleksandrina Nikolova @ 2014-12-29  8:56 UTC (permalink / raw)
  To: zsh-users

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

Sorry about this, I'm attaching the relevant (and maybe some irrelevant) 
parts of my .zshrc
I changed from using file-patterns to simply list-dirs-first, which 
seems to have the same effect (without allowing me to manually specify 
tags and desciptions). In any case, if anyone has an idea for a 
workaround, I'd love to hear it

On 29/12/14 05:55, Bart Schaefer wrote:
> On Dec 27, 11:37pm, Aleksandrina Nikolova wrote:
> }
> } I hope I made myself clear. How can I "fix this"?
>
> You haven't made yourself entirely clear because there must be some
> zstyle values or other settings that get you to the situation you have
> so far.  For example, I can't get anything even close to your example
> output without at least "setopt globcomplete".
>
> However, I *think* the answer to your question is "you can't."  The
> _path_files completion function unconditionally passes the -p (hide
> prefix) option to "compadd" with the longest unambiguous directory
> path of every file name that it finds.
>
> I thought perhaps the "fake" style could be caused to create a false
> ambiguity that would get you what you wanted, but I haven't managed
> to formulate a working example.


[-- Attachment #2: zshrc --]
[-- Type: text/plain, Size: 3995 bytes --]

######## COMPLETION, EXPANSION & MATCHING #########

autoload -Uz compinit
compinit
zmodload -i zsh/complist

zstyle ':completion:*' completer _expand _complete _prefix _complete:-separators _match _ignored _approximate
zstyle ':completion:*:expand:*' add-space true
zstyle ':completion:*:prefix:*' add-space false
zstyle ':completion:*' accept-exact false
zstyle ':completion:*' accept-exact-dirs false
zstyle ':completion:*:paths' ambiguous true
zstyle ':completion:*' insert-tab false
zstyle ':completion:*' insert-unambiguous true
zstyle ':completion:*' last-prompt true
zstyle ':completion:*' list-dirs-first true
zstyle ':completion:*' list-grouped true
zstyle ':completion:*' list-packed true
zstyle ':completion:*' list-suffixes true
zstyle ':completion:*' original true
zstyle ':completion:*' path-completion true
zstyle ':completion:*' rehash true
zstyle ':completion:*' remove-all-dups true
zstyle ':completion:*' prefix-hidden false
zstyle ':completion:*' squeeze-slashes false
zstyle ':completion:*' expand suffix
zstyle ':completion:*' fake-parameters 'DISPLAY:scalar'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' list-colors ${(s.:.)~~LS_COLORS}
zstyle ':completion:*' list-prompt %Smatch %M, line %L: Hit '<TAB>' for more, or the character to insert%s
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' menu select=2
zstyle ':completion:*' auto-description true
zstyle ':completion:*' verbose true
zstyle ':completion:*' word false
zstyle ':completion:*:auto-describe' format 'specify: %d'
zstyle ':completion:*:descriptions' format '
%F{cyan}%B%d:%b%f'
zstyle ':completion:*:-command-:*' completer _expand _complete _prefix _match _approximate _history _ignored
zstyle ':completion:*:-command-:*' group-order aliases functions builtins commands
zstyle ':completion:*:-command-:*' tag-order "commands aliases suffix-aliases builtins functions:-non-ignored reserved-words" parameters functions -
zstyle ':completion:*:functions-non-ignored' ignored-patterns '_*'
zstyle ':completion:*:complete:*' matcher-list '' 'r:|[._-]=** r:[^[:upper:]0-9]||[[:upper:]0-9]=** r:|=** l:|=**' '+m:{[:lower:][:upper:]}={[:upper:][:lower:]}'
zstyle ':completion:*:approximate:*' max-errors 1 numeric
zstyle ':completion:*:correct:*' max-errors 3 numeric
zstyle ':completion:*:expand:*' glob true
zstyle ':completion:*:expand:*' substitute true
zstyle ':completion:*:expand:*' suffix true
zstyle ':completion:*:expand:*' tag-order expansions
zstyle ':completion:*:prefix:*' completer _complete
zstyle ':completion:*:match:*' match-original true
zstyle ':completion:*:ignore:*' single-ignored menu
zstyle ':completion:*:cd:*' tag-order local-directories "path-directories named-directories directory-stack users"
zstyle ':completion:*:((*-|)files|(*-|)directories)' ignored-patterns '.*'
zstyle ':completion:*:jobs' prefix-needed false
zstyle ':completion:*:jobs' numbers true
zstyle ':completion:*:processes' list-colors '=(#b) #([0-9]#)*=0=01'
zstyle ':completion:*:processes' insert-ids single
(( $UID )) && zstyle ':completion:*:processes' command "ps -u $USER" \
		     || zstyle ':completion:*:processes' command 'ps -e'
zstyle ':completion:*:sudo::' environ PATH="/sbin:/usr/sbin:$PATH" HOME="/root"
zstyle ':completion:*' complete true		# _expand_alias
zstyle ':completion:*' complete-options false	# cd, pushd
zstyle ':completion:*' stop true		# _history_complete_word

setopt autocd cdablevars chasedots chaselinks

setopt completeinword
unsetopt autoremoveslash listtypes

setopt braceccl cshnullglob extendedglob globassign globdots globsubst numericglobsort rcexpandparam rematchpcre

################ ZLE & GENERAL ZSH ################
typeset -g ZLE_REMOVE_SUFFIX_CHARS=$' \t\n'
typeset -g WORDCHARS=¬\`\|@\&\^%\$£\"\'\#_\*=+-\?.\!,\;:\<\>/\\\[\]\{\}\(\)
typeset -ga zle_highlight
zle_highlight=(region:standout special:bold,fg=red suffix:bold isearch:underline)

setopt interactivecomments promptsubst rcquotes

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

end of thread, other threads:[~2014-12-29  8:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-27 21:37 Always display prefix, even if unambiguous? Aleksandrina Nikolova
2014-12-29  3:55 ` Bart Schaefer
2014-12-29  8:56   ` Aleksandrina Nikolova

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