@@ -38,12 +38,7 @@ local function usable_win_ids()
3838 return vim .tbl_filter (function (id )
3939 local bufid = vim .api .nvim_win_get_buf (id )
4040 for option , v in pairs (config .g .actions .open_file .window_picker .exclude ) do
41- local ok , option_value
42- if vim .fn .has (" nvim-0.10" ) == 1 then
43- ok , option_value = pcall (vim .api .nvim_get_option_value , option , { buf = bufid })
44- else
45- ok , option_value = pcall (vim .api .nvim_buf_get_option , bufid , option ) --- @diagnostic disable-line : deprecated
46- end
41+ local ok , option_value = pcall (vim .api .nvim_get_option_value , option , { buf = bufid })
4742
4843 if ok and vim .tbl_contains (v , option_value ) then
4944 return false
@@ -105,53 +100,32 @@ local function pick_win_id()
105100
106101 if laststatus == 3 then
107102 for _ , win_id in ipairs (not_selectable ) do
108- local ok_status , statusline
109-
110- if vim .fn .has (" nvim-0.10" ) == 1 then
111- ok_status , statusline = pcall (vim .api .nvim_get_option_value , " statusline" , { win = win_id })
112- else
113- ok_status , statusline = pcall (vim .api .nvim_win_get_option , win_id , " statusline" ) --- @diagnostic disable-line : deprecated
114- end
103+ local ok_status , statusline = pcall (vim .api .nvim_get_option_value , " statusline" , { win = win_id })
115104
116105 win_opts_unselectable [win_id ] = {
117106 statusline = ok_status and statusline or " " ,
118107 }
119108
120109 -- Clear statusline for windows not selectable
121- if vim .fn .has (" nvim-0.10" ) == 1 then
122- vim .api .nvim_set_option_value (" statusline" , " " , { win = win_id })
123- else
124- vim .api .nvim_win_set_option (win_id , " statusline" , " " ) --- @diagnostic disable-line : deprecated
125- end
110+ vim .api .nvim_set_option_value (" statusline" , " " , { win = win_id })
126111 end
127112 end
128113
129114 -- Setup UI
130115 for _ , id in ipairs (selectable ) do
131116 local char = config .g .actions .open_file .window_picker .chars :sub (i , i )
132117
133- local ok_status , statusline , ok_hl , winhl
134- if vim .fn .has (" nvim-0.10" ) == 1 then
135- ok_status , statusline = pcall (vim .api .nvim_get_option_value , " statusline" , { win = id })
136- ok_hl , winhl = pcall (vim .api .nvim_get_option_value , " winhl" , { win = id })
137- else
138- ok_status , statusline = pcall (vim .api .nvim_win_get_option , id , " statusline" ) --- @diagnostic disable-line : deprecated
139- ok_hl , winhl = pcall (vim .api .nvim_win_get_option , id , " winhl" ) --- @diagnostic disable-line : deprecated
140- end
118+ local ok_status , statusline = pcall (vim .api .nvim_get_option_value , " statusline" , { win = id })
119+ local ok_hl , winhl = pcall (vim .api .nvim_get_option_value , " winhl" , { win = id })
141120
142121 win_opts_selectable [id ] = {
143122 statusline = ok_status and statusline or " " ,
144123 winhl = ok_hl and winhl or " " ,
145124 }
146125 win_map [char ] = id
147126
148- if vim .fn .has (" nvim-0.10" ) == 1 then
149- vim .api .nvim_set_option_value (" statusline" , " %=" .. char .. " %=" , { win = id })
150- vim .api .nvim_set_option_value (" winhl" , " StatusLine:NvimTreeWindowPicker,StatusLineNC:NvimTreeWindowPicker" , { win = id })
151- else
152- vim .api .nvim_win_set_option (id , " statusline" , " %=" .. char .. " %=" ) --- @diagnostic disable-line : deprecated
153- vim .api .nvim_win_set_option (id , " winhl" , " StatusLine:NvimTreeWindowPicker,StatusLineNC:NvimTreeWindowPicker" ) --- @diagnostic disable-line : deprecated
154- end
127+ vim .api .nvim_set_option_value (" statusline" , " %=" .. char .. " %=" , { win = id })
128+ vim .api .nvim_set_option_value (" winhl" , " StatusLine:NvimTreeWindowPicker,StatusLineNC:NvimTreeWindowPicker" , { win = id })
155129
156130 i = i + 1
157131 if i > # config .g .actions .open_file .window_picker .chars then
@@ -170,11 +144,7 @@ local function pick_win_id()
170144 -- Restore window options
171145 for _ , id in ipairs (selectable ) do
172146 for opt , value in pairs (win_opts_selectable [id ]) do
173- if vim .fn .has (" nvim-0.10" ) == 1 then
174- vim .api .nvim_set_option_value (opt , value , { win = id })
175- else
176- vim .api .nvim_win_set_option (id , opt , value ) --- @diagnostic disable-line : deprecated
177- end
147+ vim .api .nvim_set_option_value (opt , value , { win = id })
178148 end
179149 end
180150
@@ -183,11 +153,7 @@ local function pick_win_id()
183153 -- Ensure window still exists at this point
184154 if vim .api .nvim_win_is_valid (id ) then
185155 for opt , value in pairs (win_opts_unselectable [id ]) do
186- if vim .fn .has (" nvim-0.10" ) == 1 then
187- vim .api .nvim_set_option_value (opt , value , { win = id })
188- else
189- vim .api .nvim_win_set_option (id , opt , value ) --- @diagnostic disable-line : deprecated
190- end
156+ vim .api .nvim_set_option_value (opt , value , { win = id })
191157 end
192158 end
193159 end
@@ -341,12 +307,7 @@ local function open_in_new_window(filename, mode)
341307 -- modified, and create new split if it is.
342308 local target_bufid = vim .api .nvim_win_get_buf (target_winid )
343309
344- local modified
345- if vim .fn .has (" nvim-0.10" ) == 1 then
346- modified = vim .api .nvim_get_option_value (" modified" , { buf = target_bufid })
347- else
348- modified = vim .api .nvim_buf_get_option (target_bufid , " modified" ) --- @diagnostic disable-line : deprecated
349- end
310+ local modified = vim .api .nvim_get_option_value (" modified" , { buf = target_bufid })
350311
351312 if modified then
352313 if not mode :match (" split$" ) then
0 commit comments