File tree 2 files changed +16
-0
lines changed
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -161,8 +161,21 @@ impl Command for EditCommand {
161
161
args. extend_from_slice ( & editor_args) ;
162
162
}
163
163
164
+ let editor_env = & conf. code . editor_env ;
165
+ let mut env: Vec < & str > = vec ! [ "" , "" ] ;
166
+ if !editor_env. is_empty ( ) {
167
+ env = editor_env. splitn ( 2 , '=' ) . collect ( ) ;
168
+ if env. len ( ) != 2 {
169
+ return Err ( crate :: Error :: FeatureError (
170
+ "Invalid environment variable, please check your configuration for errors"
171
+ . into ( ) ,
172
+ ) ) ;
173
+ }
174
+ }
175
+
164
176
args. push ( path) ;
165
177
std:: process:: Command :: new ( conf. code . editor )
178
+ . env ( env[ 0 ] , env[ 1 ] )
166
179
. args ( args)
167
180
. status ( ) ?;
168
181
Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ pub struct Code {
17
17
#[ serde( rename( serialize = "editor-args" ) , alias = "editor-args" , default ) ]
18
18
pub editor_args : Option < Vec < String > > ,
19
19
#[ serde( default , skip_serializing) ]
20
+ pub editor_env : String ,
21
+ #[ serde( default , skip_serializing) ]
20
22
pub edit_code_marker : bool ,
21
23
#[ serde( default , skip_serializing) ]
22
24
pub start_marker : String ,
@@ -44,6 +46,7 @@ impl Default for Code {
44
46
Self {
45
47
editor : "vim" . into ( ) ,
46
48
editor_args : None ,
49
+ editor_env : "" . into ( ) ,
47
50
edit_code_marker : false ,
48
51
start_marker : "" . into ( ) ,
49
52
end_marker : "" . into ( ) ,
You can’t perform that action at this time.
0 commit comments