autocmd: introduce "once" feature

Adds a new feature to :autocmd which sets the handler to be executed at
most one times.

Before:

    augroup FooGroup
      autocmd!
      autocmd FileType foo call Foo() | autocmd! FooGroup * <buffer>
    augroup END

After:

    autocmd FileType foo once call Foo()
This commit is contained in:
Justin M. Keyes
2019-03-10 04:32:58 +01:00
parent 092e7e6c60
commit c12cf5bde7
5 changed files with 198 additions and 101 deletions

View File

@@ -20160,7 +20160,7 @@ void ex_function(exarg_T *eap)
skip_until = vim_strsave((char_u *)".");
}
// Check for ":python <<EOF", ":lua <<EOF", etc.
// heredoc: Check for ":python <<EOF", ":lua <<EOF", etc.
arg = skipwhite(skiptowhite(p));
if (arg[0] == '<' && arg[1] =='<'
&& ((p[0] == 'p' && p[1] == 'y'