import { autocmd_get } from "https://deno.land/x/denops_std@v6.5.1/function/vim/mod.ts";
Returns a List
of autocmds. If {opts} is not supplied, then
returns the autocmds for all the events in all the groups.
The optional {opts} Dict argument supports the following items: group Autocmd group name. If specified, returns only the autocmds defined in this group. If the specified group doesn't exist, results in an error message. If set to an empty string, then the default autocmd group is used. event Autocmd event name. If specified, returns only the autocmds defined for this event. If set to "*", then returns autocmds for all the events. If the specified event doesn't exist, results in an error message. pattern Autocmd pattern. If specified, returns only the autocmds defined for this pattern. A combination of the above three times can be supplied in {opts}.
Each Dict in the returned List contains the following items:
bufnr For buffer-local autocmds, buffer number where
the autocmd is defined.
cmd Command executed for this autocmd.
event Autocmd event name.
group Autocmd group name.
nested Boolean flag, set to v:true for a nested
autocmd. See autocmd-nested
.
once Boolean flag, set to v:true, if the autocmd
will be executed only once. See autocmd-once
.
pattern Autocmd pattern. For a buffer-local
autocmd, this will be of the form "<buffer=n>"
.
If there are multiple commands for an autocmd event in a
group, then separate items are returned for each command.
Returns an empty List if an autocmd with the specified group or event or pattern is not found.
Examples:
" :autocmd MyGroup
echo autocmd_get(#{group: 'Mygroup'})
" :autocmd G BufUnload
echo autocmd_get(#{group: 'G', event: 'BufUnload'})
" :autocmd G * *.ts
let acmd = #{group: 'G', event: '*', pattern: '*.ts'}
echo autocmd_get(acmd)
" :autocmd Syntax
echo autocmd_get(#{event: 'Syntax'})
" :autocmd G BufEnter *.ts
let acmd = #{group: 'G', event: 'BufEnter',
\ pattern: '*.ts'}
echo autocmd_get(acmd)
Can also be used as a method
:
Getopts()->autocmd_get()