Most shells provide tab completion where a user can type part of a command or file name, and then press tab to make the shell complete the command. This saves greatly on the number of key presses needed when working on the command line.
Questions tagged [tab-completion]
359 questions
1
vote
1 answer
Zsh ls tab completion on symlink does not follow the symlink
I have a folder in the home directory: hdd -> /hdd.
ls -l hdd outputs hdd -> /hdd. I expected it to follow the symlink and show the contents of /hdd, but that's not the main point.
ls -l hdd/ outputs the contents of /hdd, as expected.
ls -l hd…

David Shields
- 11
- 2
1
vote
3 answers
tab completion for Ant under Windows?
Is there any way to have a proper tab completion for Ant under windows (cmd.exe) ?
I could write up the default target to list all the other targets, but that's just no the same as a proper tab completion you get on linux for instance.

dm76
- 4,130
- 8
- 35
- 46
1
vote
2 answers
getting basename with globbing when trailing / is present
input1="/$HOME/Desktop/foo/bar/"
input2="/$HOME/Desktop/foo/bar"
target1a=$(basename "$input1")
target1b="${input1##*/}"
target2a=$(basename "$input2")
target2b="${input2##*/}"
echo $target1a
echo $target1b
echo $target2a
echo…

Bleakley
- 653
- 2
- 9
- 19
1
vote
2 answers
Unix-bash cd command and then tab shows both directories and files
In unix bash shell, when I type in cd and then press tab, it lists both directories and files as the available options to choose. Displaying directories and probably links to the directories must be intuitive. Wouldn't listing the files counter…

syam
- 562
- 6
- 15
1
vote
2 answers
Syntax error in Fish Shell path completion
I made the mistake of putting an ampersand (&) in a directory name. I renamed the directory, but now every time I change directory it prints an error message:
complete: Completion '[A list of directories' path]' contained a syntax error. Expected an…

Charles Langlois
- 4,198
- 4
- 16
- 25
1
vote
0 answers
Bash: tab complete on partial word
I am very lazy. I am so lazy that I've defined this function in my .bashrc:
command_not_found_handle() {
if [ "${1:0:1}" = 'g' ]; then
git ${1:1} ${@:2}
else
#Prevent infinite recursion. Luckily this applies only in this scope.
unset…

whereswalden
- 4,819
- 3
- 27
- 41
1
vote
1 answer
Enable returning multiple arguments as completion reply at once in fish shell
I am working on porting Google Cloud SDK command line auto completion feature to fish shell. When I have an unambiguous reply with multiple arguments:
A) Either the command is completed with all those arguments BUT spaces gets escaped (\ ) when I…

Lajos Gathy
- 97
- 1
- 4
1
vote
0 answers
Tab completion within quotes?
In my GNU bash, version 4.3.11 I am using git and sometimes in comments I want to mention the files I changed. When doing so, I try to use the tab completion, so that I just have to type the first characters of the file name and then get it auto…

fedorqui
- 275,237
- 103
- 548
- 598
1
vote
0 answers
Tab completion not working correctly in gnuplot
I updated to Ubuntu 14.04 and installed gnuplot only to find that something has gone terribly wrong with tab completion. What is actually happening is something like this: Say I have two files in the folder:
abc.dat
def.dat
Now, if I type the…

Peaceful
- 4,920
- 15
- 54
- 79
1
vote
3 answers
Python CLI Framework and Argument Parsing with Tab Completion
I am looking for a good module that is already out there for parsing arguments on custom CLI interfaces. If you can imagine there is a CLI that gives you a prompt:
framework> commands go here....
It starts to get tedious when you add in arguments,…

Michael Scott
- 539
- 3
- 8
- 18
1
vote
1 answer
Completing vim and shell commands with arguments using input() prompt
I have a need to receive a vim command from user and store it to a variable. The user should be able to type the command with arguments just like Ex mode (with auto-completion via Tab). I found that this can be done in two ways, by defining a custom…

svlasov
- 9,923
- 2
- 38
- 39
1
vote
2 answers
zsh - first tab completion with autocd
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…

Bast
- 13
- 1
- 5
1
vote
2 answers
Assign directory to variable in a source file
I am building a source file with some alias to executable files (these are working just fine) and assigning directories to variables in order to get to the directory quicker, with less typing. For example, if I source…

PedroA
- 1,803
- 4
- 27
- 50
1
vote
1 answer
How can I enable tab completion for import statements in the Python interpreter?
Is there a way to enable tab completion for the import statement in python?
Example:
$ cd test/
$ ls
mytest.py
$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more…

reasgt
- 304
- 3
- 11
1
vote
1 answer
"andr" tab completes to "_xrandr" instead of android or nothing
I am running osx and installed oh-my-zsh as well, if that's relevant.
Anyway, if I type in something like "andr" and hit tab to complete it, it autocompletes to _xrandr instead of doing nothing (android isn't in my path). I'm not really sure…

randomafk
- 335
- 1
- 2
- 10