feat: highlights
This commit is contained in:
parent
d5fb6d36ef
commit
00bf84cb05
5 changed files with 437 additions and 41 deletions
|
|
@ -56,11 +56,6 @@ CONFIGURATION *fugitive-ts-config*
|
|||
Example: >lua
|
||||
disabled_languages = { 'markdown', 'text' }
|
||||
<
|
||||
{highlight_headers} (boolean, default: true)
|
||||
Highlight function context in hunk headers.
|
||||
The context portion of `@@ -10,3 +10,4 @@ func()`
|
||||
will receive treesitter highlighting.
|
||||
|
||||
{debounce_ms} (integer, default: 50)
|
||||
Debounce delay in milliseconds for re-highlighting
|
||||
after buffer changes. Lower values feel snappier
|
||||
|
|
@ -70,6 +65,37 @@ CONFIGURATION *fugitive-ts-config*
|
|||
Skip treesitter highlighting for hunks larger than
|
||||
this many lines. Prevents lag on massive diffs.
|
||||
|
||||
{conceal_prefixes} (boolean, default: true)
|
||||
Hide diff prefixes (`+`/`-`/` `) using extmark
|
||||
conceal. Makes code appear without the leading
|
||||
diff character.
|
||||
|
||||
{highlights} (table, default: see below)
|
||||
Controls which highlight features are enabled.
|
||||
See |fugitive-ts.Highlights| for fields.
|
||||
|
||||
*fugitive-ts.Highlights*
|
||||
Highlights table fields: ~
|
||||
{treesitter} (boolean, default: true)
|
||||
Apply treesitter syntax highlighting to code.
|
||||
|
||||
{headers} (boolean, default: true)
|
||||
Highlight function context in hunk headers.
|
||||
The context portion of `@@ -10,3 +10,4 @@ func()`
|
||||
will receive treesitter highlighting.
|
||||
|
||||
{background} (boolean, default: true)
|
||||
Apply `DiffAdd` background to `+` lines and
|
||||
`DiffDelete` background to `-` lines.
|
||||
|
||||
{linenr} (boolean, default: true)
|
||||
Highlight line numbers with `DiffAdd`/`DiffDelete`
|
||||
colors matching the line background.
|
||||
|
||||
{vim} (boolean, default: false)
|
||||
Experimental: Use vim syntax highlighting as
|
||||
fallback when no treesitter parser is available.
|
||||
|
||||
==============================================================================
|
||||
API *fugitive-ts-api*
|
||||
|
||||
|
|
@ -103,8 +129,10 @@ IMPLEMENTATION *fugitive-ts-implementation*
|
|||
- Language is detected from the filename using |vim.filetype.match()|
|
||||
- Diff prefixes (`+`/`-`/` `) are stripped from code lines
|
||||
- Code is parsed with |vim.treesitter.get_string_parser()|
|
||||
- Background extmarks (`DiffAdd`/`DiffDelete`) applied at priority 198
|
||||
- `Normal` extmarks at priority 199 clear underlying diff foreground
|
||||
- Treesitter highlights are applied as extmarks at priority 200
|
||||
- A `Normal` extmark at priority 199 clears underlying diff colors
|
||||
- Conceal extmarks hide diff prefixes when `conceal_prefixes` is enabled
|
||||
4. Re-highlighting occurs on `TextChanged` (debounced) and `Syntax` events
|
||||
|
||||
==============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue