File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -112,13 +112,11 @@ function M.reset_highlight()
112
112
renderer .render_hl (view .get_bufnr ())
113
113
end
114
114
115
- local prev_line
116
115
function M .place_cursor_on_node ()
117
- local l = vim .api . nvim_win_get_cursor ( 0 )[ 1 ]
118
- if l == prev_line then
116
+ local search = vim .fn . searchcount ()
117
+ if search and search . exact_match == 1 then
119
118
return
120
119
end
121
- prev_line = l
122
120
123
121
local node = lib .get_node_at_cursor ()
124
122
if not node or node .name == " .." then
@@ -233,7 +231,7 @@ local function setup_autocommands(opts)
233
231
create_nvim_tree_autocmd (" TabEnter" , { callback = vim .schedule_wrap (M .tab_enter ) })
234
232
end
235
233
if opts .hijack_cursor then
236
- create_nvim_tree_autocmd (" CursorMoved" , {
234
+ create_nvim_tree_autocmd ({ " CursorMoved" , " BufEnter " } , {
237
235
pattern = " NvimTree_*" ,
238
236
callback = function ()
239
237
if utils .is_nvim_tree_buf (0 ) then
You can’t perform that action at this time.
0 commit comments