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
2
votes
0answers
57 views

Terminal - autocomplete partial filenames [duplicate]

Let's say I have a folder with those files in it: 2017-10-16-first_lesson.pdf 2017-10-17-lesson_about_something.pdf 2017-10-23-about_something_else.pdf 2017-10-24-bash_autocomplete1.pdf 2017-10-30-...
2
votes
2answers
115 views

Custom bash tab completion showing possible completions, but not actually completing input

I have tried very hard to figure this one out before actually posting here, but I can't seem to find any other examples of people solving this particular issue. I am running Ubuntu 17.10 I have ...
3
votes
1answer
183 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
2answers
210 views

Read /dev/tty from within a completion function

Why is the following code not working for completion of the foo command? When I source it then type foo <Tab>, the shell hangs and doesn't take any input until I press ^C (which exits the ...
3
votes
1answer
934 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 ...
0
votes
1answer
122 views

Where to install bash completion scripts for out of tree packages?

I'm installing ripgrep on Ubuntu. It doesn't exist on the official repository or on private PPA's, so I'm following the project's instructions to install it as an out of tree package: https://github....
0
votes
2answers
367 views

How to use arrows and enter to select option from autocomplete options?

On an older installation I had it somehow configured, so that I if I had an autocomplete list that I could bring up with tab, the first item was highlighted and I could use my arrows to navigate the ...
1
vote
1answer
248 views

zsh completion: make sshrc behave like ssh

I'm using the sshrc package and its eponymous command to make the remote machine's shell source the contents of my local .sshrc file upon SSH login. However, I really like zsh's host autocompletion (...
1
vote
1answer
132 views

How to ignore directories using :e in vim?

how do you ignore directories like .git and node_modules when you type and autocomplete with :e **/foo<TAB> in vim? i really prefer no plugins, so this command is a nice alternative to a fuzzy ...
5
votes
1answer
304 views

Completing a command like another command in bash

Let's say I'm creating a wrapper for the Unix program wget called wget-hip. I want wget-hip to get the same shell completion rule as wget because they both happen to have the same command-line options....
6
votes
1answer
402 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? ...
2
votes
1answer
589 views

Installed Anaconda -> strange behavior with DNF

I am using Fedora 26. Since I installed Anaconda, if I type in Terminal something like sudo dnf install gnome[TAB] I get Traceback (most recent call last): File "<string>", line 1, in <...
3
votes
1answer
528 views

How to customize bash autocomplete to list the files in another directory

How to customize bash autocomplete to list the files in another directory for only one script option (-seq), for other script options (-speed, -define) default autocomplete is O.K. this is what I ...
0
votes
0answers
125 views

Command complete for a bash script

I want to build a script that permit go fast to a path. I want to know if I can use 'complete' command or other command to autocomplete with the directories under '/var/www/vhosts/'. The script is ...
2
votes
1answer
86 views

Stop bash completion from being smart and ignoring extensions

Why will bash not complete the bar.dat on the unzip line - the file is in the current directory. Is bash reading file extensions and trying to be helpful? [a@localhost:~/tmp]$ echo "Hello World" >...
2
votes
1answer
180 views

Bash completion won't work if calling application with the absolute path

Not knowing why, but the bash completion won't work if I call application in the absolute path. For example, I have file1 & file2 under the current directory [zhengw@localhost ~]$ rm -f file<...
0
votes
0answers
89 views

Change order of autocompletion loading for ZSH

Trying to implement my own flag completion for java I broke the existing one. :-) What I've done is (among others for sure) unfunction and autoload calls, to see if my module worked. I think it ...
0
votes
1answer
1k views

Homebrew installed bash-completion not working [closed]

I have installed bash-completion via homebrew and added the code below to .bash_profile if [ -f $(brew --prefix)/etc/bash_completion ]; then . $(brew --prefix)/etc/bash_completion fi Bash ...
0
votes
0answers
257 views

Setting autocomplete in terminal for NeoVim to behave like Vim

I have the files Test.java and Test.class in the same directory. Something I've noticed is that when I use Vim and type vim T and press tab in terminal, it autocompletes to vim Test.java. But if I ...
2
votes
1answer
214 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 ...
1
vote
1answer
148 views

Can I change how file completion is displayed?

I can get process completion more useful by doing zstyle ':completion:*:processes' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'. Is there some way to do something similar for file completion, ...
1
vote
1answer
1k views

Syntax error near unexpected token '{'

Every time I run new virtual terminal, it starts with bash: /usr/share/bash-completion/bash_completion: line 226: syntax error near unexpected token `}' bash: /usr/share/bash-completion/...
2
votes
0answers
736 views

Bash-completion doesn't work with filenames [closed]

I am running Kali Linux 2017.1 on my laptop. I have a problem with Bash-completion. It seems to work perfectly with folders, command names and script names, but not with file names. When I enter a ...
2
votes
1answer
680 views

Smart Bash Completion Depending on Argument position

I have a simple bash function, a wrapper around scp basically. Invoked using copytomachine <Machine> <File> I have set up some simple auto complete such that when I type copytomachine &...
1
vote
3answers
327 views

bash compgen result contains terminal color codes

I'm using alias ls='ls --color' and getting weird results with compgen where it autocompletes with terminal color code putting compgen -W "$(ls /someDir/)" in terminal looks fine with ls color ...
1
vote
0answers
69 views

Setting custom Bash completion causes hang on tab

I have Bash completion for JTR setup as recommended: Enable bash completion. add the following line to your ~/.bashrc . <JtR path>/run/john.bash_completion Therefore I have this in ....
0
votes
1answer
150 views

ash - case insensitive

I am using the ash shell (on Busybox) and I want to make the tab completion case insensitive. "cd a" and Tab completes only all directories starting with a but ignore all directories which start with ...
1
vote
0answers
49 views

Asking bash to produce completion answer for a command?

I'm writing a CLI utility called envset, which has this usage: envset [ENVSET-OPTIONS] [SETNAME] [--] [CMD] [ARGS].... It basically runs a command with a set of environment variables defined in a ...
1
vote
3answers
195 views

How do I find commands/files in my PATH through tab completion using wildcards?

After some years of "BASHing", I've wrote several custom scripts. Most of them I don't use on a daily basis, so it's easy to forget how I've named them, as consistent as I might try to be. So I know ...
2
votes
0answers
96 views

zsh: use setopt AUTO_MENU conditionally, depending on $PWD

generally, I find the zshoption AUTO_MENU annoying, and I disable it in my .zshrc: setopt noautomenu However, there are some directories where I have files with long filenames, with spaces in ...
1
vote
1answer
128 views

shell history autocompletion and in-line coloring

How can I add support for autocompletion with coloring like in the screen shot below to any shell (preferably bash)? It was taken from this video. I cannot seem to find anything that supports such ...
5
votes
1answer
203 views

zsh: separate completion for command names and filenames

I do not want filename tab completion to prioritize the start of the file name. For example, given the filenames red_blue.txt and blue_red.txt, I do not want vim red tab to prioritize red_blue.txt ...
1
vote
1answer
286 views

Can add Tab hotkey to my shell script?

Can I use Tab hotkey in my shell to auto-completion where have an input just like this: when I input "test" and tap Tab hotkey,"test" will auto-completion become "test.md". Welcome suggestions, ...
4
votes
1answer
1k views

Bash filename completion explanation

I have two files in a directory, test1 and test2. If I type less te<TAB> completion kicks in and expands te to test. If I hit TAB a second time nothing happens, and only when I press TAB a ...
2
votes
1answer
196 views

How to avoid the hang of tab completion in home folder?

Sometimes on the server, if the disk IO load is heavy, the terminal is stuck by the tab completion. Ctrl-C|D|Z all don't quit. Each time I have to login from another session, find the stuck pty and ...
0
votes
1answer
52 views

Command Completion does not work on names containing `:`

I have been hacking a Linux system (in an attempt to get BlueTooth working, although this is not relevant). There are directories structured as below /var/lib/bluetooth/ ├── B8:27:EB:8E:A8:4D ...
1
vote
1answer
148 views

Shell autocompletion very slow after partial disk formatting

I upgraded to Fedora 26 the day of the official public release earlier this week and, long story short, ended up screwing up my installation, so I did a partial reformatting . My disk layout is the ...
4
votes
1answer
871 views

How to expand filenames with Tab, even when a shell variable is used in the path?

In my .bash_profile I set short variables to ease the access to some common directories. For example: lh=/var/log/httpd hc=/etc/httpd/conf So I use it like this for example: $ cd $lh $ less $lh/...
6
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: ...
1
vote
2answers
427 views

zsh autocomplete without completing prompt

Tried to find this answer, but could not. I am new to zsh, and I like it a lot on my Mac. I am looking for an option to set it to autocomplete, but without putting the completion in the prompt until ...
2
votes
0answers
118 views

Why does nobody use the positional args made available to Bash completion functions? [closed]

The Bash man page describes parameters that are available to completion shell functions: If a shell function is being invoked, the COMP_WORDS and COMP_CWORD variables are also set. Using these ...
5
votes
1answer
673 views

Where does SSH pull autocompletion from?

I am on an enterprise network in which double tabbing after ssh leads to it spitting out suggestions of computers to ssh to. However, what I've noticed is that depending on which computer I am on, a ...
0
votes
2answers
451 views

how do I get zsh to *just* list the stuff in my current directory during tab completion?

In zsh when I type a few characters it lists all this stuff (commands and I think subfiles). How do I get zsh to just list the contents of my current_directory? In the picture above I type the ...
2
votes
1answer
84 views

How can I make pushd autocomplete CDPATH entries?

I have bash-completion installed, and I get a lot of mileage out of tab-completing CDPATH entries when using cd. I'd like to get the same functionality from pushd. I started diving into the bash-...
1
vote
1answer
555 views

dnf install completion not working with zsh, yet working with bash

In bash, if I type dnf install java<tab>, I get a bunch of suggestions of packages to install. However, if I do this in zsh, nothing happens. I've played around with /etc/bashrc and discovered ...
2
votes
1answer
167 views

How to reduce the impact of changing the value of the `fpath` array on zsh starting time?

I'm using zsh version 5.1.1 and tmux version 2.3, and recently I've noticed that starting a new shell (via a new window or pane in tmux) takes more time than before. It's enough for me to type around ...
1
vote
1answer
47 views

What is the function of @ at the command line after a file name

I noticed that when I tab complete after cat /home/@ I got some servers I have. Seems it's stuff I put in /etc/hosts. But what is the function of @ in this case. Am I missing some handy pipe ...
1
vote
2answers
1k views

Very slow auto-completion in Linux for Windows

For some reason auto-completion is very slow for me in WSL, it always takes several seconds display the result of, for example ll ~/Te<tab> (which would, after 2-3 seconds, print ll ~/Temp). I'...
1
vote
1answer
369 views

How to configure case insensitive completion of branch names for git in bash?

I use Debian Stretch for web development. Its default shell is bash. I use git for source versioning. I would like to have git branch names with case insensitive completion. At the moment, completion ...
2
votes
1answer
212 views

Tab completion on mosh (ssh) alias?

I've just started using mosh and I'm left thinking to myself "why didn't I start using this like two years ago?" I'm even more impressed by the fact that it reads my ~/.ssh/config and respects the ...