vim-projectionist icon indicating copy to clipboard operation
vim-projectionist copied to clipboard

Execute command if does not exist

Open jrock2004 opened this issue 8 years ago • 3 comments

So I am using this plugin for my EmberJS project and I think it would be cool if I do something like Econtroller application and it does not exist, it can run an ember command ember g controller application. This way it would created the controller plus the other things it does like tests. Is this possible?

jrock2004 avatar Aug 19 '17 04:08 jrock2004

I'm not opposed to a hook to allow for something like this. But I would think the user experience would be horrendous. Imagine accidentally typing :Econtroller applicatio and having to delete 4 different files scattered throughout the directory tree to undo it. I would think it vastly preferable to provide a :Generate command, like rails.vim does.

tpope avatar Aug 23 '17 04:08 tpope

I guess the next challenge from there would be, how to tell what the generate command does

jrock2004 avatar Aug 23 '17 11:08 jrock2004

I was referring to a command with explicit arguments -- :Generate controller application -- which could then load the generated files into the quickfix list. Automatic arguments sounds really cool. You could probably pluck them out of projectionist#query_raw('type') (or projectionist#query_raw('generator') if you want to be more explicit).

tpope avatar Aug 25 '17 23:08 tpope