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)

29
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 ...
19
votes
3answers
2k views

How does TAB auto-complete find options to complete?

And how does it also autocomplete aliases?
18
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
2answers
10k views

An easy bash completion tutorial?

I want to learn how to write bash completion scripts. Which tutorial would you recommend for a newbie?
16
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 ...
15
votes
0answers
278 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 ...
14
votes
4answers
4k 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 ...
12
votes
1answer
482 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
3answers
1k 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 ...
10
votes
1answer
322 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
96 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. ...
10
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 ...
9
votes
3answers
595 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
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
688 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?
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
372 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
2answers
691 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 ...
8
votes
1answer
853 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
232 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
85 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 ...
7
votes
1answer
97 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
233 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
1answer
324 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 ...
6
votes
3answers
420 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
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

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/, ...
6
votes
1answer
38 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
1answer
242 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
0answers
244 views

zsh: 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 ...
5
votes
2answers
798 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
4k 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
1k 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
2answers
210 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
426 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
359 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
825 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
2answers
780 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, ...
5
votes
1answer
251 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
349 views

How can I fix this SSH hostname tab completion script?

I found the following script (for bash) that enables me to get tab completion for any hostname I've connected to (from ~/.ssh/known_hosts): complete -W "$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ...
5
votes
1answer
195 views

Custom bash autocomplete for git breaks other git autocomplete features

I am trying to add autocompletion to git commit upon hitting TabTab. The autocomplete feature I am working on is based on a branch-naming convention. The convention is to append the PivotalTracker ...
5
votes
0answers
87 views
+50

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 ...
5
votes
2answers
129 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 ...
4
votes
2answers
233 views

Command completion does not complete the files in the current directory

Something is wrong with my tab completion. Let's say I do this: cd test // works fine, go into test directory ls // works fine, displays all of the files Let's assume I have the following files: ...
4
votes
4answers
111 views

Bash-completion and grep

I installed a program (iftop) on Debian Squeeze but some days ago I forgot it's name. I had only this information about the program: 1) It was called *top 2) I could find it using bash-completions. ...
4
votes
2answers
70 views

Check argument before program run

I have noticed that, when I type unzip in bash and press tab, auto-complete works only on files with .zip extension. How is that done? What if I would like to make program that would accept only image ...
4
votes
1answer
626 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 ...
4
votes
1answer
172 views

Zsh completion, enabling shift-tab

When zsh shows you a menu of possible completions, I'd like it to let me use shift-tab to access previous completion entries--is there an option that controls what key is used to access previous ...