On 11/12/11 21:50, Paul wrote:
On Saturday, 26 November, 2011 at 23:22:16 GMT, Paul wrote:
I want to do this, but only have the ls bit executed if make is
successful:

:make | !ls

I expanded on this by doing a make automatically when a buffer is saved:

autocmd BufWritePost *.pl make

Now, I can do this:

:w | if getqflist() == [] | [whatever] | endif

ie, if there's nothing in the quickfix list, do whatever.

So, I thought instead of wrapping my whatever in an 'if', I could define
a function that would test the quickfix list and break out of the
command if necessary:

:w | thefunction() | [whatever]

That would be a lot less typing, but I couldn't find a command that
would do that. I could return 0, but I would have to test for that,
taking me back to square one.


function TestQF(command)
        if getqflist == []
                exe a:command
        endif
endfunc

then invoke it with

        :w | call TestQF('whatever')


Best regards,
Tony.
--
Life is a yo-yo, and mankind ties knots in the string.

--
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