Split personality text editing in SSMS with Sublime Text 3
My preview post showed a demonstration of the multi-cursor editing power of Sublime Text 3 when speeding up your coding with SQL server.
There is a pretty straight forward way to setup sublime (or one of your preferred text editors) to open the same file you are editing in SQL Management Studio without much hassle. I find this helpful when the type of editing might benefit from some of the fantastic functionality in Sublime.
External Tool Menu
Go to Tools > External Tools
Setup Sublime Commands to Open
*Title: *Edit in Sublime
*Command: *C:\Program Files\Sublime Text 3\sublime_text.exe
*Arguments: *$(ItemPath):$(CurLine):$(CurCol)
Initial Directory: $(ItemDir)
Important:
One thing I personally experienced that wasn’t consistent was the handling of unsaved files. If the file is SqlQuery## as a temp file that hasn’t been saved, then this opening didn’t work for me. Once I had the file named/saved, it worked perfectly, even bringing the cursor position in Sublime to match what was currently in SSMS.
Refresh File
Tools > Options > Environment > Documents
You can setup the auto-refresh to be in the background if you wish, or manually select the refresh from SSMS when it detects the change. If the auto-refresh happens while you are editing sometimes it caused me to have redo some work (or control-z) in Sublime, but for the most part it’s pretty seamless.