문제

나는 종종 ColorsCheme에서 조금만 바뀌고 싶어하지만 원본 파일을 편집하고 싶지는 않습니다. 나는 '~/.vim/after/colors/blah.vim'에 나의 변화를 시도했지만 그것은 나에게는 효과가 없다.


예를 들어, 나는 busybee.vim에서 cursorline 하이라이트를 변경하고 싶습니다 ..

~/.vim/colors/busybee.vim

'~/.vim/after/colors/busybee.vim'파일을 만들고 다음을 추가합니다.

hi CursorLine    guibg=#000000 ctermbg=Black cterm=none

그러나 나는 변화가 보이지 않습니다. 물론 원래 Busybee.vim의 선을 바꾸면 작동하지만 말한 것처럼 그렇게하지 않기를 원합니다.

행위...

:colo Busy<TAB>

나와 ...

BusyBee  BusyBee
도움이 되었습니까?

해결책

살펴보십시오 애프터 콜러 .VIM, 그것은 당신이 당신을 사용할 수있게합니다 ~/.vim/after/colors/BusyBee.vim 방법.

다른 팁

당신은 오늘 내가 무엇을 찾고 있는지 물었습니다. 여기에 제시된 것보다 더 간단한 솔루션을 찾았습니다. 나는 테마의 검은 배경 대신 투명한 배경을 원하고 단순히 colorscheme 진술 .vimrc 작동하지 않고 플러그인을 설치하는 것이 이상합니다. 여기에 내가 한 일은 다음과 같습니다.

autocmd ColorScheme * highlight Normal ctermbg=None
autocmd ColorScheme * highlight NonText ctermbg=None

왜 작동합니까? Vim이 당신의 것 외에 무언가를하는 것 같아요 colorscheme 진술하고 진술을로드 한 다음 읽으십시오 highlight 색상을 진술하고 변경하십시오. 어쨌든 VIM은 구성 파일을 읽은 후에 색 구성표 만 변경하는 것처럼 보입니다. 그래서 나는 후크를 제공하므로 색 구성표가 변경 될 때마다 색상이 변경됩니다. 좋은 부작용은 색 구성표를 전환하더라도 작동하는 것입니다 ( if 원하는 경우 차단).

내 .VIMRC에는 'ColorScheme BusyBee'가 없습니다. 나는 지금, 그리고 그 후에 ColorsCheme을 전환하고 싶어서 실제 테마를 "수정"하고 싶습니다.

나는 가장 예쁘지 않고 무엇이든이 솔루션을 생각해 냈습니다.

function! FixColorscheme() " {{{
    echo "fixing colorscheme"
    if has("gui_running")
        if (g:colors_name =~ "busybee")
            hi Folded        guibg=#001336 guifg=#003DAD gui=none
            hi CursorLine    guibg=#000000 ctermbg=Black cterm=none

        elseif (g:colors_name =~ "256-jungle")
            hi CursorLine    guibg=#000000 ctermbg=Black cterm=none

        elseif (g:colors_name =~ "xoria256")
            hi Folded        guibg=#001336 guifg=#003DAD gui=none cterm=none
            "hi Folded         ctermbg=234  ctermfg=25    cterm=none
        endif
    elseif &t_Co == 256
        if (g:colors_name =~ "busybee")
            hi Folded        guibg=#001336 guifg=#003DAD gui=none
            hi CursorLine    guibg=#000000 ctermbg=Black cterm=none

        elseif (g:colors_name =~ "256-jungle")
            hi CursorLine    guibg=#000000 ctermbg=Black cterm=none

        elseif (g:colors_name =~ "xoria256")
            hi Folded         ctermbg=234  ctermfg=25    cterm=none
            hi CursorLine    cterm=none
        "else
            "hi CursorLine     ctermbg=0                  cterm=none
        endif
    endif
    endfunction
" }}}

색 구성표를 변경할 때 자동으로 실행하십시오.

augroup mycolorschemes
    au!
    au ColorScheme * call FixColorscheme()
augroup END

그리고 이것은 스타트 업에서 가장 좋아하는 정기식을로드하는 데 도움이됩니다. (eek !! 기본값!)

if iSFirstRun == 1
    echo "HI"
    colo xoria256
    call FixColors()
endif

.. 그리고 이것은 .vimrc의 맨 위에 있습니다

"" To let us set some settings only once. {{{
    if exists("isRunning")
        let isFirstRun = 0
    else
        let isFirstRun = 1
    endif
    let isRunning = 1
" }}}

아마도 이미 'isfirstrun'에 대한 것이 있습니까?

주식 synload.vim 파일에 $VIM/vimXX/syntax/synload.vim a

runtime! syntax/syncolor.vim

이것은 VIM이 각 디렉토리에서 주어진 FileSpec을 읽도록 지시합니다. runtimepath. Redhat Systems에서 RuntimePath는 다음과 같습니다.

$HOIME/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,$HOME/.vim/after

색상 조정을 어느 쪽이든 넣으십시오 $HOME/.vim/after/syntax/syncolor.vim 또는 /usr/share/vim/vimfiles/after/syntax 그리고 당신은 가기에 좋을 것입니다.

조정은 간단 할 수 있습니다 hi ... 지시문은 분명히 더 복잡합니다. 그래서 나는 주식에서 많이 빌렸다 syncolor.vim 파일 및 이제 다음과 같습니다.

if !exists("syntax_cmd") || syntax_cmd == "on"
  " ":syntax on" works like in Vim 5.7: set colors but keep links
  command -nargs=* SynColor hi <args>
  command -nargs=* SynLink hi link <args>
else
  if syntax_cmd == "enable"
    " ":syntax enable" keeps any existing colors
    command -nargs=* SynColor hi def <args>
    command -nargs=* SynLink hi def link <args>
  elseif syntax_cmd == "reset"
    " ":syntax reset" resets all colors to the default
    command -nargs=* SynColor hi <args>
    command -nargs=* SynLink hi! link <args>
  else
    " User defined syncolor file has already set the colors.
    finish
  endif
endif

" Change comment color from bright cyan to gray
" The bold cyan conflicts with variables and other colors
if &background == "dark"
  SynColor Comment      term=bold cterm=NONE ctermfg=Gray ctermbg=NONE gui=NONE guifg=#80a0ff guibg=NONE
endif

delcommand SynColor
delcommand SynLink

놓다

hi CursorLine    guibg=#000000 ctermbg=Black cterm=none

당신의 후

colorscheme BusyBee

_vimrc의 입력.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top