a feature provided by interactive programs such as shells and text editors that inserts text in order to complete a word or phrase that the user is likely intending to compose
21
votes
2answers
2k views
rebuild auto-complete index (or whatever it's called)
After installing new software, an already opened terminal with zsh won't know about the new commands, and cannot generate auto-complete for those. Apparently opening a new terminal fix the problem, ...
17
votes
3answers
1k views
15
votes
3answers
2k views
scp: How to Enable Autocompletion for Remote Paths?
I remote copied a file to my laptop using:
scp someFile USER@192.168.178.32:/home/USER/put/it/some/where/oh/damn/you/here
I am too lazy for this! I want to be able to autocomplete the remote path ...
14
votes
2answers
4k views
An easy bash completion tutorial?
I want to learn how to write bash completion scripts. Which tutorial would you recommend for a newbie?
11
votes
1answer
324 views
Dynamically update completion list in zsh
I find zsh's result lists for Tab completion quite useful, however I'd like to tweak their behaviour a bit:
They should appear when I Tab for the first time and afterwards dynamically update with ...
10
votes
4answers
1k views
Command-line completion from command history
So, I've looked at history and at Ctrl+R, but they are not what I thought I knew.
Is there a way that I can type in the beginning of a command, and cycle through the matches in my history with some ...
10
votes
3answers
917 views
How can I tell bash valid tab-completions for arguments to my Python script
Say I have a program hello.py and one possible valid argument to it is:
./hello.py autoawesomesauce
Is is possible to type in:
./hello.py auto[tab]
at which point the partially completed ...
10
votes
1answer
2k views
How do I get bash completion for command aliases?
I am looking to get tab-completion on my command line aliases, for example, say I defined the following alias :
alias apt-inst='sudo aptitude install'
Is there a way to get the completions ...
10
votes
1answer
152 views
Bash tab completion expands “~” into “/home/___” when it didn't before
Previously, if I typed ~/biTab, before, it would turn into ~/bin. However, today it started turning ~/biTab into /home/username/bin.
I would rather have it the former, but I'm not sure what happened ...
9
votes
1answer
1k views
Add arguments from previous command to zsh completion
In zsh (as well as bash) you can use some history word expansions to denote arguments from previous commands.
This example shows getting the 2nd parameter from the previous command in history with ...
7
votes
3answers
456 views
How to pipe the list of commands displayed by of “tab complete”?
When using commands in bash I like the double tab option to display the available commands. Some commands have more possible matches than others:
Is there a way I can pipe the output of the double ...
7
votes
2answers
898 views
Make BASH's Tab Completion Fill In First Match?
Is there any way to make BASH fill in the first match when I press TAB, kind of like the Windows command prompt?
(It should still display the list of matches, but it should cycle through them when I ...
7
votes
5answers
2k views
Weird Stuff in Terminal When I Hit Tab
For some reason, today, everytime I hit tab in the terminal this shows up:
cat bash: warning: setlocale: LC_CTYPE: cannot change locale (en_CA)
Display all 150 possibilities? (y or n)
This ...
7
votes
1answer
685 views
Bash autocomplete in ssh session
It seems that bash doesn't want to autocomplete commands (what's annoying me right now is not autocompleting apt-get) when I'm logged into my machine from SSH. Is there some setting that will allow ...
7
votes
2answers
254 views
Command line prediction
I've found an interesting paper: Predicting UNIX Command Lines about command-line prediction (based on user past activity), and I wonder if any actual implementation of such thing exists?
7
votes
1answer
271 views
How to output string completions to stdout?
Some of the git commands have many options, and it would often be useful to search through them for the one I need - I was just looking for the option which controls the TAB width in git-gui, but ...
6
votes
3answers
316 views
Bash autocomplete gives different file name than ls
An incredibly strange thing just happened. Through a serious typo, I entered
cp filename.xsl .^?~
Yeah, that's right, dot-caret-questionmark-tilde! Truth is stranger than fiction.
It gets weirder. ...
6
votes
1answer
979 views
Terminal autocomplete: cycle through suggestions
I had this on my Ubuntu setup and since I switched to Fedora I want to set it and I forgot how... The idea is simple :
I don't want the terminal to show me suggestions when I double tab, instead I ...
6
votes
3answers
977 views
Tab-completion for Mercurial in Bash?
Using Subversion on the command-line, it intelligently tab-completes available subcommands, etc:
$ svn c<tab>
cat checkout cl co copy
changelist ci ...
6
votes
5answers
267 views
How to disable emacs here document completion
When editing a bash script file with emacs, and trying to enter <<<, at the second < emacs insert a template for a here document, like in the following example:
<<EOF
EOF
This is ...
5
votes
2answers
452 views
vim custom pop up menu
How do I create a custom completion pop up menu.
I would like to be able to begin typing a part of a string then press a custom key combination to bring up a pop up completion of just a certain group ...
5
votes
4answers
2k views
Apt-get autocompletion
I am currently running 64-bit Debian Wheezy.
I am having some trouble with auto completion for apt-get. I have bash-completion installed.
If I am logged in as root in a shell, I can use auto ...
5
votes
1answer
1k views
TAB autocomplete in Bourne Shell
I don't know how to get the TAB key to autocomplete filenames, commands, or anything at all.
I'm on a Unix-like system (OS/390) and depend on several scripts that work in sh (Bourne shell, not ...
5
votes
1answer
175 views
compgen : ignoring case
I'm trying to implement a custom bash completion as described here. However, it seems that compgen is case-sensitive. Is there a way to turn it case-insensitive in that context ?
5
votes
2answers
412 views
Create bash completion script to autocomplete paths after is-equal sign?
I want to create a bash completion script which recognises arguments of the form --arg and --some-arg=file.
After reading this tutorial and some examples in /usr/share/bash_completion/completions/, ...
5
votes
1answer
200 views
zsh - fully expand binary path on <tab>
In my current zsh behaviour, hitting tab after typing "sudo" just adds a space.
$ sudo ...
What I really want is for the tab to fully expand to the path of the binary it is about to execute when I ...
5
votes
2answers
214 views
Bash autocomplete: first list files then cycle through them
Is it possible to configure bash in such a way that on the first tab autocomplete it lists all possible files and on subsequent ones cycles through the choices?
Both options are easy to do ...
5
votes
1answer
142 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 ...
4
votes
4answers
68 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
2answers
59 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
4answers
1k views
How does Bash path completion work with sudo?
Tab path completion does not work (at least on Ubuntu and AFAIK Arch) with
sudo mount <whatever>
The iso file I am trying to mount is not in /etc/fstab. If I just type
mount <whatever>
...
4
votes
1answer
43 views
List the bash completion that's current active on a program?
Is there anyway to list the bash completion function in use for current command ?
e.g for ls
4
votes
2answers
247 views
Saving tab completion possibilities to a file
Instead of displaying all possibilities on terminal screen, as in:
$ ls /etc/<TAB>
Display all 230 possibilities? (y or n)
I want to save all possibilities to a file.
ls /etc/ > file.txt ...
4
votes
1answer
656 views
How do I get my shell functions to make use of existing autocompletion in zsh?
I have a couple of shell functions defined in my .zshrc which save on typing and allow integration with screen. For example:
function s()
{
screen -t "$1" ssh "$@"
}
However, when I use these ...
4
votes
3answers
862 views
How can I expand a relative path at the command line, with tab completion?
In bash is there any way to expand a relative path into an absolute path, perhaps with tab completion?
I ask because sometimes I will search for a file, find it, then vim it:
cd /etc
cd apache2
cd ...
4
votes
2answers
541 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 ...
4
votes
3answers
553 views
Auto-completion of words from the terminal buffer
In editors like vim and emacs, one can use hotkeys like C-p (vim) or M-/ (emacs) to perform auto-completion on the current word using other words in the same buffer.
Is it possible to achieve the ...
4
votes
2answers
166 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 ...
4
votes
1answer
669 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 ...
4
votes
3answers
109 views
Can any shell do argument-level interactive search?
Sometimes I need to reuse certain long arguments like paths.
If I use history search (CTRL+R), I may find some command that contains the path, but I still need to delete anything else in the old ...
4
votes
0answers
23 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 ...
4
votes
1answer
152 views
Need help on this bash auto completion script
I'm trying to setup autocompletion for a command, which takes only one parameter, a folder name,
In /secure/kernel_builds/, I have the three following subfolder:
3.5.6/ 3.6.2/ source/
Now I want ...
4
votes
0answers
159 views
zsh: how to fix tab completion so it doesn't hide entries?
I'm using oh-my-zsh on Mac OS X with homebrew'ed zsh 4.3.12. I stumbled recently on a weird problem. In scripts/not-used I have several .R files:
breakdowns.R eventloop.R ...
3
votes
4answers
375 views
List all files / binaries in current PATH
Is there an "easy" way of running an "ls -la" style command for listing all files / executable binaries in the current PATH?
(I intend to pipe the output into grep, for looking for commands with ...
3
votes
2answers
64 views
How do I let bash autocomplete wildcards?
If I have directory containing the files
foo.bar.a.cat
foo.bar.a.hat
and I type ls f+TAB the bash shell autocompletes to ls foo.bar.a.. If I type ls *bar*+ TAB I would like it to autocomplete to ...
3
votes
1answer
209 views
ZSH takes two tabs to complete filenames
I love Zsh's tab completions, but it's frustrating when there is only one possible option and I have to tab twice to tab complete the filename.
For example, if this is a list of files in a directory:
...
3
votes
1answer
452 views
is there a way to set coloring for cd tab complete?
I use ubuntu 11.04.
Is there a way to set coloring for output after tab completion listing of a cd, ls, or etc. ?
i.e.
myshell@root$ cd ~/user/files/ I hit tab...
myfile myfoo mybar <-- this ...
3
votes
1answer
411 views
Autocomplete of filename in directory
This question is quite similar to this one, but I can't understand the solution. I also know this tutorial, but still I am unable to understand what I am doing wrong.
I am trying to autocomplete the ...
3
votes
1answer
602 views
ZSH: insert completion on first tab even if ambiguous?
Currently ZSH displays a menu when I first hit tab and the completion is ambiguous. So, if I have 'cd ' in the command prompt and I hit tab, it will show the different available completions. If I hit ...
3
votes
1answer
525 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 ...