Questions about command completion in the Bash Unix shell.
Questions tagged [bash-completion]
310 questions
6
votes
2 answers
Is it possible to enable bash_completion for :! or :r ! in VIM?
I can use :shell to enter current dir and run commands. bash_completion work fine.
But how get bash_completion working in :! command or :r ! command case?
Note. I am Emacs user and Emacs M-! command don't allow such things (also M-x shell, you need…

gavenkoa
- 45,285
- 19
- 251
- 303
6
votes
2 answers
Extending BASH completion with Python Click
I'm wanting to customize the BASH completion functionality of my Python Click CLI program to include not only the commands / subcommands of the script, but also objects that the script creates.
Let's say my program is called cli-tool, and it can…

Scott Crooks
- 1,523
- 4
- 24
- 39
6
votes
1 answer
Why does "$" perform filename completion?
While trying to configure the programmable completion, I came across a behavior I don't understand.
Given those three completion scenarios, this is the way I understand them:
$
Beginning of the line --> use complete -E --> if it…

mickp
- 1,679
- 7
- 23
6
votes
2 answers
Can I disable a particular git command?
With new versions of git new commands have been added which I will probably never use.
Is there a way I can disable these commands so that I my tab completion is faster?
For ex: before, git check would autocomplete to git checkout
But now git…

RuMAN S
- 123
- 7
6
votes
7 answers
Why doesn't kubectl bash completion work on macOS/OS X?
I followed the instructions for installing Bash completion as given by kubectl completion -h:
I installed bash-completion via Homebrew
In my ~/.bashrc, I first source bash-completion then output from the completion kubectl subcommand:
source…

Dmitry Minkovsky
- 36,185
- 26
- 116
- 160
6
votes
2 answers
Showing only the substrings of COMPREPLY bash completion options to the user
In a bash completion script, suppose COMPREPLY=(aa/ba/ aa/bb/). When the script is invoked, the completion options looks like this to the user:
$ foo aa/b
aa/ba/
aa/bb/
However, I want to have a bit more control over how these options are…

Roman Nurik
- 29,665
- 7
- 84
- 82
6
votes
1 answer
Changing tab-completion for read builtin in bash
The current tab-completion while "read -e" is active in bash seems to be only matching filenames:
read -e
[[TabTab]]
abc.txt bcd.txt cde.txt
I want the completion to be a set of strings defined by me, while file/dir/hostname-completion etc.…

Mustermann
- 109
- 1
- 1
- 9
6
votes
4 answers
Bash history expansion with tab completion
I make frequent use of command history expansion using the form !n:m, where n is the number of the historical command and m is the number of the argument, or short forms thereof.
Is there a way to expand such arguments in situ, so that I can then…

Alaya
- 272
- 1
- 4
- 10
6
votes
2 answers
Bash tab-completion not working
I am trying to troubleshoot why the bash tab-completion isn't working on my fedora 19 desktop.
I am afraid I just know what else to add to this that might be relevant.

Humble Debugger
- 4,439
- 11
- 39
- 56
6
votes
1 answer
cmdArgs bash completion
The cmdArgs package for Haskell provide command option parsing.
based on this page from the docs http://hackage.haskell.org/packages/archive/cmdargs/0.10.3/doc/html/System-Console-CmdArgs-Explicit.html#g:4 and its source…

Bilal Syed Hussain
- 8,664
- 11
- 38
- 44
6
votes
3 answers
Bash programmable completion when typing "first command"
Is there a way how to control completion for first command being typed on bash4 command prompt?
I can control completions for "empty line" with complete -E, but as soon as some characters are typed, bash (or possibly readline) gives me all filenames…

Stanislav Pavlíček
- 71
- 1
5
votes
1 answer
Can bash omit backupfiles when completing commands?
When completing commands, executables in $PATH and all, I would like to omit files named #foo# and bar~. I don't mind having these backup-files laying around, but prefer not to see them when completing commands. Do I need to somehow write a…

Daniel
- 101
- 4
5
votes
1 answer
How to autocomplete files under specific directory?
I created a command memo as follows:
memo() {
vi $HOME/memo/$1
}
I want to apply bash-completion to my memo to open files that is already in $HOME/memo directory:
$ memo [TAB] # to show files in $HOME/memo
$HOME/memo contains directory, so…

tamuhey
- 2,904
- 3
- 21
- 50
5
votes
1 answer
How to bash complete a GNU long option with given set of arguments?
GNU advises to use --name=value syntax for passing argument for long option. It enables a long option to accept an argument that is itself optional.
Suppose you have a complete set of possible arguments. How do you write a bash completion code for…

jarno
- 787
- 10
- 21
5
votes
2 answers
Django Bash completion not working on manage.py
I am trying out the django_bash_completion script provided by Django but can't use it with python manage.py command.
I am trying out the django_bash_completion script provided by Django. I have added it to active script in the virtual environment.…

Fazle Rabbi
- 231
- 1
- 5
- 17