I just put sublime text into my path variable so whenever i have to edit a text while I'm in Powershell, I can type sublime_text <file name.txt>
instead of notepad <file name.txt>
But writing out sublime_text
is too long.
Is there a way I could shorten that and write, say sublime <file name.txt>
and still have that txt file open in sublime text?
CodePudding user response:
You can use a wrapper function for this. You can also store the function in your profile file so it is auto-loaded each time you start a session.
function subl {
$p = try { Convert-Path $args } catch { }
sublime_text $p
}
Things like this should work fine:
PS /> subl .
PS /> subl .\myscript.ps1