tab-completion

Bash completion from another completion

最后都变了- 提交于 2019-12-05 22:20:35
I have a script that requires as an argument the name of command and arguments of that command. So I want to write a completion function that would complete the name of the command and would complete the arguments for that command. So I can complete the name of the command like this if [[ "$COMP_CWORD" == 1 ]]; then COMPREPLY=( $( compgen -c ${COMP_WORDS[COMP_CWORD]} )) else #Don't know what to write here fi So this will complete the first argument to list of shell commands that are available to run. And on second and other arguments I need a completion for ${COMP_WORDS[COMP_CWORD]} command. I

CVS tab completion for modules under Linux

耗尽温柔 提交于 2019-12-05 19:56:51
How can I get tab completion to work for selecting CVS modules under Linux (preferably using bash) ? For example, "cvs co " + tab would list the modules I can checkout. I've heard it's easy to do using zsh, but still I didn't manage to get it working either. Also, how can I list all available modules (or repositories?) available in the CVSROOT? There is the Bash completion project. It has some cvs completion in it, I'm not 100% if it can determine all the modules for checkout. But it would be a good place to start. I already have this behavior I think (don't have a reliable CVS repository to

Python Twisted integration with Cmd module

拥有回忆 提交于 2019-12-05 08:20:31
I like Python's Twisted and Cmd . I want to use them together. I got some things working, but so far I haven't figured out how to make tab-completion work, because I don't see how to receive tab keypres events right away (without pressing Enter) in Twisted's LineReceiver. Here's my code so far: #!/usr/bin/env python from cmd import Cmd from twisted.internet import reactor from twisted.internet.stdio import StandardIO from twisted.protocols.basic import LineReceiver class CommandProcessor(Cmd): def do_EOF(self, line): return True class LineProcessor(LineReceiver): from os import linesep as

Ignore a path entry with bash tab-completion

心不动则不痛 提交于 2019-12-05 03:51:05
I have two commands, foo and foo-bar , where foo is a symlink to foo-bar . I want to be able to type f +TAB (pretend these are the only two commands on the path that begin with f ) and have one of them be completed (meaning the full name and the space after). What ends up happening though is that it completes to just foo (no space) because of foo-bar . It's obviously not much work to then just hit the space bar, but this interrupts my flow. Some additional details: foo and foo-bar are in the same directory. Deleting/moving foo isn't an option (I've hidden some details). Is there a way to

Bash completion: compgen a wordlist as if they were paths - Only suggest up until next slash

╄→尐↘猪︶ㄣ 提交于 2019-12-04 23:58:51
问题 I'm working on a bash completion script for a dot file management utility. The tool has a command dots diff [filename] that will show the difference between the installed dot file and the source dot file. It also has a command dots files which lists the paths of all managed dot files (relative to the source directory). I would like to complete the diff command with the output of the files command. Here's an example of the files output X11/xkb/symbols/evan-custom X11/xorg.conf.d/10-dual

How do I autocomplete nested, multi-level subcommands? [duplicate]

拥有回忆 提交于 2019-12-04 23:51:56
This question already has answers here : Multi Level Bash Completion (2 answers) Closed last month . I am trying to develop an autocomplete or tab-complete feature for my own set of commands. For example, assume foo is my binary: CLI>> foo [TAB] [TAB] It should show the main commands configure and show . Then if I select configure , it should show the subcommands CM , DSP and NPU : CLI>> foo configure [TAB] [TAB] DSP NPU CM` I only know how to tab-complete and display for the first level - how can I get the second level as well? I will place this in /etc/completion.d . My Code: _foo() { local

Tab Completion In Emacs shell-mode SSH Sessions

守給你的承諾、 提交于 2019-12-04 19:25:27
问题 My current use pattern of emacs results in my having several shell-mode buffers open, each running an ssh session. I am running into an issue with this, though - when I try to tab-complete file names and other things in my remote session, the shell attempts to use completions available on the local machine instead of on the remote machine. For example, if the file ~/foobar exists on the local machine and ~/frob exists on the remote machine, typing in ~/f and pressing tab results in ~/foobar

Zsh color partial tab completions

左心房为你撑大大i 提交于 2019-12-04 17:23:29
问题 Is it possible to color the completed part of the partial completion results in Zsh? Fish does this by default (in Gentoo at least) as shown in the image below: Full size image: http://i.imgur.com/tN6w3.png 回答1: Yes, you can do it with things like that: zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)(?)*==02=01}:${(s.:.)LS_COLORS}")' Just change the 01 and 02 colors so it matches your taste, for example to match your screenshot: zstyle -e ':completion:*

Emacs: Tab completion of file name appends an extra i:\\cygwin

血红的双手。 提交于 2019-12-04 14:53:51
I am facing some strange behavior with file-name completion in emacs. C-x C-f to find file opens up the minibuffer with i:/cygwin/home/rrajagop/StockScreener/working_copy/master_repo/stock_screener/. Hitting a TAB makes it i:/cygwini:/cygwin/home/rrajagop/StockScreener/working_copy/master_repo/stock_screener/. A couple of interesting things I've noticed: When the minibuffer opens up, i:/cygwin is greyed out and the path seems to start from /home. A C-a (go to begining of line) takes me to /home and not to i:/cygwin. So it looks like something in emacs is parsing the path to start from /home

IPython tab completes only some modules

会有一股神秘感。 提交于 2019-12-04 06:57:35
I'm using the EPD version of python and IPython. After installing some modules using easy_install I notice that, although they can be imported, they cannot be tab completed. They exist on the path but, while included modules (pylab, readline, math) can be completed, these new modules cannot. Anyone know what I should look into to find the problem? I've checked that the packages are in the same place as other modules: In [1]: import pylab In [2]: pylab Out[2]: <module 'pylab' from '/Library/Frameworks/Python.framework/Versions/5.0.0/lib/python2.5/site-packages/pylab.pyc'> In [3]: import