Mercurial > vim
comparison runtime/doc/autocmd.txt @ 12785:65d7fd8381a3
Update runtime files.
commit https://github.com/vim/vim/commit/b0d45e7f5354375edd02afafde3bd37dac1515ff
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Nov 5 18:19:24 2017 +0100
Update runtime files.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 05 Nov 2017 18:30:05 +0100 |
parents | 3b26420fc639 |
children | 6e81a68d63a1 |
comparison
equal
deleted
inserted
replaced
12784:b38715f6a758 | 12785:65d7fd8381a3 |
---|---|
1 *autocmd.txt* For Vim version 8.0. Last change: 2017 Oct 21 | 1 *autocmd.txt* For Vim version 8.0. Last change: 2017 Nov 05 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
66 | 66 |
67 Note: The ":autocmd" command can only be followed by another command when the | 67 Note: The ":autocmd" command can only be followed by another command when the |
68 '|' appears before {cmd}. This works: > | 68 '|' appears before {cmd}. This works: > |
69 :augroup mine | au! BufRead | augroup END | 69 :augroup mine | au! BufRead | augroup END |
70 But this sees "augroup" as part of the defined command: > | 70 But this sees "augroup" as part of the defined command: > |
71 :augroup mine | au! BufRead * | augroup END | |
71 :augroup mine | au BufRead * set tw=70 | augroup END | 72 :augroup mine | au BufRead * set tw=70 | augroup END |
73 Instead you can put the group name into the command: > | |
74 :au! mine BufRead * | |
75 :au mine BufRead * set tw=70 | |
76 Or use `:execute`: > | |
77 :augroup mine | exe "au! BufRead *" | augroup END | |
78 :augroup mine | exe "au BufRead * set tw=70" | augroup END | |
72 | 79 |
73 Note that special characters (e.g., "%", "<cword>") in the ":autocmd" | 80 Note that special characters (e.g., "%", "<cword>") in the ":autocmd" |
74 arguments are not expanded when the autocommand is defined. These will be | 81 arguments are not expanded when the autocommand is defined. These will be |
75 expanded when the Event is recognized, and the {cmd} is executed. The only | 82 expanded when the Event is recognized, and the {cmd} is executed. The only |
76 exception is that "<sfile>" is expanded when the autocmd is defined. Example: | 83 exception is that "<sfile>" is expanded when the autocmd is defined. Example: |