i use sublime 2 developing r , php code, although imagine shortcut useful other languages.
if copy path of file windows explorer / xyplorer (or other source) has backslashes directories. when entering path source code, needs forward slashes.
sublime has reasonably powerful macro commands, cannot think of combination able to:
- take string of text on current line
- replace instances of '\' , replace them '/'
here workflow envisage:
- locate filename in explorer , copy path
- in sublime, write line of code , paste in path
- hit keyboard shortcut, ctrl+shift+\, , slashes converted forward slashes
the result:
mypath = "e:\work\code\myfile.csv";
becomes:
mypath = "e:/work/code/myfile.csv";
without running risk of backslashes elsewhere in file being changed (e.g. \n characters), , without having use multiple key presses or mouse clicks.
i imagine possible regex. 2 things no expert in sublime macros or regex, wonder if else knows magical commands achieve this?
i tried 15 minutes. few things:
- sublime text 2 doesn't allow find/replace macros
- sublime text 3 doesn't allow 'find in selection'
so, think kind of beat right other writing plugin, straightforward.
Comments
Post a Comment