Commit Graph

159 Commits

Author SHA1 Message Date
hedy
cf194e43bc docs: Clarify readme 2023-11-29 21:32:59 +08:00
hedy
920e12736c feat: Autofold non-hovered symbol by default 2023-11-29 18:18:18 +08:00
~hedy
4fbd94f9e6 Update README.md
Who said it's yaml
2023-11-29 07:22:42 +08:00
hedy
6a020c15d5 docs: Update readme 2023-11-28 21:41:07 +08:00
hedy
75ade708ef docs: Discuss related plugins in the readme 2023-11-28 21:37:13 +08:00
hedy
884486f3d0 feat: Live previews (peek editor)
Disabled by default, but if this feature turns out to be useful and
stable, it will replace the old preview window.
2023-11-28 20:50:08 +08:00
hedy
5764294eb7 docs: List asciidoc external provider 2023-11-26 15:29:37 +08:00
hedy
6d85399550 feat: Use more concise API names
No breaking change.
2023-11-25 15:43:36 +08:00
hedy
6cea72f2b5 feat(api): Get symbol and breadcrumb at location
Currently the implementation is very limited.

Ref: #24

- Outline must be open and have been loaded for it to work (requires
  lazy loading or headless loading of Sidebar)
- Empty string returned if cursor is not in any symbol ('closest' symbol
  not yet supported)
- Line column not used
- Returning concatenated symbol names rather than a list of tables with
  node info (requires a refactor of outline.SymbolNode type)
- Subject to config.symbols.filter and folds (requires finding hover
  list somewhere outside of writer.make_outline)
2023-11-25 15:41:55 +08:00
hedy
f586147ee2 docs: Fix readme -> vimdoc ignore sections 2023-11-24 17:26:09 +08:00
hedy
e5ee7dd15a docs: Fix capitalization 2023-11-24 17:17:45 +08:00
hedy
1c856660a4 docs: Update readme and changelog 2023-11-24 17:13:25 +08:00
hedy
fab3e8ce7c feat(status): Use custom highlight with default links 2023-11-24 16:47:36 +08:00
hedy
2d936bce2d docs: Update readme 2023-11-24 14:52:43 +08:00
hedy
9c54fe1bcf docs: Fix indented list in readme 2023-11-22 22:32:34 +08:00
hedy
d35187ef37 feat: Norg provider and support of external providers
- Closes #3
- Ref: simrat39/symbols-outline.nvim#190

Norg contains indents and different types of verbatim tags, I was rather
lazy to read the spec properly and parse norg using regex line-by-line
like markdown, so used treesitter instead. The only requirement is the
`norg` parser for treesitter to be installed. Tested on nvim 0.7.2.

This should lead the way for supporting vimdoc files in a similar
manner.

Documentation for how external providers could look like as of now has
been added.

In the future we could let the provider determine what to do for each
keymap, such as `goto_location` and `toggle_preview`. This would allow
the zk extension[1] to work properly without having to override existing
functions (bad practice).

[1]: https://github.com/mickael-menu/zk-nvim/discussions/134
2023-11-22 22:16:19 +08:00
hedy
a335618d5a docs: Clarify about neovim 0.7 in readme 2023-11-21 09:30:49 +08:00
hedy
a8343026bf docs: Update readme 2023-11-21 08:42:41 +08:00
hedy
699bc85cc5 feat: Properly support nvim-0.7, and fix highlights 2023-11-21 08:39:05 +08:00
hedy
a239dbfc14 docs: Update readme 2023-11-19 22:40:44 +08:00
hedy
ad6b15ee08 refactor: Rename of most recent option 2023-11-19 22:35:07 +08:00
hedy
24b4634cee docs: Document new features
Now we should close #28
2023-11-19 21:05:25 +08:00
hedy
9b90379c7a Refactor 2023-11-19 17:45:41 +08:00
hedy
4834db0802 docs: Only show 2nd level headings in TOC 2023-11-19 08:41:42 +08:00
hedy
036bae6834 docs: More consistency in referring to config options 2023-11-18 22:31:33 +08:00
hedy
f8c212bcd2 docs: Document new options, commands, API functions 2023-11-18 22:24:34 +08:00
hedy
f83eb09635 docs: Update readme 2023-11-18 21:19:47 +08:00
hedy
58e92199f3 fix conflicts 2023-11-18 12:16:43 +08:00
hedy
3b4116c2c6 refactor: Use default key for default filtering
Inspired by lazyvim
2023-11-18 10:01:07 +08:00
One234Fi
e2c8f92ffb Update README.md
Add missing comma after `goto_and_close = "<S-Cr>"` in the default config's keymaps
2023-11-17 16:24:21 -06:00
hedy
a1aa652fb2 feat: Center view on jump/goto 2023-11-17 12:34:14 +08:00
hedy
62dea5bff9 docs: Consistent quoting 2023-11-17 09:30:55 +08:00
hedy
134b7e2f39 feat: Jump highlight customizations
Closes #27

- Highlight group 'OutlineJumpHighlight' (links to Visual by default)
- Config: outline_window.jump_highlight_duration (integer for
  milliseconds, or boolean to enable/disable)
