On 18/04/11 04:23, Ted wrote:
Hello folks,
I've written a command that will replace the contents of a buffer with
the output of a shell command.
:%r !whatever
or if the buffer contains the command's stdin (or if it reads no estdin)
:%!whatever
in both cases replacing "whatever" by the command
I'd like to have it provide completion as similar as possible to that
used by bash itself. Ideally, I would like it to use the bash
completions themselves, presumably by spawning a subshell. A fallback
(for compatibility, speed, or practicality) would be to use the same
sort of completion provided by vim's `:!` command. This seems to work
by doing command-name completion on the first word and filename
completion (and escaping) on subsequent words.
I have tried using `-complete=shellcmd`, but this only seems to
complete command names and does not progress to completing filenames
after the first word.
well, on
:!ln -sv FILENAME LINKNAME
I get completion for the fileName. Haven't tried it on the linkname.
If you want bash to handle completion for your command, you'll have to
call bash while typing the command, since IIRC completion can be
customized in bash itself so that it can potentially act correctly on
any possible command, including user-defined ones. But I don't think
it's (easily) possible.
I've also looked into hooking into bash to have it handle completion;
there does not seem to be a straightforward way to do this, either.
Here, the complications are due to what seems to be a lack of features
in bash itself, so any advice is likely somewhat off-topic, but
nonetheless welcome :)
Is there an addon or a wiki page which provides such feature or a
recipe to implement it?
Best regards,
Tony.
--
The seven deadly sins ... Food, clothing, firing, rent, taxes,
respectability and children. Nothing can lift those seven milestones
from man's neck but money; and the spirit cannot soar until the
milestones are lifted.
-- George Bernard Shaw
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php