Skip to main content

Questions tagged [tab-completion]

Tab completion is a user interface enhancement for shells and other command line programs. Typing the first few characters of a command (or argument) and pressing the Tab key results in the rest of the word being automatically completed by the program.

Filter by
Sorted by
Tagged with
58 votes
5 answers
20k views

How can I get bash to perform tab-completion for my aliases?

I have a bunch of bash completion scripts set up (mostly using bash-it and some manually setup). I also have a bunch of aliases setup for common tasks like gco for git checkout. Right now I can ...
dstarh's user avatar
  • 705
52 votes
1 answer
29k views

How can I make zsh tab completion fix capitalization errors for directories and files?

I switched to zsh completely on a previous arch install and I LOVED it mainly because arch is one of the distros that capitalizes your Documents, Downloads, Music and such directories in your ~ ...
Aaron's user avatar
  • 521
43 votes
1 answer
15k views

Make bash's tab-completion case-insensitive [duplicate]

Possible Duplicate: Case insensitive tab completion in Bash Is there any way to make the tab-completion in bash case-insensitive? For instance, if I have a file called Hello.txt and try to tab-...
Wuffers's user avatar
  • 19.3k
17 votes
4 answers
6k views

Bash completion makes bash start slowly

Starting a bash on my ubuntu system takes about 2 seconds. If I remove loading /etc/bash_completition in .bashrc it starts without delay. Of course I don't want to give up completition and I don't ...
user75250's user avatar
  • 287
15 votes
3 answers
6k views

Is there a shell which supports fuzzy completion as in Sublime Text?

I'm using bash and I was wondering if there is any plugin in bash or other shell which allows me to do this cat tfnislong.txt + [tab] completes to cat ThisFileNameIsSoLong.txt just like tab completion ...
woodings's user avatar
  • 647
14 votes
2 answers
12k views

bash completion for filename patterns or directories

I'm trying to get a bash completion script set up and having some trouble. I would like to set it up so the completions listed are either files matching a particular extension, or directories (which ...
Rob I's user avatar
  • 243
13 votes
4 answers
4k views

Vim command mode complete word

Is there a way to get Vim in command mode to complete words from the current file? Say I have this file: one two three once and I enter command line mode :myruncommand o| where | denotes the ...
Nickolay Kolev's user avatar
12 votes
4 answers
4k views

Zsh, directory tab-completion with prefix

I have a directory where I put all my projects in, let's say it's ~/projects as an example. I've made a command called s which takes one argument, and moves me into that directory. E.g.: s foo moves ...
nifty's user avatar
  • 355
8 votes
2 answers
4k views

Smart tab completion (for directories)?

Are there shell versions that have a more intelligent tab completion? I'd like to be able to type cd foo-<TAB> Then it would show me the possible completions along with numbers that I can ...
dehmann's user avatar
  • 2,323
8 votes
2 answers
2k views

Why does bash tab-expand a tilde when I am completing a vim file name?

