Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/utilyre/sentiment.nvim

Enhanced matchparen.vim plugin for Neovim
https://github.com/utilyre/sentiment.nvim

lua matchparen neovim neovim-plugin nvim plugin

Last synced: 2 days ago
JSON representation

Enhanced matchparen.vim plugin for Neovim

Awesome Lists containing this project

README

        

# sentiment.nvim

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

## 📹 Demo

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

[demo.webm](https://user-images.githubusercontent.com/91974155/223225880-2b22dcda-3d38-4a9f-82d5-0e76c0c789e7.webm)

## ✨ Features

- 🚀 Performance (**Blazingly Fast!!!**).

- 🪁 Fully compatible with anything that expects
[matchparen.vim][matchparen.vim] to be there.

- 👍 Ease of use.

## 📦 Installation

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

- [lazy.nvim][lazy.nvim]

```lua
{
"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][packer.nvim]

```lua
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][matchparen.vim] plugin.

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

## 🚠 Configuration

Click to see the default config

```lua
{
---Dictionary to check whether a buftype should be included.
---
---@type table
included_buftypes = {
[""] = true,
},

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

---Dictionary to check whether a mode should be included.
---
---@type table
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[]
pairs = {
{ "(", ")" },
{ "{", "}" },
{ "[", "]" },
},
}
```

[matchparen.vim]: https://github.com/neovim/neovim/blob/master/runtime/plugin/matchparen.vim
[nvim-autopairs]: https://github.com/windwp/nvim-autopairs
[lazy.nvim]: https://github.com/folke/lazy.nvim
[packer.nvim]: https://github.com/wbthomason/packer.nvim
[nvim_set_hl]: https://neovim.io/doc/user/api.html#nvim_set_hl()