diff options
author | Bram Moolenaar <bram@vim.org> | 2013-11-28 18:53:52 +0100 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2013-11-28 18:53:52 +0100 |
commit | 981f1eb0f1a1e03c3f1439e5ad733766ca0cf1ea (patch) | |
tree | 251609ddcac7c744eaec894046c624635e172204 | |
parent | 2a07e55ddf4d208b26be0201591b55391a226964 (diff) | |
download | vim-981f1eb0f1a1e03c3f1439e5ad733766ca0cf1ea.tar.gz |
Problem: ColorScheme autocommand matches with the current buffer name.
Solution: Match with the colorscheme name. (Christian Brabandt)
-rw-r--r-- | runtime/doc/autocmd.txt | 6 | ||||
-rw-r--r-- | src/fileio.c | 9 | ||||
-rw-r--r-- | src/syntax.c | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 15 insertions, 4 deletions
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 3384051e..0a950531 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -480,6 +480,12 @@ CmdwinLeave Before leaving the command-line window. |cmdwin-char| *ColorScheme* ColorScheme After loading a color scheme. |:colorscheme| + The pattern is matched against the + colorscheme name. <afile> can be used for the + name of the actual file where this option was + set, and <amatch> for the new colorscheme + name. + *CompleteDone* CompleteDone After Insert mode completion is done. Either diff --git a/src/fileio.c b/src/fileio.c index 1d030165..cb22bd31 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -9330,7 +9330,9 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap) */ if (fname_io == NULL) { - if (fname != NULL && *fname != NUL) + if (event == EVENT_COLORSCHEME) + autocmd_fname = NULL; + else if (fname != NULL && *fname != NUL) autocmd_fname = fname; else if (buf != NULL) autocmd_fname = buf->b_ffname; @@ -9383,14 +9385,15 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap) else { sfname = vim_strsave(fname); - /* Don't try expanding FileType, Syntax, FuncUndefined, WindowID or - * QuickFixCmd* */ + /* Don't try expanding FileType, Syntax, FuncUndefined, WindowID, + * ColorScheme or QuickFixCmd* */ if (event == EVENT_FILETYPE || event == EVENT_SYNTAX || event == EVENT_FUNCUNDEFINED || event == EVENT_REMOTEREPLY || event == EVENT_SPELLFILEMISSING || event == EVENT_QUICKFIXCMDPRE + || event == EVENT_COLORSCHEME || event == EVENT_QUICKFIXCMDPOST) fname = vim_strsave(fname); else diff --git a/src/syntax.c b/src/syntax.c index a8de63a6..4352b9df 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -7071,7 +7071,7 @@ load_colors(name) retval = source_runtime(buf, FALSE); vim_free(buf); #ifdef FEAT_AUTOCMD - apply_autocmds(EVENT_COLORSCHEME, NULL, NULL, FALSE, curbuf); + apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, FALSE, curbuf); #endif } recursive = FALSE; diff --git a/src/version.c b/src/version.c index b982283a..5975135f 100644 --- a/src/version.c +++ b/src/version.c @@ -739,6 +739,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 109, +/**/ 108, /**/ 107, |