-
Notifications
You must be signed in to change notification settings - Fork 73
The match up wiki
Andy Massimino edited this page Nov 11, 2022
·
7 revisions
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
.
au FileType css,javascript call matchup#util#append_match_words('/\*:\*/')
au FileType apache let b:match_words = '<:>,<\@<=\([^ \t>/]\+\):<\@<=/\1\g{hlend}>'
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('{{:}}')
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.