edit

4.1

The edit command lets you open a folder, a file, or even a script function from your session in your favorite text editor.

It opens the specified function in the editor that you specify, and when you finish editing the function and close the editor, the script updates the function in your session with the new function code.

Functions are tricky to edit, because most
The edit command lets you open a folder, a file, or even a script function from your session in your favorite text editor.

It opens the specified function in the editor that you specify, and when you finish editing the function and close the editor, the script updates the function in your session with the new function code.

Functions are tricky to edit, because most code editors require a file, and determine syntax highlighting based on the extension of that file. edit creates a temporary file with the function code.

If you have a favorite editor, you can use the Editor parameter to specify it once, and the script will save it as your preference. If you don't specify an editor, it tries to determine an editor using the PSEditor preference variable, the EDITOR environment variable, or your configuration for git.  As a fallback it searches for Sublime, and finally falls back to Notepad.

REMEMBER: Because functions are specific to a session, your function edits are lost when you close the session unless you save them in a permanent file, such as your Windows PowerShell profile.

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Script -Name edit

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Author(s)

Joel 'Jaykul' Bennett

Copyright

Copyright 2019, Joel Bennett. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Owners

Tags

Edit VSCode

Functions

SplitCommand FindEditor

Dependencies

This script has no dependencies.

Release Notes

4.1 - Refactored back to a script function and publish to PowerShell Gallery
4.0 - Added support for VS Code, fixed a bug in the internal SplitCommand
3.0 - made it work for file paths, and any script command. Added "edit" alias, and "NoWait" option.
2.1 - fixed the fix: always remove temp file, persist across-sessions in environment
2.0 - fixed persistence of editor options, made detection more clever
1.1 - refactored by June to (also) work on her machine (and have help)
1.0 - first draft, worked on my machine

Version History

Version Downloads Last updated
4.1 (current version) 253 2/20/2019