[zsh] netcfg completion
I wrote a small completion addon for zsh/netcfg.
Hope it helps.
#compdef netcfg
local expl list intf sep
local -a disp
case $OSTYPE in
aix*)
intf=( ${(f)"$(lsdev -C -c if -F 'name:description')"} )
if zstyle -T ":completion:${curcontext}" verbose; then
zstyle -s ":completion:${curcontext}:" list-separator sep || sep=--
zformat -a list " $sep " "$intf[@]"
disp=(-ld list)
fi
darwin*|freebsd*|dragonfly*) intf=( $(ifconfig -l) ) ;;
irix*) intf=( ${${${(f)"$(/usr/etc/netstat -i)"}%% *}[2,-1]} ) ;;
linux*) intf=( /proc/sys/net/ipv4/conf/*~*(all|default)(N:t) ) ;;
*) intf=( $(ifconfig -a|sed -n 's/^([^ :]*).*/1/p') ) ;;
esac
_arguments -C
'(--menu --stop --stopall)-c[Dont reconfigure an interface if its already up]:profile:->profilelist'
'(--menu --stopall -c *)--stop[Stops an interface]:interface:->interfaces'
'(-c --stop --stopall *)--menu[Display the menu]:timeout:->menuopt'
'(-c --stop --menu *)--stopall[Stops all interfaces]'
'*:profile:->profilelist'
if [[ "$state" = profilelist ]]; then
_description path_files expl 'Netwok Profiles'
_path_files "$expl[@]" -W '/etc/network-profiles' -g '*~*template'
fi
if [[ "$state" = menuopt ]]; then
_arguments -C
'--timeout:integer'
fi
if [[ "$state" = interfaces ]]; then
_wanted interfaces expl 'network interface' compadd "$@" "$disp[@]" - "${(@)intf%%:*}"
fi
2 years later...
I updated this script so that it works with netcfg2. Please be gentle, it's my very first attempt to write a zsh completion function
#compdef netcfg netcfg2=netcfg
local -a disp
_arguments -C \
'(-a -d -i)-c[Do not start profile if interface is already up]' \
'(-a -i)-d[Take specified profile down]:Active profiles:_files -W "/var/run/network/profiles"' \
'(-c -d -i *)-a[Take all active profiles down]' \
'(-a -c -d)-i[Take down profile active on specified interface]:Active interfaces:_files -W "/var/run/network/interfaces"' \
'*:Network profiles:_path_files -W "/etc/network.d" -g "*(.)"'
Hope it helps.
Similar Messages
-
A long while ago, I found a set of functions for zsh tab-completion for pacman in the Arch mailing list archives. I've improved them recently to make it faster (reading files from /var/lib/pacman instead of calling pacman itself).
Anyway, you can find my version in the AUR: zsh-pacman
enjoy!shadowhand wrote:
Been using zsh-pacman for a while, works great, but I'm having some issues with your netcfg completions, stuff like this:
02:14:14 %] iwconfig [~]
_arguments:comparguments:208: invalid argument: device[device]
This is strange i cant reproduce this bug. Any details ?
Just for informations:
zsh --version ~
zsh 4.2.6 (i686-pc-linux-gnu) -
Zsh modutils completion (solved & bug report)
Hi,
Since last zsh update, I can't get 'modinfo' & 'modprobe' completion, only 'rmmod' & 'modprobe -r' are working actually (easy with '/proc/modules'). It seems that a new caching algorithm was implemented in the last version but I don't understand it . Diff with zsh 4.3.11 _modutils :
--- Sources/zsh-4.3.11/Completion/Linux/Command/_modutils 2009-07-14 10:57:13.000000000 +0200(B
+++ /usr/share/zsh/functions/Completion/Linux/_modutils 2011-06-02 13:02:04.000000000 +0200(B
@@ -1,8 +1,23 @@(B
#compdef lsmod modinfo modprobe rmmod insmod
+_modules_caching_policy()(B
+{(B
+ # Rebuild every week, or if $modules_dir is newer than the cache(B
+ local -a oldp(B
+(B
+ oldp=( "$1"(Nmw+1) )(B
+ (( $#oldp )) || [[ $modules_dir -nt $1 ]](B
+}(B
+(B
local curcontext="$curcontext" expl state line modules ign args ret=1
local -r modules_dir=/lib/modules
+local update_policy(B
+zstyle -s ":completion:*:*:$service:*" cache-policy update_policy(B
+if [[ -z "$update_policy" ]]; then(B
+ zstyle ":completion:*:*:$service:*" cache-policy _modules_caching_policy(B
+fi(B
+(B
args=(
'(-)'{-V,--version}'[print version]'
'(-)'{-h,--help}'[print help text]'
@@ -39,6 +54,7 @@(B
"(-v --verbose $ign)"{-v,--verbose}'[print all commands as executed]' \
'(-C --config)'{-C,--config}'[specify config file]:config file:_files' \
"(-r --remove -l --list -t --type -a --all $ign)"{-r,--remove}'[remove module (stacks)]' \
+ "(-l --list -t --type -a --all $ign)"{'-i[ignore install/remove commands in config file]','--ignore-install[ignore install commands in config file]','--ignore-remove[ignore remove commands in config file]'} \(B
"(* -l --list -r --remove $ign)"{-l,--list}'[list matching modules]' \
"(-c $ign)1:modules:->loadable_modules" \
"(-c -l --list -t --type $ign)*:params:->params" && ret=0
@@ -87,7 +103,13 @@(B
else
kver=$(uname -r)
fi
- modules=( $modules_dir/$kver/(*~(source|build))/**/*(.:t:r) )(B
+ if [[ -z $modules ]] && ! _cache_invalid modules-$kver && \(B
+ ! _retrieve_cache modules-$kver;(B
+ then (B
+ # 2011-01-02 gi1242: Do we need .o files? Or is .ko enough?(B
+ modules=( $modules_dir/$kver/(*~(source|build))/**/*.(o|ko)(.:t:r) )(B
+ _store_cache modules-$kver modules(B
+ fi(B
if [[ $state = loadable_modules ]]; then
modules=( ${modules:#(${(j:|:)~${=loaded_modules//_/-}})} )
Last edited by Drexya (2011-06-13 01:46:34)Wow, thanks it works, but there's a problem, modules appears with *.ko suffix so
modules=( $modules_dir/$kver/(*~(source|build))/**/*.(o|ko|ko.gz)(.:t:r:r) )
is even better .
taken from http://zsh.sourceforge.net/Guide/zshguide05.html :
print ${p:t:r}
will work for both arrays and scalars: the :t takes only the tail of the filename, stripping the directories, and the :r removes the suffix. These two operators could have slightly unexpected effects in versions of zsh before 4.0.1, removing `suffixes' which contained directory paths, for example (though this is what the pattern forms taken separately do, too).
bug report
Last edited by Drexya (2011-06-13 01:45:45) -
[Solved] ZSH auto-completion in BASH?
Hi everyone, I'm using BASH but I really like the way ZSH handles auto completion. For instance, in BASH, if I type vi and press [Tab], it shows my possible options but my cursor makes a new line. Therefore, if I press [Tab] again, the same thing will be created over and over. What I like about ZSH auto-completion is that when I press tab, the auto-completion fills the screen, but my cursor doesn't jump to a new line. Therefore, the actual output of the command and the [Tab] auto-completion output occupy the same space. Does anyone know a way I could have BASH perform in a way similar to this?
Thanks!
Last edited by Spara06 (2014-08-30 20:03:52)jasonwryan wrote:
Not as far as I know: this is all down to zle http://zsh.sourceforge.net/Doc/Release/ … dgets.html
If you want this, just use Zsh (it has all sorts of other advantages as well).
Thanks for your reply jasonwryan.
I'm trying out zsh thus far and I'm liking it. It's rather easy to use and has most of the good features of BASH as well as some other nice ones I didn't have before (including the way it does tab completion and right side prompts).
Thanks! -
I just started using zsh last night, and so I'm not quite sure how a few things work with completion, particularly in combination with sudo.
'sudo ' followed by a path autocompletes, but 'sudo fire<tab>' doesn't. If I drop into a root shell with sudo -s, then 'fire<tab>' *does* complete, although I think that has to do with the fact that I'm using sudo, rather than su.
As a side note, how would I go about defining my prompt differently for root, when I'm not actually using su?I used to use aliases, but I like qfi better because adding and changing shortcuts is faster, and I don't have to restart all of my shells afterwards. It also keeps the files in a separate namespace, so, if I want shortcuts to a lot of different files, I don't have to worry about overriding actual commands. Also, if I forget the exact name of the target, I can just use tab-completion, which I couldn't do with aliases, because I would get a huge list of results.
Speaking of aliases, I have qfi aliased to q and I have "pac" as a target to "/etc/pacman.conf" so I can just type
$ q pac
to open up that file. It's only three more characters, and I get the aforementioned benefits. I could also just make it "p", so I could just run:
$ q p
By the way, surfraw looks like a pretty nifty project, I'll have to look into it. Thanks! -
[SOLVED] From bash to zsh :: history completion search
Hey folks,
I'm switching from bash to zsh but I miss a feature and I don't know how to implement it on zsh.
On bash, in my .inputrc I have :
"\e[A":history-search-backward
"\e[B":history-search-forward
What it does is it searches in the history of commands to complete when you do up arrow.
I'm not sure I'm clear so here is an exemple :
$nano pouet
$pwd
then if I do
$na
and type arrow up it gives me
$nano pouet
Without this tremendously important feature it gives me
$pwd
So, how can I have the same in zsh ?
Regards,
~ktr
Last edited by Kooothor (2010-05-06 09:06:51)The info is on the man page. The widget are history-beginning-search-backward and history-beginning-search-forward
use bindkey, e.g.
bindkey '\e[A' history-beginning-search-backward
bindkey '\e[B' history-beginning-search-forward -
[solved]zsh history completion not matching after first word?
Hi!
I just switched to zsh some days ago and I can't get the history search completion working like it's used to work with bash (history-search-backward / history-search-forward)
I installed grml-zsh-config, tried to rewrite most of my .bashrc to work with zsh... read a lot of man pages and changed some settings (and broke some random things... and un-broke most of them again)...
Now when I enter p.e.:
$ sudo tes
...and press the up/down arrows, it keeps the "sudo" but not the "tes" - it goes trough all commands that I called with sudo. Seems to behave the same way for other commands - keeps the first word, ignores everything else I typed.
No idea what this is called, what it's good for or how to change it.
Where do I look for this?
Last edited by whoops (2012-12-01 19:09:52)^ I've not used that, so I can't say whether or not my solution is better or worse. However, I suggest using "up-line-or-beginning-search"/"down-line-or-beginning-search", as described in zshall:
up-line-or-beginning-search, down-line-or-beginning-search
These widgets are similar to the builtin functions up-line-or-search and
down-line-or-search: if in a multiline buffer they move up or down within the buf‐
fer, otherwise they search for a history line matching the start of the current
line. In this case, however, they search for a line which matches the current line
up to the current cursor position, in the manner of history-beginning-search-back‐
ward and -forward, rather than the first word on the line.
From my .zshrc:
autoload up-line-or-beginning-search
autoload down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey "\e[A" up-line-or-beginning-search
bindkey "\e[B" down-line-or-beginning-search -
$ zsh -f
$ autoload -U compinit
$ compinit
$ zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
now here's the problem:
$ defaults read com.apple.S<tab> offers a number of completions, but
$ defaults read com.apple.s<tab> crashes the shell.
apparently case-insensitive matching can't coexist with the partial-completion matching used in the _defaults function (removing the latter solved the problem). so i'm wondering if my mac just isn't powerful enough to handle this or (if other people can reproduce this) it's a _defaults function bug.
zsh 4.2.6It seems the problem can be reproduced (on MacOSX and Linux) by the following procedure:
Create a file _mycmd in $HOME/.zsh/functions/ (or anywhere in your FPATH) with the following contents:
#compdef mycmd
_mydomains() {
local -a list
local expl
list=( a.b.Cx a.b.cy a.b.cz )
_wanted domains expl domain compadd -M 'r:|.=* r:|=*' -a list
_arguments '*:domains:_mydomains'
and start a new zsh
% zsh -f
zsh% FPATH=$HOME/.zsh/fuctions:$FPATH
zsh% autoload -U compinit; compinit
zsh% zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
zsh% mycmd a.b.c<TAB>
If you hit <TAB>, zsh hangs and eventually core dumps after few seconds (or minutes). This happens on (at least) Tiger, Leopard and Linux (Fefora7).
As ra5ul writes, the core dump does not occur
if "zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'" is not run, or
if "-M 'r:|.=* r:|=*'" is omitted from _mycmd, or
if the value of "list" is changed to either of
list=( a.b.Cx a.b.cy )
list=( a.b.cx a.b.cy a.b.cz )
list=( b.Cx b.cy b.cz )
I have posted a bug report to zsh-workers mailing list. -
Systemctl (systemd) zsh autocomplete
Has anyone created a zsh command completion script for systemctl? If so, would you mind sharing on the AUR?
In my mind, it should work like so:
systemctl en[TAB] wic[TAB]
#evaluates to
systemctl enable wicd.service
systemctl rest[TAB] get[TAB][TAB]
#evaluates to
systemctl restart getty@tty
[email protected] [email protected] (etc)
For {COMMAND}, it should obviously expand to list-units, start, stop, reload, restart, try-restart, reload-or-restart, reload-or-try-restart, isolate, kill, is-active, status, show, reset-failed, enable, disable, is-enabled, load, list-jobs, cancel, monitor, dump, dot, snapshot, delete, daemon-reload, daemon-reexec, show-environment, set-environment, unset-environment, default, rescue, emergency, halt, poweroff, reboot, kexec, or exit.
As for [NAME...], it's gonna be a lot more complicated. Depending on the COMMAND, it should search through the relevant files in /lib/systemd/system/ and /etc/systemd/system, or the currently enabled services, or the currently running services, etc.
If nobody's made/in the process of making something like this, I'll give it a go when I have the time. Although I'd probably just focus on the start, restart, stop, enable, disable, poweroff and reboot, since those are the only commands I use.Awesome, thanks. I did make a start on my own, but I couldn't get it to work properly. You might want to write up a PKGBUILD and submit it to the AUR so more people can find it (here's the PKGBUILD I wrote up to install it on my PC, which'll save you ~20 seconds of writing).
AUR submission instructions are here. -
whenever I open zsh, I get this error message:
/home/InfinityDweller/.oh-my-zsh/lib/completion.zsh:37: command not found: hostname
I have no clue why it can't find hostname info...
My first thought was rc.conf and hosts
# HOSTNAME: Hostname of machine. Should also be put in /etc/hosts
HOSTNAME="Quasar"
#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost Quasar
::1 localhost.localdomain localhost
any help at all would be appreciated!
Last edited by InfinityDweller (2011-08-10 22:46:51)kfl62 wrote:
Warning: hostname utility moved from net-tools to inetutils . Now to avoid strange behavior in zsh, must:
pacman -Syu inetutils
Oh come on, it's in the news, are we going to "update" every thread about net-tools, zsh, xorg-server etc.? Arch is a rolling release, things change every day - just because it worked yesterday doesn't mean it will still work today. -
Zsh 4.3 and multibyte support
I compiled zsh-4.3.0-dev-2 with --enable-multibyte
How do I test to see if it is working?I got a very detailed reply from Peter Stephenson. If anyone feels like testing this, please let me know of the outcome and I will send it to him.
That's a good point. I suppose this could go into the FAQ, so please
correct any bits I've got wrong.
Multibyte support is compiled in if the line
#define MULTIBYTE_SUPPORT 1
appears in config.h. If you don't have the source, you could try
running
(bindkey -m)
and see if you get a warning message about doing this with multibyte
enabled. (The parentheses protect you from the results.)
% (bindkey -m)
bindkey: warning: `bindkey -m' disables multibyte support
To test it, you need an appropriate environment:
(1) a locale with multibyte characters. Unless you already know that
you need a different character set, look for a variant of your usuallocale with UTF-8 in it. Nowadays it's quite possible $LANG is already
set to a UTF-8 locale. For example, mine is en_GB.UTF-8; en_US.UTF-8 is
an obvious one. zsh will complete locales on assignment to the variable
LANG, so
export LANG=^D
will show possible values. A reasonable modern Unix distribution should
let you set this up consistently for your desktop environment, but
exporting the variable, then starting a suitable terminal emulator is
enough to get things going.
(2) a corresponding font. If you use an old-style X font with lots of
dashes, you need one with iso10646-1 at the end (not, for example,
iso8859-1). If your terminal emulator allows you to pick fonts from a
menu, it's probably smart enough to match the character set to the
locale and you can forget about this.
(3) a terminal emulator that handles multibyte mode. I've had mixed
results with xterm, possibly out of ignorance. gnome-terminal is the
best I've tried but I haven't searched too far. (This is the sort of
thing Apple will almost certainly have got right in whatever they
provide.)
Once zsh is running in this environment, you need to be able to enter
multibyte characters.
If your keyboard provides such characters, don't use the "bindkey -m"
option, which treats the high bit in 8-bit characters as if it were an
escape character. A shell with multibyte enabled will warn if you set
the option. You can remove all meta bindings with:
bindkey -L | grep '\\M' |
sed -e '/^bindkey \(-R \|\)"\\M/s/[^ ]*$/undefined-key/' |
while read -r line; do eval $line; done
(that's the simplest I could come up with; the shell doesn't provide a
direct antidote), but that doesn't seem to undo the effect completely,
so there may be a bug lurking.
There are two zle widgets provided with 4.3 to allow you to enter
characters not on the keyboard; load them in the normal way with
autoload -Uz insert-unicode-char insert-composed-char
zle -N insert-unicode-char
zle -N insert-composed-char
Bind them with bindkey as appropriate. They're described in the
zshcontrib manual page.
insert-unicode-char takes the Unicode value for the character as
a hex number (execute the widget before and after the hex number).
insert-composed-char is followed by a more memorable two-character
mnemonic described in RFC 1345, http://www.faqs.org/rfcs/rfc1345.html,
for various accented characters, non-Latin European and related character sets, and special characters such as punctuation and
mathematical symbols. For example, try cH and see if you get a playing
card heart. Not all of RFC 1345 is implemented but it's easy to extend
the function.
Ideally, editing with multibyte characters should behave identically to
editing with ASCII, even if the characters have double width. There's
one bug in cd listings reported by Mikael Magnusson in zsh-users/9741
that hasn't been looked at yet, but mostly it seems to be working OK.
It's taken me six years until I can use the Euro character that came
on my keyboard directly in zsh, but it's quite satisfying... -
Zsh compinit:375: parse error near '('
Hello,
I've just installed Zsh, and it crashes on login with the following error:
compinit:375: parse error near ‘(’
repeated three times. The appropriate line in /usr/share/zsh/functions/Completion/compinit is this:
if [[ $1 = (#b)(*)=(*) ]]; then
I haven't modified the file in any way.
Compinit is loaded from my ~/.zshrc as follows:
autoload -U compinit && compinit
Help, please?Here it is. Generally, it's based on the advice in the wiki.
# BEHAVIOUR =============================================================================
# don't know
autoload p
typeset -A key
zstyle :compinstall filename '/home/kamil/.zshrc'
# autojump
. /etc/profile
. /etc/profile.d/autojump.zsh
# autoloads
autoload -U colors && colors
autoload -U compinit && compinit
autoload -U promptinit && promptinit
# history
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
# keys
stty -ixon -ixoff # free ctrl-s for use in Vim
bindkey -e # emacs mode
key[End]=${terminfo[kend]}
key[Home]=${terminfo[khome]}
key[Down]=${terminfo[kcud1]}
key[Up]=${terminfo[kcuu1]}
[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" history-beginning-search-forward
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" history-beginning-search-backward
bindkey ';5D' backward-word # ctrl-left
bindkey ';5C' forward-word # ctrl-right
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
function zle-line-init () { printf '%s' "${terminfo[smkx]}" }
function zle-line-finish () { printf '%s' "${terminfo[rmkx]}" }
zle -N zle-line-init
zle -N zle-line-finish
fi
# prompt
PROMPT="
%~ %{$fg[green]%}%# %{$reset_color%}"
RPROMPT="%?"
# setopts
setopt extendedGlob
setopt hist_ignore_dups
setopt interactivecomments
setopt noflowcontrol
### ALIASES =============================================================================
alias dzen='dzen2 -bg $colBgNormal -fg $colFgNormal '
alias pacman='sudo pacman'
alias cal='cal -m' # -m: monday's the first day
alias cp='cp -iv' # -i: ask before overwriting; -v: verbose
alias emacs='emacs -nw' # the terminal version
alias grep='grep --color=auto -in' # -i: case-insensitive; -n: line numbers
alias locate='locate -i' # -i: case-insensitive
alias ls='ls --color=auto -C' # -C: columns
alias mv='mv -iv' # -i: ask before overwriting; -v: verbose
alias nano='nano -c' # -c: line numbers
alias open='gnome-open'
alias pf='ps -o user,pid,ppid,command -ax | grep'
alias rm="rm -iv" # silly, silly me
alias updatedb='sudo updatedb'
alias vim="vim -p" # open multiple files in tabs
alias wifi-scan='sudo iwlist wlan0 scanning | /bin/grep "Cell\|Quality\|Encryption\|ESSID"'
### DEFAULTS ============================================================================
export BROWSER=/usr/bin/chromium
export EDITOR=/usr/bin/vim
export PAGER=/usr/bin/vimpager && alias less=$PAGER
export TERM='xterm-256color'
# java a tiny bit less annoying
# export _JAVA_OPTIONS="-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel" -
Trying to learn zsh completion. Help me achieve it?
Hi,
I'm trying to learn to write completion functions for zsh, and started by writing one for unison, which looks in the profiles directory to tab-complete profiles. So far, I've got a _unison file containing the following:
#compdef unison
#typeset -A opt_args
local profiles
profiles=~/.unison
_files -W ${profiles} -g '*.prf' && return 0
return 1
Which works relatively well:
% unison <tab>
default.prf documents.prf photographs.prf
Just for the fun of it really, I'd like to remove the .prf bit and just have it complete the basename. Any idea how I can achieve this?
Thanks :-)I don't think 'basename' is the right word.
This works for bash:
for i in *.txt; do echo ${i%%.*}; done
Now you have to somehow add it to your workflow. -
Zsh completion with pacman 3.5
Hi.
Does zsh completion work for you with pacman 3.5 for -S?
Bash completion works as intended:
[chris@chriseee ~]$ sudo pacman -S fire
firefox firefox-adblock-plus firefox-i18n firefox-noscript firefox-spell-ru firehol
However, with zsh it is broken:
~ % sudo pacman -S fire core/
No matches for: `arguments', `package', `packages', `repository/package', or `file'
and it "corrects" fire to core/
With -Q it works with zsh too:
~ % pacman -Q firefox :(
completing package
firefox firefox-i18nOh well, thank you.
-
[SOLVED]zsh completion config not being loaded but other settings work
This seems like a slightly odd problem. I've been using zsh quite happily for a while now and as far as I've been aware, my .zshrc has been loaded consistently and properly.
Today I decided to add auto-completion for one of my own programs. It works, BUT I have to manually `source ~/.zshrc` in each new terminal even after logging out and back in. The `fpath` variable is not being read from the .zshrc when I log in or start a terminal/emulator, but if I manually source .zshrc it works fine.
Here are the relevant files:
~/.zshenv
#!/bin/zsh
ZDOTDIR=~/.config/zsh
typeset -U path
path=($HOME/bin $HOME/scripts $path)
export EDITOR=vim
export DIRB=~/.local/share/DirB
export LOCAL_PACKAGE_SOURCES=/home/ian/dl
~/.config/_zshrc
# The following lines were added by compinstall
zstyle ':completion:*' completer _complete _ignored
zstyle :compinstall filename '/home/ian/.config/zsh/_zshrc'
autoload -Uz promptinit colors
colors
promptinit
# COMPLETION settings
fpath=(~/.config/zsh/completion $fpath)
autoload -Uz compinit
compinit
zstyle ':completion:*' menu select=2
# Lines configured by zsh-newuser-install
HISTFILE=~/.local/share/zshhistfile
HISTSIZE=1000
SAVEHIST=1000
if ! [[ "${PATH}" =~ "^${HOME}/bin" ]]; then
export PATH="${HOME}/bin:${PATH}"
fi
if ! [[ "${PATH}" =~ "^${HOME}/scripts" ]]; then
export PATH="${HOME}/scripts:${PATH}"
fi
# history options:
setopt append_history hist_ignore_dups hist_ignore_all_dups hist_ignore_space hist_no_store
# background jobs:
setopt notify
# changing directory:
setopt auto_cd auto_pushd pushd_silent
# globbing:
setopt extended_glob
# unset:
unsetopt beep flow_control
# keymap: emacs
bindkey -e
# End of lines configured by zsh-newuser-install
# make M-f and M-b stop at / in paths:
export WORDCHARS=''
source ~/.bash_profile
source ~/.config/bash/aliases
source ~/.config/zsh/alias_s
source ~/.config/zsh/alias_g
source ~/.config/bash/DirB
source ~/.config/zsh/functions
# prompt:
PS1="%B%{$fg[black]%}::%{$fg[cyan]%}(%b%{$fg[cyan]%}%n@%m%B%{$fg[cyan]%})%{$fg[black]%}-%{$fg[cyan]%}(%b%{$fg[cyan]%}%T%B%{$fg[cyan]%})%{$fg[black]%}-%{$fg[cyan]%}[%b%{$fg[cyan]%}%h%B%{$fg[cyan]%}]%{$fg[black]%}-%{$fg[cyan]%}(%b%{$fg[yellow]%}%2~%B%{$fg[cyan]%})%{$fg[black]%}>%b %{$reset_color%}"
The only changes I've made are the lines under "COMPLETION."
Can anyone spot something in there to suggest why everything seems to work except the `fpath=(~/.config/zsh/completion $fpath)` line?
Last edited by ibrunton (2015-06-09 22:43:24)This is what I use (note, different ZSHDOTDIR to you):
# completions
# add custom completion scripts
fpath=(~/.zsh/completion $fpath)
autoload -Uz compinit
compinit
zstyle ':completion:*' completer _complete _correct _approximate
zstyle ':completion:*' expand prefix suffix
zstyle ':completion:*' completer _expand_alias _complete _approximate
zstyle ':completion:*' menu select
zstyle ':completion:*' file-sort name
zstyle ':completion:*' ignore-parents pwd
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*:pacman:*' force-list always
zstyle ':completion:*:*:pacman:*' menu yes select
zstyle -e ':completion:*' hosts 'reply=(cent pi sent veles)'
zstyle :compinstall filename '$HOME/.zsh/zshrc'
Maybe you are looking for
-
Please Help,I made new account then remembered old one.need to delete new
Please Please help . so complicated . ok i had an apple id but couldn't remember id n password so i made a new one . old one has all my music . old one has an old email that i can't access . after i made new one i remembered the old one . i want the
-
Error in Event Binding for Table UI element
Hi, I had created a table UI element in my web dynpro component and it worked fine. After a few weeks, while I was making some other changes in the same module and did a syntax check on the component, I got this error "The event binding for element "
-
BURNING PICTURES ON BLANK DVD: mission impossible
i've been trying to burn some pictures as backup on dvd's, but unable to do it. anyone can help me with this? i always get the message "insert blank disk to begin." and the disk is a new blank SONY dvd. thanks in advance, [email protected]
-
Regarding customized application development
dear SDN . can anyone share some knowledge on customized application development. i.e 3 layered framework to develop ABAP applications. can u please provide the document or any useful link . Regards, Suman.
-
I have a 6260 which will no longer allow me to make a call. I can receive incoming calls only. This has happened recently after setting up a hands free blue tooth device. When I try to make a call using keys or hands free or voice, the phone tries to