Skip to content

$EDITOR_Override #163

@Chisamba880

Description

@Chisamba880

As the Editor Configuration section is currently written the vim alias is only set to an editor found in the list or the default 'Notepad'. It is not applied to an editor supplied with the $EDITOR_Override variable taken from the users profile, unless the user sets the alias there. By moving "Set-Alias -Name vim -Value $EDITOR" to after the last closing bracket of the if statement the alias will be set to the editor provided by the $EDITOR_Override variable, where it exists, or that set in the if statement where it does not.

# Editor Configuration
if ($EDITOR_Override){
    $EDITOR = $EDITOR_Override
} else {
    $EDITOR = if (Test-CommandExists nvim) { 'nvim' }
          elseif (Test-CommandExists pvim) { 'pvim' }
          elseif (Test-CommandExists vim) { 'vim' }
          elseif (Test-CommandExists vi) { 'vi' }
          elseif (Test-CommandExists code) { 'code' }
          elseif (Test-CommandExists codium) { 'codium' }
          elseif (Test-CommandExists notepad++) { 'notepad++' }
          elseif (Test-CommandExists sublime_text) { 'sublime_text' }
          else { 'notepad' }
}
Set-Alias -Name vim -Value  $EDITOR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions