cespare / reflex

Run a command when files change
MIT License
3.35k stars 135 forks source link

Run go install on file change #84

Closed souvikhaldar closed 3 years ago

souvikhaldar commented 3 years ago

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'
cespare commented 3 years ago

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
souvikhaldar commented 3 years ago

Awesome, thanks!