tab-completion

How to test Python readline completion?

帅比萌擦擦* 提交于 2020-01-01 08:33:07
问题 I'm writing a command-line interface in Python. It uses the readline module to provide command history and completion. While everything works fine in interactive mode, I'd like to run automated tests on the completion feature. My naive first try involved using a file for standard input: my_app < command.file The command file contained a tab, in the hopes that it would invoke the completion feature. No luck. What's the right way to do the testing? 回答1: For this I would use Pexpect (Python

How to test Python readline completion?

血红的双手。 提交于 2020-01-01 08:32:49
问题 I'm writing a command-line interface in Python. It uses the readline module to provide command history and completion. While everything works fine in interactive mode, I'd like to run automated tests on the completion feature. My naive first try involved using a file for standard input: my_app < command.file The command file contained a tab, in the hopes that it would invoke the completion feature. No luck. What's the right way to do the testing? 回答1: For this I would use Pexpect (Python

zsh - first tab completion with autocd

情到浓时终转凉″ 提交于 2019-12-25 01:44:20
问题 I am currently switching from csh to zsh I am writing a .zshrc trying to get all the options I am used to in this new shell. I use autocd (to go into a directory just typing its name (without the cd command), and I wonder if it is possible that my first propose all the files existing in the current directory (like it's working in csh). I am quite used to this way of having an overview of the files I can open or directory I can "autocd" into, before typing my command just pressing without

Remapping tab completions in vim

旧城冷巷雨未停 提交于 2019-12-24 08:28:42
问题 I've got a crazy little challenge. I'd like to remap tab and shift + tab to the basic tab completions in vim. Here's where I started: set completeopt= inoremap <tab> <C-n> inoremap <S-tab> <C-p> That didn't have any effect at all, and I also realized it might be messing up my snippets plugin. I went googling around and found this: http://vim.wikia.com/wiki/Smart_mapping_for_tab_completion, but had little luck implementing any of the suggestions. I'd like to map to tab and to shift + tab,

Is it possible to copy the tab completion of a command for my linux function?

早过忘川 提交于 2019-12-23 22:28:53
问题 Let's say I have a bash shell function named magic . I want to define a tab completion function _magic which would allow magic to piggyback on the tab completion functions of any given command (if available). In other words, I want magic to be able to do something like this: ~ $ magic git ... <search for _git and use it if found> ~ $ magic cd ... <search for _cd and use it if found> ~ $ magic some-cmd ... <search for _some-cmd and use it if found> I can't seem to find anything online that

Is it possible to display some help message when showing autocomplete candidates?

有些话、适合烂在心里 提交于 2019-12-22 11:43:10
问题 Some commands have many -x ( x can be any English letter) options and it's some times difficult to remember all of their meanings. I can use bash's compgen -W '-a -b -c' to show possible options and I'm wondering if it's possible to also show some help message. Like this: bash# foo -<TAB><TAB> -a: This is option a -b: This is option b -C: This is option c bash# 回答1: I ever did something similar to map some of curl 's single char options (like -x ) to GNU style --long-option s. This is how it

Unable to find a substitute command for Bash's complete in Zsh

一个人想着一个人 提交于 2019-12-22 10:35:17
问题 I put the newest git-completion.bash to my .zshrc and I get /Users/Masi/bin/shells/git/git-completion.bash:2116: command not found: complete /Users/Masi/bin/shells/git/git-completion.bash:2118: command not found: complete The lines are complete -o bashdefault -o default -o nospace -F _git git 2>/dev/null \ || complete -o default -o nospace -F _git git complete -o bashdefault -o default -o nospace -F _gitk gitk 2>/dev/null \ || complete -o default -o nospace -F _gitk gitk Which command is a

TAB completion does not work in Jupyter Notebook but fine in iPython terminal

▼魔方 西西 提交于 2019-12-20 08:57:48
问题 TAB completion works fine in iPython terminal, but not in Firefox browser. So far I had tried but failed, 1). run a command $ sudo easy_install readline , then the .egg file was wrote in /usr/local/lib/python2.7/dist-packages/readline-6.2.4.1-py2.7-linux-x86_64.egg, but TAB completion still doesn't work in Jupyter Notebook. 2). also tried to find locate the ipython_notebook_config.py or ipython_config.py , but failed. I use Python 3.5 and iPython 4.0.0. and both are installed in Ubuntu 15.10

How to enable auto completion in Ruby's IRB

喜欢而已 提交于 2019-12-20 08:00:30
问题 When I use Merb's built in console, I get tab auto-completion similar to a standard bash prompt. I find this useful and would like to enable it in non-merb IRB sessions. How do I get auto-completion in IRB? 回答1: Just drop require 'irb/completion' in your irbrc. If that doesn't work try bond, http://tagaholic.me/bond/: require 'bond'; require 'bond/completion' Bond not only improves irb's completion, http://tagaholic.me/2009/07/22/better-irb-completion-with-bond.html, but also offers an easy

Tab-completion of filenames as arguments for MATLAB scripts

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 22:50:10
问题 We all know MATLAB provides tab-completion for filenames used as arguments in MATLAB function like importdata , imread . How do we do that for the functions we create? EDIT: Displays the files and folders in the current directory. 回答1: Caution: unsupported hack here. Take a look at the file toolbox\local\TC.xml in your Matlab installation. This appears to contain the argument type mappings for tab completion. (I found this by just grepping the Matlab installation for "imread" in R2009b.)