ex-mode
ex-mode copied to clipboard
Feature proposal: Command specific autocompletion
Hi. Thanks for the handy library. I've written a couple of commands that take package names. I would like those commands to autocomplete with package names. Would you be open to allowing users to define command-specific completions? If so, some thoughts on how this could work:
- Commands would be registered with a basic api like
Ex.registerCommandCompletions('command_name', completionFn)
.completionFn
would be a function that takes one argument, the string of text after a command. For example, if a user typedcommand foo bar
, the completionFn would receive 'foo bar'. - If a command doesn't have a completionFn registered, default to the excellent file completion introduced in #29
Let me know your thoughts. Can create a PR if interested. Cheers, Gabriel