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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
09-18-2005, 10:35 PM
|
#1
|
Member
Registered: Jul 2003
Location: Seattle, WA
Distribution: Kubuntu 14.04 LTS
Posts: 915
Rep:
|
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
|
|
|
09-19-2005, 03:08 PM
|
#2
|
Senior Member
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
|
I think you want to put the setting in the ~/.gvimrc which get executed when the GUI is started.
|
|
|
09-20-2005, 12:18 AM
|
#3
|
Member
Registered: Jul 2003
Location: Seattle, WA
Distribution: Kubuntu 14.04 LTS
Posts: 915
Original Poster
Rep:
|
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
|
|
|
09-20-2005, 12:38 AM
|
#4
|
Senior Member
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
|
Got it. Remove the quotes. The command should be:
set guifont=Luxi Mono 9
When I tried with the quotes, it was ignored.
|
|
|
09-20-2005, 01:27 AM
|
#5
|
Member
Registered: Jul 2003
Location: Seattle, WA
Distribution: Kubuntu 14.04 LTS
Posts: 915
Original Poster
Rep:
|
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.
|
09-20-2005, 02:44 AM
|
#6
|
Senior Member
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037
Rep:
|
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
|
|
|
09-20-2005, 03:17 AM
|
#7
|
LQ Newbie
Registered: Sep 2005
Location: Romania/Bucharest
Distribution: Ferdora Core 3
Posts: 7
Rep:
|
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
|
|
|
09-20-2005, 03:39 AM
|
#8
|
Member
Registered: Jul 2003
Location: Seattle, WA
Distribution: Kubuntu 14.04 LTS
Posts: 915
Original Poster
Rep:
|
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?
|
|
|
10-07-2005, 05:09 AM
|
#9
|
LQ Newbie
Registered: Oct 2005
Posts: 16
Rep:
|
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?
|
|
|
10-07-2005, 11:09 AM
|
#10
|
Member
Registered: Jul 2003
Location: Seattle, WA
Distribution: Kubuntu 14.04 LTS
Posts: 915
Original Poster
Rep:
|
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...
|
|
|
11-24-2005, 02:49 AM
|
#11
|
LQ Newbie
Registered: Oct 2005
Posts: 16
Rep:
|
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.
|
|
|
11-24-2005, 03:48 AM
|
#12
|
Member
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666
Rep:
|
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.
|
|
|
11-24-2005, 04:17 AM
|
#13
|
LQ Newbie
Registered: Oct 2005
Posts: 16
Rep:
|
It doesnt work.
BTW. I installed Latex vim Suite, but the guifont neither works for latex nor for other type files.
|
|
|
11-24-2005, 04:32 AM
|
#14
|
Member
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666
Rep:
|
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?
|
|
|
11-24-2005, 04:43 AM
|
#15
|
Senior Member
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 04:00 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|