Replace Text Edit as the default text editor
Another option is to use duti (https://github.com/moretension/duti). 

Run brew install duti, save a filetype like this as:

duti -s com.sublimetext.3 public.plain-text all


The changes should be applied immediately, so you don't have to restart like when editing com.apple.LaunchServices.plist.

To also change the default application for executable scripts with no filename extension, add a line like this:

duti -s com.sublimetext.3 public.unix-executable all


Some files are also considered 'public.data', not 'public.plain-text', so you can do this as well:

duti -s com.sublimetext.3 public.data all