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()
112112 renderer .render_hl (view .get_bufnr ())
113113end
114114
115- local prev_line
116115function 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
119118 return
120119 end
121- prev_line = l
122120
123121 local node = lib .get_node_at_cursor ()
124122 if not node or node .name == " .." then
@@ -233,7 +231,7 @@ local function setup_autocommands(opts)
233231 create_nvim_tree_autocmd (" TabEnter" , { callback = vim .schedule_wrap (M .tab_enter ) })
234232 end
235233 if opts .hijack_cursor then
236- create_nvim_tree_autocmd (" CursorMoved" , {
234+ create_nvim_tree_autocmd ({ " CursorMoved" , " BufEnter " } , {
237235 pattern = " NvimTree_*" ,
238236 callback = function ()
239237 if utils .is_nvim_tree_buf (0 ) then
You can’t perform that action at this time.
0 commit comments