tab-completion

Accesssing bash completions for specific commands programmatically

I'm trying to write a small command launcher application, and would like to use bash's tab completions in my own completion system. I've been able to get a list of completions for general commands using compgen -abck. However, I would also like to get completions for specific commands: for instance, the input git p should display complet...

bash completion prevents backspace

I am trying to set up bash completion for a utility script I wrote, so I added the following script to /etc/bash_completion.d: _mcd() { local cur words COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" words=`mcd-completion-words` COMPREPLY=( $(compgen -W "${words}" -- "$cur") ) return 0 } complete -F _mcd mcd The ...

Unification of python command line interpreter and command-subcommand command line interfaces

I have an command line interpreter (or "line-oriented command interpreter" in the python docs for the cmd module) for a program that I'd like to add command line utility interface to. For example, now a session looks like this: (% for shell prompt, :) is my custom prompt) % tasks (invokes command line interpreter) :) clockHours Teachin...

How do I get Xcode-like tab-completion in TextMate?

Xcode shows you a grayed-out version of what it will complete to and if you hit tab or right-arrow, it will complete. It's pretty sweet. Is this possible in TextMate? Thanks! Matt ...

Ambiguous tab completion not working in iPython on Windows

I am running IPython on Windows 7 x64 with pyreadline installed. If I start a new session and type: import numpy nu<TAB> Then nu autocompletes to numpy. However, if I start a new session and try this: import numpy n<TAB> Then nothing happens. I would expect it to cycle through all of the possible completions. I'm currently usin...

Zsh completion resource?

Zsh completion is a rather complex beast, and I find the man-page very difficult to read, especially it's missing (simple) examples of all the various optspec forms etc. I haven't managed to find anything online myself yet so help would be most appreciated. As an example here's what I'm struggling with at the moment, and the zshcompsys...

How do I prevent vim from expanding ~ during completion?

I'm on my macbook using vim, and let's say for simplicity's sake that I have ~/some_file.py, ~/some_other_file.py, and ~/user.py open. On the mac, ~ expands to /Users/<username>. So if I type in :b user and then hit tab to expand, it goes through each of the files instead of going straight to ~/user.py. Is there any way to prevent thi...

How to do a multi-level CLI in Python?

Hi I'm trying to do a CLI, preferrably written in Python. I need a multi-level CLI, and I want tab completion. I looked at the cmd module (from the Python standard library) and readline with the "complete" function (for tab completion). They both lacked at something, i.e. I haven't figured out how to handle multiple levels such as: l...

vim word completion navigating with 'j' and 'k'.

In vim, I use Ctrl-n to word complete while in insert mode. If there is more than one possible match, I get a dropdown from which I can select one of the possible matches using the arrow keys. However, I don't want to use the arrow keys; I want to use the 'j' and 'k' keys. But when I type 'j' or 'k', it inserts the letters instead of go...