Mac Vim:如何将默认文本颜色更改为绿色?默认字体? Macvim 手册?

发布于 2024-09-06 12:21:26 字数 2201 浏览 2 评论 0原文

我已经安装了 MacVim,但我不知道如何进行一些格式化操作。

下面的屏幕截图显示:

  • 文件 class1.jak (我定义的自定义文件类型)在 macvim 和 vim 中打开
  • 左边的是 macvim
  • 右边的是终端

这是我想要做的:

  1. 默认我的终端颜色是绿色。我希望 mac vim 的默认文本颜色也为绿色。

  2. macvim 中的字体很奇怪。我该如何改变它。

  3. 我认为这两个都是非常基本的 macvim 问题,但我找不到真正好的 mac vim 参考。我阅读了 :help macvim 但我发现它没有那么有帮助。我应该阅读什么才能更好地理解 macvim 格式和功能?某处有教程吗?总的来说,我对我的 vim 技能感到非常满意,但这是我使用的第一个 gvim。

http://torch.cs.dal.ca/~summers/Picture%205.png

这是我的 .gvimrc

set background=dark
set go-=T

这是位于 (~/.vim/syntax/jak.vim) 中的 .jak 文件的配色方案:

 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

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:

  1. The default color of my terminal is green. I would like the default text color to be green for mac vim as well.

  2. The font is strange in macvim. How can I change that.

  3. 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

对你的占有欲 2024-09-13 12:21:26

对于字体问题(在 .gvimrc 中):

set guifont=Menlo:h11.00

MacVim 中的字体设置为 Menlo,大小 11。

至于语法突出显示,可能只是 MacVim 没有选择您在控制台 vim 中使用的颜色方案:

colorscheme xoria256

将 .gvimrc 中的此命令将使用 xoria256 颜色方案(例如)。我发现 .vimrc 中的颜色方案设置并不总是正确选择。

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.

高速公鹿 2024-09-13 12:21:26

如果您想尝试一下字体设置,

:set guifont=*

可以尝试使用标准 Mac 字体窗口选择字体。找到您喜欢的字体后,请输入:

:set guifont=<tab>

它将显示 guifont 的当前设置。然后你可以将其输入到 .gvimrc 中。

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.

街角迷惘 2024-09-13 12:21:26

我现在不在 Mac 上,所以我无法为您找到确切的参考,但我发现在菜单中操作时,可以手动更改其中一些设置......然后调出配置文件以查看这些设置转化为文字的内容。结果,我能够将这些行添加到我的标准 ~/.vimrc (Macvim 会读取)中,以便更改字体:

set gfn=Monaco:h10

您应该能够在附近找到类似的颜色设置。
(当我回到我的 Mac 上添加更多详细信息时,我会编辑这个答案......不过,你必须等待大约 6 个小时。)

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.)

翻了热茶 2024-09-13 12:21:26

您可以使用以下命令更改字体:

set gfn=<your font settings>

Vim GFN 文档

文本颜色有点复杂,因为它是语法突出显示。但是您可以像在以前使用过的任何版本的 vim 中更改文本颜色一样更改此设置。例如,我每天都使用 Mac 版 GVIM,但我没有注意到它与 Windows 版 GVIM 之间有任何差异。对于颜色架构更改,我可能会建议这个很棒的脚本:

配色方案采样器包

它应该为您提供许多很棒的配色方案供您尝试,并且其中任何一个都可以轻松编辑,因此这是一个很好的起点。祝你好运!

You can change the font with this command:

set gfn=<your font settings>

Vim GFN documentation

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:

Color Scheme Sampler Pack

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!

小姐丶请自重 2024-09-13 12:21:26

长话短说::h :hi(:h 是 :help 的快捷方式,:hi 是 :highlight)并查找 guifg

在您的自定义配色方案中,您仅定义了 cterm 部分 - guifgguibg 等都丢失了。这就是为什么 GUI 模式下的 VIM 使用配色方案中的默认颜色 (:h :colo)。

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文