File tree Expand file tree Collapse file tree 5 files changed +15
-1
lines changed Expand file tree Collapse file tree 5 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,7 @@ use {
200200 [" <cr>" ] = " open" ,
201201 [" <esc>" ] = " revert_preview" ,
202202 [" P" ] = { " toggle_preview" , config = { use_float = true } },
203+ [" l" ] = " focus_preview"
203204 [" S" ] = " open_split" ,
204205 [" s" ] = " open_vsplit" ,
205206 -- ["S"] = "split_with_window_picker",
Original file line number Diff line number Diff line change @@ -195,6 +195,8 @@ z = close_all_nodes: Close all nodes in the tree.
195195
196196P = toggle_preview: Toggles "preview mode", see | neo-tree-preview-mode |
197197
198+ l = focus_preview: Focus the active preview window
199+
198200<esc> = revert_preview: Ends "preview_mode" if it is enabled, and reverts
199201 any preview windows to what was being shown before
200202 preview mode began.
Original file line number Diff line number Diff line change @@ -312,6 +312,7 @@ local config = {
312312 [" <cr>" ] = " open" ,
313313 [" <esc>" ] = " revert_preview" ,
314314 [" P" ] = { " toggle_preview" , config = { use_float = true } },
315+ [" l" ] = " focus_preview" ,
315316 [" S" ] = " open_split" ,
316317 -- ["S"] = "split_with_window_picker",
317318 [" s" ] = " open_vsplit" ,
Original file line number Diff line number Diff line change @@ -487,6 +487,10 @@ M.toggle_preview = function(state)
487487 Preview .toggle (state )
488488end
489489
490+ M .focus_preview = function ()
491+ Preview .focus ()
492+ end
493+
490494--- Open file or directory
491495--- @param state table The state of the source
492496--- @param open_cmd string The vim command to use to open the file
Original file line number Diff line number Diff line change @@ -393,7 +393,7 @@ Preview.toggle = function(state)
393393 local preview_event = {
394394 event = events .VIM_CURSOR_MOVED ,
395395 handler = function ()
396- if not toggle_state then
396+ if not toggle_state or vim . api . nvim_get_current_win () == instance . winid then
397397 return
398398 end
399399 if vim .api .nvim_get_current_win () == winid then
@@ -410,4 +410,10 @@ Preview.toggle = function(state)
410410 end
411411end
412412
413+ Preview .focus = function ()
414+ if Preview .is_active () then
415+ vim .fn .win_gotoid (instance .winid )
416+ end
417+ end
418+
413419return Preview
You can’t perform that action at this time.
0 commit comments