7

This is what I use. As far as I can tell it does exactly what you want. # make tab cycle through commands after listing bind '"\t":menu-complete' bind "set show-all-if-ambiguous on" bind "set completion-ignore-case on" bind "set menu-complete-display-prefix on" This works on Mac (10.13 & 10.14) and Ubuntu (16.04 & 18.04).


7

As mentioned in the comments, your home directory itself is huge, and won’t shrink again. Scanning your home directory’s contents will involve reading a lot of data, every single time (from cache or disk). To fix this, you need to re-create your home directory: log out, log in as root, and make sure no running process refers to your home directory: lsof /...


6

The shell being used in the shown terminal is the fish shell. The fish shell is a non-POSIX shell (and hence provides a different syntax from shells like bash and zsh) that gives the user what it calls "autosuggestions" based on previously entered commands, which is what is being displayed in the GIF animation in the question. I recognized it as the fish ...


5

The solution I chose was to run the command: $ compgen -A function -abck | sort -u >> cmds.txt which appends all runnable commands, functions and aliases to a text file cmds.txt Taken from: https://stackoverflow.com/questions/948008/linux-command-to-list-all-available-commands-and-aliases Edit: added sort -u to command to remove duplicates as ...


4

The name of the completion function for the command foo is $_comps[foo]. To see the code of a function myfunc, run echo -E $functions[myfunc], or just echo $functions[myfunc] if you have the bsd_echo option on, or print -rl $functions[myfunc]. So to see the code of the completion function for the command foo, run echo -E $functions[$_comps[foo]]. ...


4

Your package can’t do this on its own, because it doesn’t have access to the environment of the shell (if any) from which the installation was started. When you try to load the new completion in postinst, that only affects the shell instance which is running the postinst, and that’s not the same as the user’s shell instance. Your completion will only be ...


4

It seems compgen outputs duplicates: perhaps programs that appear in multiple locations in your PATH: autocomplete says: $ [tab][tab] Display all 2328 possibilities? (y or n) compgen says: $ compgen -A function -abck | wc -l 2647 $ compgen -A function -abck | sort -u | wc -l 2328 I don't know if this is important for you.


3

You can do: zstyle ':completion:*:*:-command-:*:*' ignored-patterns 'chmem' If you needed to do more than one ignored pattern, you would do it like this: zstyle ':completion:*:*:-command-:*:*' ignored-patterns 'chmem|chcpu|chcon'


3

There are a lot of ways to customize completion, starting with some boolean options. I think the effect you're after is to turn off always_last_prompt. setopt no_always_last_prompt Funny, I've seen the opposite question a lot: people who are used to zsh tend to hate the bash behavior where completing something causes previous terminal commands to scroll ...


3

In Arch, it is quite common to see AUR packages of a project’s releases alongside packages of regular snapshots the same project. These snapshot packages are commonly suffixed with -git (at least, when they involve snapshots of a git repository). In some cases, typically when the project doesn’t publish releases, there is no corresponding non--git package. ...


3

