I can change the font size with set guifont=FixedsysTTF Monospace:h13 inside Vim and works perfectly.
However when I put this inside ~/.vimrc it stays the same font size no matter what size I set it to, and it's really small.
Here is the screenshot of the problem:
I didn't catch a space in the font name. It must be escaped:
set guifont=FixedsysTTF\ Monospace:h13
Related
I want to mention font-size bigger in .profile file, so that when I open a file using vi / vim editor font become larger. What I need to do in .profile ?
To change the font size, you can use either xfontset or guifontset depending on your needs.
You should specify this in your vimrc file. it should be at ~/.vimrc
I am configuring macvim on Mac OS X Mavericks. I type "set guifont=Menlo\ 14" in both ~/.vimrc and ~/.gvimrc but the editor remains displaying in courier.
I insert ":set guifont?" and it reveals "guifont=Menlo\ 14". I overviewed the content of .vimrc and .gvimrc but found no other line overriding the guifont setting.
I have checked several posts in stack overflow but cannot yet find the solution. Wish to get some help, thanks for anticipation.
The ideal way of going about doing this is by invoking the following command from vim :
set guifont=*
That will open a font selection dialog box and you can select whatever you would like there. Once done, you should then check what the option was set to by using the command you mentioned yourself :
set guifont?
Now you should put the output of that in your .gvimrc (not .vimrc) and additionally you'll need to escape the spaces like you're doing already. There might be subtle mistakes in what you're setting yourself, the font size for instance can sometimes be set in different ways.
On my version of MacVim (7.4.258) and running EL Kapitan, putting
set guifont=*
in .vimrc caused MacVim to spit out the following error (when run from the command line, starting it from the Dock caused it to just not run at all):
E665: Cannot start GUI, no valid font found
So it seems the correct way is to start MacVim, use the Edit > Font > Show Font menu, pick a font, then use
set guifont?
to find the line to add to your .vimrc
Also remember to use forward slashes to escape any spaces in the font name.
To change font, use Edit -> Font -> Show Fonts and selected a font.
Unfortunately this setting gets wiped out with each update of MacVim.
To have your font setting persisted in MacVim add this to your ~/.gvimrc
set guifont=Hack\ Nerd\ Font:h12
In gvim small paddings on the right and bottom sides of a window can appear. Particularly when gvim window is maximized. For example, here is what my bottom-right corner of gvim looks like when I maximize gvim window:
http://imgur.com/0lAYU
So is there anything I can do with these paddings? For example, move the actual editing area so paddings spread evenly from all four sides of gvim window instead of being only from two sides. Does any section of the manual contains the description of them? There is no real issue here, I'm just curious.
EDIT: I'm asking about the Linux version of gvim. I don't know how gvim behaves in similar situation in Windows or on Mac.
A common fix is to "hack" GTK so that GVim's window background is the same color as the background of your colorscheme. It's obviously less than ideal (you'd have to change it each time you try a new colorscheme) but it works reliably.
Put this code:
style "vimfix" {
bg[NORMAL] = "#202020" # this matches my gvim theme 'Normal' bg color.
}
widget "vim-main-window.*GtkForm" style "vimfix"
in this file:
~/.gtkrc-2.0
Put this in your .gvimrc:
set ghr=0
:help guiheadroom
'guiheadroom' 'ghr' number (default 50)
global
{not in Vi} {only for GTK and X11 GUI}
The number of pixels subtracted from the screen height when fitting
the GUI window on the screen. Set this before the GUI is started,
e.g., in your gvimrc file. When zero, the whole screen height will
be used by the window. When positive, the specified number of pixel
lines will be left for window decorations and other items on the
screen. Set it to a negative value to allow windows taller than the
screen.
I was tipped off to this solution on ArchWiki.
You can adjust the lines and columns options. For example:
:set lines=1000
:set columns=1000
You can find out about these with :help lines and :help columns.
Well, the reason it's there is because windows is forcing it to a size other than it's normal size plus an integer number of character sizes. As far as I know the people who wrote gvim didn't bother to add a centered option.
I have a problem with a setting in my gvimrc. I like to always have all windows the same size so I specify the following:
set lines=90
set columns=90
This works fine except when I open gvim with the -p argument for multiple tabs. The statusline and ruler are hidden until I manually resize the window. This only happens when the lines/columns are specified AND I use the -p argument. Is there a way to prevent this on startup other than manually dragging the window around to redraw the ruler/statusline?
I'm using gvim 7.3.154 in ubuntu 11.10.
The solution to this is actually spelled out when reading the gvim documentation on 'lines', see :help lines.
from :help lines
"If you get less lines than expected, check the 'guiheadroom' option.
When you set this option and Vim is unable to change the physical
number of lines of the display, the display may be messed up."
I was able to set guiheadroom=100 on my system and avoid this problem completely. The 100 was just a guess on my part. The default value for this is 50, so if you run into this problem you should set it to something > 50. I was able to go as small as 80, but your mileage will most likely vary depending on your OS, window manager, etc.
I wanted to add a UTF-8 font in Gvim but I could not find out how to do this.
I tried to follow the step on this manual but it still did not work.
http://www.inter-locale.com/whitepaper/learn/learn_to_type.html (vim section halfway the page)
Can anyone tell me how to add a font in Vim so I can have Japanese characters displayed ?
As others note, you must use a fixed-width font. Vim is a text editor, not a WYSIWYG editor.
If you have a fixed-width font with the characters you need then:
:set guifont=*
Select the font you want to use, the size, etc. Once you're happy with it, do:
:set guifont?
And it will output the current setting of the value. Put the set guifont=foo in your .gvimrc (or in .vimrc with a if has("gui_running") block).
set guifont=<C-R>=&guifont<CR>
That will put the current value into the file.
For Windows, I found using the guifontwide setting provided the expected functionality (i.e. mixed character display: Japanese, Chinese and English in the same file). This is not intuitive or obvious (at least not to me!) from the Vim help files, but having something like this in your startup settings will work:
set guifont=Consolas:h10
set guifontwide=MingLiU:h10 "For windows to display mixed character sets
set encoding=utf-8
Quote from the vim documentation:
For MS-Windows, some fonts have a limited number of Unicode characters. Try
using the "Courier New" font. You can use the Edit/Select Font... menu to
select and try out the fonts available. Only fixed-width fonts can be used
though. Example:
:set guifont=courier_new:h12
So, I guess, unless you find a fixed width font containing the characters you want to display, then you are out of luck.
This is what I use...
set gfn=MingLiU:h16:cDEFAULT
set fenc=utf-8
set encoding=utf-8
Put this in your _vimrc file, exit and reopen. Works like a charm for me.
+T
You have to use a fixed-width font for Gvim under Windows.
There are several relevant pages at the Vim Tips Wiki:
Working with Unicode
Setting the guifont
The perfect programming font