On 09/07/10 01:47, bill lam wrote:
I want a bufwritepre event for all files except a few, pseudo code
like

au bufwritepre !(*.[chy] Makefile*) :if ........

Is that possible?


Well, it is possible but...

Here's how I would code it (untested):

  au BufWritePre *
    \ if expand('<afile>') !~ '\.[chy]$\|^Makefile'
      \ | if (condition) | DoSomething
      \ | else | DoSomethingElse | endif | endif

If you don't need an "else" clause in your "if" (represented here by if (condition)) you may of course group them with && and suppress one of the "endif" keywords.

see
        :help expand()
        :help <afile>
        :help expr-!~

Note that the syntax of the !~ operator requires a full Vim pattern on its right-hand side, not a shell-like glob pattern.


Best regards,
Tony.
--
Statisticians do it with 95% confidence.

--
You received this message from the "vim_use" 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

Reply via email to