Rebooting vimrc causes different syntax highlighting

When I open the file in macvim, it looks like http://imgur.com/a/3cLqB#0 . I installed ,Vin :source ~/.vimrc<CR>.

After opening this file, I click ,V, and the syntax highlighting changes to http://imgur.com/a/3cLqB#1 . The difference is that (, ), ;, ,are blue, white, and ->, ., ?are blue, darker. Why is this happening? This is my vimrc file https://gist.github.com/pvinis/4979592

- Update page: I found out that Valloric/vim-operator-highlightthis is a plugin that changes colors. therefore, the first image is the correct image. I also found out that as soon as I do :syntax on, the colors are reset. Is there a way to check if syntax is enabled?

+5
source share
6 answers

I had something very similar to this. I was able to solve this by making sure they were in the correct order:

syntax on
let g:solarized_termtrans=1
let g:solarized_termcolors=256
set background=dark
colorscheme solarized

I also used this to reboot

augroup reload_vimrc
autocmd!
autocmd BufWritePost $MYVIMRC source $MYVIMRC
augroup END

vimrc . iTerm2 Terminal vim. , - , , . , . , , .

+2

:

.vimrc . , . , highlight links , highlight groups .

hi links groups on:

:
( . :wa ) Reloading mess!

, , , hi . colorscheme <your-coloscheme> , Vimscript . , - .

vimrc:

vim reload.vim:
.vimrc:

" .....
augroup reload_vimrc " {
    autocmd!
    autocmd BufWritePost ~/.vim/*.vim,~/.vim/vimrc source ~/.vim/reload.vim
augroup END " }

reload.vim:

hi vimrc.
, . SignColumn, :
:hi SignColumn, .

( xxx - ): hl SignColumn

hi.
SignColumn, solarized.
GitGutter:
, GitGutterAdd GitGutterAddDefault, , GitGutterAddDefault DiffAdd , . .

reload.vim:

source ~/.vim/vimrc

hi SignColumn ctermfg=12 ctermbg=0 guifg=Cyan guibg=Grey

" GitGutterAdd -> GitGutterAddDefault (preserved)
hi link GitGutterAddDefault DiffAdd

" GitGutterChange -> GitGutterChangeDefault (preserved)
hi GitGutterChangeDefault ctermfg=3 ctermbg=0 guifg=#bbbb00

" GitGutterDelete -> GitGutterDeleteDefault (preserved)
hi GitGutterDeleteDefault ctermfg=1 ctermbg=0 guifg=#ff2222

" GitGutterChangeDelete -> GitGutterChangeDefault (preserved)
" (which we already fixed above)

" Powerline highlight groups
" (see this attached Gist for solution)

, : Fix hi groups and links

powerline-status colors:

, . powerline Pl_. , , . , visual, . , insert, visual normal , , . hl. reload.vim hl.

, . gist reload.vim gifs, .

+2

, / . :colorscheme . ColorScheme :autocmd, .

, :colorscheme :

if ! exists('g:colors_name') || g:colors_name !=# 'Tomorrow-Night-Eighties'
    colorscheme Tomorrow-Night-Eighties
endif
+1

"auto reload vimrc once changed
if has("autocmd")
  autocmd! BufWritePost .vimrc source $MYVIMRC

  " This fixes the color changes and things not working :D
  autocmd! BufWritePost .vimrc filetype plugin indent on
endif
+1

, , , StackOverflow Google.

: Solarized .vimrc , , Solarized.

.vimrc :

set background="dark"
let g:solarize_termcolors=256
colorscheme solarized

? :

set background=dark

.vimrc . , -. , , , , , .

0

I have absolutely no idea why (perhaps for the same reason as when working with :source ~/.vimrcmanual), but for me the replacement

autocmd BufWritePost *vimrc,*exrc :source %

with

autocmd BufWritePost *vimrc,*exrc :call feedkeys(":source %\<cr>")

fixed the problem for me.

0
source

All Articles