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)

2
votes
2answers
23 views

Tmux bash completion code walk-through

if [[ $COMP_CWORD -le $cmd_index ]]; then # The user has not specified a command yet local all_commands="$(tmux -q list-commands | cut -f 1 -d ' ')" COMPREPLY=( ...
1
vote
1answer
188 views

How can I reset the bash filename completion for “more”?

I've done something that has changed the way TAB auto-complete works, but only for the more command. Every other command lists the possible completions, but more now lists ALL of the possibilities ...
35
votes
1answer
1k 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 ...
13
votes
4answers
623 views

How to customize Bash command completion?

In bash, it's easy enough to set up customized completion of command arguments using the complete built-in. For example, if, for a hypothetical command with a synopsis of foo --a | --b | --c, you ...
3
votes
1answer
77 views

bash - ignore case but disallow autocomplete if ambiguous

Recently i face inconvenient when using bash auto complete with ignore case. Let's say i have this directories: [xiaobai@xiaobai test]$ l total 20K 3407873 drwx------. 60 xiaobai xiaobai 4.0K May 25 ...
3
votes
2answers
89 views

how to re-use existing completion with recent bash-completion?

i use alias which adds some parameters to some program. for example: alias git.home='git --git-dir=$HOME/.git.home/' complete -o bashdefault -o default -o nospace -F _git git.home \ ...
1
vote
1answer
47 views

Disable sorting of COMPREPLY in bash complete function

I have a list of words that should be present in the order of appearance in completion to a certain key, but bash seems to be internally sorting what is assigned to COMPREPLY array. How to avoid that? ...
3
votes
1answer
36 views

How can I ignore / remove / exclude autocompletions in zsh?

I usually use rs+[tab] to get rsync but it's showing three options (on a new system): ➜ $ rs rsh rsync rsyslogd I seldom use rsh or rsyslogd - how can I prevent these from appearing ...
3
votes
1answer
160 views

code review: automatic completion for bash aliases

I was reading How do I get bash completion for command aliases? and I thought, that the answer by Shawn J. Goff needed a little something: less user setup so I wrote a little script that is intended ...
3
votes
3answers
603 views

remove a host from the completion list for ssh in zsh

I once had some hosts named 'myhost', 'myhost1', etc. And now all those except 'myhost3' become invalid. I removed those from /etc/hosts and ~/.ssh/known_hosts, but zsh still completes them for me. Is ...
2
votes
1answer
130 views

g++ bash: warning: programmable_completion: g++: possible retry loop

When I type g++ and do tab completion for file listing, I get this warning **g++ bash: warning: programmable_completion: g++: possible retry loop** I googled it and so far no results . Can ...
1
vote
1answer
27 views

How to add a dir to fpath

I'm using zsh and prezto. I've adding the following line at the end of my .zshrc fpath=(/usr/local/share/zsh/site-functions $fpath) But unfortunately, the functions defined in this folder seems ...
17
votes
3answers
1k 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 ...
4
votes
1answer
139 views

How does Bash auto completion work?

I can understand that bash auto completion works for standard utilities. But how does it do auto completion for custom programs like Oracle SQL loader? In the following command if you Tab after ...
13
votes
3answers
445 views

Unexpected Bash completion of ~ on OS X

I pressed ~TabTab on the bash command prompt and got an unexpected set of completions. First it looked like all the folks in the /Users directory, and a lot more. Then I thought it was doing the ...
3
votes
1answer
182 views

variable name lost when tab completing to export an environment variable with a path

I'm trying to setup an environment variable using tab completion, e.g. snowch$ export JAVA_HOME=/usr/lib/jvm/java-6-oracle/ I used to be able to tab complete the folders after typing the export ...
8
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> ...
2
votes
2answers
154 views

bash completion in Posix mode

I would like to use an interactive Posix bash shell but the autocomplete feature doesn't work. When I type the Tab character it simply prints a tab. The tab completion works only when I'm in a ...
5
votes
3answers
562 views

bash does not autocomplete my command when using sudo?

I'm using SaltStack. I would like to auto-complete the minion name when calling the salt command. The following line has been added into ~/.bashrc: complete -o default -o nospace -W "$(sudo ls -1 ...
10
votes
4answers
1k views

How do I trigger autocomplete without a tab key?

I'm ssh-ing to my machine using my iPhone with an app called ServerAuditior. It doesn't have tab key. See screenshot. How do I trigger autocomplete without the tab key? I don't want to type a lot of ...
14
votes
1answer
670 views

How do command-line tools have their own autocomplete list?

How does Bash in Ubuntu know a tool's specific list of actions? For example if I type apt-get and tab twice I only see remove, update, upgrade ...etc, but not the actions for another command or the ...
7
votes
2answers
3k 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/, ...
3
votes
1answer
139 views

Autocomplete issue in bash with equal sign (=)

