cespare / reflex

Run a command when files change

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Run go install on file change

souvikhaldar opened this issue · comments

I want to run go install in my current directory whenever a go file is changed (using vim :w). How can I do it?
I tried the following but it did not work:

reflex -v -g "*.go" 'go install'

Reflex will try to run a command named go install; you need to let the shell do argument splitting for you so you want

reflex -v -g "*.go" go install

If the .go files you're editing are inside some subdirectory, this won't work since there's no recursive globbing. In that case you could use a regex match instead:

reflex -v -r '\.go$' go install

Awesome, thanks!