File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -66,11 +66,13 @@ impl ExternalEditorComponent {
6666 io:: stdout( ) . execute( EnterAlternateScreen ) . expect( "reset terminal" ) ;
6767 }
6868
69- let editor = env:: var ( "GIT_EDITOR" )
69+ let environment_options = [ "GIT_EDITOR" , "VISUAL" , "EDITOR" ] ;
70+
71+ let editor = env:: var ( environment_options[ 0 ] )
7072 . ok ( )
7173 . or_else ( || get_config_string ( CWD , "core.editor" ) . ok ( ) ?)
72- . or_else ( || env:: var ( "VISUAL" ) . ok ( ) )
73- . or_else ( || env:: var ( "EDITOR" ) . ok ( ) )
74+ . or_else ( || env:: var ( environment_options [ 1 ] ) . ok ( ) )
75+ . or_else ( || env:: var ( environment_options [ 2 ] ) . ok ( ) )
7476 . unwrap_or_else ( || String :: from ( "vi" ) ) ;
7577
7678 // TODO: proper handling arguments containing whitespaces
@@ -82,7 +84,10 @@ impl ExternalEditorComponent {
8284 let mut echars = editor. chars ( ) . peekable ( ) ;
8385
8486 let first_char = * echars. peek ( ) . ok_or_else ( || {
85- anyhow ! ( "editor configuration set to empty string" )
87+ anyhow ! (
88+ "editor env variable found empty: {}" ,
89+ environment_options. join( " or " )
90+ )
8691 } ) ?;
8792 let command: String = if first_char == '\"' {
8893 echars
You can’t perform that action at this time.
0 commit comments