1
1
--- @type CodeRunnerOptions
2
- local options = {
2
+ local default_options = {
3
3
mode = " term" , -- default display mode
4
4
hot_reload = true , -- hot reload enabled/disabled
5
5
focus = false , -- Focus window/viewport on the buffer (only works term and tab display mode)
6
6
startinsert = false , -- startinsert (see ':h inserting-ex')
7
7
insert_prefix = " " , -- this key is controlled by startinsert
8
- term = {
9
- position = " vert" , -- Position to open the terminal, this option is ignored if mode ~= term
10
- size = 64 , -- window size, this option is ignored if mode == tab
8
+ term = { -- this configs are ignored if mode ~= "term"
9
+ position = " vert" , -- Position to open the terminal,
10
+ size = 64 , -- window size, if position 'bot'(bottom) 8 is a good default
11
11
},
12
12
float = {
13
13
close_key = " <ESC>" ,
14
14
border = " solid" , -- Window border (see ':h nvim_open_win()' ; /border)
15
15
16
- height = 0.8 , -- number from `0 - 1` for measurements
17
- width = 0.8 , -- number from `0 - 1` for measurements
16
+ height = 0.8 ,
17
+ width = 0.8 ,
18
18
x = 0.5 ,
19
19
y = 0.5 ,
20
20
@@ -23,9 +23,9 @@ local options = {
23
23
24
24
blend = 0 , -- Transparency (see ':h winblend')
25
25
},
26
- better_term = { -- Toggle mode replacement
26
+ better_term = { -- Toggle mode replacement
27
27
clean = false , -- Clean terminal before launch
28
- number = 10 , -- Use nil for dynamic number and set init
28
+ number = 10 , -- Use nil for dynamic number and set init
29
29
init = nil ,
30
30
},
31
31
filetype_path = " " ,
@@ -75,18 +75,18 @@ local function concat(v)
75
75
end
76
76
77
77
-- set user config
78
- --- @param user_options table
78
+ --- @param user_options CodeRunnerUserOptions
79
79
M .set = function (user_options )
80
80
if user_options .startinsert then
81
81
user_options .insert_prefix = " startinsert"
82
82
end
83
- options = vim .tbl_deep_extend (" force" , options , user_options )
84
- options .filetype = vim .tbl_map (concat , options .filetype )
85
- options .prefix = string.format (" %s %d new" , options .term .position , options .term .size )
83
+ default_options = vim .tbl_deep_extend (" force" , default_options , user_options )
84
+ default_options .filetype = vim .tbl_map (concat , default_options .filetype )
85
+ default_options .prefix = string.format (" %s %d new" , default_options .term .position , default_options .term .size )
86
86
end
87
87
88
88
M .get = function ()
89
- return options
89
+ return default_options
90
90
end
91
91
92
92
return M
0 commit comments