All Questions

Tagged with
Filter by
Sorted by
Tagged with
1
vote
1answer
10 views

How to set up alias to cd into a subdirectory with completions?

I've set up this function in my ~/.zshrc: cdp() { cd "/mnt/c/Users/Mark/PhpstormProjects/$1" } But I don't get tab completions for it. Is there any way to get the directory names to autocomplete ...
0
votes
0answers
25 views

npm autocomplete broken if prefixed by double dash (--)

I notice this when using a command that accepts additional args after a double-dash, for example: npm test -- spec/blah-spec.js In a raw, clean, ZSH v5.3 install, tab-completion works properly: npm ...
0
votes
1answer
47 views

email address completion in zsh

This is an extract from the zsh shell's manual: The completion system in zsh is programmable. For example, the shell can be set to complete email addresses in arguments to the mail ...
2
votes
1answer
59 views

How to properly make custom zsh completions “just work”?

Please forgive me if I'm doing something stupid here, the documentation is huge and searching didn't turn up anything yet. I'm trying to create shell completions for my custom script called fab. For ...
3
votes
1answer
37 views

ignore specific command from zsh completion

Is it possible to tell zsh to not autocomplete certain commands when using TAB completion ? EXAMPLE: I type chm <tab> and zsh completion offers me two options: chmem chmod I never use chmem....
1
vote
0answers
33 views

bash/zsh: Is it possible to prevent auto-inclusion of a slash when using tabs to autocomplete a path?

When I use tab to autocomplete a path, a trailing slash is automatically added. I checked both bash and ZSH and I get the same behavior. Is it possible to prevent this? I check unsetopt and I have "...
0
votes
1answer
20 views

Complete something not according to the context in zsh

I use zsh with the “new” completion system (compinit). Sometimes I want to restrict completion to a subset of what is possible, to cut down on ambiguity. This is a user choice, not a configuration ...
0
votes
0answers
20 views

distinguish absolute from relative paths in zsh completion function

I have a command that can accept absolute and relative paths (just like ls) as first argument # absolute mycommand $HOME/.local mycommand /tmp/ # relative mycommand ../build mycommand file_in_cwd.txt ...
2
votes
1answer
56 views

Complete a command fully relative to a different directory

I have a function to run a single command in a different category. cd1 SOMEDIR MYCOMMAND ARG… is equivalent to (cd SOMEDIR && MYCOMMAND ARG…), with two advantages. It's slightly easier to type ...
1
vote
1answer
40 views

Make auto completion options remain on screen in zsh, like bash

As Apple rolled out the first developer previews of macOS Catalina, it seems like they have made the default shell into zsh, instead of the good old bash. I've kept myself at Mojave, but nonetheless I'...
1
vote
0answers
31 views

zsh _arguments completion that gradually reveals options

I have at the moment a completion function that looks something like this (except way more entries) _arguments \ '-check[do a check]' \ '-play[play a specific song]:songnumber' \ '-test.n=[run ...
2
votes
0answers
43 views

Tab complete global alias names not at the beginning of a line

