Questions tagged [autocomplete]

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.

Filter by
Sorted by
Tagged with
4
votes
1answer
474 views

When using zsh tab-completion, Ignore CDPATH if a local file or directory matches

I love Z shell's tab completion with CDPATH, but sometimes it's overkill. I'd like it to only kick in as a fall-back if nothing in the local directory matches. For instance, I was just in ~/Code/...
4
votes
2answers
588 views

Where do bash completion functions come from?

I have a Raspberry Pi running Raspbian (Debian Wheezy). I entered set in a terminal and was surprised by the long list. This seems to be almost entirely git functions — ~3700 lines of them. ...
4
votes
1answer
195 views

Tab-completion within for loops not working

Tab completion for executable command is not working within interactive for loops in bash. I could have sworn it used to work, but I'm open to the idea that it's never worked and I'm going crazy. It ...
4
votes
1answer
4k views

ZSH autocompletion gives seemingly random errors after some time

My zsh autocompletion is broken in a strange way. For clean logins everything works but after some time I will get seemingly random autocompletion errors, for different "kinds" of autocompletion. ...
4
votes
1answer
696 views

bash_completion for initscripts

I have writen my own initscript /etc/init.d/myscript. I can start and stop my script with the service command service myscript start service myscript stop When I type service <TAB>, ...
4
votes
2answers
2k views

Autocompletion for Makefile rules in tcsh

I'm using tcsh in a SUSE 11 box and I realized that when typing makeTab it allows me to auto-complete the rules available within the Makefile, not the files that are inside the current directory. ...
4
votes
2answers
7k 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, ...
4
votes
1answer
162 views

Remove executable from path [duplicate]

I have a script called teleport in my path. When I type tele and hit tab, I'd like for tab-completion to complete this to teleport. However, there's another program installed on my system: telepathy-...
4
votes
3answers
2k views

zsh: completion rules for ssh

in zsh, I can autocomplete hostnames from /etc/hosts, ie: ssh f<TAB> will offer completions for hosts starting with f. This is configured in /usr/share/zsh/functions/Completion/Unix/_hosts: ...
4
votes
1answer
610 views

Make Bash Tab Autocomplete match like “Contains” in all possible files instead of “Starting With”

I want to make the bash autocomplete on TAB behave a little like oh-my-zsh. I already added ignore case and cycle through all possibilities on each tab. Now currently if I have a folder in directory ...
4
votes
2answers
608 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 ...
4
votes
1answer
613 views

can we use something better than more for tab completion?

more is not as convenient as less. Is it possible to use something better than more for tab completion, when ls and then tab? Thanks.
4
votes
5answers
1k views

Why can't I use tab expansion/auto-complete of shell variables with cd?

I have setup a variable in .bashrc: export SOME_DIR=/path/to/some/dir Now, with ls I can type ls $SOME_DIR[tab] and the variable will be expanded, and I can then use tab for auto-completion when ...
4
votes
2answers
612 views

zsh completion - show more options than just the alias

I am trying to modify the behaviour of zsh completion and its menus. I'm stuck, and I've read so much documentation it's making my head spin. The following is only an example; I'd prefer answers that ...
4
votes
2answers
6k 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 ...
4
votes
1answer
877 views

compgen warning: -C option not working as I expected

What is the correct way to use the compgen -C option? I'm trying to learn about Bash programmable completion, and in particular the compgen builtin function. I'm experimenting with the different ...
4
votes
1answer
580 views

_path_files and compadd ignore-files parameter

What is the format for the -F option of _path_files and compadd? I'm passing several directories to _path_files: _path_files -W "($base_directories)" -/ But some of those directory trees I don't ...
4
votes
1answer
336 views

What can bash do: syntax highlighting, git info prompt and autocomplete based on the middle of a word?

I'm using prezto framework for zsh and started wondering if I really need zsh. Main features I really enjoy are: syntax highlighting for commands, fancy prompt when in a git repository and the ...
4
votes
1answer
546 views

Is it possible for bash/readline to “clean up” completion suggestions out the terminal?

If you are using zsh and do a tab completion for commands, pathnames, options etc, whenever there are multiple potential matches the suggestions will be displayed below the prompt. Once you chose a ...
4
votes
1answer
62 views

Prevent customized bash autocomplete from affecting io redirection (< and >)

I've used complete -W 'firstdatabase databasetwo etc' mysql to save a list of databases, so that I can autocomplete them using the mysql command. However, in many cases I would type mysql db < /...
4
votes
1answer
944 views

Custom tab-completion in bash's `read`

Is there a way to "import" a list of words into bash's read builtin to have custom tab-completion? I've been writing a wrapper script for suckless' minimalist irc client "ii", and I don't have a way ...
4
votes
0answers
28 views

Bash completion own compgen prefix

I have a simple bash completion script that essentially invokes my (non-bash) program and set its output to COMREPLY, i.e. COMPREPLY=( $(my-program -- "${COMP_WORDS[@]}") ) Some of the options ...
4
votes
0answers
144 views

How do I wrap the zsh completion list with a fixed line of text before and after?

Specifically, I'd like to arrange for all completion lists (under the :completion:* context) to be preceded and followed by a fixed string (say "ABC" for the moment) on its own line. I have tried a ...
4
votes
0answers
360 views

custom zsh autocomplete

I'd like to write a zsh completion for pytest. Where do I Start? I'm using oh-my-zsh. in .zshrc: fpath=($HOME/.mycompletions $fpath) autoload -U compinit && compinit -u in $HOME/....
4
votes
0answers
113 views

Manual tab completions in zsh

I would like nm[TAB] to expand to node_modules in zsh. Is this possible? How can it be done? Ideally, it wouldn't be triggered if there is another completion available, such as an already existing nm ...
4
votes
2answers
529 views

Trouble w/ bash programmable completion of filenames matching patterns

I've got a simple command named th. I've got a bash-completion file for it that goes as follows: _th() { COMPREPLY=() local curr=${COMP_WORDS[COMP_CWORD]} COMPREPLY=( $(compgen -f -X '!*.@(tar|...
4
votes
0answers
40 views

Forward Autocorrect to a script [duplicate]

Possible Duplicate: How do I get bash completion for command aliases? I wrote a series of scripts to make package management a little more intuitive for me. However, I can no longer tab complete ...
3
votes
5answers
2k views

How to set proper monitoring of my services in a automated way? So that if one crash it auto on the fly restarts?

How can i setup monitoring to my system services? Either using automated script which scan every moment, if httpd, mysqld, and my custom daemon is running or not, if not running it will automatically ...
3
votes
3answers
2k views

vi <TAB> completes only directories in bash

In a directory I type vi and then tab (twice), this gives me user$ vi CMakeFiles/ global/ libs/ whereas ls followed by 2 tabs gives me user$ ls ! core.log CMakeFiles/ global/ libs/ _jni/...
3
votes
2answers
419 views

Why does man page completion fail after su?

I have a default Debian 8.1 installation. I do su man apt<TAB> but get nothing. I do see the manual when I write man apt-get in both modes: as user mas and as root. However, tab completion ...
3
votes
1answer
2k views

zsh adds tab character when autocompleting

I have zsh 4.3.10 installed on a RHEL 6.4 box. I'm not sure why this happens, but when I but Tab to autocomplete things, it also adds a tab character. For example: rocket@rhelbox www % vim vim ...
3
votes
3answers
4k views

Tab completion hangs

When I first open a terminal, or open a new one after not having used one for a while, any kind of tab completion in my home directory (for example, ls and Tab) takes several seconds. I have seen this ...
3
votes
2answers
2k 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 # http://code.google.com/p/iterm2/wiki/...
3
votes
2answers
299 views

exclude particular file from bash_completion

I have a simple bash_completion code. The only thing it does, is when I type grcat and then Tab, it offers to complete filenames from /etc/grcat. _grcat() { local word COMPREPLY=() if [ 1 ...
3
votes
1answer
318 views

bash tab completion not working in >& redirection

When I use tab completion on an argument after ls command it works, but when I use it after some script argument (see second example below) it does not work. I have checked that tab completion is ...
3
votes
1answer
393 views

zsh completion: menu and unambiguous prefix with a single tab?

I'm in a folder where I have the following files: aaa1 aaa2 aaa3 bbb1 bbb2 bbc1 bbc2 and I have typed cd a at the prompt. Currently, pressing Tab completes to cd aaa then another Tab brings ...
3
votes
2answers
666 views

Can I ignore __pycache__ directories in bash-completion and grep?

I've ignored __pycache__ in my git repos and in vi's wildmenu. The last place these directories pollute my workflow is when recursively grepping through project files and when using tab auto-...
3
votes
2answers
957 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
2answers
2k views

Bash and Tab Auto-complete

I recently put Fedora Core 15 on my system, and I've had a behaviour change that I can't figure out. Using Tab-Complete in the BASH shell works fine except when I use the $HOME variable. If I type cd ...
3
votes
2answers
997 views

How to change the target directory for tab completion?

I found a short script to enable note-taking on onethingwell, which includes this: function n { nano ~/n/$1.txt } I'd like to extend it to do tab completion, so that if I want to edit the pre-...
3
votes
1answer
2k views

ZSH to auto-complete directories in command-line arguments?

Transferred from regular StackOverflow... I'm a new ZSH convert on OSX (git status in the prompt was my main driver to make the leap). Everything seems to be working swimmingly but I'm missing ...
3
votes
1answer
200 views

Make Bash autocomplete guess the closest approximation

I have a somewhat uncomfortable keyboard on my laptop, resulting in that I sometimes misspell things in Bash and when pressing Tab for an auto-completion nothing happens. Is it possible to have Bash ...
3
votes
1answer
987 views

Automatically generate ZSH/Bash completion files

Does a tool exist that will automatically generate completion files for both bash and zsh? I'd like to be able to specify one source of truth for my completions instead of maintaining a separate ...
3
votes
1answer
170 views

How to include all PIDs in tab completion?

When I enter a command that takes a process ID (such as kill and strace -p), ZSH's tab completion offers what looks like the PIDs of the processes running in my current shell session. How can I make ...
3
votes
1answer
428 views

zsh: menu completion for glob

In zsh, if I type vim *.txt then Tab, it expands to vim f1.txt f2.txt f3.txt. How can I make it show a completion menu listing files matching the pattern, so I can select a single file?
3
votes
1answer
599 views

How to remove a filename from bash completion, based on its suffix?

Apologies if this is a duplicate, but I'm (unsuccessfully) trying to edit the bash completion options for vim. Specifically, when editing a LaTeX document, there are lots of supplementary files which ...
3
votes
2answers
805 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 non-...
3
votes
1answer
437 views

How to cd open / autocomplete a folder that ends in a specific phrase

I have a folder with subfolders named like this: 1122334 important things 1122335 less important things 1122336 notes 1122337 pictures of kittens etc The numbers at the beginning are date codes. If ...
3
votes
1answer
436 views

How can I autocomplete each parameter in a different way?

I have a function called load_pg, which is defined like this: load_pg () { pg_restore --verbose --clean --no-acl --no-owner -h localhost -U $1 -d $2 $3 } And I'm trying to autocomplete each ...
3
votes
2answers
4k views

Phrase Express Equivalent for Linux?

Is there some sort of auto text-insertion program with macros, similar to PhraseExpress for Windows in Linux? In case you've never seen this application it offers the following features: Organize ...