I adapted your code a bit, it does exactly what i want :o)
I don't know why, but all my errors where "not valid", so your code didn't work.
Instead, i just told it to open a new tab and do copen (and cfile), if there was more than 1 element in qflist (if there is just one, it's "Syntax OK").
I ended up with this :
function MakeWithCopenAndCfileInNewTab()
make
let qflist = getqflist()
if len(qflist)>1
tabnew
copen
cfile $ERROR_FILE
else
call TellSyntaxOk()
endif
endfunction
function TellSyntaxOk()
call inputsave()
let name = input("SYNTAX OK ! \npress Enter...")
call inputrestore()
endfunction
The only way i could imagine to improve it now, would be by closing the current tab at the end of the function,
IF there is no syntax error
AND
IF the current tab contains the Quicklist List window.
But i have no idea how to do this :D
And what i have now (thanks to you) feels quite magical and amazing already.
Once again, thank you
pierre / mascip
On 14 July 2012 19:03, Marc Jessome <marc.jessome@gmail.com> wrote:
The addition of "set switchbuf=useopen" to my vimrc has gotten me the
behaviour that I was looking for without any other modifications.
Thanks for the help!
Marc
On Sat, Jul 14, 2012 at 6:15 AM, John Beckett <johnb.beckett@gmail.com> wrote:
> Marc Jessome wrote:
>> I'm writing a script that will allow for what I feel is a
>> more comfortable :make + :copen behaviour. Essentially what I
>> am writing is a function that will run :make!, and check if
>> there are errors.
>
> It's not quite what you want, but are you aware that :cw
> opens the quickfix window, but only if there are errors?
>
> Check your 'switchbuf' option which (I think) may be responsible
> for jumping to the already open buffer in a window in another
> tab.
>
> John
>
> --
> 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
--
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
mascip@gmail.com
http://lesrikikibians.fr
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
No comments:
Post a Comment