@@ -85,45 +85,6 @@ function M.setup(opts)
85
85
M .View .winopts .signcolumn = options .signcolumn
86
86
end
87
87
88
- local move_cmd = {
89
- right = ' h' ,
90
- left = ' l' ,
91
- top = ' j' ,
92
- bottom = ' k' ,
93
- }
94
-
95
- function M ._prevent_buffer_override ()
96
- vim .schedule (function ()
97
- local curwin = a .nvim_get_current_win ()
98
- local curbuf = a .nvim_win_get_buf (curwin )
99
-
100
- if curwin ~= M .get_winnr () or curbuf == M .View .bufnr then
101
- return
102
- end
103
-
104
- if a .nvim_buf_is_loaded (M .View .bufnr ) and a .nvim_buf_is_valid (M .View .bufnr ) then
105
- -- pcall necessary to avoid erroring with `mark not set` although no mark are set
106
- -- this avoid other issues
107
- pcall (vim .api .nvim_win_set_buf , M .get_winnr (), M .View .bufnr )
108
- end
109
-
110
- local bufname = a .nvim_buf_get_name (curbuf )
111
- local isdir = vim .fn .isdirectory (bufname ) == 1
112
- if isdir or not bufname or bufname == " " then
113
- return
114
- end
115
-
116
- if # vim .api .nvim_list_wins () < 2 then
117
- local cmd = M .is_vertical () and " vsplit" or " split"
118
- vim .cmd (cmd )
119
- else
120
- vim .cmd (" wincmd " .. move_cmd [M .View .side ])
121
- end
122
- vim .cmd (" buffer " .. curbuf )
123
- M .resize ()
124
- end )
125
- end
126
-
127
88
function M .win_open (opts )
128
89
if opts and opts .any_tabpage then
129
90
for _ , v in pairs (M .View .tabpages ) do
@@ -221,14 +182,14 @@ local function open_window()
221
182
M .View .tabpages [tabpage ] = vim .tbl_extend (" force" , M .View .tabpages [tabpage ] or {help = false }, {winnr = winnr })
222
183
end
223
184
224
- local function is_buf_valid (bufnr )
185
+ function M . is_buf_valid (bufnr )
225
186
return bufnr and a .nvim_buf_is_valid (bufnr ) and a .nvim_buf_is_loaded (bufnr )
226
187
end
227
188
228
189
function M .open (options )
229
190
M .View .last_focused_winnr = a .nvim_get_current_win ()
230
191
local should_redraw = false
231
- if not is_buf_valid (M .View .bufnr ) then
192
+ if not M . is_buf_valid (M .View .bufnr ) then
232
193
should_redraw = true
233
194
M .create_buffer ()
234
195
end
0 commit comments