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.
827
questions
1
vote
1
answer
17
views
zsh completion for umount: limit completion to one argument
when I use zsh completion for the umount command:
umount /mnt/t<TAB>
it completes the mounted filesystem /mnt/tmp.
But when I accidentally press tab too many times, it tries to be too helpful, ...
0
votes
1
answer
25
views
zsh custom completion file not sourced properly
I encountered a strange behaviour regarding ZSH completion for my custom script and need some ideas, what went wrong and how to solve it.
I have written a little custom script myscript and also ...
0
votes
0
answers
19
views
bash autocompletion filetype filter bypass
How to ignore bash autocompletion's file filtering when it's broken?
For example, I want to auto complete a iso file for bsdtar, but my distro didn't include that extension. Pressing tab just feel ...
0
votes
2
answers
40
views
I want to "Autocomplete" sub and sub/sub directories rooted in a fixed directory
I have some directories with music files
$ tree -d ~/Music/
/home/boffi/Music/
├── Aldous_Harding
│ ├── Aldous_Harding
│ ├── Designer
│ ├── Party
│ └── Warm_Chris
├── Madness
│ └── ...
1
vote
0
answers
17
views
ZSH, complete to longest prefix
I no longer find the combination of settings in ZSH that first completes to the longest prefix. What I'm looking for is this:
Given several files aaa, aab, cab, if you type a + tab, ZSH completes to ...
0
votes
0
answers
38
views
How do I disable completion for a specific command in zsh
I want to disable completion for the make command, so when I type make <tab>, zsh doesn't try to parse Makefile. It should be done temporarily (e.g. for this zsh session only, so removing files ...
2
votes
1
answer
77
views
zsh completion: complete from predefined list
My zsh script takes following arguments:
./script --connect server --foo 3 --bar 5 name
--foo and --bar take integers, name is the only non-option argument, and --connect should complete from ...
0
votes
1
answer
32
views
How to get bash autocompletion to mimic the behavior for a certain command?
I'm writing a script wrapping a certain Linux command. Now, that command, when I use it directly on the command-line, has some autocomplete behavior. For example, if I type the command name, then ...
1
vote
1
answer
39
views
How to disable "long descriptions" of commands in ZSH
I have a program named fhome that provides shell completion for Zsh:
$ fhome <tab>
config -- Manage system configuration
event -- Manage events
help h -- Shows a list of commands or ...
1
vote
2
answers
108
views
SSH Config Host Autocomplete Command not Autocompleting
I wrote a function to get my hosts from ssh config without getting wildcard hosts:
sshConfAutoComplete() {
cat ~/.ssh/config | \
grep 'host ' | \
sed '
s#.*\*##g;
s#host ##g
...
0
votes
0
answers
49
views
Enable filepath autocompletion when adding files with Git in Zsh
Let's say following is the output of my git status command.
On branch LG-201
Your branch is up to date with 'origin/LG-201'.
Changes not staged for commit:
(use "git add <file>..." ...
1
vote
0
answers
171
views
How to disable annoying autocomplete popup on Fedora Linux?
I'm running Fedora Linux 37 on a laptop computer with a touch screen. Occasionally, some process or something triggers and I start seeing this really obnoxious text autocomplete prompt whenever I type ...
1
vote
1
answer
93
views
Where to put bash-completion scripts from 3rd party programs in Fedora?
A piece of software I would like to use, xsos, comes with a bash-completion script.
Where is the correct place to store it on a Fedora system?
Should I create a generic directory in my $HOME and then ...
1
vote
1
answer
49
views
How to troubleshoot bash completion for git not working in subshell
When I launch my first bash shell, completion for git works (git rest<TAB>->git restore).
After opening a second shell within the first one, tab completion is no longer working for git, but ...
0
votes
0
answers
41
views
Does the implementation of a program provide the handler of the Tab-hitting event? [duplicate]
In bash, how does autocompletion know the options to complete a command?
For example,
when I hit key Tab after ls, it will list the files in the current directory.
when I hit key Tab after ebook-...
1
vote
2
answers
269
views
git autocompletions in Fish: how can I disable them or speed them up?
I'm running Fish shell (3.6.0) on Ubuntu. Let's say that I'm trying to run git add foo/bar.txt . I type:
git add foo
and then I press tab . Now the shell freezes up for a few seconds. Even pressing ...
0
votes
1
answer
164
views
Why the option -P of compgen does not work?
I am playing around with the programmable completion of Bash and there is something I don't quite understand.
Environment
This is what I get when I run bash --version in my terminal.
GNU bash, version ...
0
votes
1
answer
71
views
Should I use `set -u` in my terminal? Why does it break autocomplete for git?
I added set -u (equiv. set -o nounset) to .bashrc, but now some tab autocompletes fail with errors about unset variables. One example is for git autocompletes.
Would this be a git autocomplete bug or ...
3
votes
0
answers
173
views
Most recents files/directory suggested results by TAB completion with zsh
I would like to get with TAB suggestion on zsh to get the more recent file as first suggestion after a second TAB pushing.
For the moment, I have with a first TAB pushing the list of the more recent ...
0
votes
0
answers
126
views
Custom autocompletion for zsh function
I keep several pyenv environments in ~/environments. I've got this function in my .zshrc:
actenv() {
source ~/environments/$1/bin/activate
}
Is there a way to tell zsh to autocomplete the ...
2
votes
1
answer
84
views
zsh gnu-screen tab completion for `-x` flag similar to `-ls`
In bash, when I type screen -x and press tab twice, I get a list of all the running sessions.
In zsh, when I type screen -ls and press tab twice, I get a list of all the running sessions and can tab ...
0
votes
1
answer
101
views
BASH: use . instead of a space for command completion
I have bash function directory located at /git/function
This is structure:
/git/function/
├── delete
│ ├── delete.dir
│ └── delete.file
├── main.sh
├── get
│├── get.dir.sh
│└── get.file.sh
How to use ...
0
votes
0
answers
119
views
Zsh command history completion
How to have case insensitive in retrieving completion of command history in Zsh ?
did put setopt NOCASEGLOB in ~/.zshrc but has nothing for help
how is the correct way to do?
0
votes
1
answer
246
views
Konsole auto-completion for link pointing to folder [duplicate]
Original Question
When cding into a folder through a link, auto-completes does not add the last / unless I hit tab twice. How to change that behavior?
MWE:
cd /tmp/ && mkdir test && ...
1
vote
1
answer
41
views
conflict between bash and its auto-completer on the meaning of .. for symlink to directory
In my home directory /home/regis, after creating a symbolic link LINK to directory DIR/SUBDIR, and doing cd LINK, I have a conflict between bash and its auto-completer regarding what .. leads to.
For ...
1
vote
1
answer
108
views
zsh completion: complete --options for custom script
I have zsh completion rule for custom script. My script can take zero or more options (starting with -) and zero or more arbitrary strings (patterns):
_arguments -S : \
'--foo' \
'--bar' \
...
2
votes
0
answers
61
views
How to auto-complete "hashcat" options?
Is it possible to get auto-completion of hashcat command line options? What I mean is, when entering, for example, hashcat --incre, and then pressing Tab, I want that the incomplete option completed ...
1
vote
0
answers
100
views
zsh vared: how to define custom completion?
I would like to launch a command that would read user input and pass each line as a new task to TaskWarrior:
#!/bin/zsh
set -e
while vared -p 'task add> ' -eca task; do eval task add "${task[@...
1
vote
1
answer
293
views
set colored-stats ignores $LS_COLORS
Problem
Bash <tab> autocompletion ignores $LS_COLORS variable and uses default color values.
Setting
I have a dircolors file and just the following declarations in .bashrc:
eval `dircolors $HOME/...
3
votes
1
answer
378
views
Zsh completion: move into list selection on first tab
Short Description
When I hit <tab> in zsh, I want the first completion candidate to be highlighted immediately instead of requiring me to hit <tab> a second time to focus the list.
Example
...
1
vote
2
answers
70
views
zsh completion: complete block devices in /dev
for my script, I need to complete block devices in /dev, so that when I do
my_script.sh <TAB>
it will complete /dev/ and offer me all disks that are listed in /dev (not in subdirectories). So ...
0
votes
0
answers
793
views
Tab completion and Mobaxterm
I am using Mobaxterm to access cluster that is running on Bash. I have an absurd, but very annoying issue.
When I installed Mobaxterm, Tab completion would end the path with a / and if you press it ...
3
votes
1
answer
136
views
zsh completion: duplicate commands
Lets say I have an alias for grep. When I use zsh completion, it will offer grep twice (once as command, once as alias):
gr<TAB>
grep
grep
I found I can use ignored-patterns specifically for ...
0
votes
1
answer
116
views
Zsh autocompletion for git bare repos
This is the completion code in my .zshrc:
autoload -U compinit
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
_comp_options+...
1
vote
1
answer
79
views
Don't jump to the end of the word after inword (completeinword) completion in zsh
I've been able to turn on autocompletion when the cursor is in the word: https://unix.stackexchange.com/a/736909/556055
But the whole point was that I can accept an autocompletion and resume typing ...
5
votes
1
answer
834
views
Configure zsh to use tab autocompletion when in the middle of a word (ignore chars after the cursor) like in bash
In bash (\bash --noprofile --norc) when the caret/carriage/cursor (|) is in the middle of a word (l|!@#asdf) you can double Tab to show suggestions (ls for this example) for the word before the caret (...
1
vote
4
answers
148
views
Path-like search for a file
Basically I am trying to get something similar to command search with $PATH, but with a different list of directories and the file I'm searching for is not executable.
The list of directories is fixed ...
0
votes
0
answers
150
views
Zsh: make single file selection smart, stylish, and functionally correct (highlights, completions below cursor, etc)
I would like to have a near-flawless "single file selector" with zsh. So far I haven't seen one in questions as they tend to focus on zle settings for one's command line. Let's say we are ...
1
vote
0
answers
56
views
Stop '@' in alias name preventing bash completion
On one laptop I have bash aliases for ssh-ing into various machines of the form
loris@machineA
loris@machineB
On this machine I can type
loris@<TAB>
and bash will show me possible completions.
...
0
votes
0
answers
74
views
How to build tab completion for string
I have the following code (taken from https://web.archive.org/web/20190402231844/https://debian-administration.org/article/317/An_introduction_to_bash_completion_part_2):
_foo()
{
local cur prev ...
2
votes
1
answer
3k
views
Suppress warning: egrep is obsolescent; using grep -E
When I run egrep, it shows warning: egrep is obsolescent; using grep -E
But I'm using it as part of my shell autocomplete script that I often use, and I don't want to rewrite them.
I'm looking for way ...
2
votes
1
answer
210
views
zsh: How to identify which file zsh completion function comes from?
In zsh, how can one know which file a completion function is defined in or comes from?
which can print the source code of a completion but it does not give any information about where I can find the ...
0
votes
1
answer
229
views
Bash auto-completion slow: /bin/bash hangs at rl_getc
When pressing tab to autocomplete a command (e.g. cd) bash hangs for a couple of seconds before completing it.
when using set -x nothing is printed prior to the hang
When using a tty console from ...
0
votes
1
answer
66
views
Complete a positional argument only once
I'm trying to write a completion for a command (call it gs) that takes an SSH hostname as its first argument, and an arbitrary string as the second argument.
I've stolen this from the default SSH ...
0
votes
2
answers
54
views
dc3dd, why tab completion doesn't work?
On Slackware 15.
Using dd I do
dd if=/home/myuser/my..TAB and complete dir path after pressing tab
using dc3dd I did
dc3dd if=/home/myuser/my..TAB and nothing happen.
Why?
I have tried with rlwrap but ...
1
vote
1
answer
125
views
Fish completion that depends on other flags
I have a command, that can connect to remote machines and so the completion should be based on which machine the user provided. That means that if the user pass -D DEVICE_ID I want the completion to ...
1
vote
0
answers
81
views
Avoiding support bash functions to show up in terminal sessions when tab-completing
I have a number of bash functions which I source from my .bashrc. I also have a bunch of support function that are needed but do not want them to show up in a terminal session when a user does tab-...
1
vote
1
answer
115
views
How having insensitive-case the Bash history completion [duplicate]
Is there a setting to enable case-insensitive history completion for Bash?
I tried tab-completing cd s with cd Socket/in in my history but it didn't complete.
1
vote
1
answer
191
views
How can I configure zsh completion to exclude `.` and `..`?
I configured my zsh following this answer. Then I found the completion now includes . and ... How do I remove them?
3
votes
1
answer
178
views
zsh glob qualifier with negated null glob works like it should with null glob
Note: Please don't respond about this being a XY situation. I am trying to understand how a globbing pattern works, not trying to achieve a specific result. Am also not interested in other ways to ...