2023-11-16 22:14:47 +08:00
hedy
fdc7c6391f docs: Add new config options 2023-11-16 21:51:08 +08:00
hedy
fa44423c16 docs: Better formatting for commands 2023-11-16 14:06:00 +08:00
hedy
2238002462 docs: Add script to convert symbols-outline setup opts 2023-11-16 09:22:51 +08:00
hedy
43f7f7d158 docs: Collapse default opts to not take up screen space 2023-11-15 22:36:12 +08:00
hedy
7c703361e9 feat: Support command modifiers on open commands 2023-11-15 22:32:33 +08:00
hedy
d78d0a0b50 docs: Fix typo on issue reference 2023-11-15 11:23:06 +08:00
hedy
f356c29578 feat: Allow disabling icons 2023-11-15 11:21:20 +08:00
hedy
3f0025af3d docs: Use one screenshot only for hide_cursor 2023-11-13 18:27:13 +08:00
hedy
aba398af54 docs: Fix typo
OMG
2023-11-13 18:26:34 +08:00
hedy
bb006be6f6 docs: Fix image placement 2023-11-13 18:25:56 +08:00
hedy
40a41b7d18 docs: Add another screenshot 2023-11-13 18:24:22 +08:00
hedy
1446bdd135 fix: Lineno alignment, hl_mode, config options
- Config
  - Renamed auto_goto -> auto_jump (because goto implies change of
    cursor focus)
  - Renamed down/up_and_goto -> down/up_and_jump

Existing config that use the old keys *WILL STILL WORK*. But users are
recommended to update to avoid inconsistency. I promise the number of
config changes like this will decrease inverse-exponentially after the
plugin refactor :)

- Docs
  - Improved wording

- Lineno
  - Fixed alignment (no way I was taking max line num of the *Outline*
    buf this whole time!)
  - Fixed appearance of lineno column hl blending if hide_cursor is one
    (please see the comment added)
2023-11-13 18:07:52 +08:00
hedy
c6438a21e1 docs: Update readme on new highlight groups 2023-11-13 14:46:01 +08:00
hedy
66aecc7636 MAJOR: Complete rewrite of outline parsing into buffer lines
Scope:
- Parsing of symbol tree
- Producing the flattened tree
- Producing the lines shown in the outline based on the symbol tree
- API of exported functions for parser.lua and writer.lua

Note that the formatting of the outline remains the same as before.

Fixes:
- Guide highlights sometimes cover fold marker areas (may be related to
  the issue brought up by @silvercircle on reddit)
- Guide highlights do not work when using guide markers of different
  widths than the default (such as setting all markers to ascii chars)

All of these issues are now fixed after integrating the a parser
algorithm.

This commit introduces:
1. A better algorithm for flattening & parsing the tree in one go
2. `OutlineFoldMarker` highlight group
3. Fixed inconsistent highlighting of guides and legacy (somewhat weaker
   code), through (1).
4. Minor performance improvements
5. Type hints for the symbol tree
6. Removed several functions from writer.lua and parser.lua due to them
   being merged into writer.make_outline

This can be seen as a breaking change because functions that were
exported had altered behaviours. However I doubt these functions
actually have any critical use outside of this plugin, hence it isn't
really a breaking change as the user-experience remains the same.

The extraneous left padding on the outline window is now a relic of the
past 🎉

The old implementation, parser.get_lines used a flattened tree and was
inefficient, full of off-by-one corrections.

While trying to look for bug fixes in that function I realized it's the
sort of "if it works, don't touch it" portion of code.

Hence, I figured a complete rewrite is necessary.

Now, the function responsible for making the outline lines lives at
writer.make_outline. Building the flattened tree, getting lines, details
and linenos are now done in one go.

This is a tradeoff between modular design and efficiency.

parser.lua still serve important purposes:
- local parse_result function converts the hierarchical tables from
  provider into a nested form tree, used everywhere in outline.nvim. The
  type hint of the return value is now defined -- outline.SymbolNode
- preorder_iter is an iterator that traverses the aforementioned tree in
  pre-order style. First the parents, all the childrens, and so on until
  the last node of the root tree. This is used in writer.make_outline to
  abstract a way the traversal code from the code of making the lines.

Thanks to stack overflow I did not have to consult a DS book to figure
out the cleanest way of this traversal method without using recursion.

This, of course, closes #14 on github.

Note that another minor 'breaking' change is that previously, hl for the
guides where grouped per-character, now they are grouped together for
all the guide markers in the same line. This should not be a problem for
those who only style the fg color for guide hl. However, if you're
styling the bg color, they will now take on that bg collectively rather
than individually.

This change eliminates future maintenance burden because controlling
per-character guide highlights requires careful avoidance of off-by-one
errors.

I have tested most common features to work as before.
I may have missed particular edge cases.

Please take note of "scope" at the top of this commit message.
2023-11-13 14:19:43 +08:00
hedy
bc2b0ff9ac fix: Don't open hover on preview by default
Also updated docs
2023-11-12 14:01:06 +08:00
hedy
e5d95ff69a docs: Update readme and rename highlight 2023-11-12 13:30:35 +08:00
hedy
82d47f4b40 docs: Minor readme update 2023-11-12 13:18:25 +08:00