Skip to content

feat: add word_del_strikethrough config option - #2

Open
leolaurindo wants to merge 1 commit into
cvlmtg:mainfrom
leolaurindo:feat/word-del-strikethrough
Open

feat: add word_del_strikethrough config option#2
leolaurindo wants to merge 1 commit into
cvlmtg:mainfrom
leolaurindo:feat/word-del-strikethrough

Conversation

@leolaurindo

Copy link
Copy Markdown

Allow disabling the strikethrough on deleted words within changed
lines. Defaults to true, preserving current behavior.

Summary

Add a configuration option for the strikethrough applied to deleted words inside changed lines.

The default remains true, preserving current behavior.

Motivation

The plugin currently uses two different visual treatments:

  • Fully deleted lines use the InlineDiffDelete background.
  • Deleted words inside modified lines use InlineDiffWordDel, which also enables strikethrough.

The strikethrough is useful for some users, but in my honest opinion it can be visually noisy, especially when the deleted virtual line already has a deletion background. This option lets users choose the latter style without overriding highlight groups manually.

Usage

require("inline-diff").setup({
  word_del_strikethrough = false,
})

The default still is word_del_strikethrough = true, so the behavior on existing configs remain unchanged.

Implementation

The option is applied when highlights are defined and re-applied when the plugin is enabled. This ensures the setting survives:

  • Initial setup
  • ColorScheme highlight re-derivation
  • Re-enabling or switching refs

Testing

Added tests covering:

  • Default behavior remains strikethrough-enabled
  • word_del_strikethrough = false removes the strikethrough attribute

Full test suite passes:
Success: 23
Failed: 0
Errors: 0

The combined demo branch is available at:
https://github.com/leolaurindo/inline-diff.nvim/tree/dev/all

Allow disabling the strikethrough on deleted words within changed
lines. Defaults to true, preserving current behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant