Mercurial > vim
annotate runtime/pack/dist/opt/matchit/plugin/matchit.vim @ 19574:d4deb2e50667
Update runtime files
Commit: https://github.com/vim/vim/commit/eab6dff19f387469a200011bc6cf3508f5e43a4a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 1 19:06:45 2020 +0100
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 01 Mar 2020 19:15:04 +0100 |
parents | 6d11fc4aa683 |
children | f0d7cb510ce3 |
rev | line source |
---|---|
8720
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " matchit.vim: (global plugin) Extended "%" matching |
15729 | 2 " Maintainer: Christian Brabandt |
19574 | 3 " Version: 1.17 |
18456 | 4 " Last Change: 2019 Oct 24 |
15729 | 5 " Repository: https://github.com/chrisbra/matchit |
6 " Previous URL:http://www.vim.org/script.php?script_id=39 | |
7 " Previous Maintainer: Benji Fisher PhD <benji@member.AMS.org> | |
8720
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 " Documentation: |
18456 | 10 " The documentation is in a separate file: ../doc/matchit.txt |
8720
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 " Credits: |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 " Vim editor by Bram Moolenaar (Thanks, Bram!) |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 " Original script and design by Raul Segura Acevedo |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 " Support for comments by Douglas Potts |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 " Support for back references and other improvements by Benji Fisher |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 " Support for many languages by Johannes Zellner |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 " Suggestions for improvement, bug reports, and support for additional |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 " languages by Jordi-Albert Batalla, Neil Bird, Servatius Brandt, Mark |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 " Collett, Stephen Wall, Dany St-Amant, Yuheng Xie, and Johannes Zellner. |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 " Debugging: |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 " If you'd like to try the built-in debugging commands... |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 " :MatchDebug to activate debugging for the current buffer |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 " This saves the values of several key script variables as buffer-local |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 " variables. See the MatchDebug() function, below, for details. |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 " TODO: I should think about multi-line patterns for b:match_words. |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 " This would require an option: how many lines to scan (default 1). |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 " This would be useful for Python, maybe also for *ML. |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 " TODO: Maybe I should add a menu so that people will actually use some of |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 " the features that I have implemented. |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 " TODO: Eliminate the MultiMatch function. Add yet another argument to |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 " Match_wrapper() instead. |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 " TODO: Allow :let b:match_words = '\(\(foo\)\(bar\)\):\3\2:end\1' |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 " TODO: Make backrefs safer by using '\V' (very no-magic). |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 " TODO: Add a level of indirection, so that custom % scripts can use my |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 " work but extend it. |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 |
15334 | 40 " Allow user to prevent loading and prevent duplicate loading. |
15729 | 41 if exists("g:loaded_matchit") || &cp |
8720
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 finish |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 endif |
15729 | 44 let g:loaded_matchit = 1 |
8720
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 let s:save_cpo = &cpo |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 set cpo&vim |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 |
15729 | 49 nnoremap <silent> <Plug>(MatchitNormalForward) :<C-U>call matchit#Match_wrapper('',1,'n')<CR> |
50 nnoremap <silent> <Plug>(MatchitNormalBackward) :<C-U>call matchit#Match_wrapper('',0,'n')<CR> | |
18456 | 51 xnoremap <silent> <Plug>(MatchitVisualForward) :<C-U>call matchit#Match_wrapper('',1,'v')<CR>m'gv`` |
52 xnoremap <silent> <Plug>(MatchitVisualBackward) :<C-U>call matchit#Match_wrapper('',0,'v')<CR>m'gv`` | |
15729 | 53 onoremap <silent> <Plug>(MatchitOperationForward) :<C-U>call matchit#Match_wrapper('',1,'o')<CR> |
54 onoremap <silent> <Plug>(MatchitOperationBackward) :<C-U>call matchit#Match_wrapper('',0,'o')<CR> | |
55 | |
56 nmap <silent> % <Plug>(MatchitNormalForward) | |
57 nmap <silent> g% <Plug>(MatchitNormalBackward) | |
58 xmap <silent> % <Plug>(MatchitVisualForward) | |
59 xmap <silent> g% <Plug>(MatchitVisualBackward) | |
60 omap <silent> % <Plug>(MatchitOperationForward) | |
61 omap <silent> g% <Plug>(MatchitOperationBackward) | |
8720
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 " Analogues of [{ and ]} using matching patterns: |
15729 | 64 nnoremap <silent> <Plug>(MatchitNormalMultiBackward) :<C-U>call matchit#MultiMatch("bW", "n")<CR> |
65 nnoremap <silent> <Plug>(MatchitNormalMultiForward) :<C-U>call matchit#MultiMatch("W", "n")<CR> | |
18456 | 66 xnoremap <silent> <Plug>(MatchitVisualMultiBackward) :<C-U>call matchit#MultiMatch("bW", "n")<CR>m'gv`` |
67 xnoremap <silent> <Plug>(MatchitVisualMultiForward) :<C-U>call matchit#MultiMatch("W", "n")<CR>m'gv`` | |
15729 | 68 onoremap <silent> <Plug>(MatchitOperationMultiBackward) :<C-U>call matchit#MultiMatch("bW", "o")<CR> |
69 onoremap <silent> <Plug>(MatchitOperationMultiForward) :<C-U>call matchit#MultiMatch("W", "o")<CR> | |
70 | |
71 nmap <silent> [% <Plug>(MatchitNormalMultiBackward) | |
72 nmap <silent> ]% <Plug>(MatchitNormalMultiForward) | |
73 xmap <silent> [% <Plug>(MatchitVisualMultiBackward) | |
74 xmap <silent> ]% <Plug>(MatchitVisualMultiForward) | |
75 omap <silent> [% <Plug>(MatchitOperationMultiBackward) | |
76 omap <silent> ]% <Plug>(MatchitOperationMultiForward) | |
8720
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 " text object: |
18456 | 79 xmap <silent> <Plug>(MatchitVisualTextObject) <Plug>(MatchitVisualMultiBackward)o<Plug>(MatchitVisualMultiForward) |
15729 | 80 xmap a% <Plug>(MatchitVisualTextObject) |
8720
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 " Call this function to turn on debugging information. Every time the main |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 " script is run, buffer variables will be saved. These can be used directly |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 " or viewed using the menu items below. |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 if !exists(":MatchDebug") |
15729 | 86 command! -nargs=0 MatchDebug call matchit#Match_debug() |
8720
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 endif |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 let &cpo = s:save_cpo |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 unlet s:save_cpo |
9380c37723f8
commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 |
15729 | 92 " vim:sts=2:sw=2:et: |