vim-css-color icon indicating copy to clipboard operation
vim-css-color copied to clipboard

Add documentation for enable/disable/toggle

Open ap opened this issue 9 years ago • 6 comments

And I guess also for how to write support for new filetypes and the fact that you can have them in your .vim/after independently of the filetypes supported by the plugin.

ap avatar Oct 24 '16 19:10 ap

I second this. I want move to this plugin, but there is no documentation for me to fallow, or instructions leading me to the name of the help file.

BubbatheVTOG avatar Oct 20 '17 20:10 BubbatheVTOG

@BubbatheVTOG: The short answer is, look at :set filetype? in the file where you want to enable vim-css-color, and if for example it says foo, then make a file ~/.vim/after/syntax/foo.vim that looks like one of the files in the plugin’s after/syntax/.

ap avatar Nov 05 '17 21:11 ap

Is there any way to disable it at the moment?

I couldn't see one, so today I added this to the top of css_color#init():

	if get(g:, 'css_color_disabled', 0) || get(b:, 'css_color_disabled', 0)
		return
	endif

Although it might be more appropriate at the top of s:create_matches()


(Why did I need it? I was opening a handlebars (.hbs) file and Vim was calling css_color#init() multiple times, making it really slow to load the file. Disabling the plugin for those files was a quick and easy fix. It could be an issue with other plugins I am running. I get quite a lot of calls when loading .markdown files too. But when I open a .json file, I see only: hex, css, css, and for .vimrc and .yaml files, only hex. This is likely exacerbated by other plugins, something I could try to narrow down, but if I find out otherwise I will open a new issue.)

joeytwiddle avatar May 26 '18 18:05 joeytwiddle

There is css_color#disable() to turn it off in the current buffer, but no way to prevent it from being loaded in a buffer.

ap avatar May 27 '18 09:05 ap

Is there a way to toggle it with a single mapping? EDIT:css_color#toggle() seems to work.

psmolak avatar Aug 05 '18 12:08 psmolak

Is there a way to turn it on for the current file without having to create a file at ~/.vim/after/syntax/foo.vim?

Currently, there's no css_color#toggle() function defined for me (a Markdown file opened in nvim v0.4.3).

mb720 avatar Feb 17 '20 17:02 mb720