101
votes
How do I get bash completion for command aliases?
Try complete-alias, which solves this problem exactly. (Disclaimer: I am the author of complete_alias)
After install it you can use one generic function to complete many aliases like this:
complete -...
68
votes
Accepted
zsh: command not found: {compinstall,compinit,compdef}
This is the same issue I got on my mac. I am using zsh shell.
Compdef is basically a function used by zsh for load the auto-completions. The completion system needs to be activated. If you’re using ...
41
votes
Debian - apt (not apt-get) autocompletion not working
Debian does not come with 'bash-completion' installed and enabled.
If you're coming to Debian from, say, an Ubuntu background, where it is pre-installed and enabled by default, this can be a source of ...
30
votes
How can I configure zsh completion to show hidden files and folders?
This is a zsh option. It is mentioned in its introduction.
GLOBDOTS lets files beginning with a . be matched without explicitly specifying the dot.
Add the following to your .zshrc file.
setopt ...
29
votes
Accepted
Add trailing slash in bash completion of directory symbolic links
Add the following line to your ~/.inputrc file:
set mark-symlinked-directories on
See "Readline Init File Syntax" in the Bash Reference Manual for more on this topic.
28
votes
How to turn off the beep only in bash tab-complete
If you don't want to create and maintain a separate ~/.inputrc file, you can also just add this line to ~/.bashrc:
bind 'set bell-style none'
Then source ~/.bashrc to reload it.
27
votes
Accepted
Can I navigate zsh's tab-completion menu with vi-like hjkl keys?
Yes, you can by enabling menu select:
zstyle ':completion:*' menu select
zmodload zsh/complist
...
# use the vi navigation keys in menu completion
bindkey -M menuselect 'h' vi-backward-char
bindkey -...
23
votes
Accepted
Is it possible to configure bash to autocomplete with one tab like zsh?
Put this in your ~/.inputrc:
set show-all-if-ambiguous on
For additional credit, add:
set completion-ignore-case on
All of the options are in the GNU manual...
22
votes
Bash autocomplete: first list files then cycle through them
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 ...
19
votes
How do I get bash completion for command aliases?
By googling this issue I ended up here, so I tried the approaches in the other answers. For various reasons I don't actually understand, they never behaved properly in my Ubuntu 16.04.
What in the end ...
19
votes
Accepted
How can I configure zsh completion to show hidden files and folders?
You could add globdots to $_comp_options in your .zshrc e.g.
.....
compinit
_comp_options+=(globdots)
.....
16
votes
How to specify a custom autocomplete for specific commands?
Here is basic guide.
Lets have an example of script called admin.sh to which you would like to have autocomplete working.
#!/usr/bin/bash
while [ $# -gt 0 ]; do
arg=$1
case $arg in
option_1)
...
16
votes
Accepted
Hide some commands from bash completion?
This is rather new, but in Bash 4.4 you can set the EXECIGNORE variable:
aa. New variable: EXECIGNORE; a colon-separate list of patterns that
will cause matching filenames to be ignored when ...
16
votes
zsh: command not found: {compinstall,compinit,compdef}
Answer to the question as asked
Access these commands by running:
$ autoload -Uz compinstall && compinstall
It will load a guided wizard, I quit as soon as I had the option to Save and exit....
16
votes
Accepted
Where to install bash completion scripts for out of tree packages?
From what I could gather after a lot of reading, specially their official documentation, /usr/share/doc/bash-completion/README.Debian, and the sources themselves:
/etc/bash_completion.d/ is the ...
16
votes
Accepted
Prevent completion of files for 'make' command in zsh shell
You can ask zsh to only display targets tag for the make command completion with
zstyle ':completion:*:*:make:*' tag-order 'targets'
Add above code somewhere after the line
autoload -U compinit &...
15
votes
Accepted
sudo: nocorrect: command not found
I have this alias alias sudo='sudo 'defined in a file which I sourced at the end of ~/.zshrc file which overwrote alias sudo='nocorrect sudo' which is defined in .oh-my-zsh/lib/correction.zsh
alias ...
14
votes
Accepted
Automatically add slash when navigating through symlink
Set the mark-symlinked-directories readline option.
The usual way to do this is to edit ~/.inputrc, put
set mark-symlinked-directories on
in there, then start a new bash shell (or press Ctrl+X Ctrl+...
14
votes
Is it possible to configure bash to autocomplete with one tab like zsh?
I do not have enough reputation to comment, but I would add to jasonwryans answers that it can be added to .bash_profile or .bashrc by writing them as:
bind 'set show-all-if-ambiguous on'
bind 'set ...
14
votes
Accepted
Where does SSH pull autocompletion from?
The OpenSSH is using bash completion from package bash-completion. The responsible script is stored in /usr/share/bash-completion/completions/ssh (on Fedora. Might be different on different distros). ...
14
votes
debugging zsh completion method
Press ^X? (Ctrl+X ?) instead of Tab to run _complete_debug. This places a trace of the completion code into a file which you can view by pressing Up Enter.
Alternatively, if you want to generate a ...
13
votes
Terminal autocomplete: cycle through suggestions
You can cycle through the completion menu in Bash, and you can also show the menu of items. Unlike in Zsh, the current menu item will not be highlighted.
Add to ~/.inputrc:
set show-all-if-ambiguous ...
13
votes
Select an item in vim autocomplete list without inserting line break
Personally I use this one:
inoremap <expr> <TAB> pumvisible() ? "\<C-y>" : "\<CR>"
inoremap <expr> <Esc> pumvisible() ? "\<C-e>" : "\<Esc>"
inoremap &...
13
votes
Autocompletion fails on <TAB> with `bash: !ref: unbound variable`
The problem was fixed after command
$ set +u
12
votes
Accepted
Bash completion is very incomplete on centos 7
You might want to try bash-completion-extras. It was briefly only in epel-testing, but has been released into epel. Right now, you should be able to run:
yum --enablerepo=epel install bash-...
11
votes
How to make zsh completion show the first guess on the same line (like fish's)?
Follow the steps here to get other features as well:
https://github.com/abhigenie92/zsh_to_fish
Install oh-my-zsh
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/...
11
votes
Autocomplete server names for SSH and SCP
To enable ssh autocompletion in Debian and Ubuntu:
sudo apt-get install bash-completion
Note that this has nothing at all to do with known_hosts hashing, contrary to what was stated above and the ...
11
votes
Accepted
Search bash history for already typed command
If you start typing a command and then, after typing some of it, remember to do a history search, you just need to:
CTRL+A
CTRL+R
CTRL+Y
CTRL+R ... (keep searching or)
CTRL+S ... (search in the other ...
11
votes
How to enable bash completion in vi mode on Synology DSM6
TL;DR Solve by creating ~/.profile with
if [ $0 != -bash ]; then
exec -l bash
fi
Long version:
After searching for quite a while I found that on DSM6 bash runs in posix mode (verify with set -o) ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
autocomplete × 829bash × 418
zsh × 318
shell × 64
oh-my-zsh × 42
command-line × 40
shell-script × 26
ssh × 25
git × 24
terminal × 21
vim × 19
macos × 18
ubuntu × 16
alias × 16
filenames × 15
fish × 15
linux × 13
colors × 13
cd-command × 13
wildcards × 12
debian × 11
directory × 10
tcsh × 10
readline × 10
sudo × 9