Closes #37 Almost completely refactored the UI parts outline.nvim to use a Sidebar object that implements an outline window. In init.lua, we can then store a table of the outline for each tabpage ID. When tabs are closed the outline is closed and sidebar reset responsibly. This simplifies `init.lua` quite a lot, making it the highest level control center for the outline elements. All lua APIs and commands should work as before.
6.7 KiB
6.7 KiB
Changelog
Main branch
Breaking changes
- Highlight for guides (previously
OutlineConnectorthat covers both guides and fold markers) now split intoOutlineGuides(covering from left edge until start of symbol icon) andOutlineFoldMarker. - Config options
auto_goto -> auto_jump,keymaps.down/up_and_goto -> keymaps.down/up_and_jump. The old names still work as expected but may be removed in feature releases (after v1.0.0).
Features
- Config option for split command used in creating outline (
outline_window.split_command) - Added highlight group for fold marker
- A custom icon fetcher function can be used, which receives a kind as string and should return an icon as string. An empty string means no icon for this kind
- Lspkind is now supported as an icon source
- Outline open/toggle commands now support command modifiers to override the
config options
positionandsplit_command. Eg::leftabove Outline/:belowright OutlineOpen! - Highlight group and duration of the 'flash' highlight on goto/jump operations can now be customized (#27)
- A better config system for symbol filtering: deprecating
symbols.blacklistconfig. Note that the old option still works as expected but may be deprecated in feature releases. This newsymbols.filteroption supports both inclusive filtering and also exclusive filtering, per-filetype filtering is also supported. (#23) - Optionally put cursor vertically centered on the screen after a goto/jump
operation. Configurable via
outline_window.center_on_jump - By default, automatic following of cursor (and highlight hover) when outline
is not in focus will now trigger on each
CursorMovedevent, rather thanCursorHold. This is also configurable now usingoutline_items.auto_update_eventswith keyfollow. The keyitemscontrols the events that should trigger a re-request of symbols from the provider. - On fold all or unfold all operations, the cursor will now stay on the same node, rather than the same line in the outline.
- Optionally not automatically update cursor position in outline to reflect
cursor location in code. The auto-update is triggered by events from
outline_items.auto_update_events.followwhich controls both highlighting of hovered node and also setting of cursor in outline. To disable the latter, useoutline_items.auto_set_cursor. Disabling the former can still be done usingoutline_items.highlight_hovered_item. Regardless, manual follow-cursor can still be done using:FollowCursor[!]or lua APIfollow_cursor({ focus_outline = true/false }). - Config option for cursorline now supports 2 other string values,
focus_in_outlineandfocus_in_code. These make the cursorline only show up depending on cursor focus. The first option,focus_in_outlinemakes it so cursorline is enabled only when focus is in outline. This lessens the visual changes due toauto_set_cursor, when focus is in code. - Floating windows are now used for
show_helpkeymap and:OutlineStatuscommand. :OutlineStatuscommand is now more informative.- New command
:OutlineRefreshand corresponding lua API functionrefresh_outline()triggers re-requesting of symbols from provider and updating the outline. - New lua API function
is_focus_in_outline() - Auto-unfold root nodes when there is only N nodes. Where N defaults to 1
(meaning when there is only 1 root node, keep it unfolded). The added config
option is
symbol_folding.auto_unfoldwith keyshoveredandonly. Keyhoveredis the successor of the legacysymbol_folding.auto_unfold_hoveroption. The old option would still work as expected. - Updated the default symbols icon highlights to not use highlight groups that
start with
@. Everything should still work as expected, most highlights should still be the same. This is to supportnvim-0.7. The symbols icon highlights is still configurable as before. - Highlights used by outline.nvim are now set to default using links if they
aren't already defined. Default winhl for outline window is now an empty
string, and for preview window,
NormalFloat:to ensure the preview window looks similar to a normal window (since it displays a preview of the actual code) - Highlights will also take into account
ctermfg/bgwhen setting default values. This ensures outline.nvim highlights work iftermguicolorsis not enabled - A built-in provider for
norgfiles that displays headings in the outline is now provided. This requiresnorgparser to be installed for treesitter - Outline.nvim now supports per-tabpage outlines
Fixes
- Don't auto-update cursor when focus is in outline (#7)
- Symbol hover is not opened on preview open by default now
- Incorrect guide highlights
- Follow cursor can now put the cursor on the parent node if the child is folded and invisible in outline
- Follow cursor puts the cursor in the first column, and if there is lineno, puts it at the end of the lineno
- Markdown headings produced from the built-in markdown provider will now
use the
Stringkind, like marksman - Preview window can now properly vertically center-align and determine its
correct height depending on relative position of the outline window. Previously
this did not work if there were horizontal splits below the outline window.
This also adds a
preview_window.min_heightconfig option. The preview height is half of the outline height, unless smaller thanmin_height. - No more obnoxious '}' on the cmdline when using
show_helpkeymap. A floating window is used now. (#19) - Fixed display of JSX Fragments due to recent update from
javascriptTS parser
Performance
- Building of outline items (and details/lineno) parsed from symbol tree functions completely refactored, which reduced redundant code that could have O(N) time complexity, a significant difference for codebase with a lot of symbols.
- Follow cursor algorithm significantly improved
- Highlight hovered item and initial opening of outline has been rewritten and performance improved
Others
- A script is added to convert symbols-outline.nvim config to outline.nvim config. Note that all config values are evaluated, so if the old config uses some external source and assigned it to a config key, the value from the external source would be used directly rather than the identifier.
Older changes
Changes before fork detach can be found on #12 on github