Mac Vim: How can I change the default text color to be green? Default font? Macvim manual?
Question
I have installed MacVim but I cannot figure out how to do some formatting things.
The screen shot below shows:
- the file class1.jak (custom file type I have defined) open in both macvim and vim
- the left one is macvim
- the right one is the terminal
Here is what I would like to do:
The default color of my terminal is green. I would like the default text color to be green for mac vim as well.
The font is strange in macvim. How can I change that.
I think that both of these are very basic macvim questions but I could not find a really good mac vim reference. I read the
:help macvim
but I didn't find it that helpful. What should I read to understand macvim formatting and features better? Is there a tutorial somewhere? I feel pretty happy with my vim skills in general but this is the first gvim I have used.
http://torch.cs.dal.ca/~summers/Picture%205.png
This is my .gvimrc
:
set background=dark
set go-=T
This is the color scheme for .jak files located in (~/.vim/syntax/jak.vim
):
16 "===============
17 " Titles
18 "===============
19
20 syn region JakeSubSubtitle start=+= + end=+ =\n+ oneline
21 highlight JakeSubSubtitle ctermfg=cyan guifg=cyan
22
23 syn region JakeSubtitle start=+== + end=+==+ oneline
24 highlight JakeSubtitle ctermbg=black ctermfg=DarkMagenta guifg=DarkMagenta
25
26 syn region JakeTitle start=+=== + end=+===+ oneline
27 highlight JakeTitle ctermbg=black ctermfg=Yellow guifg=yellow
28
29 syn region JakeMasterTitle start=+==== + end=+====+ oneline
30 highlight JakeMasterTitle cterm=bold term=bold ctermbg=black ctermfg=LightBlue guifg=LightBlue
31
32 "===============
33 " Keywords
34 "===============
35
36 syn keyword JakeKeywords AssQuestion Question TODO Answer JAKEHTTPS PossibleProblem Note done LowPrio
37 highlight JakeKeywords cterm=bold term=bold ctermbg=black ctermfg=blue guifg=blue
38
39 syn keyword JakeRedKeywords Priority HighPriority containedin=ALL
40 highlight JakeRedKeywords cterm=bold term=bold ctermbg=black ctermfg=Red
41
42 syn keyword JakeLongTermKeywords ReturnTo Ask containedin=all
43 highlight JakeLongTermKeywords ctermfg=lightGreen
Solution
For the font issue (in .gvimrc):
set guifont=Menlo:h11.00
will set the font in MacVim to Menlo, size 11.
As for the syntax highlighting, it might just be that the colorscheme you are using in console vim is not being picked up by MacVim:
colorscheme xoria256
Putting this command in .gvimrc will use the xoria256 colorscheme (for example). I have found that the colorscheme setting in .vimrc are not always picked up correctly.
OTHER TIPS
If you'd like to experiment with your font settings try
:set guifont=*
That will allow you to choose a font using the standard mac font window. Once you've found the font you like, type:
:set guifont=<tab>
It will show you what the current setting is for guifont. Then you can type that into your .gvimrc.
I'm not on a mac right now so I can't find the exact reference for you, but I found that while playing around in the menus, one can manually change some of these settings... and then to bring up the configuration file to see what those settings translate to in words. As a result, I was able to add these lines to my standard ~/.vimrc (which Macvim does read), in order to change the font:
set gfn=Monaco:h10
You should be able to find similar settings for colours very nearby. (I'll edit this answer when I get back to my mac to add more details... you'll have to wait ~6 hours though.)
You can change the font with this command:
set gfn=<your font settings>
The text color is a bit more complicated because it is syntax highlighting. But you can change this the same way you change the text color in any whatever version of vim you have used before. I use GVIM for Mac every day and I don't notice any differences between it and GVIM for Windows, for example. For color schema changes might I suggest this great script:
It should give you a lot of great color schemes to try, and any of them can be easily edited, so it's a good starting point. Good luck!
Long story short: :h :hi
(:h is a shortcut for :help, :hi for :highlight) and look for the guifg
.
In your custom color scheme you define only cterm
part - the guifg
, guibg
, etc are all missing. That's why VIM in GUI mode is using default colors from your color scheme (:h :colo
).