cfile autocmd
Marcin Szamotulski <mszamot <at> gmail.com>
2012-02-01 11:12:42 GMT
Dear Bram and Vim_Dev,
I attach a patch which adds the following commands to QuickFixCmdPre and
QuickFixCmdPost autocmds groups: :cfile, :cgetfile, :caddfile, :lfile,
:lgetfile, :laddfile.
The reason is that for some compilers (for example LaTeX) the error file is
not easily readable by vim using errorformat. With this patch using
QuickFxCmdPost, one can write a script which rewrites the log file in a vim
readable way.
The attached patch contains also changes to the description of QuickFixCmdPre
in the doc.
Best regards,
Marcin Szamotulski
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff -r d3cf98aa1619 runtime/doc/autocmd.txt
--- a/runtime/doc/autocmd.txt Sat Jan 28 18:03:35 2012 +0100
+++ b/runtime/doc/autocmd.txt Wed Feb 01 11:11:42 2012 +0000
<at> <at> -700,7 +700,9 <at> <at>
|:lmake|, |:grep|, |:lgrep|, |:grepadd|,
|:lgrepadd|, |:vimgrep|, |:lvimgrep|,
|:vimgrepadd|, |:lvimgrepadd|, |:cscope|,
- |:helpgrep|, |:lhelpgrep|).
+ |:cfile|, |:cgetfile|, |:caddfile|, |:lfile|,
+ |:lgetfile|, |:laddfile|, |:helpgrep|,
+ |:lhelpgrep|).
The pattern is matched against the command
being run. When |:grep| is used but 'grepprg'
is set to "internal" it still matches "grep".
diff -r d3cf98aa1619 src/quickfix.c
--- a/src/quickfix.c Sat Jan 28 18:03:35 2012 +0100
+++ b/src/quickfix.c Wed Feb 01 11:11:42 2012 +0000
<at> <at> -2999,7 +2999,23 <at> <at>
if (eap->cmdidx == CMD_lfile || eap->cmdidx == CMD_lgetfile
|| eap->cmdidx == CMD_laddfile)
wp = curwin;
-
+#ifdef FEAT_AUTOCMD
+ char_u *au_name = NULL;
+ switch (eap->cmdidx)
+ {
+ case CMD_cfile: au_name = (char_u *)"cfile"; break;
+ case CMD_cgetfile: au_name = (char_u *)"cgetfile"; break;
+ case CMD_caddfile: au_name = (char_u *)"caddfile"; break;
+ case CMD_lfile: au_name = (char_u *)"lfile"; break;
+ case CMD_lgetfile: au_name = (char_u *)"lgetfile"; break;
+ case CMD_laddfile: au_name = (char_u *)"laddfile"; break;
+ default: break;
+ }
+ if (au_name != NULL)
+ {
+ apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, NULL, FALSE, curbuf);
+ }
+#endif
#ifdef FEAT_BROWSE
if (cmdmod.browse)
{
<at> <at> -3035,6 +3051,12 <at> <at>
qi = GET_LOC_LIST(wp);
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
}
+#ifdef FEAT_AUTOCMD
+ if (au_name != NULL)
+ {
+ apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf);
+ }
+#endif
}
/*