Macvim seems not to be reading my .vimrc

896 views
Skip to first unread message

Eric Weir

unread,
Jun 17, 2013, 1:25:54 PM6/17/13
to vim...@googlegroups.com

Getting macvim set up on a new computer. It seems not to be reading the .vimrc. E.g., when I change font size and restart macvim the change doesn't take effect. The .vimrc is in my user directory.

Thanks,
------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA USA
eew...@bellsouth.net

"The most important thing is the tee-shirt."

- Samara Alnafdage




Ben Fritz

unread,
Jun 17, 2013, 1:38:33 PM6/17/13
to vim...@googlegroups.com
On Monday, June 17, 2013 12:25:54 PM UTC-5, Eric Weir wrote:
> Getting macvim set up on a new computer. It seems not to be reading the .vimrc. E.g., when I change font size and restart macvim the change doesn't take effect. The .vimrc is in my user directory.
>

To see if Vim is reading ANY script, look at the output of the :scriptnames command.

Did you actually edit your .vimrc file in order to change font size? What was the "set guifont" line before and after your change? What does :echo getfontname() tell you before and after your change? Font is a little more complicated than other options, you might just be entering a bad string.

Bee

unread,
Jun 17, 2013, 2:00:19 PM6/17/13
to vim_use
What does this return?

:set guifont?

Bill

Eric Weir

unread,
Jun 17, 2013, 2:06:38 PM6/17/13
to vim...@googlegroups.com
On Jun 17, 2013, at 1:38 PM, Ben Fritz <fritzo...@gmail.com> wrote:

> On Monday, June 17, 2013 12:25:54 PM UTC-5, Eric Weir wrote:
>> Getting macvim set up on a new computer. It seems not to be reading the .vimrc. E.g., when I change font size and restart macvim the change doesn't take effect. The .vimrc is in my user directory.
>
> To see if Vim is reading ANY script, look at the output of the :scriptnames command.

Thanks, Ben.

The .vimc is the second script bering read out of a large group---50 plus.

> Did you actually edit your .vimrc file in order to change font size? What was the "set guifont" line before and after your change? What does :echo getfontname() tell you before and after your change? Font is a little more complicated than other options, you might just be entering a bad string.

Yes, I edited the .vimrc. Used the default mac text editor, textedit. :echo getfontname() returns nothing.

Regards,
------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA USA
eew...@bellsouth.net

"We do not inherit the earth from our ancestors,
we borrow it from our children."

- Chief Seattle

Bee

unread,
Jun 17, 2013, 2:07:56 PM6/17/13
to vim_use
On Jun 17, 11:00 am, Bee <fo...@calcentral.com> wrote:
> On Jun 17, 10:25 am, Eric Weir <eew...@bellsouth.net> wrote:
> > Getting macvim set up on a new computer. It seems not to be reading the .vimrc. E.g., when I change font size and restart macvim the change doesn't take effect. The .vimrc is in my user directory.
>...
> What does this return?
>
> :set guifont?

Using the font menu item does not change your .vimrc, you need to
edit.

I have this in .gvimrc, it will choose the first VALID font in the
comma separated list:

set antialias guifont=
\Menlo_Bold:h14,
\Lucida_Sans_Typewriter_Bold:h14,
\Courier_New_Bold:h14,
\Courier_Bold:h14,
\Monaco:h12,

I like to keep vim and gvim (MacVim) settings in separate files.

Bill

Eric Weir

unread,
Jun 17, 2013, 2:09:53 PM6/17/13
to vim...@googlegroups.com

On Jun 17, 2013, at 2:00 PM, Bee <fo...@calcentral.com> wrote:

> On Jun 17, 10:25 am, Eric Weir <eew...@bellsouth.net> wrote:
>
>> Getting macvim set up on a new computer. It seems not to be reading the .vimrc. E.g., when I change font size and restart macvim the change doesn't take effect. The .vimrc is in my user directory.
>
> What does this return?
>
> :set guifont?

Thanks, Bill.

