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.

115 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
1answer
418 views

autocomplete filenames with underscores

What do I need to add to my ~/.bashrc so that if, for example, there is a file named name_separated_by_under_score, I can press n-s-b-u-s and then [TAB] and the shell will auto-complete the file name? ...
6
votes
2answers
844 views

dnf tab completion hangs

Tab completion is hanging when attempting to complete package names. eg dnf info fire[TAB]. How can I fix this? It works in general for bash, and also for completing dnf options, but not for package ...
5
votes
1answer
1k views

Autocomplete in make based on possible targets

The Makefile is: %.pdf: %.tex rubber -d $< If there is a doc.tex in the directory, then make doc.pdf builds doc.pdf. The problem is that when I type make, the autocompletion gives nothing: it ...
5
votes
1answer
497 views

Assign both menu-complete and dynamic-complete-history to TAB

Is there a way for me to assign both menu-complete and dynamic-complete-history to Tab (or one to Tab and the other to Tab-Tab) in .inputrc? I'm thinking there might be a way to setup a function and ...
4
votes
0answers
26 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
137 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
348 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
112 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 ...
3
votes
2answers
50 views

zsh completion for media player

In my .zshrc, I have menu select disabled globally, except for mpv/mplayer: zstyle ':completion:*' menu select=0 zstyle ':completion::complete:mpv:*' menu yes select This works as expected, but I ...
3
votes
0answers
171 views

Use colon as filename separator in zsh tab completion

I have many programs which take filename arguments as one(or more) of path/to/file scp:path/to/file.ext ark:/abs/path/to/file.ext Is it possible make zsh complete filenames after some keywords ...
3
votes
1answer
64 views

Faster auto-completion for kanjis files/folders, without having to switch IME

I have a project with many Japanese kanji/kana folder and file names, like this: 提案書/ フォルダ/ 工数.sh 設計書.sh It takes so much time to change directories or open a file: Type the first part of the ...
3
votes
0answers
237 views

ZSH custom completion from command output

I am creating a custom completion for my command ipadd which will automatically complete all the network devices for OS X. It has a parameter --device which allows you to specify the network devices ...
3
votes
0answers
52 views

How do I write a custom filename completer for specific directories in zsh?

I've found that file names with dates before the title are difficult to tab-completion. I'd like to write custom completion functions for these directories. How do I specify that the completer should ...
3
votes
2answers
350 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 ...
3
votes
1answer
611 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 ...
3
votes
0answers
1k 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 ...
3
votes
2answers
816 views

Bash autocomplete variables for other commands than cd

I have env variable $SCRIPT. Normaly I can use autocomplete vim $SC<tab> and completion works as expected. On some systems it does not work. I have bash completion loaded, but completion in ...
3
votes
0answers
332 views

Call vared and complete files from a different directory

I have the following zsh function which lets me edit symbolic links using the vared ZLE builtin. function lned { emulate zsh setopt err_return extended_glob local_options local_traps local -a ...
3
votes
0answers
123 views

ZSH and completion of files with newline characters

I am experimenting with ZSH on nasty file names, especially file names with the newline character in it. Here is how I create them: $ touch "filename<hit return here> 1" $ touch "filename<...
3
votes
0answers
333 views

Git completions for aliases only available after running `git reflog`

I have a few aliases that I want to autocomplete for git, e.g., the following alias gco="git checkout" When I was attempting to add completions for this alias, I looked around in my path and saw ...
2
votes
0answers
20 views

How to enable “on-the-fly” autocompletion with vim-supertab?

Using the "supertab" plugin for autocompletion in vim, how can I make it so that hitting TAB is not required for the selection menu to pop up? I.e. what I want is the menu to be always present and to ...
2
votes
0answers
44 views

Tab complete global alias names not at the beginning of a line

I have a bunch of aliases like this alias -g foo=cmd1 alias -g faz=cmd2 alias -g fam=cmd3 At the shell (I'm using zsh) I want to be able to type echo fa<TAB> and be prompted for faz or fam ...
2
votes
0answers
60 views

autocomplete with inline variable setting

I use bash version 4.4.19(1)-release (x86_64-apple-darwin17.3.0) on my Mac with MacOS (10.13.6) For example, I have autocomplete set up for the AWS CLI, via complete -C '/Users/jstoner/Library/...
2
votes
0answers
168 views

How to make zsh pass the manual section to the man command when the `separate-sections` style is set?

When asking for a completion by pressing Tab on the zsh command line, the matches can be grouped according to their tag provided that the group-name style is set to an empty string: autoload -Uz ...
2
votes
0answers
117 views

bash tab auto-complete for java keytool

Can anyone point me to a bash tab autocomplete for the java keytool command? Learning & writing this seems not simple, and I presume that someone has felt this pain before.
2
votes
1answer
636 views

Auto-Complete the path on AIX using profile

We have an AIX environment in which I have to use Esc\ to complete the path. In a RHEL environment I was able complete the path using Tab. Is it possible to get this Tab auto complete feature going in ...
2
votes
1answer
224 views

With zsh how to add autocompletion for a specific script, with autocompletion choices coming from a file?

I have written a small shell script that takes a single command line argument. I'd like to be able to autocomplete when I start writing an argument, the autocompletion choices should come from a ...
2
votes
1answer
550 views

ksh tab completion not working if I've typed exactly 4 chars before pressing tab

If I have the folder ~/1234567 and I type one of the following: ls ~/123 cd ~/12 then press tab, everything's groovy. But if, on either of those commands, I type 1234 before hitting tab, the 4th ...
2
votes
0answers
127 views

bash custom tab completion with wildcards

I have a script (let's call it myscript) and I want to enable autocomplete arguments for files with a specific extension (e.g. .txt). I can do this simply with: complete -f -X '!*.txt' myscript Then,...
2
votes
0answers
258 views

how to scroll multiple lines in zsh screen completion

Thanks to this question, I was able to configure zsh to properly scroll one line up or down when hitting "pgup/pgdwn" in a autocompletion menu: bindkey "${terminfo[kpp]}" up-line-or-history bindkey "$...
2
votes
0answers
200 views

Autocomplete flags after a subcommand

There is a program I have called luarocks that features a list of subcommands like build, install, and make, with flags after them. At the end, a command would like like the following: # luarocks ...
2
votes
0answers
95 views

Printing autocomplete info on current option in fish shell

When writing a command with a - option and pressing tab, a list of possible completions with short explanations of what the options do is displayed. Is there a way to make this list also contain the ...
2
votes
1answer
123 views

Use all hosts completed by zsh for cssh

Is there any possibility to use all completed hosts with cssh? E.g: cssh www* This should establish three connections to www1, www2, www3 If I press Tab after www I get all three possibilities.
2
votes
1answer
333 views

Bash completion extra space when adding file directory

I have a script for extending bash-completion for certain commands. If I type command1 and do a tab, it should auto-complete with a file directory (and the files). It works fine expect for one ...
2
votes
0answers
41 views

How did I get the git commits to show up in autocomplete?

Git tab completion on my mac: Git tab completion on my Ubuntu server: On my mac and my Ubuntu server I get very different output from tab completion despite having the same version of zsh, same ...
2
votes
0answers
88 views

Can I clear an env var during bash completion?

I use bash completion from https://bash-completion.alioth.debian.org/ and some vendor supplied scripts too (eg. https://github.com/git/git/blob/master/contrib/completion/git-completion.bash) I also ...
2
votes
0answers
66 views

Escaping output in tcsh completion by program

How do I escape output in the program providing completion? Suppose: tcsh% complete foo 'p/*/`mycomp`/' And mycomp is a Perl program printing this: #!/usr/bin/perl print "one\n"; print "two three\n"...
2
votes
0answers
266 views

Bash tabcomplete file names for environmental variable values

After I upgraded my Ubuntu from 12.04 to 14.04, bash would no longer let me tabcomplete file names when setting the value of an environmental variable, e.g. FILE=/home/_ _ is where I would press ...
1
vote
0answers
33 views

bash/zsh: Is it possible to prevent auto-inclusion of a slash when using tabs to autocomplete a path?

When I use tab to autocomplete a path, a trailing slash is automatically added. I checked both bash and ZSH and I get the same behavior. Is it possible to prevent this? I check unsetopt and I have "...
1
vote
0answers
45 views

Bash Tab Completion in continuous line

I am trying to develop an autocomplete or tab-complete feature for my own set of commands. For my conitnous line input the identifer is .E or .D. For example: FILENAME N [TAB] [TAB] FILENAME ...
1
vote
0answers
31 views

zsh _arguments completion that gradually reveals options

I have at the moment a completion function that looks something like this (except way more entries) _arguments \ '-check[do a check]' \ '-play[play a specific song]:songnumber' \ '-test.n=[run ...
1
vote
0answers
40 views

How to restrict autocomplete for the files found from PATH?

What I would like to be able to do is to have a list of words that are allowed to be autocompleted when typing the first word in the command line. Say, I have PATH=/dir, and the directory /dir has ...
1
vote
0answers
80 views

How can i fix Linux Mint 19.1's GNOME terminal not TAB-autocompleting file names in apt?

I have a .deb package downloaded that i want to install using apt. When i wanted to TAB-autocomplete the following command nothing happened. $ sudo apt install ./pa[TAB] However, when i tried $ ./...
1
vote
0answers
39 views

Make bash understand I want to complete a directory name after “cd”

How to get bash to auto-complete cd commands only with directory names and ignore filenames (just as CMD on Windows) Example: I'm in /some/folder/ I have -rwxr-xr-x filesharp -rwxr-xr-x ...
1
vote
0answers
132 views

How to change bash completion result coloring

How to change completion coloring when auto-completing subcommands in bash? For unknown reason, it looks like the completion results are treated by bash as broken symlinks. And it looks really ...
1
vote
0answers
199 views

why is yum's tab completion slow while apt-get's tab completion is fast?

Why is yum's tab completion slow while apt-get's tab completion is fast? I'm not sure but I believe that this may have to do with the fact that for autocomplete yum looks over the internet and apt-get ...
1
vote
0answers
59 views

When using TAB completion with dd command, options (like 'if' or 'of') disappear

When I type dd if= then hit TAB to complete, the file name is added, but the if= portion vanishes (and of= too, for that matter). So for example, instead of # dd if=input_file.iso of=/dev/sdb I get ...
1
vote
0answers
70 views

Bash how does skip-completed-text work?

I use menu-complete bash function to cycle through completion when I press Tab, and I'm happy with it. But it has too often happened to me the following. Suppose I'm looking for the file ...
1
vote
0answers
124 views

Bash autocompletion is slow

I have written a shell script for autocompletion(bash); which, on sourcing, runs a python script, stores the output of the script and acts as a source of word list for the compgen command. Following ...
1
vote
1answer
337 views

“compdef: unknown command or service” with disk quota exceeded

I just came across a problem with zsh. Every time I open it, I got this: /home/****/.zcompdump:201: parse error near `\n' compdef: unknown command or service: git And zsh completion broke down as ...