I have tried well over 15 different colorschemes for vim. I have made all of the correct settings for full color support in terminal. This 'problem' persists in both terminal and gvim. Perhaps it is not a bug and simply the design of the colorschemes themselves, but only one colorscheme I have tried actually has decent highlight support. For example:
In this python class all of the colorschemes will only highlight a couple of things.
wombat only highlights comments and the if.
molokai is extremly dissapointing but at least gets the ints
All of the themes I try are similar to these two except 'Crayon' which compares like so:
Most of the vim color-scheme github pages show previews with highlight support compared to crayon. My question is what might be causing this problem? or is this just the design of the themes themselves?
Syntax highlighting is the combination of two things:
syntax definition, provided by syntax scripts typically found in syntax/ or after/syntax/,
highlighting definition, provided by colorschemes typically found in colors/.
The former defines syntax groups, the latter defines how those groups look.
But those almost never come in pairs so there's no guarantee whatsoever that every possible syntax group is properly handled by every possible colorscheme.
If a colorscheme you like doesn't handle some of the syntax groups you expect it to handle, open an issue or (better) patch it.
Related
I have installed spf13-vim plugin and when I set :color molokai the following orange highlighting occurs;
Does anyone know which setting I need to change to disable the highlighting?
It's not the result of a search, that was my first guess! It doesn't seem confined to any one particular object type either as you can see from the picture.
You need to find out which syntax group causes the highlighting. :syn list shows all active groups, but it's easier when you install the SyntaxAttr.vim - Show syntax highlighting attributes of character under cursor plugin. When you have the name of the offending syntax group, you can investigate where it comes from; (the last lines of) :scriptnames may help.
PS: Vim "distributions" like spf-13 and Janus lure you with a quick install and out-of-the-box settings, but you pay the price with increased complexity (you need to understand both Vim's runtime loading scheme and the arbitrary conventions of the distribution) and inflexibility (the distribution may make some things easier, but other things very difficult). Vim is incredibly customizable, using someone else's customization makes no sense.
I have a problem with search highlighting in vim. I have used it before but currently it does not work at all.
I have entered :set hlsearch, which is also in my .vimrc file.
I have entered :set hlsearch? and the result is hlsearch, indicating that I have successfully turned the option on. (right?)
I am running vim and not vi, so that is not the problem.
I have searched around but only found people asking about turning OFF search highlighting.
I would appreciate any input as this has been driving me nuts. Thanks!
Edit: highlighting also doesn't work for spellcheck, so evidently it's something global about highlighting.
When you have problems with multiple highlightings (like search and spell in your case), first check the defined highlightings with
:hi
If any groups are wrong or off, check your :colorscheme, and maybe try another.
In the console, color problems are often related to the number of available colors, a hairy problem. Check with
:set t_Co?
Another good tool for checking problems with individual syntax items is the SyntaxAttr.vim - Show syntax highlighting attributes of character under cursor plugin.
I have a bit of a strange problem with [La]TeX syntax highlighting in vim. vim seems to randomly switch between three different syntax highlighting styles, with little rhyme or reason. It doesn't appear to do this for other languages, though I haven't written anything except LaTeX (using syntax highlighting) for a while now.
So: a bit of background. This problem started becoming noticeable when I switched terminal emulators (to urxvt), but it also appears in roxterm, konsole, and gnome-terminal.
Playing around with the value of the TERM environment variable does appear to affect the result: changing TERM from the default of rxvt-unicode-256color to xterm or linux appears to make vim not choose the third, but the first two appear to be selected at random.
I've done some Googling, to no avail. My google-fu is perhaps weak, and I apologize if this is a common problem that I've managed to overlook . . .
For reference, what the three styles look like in a sample document:
Any thoughts or suggestions would be much appreciated.
According to this website, for TeX files, Vim scans the file and guesses whether it is LaTeX, ConTeXt, or plain TeX based on the keywords used therein. Now this is a guess, but maybe every once in a while, while you're editing, you're adding or removing some keyword that is causing it to change its guess each time.
I'm making a colorscheme for Vim and have a command that allows me to view the 'scope' of a attribute to highlight, but I need some of the general attributes (background, line numbers, etc.) so I can properly create my scheme. Is there any good cheat sheets or lists of some of the attributes? I checked all the Vim documentation and wikis but they don't list many things that affect the editor itself.
Yes, there is such a list. All you need is in Vim's awesomely-exhaustive-but-sometimes-cryptic documentation: :help syntax, more specifically :help highlight-default for a list of default highlight groups. If something is not there it probably means that it can't be done or that it's custom/syntax-dependant.
You could also open a pre-existing colorscheme and see how it's done. It's actually not that complicated to understand how the syntax works.
Good luck and make sure to share your colorscheme with the community when it's ready.
May be you'll find useful this colorscheme: http://www.vim.org/scripts/script.php?script_id=106 .
Here is the description given by author:
The philosophy here is to provide a ready-to-uncomment list of highlight commands for all the important groups. Then you can deviate from the default until you come up with one you like.
I want to used different colorschemes for different filetypes and I added the following code in my .vimrc
function SetColorScheme ()
if &filetype != "vo_base"
colorscheme desertEx
endif
endfunction
au WinEnter * call SetColorScheme()
This works fine with one issue.
If I open a .otl file, say todo.otl (vo_base), and then open another file, say example.xml, using :sp the colorscheme desertEx does not get applied to the second window (the one having example.xml).
If I use BufEnter instead of WinEnter than desertEx gets applied to both the windows.
Is there a way to make sure that when I open a window with :sp the above function (a) runs, and (b) runs only for that particular window and not all the windows in the current session.
No there's no way to do that. There can be only one active colorscheme at the same time in vim.
Something that comes to mind is to create a color scheme that directly points to the low-level syntax groups in the Vim syntax files.
Take for instance c.vim for the C programming language. You will find for instance syntax hightlighting groups such as: cStatement, cLabel, cConditional, cType.. etc.
Take python.vim and you will find pythonDefStatement, pythonFunction, pythonConditional, etc..
So, if you want to use different color schemes for C code and python, you would copy the two original color schemes to ~/.vim/colors/mycolorscheme.vim and edit them to point to the low-level syntax groups instead of the generic high level groups such as Comment, Constant, Error, Identifier, etc. that are found in many available color schemes.
Note that you would probably want keep a default stanza of 'highlight' statements on top of these other two to take care of syntax highlighting for files that contain neither C nor python code.
To clarify, you could edit the celebrated 'Hello World' code and issue the following from the Vim command line:
:hi cInclude ctermfg=cyan guifg=cyan
You have not changed color schemes, other files displayed in other windows or tabs are unaffected, and yet the '#include' is now displayed in a different color.
Unless you absolutely need the feature, I would advise against it, because it pretty much breaks Vim's syntax highlighting. Besides, it will require significant work to convert the existing ':hi' statements comprised in the original color schemes because there are usually many low-level syntax highlighting groups.
A somewhat better approach might be to link the language-specific low level groups to high-level groups that are also specific to each language. This would help keep the custom color scheme file reasonably small, but requires additional inventory work.