Sunday, November 4, 2012

Re: sourcing functions in file with has gui_running from .vimrc

On 23:40 Sat 03 Nov , Chris Lott wrote:
> Currently running:
>
> VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Sep 1 2012 18:08:47)
> MacOS X (unix) version
> Included patches: 1-646
> Compiled by Bjorn Winckler <bjorn.winckler@gmail.com>
>
> I have these lines in my .vimrc
>
> if has("gui_macvim")
> source ~/.vim/vimrc/mygfuncs.vim
> endif
>
> In the mygfuncs file are some functions that set the `guitablabel` and
> `guitabtooltip` based on two custom functions. The file is being
> sourced (because the functions are defined), but the lines that set
> those variables using those functions aren't working:
>
> set guitabtooltip=%{GuiTabToolTip()}
> set guitablabel=%{GuiTabLabel()}
>
> At this point, the variables are set properly, because if I
>
> :set guitabtooltip
>
> Vim responds with
>
> guitabtooltip=%{GuiTabToolTip()}
>
> But it isn't actually being applied.
>
> **But** if I then `:so ~/.vimrc`, the tab label and tooltips *are* applied.
>
> What is going on here?
>
> c
> --
> Chris Lott <chris@chrislott.org>
>
> --
> 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

The way to set an option from a value returned by a function is:

let &guitabltooltip=GuiTabToolTip()

if you want to set local value (like setlocal does) you could use:

let &l:guitabtooltip=GuiTabToolTip()

You can read about it in ":help :let-&". You can also use the short
name of an option. &guitabtooltip is just a VimL variable. There is
also &g:guitabtooltip which will work like using the :setglobal command.

Best,
Marcin

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