From ec028dd0e5b1a39480fd8eb6eff2642159f24eff Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Mon, 2 Feb 2026 16:51:48 -0500 Subject: [PATCH] feat(doc): more updates --- doc/fugitive-ts.nvim.txt | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/doc/fugitive-ts.nvim.txt b/doc/fugitive-ts.nvim.txt index 1bfd9e4..7afeeb1 100644 --- a/doc/fugitive-ts.nvim.txt +++ b/doc/fugitive-ts.nvim.txt @@ -10,6 +10,14 @@ fugitive-ts.nvim adds treesitter-based syntax highlighting to vim-fugitive diff views. It overlays language-aware highlights on top of fugitive's default regex-based diff highlighting. +Features: ~ +- Syntax highlighting in |:Git| summary diffs and commit detail views +- Syntax highlighting in |:Gdiffsplit| / |:Gvdiffsplit| side-by-side diffs +- Vim syntax fallback for languages without a treesitter parser +- Blended diff background colors that preserve syntax visibility +- Optional diff prefix (`+`/`-`/` `) concealment +- Gutter (line number) highlighting + ============================================================================== REQUIREMENTS *fugitive-ts-requirements* @@ -148,19 +156,31 @@ refresh({bufnr}) *fugitive-ts.refresh()* ============================================================================== IMPLEMENTATION *fugitive-ts-implementation* -1. The `FileType fugitive` autocmd triggers |fugitive-ts.attach()| -2. The buffer is parsed to detect file headers (`M path/to/file.lua`) and - hunk headers (`@@ -10,3 +10,4 @@`) +Summary / commit detail views: ~ +1. `FileType fugitive` or `FileType git` (for `fugitive://` buffers) + triggers |fugitive-ts.attach()| +2. The buffer is parsed to detect file headers (`M path/to/file`, + `diff --git a/... b/...`) and hunk headers (`@@ -10,3 +10,4 @@`) 3. For each hunk: - 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()| + - If no treesitter parser and `vim.enabled`: vim syntax fallback via + scratch buffer and |synID()| - Background extmarks (`FugitiveTsAdd`/`FugitiveTsDelete`) at priority 198 - `Normal` extmarks at priority 199 clear underlying diff foreground - - Treesitter highlights are applied as extmarks at priority 200 + - Syntax highlights are applied as extmarks at priority 200 - Conceal extmarks hide diff prefixes when `hide_prefix` is enabled 4. Re-highlighting occurs on `TextChanged` (debounced) and `Syntax` events +Diffsplit views: ~ +1. `OptionSet diff` detects when a window enters diff mode +2. If any `&diff` window in the tabpage contains a `fugitive://` buffer, + all `&diff` windows receive a window-local 'winhighlight' override +3. The override remaps `DiffAdd`/`DiffDelete`/`DiffChange`/`DiffText` to + background-only variants, allowing existing treesitter highlighting to + show through the diff colors + ============================================================================== KNOWN LIMITATIONS *fugitive-ts-limitations*