@@ -108,38 +108,26 @@ local move_tbl = {
108
108
top = " K" ,
109
109
}
110
110
111
- -- TODO: remove this once they fix https://github.com/neovim/neovim/issues/14670
112
- local function set_local (opt , value )
113
- local cmd
114
- if value == true then
115
- cmd = string.format (" setlocal %s" , opt )
116
- elseif value == false then
117
- cmd = string.format (" setlocal no%s" , opt )
118
- else
119
- cmd = string.format (" setlocal %s=%s" , opt , value )
120
- end
121
- vim .cmd (cmd )
122
- end
123
-
124
111
-- setup_tabpage sets up the initial state of a tab
125
112
local function setup_tabpage (tabpage )
126
113
local winnr = a .nvim_get_current_win ()
127
114
M .View .tabpages [tabpage ] = vim .tbl_extend (" force" , M .View .tabpages [tabpage ] or tabinitial , { winnr = winnr })
128
115
end
129
116
130
- local function open_window ()
131
- a .nvim_command " vsp"
132
- M .reposition_window ()
133
- setup_tabpage (a .nvim_get_current_tabpage ())
134
- end
135
-
136
117
local function set_window_options_and_buffer ()
137
118
pcall (vim .cmd , " buffer " .. M .get_bufnr ())
138
119
for k , v in pairs (M .View .winopts ) do
139
- set_local ( k , v )
120
+ vim . opt_local [ k ] = v
140
121
end
141
122
end
142
123
124
+ local function open_window ()
125
+ a .nvim_command " vsp"
126
+ M .reposition_window ()
127
+ setup_tabpage (a .nvim_get_current_tabpage ())
128
+ set_window_options_and_buffer ()
129
+ end
130
+
143
131
local function get_existing_buffers ()
144
132
return vim .tbl_filter (function (buf )
145
133
return a .nvim_buf_is_valid (buf ) and vim .fn .buflisted (buf ) == 1
@@ -190,7 +178,6 @@ function M.open(options)
190
178
191
179
create_buffer ()
192
180
open_window ()
193
- set_window_options_and_buffer ()
194
181
M .resize ()
195
182
196
183
local opts = options or { focus_tree = true }
0 commit comments