I am trying to make autocomplete work and wroted a piece of code to demonstrate an issue I faced up: $ cat completion.sh function _completion_command() { compopt +o bashdefault +o default +o ...
0
votes
1answer
14 views

how to access through the matches in file-name completion?

In case of file-name completion, is there a way to access through the matches that get displayed after a double tab?
3
votes
2answers
3k views

Tab autocompletion and history in tcsh

I use tcsh, and I'd like to set up the following behaviour, which I've seen on some systems in the past. If I type !string TAB then: If the history contains a unique entry beginning with string, ...
1
vote
1answer
37 views

Completions stopped working after upgrading zsh

Previously I have been using this handy script with oh-my-zsh to set the tab color whenever I ssh into a machine: # iTerm2 window/tab color commands # ...
24
votes
1answer
714 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 ...
0
votes
0answers
38 views

Add slash suffix and not space for folder commands on bash auto-completion

What i expect my bash shell autocompletion to be like, % cd $HOM<TAB> -> cd $HOME/<CURSOR-HERE> What it does to me, % cd $HOM<TAB> -> cd ...
1
vote
0answers
44 views

set -x doesn't print stack info for bash autocompletion

In my bash 4.2.46 and centos - 7.1.1503, I ran set -x (to print debug info). Now, if I type ls, it prints: + ls --color=auto a b c ++ printf '\033]0;%s@%s:%s\007' root sk-vbox '~' All well and ...
28
votes
4answers
12k 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 ...
0
votes
0answers
57 views

busybox tab completion in vi mode

When I use busybox and switch editing mode to vi via set -o vi then tab completion stops working. When I switch back set -o emacs then tab completion starts working again. # set -o vi # ls -l ...
1
vote
1answer
33 views

getting case insensitive completions with compgen in bash

I'm trying to get my command (devmode2) auto-completing with bash working with compgen -W, my bashrc has: _devmode2() { COMPREPLY=() local sonames=$(devmode2 --auto --current "${COMP_CWORD}" ...
2
votes
1answer
46 views

csh: setting command completion for `cd` to show both directories and files

In my csh terminal, when I do: ls tab -- it shows everything in the current directory as a possibility cd tab -- it shows only directories in the current directory as a possibility. If no ...
1
vote
1answer
103 views

zsh git command auto-complete add extra origin to the git branch name

After I clone a git repository locally, I want to switch branch to, says, 'ABCD'. $ git branch -a * master remotes/origin/ABCD remotes/origin/HEAD -> origin/master remotes/origin/master $ ...
15
votes
1answer
644 views

What's the magic that allows me to tab-complete remote files as I type an scp command?

Presumably this is a feature provided by some plugin I have enabled in my oh-my-zsh setup (I have been using zsh for many years now). I noticed ever since I added my public key to the server (now I ...
2
votes
0answers
40 views

Context-sensitive bash completion changes wildcard behavior

Somewhere along the way I've fallen into the habit of hitting tab twice after using a wildcard in commands like mv or rm, which by default causes bash to show the list of files that would match the ...
7
votes
4answers
7k 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 ...
3
votes
3answers
94 views

Autocomplete of a file name in bash prompt

I usually put a date before a file or directory name similar to 2014-04-20 file_name.doc. So, in a folder there is usually a bunch of files and directories starting with a date. But when accessing ...
0
votes
0answers
72 views

My apt-get installer has no autocompletion for some packages

I have installed Kali Linux v1.1.0 (Debian based). Filename completion for sudo was not running at the beginning, so I added: complete -c sudo And everything seems to autocomplete now, except for ...
2
votes
1answer
61 views

Writing a tab completion script for bash

I made a shell script that reads input from user and kills a process. But in bash if the user presses Tab key then bash suggests some keyword or file names. My script however doesn't suggest anything. ...
25
votes
1answer
4k 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 ...
2
votes
1answer
52 views

Bash completion - How to get filename completion for suboptions

I have a function which can take main arguments and then sub-arguments. Some of these sub-arguments are filenames. The current completion code I have is as follows. _scm() { local cur prev opts ...
2
votes
1answer
57 views

zsh case-insensitive mid-word completion

I have the following in my .zshrc for case-insensitive tab completion. I encountered a situation where the tab completion fails, and I can't figure out why. autoload -U compinit && compinit ...
1
vote
2answers
792 views

refresh bash tab completion

I have a script for auto-completing my ssh-hosts. If I change my ~/.ssh/config the auto-completion is not updated automatically, though. This does not surprise me. In a new shell, the new entry is ...
3
votes
1answer
89 views

Run a command in background that sets env var or define function

> export foo=1 & [1] 9016 [1] + done export foo=1 > echo $foo > I know when running a command with & you spawn a new process and the export foo=1 is not setting env vars in ...
2
votes
1answer
84 views

Install an additional completion function for bash

I have never used bash completion of todo.txt cli; however, I have decided to give it try. On the author's github, it says: (Optional, since v 2.9:) Install the Bash completion, either system-wide, ...
7
votes
4answers
4k views

Autocomplete server names for SSH and SCP

I have a few servers configured in ~/.ssh/config, such as alpha and beta. How might I configure Bash such that the commands ssh al<tab> and scp file.tgz al<tab> autocomplete the names of ...
2
votes
2answers
984 views

How to enable double tab autocompletion list in csh?

I've worked in Linux before where when I press tab it autocompletes until it becomes ambiguous. If I pressed tab twice at that point it would give me a list of all possible completions. My current ...
1
vote
2answers
81 views

Bash autocomplete: does not list files or directories

In my bash terminal, I would usually press tab twice to get the file and folder list. For instance cat 2XTAB would list all files and folders in the present directory and cd Proj2XTAB would list all ...
2
votes
0answers
138 views

Making zsh filename completion case-insensitive everywhere

I have the following line in my zshrc to make filename completions case-insensitive: zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' This works most of the time but I’ve noticed that if I ...