annotate runtime/pack/dist/opt/matchit/plugin/matchit.vim @ 26708:f0d7cb510ce3

Update runtime files Commit: https://github.com/vim/vim/commit/fa3b72348d88343390fbe212cfc230fec1602fc2 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 24 13:18:38 2021 +0000 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Fri, 24 Dec 2021 14:30:04 +0100
parents d4deb2e50667
children ea044451c98f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
2 " Maintainer: Christian Brabandt
26708
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
3 " Version: 1.18
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
4 " Last Change: 2020 Dec 23
15729
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
5 " Repository: https://github.com/chrisbra/matchit
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
6 " Previous URL:http://www.vim.org/script.php?script_id=39
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
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
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15729
diff changeset
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
9d3d7b0f4861 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14254
diff changeset
40 " Allow user to prevent loading and prevent duplicate loading.
15729
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
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
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
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
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
49 nnoremap <silent> <Plug>(MatchitNormalForward) :<C-U>call matchit#Match_wrapper('',1,'n')<CR>
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
50 nnoremap <silent> <Plug>(MatchitNormalBackward) :<C-U>call matchit#Match_wrapper('',0,'n')<CR>
26708
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
51 xnoremap <silent> <Plug>(MatchitVisualForward) :<C-U>call matchit#Match_wrapper('',1,'v')<CR>
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
52 \:if col("''") != col("$") \| exe ":normal! m'" \| endif<cr>gv``
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15729
diff changeset
53 xnoremap <silent> <Plug>(MatchitVisualBackward) :<C-U>call matchit#Match_wrapper('',0,'v')<CR>m'gv``
15729
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
54 onoremap <silent> <Plug>(MatchitOperationForward) :<C-U>call matchit#Match_wrapper('',1,'o')<CR>
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
55 onoremap <silent> <Plug>(MatchitOperationBackward) :<C-U>call matchit#Match_wrapper('',0,'o')<CR>
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
56
8720
9380c37723f8 commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 " Analogues of [{ and ]} using matching patterns:
15729
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
58 nnoremap <silent> <Plug>(MatchitNormalMultiBackward) :<C-U>call matchit#MultiMatch("bW", "n")<CR>
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
59 nnoremap <silent> <Plug>(MatchitNormalMultiForward) :<C-U>call matchit#MultiMatch("W", "n")<CR>
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15729
diff changeset
60 xnoremap <silent> <Plug>(MatchitVisualMultiBackward) :<C-U>call matchit#MultiMatch("bW", "n")<CR>m'gv``
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15729
diff changeset
61 xnoremap <silent> <Plug>(MatchitVisualMultiForward) :<C-U>call matchit#MultiMatch("W", "n")<CR>m'gv``
15729
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
62 onoremap <silent> <Plug>(MatchitOperationMultiBackward) :<C-U>call matchit#MultiMatch("bW", "o")<CR>
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
63 onoremap <silent> <Plug>(MatchitOperationMultiForward) :<C-U>call matchit#MultiMatch("W", "o")<CR>
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
64
8720
9380c37723f8 commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 " text object:
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 15729
diff changeset
66 xmap <silent> <Plug>(MatchitVisualTextObject) <Plug>(MatchitVisualMultiBackward)o<Plug>(MatchitVisualMultiForward)
26708
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
67
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
68 if !exists("g:no_plugin_maps")
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
69 nmap <silent> % <Plug>(MatchitNormalForward)
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
70 nmap <silent> g% <Plug>(MatchitNormalBackward)
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
71 xmap <silent> % <Plug>(MatchitVisualForward)
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
72 xmap <silent> g% <Plug>(MatchitVisualBackward)
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
73 omap <silent> % <Plug>(MatchitOperationForward)
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
74 omap <silent> g% <Plug>(MatchitOperationBackward)
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
75
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
76 " Analogues of [{ and ]} using matching patterns:
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
77 nmap <silent> [% <Plug>(MatchitNormalMultiBackward)
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
78 nmap <silent> ]% <Plug>(MatchitNormalMultiForward)
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
79 xmap <silent> [% <Plug>(MatchitVisualMultiBackward)
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
80 xmap <silent> ]% <Plug>(MatchitVisualMultiForward)
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
81 omap <silent> [% <Plug>(MatchitOperationMultiBackward)
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
82 omap <silent> ]% <Plug>(MatchitOperationMultiForward)
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
83
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
84 " Text object
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
85 xmap a% <Plug>(MatchitVisualTextObject)
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
86 endif
8720
9380c37723f8 commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87
9380c37723f8 commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 " 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
89 " 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
90 " or viewed using the menu items below.
9380c37723f8 commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 if !exists(":MatchDebug")
15729
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
92 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
93 endif
9380c37723f8 commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94
9380c37723f8 commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 let &cpo = s:save_cpo
9380c37723f8 commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 unlet s:save_cpo
9380c37723f8 commit https://github.com/vim/vim/commit/aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97
15729
fe57e4f0eac1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15334
diff changeset
98 " vim:sts=2:sw=2:et: