简体   繁体   English

是否可以为:启用bash_completion:或者:r!在VIM?

[英]Is it possible to enable bash_completion for :! or :r ! in VIM?

I can use :shell to enter current dir and run commands. 我可以使用:shell输入当前目录并运行命令。 bash_completion work fine. bash_completion工作正常。

But how get bash_completion working in :! 但是如何让bash_completion工作 command or :r ! 命令:r! command case? 命令案例?

Note . 注意 I am Emacs user and Emacs M-! 我是Emacs用户和Emacs M-! command don't allow such things (also Mx shell , you need Mx term to get bash_completion). 命令不允许这样的事情(也是Mx shell ,你需要Mx术语来获得bash_completion)。

It is not possible. 这不可能。 What @Prince Goulash is referring to is a simple filename completion done by vim itself. @Prince Goulash所指的是由vim本身完成的简单文件名完成。 If you know how to force bash to pipe completion variants somewhere you can create a completion function for custom command which may in turn call built-in :! 如果您知道如何在某处强制执行bash到管道完成变体,则可以为自定义命令创建一个完成函数,该函数可以依次调用内置函数:! , but redefining completion for built-in commands is not possible. ,但无法重新定义内置命令的完成。

I personally do not know how to do this with bash and know that trying to do so in zsh results in dirty hacks with redefining zsh built-in commands (like compadd ), using pexpect (python), Expect (perl), expect (tcl), zsh/zpty or something similar to run shell in interactive mode and inventing zsh->vim IPC mechanism (in opposite direction it is much simpler) (I once started working on a similar module for zsh, but stopped as there were too much problems on this way). 我个人不知道如何用bash做到这一点,并且知道在zsh中尝试这样做会导致重新定义zsh内置命令(如compadd )的脏兮兮,使用pexpect(python),Expect(perl),expect(tcl) ),zsh / zpty或类似的东西在交互模式下运行shell并发明zsh-> vim IPC机制(相反方向它更简单)(我曾经开始为zsh开发类似的模块,但因为太多而停止了这方面的问题)。

Have you got 你有吗?

set nocompatible

in your .vimrc? 在你的.vimrc中? This automatically enables ex-mode completion for :! 这将自动启用ex模式完成:! . To see the list of possible completions you could also use 要查看可能的完成列表,您也可以使用

set wildmenu

and investigate the wildmode options. 并调查wildmode选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM