On Mar 16, 2014 8:53 PM, "Ivan" <ivan.brennan@gmail.com> wrote:
>
> I wrote a function in my vimrc that builds my statusline (I use it to toggle certain elements). The function call occurs earlier in the file than the actual definition, and I wondered whether that would be a problem, but when I started up MacVim it all worked fine. In terminal Vim however, I get an error on startup (E117: Unknown function: BuildStatusLn), though it still works fine.
It is not possible to call function before it is defined. You must be mistaking about when this function gets called. If you have something like
set statusline=%!BuildStatusLn()
then function *will* be called when statusline is drawn, but it is not called *when this line is parsed*. I guess that in MacVim statusline draw is deferred until gui initialization (which happens after vimrc loading) and in terminal it is drown immediately when you set this option.
>
> Is there a way around this? Is it bad practice? Does anyone know why it's not raising an error in MacVim?
>
> --
> --
> 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 because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment