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
5
votes
1answer
692 views

Modify $READLINE_LINE and $READLINE_POINT values inside bash script

I already asked this question on stackoveflow, but received no answer and very few views. I thought I would post here as there should be more bash users and someone might have already stumbled upon ...
5
votes
1answer
4k views

Complete files from a different directory in bash [duplicate]

I wrote two functions push and pull to copy files to and from a directory ($FILE_EXCHANGE_DIR). I want bash to autocomplete names from that directory when I use the pull function. I want the ...
5
votes
2answers
2k views

ZSH tab completion: only complete files and not binaries

Is it possible to make a custom zsh completion file,so when hitting tab for filenames it avoids completing the binaries? For example,I have 2 files , myprogram.c and myprogram,the binary,is it ...
5
votes
2answers
3k views

Is there a way to use regex expressions to auto-fill filenames in bash?

Assuming I have a directory with files as shown: $ ls file0001.txt file0002.txt file0003.txt file0004.txt file0005.txt someotherfile.txt Lets say I want to run the following command: $ cat file0001....
5
votes
2answers
4k views

autocomplete filenames using compgen

As part of a larger autocomplete function I'm writing, I want to use compgen to generate a list of files. I read the bash manual entries for compgen and complete, and from there I assumed that the ...
5
votes
1answer
337 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....
5
votes
1answer
275 views

Shell that tab-completes prefix?

I would like tab completion to behave differently when the cursor is at the beginning of a word than when the cursor is at the end of a word. I've only ever seen shells that tab-complete the suffix, ...
5
votes
1answer
140 views

What's the relevance of these bash completion suggestions?

~ is $HOME. For me, cd ~ is /home/cat. Simple so far, yes? In Bash, the following happens: cat @ mint-kitty : ~/Downloads $ cd ~ # from /home/cat/Downloads to /home/cat/, as an example, but ...
5
votes
2answers
273 views

Display possible corrections but do not apply them automatically

I have the following completion: zstyle ':completion:*' completer _complete _approximate As a result if I type something incorrectly and hit TAB I will see a list with corrected propositions (what ...
5
votes
2answers
13k views

What causes ln: //: Is a directory?

When linking a directory to root, I get this error: $ ln -s ~/inbox/ / $ ln: //: Is a directory Bash autocompletes the directory path by adding a /. I've tried escaping without success. $ ln -s ~/...
5
votes
1answer
1k views

When auto-completing in tcsh, can I reference a previous argument?

I'm trying to get some efficient auto-completing going here, and have hit upon a bit of a snag. I've got a command for setting two things at once. The first is a relatively small list, but the second,...
5
votes
1answer
108 views

Ignore auto-completion on single same filename

Normally when I pass a filename which is the only file there in current directory with auto-completion by Tab to the command come before it then press multiple Tab(mistakenly), the same filename ...
5
votes
2answers
199 views

How to prevent bash to autocomplete the trailing dot?

Let's say I have a filename and different extensions to it: test.tex test.pdf It is easier to type just the filename without extension, then the whole filename. This is possible, because ...
5
votes
1answer
3k 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 $ ...
5
votes
1answer
1k views

Zsh completion that is insensitive between `_` and `-`

I don't like typing underscores, and would like to type a dash instead, and have zsh autocompletion treat it like it could be either a dash or an underscore. Is this possible with built-in zsh ...
5
votes
2answers
180 views

Bash completion overwrites current word

I am trying to create a bash completion script for my command. ls has the behaviour that I want. I need to get this same behaviour form my command. This is what I get for ls $ ls /home/tux/<Tab&...
5
votes
1answer
1k 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 ...
5
votes
2answers
737 views

Inhibit Variable Expansion in Paths

How do I prevent Zshell (and Bash I assume) from expanding environment variables in paths be completed as shown in the following example: $PREFIX/alt/li should expand to $PREFIX/alt/lib and not to ...
5
votes
1answer
211 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 ...
5
votes
1answer
2k views

Bash completion of parameters when using sudo

I am using CetnOS 6 and want to have autocompletion for parameters while using sudo. I found this question https://superuser.com/questions/804128/bash-hints-does-not-work-after-sudo-or-man and now ...
5
votes
1answer
264 views

Bash completions -C vs -F

In the bash completion setup (https://github.com/scop/bash-completion) supplied by my system there seems to be an unequivocal preferences towards completing with complete -F as opposed to complete -C. ...
5
votes
1answer
574 views

Tab autocompletion of accented characters with oh-my-zsh doesn't work

I am not able to properly display autocompleted filenames that contain accented characters like ã in my shell configuration of zsh and oh-my-zsh. I've created a filename cão.txt to demonstrate this ...
5
votes
1answer
476 views

Custom bash autocomplete for git breaks other git autocomplete features

I am trying to add autocompletion to git commit upon hitting TabTab. The autocomplete feature I am working on is based on a branch-naming convention. The convention is to append the PivotalTracker ...
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
1k views

Use same colors in bash tab complete and ls [duplicate]

Bash is using a different color for tab completion than ls. For example, my ls command uses a red color for a broken symlinks (I'm using dircolors to configure it), but if I use ls Tab, the color is ...
5
votes
1answer
500 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
4answers
570 views

Bash-completion and grep

I installed a program (iftop) on Debian Squeeze but some days ago I forgot it's name. I had only this information about the program: 1) It was called *top 2) I could find it using bash-completions. ...
4
votes
1answer
535 views

Automatically add slash when navigating through symlink

I use symlinks a lot and pretty much linked my whole home directory into a folder .other or .dotfiles. When I'm im my home directory and try to got into the folder .config/, its actually a symbolic ...
4
votes
2answers
1k views

Modify bash autocomplete rule to exclude particular file names

I want to modify the existing vi bash autocompletion rule to exclude some filenames (for example, the config.log file). I tried using the FIGNORE environmental variable, but that didn't work. Using ...
4
votes
2answers
83 views

Check argument before program run

I have noticed that, when I type unzip in bash and press tab, auto-complete works only on files with .zip extension. How is that done? What if I would like to make program that would accept only image ...
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 ...
4
votes
1answer
923 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/...
4
votes
1answer
1k views

How to enable bash completion in vi mode on Synology DSM6

When I turned on vi mode in bash by setting set -o vi suddenly the tab completion was broken, and a literal tab was inserted. How can this be fixed?
4
votes
2answers
338 views

Is there a workaround for Debian file-completion trashing $_?

I have years of experience on Slackware linux, and have never seen this problem there. Lately I have been administering Debian servers, and this has become an annoyance. I frequently use "$_" in a ...
4
votes
2answers
559 views

Vim autocomplete to include punctuation between words

I'm currently programming in Tcl/Tk. I have some widgets called .entry,stdin and .entry,stdout and I'm using supertab for autocompletion. The comma is there because I'm using a package called gridplus ...
4
votes
3answers
2k views

oh-my-zsh completion on home directory names

I recently switched to zsh from bash, and I'm using oh-my-zsh. There's a completion behaviour I don't want: in any directory, the list of autocompletion candidates seems to include the names of all ...
4
votes
1answer
611 views

Custom bash completion with directories and a fixed set

I'm trying to setup a bash completion, and have two problems For parameter one, I needed a completion for directories For parameter two, a fixed array for completion, I just don't know how to let ...
4
votes
1answer
136 views

Don't suggest current directory in autocomplete

I am a long time user of ZSH. It seems to me that I used to have this functionality a long time ago but then I rewrote my .zshrc (a long time ago) and now I miss this functionality every now and then. ...
4
votes
1answer
1k views

How can I configure zsh completion to launch a menu - for command options?

If I am cd'ing into a directory, there is a setting in my ~/.zshrc that tells zsh to always launch a menu when I hit tab on an ambiguous completion, e.g. ~% cd /etc/a tab will immediately cause a ...
4
votes
2answers
1k views

Prevent path autocompletion from using CDPATH in bash?

On my Mac, bash (version 3.2.53(1)) autocompletes command-line arguments using files only in the current directory. On a Linux machine at work, bash (version 4.1.2(1)) autocompletes command-line ...
4
votes
2answers
1k 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=( ${COMPREPLY[@]:-...
4
votes
2answers
3k views

Add autocompletion in dash

Is it possible to get at least "some" autocompletion in a dash shell like in bash? At least for the existing filenames in a path.
4
votes
1answer
1k views

Autojump auto-complete feature does not work

On my configuration, autojump autocomplete feature does not seem to work. To be clear, autojump works properly, only the autocomplete feature fails to work. When I press the <TAB> key, the ...
4
votes
2answers
986 views

Guess complete filename

I have some files with really long names lying around on my server and writing the complete names is kind of a pita so I'm asking if my Linux system (Debian 7) can guess the complete filename? I want ...
4
votes
1answer
396 views

Ignore files for zsh's completion for SVN

I managed to configure zsh such that it does not suggest LaTeX temporary files when I use autocompletion for emacs by adding this line to my ~/.zshrc: zstyle ':completion:*:*:emacs:*:*files' ignored-...
4
votes
1answer
1k views

Zsh autocomplete ls command with directories only

Suppose I have following files and directories: % ls bui00293 buiawer builds/ buiowpe/ I want to list the content of ...
4
votes
1answer
3k views

Avoid a trailing slash in bash when completing a directory name (like zsh)

I'm on a Mac and the cp and mv commands are killing me due to them copying the contents of a directory if a trailing slash is present. It has bitten me more than once when I use tab completion to ...
4
votes
1answer
230 views

set -x: tab completion results in messy output when working in debug mode

I understand that set -x gets a Bash user into debug mode and I feel that working full time in debug mode will help me handle possible problems better in Bash. I experience a problem when working ...
4
votes
1answer
262 views

How to deal with filenames containing a single quote inside a zsh completion function?

I'm using the zsh shell and have the following code inside my .zshrc: fpath=(~/.zsh/completion $fpath) autoload -Uz _vc autoload -Uz compinit compinit The first line add the path ~/.zsh/completion ...
4
votes
1answer
744 views

zsh: Tab completion for function with Git commands

In zsh I am using the following function to delete a local and a remote branch with one command: gpDo () { git branch -d "$1" && git push --delete origin "$1" } Currently, auto-...