Skip to content

The match up wiki

Andy Massimino edited this page Nov 11, 2022 · 7 revisions

Recipes (classic)

To use new patterns, you can use an autocmd FileType in your vimrc/init.vim or create an "ftplugin" file in your configuration, e.g., ~/.vim/after/ftplugin/css.vim.

javascript comments

au FileType css,javascript call matchup#util#append_match_words('/\*:\*/')

apache httpd.conf

au FileType apache let b:match_words = '<:>,<\@<=\([^ \t>/]\+\):<\@<=/\1\g{hlend}>'

hugo

Place in a file called ~/.vim/after/ftplugin/{my_filetype}.vim:

let s:block_start = '\(define\|block\|with\|range\|if\)'
call matchup#util#append_match_words(
       \ '{{-\?\s*' . s:block_start . '.\{-}\s*-\?}}'
       \ . ':{{-\?\s*end\s*-\?}}')
call matchup#util#append_match_words('{{:}}')

Engines

Currently, match-up has support for two matching engines: classic which is based on match_words and is compatible with matchit and tree-sitter which has support for additional languages but is only possible in neovim (for now..).

Note: you can actually use both engines at the same time by setting include_match_words to true in the matchup section of nvim-treesitter.configs.setup.

This wiki contains some technical and rough documentation for very advanced configuration.

Classic matching

Classic match preferences

Supporting a new language (classic)

Tree-sitter matching

Supporting a new language (tree sitter)