chrisbra / Colorizer

color hex codes and color names
547 stars 30 forks source link

Doesn't Automatically Color C Files #85

Closed hkdd closed 2 years ago

hkdd commented 4 years ago

VIM 8.2.1551

I've tried both:

let g:colorizer_auto_filetype='css,html,c' let g:colorizer_auto_color = 1

And when opening .c files it doesn't automatically color, but :ColorToggle does toggle it correctly. HTML files automatically color on opening.

thecaralice commented 3 years ago

Same with mplstyle. Also doesn't work at all without g:colorizer_auto_filetype (g:colorizer_auto_color doesn't work).

NVIM v0.5.0-885-gba13b94f5
Build type: RelWithDebInfo
LuaJIT 2.0.5
Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/johnm/.cache/yay/neovim-git/src/build/config -I/home/johnm/.cache/yay/neovim-git/src/neovim-git/src -I/usr/include -I/home/johnm/.cache/yay/neovim-git/src/build/src/nvim/auto -I/home/johnm/.cache/yay/neovim-git/src/build/include
Compiled by johnm@john-venue11pro7140
chrisbra commented 3 years ago

thanks, I'll have a closer look over the holidays.

chrisbra commented 3 years ago

Hm, I just checked and I cannot reproduce. Setting g:colorizer_auto_filetype will setup a filetype autocommand as can be seen here:

https://github.com/chrisbra/Colorizer/blob/879e6c69c0c02c4ef0f08b3955c60de16efd8fb8/plugin/ColorizerPlugin.vim#L82-L90

Can you check if this is there for you? Please show the output of :au FT_Colorizer_Plugin FileType and also :au FTColorizer

thecaralice commented 3 years ago

Same with mplstyle. Also doesn't work at all without g:colorizer_auto_filetype (g:colorizer_auto_color doesn't work).

NVIM v0.5.0-885-gba13b94f5
Build type: RelWithDebInfo
LuaJIT 2.0.5
Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/johnm/.cache/yay/neovim-git/src/build/config -I/home/johnm/.cache/yay/neovim-git/src/neovim-git/src -I/usr/include -I/home/johnm/.cache/yay/neovim-git/src/build/src/nvim/auto -I/home/johnm/.cache/yay/neovim-git/src/build/include
Compiled by johnm@john-venue11pro7140

Oh it's me being stupid and the reason is Vim not knowing mplstyle filetype

thecaralice commented 3 years ago

C files work for me, but when current filetype is not in g:colorizer_auto_filetype color only appears after I change something

chrisbra commented 3 years ago

can you give an example please?

thecaralice commented 3 years ago

File used in both examples:

# /tmp/col-test.py
awesome_color = "#c0ffee"

Now start vim and type the following:

:e /tmp/col-test.py
:%s/awesome/my_awesome/
mark2185 commented 3 years ago

In a somewhat related note, it doesn't work for the qf (quickfixlist) type either?

With these settings:

let g:colorizer_auto_color       = 1
let g:colorizer_auto_filetype    = 'qf'
let g:colorizer_disable_bufleave = 1

It starts colorizing only after I run :ColorHighlight manually in the qflist, by switching to another window it turns off (expected) and it turns back on when returning. But nothing unless I run it manually first.

chrisbra commented 2 years ago

Does that part of the documentation help here please? https://github.com/chrisbra/Colorizer/commit/e592848da3f58f426aed89aa525d46886f071085