LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-18-2005, 10:35 PM   #1
daihard
Member
 
Registered: Jul 2003
Location: Seattle, WA
Distribution: Kubuntu 14.04 LTS
Posts: 915

Rep: Reputation: 34
Setting font for gVim


Hi.

I'm having trouble setting the GUI font for gVim. I hope someone can help me out.

I set the following in my ~/.vimrc file:
Code:
set guifont="Luxi Mono 9"
However, when I invoke gVim, it does not use that font. The "set guifont" command should also return "Luxi Mono 9," but it comes back blank.

Strangely, if I specify the same font through the command-line parameter, such as gvim -font="Luxi Mono 9", then gVim uses the appropriate font. The "set guifont" command returns the correct font name ("Luxi Mono 9"), too.

What am I doing wrong? Everything else I have in ~/.vimrc is working fine.

I would appreciate any help.

Dai
 
Old 09-19-2005, 03:08 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
I think you want to put the setting in the ~/.gvimrc which get executed when the GUI is started.
 
Old 09-20-2005, 12:18 AM   #3
daihard
Member
 
Registered: Jul 2003
Location: Seattle, WA
Distribution: Kubuntu 14.04 LTS
Posts: 915

Original Poster
Rep: Reputation: 34
Quote:
Originally posted by macemoneta
I think you want to put the setting in the ~/.gvimrc which get executed when the GUI is started.
Hi.

Thanks for the response. I tried that too, but it did not work either.

Anything else that you can think of?

Thanks again,
Dai
 
Old 09-20-2005, 12:38 AM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Got it. Remove the quotes. The command should be:

set guifont=Luxi Mono 9

When I tried with the quotes, it was ignored.
 
Old 09-20-2005, 01:27 AM   #5
daihard
Member
 
Registered: Jul 2003
Location: Seattle, WA
Distribution: Kubuntu 14.04 LTS
Posts: 915

Original Poster
Rep: Reputation: 34
Quote:
Originally posted by macemoneta
Got it. Remove the quotes. The command should be:

set guifont=Luxi Mono 9

When I tried with the quotes, it was ignored.
Thanks for the suggestion. I actually tweaked it a bit to get it working. Let me explain...

You were right about the quotes being ignored. However, the above syntax with no quotes gave an error like this:
Code:
Error detected while processing /home/dtoyama/.vimrc:
line    7:
E518: Unknown option: Mono
So instead of using quotes, I preceded each white space with a backslash, like this:
Code:
set guifont=Luxi\ Mono\ 9
That worked.
 
1 members found this post helpful.
Old 09-20-2005, 02:44 AM   #6
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,
i would like to link this tip to this thread.
it is a really complete information about setting font for vim in gui mode.
regards,
slackie1000
 
Old 09-20-2005, 03:17 AM   #7
sorin25
LQ Newbie
 
Registered: Sep 2005
Location: Romania/Bucharest
Distribution: Ferdora Core 3
Posts: 7

Rep: Reputation: 0
Or, you can use xfontsel to get a compatible font description.
This is one description for Luxi Mono
Code:
-*-luxi mono-medium-r-normal--17-120-*-100-*-0-microsoft-cp1252
 
Old 09-20-2005, 03:39 AM   #8
daihard
Member
 
Registered: Jul 2003
Location: Seattle, WA
Distribution: Kubuntu 14.04 LTS
Posts: 915

Original Poster
Rep: Reputation: 34
Quote:
Originally posted by sorin25
Or, you can use xfontsel to get a compatible font description.
This is one description for Luxi Mono
Code:
-*-luxi mono-medium-r-normal--17-120-*-100-*-0-microsoft-cp1252
Care to show me how to obtain the X11-type font description from a font name?
 
Old 10-07-2005, 05:09 AM   #9
windhair
LQ Newbie
 
Registered: Oct 2005
Posts: 16

Rep: Reputation: 0
This doesnt work in my vim 6.1 kde.
:set guifont=6x12 works
but it what I write in .gvimrc set guifont=6x12 seems have no effect.
what should I do?
 
Old 10-07-2005, 11:09 AM   #10
daihard
Member
 
Registered: Jul 2003
Location: Seattle, WA
Distribution: Kubuntu 14.04 LTS
Posts: 915

Original Poster
Rep: Reputation: 34
Quote:
Originally posted by windhair
This doesnt work in my vim 6.1 kde.
:set guifont=6x12 works
but it what I write in .gvimrc set guifont=6x12 seems have no effect.
what should I do?
I have my guifont variable defined in ~/.vimrc, not in ~/.gvimrc. It should not matter, but it may be worth trying...
 
Old 11-24-2005, 02:49 AM   #11
windhair
LQ Newbie
 
Registered: Oct 2005
Posts: 16

Rep: Reputation: 0
Thing not getting solved yet.
I thought I have a solution for the problem, but it doesnt.
What I used in is
Code:
autocmd BufEnter *.for source $HOME/.vimrcfor
And in the .vimrcfor I just add a line "set guifont=6x12".
It works well.
It seems that "set guifont" in .vimrc works only after the "source" or directly input with :set guifont=... after gvim startup, but no effect if I set it in .vimrc . And the other command in .vimrc work well, such as set hlsearch....

I dont'n know why? Can anyone give a hand?

Last edited by windhair; 11-24-2005 at 03:01 AM.
 
Old 11-24-2005, 03:48 AM   #12
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
You can use /etc/vim/vimrc.local too. But firstly, I do not know why, but you
should to comment the logical structure in the /usr/share/vim/vimrc. Last three
lines in it must be:
Code:
"if filereadable('/etc/vim/vimrc.local')
source! /etc/vim/vimrc.local
"endif
so that file will be executed anyway. Then you can add anything into above
local rc file.
 
Old 11-24-2005, 04:17 AM   #13
windhair
LQ Newbie
 
Registered: Oct 2005
Posts: 16

Rep: Reputation: 0
It doesnt work.

BTW. I installed Latex vim Suite, but the guifont neither works for latex nor for other type files.
 
Old 11-24-2005, 04:32 AM   #14
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
It works when you run the command by your hands, right? The 'source!' command
(by default in vimrc it does not contains exclamation point, did you add it?)
does exactly the same things, like you type them by yourself just after vim
runs. Did you add the char ':' in the begining of your local script line?
 
Old 11-24-2005, 04:43 AM   #15
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
Quote:
Originally posted by sorin25
Or, you can use xfontsel to get a compatible font description.
This is one description for Luxi Mono
Code:
-*-luxi mono-medium-r-normal--17-120-*-100-*-0-microsoft-cp1252
That will only work with gvim compiled against gtk+1.x. For gtk+2.x you need to use fontconfig names (i.e. "set guifont=CodingFontTobi1_euro\ 12").


Håkan
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Gvim font issue in Linux kseetharaman Linux - General 0 04-05-2004 09:38 AM
How to save the setting of gVim? ICO Linux - Software 4 02-07-2004 05:58 PM
Gvim font and tabwidth settings kazuni Linux - Software 2 11-16-2003 10:04 AM
How to change GVIM Menu font?? isarathkumar Linux - Software 0 07-11-2003 05:02 AM
Problem in GVIM menu Font isarathkumar Linux - Software 0 07-11-2003 12:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration