Having no native text editor in PowerShell is pain. To edit text in PowerShell you have limited number of features to use. And most common one is notepad.exe. There is nothing wrong with notepad for basic text editing. But you know what a person using PowerShell wanted to edit text without leaving the command line is just not gonna edit a simple text file.
Expectations
That text file also could be a code file like .js , .php or our loved one .py file. And editing those files in notepad is not a good idea. There is a simple way to do this thing in very useful way without facing an ugly UI of notepad.
Setting up
Setting up sublime text editor can save your life as it did for me. For setting sublime to use from PowerShell. We just need to set alias to open, create and view files from PowerShell in your favorite text editor.
Here is how to set alias in PowerShell:
Set-Alias subl 'C:\Program Files\Sublime Text\subl.exe'
Here “subl” is the alias we can to set and the path in front of it is the path of program we want to set up an alias for.
Here we create alias for “subl.exe” as “subl”. You can name it whatever you want just replace “subl” and type name for your ease.
Usage
Now to use this alias simple just go to folder where your file are by using “cd” tool or open terminal in your folder where you want you to open files.
subl script.py
File will be opened as expected.
Thanks for reading. Peace ✌🏻