zsh-completion

Multi-dot paths in zsh, like `cd …`

☆樱花仙子☆ 提交于 2020-01-01 03:17:19
问题 All shells understand these commands: $ cd . $ cd .. And zsh will also understand: $ cd ... $ cd .... Provided you say: $ alias -g ...='../..' $ alias -g ....='../../..' Now, how can I make it do proper tab-completion when I've started typing cd ..../<TAB> ? I recall it was implemented in oh-my-zsh but I've stopped using it now. It would also be appreciated if it would work not only for cd , say I want to execute cat ..../a/b/..../c/d | less . 回答1: I wasn't happy with the other answers so I

zsh - first tab completion with autocd

情到浓时终转凉″ 提交于 2019-12-25 01:44:20
问题 I am currently switching from csh to zsh I am writing a .zshrc trying to get all the options I am used to in this new shell. I use autocd (to go into a directory just typing its name (without the cd command), and I wonder if it is possible that my first propose all the files existing in the current directory (like it's working in csh). I am quite used to this way of having an overview of the files I can open or directory I can "autocd" into, before typing my command just pressing without

bind key to complete filename wherever the context is in Zsh

做~自己de王妃 提交于 2019-12-21 14:01:06
问题 Sometimes I want a filename instead of what zsh guesses for me. For example, I have a PNG file without a proper .png suffix, which makes zsh think it isn't a picture and won't list it when I type Tab to complete arguments of display . I am wondering if there is a key sequence that completes for a filename wherever the context is, like ^XC for _correct_filename , or how to configure zsh to do the thing? 回答1: You can add a key binding to do what you want: zle -C complete complete-word complete

How to pass the contents of a file using `cat` to `_values` (zsh completion)

五迷三道 提交于 2019-12-12 13:52:00
问题 Is it possible to pass the contents of a file using cat to _values (zsh completion)? If I uncomment the line _values cat .test_tasks~ and comment _values below, it doesn't work, I get: _values:compvalues:10: invalid value definition: 1test[1 . #compdef test #autoload local curcontext="$curcontext" state line ret=1 local -a _configs _arguments -C \ '1: :->cmds' \ '2:: :->args' && ret=0 _test_tasks() { # _values "test" $(cat .test_tasks~) _values "test" \ "1test[1 test test]" \ "2test[2 test

Zsh Docker Plugin not Working

一曲冷凌霜 提交于 2019-12-12 07:39:32
问题 I have been using oh-my-zsh for a while now and the docker plugin as recently stopped working for me for some reason. I checked my ~/.zshrc file and the plugin is included plugins=(git colored-man colorize github jira vagrant virtualenv pip python brew osx zsh-syntax-highlighting docker) I checked the ~/.oh-my-zsh/plugins/docker directory and there is a _docker file in there. Yet when I type docker and press Tab, I get none of the autocomplete shortcuts that I used to get. I can confirm that

Completion when program has sub-commands

[亡魂溺海] 提交于 2019-12-04 16:20:20
问题 I have written a command-line tool that uses sub-commands much like Mercurial, Git, Subversion &c., in that its general usage is: >myapp [OPTS] SUBCOMMAND [SUBCOMMAND-OPTS] [ARGS] E.g. >myapp --verbose speak --voice=samantha --quickly "hello there" I'm now in the process of building Zsh completion for it but have quickly found out that it is a very complex beast. I have had a look at the _hg and _git completions but they are very complex and different in approach (I struggle to understand

Zsh Docker Plugin not Working

亡梦爱人 提交于 2019-12-03 22:12:20
I have been using oh-my-zsh for a while now and the docker plugin as recently stopped working for me for some reason. I checked my ~/.zshrc file and the plugin is included plugins=(git colored-man colorize github jira vagrant virtualenv pip python brew osx zsh-syntax-highlighting docker) I checked the ~/.oh-my-zsh/plugins/docker directory and there is a _docker file in there. Yet when I type docker and press Tab, I get none of the autocomplete shortcuts that I used to get. I can confirm that my git plugin works just fine but not the docker plugin. Tried doing exec zsh and source ~/.zshrc and

Multi-dot paths in zsh, like `cd …`

痞子三分冷 提交于 2019-12-03 14:22:40
All shells understand these commands: $ cd . $ cd .. And zsh will also understand: $ cd ... $ cd .... Provided you say: $ alias -g ...='../..' $ alias -g ....='../../..' Now, how can I make it do proper tab-completion when I've started typing cd ..../<TAB> ? I recall it was implemented in oh-my-zsh but I've stopped using it now. It would also be appreciated if it would work not only for cd , say I want to execute cat ..../a/b/..../c/d | less . I wasn't happy with the other answers so I spent a bit of time getting something more to my liking. The following will expand the dots when you hit ↵

Make zsh complete arguments from a file

烈酒焚心 提交于 2019-12-03 10:43:07
问题 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

ZSH auto completion for git takes significant amount of time, can I turn it off or optimize it?

对着背影说爱祢 提交于 2019-12-03 03:42:04
问题 Git's tab autocompletion is useful for small projects, but I'm currently working on two big projects that use git and for these it's worse than useless. Whenever I type, say, git add forms<tab> , git takes 20 seconds or more to find the file (in this example, forms.py), and in this timespan I can't do anything else in the terminal. Is there any way to turn off the autocompletion feature, or somehow make it faster? 回答1: It's not git auto completing the file names, it's your shell. Do you have