feat: Optionally not auto-update cursors position

This also fixes a typo from an old commit (did not catch the bug because
all this time I was testing with the same window!), and put
auto_update_events into outline_items since it makes more sense, and is
closer to highlight_hovered_item and (the new) auto_follow_cursor.

Added code_buf to state since it appears to be used quite often now.
This commit is contained in:
hedy
2023-11-18 11:14:18 +08:00
parent 82ab53a167
commit d65696a9cf
2 changed files with 42 additions and 29 deletions

View File

@@ -18,7 +18,16 @@ M.defaults = {
outline_items = {
show_symbol_details = true,
show_symbol_lineno = false,
-- The two below are both for auto_update_events.follow
highlight_hovered_item = true,
-- On open, always followed. This is for auto_update_events.follow, whether
-- to auto update cursor position to reflect code location. If false, can
-- manually trigger with follow_cursor (API, command, keymap action).
auto_follow_cursor = true,
auto_update_events = {
follow = { 'CursorMoved' },
items = { 'InsertLeave', 'WinEnter', 'BufEnter', 'BufWinEnter', 'TabEnter', 'BufWritePost' },
},
},
outline_window = {
position = 'right',
@@ -37,10 +46,6 @@ M.defaults = {
winhl = 'OutlineDetails:Comment,OutlineLineno:LineNr',
jump_highlight_duration = 400,
center_on_jump = true,
auto_update_events = {
cursor = { 'CursorMoved' },
items = { 'InsertLeave', 'WinEnter', 'BufEnter', 'BufWinEnter', 'TabEnter', 'BufWritePost' },
},
},
preview_window = {
auto_preview = false,