guifont=Monaco:10

That's what it was before I made the change. The change was to Monaco:14

------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA USA
eew...@bellsouth.net

"It is the mark of an educated man to look for precision in
each class of things just so far as the nature of the subject admits."

- Aristotle, Nichomachean Ethics

Bee

unread,
Jun 17, 2013, 2:15:21 PM6/17/13
to vim_use
On Jun 17, 11:09 am, Eric Weir <eew...@bellsouth.net> wrote:
> On Jun 17, 2013, at 2:00 PM, Bee <fo...@calcentral.com> wrote:
> > On Jun 17, 10:25 am, Eric Weir <eew...@bellsouth.net> wrote:
> >> Getting macvim set up on a new computer. It seems not to be reading the .vimrc. E.g., when I change font size and restart macvim the change doesn't take effect. The .vimrc is in my user directory.
>
> > What does this return?
>
> > :set guifont?
>
> guifont=Monaco:10
>
> That's what it was before I made the change. The change was to Monaco:14

Should be:

Monaco:h14

Ben Fritz

unread,
Jun 17, 2013, 3:13:25 PM6/17/13
to vim...@googlegroups.com
On Monday, June 17, 2013 1:06:38 PM UTC-5, Eric Weir wrote:
> Yes, I edited the .vimrc. Used the default mac text editor, textedit. :echo getfontname() returns nothing.
>

I've never seen getfontname() return nothing.

Without arguments, getfontname() is supposed to return whatever font is actually being used by gvim, whether it was found in the guifont option, or is just the default font.

However it doesn't work if the GUI is not running. Did you run the ":echo getfontname()" command manually from gvim, after it is all the way started up, and not in your .vimrc, etc.?

Note, the best way to set a font, is to use the dialog, with ":set guifont=*"

Then you can make note of the exact font string used, by doing ":set guifont?" to echo it, and use that string in your .vimrc or .gvimrc.

Font strings differ greatly depending on the system Vim is running on.

Eric Weir

unread,
Jun 17, 2013, 5:55:04 PM6/17/13
to vim...@googlegroups.com

On Jun 17, 2013, at 3:13 PM, Ben Fritz <fritzo...@gmail.com> wrote:

> On Monday, June 17, 2013 1:06:38 PM UTC-5, Eric Weir wrote:
>
>> Yes, I edited the .vimrc. Used the default mac text editor, textedit. :echo getfontname() returns nothing.
>
> I've never seen getfontname() return nothing.
>
> Without arguments, getfontname() is supposed to return whatever font is actually being used by gvim, whether it was found in the guifont option, or is just the default font.
>
> However it doesn't work if the GUI is not running. Did you run the ":echo getfontname()" command manually from gvim, after it is all the way started up, and not in your .vimrc, etc.?

Thanks again, Ben.

I'm using macvim. I ran getfontname() from the command line.

> Note, the best way to set a font, is to use the dialog, with ":set guifont=*"
>
> Then you can make note of the exact font string used, by doing ":set guifont?" to echo it, and use that string in your .vimrc or .gvimrc.

I have this in my .vimrc: set guifont=Monaco:h14

When I do :set guifont? I get set guifont=Monaco:h10

Regards,
------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA USA
eew...@bellsouth.net

"With an ounce of willingness, everything can change."

- Kim




Eric Weir

unread,
Jun 17, 2013, 5:57:19 PM6/17/13
to vim...@googlegroups.com

On Jun 17, 2013, at 2:15 PM, Bee <fo...@calcentral.com> wrote:

>>> What does this return?
>>
>>> :set guifont?
>>
>> guifont=Monaco:10
>>
>> That's what it was before I made the change. The change was to Monaco:14
>
> Should be:
>
> Monaco:h14

That was a typo, Bill. That's what I actually have.

------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA USA
eew...@bellsouth.net

"Uncertainty is an uncomfortable position,
but certainty is an absurd one."

- Voltaire

Eric Weir

unread,
Jun 17, 2013, 6:00:17 PM6/17/13
to vim...@googlegroups.com

On Jun 17, 2013, at 2:07 PM, Bee <fo...@calcentral.com> wrote:

> Using the font menu item does not change your .vimrc, you need to
> edit.

I've been making my changes in the .vimrc.

> I have this in .gvimrc, it will choose the first VALID font in the
> comma separated list:
>
> set antialias guifont=
> \Menlo_Bold:h14,
> \Lucida_Sans_Typewriter_Bold:h14,
> \Courier_New_Bold:h14,
> \Courier_Bold:h14,
> \Monaco:h12,
>
> I like to keep vim and gvim (MacVim) settings in separate files.

For as long as I've been using vim I've set this in my .vimrc. Should I be doing it in the .gvimrc?

Steve Litt

unread,
Jun 17, 2013, 7:18:14 PM6/17/13
to vim...@googlegroups.com
On Mon, 17 Jun 2013 18:00:17 -0400
Eric Weir <eew...@bellsouth.net> wrote:

>
> On Jun 17, 2013, at 2:07 PM, Bee <fo...@calcentral.com> wrote:
>
> > Using the font menu item does not change your .vimrc, you need to
> > edit.
>
> I've been making my changes in the .vimrc.
>
> > I have this in .gvimrc, it will choose the first VALID font in the
> > comma separated list:
> >
> > set antialias guifont=
> > \Menlo_Bold:h14,
> > \Lucida_Sans_Typewriter_Bold:h14,
> > \Courier_New_Bold:h14,
> > \Courier_Bold:h14,
> > \Monaco:h12,
> >
> > I like to keep vim and gvim (MacVim) settings in separate files.
>
> For as long as I've been using vim I've set this in my .vimrc. Should
> I be doing it in the .gvimrc?

Eric,

A little experimentation would probably get you the answers you need.
But here's complete documentation on how to do this:

http://www.troubleshooters.com/linux/vifont.htm

SteveT

Bee

unread,
Jun 18, 2013, 12:53:38 AM6/18/13
to vim_use
On Jun 17, 3:00 pm, Eric Weir <eew...@bellsouth.net> wrote:
> On Jun 17, 2013, at 2:07 PM, Bee <fo...@calcentral.com> wrote:
>...
> > I like to keep vim and gvim (MacVim) settings in separate files.
> For as long as I've been using vim I've set this in my .vimrc.
> Should I be doing it in the .gvimrc?

Check the MacVim 'Preferences...' in the MacVim menu,
In the Advanced tab uncheck [ ] Enable Quickstart, or
uncheck all items for troubleshooting.

With [x] Enable Quickstart checked the .vimrc file is not reloaded
after changes.

QUIT (really... quit from the MacVim menu 'Quit MacVim', not just
clicking the window red dot) and restart MacVim and check the font
visually and with:

:set guifont?

If it is not fixed more troubleshooting:

I like the separation, terminal vim settings in .vimrc, gvim (MacVim)
in .gvimrc. That has helped me isolate some setting errors.

It may be that some plugin or a setting is clobbering your guifont
setting.

Use MacVim (TextEdit may not be pure plain text) to create a .gvimrc
with only:

:set guifont=Monaco:h14

Remove the guifont setting in your .vimrc, search for more than one
instance of guifont.

Then put 'finish' (without quotes) at the TOP of the .vimrc file so it
skips the remaining settings and only loads the .gvimrc.

If it is good, then you know it is something later in .vimrc.
Move the 'finish' down until you find the culprit.

Bill

Eric Weir

unread,
Jun 18, 2013, 7:26:39 AM6/18/13
to vim...@googlegroups.com

On Jun 18, 2013, at 12:53 AM, Bee <fo...@calcentral.com> wrote:

> Use MacVim (TextEdit may not be pure plain text) to create a .gvimrc
> with only:
>
> :set guifont=Monaco:h14
>
> Remove the guifont setting in your .vimrc, search for more than one
> instance of guifont.
>
> Then put 'finish' (without quotes) at the TOP of the .vimrc file so it
> skips the remaining settings and only loads the .gvimrc.
>
> If it is good, then you know it is something later in .vimrc.
> Move the 'finish' down until you find the culprit.

Thanks for the suggestions for diagnosis, Bill. Following them I found the culprit.

I use vundle to manage plugins. One of the plugins is 'sessions.' When 'finish' appears after the call for 'sessions' font type reverts from Monaco:h14 to Monaco:h10.

I have no idea what to do about that. I tried putting 'set guifont=Monaco:h14 after the call for 'sessions' but that had no effect.

------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA USA
eew...@bellsouth.net

"Any assurance economists pretend to with
regard to cause and effect is merely a pose."

- Emanuel Derman




Ben Fritz

unread,
Jun 18, 2013, 10:28:20 AM6/18/13
to vim...@googlegroups.com
On Tuesday, June 18, 2013 6:26:39 AM UTC-5, Eric Weir wrote:
>
>
> I use vundle to manage plugins. One of the plugins is 'sessions.' When 'finish' appears after the call for 'sessions' font type reverts from Monaco:h14 to Monaco:h10.
>
>
>
> I have no idea what to do about that. I tried putting 'set guifont=Monaco:h14 after the call for 'sessions' but that had no effect.
>

I don't know what 'sessions' is, but I assume it automatically saves and loads a Vim "session" file via :mksession automatically when exiting and entering Vim.

Try removing "options" from your 'sessionoptions' option in your .vimrc. It is there by default and a major annoyance to me. You might tweak 'sessionoptions' to make sure other things you don't want restored blindly are also not included.

Another note, and I almost suggested this, now I wish I had: if an option is set differently than you expect, you can do ":verbose set optionname?" to see not only what it is set to, but also what file set it to that value. This would have found the culprit more quickly I think.

Bee

unread,
Jun 18, 2013, 12:04:10 PM6/18/13
to vim_use
On Jun 18, 4:26 am, Eric Weir <eew...@bellsouth.net> wrote:
> On Jun 18, 2013, at 12:53 AM, Bee <fo...@calcentral.com> wrote:
> ...
> Thanks for the suggestions for diagnosis, Bill. Following them I found the culprit.
>
> I use vundle to manage plugins. One of the plugins is 'sessions.' When 'finish' appears after the call for 'sessions' font type reverts from Monaco:h14 to Monaco:h10.
>
> I have no idea what to do about that. I tried putting 'set guifont=Monaco:h14 after the call for 'sessions' but that had no effect.

session.zip 2.3.11 2013-06-06 7.0 Peter Odding
• Bug fix: Don't persist &go and &gfn when !has('gui'):
http://github.com/xolox/vim-session/commit/4664cc7

It looks like the problem has been addressed,
try upgrading to the latest version of session.vim

http://www.vim.org/scripts/script.php?script_id=3150

Bill

Bee

unread,
Jun 18, 2013, 12:24:12 PM6/18/13
to vim_use
Oops... I guess not... !has('gui')
This is a fix for non-gui vim.

Maybe you can use the MacVim menu

Edit > Font > Show Fonts

To select the font you want, and session.vim will save that setting
for you.

Anyone?
When do 'sessions' (made by session.vim) get sourced?
I would assume after .vimrc and .gvimrc.

This plugin would drive me nuts, it is like the [Mountain] Lion
settings to reopen all windows when restarting.

Bill


Eric Weir

unread,
Jun 18, 2013, 2:42:52 PM6/18/13
to vim...@googlegroups.com

On Jun 18, 2013, at 10:28 AM, Ben Fritz <fritzo...@gmail.com> wrote:

> I don't know what 'sessions' is, but I assume it automatically saves and loads a Vim "session" file via :mksession automatically when exiting and entering Vim.
>
> Try removing "options" from your 'sessionoptions' option in your .vimrc. It is there by default and a major annoyance to me. You might tweak 'sessionoptions' to make sure other things you don't want restored blindly are also not included.