If I type cat ~/.bashr<TAB> then it completes to cat ~/.bashrc. If I type vim ~/.bashr<TAB> then it completes to vim /home/neil/.bashrc... (It does the same with vi, which is aliased to "...
Neil's user avatar
  • 879
8 votes
1 answer
2k views

Bash partial glob expansion

I have a question similar to this one, but different: I want bash to use a glob expansion in auto-completion, if possible. For example, I would like $ ls *2.<TAB> To give me: $ ls mydoc2. ...
Ryo's user avatar
  • 389
8 votes
1 answer
3k views

Bash-like, non-rotating filename tab completion with PowerShell

Under Windows, using PowerShell, is it possible to make the filename suggestion (using the Tab key) work like with bash under Linux? Let's assume a directory contains 3 directories: example1, example ...
Bruno's user avatar
  • 618
7 votes
2 answers
3k views

How do I restore tab-completion on shell variables on the bash command-line?

I've long set my most-recently visited directories to shell variables d1, d2, etc. On an ancient Fedora machine I could type a command like $ cp $d1/ and the shell would replace $d1 with text like ...
Eric's user avatar
  • 471
7 votes
2 answers
2k views

Bash: always display file possibilities on tab-complete

When I use tab for filename completion and there are more than ~100 matches, it displays something like "Display all 403 possibilities? (y or n)". This gets annoying when I do it many times a day. Is ...
fferen's user avatar
  • 173
7 votes
2 answers
2k views

bash complete: list directory names from a defined directory?

I need the directory names in /mailman/lists to tab-complete as an argument (without any slashes) to the 'list_members' command regardless of where I am in the filesystem. In tcsh (on our old server),...
zenatom's user avatar
  • 121
7 votes
2 answers
3k views

Tab completion for .bat files in Git-for-Windows Bash

Git for Windows installs "Git Bash," a bash shell that works in Windows, which is very nice. It's based on MinTTY, I believe. As well as bash shell scripts, it can also execute Windows batch (.bat) ...
KRyan's user avatar
  • 255
7 votes
2 answers
3k views

How can I get emacs under windows to autocomplete paths in shell buffers using "\" instead of "/"?

I'm using emacs to work on linux, windows, osx and everything is fine except one annoying problem with shell buffers under windows. Autocompleting filenames would work great (better than standard ...
6502's user avatar
  • 145
7 votes
2 answers
1k views

How do you set a minimum number of characters for Bash tab completion?

Is there a way to set a minimum number of characters to Bash's tab completion? My reason is that I often accidentally press the tab key on an empty command line and it takes forever to load the ...
Yuval Langer's user avatar
6 votes
3 answers
2k views

Do not expand wildcard on tab completion

I'm wondering how I can configure zsh to not expand the wildcard in a filename. For example I have a directory of a couple hundred files named as following: a.foo-bar a.foo b.foo-bar b.foo c.foo-bar ...
BMorgenthaler's user avatar
6 votes
1 answer
2k views

Is it possible to force bash tab completion suggestions to list in a single column?

When I'm typing a filename and double-press Tab, a directory listing occurs to suggest all options for the tab completion. By default it lists in the same format as ls however I would prefer it to ...
DanH's user avatar
  • 333
6 votes
2 answers
2k views

Bash auto-completion of variables adds additional white space at the end

When I perform an auto-completion of a bash variable, an additional whitespace character is added at the end. So this: $FO[TAB] Becomes this: $FOO" " I added the quotes in order to denote the ...
user avatar
5 votes
1 answer
1k views

Completion stops working in /root directory

If I am in a root terminal su, then everything is fine: completion is OK everywhere. The problem arises if, as a normal user, I try to use sudo to reach the /root/ directory , for instance, if I want ...
mazda's user avatar
  • 177
5 votes
1 answer
2k views

Tab completion for command arguments fail in Cygwin due to `.exe` extension

Is there a configuration option in Cygwin so that when Bash completes the name of the command, the filename’s .exe suffix is ignored (not included)? Explanation of the problem When using tab ...
Anthony Geoghegan's user avatar
5 votes
11 answers
2k views

How to minimize typing when frequently changing directories?

What are some good Linux commands to make switching between different directories on the command line easier? I often have to switch between different directories with long names, e.g. cd foo/20100801-...
dehmann's user avatar
  • 2,323
5 votes
4 answers
5k views

zsh completion will not work in emacs shell

I'm learning about the more powerful tab-completion and expansion capabilities of zsh, and they don't seem to work when I run zsh under emacs with M-x shell: cat $PATH<TAB> expands the tab ...
benhsu's user avatar
  • 631
5 votes
2 answers
3k views

Bash Autocomplete Subdirectory for Custom Command

I have tried for hours to get this working and feel like I've not come anywhere close. I am trying to shorten our workflow by tab-completing directory names from the Mac OS X Terminal. We have an ...
Gedrick Wilson's user avatar
5 votes
2 answers
1k views

Access Finder's "Open With" menu from the commandline (for tab completion)

On Mac OS X, I know one can open a file from the commandline with its default application with open, and with other applications with open -a <application name>. Thus, open movie.avi open -a ...
ShreevatsaR's user avatar
5 votes
2 answers
2k views

Setting up tab-completion of paths in bash or zsh to resemble tcsh

I’m a long time tcsh user, but all the cool kids seem to be using either bash or zsh nowadays (that is, completion patterns for git or stuff are available for bash and zsh, rarely for tcsh). My ...
Olivier 'Ölbaum' Scherler's user avatar
5 votes
3 answers
380 views

How do I abort building the list for tab completion without losing the command?

some_very_long_command_line --arg1 --arg2=555 --arg4 ... ... ... && <now Tab pressed> (Now it works. I want to cancel before the following message) Display all 6936 possibilities? (y or ...
Vi.'s user avatar
  • 17.3k
4 votes
1 answer
2k views

How do I make bash do vim-like tab completion for file names?

I'd like for bash to rotate through the matching file names instead of listing them, like the default tab completion behavior in vim. Is there an easy command to do this? This is essentially the ...
thebossman's user avatar
4 votes
1 answer
3k views

zsh: Select menu auto-completion with single Enter/Return press

Once finding the auto-completion I want to select from the completions menu, I currently need to hit <Enter> twice - once to add the selection to the terminal, and once to execute the command. ...
Kipras's user avatar
  • 191
4 votes
1 answer
538 views

zsh autocomplete results from function

I've been searching and searching and unable to find a clear way to do this: Slightly contrived example to hide details: Say I want to autocomplete tmux session names with a command that will open ...
alecbz's user avatar
  • 348
4 votes
1 answer
525 views

How do I get zsh tab completion to "vi **/foo<TAB>" to match and complete the first file matching "foo*" anywhere under the current directory?

How do I get zsh tab completion to cat **/foo<TAB> to match and complete the first file matching foo* in any subdirectory under the current directory? For example, do this while inside a fresh ...
Mike Morearty's user avatar
4 votes
2 answers
2k views

Can bash (or a terminal) auto-complete (tab-complete) from terminal buffer contents?

Imagine I have a bash session in a terminal, just after some output: $ grep foo *.txt this.txt: something123 foo $ After this grep, let's say that my next command will take something123 as an ...
wodow's user avatar
  • 207
4 votes
5 answers
1k views

Command-T for shell

I'm looking for a shell extension that allows me to do filename completion similarly to Command-T. Command-T a feature in TextMate and a plugin for Vim that allows you to select filenames by typing ...
Ryan Patterson's user avatar
4 votes
1 answer
231 views

Why does a value '-' (hyphen) in "tag-order" style prevent matching of the "executables" tag even if that tag is explicitly specified?

With the code below, everything works as expected: When I write c and hit the TAB key, I get the appropriate completions in correct order. When I write ./ and hit the TAB key, I get the ...
Iskustvo's user avatar
  • 290
4 votes
1 answer
227 views

How can I enable colored completion in Vim?

I understand that this questions could be a bit unclear, but I think an example will help. I'm in Vim and want to open a file. There are a few files in my directory and some have the same prefix. I ...
Peter Stuifzand's user avatar
4 votes
2 answers
1k views

zsh completion doesn't work under Cygwin for other drives

I'm on Win7 x64, Cygwin 1.7 and zsh (and using oh-my-zsh). Zsh newbie here. I've reviewed zsh autocompletion not working on cygwin and tried the solution there but no luck. My mount table: C: on /...
Raghu's user avatar
  • 143
4 votes
0 answers
160 views

TAB completion with .bash_history

I usually use PageUp/PageDown to search through .bash_history given a prefix. However, I regularly catch me pressing TAB multiple times before realizing that I need to use PageUp/PageDown in this ...
Sven R. Kunze's user avatar
4 votes
0 answers
863 views

Can't tab complete in psql

For some reason, tab-completion isn't working in psql on my Mac. I can tab complete table and field names just fine in Ubuntu, but pressing TAB fails to work in Mac OS X. I can successfully use my Up/...
mcandre's user avatar
  • 3,048
4 votes
0 answers
689 views

How can I get bash to perform case insensitive tab-completion for my aliases and functions?

I have an alias like this: alias sshUntrusted='ssh -X -C -c blowfish-cbc,arcfour' But when I type $ sshun followed by Tab, Bash does not complete the alias. I have put set completion-ignore-case ...
FooBee's user avatar
  • 141
4 votes
1 answer
209 views

Unquoted completion lists in zsh

I noticed that autocompletion lists in zsh escape all filenames like this Age\ of\ Empires\ 2/ ePSXe\ 1.7.0/ Touhou\ Project/ Windows\ 98\ SE/ Aikisado/ Mathematica\ 8/ ...
user1002327's user avatar
3 votes
1 answer
1k views

Tab completion closes SSH connection

I am using SSH connection to log into my Raspberry Pi. I used tab completion over SSH before and that worked perfectly. But now I am getting the "connection closed" message whenever I try to use tab ...
Shoumik Hoque's user avatar
3 votes
2 answers
664 views

Completion when pasting Bash command beginning with tabs

I'm writing a Dockerfile which I'm formatting using tabs (which I usually use everywhere). But I've copied a multi-line command where the second line begins with two tab characters, i.e.: apt-get -y ...
lucasvc's user avatar
  • 222
3 votes
2 answers
118 views

Is there a way to tell the shell (zsh preferably) about a command?

I defined an alias: alias school="cd ~/School/3BaFys/" to quickly go to the folder 3BaFys which contains all of the directories I need this year. Is there a way to tell zsh that when I do: $school ...
romeovs's user avatar
  • 309
3 votes
2 answers
651 views

Can I ignore dot files with cmd.exe tab completion?

I unfortunately need to work with cmd.exe from time to time and it usually doesn't bug me too much except when I am editing a file in vim and then try to run that file with tab-completion. If I have ...
djs's user avatar
  • 268
3 votes
2 answers
807 views

How can I turn off completion cycling in zsh?

How do I prevent ZSH cycling through matching completions but instead just presenting a list of remaining possibilities in a list? On my more recent OS installations I've started getting ZSH cycling ...
Sridhar Sarnobat's user avatar
3 votes
1 answer
2k views

How do I view the tab completion function for a command in bash?

I ultimately want to alias screen -r. I mostly want to do this because that command has an awesome tab completion feature that shows me the current GNU screen sessions. I want that power with the ...
Matt Kneiser's user avatar
3 votes
1 answer
204 views

Why does ~username/ change to /home/username if tab-completing a path with a space in it?

In ~jacksonc/temp/ there are two files, test.txt and space test.txt, both placed there through Windows (using Samba). Using bash, if I type cat ~jacksonc/temp/t[tab] , it autocompletes to cat ~...
Cam Jackson's user avatar
  • 2,496
3 votes
1 answer
1k views

Add strings to zsh tab completion for all commands and arguments

I want to add the keywords foo and bar to be added to the auto completion results for any command or argument. eg: cd <TAB> should give foo and bar in the suggestions in addition to the ...
woodstok's user avatar
  • 981