Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

tar80/matchwith.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

matchwith.nvim

matchwith.nvim is an alternative plugin to matchparen and matchit. Provides simpler functionality using treesitter.

Caution

We have identified some bugs and are actively working on resolving them.

Features

Displays off-screen match symbols.

off-screen

Highlight the next capture match and parent node match.

show-nodes

The word_highlight feature is a treesitter implementation of LSP reference highlighting.
This feature can have a significant impact on performance and is therefore implemented in the word_highlight branch.

Option values

  • word_highlight(boolean): Enable/Disable the feature. default: true
  • avoid_word_type(string[]): Specifies nodes to be excluded. default: { 'comment', 'string', 'codeblock', 'heading', 'delimiter' }

word-highlight

Requirements

  • Neovim >= 0.11.0

Installation

  • lazy.nvim
{
  'tar80/matchwith.nvim',
  opts = {
    ...
  },
}

Configuration

Defalut values.

Caution

The off_side option is no longer needed.

require('matchwith').setup({
    captures = {
        ['*'] = { 'tag.delimiter', 'punctuation.bracket' },
        lua = { 'keyword.function', 'keyword.repeat', 'keyword.conditional', 'keyword.do.matchwith', 'punctuation.bracket', 'constructor' },
        vim = { 'keyword.function', 'keyword.repeat', 'keyword.conditional', 'punctuation.bracket', 'constructor', 'keyword.exception' },
    },
    debounce_time = 50,
    depth_limit = 10,
    ignore_buftypes = { 'nofile' },
    ignore_filetypes = { 'vimdoc' }, -- Suggested items: 'TelescopePrompt', 'TelescopeResults', 'cmp_menu', 'cmp_docs' ,'fidget', 'snacks_picker_input'
    ignore_parsers = { 'markdown' },
    indicator = 0,
    jump_key = nil, -- e.g. '%'
    priority = 100,
    show_next = false,
    show_parent = false,
    sign = false,
    symbols = { [1] = '', [2] = '', [3] = '', [4] = '', [5] = '', [6] = '', [7] = '', [8] = '' },
    -- in word_highlight branch
    word_highlight = true,
    avoid_word_type = { 'comment', 'string', 'codeblock', 'heading', 'delimiter' }
})

Operator keys

Matchwith provides four operator keys corresponding to matchepair.

  • <Plug>(matchwith-operator-i) Inner range of the current/next matchpair
  • <Plug>(matchwith-operator-a) A range of the current/next matchpair
  • <Plug>(matchwith-operator-parent-i) Inner range of the parent matchpair
  • <Plug>(matchwith-operator-parent-a) A range of the parent matchpair

Register like this:

vim.keymap.set({'o','x'}, 'i%', '<Plug>(matchwith-operator-i)')
vim.keymap.set({'o','x'}, 'a%', '<Plug>(matchwith-operator-a)')
vim.keymap.set({'o','x'}, 'iP', '<Plug>(matchwith-operator-parent-i)')
vim.keymap.set({'o','x'}, 'aP', '<Plug>(matchwith-operator-parent-a)')

About

A typical alternative to matchparen and matchit

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published