I don't have anything in my .vimrc related to 'sessions' except a call for it in the 'bundle' configuration.

> Another note, and I almost suggested this, now I wish I had: if an option is set differently than you expect, you can do ":verbose set optionname?" to see not only what it is set to, but also what file set it to that value. This would have found the culprit more quickly I think.

Thanks, for this, Ben. It identified the file for me in which the .gvimrc setting is getting reset. It's the file in which 'sessions' saves the session. I basically have one session. Just use it over and over. When it's loaded it resets the font to whatever it was when the session was first saved.

I created a new session. It now has the font setting as set by my .gvimrc. Problem solved.

Thanks for your help, especially that last suggestion.

Sincerely,
------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA USA
eew...@bellsouth.net

"What is man without the beasts? If all the beasts were gone,
men would die from a great loneliness of spirit."

- Chief Seattle






Eric Weir

unread,
Jun 18, 2013, 2:53:24 PM6/18/13
to vim...@googlegroups.com

On Jun 18, 2013, at 12:24 PM, Bee <fo...@calcentral.com> wrote:

>> It looks like the problem has been addressed,
>> try upgrading to the latest version of session.vim
>>
>> http://www.vim.org/scripts/script.php?script_id=3150
>
> Oops... I guess not... !has('gui')
> This is a fix for non-gui vim.
>
> Maybe you can use the MacVim menu
> ….
> Anyone?
> When do 'sessions' (made by session.vim) get sourced?
> I would assume after .vimrc and .gvimrc.

I appreciate your following up on this with me, Bill.

It's not a bug. It's an artifact of the way I've been using 'sessions'---basically reusing the same session over and over. So when the saved session is sourced it sets the font to the value it had when the session was originally save.
So I started macvim without loading the session, recreated the session and saved it. Now the session has the font value set in my .gvimrc.

Hope I remember this next time I change something in my .gvimrc or .vimrc.

Thanks again,
------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA USA
eew...@bellsouth.net

Ben Fritz

unread,
Jun 18, 2013, 3:32:47 PM6/18/13
to vim...@googlegroups.com
On Tuesday, June 18, 2013 1:42:52 PM UTC-5, Eric Weir wrote:
>
> I don't have anything in my .vimrc related to 'sessions' except a call for it in the 'bundle' configuration.
>

Yes, I figured that. But Vim has an option called 'sessionoptions' which controls what actually gets saved in a session file. You can customize the value of this option in your .vimrc, if desired. See :help 'sessionoptions'.

However, I'm coming at this from the viewpoint of having a detailed .vimrc and a lot of plugins all setting options and mappings. I don't need to have Vim remember options in a session, because the options I like are already set in my .vimrc.

You may like having options remembered, because then you can simply set the option manually, and the auto-saved session file will remember it and restore it the next time you run Vim.

Still, you might want to at least look at :help 'sessionoptions' to see what is available for you to customize.

Eric Weir

unread,
Jun 19, 2013, 5:11:23 AM6/19/13
to vim...@googlegroups.com

On Jun 18, 2013, at 3:32 PM, Ben Fritz <fritzo...@gmail.com> wrote:

> But Vim has an option called 'sessionoptions' which controls what actually gets saved in a session file. You can customize the value of this option in your .vimrc, if desired. See :help 'sessionoptions'.
>
> However, I'm coming at this from the viewpoint of having a detailed .vimrc and a lot of plugins all setting options and mappings. I don't need to have Vim remember options in a session, because the options I like are already set in my .vimrc.
>
> You may like having options remembered, because then you can simply set the option manually, and the auto-saved session file will remember it and restore it the next time you run Vim.
>
> Still, you might want to at least look at :help 'sessionoptions' to see what is available for you to customize.

Thanks, Ben I will do it.

------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA USA
eew...@bellsouth.net

"Imagining the other is a powerful antidote to fanaticism and hatred."

- Amos Oz

Reply all
Reply to author
Forward
0 new messages