开发者

Why doesn't VIM recognize a color totally available?

开发者 https://www.devze.com 2023-03-21 15:48 出处:网络
This is myste开发者_开发问答ry drives me crazy: I am trying to specify certain colors that are listed inside gVim 7.3 when running this script.

This is myste开发者_开发问答ry drives me crazy: I am trying to specify certain colors that are listed inside gVim 7.3 when running this script.

But when put in a .vim syntax file, gVim simply issues an error "Color name not recognized". This happens even with simple colors like orange. Instead, it only recognizes a few colors like red, blue, yellow, darkyellow, darkgreen, black, etc.

Why does this happen and how to workaround this?


Because, as a terminal program vim only supports ANSI colors by default. http://en.wikipedia.org/wiki/ANSI_escape_code#Colors

I don't know enough about syntax files to fully answer, but these links might be useful http://vim.wikia.com/wiki/256_colors_in_vim http://vim.wikia.com/wiki/View_all_colors_available_to_gvim

It's possible that only the normal colors are available to syntax files from there you can use a different color scheme to reassign the normal colors. http://vimcasts.org/episodes/creating-colorschemes-for-vim/


I ended up solving the problem by hard coding the offending color (orange) in the .vim file:

hi def MyOrange_color ctermfg=202 guifg=#ff5f00
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号