Skip to content

usefulmove/dimparens.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

dimparens.nvim

A Neovim plugin that dims parentheses, brackets, and braces for better code clarity. Especially useful for Lisp-like languages where structural delimiters can overwhelm the actual code.

Requirements

  • Neovim 0.9+
  • termguicolors enabled (:set termguicolors)
  • Treesitter parsers for your target languages (:TSInstall lua python scheme racket)

Installation

Using lazy.nvim:

{
  "usefulmove/dimparens.nvim",
  ft = { "lua", "python", "scheme", "racket", "lisp" },  -- Load on these filetypes
  opts = {
    dim_weight = 0.5,  -- 0 = background color, 1 = normal text color
    languages = { "lua", "python", "scheme", "racket", "lisp" },
  },
}

For local development:

{
  "dimparens.nvim",
  dir = "/path/to/dimparens.nvim",
  ft = { "lua", "python", "scheme" },
  opts = {
    languages = { "lua", "python", "scheme" },
  },
}

Configuration

Default options:

require("dimparens").setup({
  dim_weight = 0.5,           -- Blend factor (0 = background, 1 = foreground)
  highlight_group = "DimParens",  -- Highlight group name
  languages = {               -- Languages to enable dimming for
    "lua",
    "scheme",
    "racket",
    "lisp",
    "python",
    "javascript",
    "typescript",
  },
})

dim_weight

Controls how much the delimiters are dimmed:

  • 0.0 = Same color as background (invisible)
  • 0.5 = Halfway between foreground and background (default)
  • 1.0 = Same color as normal text (no dimming)

For aggressive dimming, try 0.2 or lower.

Commands

Command Description
:DimParensToggle Toggle dimming on/off
:DimParensStatus Show current state and debug info

Troubleshooting

Dimming not working for a language

Make sure the Treesitter parser is installed:

:TSInstall python
:TSInstall scheme
:TSInstall racket

Colors look wrong

Ensure termguicolors is enabled:

:set termguicolors

Not working on first file opened

If using event = "VeryLazy" in lazy.nvim, switch to ft = { ... }:

{
  "usefulmove/dimparens.nvim",
  ft = { "lua", "python" },  -- Instead of event = "VeryLazy"
  opts = { ... },
}

Check plugin status

Run :DimParensStatus to see:

  • Whether the plugin is enabled
  • The current highlight color
  • Number of extmarks in the current buffer

How It Works

  1. Uses Treesitter to parse the buffer and identify delimiter tokens
  2. Creates extmarks with a dimmed highlight for each (, ), [, ], {, }
  3. The dimmed color is calculated by blending the Normal foreground toward the background

License

MIT

About

Neovim readability plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages