From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: off topic
Date: Fri, 9 Dec 2016 16:54:54 -0800 [thread overview]
Message-ID: <161209165454.ZM9226@torch.brasslantern.com> (raw)
In-Reply-To: <584AEDBF.2050402@eastlink.ca>
On Dec 9, 9:45am, Ray Andrews wrote:
} Subject: Re: off topic
}
} On 12/09/2016 08:28 AM, Oliver Kiddle wrote:
}
} Thanks Oliver:
} > There's clear advantages to having a powerful setup that you
} > understand well. If that process now involves "brutality" then you can
} > understand why people might be be happy to just take what they get
} > with oh-my-zsh: and I don't view that as heresy. Oliver
}
} I know I've ranted about this before, but I sure wish there was
} something in between.
I've had the below kicking around for a while, was planning to post it
after 5.3 was out but might as well offer it for comments. This is
mostly specific to completion; it collects what I think are a set of
sensible default settings to make completion "pretty" and informative
without adding so many special-cases that the user gets lost.
It's also designed to be source-able at any point either before or
after the user's own zstyles without stomping on anything.
Some of these are pulled directly from examples in the manual, some
from zsh-newuser-install, others from various suggestions that have
gone by on the mailing lists, etc.
--- 8< --- 8< --- 8< ---
# Safely define default values for assorted completion zstyles
emulate zsh -o extendedglob -c 'default_zstyle() {
local -a patstyle defn
if [[ "$1" = (-e|-|--) ]]
then patstyle=( "$2" "$3" )
else patstyle=( "$1" "$2" )
fi
zstyle -g defn "${patstyle[@]}" || zstyle "$@"
}'
###
autoload -Uz colors && colors
###
default_zstyle ':completion:*' completer \
_expand _complete _ignored _correct _approximate
# General appearance
default_zstyle ':completion:*' menu 'yes=long' 'select=long-list'
default_zstyle ':completion:*' group-name ''
default_zstyle ':completion:*' verbose true
default_zstyle ':completion:*' ignore-parents parent pwd ..
default_zstyle ':completion:*' format '%BCompleting %U%d%u%b'
default_zstyle ':completion:*:messages' format %S%d%s
default_zstyle ':completion:*:warnings' format 'No matches for %U%d%u'
default_zstyle ':completion:*:corrections' format \
'%BCompleting %U%d%u (errors: %e)%b'
# Insert all expansions for expand completer
default_zstyle ':completion:*:expand:*' tag-order all-expansions
# Allow one error for every three characters typed for _approximate
default_zstyle -e ':completion:*:approximate:*' max-errors \
'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )'
# Allow two errors elsewhere, e.g. for _correct
default_zstyle ':completion:*' max-errors 2 numeric
# Double colon here to avoid overriding the value set by "zed"
default_zstyle ':completion::*' insert-tab 'pending=1'
# Matching
# 1. Try completion with no alterations (i.e., literal match is best)
# 2. Match substrings separated by dashes, dots, underscores, commas
# 3. As (2) but case-insensitively
# 4. As (2) but allow arbitrary stuff at the beginning of the result
default_zstyle ':completion:*' matcher-list '' 'r:|[-._,]=** r:|=**' \
'm:{[:lower:][:upper:]}={[:upper:][:lower:]} r:|[-._,]=** r:|=**' \
'r:|[-._,]=** r:|=** l:|=*'
# Offer indexes before parameters in subscripts
default_zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
# Ignore completion functions (until the _ignored completer)
zstyle ':completion:*:functions' ignored-patterns '_*'
# From Oliver Kiddle, users/20372, for process lists
default_zstyle ':completion:*:(kill|lsof|ps|ss):*:' tag-order \
processes:-tty 'processes:-mine:user\ processes' \
'processes:-all:all\ processes'
default_zstyle ':completion:*:([sl]trace|truss|gcore|(ll|g)db):*:' tag-order \
processes:-mine 'processes:-all:all\ processes'
case $OSTYPE in
*bsd*)
default_zstyle ':completion:*:processes' command \
'ps -o pid,ppid,state,start,args'
default_zstyle ':completion:*:processes-mine' command \
"ps U $EUID -o pid,ppid,state,start,args"
default_zstyle ':completion:*:processes-all' command \
"ps A -o pid,ppid,state,start,args"
;;
*)
default_zstyle ':completion:*:processes' command \
'ps -o pid,s,ppid,stime,args'
default_zstyle ':completion:*:processes-mine' command \
"ps -u $EUID -o pid,s,ppid,stime,args"
default_zstyle ':completion:*:processes-all' command \
'ps -e -o pid,s,ppid,stime,args'
;;
esac
# Avoid subverting list-colors, otherwise show-ambiguity reverse-video
default_zstyle -e ':completion:(#b)(*)' show-ambiguity \
'zstyle -T ":completion:$match" list-colors && reply=( ${color[reverse]} )'
next prev parent reply other threads:[~2016-12-10 0:54 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20161209130109epcas2p1fd786d46827852a8cf1badcb5d003ec9@epcas2p1.samsung.com>
2016-12-09 12:29 ` vi mode reset Christian Brabandt
2016-12-09 14:33 ` Ray Andrews
2016-12-09 14:41 ` Peter Stephenson
2016-12-09 14:44 ` Oliver Kiddle
2016-12-09 15:07 ` off topic Ray Andrews
2016-12-09 16:28 ` Oliver Kiddle
2016-12-09 17:45 ` Ray Andrews
2016-12-10 0:54 ` Bart Schaefer [this message]
2016-12-10 2:50 ` Oliver Kiddle
2016-12-10 3:13 ` Bart Schaefer
2016-12-10 3:31 ` Ray Andrews
[not found] ` <95362.1481338226__15466.9970310808$1481338718$gmane$org@hydra.kiddle.eu>
2016-12-11 4:32 ` Daniel Shahaf
2016-12-11 17:07 ` Ray Andrews
2016-12-11 17:19 ` Bart Schaefer
2016-12-11 18:02 ` Ray Andrews
2016-12-11 19:20 ` Bart Schaefer
2016-12-11 20:23 ` Ray Andrews
[not found] ` <584AEDBF.2050402__19991.0537027337$1481307418$gmane$org@eastlink.ca>
2016-12-09 19:24 ` Daniel Shahaf
2016-12-09 20:25 ` Ray Andrews
[not found] ` <584B1325.1010907__10266.7204490446$1481316980$gmane$org@eastlink.ca>
2016-12-10 0:14 ` Daniel Shahaf
2016-12-10 0:21 ` Ray Andrews
2016-12-12 13:11 ` Vincent Lefevre
2016-12-09 15:48 ` vi mode reset Christian Brabandt
2016-12-09 16:46 ` Oliver Kiddle
2016-12-09 20:24 ` Christian Brabandt
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=161209165454.ZM9226@torch.brasslantern.com \
--to=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).