A Useful Dev tip/trick I Learnt Today

Souvik Haldar
1 min readDec 13, 2021
That’s my desktop, when not working like a nomad :D

It is useful to run some commands automatically when certain files change, like, I want to run `go install` in my working directory every time I edit any go file. You can do it using this tool https://github.com/cespare/reflex using the following command:

reflex -r ‘\.go’ go install

Bonus tip: nohup it using the following command to run in the background and ignore the input and append output to .out file to avoid activity on the screen.

nohup reflex -r ‘\.go’ go install &

You can of course control the background processes using jobs command afterward.

If you’re using vim you can run it async using AsyncRun vim plugin using:

AsyncRun reflex -r `\.go` go install

This will enable use you to look out for compilation errors in the quickfix window easily. (:copen to open and :cclose to close)

More about the auther at http://www.souvikhaldar.info :)

--

--