=Generalize editor initialization
This commit is contained in:
parent
0a2bb25700
commit
2ce7561fb7
|
@ -5,7 +5,7 @@
|
|||
)
|
||||
|
||||
begin {
|
||||
$global:WaitForEditor = (($WaitForEditor, 0 -ne $null)[0], 5 -ne 0)[0]
|
||||
$global:WaitForEditor = (($WaitForEditor, -1 -ne $null)[0], 5 -ne -1)[0]
|
||||
$PathForEditor = @()
|
||||
}
|
||||
process {
|
||||
|
@ -15,7 +15,7 @@ process {
|
|||
}
|
||||
|
||||
end {
|
||||
$local:editors = $env:EDITOR,'nvim','code'
|
||||
$local:editors = $env:EDITOR,'nvim','codium','code'
|
||||
$local:editor = $null
|
||||
foreach( $local:testEditor in $editors ) {
|
||||
if( $(try{Get-Command -ListImported -Type Application $testEditor -ErrorAction SilentlyContinue}catch{}) ) {
|
||||
|
@ -28,10 +28,10 @@ end {
|
|||
$editor += ' -p'
|
||||
}
|
||||
|
||||
if( $editor -match 'code(\.exe)?"$' ) {
|
||||
if( -not (Get-Process -Name 'code' -ErrorAction SilentlyContinue) ) {
|
||||
if( $EditorProcessName ) {
|
||||
if( -not (Get-Process -Name $EditorProcessName -ErrorAction SilentlyContinue) ) {
|
||||
Invoke-ExpressionEx -sudo:$sudo "& $editor"
|
||||
while( -not (Get-Process -Name 'code' -ErrorAction SilentlyContinue) ) {
|
||||
while( -not (Get-Process -Name $EditorProcessName -ErrorAction SilentlyContinue) ) {
|
||||
Start-Sleep -Seconds 1
|
||||
}
|
||||
Write-Host -ForegroundColor DarkCyan "Please wait, initializing editor..."
|
||||
|
|
Loading…
Reference in New Issue