comparison runtime/doc/autocmd.txt @ 28917:c5862dfaf0bd v8.2.4981

patch 8.2.4981: it is not possible to manipulate autocommands Commit: https://github.com/vim/vim/commit/1755a91851f7022fdd3eecfbd2cc0b508a2f2a8f Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Thu May 19 10:31:47 2022 +0100 patch 8.2.4981: it is not possible to manipulate autocommands Problem: It is not possible to manipulate autocommands. Solution: Add functions to add, get and set autocommands. (Yegappan Lakshmanan, closes #10291)
author Bram Moolenaar <Bram@vim.org>
date Thu, 19 May 2022 11:45:05 +0200
parents f73a9bdff3a3
children 3c3bdb8069f5
comparison
equal deleted inserted replaced
28916:40a5b3396eb4 28917:c5862dfaf0bd
80 au BufReadPost *.xml { 80 au BufReadPost *.xml {
81 setlocal matchpairs+=<:> 81 setlocal matchpairs+=<:>
82 /<start 82 /<start
83 } 83 }
84 84
85 The |autocmd_add()| function can be used to add a list of autocmds and autocmd
86 groups from a Vim script.
87
85 Note: The ":autocmd" command can only be followed by another command when the 88 Note: The ":autocmd" command can only be followed by another command when the
86 '|' appears where the pattern is expected. This works: > 89 '|' appears where the pattern is expected. This works: >
87 :augroup mine | au! BufRead | augroup END 90 :augroup mine | au! BufRead | augroup END
88 But this sees "augroup" as part of the defined command: > 91 But this sees "augroup" as part of the defined command: >
89 :augroup mine | au! BufRead * | augroup END 92 :augroup mine | au! BufRead * | augroup END
144 prompt. When one command outputs two messages this can happen anyway. 147 prompt. When one command outputs two messages this can happen anyway.
145 148
146 ============================================================================== 149 ==============================================================================
147 3. Removing autocommands *autocmd-remove* 150 3. Removing autocommands *autocmd-remove*
148 151
152 In addition to the below described commands, the |autocmd_delete()| function can
153 be used to remove a list of autocmds and autocmd groups from a Vim script.
154
149 :au[tocmd]! [group] {event} {aupat} [++once] [++nested] {cmd} 155 :au[tocmd]! [group] {event} {aupat} [++once] [++nested] {cmd}
150 Remove all autocommands associated with {event} and 156 Remove all autocommands associated with {event} and
151 {aupat}, and add the command {cmd}. 157 {aupat}, and add the command {cmd}.
152 See |autocmd-once| for [++once]. 158 See |autocmd-once| for [++once].
153 See |autocmd-nested| for [++nested]. 159 See |autocmd-nested| for [++nested].
195 [group]; otherwise, Vim lists the autocommands for ALL groups. Note that this 201 [group]; otherwise, Vim lists the autocommands for ALL groups. Note that this
196 argument behavior differs from that for defining and removing autocommands. 202 argument behavior differs from that for defining and removing autocommands.
197 203
198 In order to list buffer-local autocommands, use a pattern in the form <buffer> 204 In order to list buffer-local autocommands, use a pattern in the form <buffer>
199 or <buffer=N>. See |autocmd-buflocal|. 205 or <buffer=N>. See |autocmd-buflocal|.
206
207 The |autocmd_get()| function can be used from a Vim script to get a list of
208 autocmds.
200 209
201 *:autocmd-verbose* 210 *:autocmd-verbose*
202 When 'verbose' is non-zero, listing an autocommand will also display where it 211 When 'verbose' is non-zero, listing an autocommand will also display where it
203 was last defined. Example: > 212 was last defined. Example: >
204 213