VimuxPromptCommand should support completion
hupfdule opened this issue · 4 comments
It would be the best if Vimux would utilize the completion features of the users shell.
I expect that this is not easy / impossible inside vim, but since Vimux integrates with tmux it could be done by actually using a tmux pane for entering the command (which then supports the completion features of the users shell) and remember that command to be used for VimuxRunLastCommand
.
As you can see at #142---and in case anyone else comes across this issue while waiting for repository ownership to settle, as I did---all you need to do is add an argument to the input
function, so that its invocation reads let l:command = input(_VimuxOption("g:VimuxPromptString", "Command? "), command, 'shellcmd')
. Notwithstanding @madchap's comment on that issue, this fix does not seem to interfere with calls to VimuxRunLastCommand.
Fixed in #142, thanks to @thalesmello for the contribution.
I leave this issue closed, as it seems that other people are fine with the current solution.
But in fact this is not fully what I meant when writing this issue. I was a bit unclear in the description of my expectations. In fact I do not only want the actual command to be autocompleted, but (and that is way more important to me) the arguments to the command. Most of the time I have to add some file path to a command. That one is hard to remember and easy to mistype. Every shell has the functionality to expand file paths. Or a command has a lot of different options I can't easily remember. Most shells have a feature for autocompleting options to specific commands (bashcompl for example). That is also very handy. In fact that is way more important than the command which is most of the time an easy to remember and easy to type short string.
@hupfdule I see what you are saying now, but I think it is out of scope for this plugin to try to invent an entire completion system, even if it is some kind of pass through to a shell.
On the other hand we could easily change the completion mechanism to any provider. The shellcmd
provide is a VIM builtin, but it is possible to write your own completion provider function and have it do anything you want. See :help command-completion
for some info including how to write custom functions.
I'd be happy to adapt the input
field to use a configuration preference instead of hard coding shellcmd
so that you can use any completion provider you wish. There are lots of them out there and presumably one is out there somewhere that mimics shell completions.