A feature provided by interactive programs such as shells and text editors that inserts text to complete a word or phrase that the user is likely intending to compose.

learn more… | top users | synonyms (2)

31
votes
2answers
4k views

Rebuild auto-complete index (or whatever it's called) and binaries in $PATH cache in zsh

After installing new software, an already opened terminal with zsh won't know about the new commands and cannot generate auto-complete for those. Apparently opening a new terminal fix the problem, but ...
22
votes
1answer
518 views

How do I redirect command completion output?

On the command line, I can redirect or pipe output of a command to a file or another command using the > or | operator after the command. I have come across a less standard situation that I would ...
20
votes
2answers
12k views

An easy bash completion tutorial? [closed]

I want to learn how to write bash completion scripts. Which tutorial would you recommend for a newbie?
20
votes
3answers
2k views

How does TAB auto-complete find options to complete?

And how does it also autocomplete aliases?
20
votes
0answers
431 views

Completing avfs fake directories in zsh

How can I tweak zsh's completion system to complete “fake” files in some circumstances? More precisely, the AVFS filesystem exposes archives as directories by creating a “fake directory” next to ...
19
votes
3answers
5k views

How to enable autocompletion for remote paths when using scp?

I remote copied a file to my laptop using: scp someFile USER@192.168.178.32:/home/USER/put/it/some/where/oh/damn/you/here I want to be able to autocomplete the remote path by hitting tab.
18
votes
4answers
5k views

Command-line completion from command history

So, I've looked at history and at Ctrl+R, but they are not what I thought I knew. Is there a way that I can type in the beginning of a command, and cycle through the matches in my history with some ...
17
votes
1answer
3k views

How do I get bash completion for command aliases?

I am looking to get tab-completion on my command line aliases, for example, say I defined the following alias : alias apt-inst='sudo aptitude install' Is there a way to get the completions ...
12
votes
3answers
2k views

How can I tell bash valid tab-completions for arguments to my Python script

Say I have a program hello.py and one possible valid argument to it is: ./hello.py autoawesomesauce Is is possible to type in: ./hello.py auto[tab] at which point the partially completed ...
12
votes
1answer
529 views

Dynamically update completion list in zsh

I find zsh's result lists for Tab completion quite useful, however I'd like to tweak their behaviour a bit: They should appear when I Tab for the first time and afterwards dynamically update with ...
11
votes
1answer
369 views

Bash completion for comma-separated values

I would like to create completion rule for comma-separated parameters list. E.g. I have command which receives list of server names: myscript -s name1,name2,name3 At this moment I've managed to ...
11
votes
1answer
2k views

Add arguments from previous command to zsh completion

In zsh (as well as bash) you can use some history word expansions to denote arguments from previous commands. This example shows getting the 2nd parameter from the previous command in history with ...
11
votes
0answers
353 views

How to fix tab completion so it doesn't hide entries?

I'm using oh-my-zsh on Mac OS X with homebrew'ed zsh 4.3.12. I stumbled recently on a weird problem. In scripts/not-used I have several .R files: breakdowns.R eventloop.R ...
10
votes
1answer
362 views

Bash tab completion expands “~” into “/home/___” when it didn't before

Previously, if I typed ~/biTab, before, it would turn into ~/bin. However, today it started turning ~/biTab into /home/username/bin. I would rather have it the former, but I'm not sure what happened ...
10
votes
2answers
111 views

Cancel completion, but only completion, in zsh

When a completion function takes a long time, I can interrupt it by pressing Ctrl+C (terminal interrupt key, sends SIGINT) or Ctrl+G (bound to send-break). I am then left with the uncompleted word. ...
9
votes
3answers
641 views

How to pipe the list of commands displayed by of “tab complete”?

When using commands in bash I like the double tab option to display the available commands. Some commands have more possible matches than others: Is there a way I can pipe the output of the double ...
9
votes
2answers
1k views

Make zsh completion show the first guess on the same line (like fish's)

In Fish when you start typing, autocompletion automatically shows the first autocompleted guess on the line itself. In zsh you have to hit tab, and it shows the autocompletion below. Is there anyway ...
9
votes
2answers
2k views

Make BASH's Tab Completion Fill In First Match?

Is there any way to make BASH fill in the first match when I press TAB, kind of like the Windows command prompt? (It should still display the list of matches, but it should cycle through them when I ...
9
votes
5answers
2k views

Weird Stuff in Terminal When I Hit Tab

For some reason, today, everytime I hit tab in the terminal this shows up: cat bash: warning: setlocale: LC_CTYPE: cannot change locale (en_CA) Display all 150 possibilities? (y or n) This ...
9
votes
2answers
828 views

Command line prediction

I've found an interesting paper: Predicting UNIX Command Lines about command-line prediction (based on user past activity), and I wonder if any actual implementation of such thing exists?
9
votes
3answers
80 views

Bash autocomplete with vim command

In bash, autocompletion of paths has recently stopped working when issuing vim commands where the path is deeper than two directories (it continues to work as expected with other commands, such as ls ...
8
votes
1answer
2k views

Terminal autocomplete: cycle through suggestions

I had this on my Ubuntu setup and since I switched to Fedora I want to set it and I forgot how... The idea is simple : I don't want the terminal to show me suggestions when I double tab, instead I ...
8
votes
6answers
408 views

How to disable emacs here document completion

When editing a bash script file with emacs, and trying to enter <<<, at the second < emacs insert a template for a here document, like in the following example: <<EOF EOF This is ...
8
votes
1answer
100 views

Disable Bash autocompletion for a specific command only

Is it possible to disable Bash's autocompletion for a specific command only? Use case: For obvious reasons, I would like to disable autocompletion for the rm command when I'm root. It would also be a ...
8
votes
1answer
914 views

Bash autocomplete in ssh session

It seems that bash doesn't want to autocomplete commands (what's annoying me right now is not autocompleting apt-get) when I'm logged into my machine from SSH. Is there some setting that will allow ...
7
votes
3answers
322 views

Select unicode filename in Bash

Ok; suppose I'm in Bash and I have several files in a folder. Several of them are named file☠☡☢☣.txt, where ☠☡☢☣ starts with crazy untypable unicode characters. How would I refer to one of them? ...
7
votes
1answer
107 views

Change zsh completion to put completions above the prompt

I'm a long-time tcsh user that finally decided to try out zsh. I've been toying around with completion, but one thing I don't like is that when I hit tab for a completion that might have a lot of ...
7
votes
1answer
252 views

compgen : ignoring case

I'm trying to implement a custom bash completion as described here. However, it seems that compgen is case-sensitive. Is there a way to turn it case-insensitive in that context ?
7
votes
2answers
1k views

Create bash completion script to autocomplete paths after is-equal sign?

I want to create a bash completion script which recognises arguments of the form --arg and --some-arg=file. After reading this tutorial and some examples in /usr/share/bash_completion/completions/, ...
7
votes
1answer
355 views

How to output string completions to stdout?

Some of the git commands have many options, and it would often be useful to search through them for the one I need - I was just looking for the option which controls the TAB width in git-gui, but ...
7
votes
2answers
308 views

Need help on this bash auto completion script

I'm trying to setup autocompletion for a command, which takes only one parameter, a folder name, In /secure/kernel_builds/, I have the three following subfolder: 3.5.6/ 3.6.2/ source/ Now I want ...
6
votes
3answers
453 views

Bash autocomplete gives different file name than ls

An incredibly strange thing just happened. Through a serious typo, I entered cp filename.xsl .^?~ Yeah, that's right, dot-caret-questionmark-tilde! Truth is stranger than fiction. It gets weirder. ...
6
votes
3answers
1k views

Tab-completion for Mercurial in Bash?

Using Subversion on the command-line, it intelligently tab-completes available subcommands, etc: $ svn c<tab> cat checkout cl co copy changelist ci ...
6
votes
2answers
889 views

How to implement package install suggestion on Debian?

I have noticed that while on Ubuntu, if I type the following: mc and it isnt installed, I get the message below: The program 'mc' is currently not installed. You can install it by typing: sudo ...
6
votes
4answers
2k views

How does Bash path completion work with sudo?

Tab path completion does not work (at least on Ubuntu and AFAIK Arch) with sudo mount <whatever> The iso file I am trying to mount is not in /etc/fstab. If I just type mount <whatever> ...
6
votes
2answers
1k views

How to debug and fix slow autocomplete in bash?

After a recent update (Ubuntu 12.04 LTS), TAB complete on the command line is slow. After entering a partial command (e.g evi [TAB]) or partial filename (e.g. evince somedocu[TAB]) the shell, ...
6
votes
1answer
67 views

Zsh auto complete suggest complete functions (_git _vim etc)

I have a small annoyance with how zsh is doing complete suggestions for my commands. If I type the beginning of a command that I don't have installed and press tab it will suggest the completion ...
6
votes
3answers
165 views

How to order files by date in tab completion list

$ 7z l ~/Downloads/Tab How to make the resulting list to be sorted by date, not by name? I currently use special script to list N most recent files in a given directory (and copy the filename ...
5
votes
1answer
755 views

Git auto-complete

I am using Git as many of you do. Also, I don't use any GUI for that — just CLI. So I was wondering: are there any way to make Git commands (git status, git checkout etc.) complete themselves when ...
5
votes
2answers
777 views

is there a way to set coloring for cd tab complete?

I use ubuntu 11.04. Is there a way to set coloring for output after tab completion listing of a cd, ls, or etc. ? i.e. myshell@root$ cd ~/user/files/ I hit tab... myfile myfoo mybar <-- this ...
5
votes
2answers
930 views

vim custom pop up menu

How do I create a custom completion pop up menu. I would like to be able to begin typing a part of a string then press a custom key combination to bring up a pop up completion of just a certain group ...
5
votes
4answers
5k views

Apt-get autocompletion

I am currently running 64-bit Debian Wheezy. I am having some trouble with auto completion for apt-get. I have bash-completion installed. If I am logged in as root in a shell, I can use auto ...
5
votes
1answer
898 views

How do I get my shell functions to make use of existing autocompletion in zsh?

I have a couple of shell functions defined in my .zshrc which save on typing and allow integration with screen. For example: function s() { screen -t "$1" ssh "$@" } However, when I use these ...
5
votes
1answer
2k views

TAB autocomplete in Bourne Shell

I don't know how to get the TAB key to autocomplete filenames, commands, or anything at all. I'm on a Unix-like system (OS/390) and depend on several scripts that work in sh (Bourne shell, not ...
5
votes
3answers
322 views

Custom autocomplete: deal with spaces in filenames

A bit of context, this question is a follow-up of this one: Bash remote autocompletion : change the 'starting' directory Anyway, I'm writing my custom autocompletion bash script: I want the ...
5
votes
1answer
480 views

Cancel zsh tab completion

Is there a way to cancel a completion once it has been started? I sometimes foolishly press tab to autocomplete make targets (only from sheer indolence) and then end up having to wait for a longer ...
5
votes
2answers
458 views

Bash autocomplete: first list files then cycle through them

Is it possible to configure bash in such a way that on the first tab autocomplete it lists all possible files and on subsequent ones cycles through the choices? Both options are easy to do ...
5
votes
3answers
940 views

Auto-completion of words from the terminal buffer

In editors like vim and emacs, one can use hotkeys like C-p (vim) or M-/ (emacs) to perform auto-completion on the current word using other words in the same buffer. Is it possible to achieve the ...
5
votes
1answer
277 views

zsh - fully expand binary path on <tab>

In my current zsh behaviour, hitting tab after typing "sudo" just adds a space. $ sudo ... What I really want is for the tab to fully expand to the path of the binary it is about to execute when I ...
5
votes
2answers
67 views

How do I set Zsh autocompletion rules for second argument (of function) to an existing command's rules?

I have a custom Zsh function g: function g() { # Handle arguments [...] } Within it, I handle short arguments that execute Git commands. For example: g ls # Executes git ls-files ... g g # ...