Skip to content

Commit

Permalink
Get-EditorLaunch returns a cmd line for unknown editor (#247)
Browse files Browse the repository at this point in the history
- $env:EDITOR and $ENV:VISUAL are now respected properly if the editor is unknown
- Resolves #246
  • Loading branch information
kelleyma49 authored Feb 2, 2024
1 parent dcaf205 commit a02741b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions PSFzf.Functions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ function Get-EditorLaunch() {
"$editor$editorOptions +{1} ""{0}""" -f $(Resolve-Path $FileList.Trim('"')), $LineNum
}
}
else {
# select the first file as we don't know if the editor supports opening multiple files from the cmd line
if ($FileList -is [array] -and $FileList.length -gt 1) {
"$editor$editorOptions ""{0}""" -f $(Resolve-Path $FileList[0].Trim('"'))
}
else {
"$editor$editorOptions ""{0}""" -f $(Resolve-Path $FileList.Trim('"'))
}
}
}
function Invoke-FuzzyEdit() {
param($Directory = ".", [switch]$Wait)
Expand Down

0 comments on commit a02741b

Please sign in to comment.