Skip to content

Issue with flash.nvim and snacks.indent overlapping #95

Description

@peter-bread

Important

This issue is just for documentation.


In some rare cases, a flash overlay is on the same cell as an existing indent guide. The highlight is updated, but the virtual text is not, i.e. the text is still the indent guide character but the highlight is from flash.nvim.

This happens because both plugins are setting virtual text in an extmark in the same cell, but they are in different namespaces. The flash.nvim extmark has a higher priority so it overwrites the highlight, but being in different namespaces means the virtual text cannot be overwritten. You can't clear the "snacks_indent" namespace as it is re-created on the next redraw event, and snacks.indent automatically calls redraw.

The only workaround is to:

  1. Use flash.nvim as normal, with snacks.indent enabled
  2. If they overlap, press ESC then use :lua Snacks.indent.disable()
  3. Use flash.nvim again
  4. Re-enable snacks.indent with :lua Snacks.indent.enable()

A keymap was added in 37f9ddc to make toggling snacks.indent easier.

I can't see an easy way of fixing this. I assume it would need some hacky changes made to both plugins.

For that reason I will not attempt to actually fix this. This issue is just for documentation.

Example:
Start with this YAML file, ensuring the YAML tree-sitter parser is installed:

---
name: CI

on:
  push:
  pull_request:

  # this is only for testing
  workflow_dispatch:

jobs:
  stylua:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: JohnnyMorganz/stylua-action@v4
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          version: latest
          args: --check .

Place the cursor on the t at the start of token.

Use flash.nvim:

Image

Disable snacks.indent.

Use flash.nvim again:

Image

Enable snacks.indent.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Work on eventually maybebugSomething isn't workingpluginAdd, remove or customise a pluginresearchNeed more information about thiswontfixThis will not be worked on

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions