utilyre / sentiment.nvim

Enhanced matchparen.vim plugin for Neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sentiment.nvim

Enhanced matchparen.vim plugin for Neovim to highlight the outer pair.

๐Ÿ“น Demo

DISCLAIMER: The autopair functionality is coming from nvim-autopairs.

demo.webm

โœจ Features

  • ๐Ÿš€ Performance (Blazingly Fast!!!).

  • ๐Ÿช Fully compatible with anything that expects matchparen.vim to be there.

  • ๐Ÿ‘ Ease of use.

๐Ÿ“ฆ Installation

NOTE: Keep in mind that calling setup disables the built-in matchparen.vim plugin.

  • lazy.nvim

    {
      "utilyre/sentiment.nvim",
      version = "*",
      event = "VeryLazy", -- keep for lazy loading
      opts = {
        -- config
      },
      init = function()
        -- `matchparen.vim` needs to be disabled manually in case of lazy loading
        vim.g.loaded_matchparen = 1
      end,
    }
  • packer.nvim

    use({
      "utilyre/sentiment.nvim",
      tag = "*",
      config = function()
        require("sentiment").setup({
          -- config
        })
      end,
    })

๐ŸŽฎ Usage

  • require("sentiment").disable(), :NoMatchParen

    Disable the plugin.

  • require("sentiment").enable(), :DoMatchParen

    Re-enable the plugin.

๐ŸŽจ Highlight

This plugin re-uses the widely supported MatchParen highlight group of the former matchparen.vim plugin.

See :help nvim_set_hl() for how you can change it.

๐Ÿš  Configuration

Click to see the default config
{
  ---Dictionary to check whether a buftype should be included.
  ---
  ---@type table<string, boolean>
  included_buftypes = {
    [""] = true,
  },

  ---Dictionary to check whether a filetype should be excluded.
  ---
  ---@type table<string, boolean>
  excluded_filetypes = {},

  ---Dictionary to check whether a mode should be included.
  ---
  ---@type table<string, boolean>
  included_modes = {
    n = true,
    i = true,
  },

  ---How much (in milliseconds) should the cursor stay still to calculate and
  ---render a pair.
  ---
  ---NOTE: It's recommended to set this somewhere above and close to your key
  ---repeat speed in order to keep the calculations at minimum.
  ---
  ---@type integer
  delay = 50,

  ---How many lines to look backwards/forwards to find a pair.
  ---
  ---@type integer
  limit = 100,

  ---List of `(left, right)` pairs.
  ---
  ---NOTE: Both sides of a pair can't have the same character.
  ---
  ---@type tuple<string, string>[]
  pairs = {
    { "(", ")" },
    { "{", "}" },
    { "[", "]" },
  },
}

About

Enhanced matchparen.vim plugin for Neovim

License:MIT License


Languages

Language:Lua 100.0%