Tuesday, August 16, 2011

functions in vim does't respond to % or %<

hey guys, I want to write a function in _vimrc to compile some source
code file .

For example, I want to use "set makeprg=javac\ %" to compile .java
file, and if there is no error I wanna vim to continue run the "java
%<", and if there are any errors , I wanna vim to open the quickfix
windows automatically. So , the problem is how to judge whether there
is error after compile . I wanna use vim's function filereadable() to
judge whether there is any error (if there is error , javac will not
create a class file ), but when I try to use this function, I found
that the function filereadable() can't receive arguments like % and
%<, the result is , ":echo filereadable("test.class")" is 1, but
":echo filereadable("%<.class")" is 0 .The current file I am editing
is test.java, so this confused me a lot .

I wonder whether fuctions like filereadable() can receive arguments
like % or %<, and anyone who can help me to write my own function ?
Thanks a lot .

sorry for my poor English , I hope you guys can understand what I
mean .


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