在emacs dabbrev-expand之类的linux shell中是否有一个函数?
首先给出一个定义:
Mx描述功能输入 dabbrev-expand Enter
... Expands to the most recent, preceding word for which this is a prefix.
鉴于bash
似乎受Emacs影响最大,首先在那里看到几个可能性:
男人bash(1),readline部分
dynamic-complete-history (M-TAB) Attempt completion on the text before point, comparing the text against lines from the history list for possible completion matches. dabbrev-expand Attempt menu completion on the text before point, comparing the text against lines from the history list for possible completion matches.
默认情况下(或者我的系统至少), M- /已经绑定complete-filename
:
$ bind -l | grep / "\e/": complete-filename
你可以重新绑定它
"\e/": dabbrev-expand
在~/.inputrc
或/etc/inputrc
。
请注意,它似乎只能完成第一个单词(命令),并且只能从历史记录中完成,而不是从当前命令行完成,据我所知。
在zsh中,我在man page中看不到任何东西,但是通过找出合适的compctl
命令( Google镜像 ),就可以做到这一点。