I have a bunch of aliases like this alias -g foo=cmd1 alias -g faz=cmd2 alias -g fam=cmd3 At the shell (I'm using zsh) I want to be able to type echo fa<TAB> and be prompted for faz or fam ...
1
vote
0answers
40 views

How to restrict autocomplete for the files found from PATH?

What I would like to be able to do is to have a list of words that are allowed to be autocompleted when typing the first word in the command line. Say, I have PATH=/dir, and the directory /dir has ...
0
votes
1answer
139 views

How to use zsh tab completion on Git without origin?

I am using zsh with oh-my-zsh on Ubuntu 18.04.2. Currently, Git is installed at version 2.20.1. Whenever I want to push a local branch to a remote (origin) I try to use the tab completion in the ...
3
votes
2answers
50 views

zsh completion for media player

In my .zshrc, I have menu select disabled globally, except for mpv/mplayer: zstyle ':completion:*' menu select=0 zstyle ':completion::complete:mpv:*' menu yes select This works as expected, but I ...
2
votes
1answer
60 views

How to look up zsh completion definitions

Is there a way to lookup (just print the completion definition to stdout) currently loaded zsh completion functions. I understand that they are stored somewhere on my fpath and I could do something ...
1
vote
2answers
317 views

Show possible completions in zsh (possible-completions in bash)

I have recently switched to zsh from bash. Deep in my inputrc, I had "\e[/": possible-completions set. This allowed me to see all completions at a given point, without applying them. This was really ...
3
votes
1answer
155 views

Prevent completion of files for 'make' command in zsh shell

Context zsh shell, oh-my-zsh framework, no special zsh's configuration (same problem with or without zsh-completions): see .zshrc at the end. Trouble If a directory contains: a makefile with ...
0
votes
1answer
380 views

Zsh: manually load completion functions

If I load completion functions at shell startup, but I spawn shell like a madman to work on the same folder. This is the case when I have multiple completion functions that target repository that ...
2
votes
2answers
79 views

Treat command like another for completion purposes

My zshrc includes the following function to create a directory and then enter it: function mcd () { mkdir -p "$*" && cd "$*" } The function itself works fine but I get odd behavior with ...
6
votes
1answer
188 views

zsh: complete hostnames and files in given directory

I have a script myscript which takes two arguments: hostname directory How can I write my own zsh completion, so that whenever I do mysript <TAB> it completes from my hosts list (ie same as ...
3
votes
1answer
74 views

Managing trailing characters using zsh autoloaded completion

I'm trying to create an autoloaded completion file for zsh. To do so, I've added a _myprog file in a folder that is in my fpath. This file goes roughly like this: #compdef myprog _myprog () { ...
1
vote
1answer
119 views

ZSH completion depending on the provided argument

Is there a way to access already provided argument as a variable in a ZSH completion scripts? here is the example: #compdef test _test_comp(){ t=($(cat /tmp/file_with_opts)) _wanted t expl "...
2
votes
0answers
167 views

How to make zsh pass the manual section to the man command when the `separate-sections` style is set?

When asking for a completion by pressing Tab on the zsh command line, the matches can be grouped according to their tag provided that the group-name style is set to an empty string: autoload -Uz ...
1
vote
2answers
127 views

Remove forward slash when tabbing to see a list of directories

Is there a way to remove the trailing forward slashes in the tab-completion output of Zsh when I start writing a cd command and tab to see a list of directories? E.g. ~ cd <tab> Adlm/ ...
1
vote
1answer
332 views

How to extend existing zsh completion functions?

I'm trying to add auto-completion for some custom ant parameters. However, it seems to be overwriting the existing oh my zsh ant plugin auto-completions which I'd like to keep. Is there a simple way ...
2
votes
3answers
710 views

Remove zsh autocomplete suggestion

When I type cd l and hit tab, zsh autocompletes to cd lightdm/ this is not a directory that is available to me (in fact I've uninstalled lightdm). How do I stop this from happening? I have ...
1
vote
1answer
423 views

How to use aliases with auto completion in oh-my-zsh?

I'm using zsh on MacOS El Capitan. I'm wondering how auto completion has to be parameterized to resolve aliases as well. When I used bash, my .bash_profile contained the following: alias mdb "mongo -...
1
vote
1answer
237 views

How can I define zstyle completion preference for a zsh alias?

If I have an executable - say ~/bin/stuff in my PATH, I can define this in my .zshrc to have it autocomplete text files first as arguments to my command: zstyle ':completion:*:*:stuff:*' file-...
0
votes
1answer
72 views

How to allow for files completition for the rest of _arguments?

I got _arguments "1: :($(/usr/local/bin/aliases-drush.php))" \ working which is really great -- it's a PHP script printing one possibility for argument every line -- but the rest of the arguments can ...
1
vote
1answer
140 views

define tab completion helper function to use in several completion files (zsh)

I am writing zsh completion functions for a couple of commands from the same toolkit. The commands are different enough that I want to write different completions for them in different files. (i.e. ...
0
votes
1answer
727 views

Remove colors from zsh tab-completion

I don't want to see colors in the suggestions of zsh tab-completion. They make the reading harder for me. How can I do that? Here is my .zshrc: # _ # _______| |__ # |_ / __| _ \ # / ...
3
votes
0answers
170 views

Use colon as filename separator in zsh tab completion

I have many programs which take filename arguments as one(or more) of path/to/file scp:path/to/file.ext ark:/abs/path/to/file.ext Is it possible make zsh complete filenames after some keywords ...
4
votes
1answer
130 views

Don't suggest current directory in autocomplete

I am a long time user of ZSH. It seems to me that I used to have this functionality a long time ago but then I rewrote my .zshrc (a long time ago) and now I miss this functionality every now and then. ...
1
vote
1answer
336 views

“compdef: unknown command or service” with disk quota exceeded

I just came across a problem with zsh. Every time I open it, I got this: /home/****/.zcompdump:201: parse error near `\n' compdef: unknown command or service: git And zsh completion broke down as ...
3
votes
2answers
213 views

Read /dev/tty from within a completion function

Why is the following code not working for completion of the foo command? When I source it then type foo <Tab>, the shell hangs and doesn't take any input until I press ^C (which exits the ...
3
votes
1answer
957 views

Automatically generate ZSH/Bash completion files

Does a tool exist that will automatically generate completion files for both bash and zsh? I'd like to be able to specify one source of truth for my completions instead of maintaining a separate ...
1
vote
1answer
254 views

zsh completion: make sshrc behave like ssh

I'm using the sshrc package and its eponymous command to make the remote machine's shell source the contents of my local .sshrc file upon SSH login. However, I really like zsh's host autocompletion (...
2
votes
1answer
594 views

Installed Anaconda -> strange behavior with DNF

I am using Fedora 26. Since I installed Anaconda, if I type in Terminal something like sudo dnf install gnome[TAB] I get Traceback (most recent call last): File "<string>", line 1, in <...
0
votes
0answers
90 views

Change order of autocompletion loading for ZSH

Trying to implement my own flag completion for java I broke the existing one. :-) What I've done is (among others for sure) unfunction and autoload calls, to see if my module worked. I think it ...
2
votes
1answer
223 views

With zsh how to add autocompletion for a specific script, with autocompletion choices coming from a file?

I have written a small shell script that takes a single command line argument. I'd like to be able to autocomplete when I start writing an argument, the autocompletion choices should come from a ...
1
vote
1answer
149 views

Can I change how file completion is displayed?

I can get process completion more useful by doing zstyle ':completion:*:processes' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'. Is there some way to do something similar for file completion, ...
1
vote
0answers
100 views

zsh: use setopt AUTO_MENU conditionally, depending on $PWD

generally, I find the zshoption AUTO_MENU annoying, and I disable it in my .zshrc: setopt noautomenu However, there are some directories where I have files with long filenames, with spaces in ...
5
votes
1answer
205 views

zsh: separate completion for command names and filenames

I do not want filename tab completion to prioritize the start of the file name. For example, given the filenames red_blue.txt and blue_red.txt, I do not want vim red tab to prioritize red_blue.txt ...
1
vote
1answer
156 views

Shell autocompletion very slow after partial disk formatting

I upgraded to Fedora 26 the day of the official public release earlier this week and, long story short, ended up screwing up my installation, so I did a partial reformatting . My disk layout is the ...
4
votes
3answers
2k views

zsh: completion rules for ssh

in zsh, I can autocomplete hostnames from /etc/hosts, ie: ssh f<TAB> will offer completions for hosts starting with f. This is configured in /usr/share/zsh/functions/Completion/Unix/_hosts: ...
1
vote
2answers
438 views

zsh autocomplete without completing prompt

Tried to find this answer, but could not. I am new to zsh, and I like it a lot on my Mac. I am looking for an option to set it to autocomplete, but without putting the completion in the prompt until ...
0
votes
2answers
471 views

how do I get zsh to *just* list the stuff in my current directory during tab completion?

In zsh when I type a few characters it lists all this stuff (commands and I think subfiles). How do I get zsh to just list the contents of my current_directory? In the picture above I type the ...
1
vote
1answer
567 views

dnf install completion not working with zsh, yet working with bash

In bash, if I type dnf install java<tab>, I get a bunch of suggestions of packages to install. However, if I do this in zsh, nothing happens. I've played around with /etc/bashrc and discovered ...
2
votes
1answer
171 views

How to reduce the impact of changing the value of the `fpath` array on zsh starting time?

I'm using zsh version 5.1.1 and tmux version 2.3, and recently I've noticed that starting a new shell (via a new window or pane in tmux) takes more time than before. It's enough for me to type around ...