To make the usage of vim in cygwin convenient, I've added the color scheme in my cygwin .vimrc. But I found the color scheme doesn't work when vim is started.
So I did some investigations:
- My Cygwin indeed support
xterm-256color
. This is 256 color test script: - The Comment highlight style indeed setup in the .vimrc:
hi Comment ctermfg=239
- But the final Comment color scheme was loaded from
/usr/share/vim/vim74/syntax/syncolor.vim
- My .vimrc was indeed sourced, but the color part was replaced by syncolor.vim. Because syncolor.vim is sourced twice, and it's sourced at the end of vim startup. I'm using the
# vim -u ~/.cygwin/.vimrc --startuptime startup.log
to check the startup scripts as below:
times in msec
clock self+sourced self: sourced script
clock elapsed: other lines
000.003 000.003: --- VIM STARTING ---
000.076 000.073: Allocated generic buffers
000.124 000.048: locale set
000.127 000.003: clipboard setup
000.130 000.003: window checked
007.568 007.438: inits 1
007.576 000.008: parsing arguments
007.577 000.001: expanding arguments
007.623 000.046: shell init
008.543 000.920: Termcap init
008.562 000.019: inits 2
008.791 000.229: init highlight
016.569 001.641 001.641: sourcing /usr/share/vim/vim74/syntax/syncolor.vim
017.190 003.695 002.054: sourcing /usr/share/vim/vim74/syntax/synload.vim
043.658 024.373 024.373: sourcing /usr/share/vim/vim74/filetype.vim
044.007 032.170 004.102: sourcing /usr/share/vim/vim74/syntax/syntax.vim
045.527 000.074 000.074: sourcing /usr/share/vim/vim74/filetype.vim
047.319 000.182 000.182: sourcing /usr/share/vim/vim74/ftplugin.vim
049.047 000.151 000.151: sourcing /usr/share/vim/vim74/indent.vim
049.926 039.919 007.342: sourcing /cygdrive/c/Users/310258281/.cygwin/.vimrc
049.947 001.237: sourcing vimrc file(s)
053.216 001.338 001.338: sourcing /usr/share/vim/vimfiles/plugin/fzf.vim
058.199 000.224 000.224: sourcing /usr/share/vim/vim74/plugin/getscriptPlugin.vim
060.159 000.664 000.664: sourcing /usr/share/vim/vim74/plugin/gzip.vim
061.716 000.449 000.449: sourcing /usr/share/vim/vim74/plugin/logiPat.vim
062.920 000.166 000.166: sourcing /usr/share/vim/vim74/plugin/manpager.vim
064.748 000.545 000.545: sourcing /usr/share/vim/vim74/plugin/matchparen.vim
067.242 001.156 001.156: sourcing /usr/share/vim/vim74/plugin/netrwPlugin.vim
068.456 000.122 000.122: sourcing /usr/share/vim/vim74/plugin/rrhelper.vim
069.628 000.137 000.137: sourcing /usr/share/vim/vim74/plugin/spellfile.vim
071.121 000.530 000.530: sourcing /usr/share/vim/vim74/plugin/tarPlugin.vim
072.821 000.264 000.264: sourcing /usr/share/vim/vim74/plugin/tohtml.vim
074.253 000.478 000.478: sourcing /usr/share/vim/vim74/plugin/vimballPlugin.vim
075.695 000.465 000.465: sourcing /usr/share/vim/vim74/plugin/zipPlugin.vim
075.716 019.231: loading plugins
077.403 001.687: loading packages
077.839 000.436: loading after plugins
077.851 000.012: inits 3
078.628 000.777: reading viminfo
078.634 000.006: setting raw mode
078.652 000.018: start termcap
078.724 000.072: clearing screen
090.187 011.463: opening buffers
090.254 000.067: BufEnter autocommands
090.263 000.009: editing files in windows
092.323 000.474 000.474: sourcing /usr/share/vim/vim74/syntax/syncolor.vim
094.458 003.721: VimEnter autocommands
094.464 000.006: before starting main loop
094.627 000.163: first screen update
094.630 000.003: --- VIM STARTED ---
So simply speaking, vim works as below:
016.569 001.641 001.641: sourcing /usr/share/vim/vim74/syntax/syncolor.vim
049.926 039.919 007.342: sourcing /cygdrive/c/Users/310258281/.cygwin/.vimrc
092.323 000.474 000.474: sourcing /usr/share/vim/vim74/syntax/syncolor.vim
Why's that?
Oh, by the way, my environment:
- OS: Win10 64bit
- Cygwin: mintty 2.6.2 (x86-64-pc-cygwin)
- Vim in Cygwin: version 7.4.2367, Modified by