Update readme

This commit is contained in:
Andy K. Massimino
2021-05-02 12:03:22 -04:00
parent 9762604545
commit 7b74e2130d

View File

@@ -1,10 +1,16 @@
<div align="center">
<p>
<img src='https://github.com/andymass/matchup.vim/wiki/images/teaser.jpg' width='300px' alt='and in this corner...' />
</p>
</div>
# vim match-up
match-up is a plugin that lets you highlight, navigate, and operate on
sets of matching text. It extends vim's `%` key to language-specific
words instead of just single characters.
<img src='https://github.com/andymass/matchup.vim/wiki/images/teaser.jpg' width='300px' alt='and in this corner...'>
[![Gitter](https://badges.gitter.im/vim-matchup/community.svg)](https://gitter.im/vim-matchup/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
## Screenshot
@@ -38,18 +44,19 @@ more information. This plugin:
- Extends vim's `%` motion to language-specific words. The following vim
file type plugins currently provide special support for match-up:
> abaqus, ada, aspvbs, bash, c, cpp, chicken, clojure, cmake, cobol,
> context, csc, csh, dtd, dtrace, eiffel, eruby, falcon, fortran,
> framescript, haml, hamster, hog, html, ishd, j, javascript,
> javascriptreact, jsp, kconfig, liquid, lua, m3quake, make, matlab, mf,
> modula2, modula3, mp, nsis, ocaml, pascal, pdf, perl, php, plaintex,
> postscr, ruby, sh, spec, sql, tex (latex), typescriptreact, vb,
> verilog, vhdl, vim, xhtml, xml, zimbu, zsh
> abaqus, ada, aspvbs, bash, c, cpp, chicken, clojure, cmake, cobol,
> context, csc, csh, dtd, dtrace, eiffel, eruby, falcon, fortran,
> framescript, haml, hamster, hog, html, ishd, j, javascript,
> javascriptreact, jsp, kconfig, liquid, lua, m3quake, make, matlab, mf,
> modula2, modula3, mp, nsis, ocaml, pascal, pdf, perl, php, plaintex,
> postscr, ruby, sh, spec, sql, tex (latex), typescriptreact, vb,
> verilog, vhdl, vim, xhtml, xml, zimbu, zsh
Other file types can be supported by installing additional filetype
plugins (not provided by match-up).
Note: match-up uses the same `b:match_words` as matchit.
- Adds motions `g%`, `[%`, `]%`, and `z%`.
- Combines these motions into convenient text objects `i%` and `a%`.
- Highlights symbols and words under the cursor which `%` can work on,
@@ -80,6 +87,30 @@ let g:loaded_matchit = 1
See [Interoperability](#interoperability) for more information about working
together with other plugins.
### Tree-sitter integration
_Note: Currently this feature is possible in neovim 0.5.5+ only._
match-up now has experimental support for language syntax provided
by tree-sitter. The list of supported languages is available
[here](https://github.com/andymass/vim-matchup/tree/master/after/queries).
This feature requires manual opt-in in your init.vim and requires
[nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) to
be installed.
```vim
Plug 'nvim-treesitter/nvim-treesitter'
lua <<EOF
require'nvim-treesitter.configs'.setup {
matchup = {
enable = true, -- mandatory, false will disable the whole extension
disable = { "c", "ruby" }, -- optional, list of language that will be disabled
},
}
EOF
```
## Features
| | feature | __match-up__ | matchit | matchparen |
@@ -89,10 +120,10 @@ together with other plugins.
| ([a.3]) | jump inside (`z%`) | :thumbsup: | :x: | :x: |
| ([b.1]) | full set of text objects | :thumbsup: | :question: | :x: |
| ([c.1]) | highlight `()`, `[]`, & `{}` | :thumbsup: | :x: | :thumbsup: |
| ([c.2]) | highlight _all_ matches | :thumbsup: | :x: | :x: |
| ([c.2]) | highlight _all_ matching words | :thumbsup: | :x: | :x: |
| ([c.3]) | display matches off-screen | :thumbsup: | :x: | :x: |
| ([c.4]) | show where you are (breadcrumbs) | :thumbsup: | :x: | :x: |
| ([d.1]) | modern, modular coding style | :thumbsup: | :x: | :x: |
| ([d.1]) | (neovim) tree-sitter integration | :thumbsup: | :x: | :x: |
[a.1]: #a1-jump-between-matching-words
[a.2]: #a2-jump-to-open-and-close-words
@@ -102,11 +133,11 @@ together with other plugins.
[c.2]: #c2-highlight-all-matches
[c.3]: #c3-display-matches-off-screen
[c.4]: #c4-where-am-i
[d.1]: #development
[d.1]: #tree-sitter-integration
[inclusive]: #inclusive-and-exclusive-motions
[exclusive]: #inclusive-and-exclusive-motions
Legend: :thumbsup: supported. :construction: TODO, planned, or in progress.
Legend: :thumbsup: supported.
:question: poorly implemented, broken, or uncertain. :x: not possible.
### Detailed feature documentation
@@ -155,6 +186,7 @@ Since in C and C++, blocks are delimited using braces (`{` & `}`),
match-up will recognize `{` as the open word and `}` as the close word.
It will ignore the `if` and `else if` because they are not defined in
vim's C file type plugin.
With [Tree-sitter](#tree-sitter-integration)
On the other hand, match-up will recognize the `#if`, `#else`, `#endif`
preprocessor directives.
@@ -276,7 +308,7 @@ print out.
### Inclusive and exclusive motions
In vim, character motions following operators (such as `d` for delete
and `c` for change) are either _inclusive_ or _exclusive_. This means
and `c` for change) are either [inclusive] or [exclusive]. This means
they either include the ending position or not. Here, "ending position"
means the line and column closest to the end of the buffer of the region
swept over by the motion. match-up is designed so that `d]%` inside a set
@@ -312,7 +344,7 @@ pressing `d[%` will produce
```
This is compatible with vim's `d[(` and `d[{`.
Unlike `]%`, `%` is an _inclusive_ motion. As a special case for the
Unlike `]%`, `%` is an [inclusive] motion. As a special case for the
`d` (delete) operator, if `d%` leaves behind lines white-space, they will
be deleted also. In effect, it will be operating line-wise. As an
example, pressing `d%` will leave behind nothing.
@@ -516,7 +548,7 @@ following optional keys:
Sets the method to use to show off-screen matches.
Possible values are:
`'status'` (default): Replace the |status-line| for off-screen matches.
`'status'` (default): Replace the _status-line_ for off-screen matches.
If a match is off of the screen, the line belonging to that match will be
displayed syntax-highlighted in the status line along with the line number
@@ -524,6 +556,9 @@ following optional keys:
an additional Δ symbol will be shown to indicate that the matching line is
really above the cursor line.
`'popup'`: Show off-screen matches in a popup (vim) or
floating (neovim) window.
`'status_manual'`: Compute the status-line but do not display it (future
extension).