The first problem is that the openvpn binary name matches its entry in init.d directory. complete | grep -i openvpn yields complete -F _service /etc/init.d/openvpn On Ubuntu and derivatives this comes from the code in /usr/share/bash-completion/bash_completion (part of bash-completion package). for svcdir in ${sysvdirs[@]}; do for svc in $svcdir/!($...


3

In the fish shell, tab will complete the common prefix unless the common prefix is empty, in which case it will start the pager. This particular behavior is not configurable. The pager has lots of ways to navigate inside it: Use tab for next, shift-tab for previous Use the arrow keys to move in cardinal directions Press control-S to reveal a search field ...


2

There are some workarounds here https://bugzilla.redhat.com/show_bug.cgi?id=1625674. At some point there will be also a fix.


2

Yes, the script for configure gets loaded dynamically. You can confirm that with setting the option that prints all executed commands with set -x. And try to autocomplete with TAB. The clue to find the source is the output of this command dpkg -L bash-completion | xargs egrep '\<_configure\>' 2>/dev/null Just delete the file for configure and ...


2

If your custom completion is designed only for commands_list, this should work: bind complete command to a second key combination, and check value of $COMP_KEY in your script (this is a decimal character code of last character in the key sequence). If it's 9 (regular tab), do the default filename completion.


2

You should either go learn how to fiddle with bash's Programmable Completion (not for the faint of heart ;-)) or just disable it with shopt -u progcomp That you will get the classical readline(3) command / variable / filename completion back [1]. If the programmable completion is already disabled and =<Tab> still doesn't work, you should check the ...


2

(Assuming you're using Linux) Use echo $$ to get the PID of your current shell. Open a new terminal, and run: sudo strace -fp <PID> -o log Switch back to the old shell, try tab completion. Then switch to the new terminal and press CtrlC to end strace. The output will be in the file named log. You could also run the strace command in the same shell (...


2

The behavior you describe is likely caused by bash-completion. (What follows is based on the current version of the package (2.9), but it will be reasonably accurate for the 2.1 version you have too). bash-completion provides a set of completion specifications (compspec) that the Readline library uses to complete words that are supplied as arguments to ...


2

TL,DR: In normal operations, just drop the file into the appropriate directory. While testing, you need to remove the cache file (.zcompdump by default, but users can put it in a different location, and oh-my-zsh does put it in a different location). The simple answer is to write the completion function in a file where the first line is #compdef fab. The ...


2

If --git-dir is present on the command line, the completion code recognizes it and takes it into account when looking for things to complete, if your zsh is recent enough (≥5.3). It does so by passing the argument to --git-dir as the environment variable GIT_DIR. For example, to complete remote names after git fetch, zsh runs git remote. After git --git-dir=/...


2

As mentioned in the other answer, if you can easily recreate the directory, then this can be done without shutting the system down. In other cases, where the number or size of files in the directory tree make it harder to just copy them to a new directory, you can also unmount the filesystem (or boot from a rescue disk if it is the root filesystem) and run ...


2

The easy way in this specific case: make it an alias instead. This is possible because you can put --ask before the network name. Zsh expands aliases before doing completion by default. alias cn='nmcli device wifi connect --ask' If you use a function, you need to teach zsh about the arguments of the function: specify a completion function for cn, which may ...


2

I never use Enter to move forward in such a case. Enter moves only one line up and that is inefficient, and a waste of time for me. Use Space which moves a whole screen ahead and there is no danger of executing unwanted command.


2

I believe that the "possibilities" being shown are not necessarily programs that you can run. For example, when you type man, it is likely saying that there are that many possible things you can run man with (e.g. man ls). The number of commands that you can run should be very similar regardless of whether you're root or not. If you're not root, you may ...


2

This behaviour can be caused by the shell option nullglob, which may be, for example, turned on in your .bashrc. The reason is that the _longopt function has a bug in its definition, which causes this behaviour with _longopt turned on. The solution is to disable this option or to override the _longopt function yourself. A similar effect is also described ...


1

You can have a negative lookup in ignored-patterns: use a single pattern which uses the ^ negation operator. (extended_glob is always enabled during completion, but I recommend setopt extended_glob anyway because it's also useful outside of completion.) zstyle ':completion:*:complete:git:*:main-porcelain-commands-freq' \ ignored-patterns '^(add|branch|…)'


1

Do the following: _api(){ ... local IFS=$'\n' COMPREPLY=( $( compgen -W "$args" -- "$cur" ) ) ... } complete -F _api ./command


1

The following function prepends $PWD/ to any relative path before passing it to _files, which is the normal completion function for files. _absolute_files () { local expansion=$PREFIX$SUFFIX; expansion=${(e)expansion} if [[ "${expansion%%/#}" != "${expansion:a}" ]]; then PREFIX="\$PWD/$PREFIX" fi _files "$@"; } This works in many common cases, ...


1

Define a completion function for cdp. Conventionally, the function is called _cdp. You can define it in your .zshrc and assign it explicitly with compdef. _cdp () { … # code goes here } compdef _cdp cdp Alternatively, put the completion code in a file in your $fpath called _cdp with a completion autoload directive. #compdef cdp … # code goes here To ...


1

The problem was fixed after command $ set +u


Only top voted, non community-wiki answers of a minimum length are eligible