Is it possible to enable bash_completion for :! or: r! in vim?

I can use: shell to enter the current dir and run commands. bash_completion is working fine.

But how to get bash_completion to work in :! command or: r! command line

Note I'm Emacs, and the Emacs M team is! doesn't allow such things (also Mx shell , you need Mx term to get bash_completion).

+6
source share
2 answers

It's impossible. What @Prince Goulash has in mind is a simple vim fill in of the file name. If you know how to get bash to use pipe termination options somewhere, you can create a termination function for the user command, which can, in turn, call the built-in :! but completion override for built-in commands is not possible.

I personally don’t know how to do it with bash and I know that trying to do it in zsh leads to dirty hacks overriding zsh built-in commands (like compadd ) using pexpect (python), Expect (perl), expect (tcl) , zsh / zpty or something similar to launching the shell interactively and inventing the IPS mechanism zsh-> vim (in the opposite direction it is much easier) (I once started working on a similar module for zsh, but stopped because it was too many problems).

+2
source

You have

 set nocompatible 

in your .vimrc? This automatically allows you to end ex-mode for :! . To see a list of possible completions, you can also use

 set wildmenu 

and explore wildmode options.

+1
source

Source: https://habr.com/ru/post/893408/


All Articles