zsh-completion

cd -1, -2, -3 etc in Z shell

青春壹個敷衍的年華 提交于 2019-12-03 03:13:49
问题 How do you set up the Z shell such that typing cd - gives you a list of previously visited paths, and cd -1, -2, -3, etc. will then take you to the directories? 回答1: If you have setopt AUTO_PUSHD in your .zshrc then cd will automatically do a pushd of each directory you change to. Taking the example from ZyX: $ setopt AUTO_PUSHD $ mkdir -p 1/2/3/4 $ cd 1 $ cd 2 $ cd 3 $ cd 4 You can see a list of the directories using dirs : $ dirs -v 0 ~/1/2/3/4 1 ~/1/2/3 2 ~/1/2 3 ~/1 4 ~ To be able to tab

Make zsh complete arguments from a file

假如想象 提交于 2019-12-03 00:22:58
zsh is great but its completion system is very diverse. And the documentation lacks good examples. Is there a template for completing for a specific application. The completion would get its match data from a file, separated by newlines? I tried modifying an older example of mine that takes match data "live": ~ % cat .zsh/completers/_jazzup #compdef jazz_up _arguments "2: :(`mpc lsplaylists|sed -e 's# #\\\\ #g'`)" I could supply cat my_file there instead of mpc invocation and so on but would there be a more elegant way to do this simple task? And that completion there is placement-specific:

zsh compinit: insecure directories

安稳与你 提交于 2019-12-03 00:02:44
问题 What does it mean and how can I fix it? zsh compinit: insecure directories, run compaudit for list. Ignore insecure directories and continue [y] or abort compinit [n]? Running the compaudit returns the follows: There are insecure directories: /usr/local/share/zsh/site-functions 回答1: This fixed it for me: $ cd /usr/local/share/zsh $ sudo chmod -R 755 ./site-functions Credit: a post on zsh mailing list EDIT: As pointed out by @biocyberman in the comments. You may need to update the owner of

cd -1, -2, -3 etc in Z shell

时光总嘲笑我的痴心妄想 提交于 2019-12-02 16:44:26
How do you set up the Z shell such that typing cd - gives you a list of previously visited paths, and cd -1, -2, -3, etc. will then take you to the directories? If you have setopt AUTO_PUSHD in your .zshrc then cd will automatically do a pushd of each directory you change to. Taking the example from ZyX: $ setopt AUTO_PUSHD $ mkdir -p 1/2/3/4 $ cd 1 $ cd 2 $ cd 3 $ cd 4 You can see a list of the directories using dirs : $ dirs -v 0 ~/1/2/3/4 1 ~/1/2/3 2 ~/1/2 3 ~/1 4 ~ To be able to tab complete the list you can use the + and - arguments with cd ( <TAB> meaning you hit the tab key): $ cd +<TAB

zsh compinit: insecure directories

偶尔善良 提交于 2019-12-02 13:50:34
What does it mean and how can I fix it? zsh compinit: insecure directories, run compaudit for list. Ignore insecure directories and continue [y] or abort compinit [n]? Running the compaudit returns the follows: There are insecure directories: /usr/local/share/zsh/site-functions chakrit This fixed it for me: $ cd /usr/local/share/zsh $ sudo chmod -R 755 ./site-functions Credit: a post on zsh mailing list EDIT: As pointed out by @biocyberman in the comments. You may need to update the owner of site-functions as well: $ sudo chown -R root:root ./site-functions On my machine (OSX 10.9), I do not

Custom zsh completion for a function based on default arguments

本秂侑毒 提交于 2019-11-30 15:47:22
How can I setup completion for a function, based on existing completion definitions and default arguments. A simplified example (which could be rewritten as an alias): gpl() { git pull origin $@ } This should have the same completion as after git pull origin . compdef -e 'words[1]=(git pull origin); service=git; (( CURRENT+=2 )); _git' ggl This massages the $words , $service and $CURRENT vars used by the completion system, and then calls the _git completion function. (Thanks to Mikachu on #zsh). 来源: https://stackoverflow.com/questions/27226716/custom-zsh-completion-for-a-function-based-on

Custom zsh completion for a function based on default arguments

最后都变了- 提交于 2019-11-29 23:06:54
问题 How can I setup completion for a function, based on existing completion definitions and default arguments. A simplified example (which could be rewritten as an alias): gpl() { git pull origin $@ } This should have the same completion as after git pull origin . 回答1: compdef -e 'words[1]=(git pull origin); service=git; (( CURRENT+=2 )); _git' ggl This massages the $words , $service and $CURRENT vars used by the completion system, and then calls the _git completion function. (Thanks to Mikachu