vim没有突出显示某些c关键字

前端之家收集整理的这篇文章主要介绍了vim没有突出显示某些c关键字前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我使用 vim(安装在cygwin上)编写c程序,但它没有突出显示一些c关键字,如new,delete,public,friend,try,但突出显示其他命令,如namespace,int,const,operator,true,class,include .它也不会改变操作符的颜色.

我从未改变过它的语法文件.它出什么问题了?
非常感谢.

我使用定制的配色方案;当我将其更改为沙漠配色方案时,突出显示没有问题,但我需要使用该配色方案,并且无法将其更改为其他内容.

我希望它显示程序如下图(我在图片中使用了带有记事本的配色方案):

但现在它如下图所示:

colorscheme在这里:

"Tomorrow Night Bright - Full Colour and 256 Colour
" http://chriskempson.com
"
" Hex colour conversion functions borrowed from the theme "Desert256""

 " Default GUI Colours
 let s:foreground = "eaeaea"
 let s:background = "000000"
 let s:selection = "424242"
 let s:line = "2a2a2a"
 let s:comment = "969896"
 let s:red = "d54e53"
 let s:orange = "e78c45"
 let s:yellow = "e7c547"
 let s:green = "b9ca4a"
 let s:aqua = "70c0b1"
 let s:blue = "7aa6da"
 let s:purple = "c397d8"
 let s:window = "4d5057"

 set background=dark
 hi clear
 Syntax reset

 let g:colors_name = "Tomorrow-Night-Bright"

 if has("gui_running") || &t_Co == 88 || &t_Co == 256
" Returns an approximate grey index for the given grey level
fun <SID>grey_number(x)
    if &t_Co == 88
        if a:x < 23
            return 0
        elseif a:x < 69
            return 1
        elseif a:x < 103
            return 2
        elseif a:x < 127
            return 3
        elseif a:x < 150
            return 4
        elseif a:x < 173
            return 5
        elseif a:x < 196
            return 6
        elseif a:x < 219
            return 7
        elseif a:x < 243
            return 8
        else
            return 9
        endif
    else
        if a:x < 14
            return 0
        else
            let l:n = (a:x - 8) / 10
            let l:m = (a:x - 8) % 10
            if l:m < 5
                return l:n
            else
                return l:n + 1
            endif
        endif
    endif
endfun

" Returns the actual grey level represented by the grey index
fun <SID>grey_level(n)
    if &t_Co == 88
        if a:n == 0
            return 0
        elseif a:n == 1
            return 46
        elseif a:n == 2
            return 92
        elseif a:n == 3
            return 115
        elseif a:n == 4
            return 139
        elseif a:n == 5
            return 162
        elseif a:n == 6
            return 185
        elseif a:n == 7
            return 208
        elseif a:n == 8
            return 231
        else
            return 255
        endif
    else
        if a:n == 0
            return 0
        else
            return 8 + (a:n * 10)
        endif
    endif
endfun

" Returns the palette index for the given grey index
fun <SID>grey_colour(n)
    if &t_Co == 88
        if a:n == 0
            return 16
        elseif a:n == 9
            return 79
        else
            return 79 + a:n
        endif
    else
        if a:n == 0
            return 16
        elseif a:n == 25
            return 231
        else
            return 231 + a:n
        endif
    endif
endfun

" Returns an approximate colour index for the given colour level
fun <SID>rgb_number(x)
    if &t_Co == 88
        if a:x < 69
            return 0
        elseif a:x < 172
            return 1
        elseif a:x < 230
            return 2
        else
            return 3
        endif
    else
        if a:x < 75
            return 0
        else
            let l:n = (a:x - 55) / 40
            let l:m = (a:x - 55) % 40
            if l:m < 20
                return l:n
            else
                return l:n + 1
            endif
        endif
    endif
endfun

" Returns the actual colour level for the given colour index
fun <SID>rgb_level(n)
    if &t_Co == 88
        if a:n == 0
            return 0
        elseif a:n == 1
            return 139
        elseif a:n == 2
            return 205
        else
            return 255
        endif
    else
        if a:n == 0
            return 0
        else
            return 55 + (a:n * 40)
        endif
    endif
endfun

" Returns the palette index for the given R/G/B colour indices
fun <SID>rgb_colour(x,y,z)
    if &t_Co == 88
        return 16 + (a:x * 16) + (a:y * 4) + a:z
    else
        return 16 + (a:x * 36) + (a:y * 6) + a:z
    endif
endfun

" Returns the palette index to approximate the given R/G/B colour levels
fun <SID>colour(r,g,b)
    " Get the closest grey
    let l:gx = <SID>grey_number(a:r)
    let l:gy = <SID>grey_number(a:g)
    let l:gz = <SID>grey_number(a:b)

    " Get the closest colour
    let l:x = <SID>rgb_number(a:r)
    let l:y = <SID>rgb_number(a:g)
    let l:z = <SID>rgb_number(a:b)

    if l:gx == l:gy && l:gy == l:gz
        " There are two possibilities
        let l:dgr = <SID>grey_level(l:gx) - a:r
        let l:dgg = <SID>grey_level(l:gy) - a:g
        let l:dgb = <SID>grey_level(l:gz) - a:b
        let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
        let l:dr = <SID>rgb_level(l:gx) - a:r
        let l:dg = <SID>rgb_level(l:gy) - a:g
        let l:db = <SID>rgb_level(l:gz) - a:b
        let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
        if l:dgrey < l:drgb
            " Use the grey
            return <SID>grey_colour(l:gx)
        else
            " Use the colour
            return <SID>rgb_colour(l:x,l:y,l:z)
        endif
    else
        " Only one possibility
        return <SID>rgb_colour(l:x,l:z)
    endif
endfun

" Returns the palette index to approximate the 'rrggbb' hex string
fun <SID>rgb(rgb)
    let l:r = ("0x" . strpart(a:rgb,2)) + 0
    let l:g = ("0x" . strpart(a:rgb,2,2)) + 0
    let l:b = ("0x" . strpart(a:rgb,4,2)) + 0

    return <SID>colour(l:r,l:g,l:b)
endfun

" Sets the highlighting for the given group
fun <SID>X(group,fg,bg,attr)
    if a:fg != ""
        exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . <SID>rgb(a:fg)
    endif
    if a:bg != ""
        exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . <SID>rgb(a:bg)
    endif
    if a:attr != ""
        exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr
    endif
endfun

" Vim Highlighting
call <SID>X("Normal",s:foreground,s:background,"")
call <SID>X("LineNr",s:selection,"","")
call <SID>X("NonText","")
call <SID>X("SpecialKey","")
call <SID>X("Search",s:yellow,"")
call <SID>X("TabLine","reverse")
call <SID>X("StatusLine",s:window,"reverse")
call <SID>X("StatusLineNC","reverse")
call <SID>X("VertSplit","none")
call <SID>X("Visual","")
call <SID>X("Directory",s:blue,"")
call <SID>X("ModeMsg",s:green,"")
call <SID>X("MoreMsg","")
call <SID>X("Question","")
call <SID>X("WarningMsg",s:red,"")
call <SID>X("MatchParen","")
call <SID>X("Folded",s:comment,"")
call <SID>X("FoldColumn","")
if version >= 700
    call <SID>X("CursorLine",s:line,"none")
    call <SID>X("CursorColumn","none")
    call <SID>X("PMenu","none")
    call <SID>X("PMenuSel","reverse")
end
if version >= 703
    call <SID>X("ColorColumn","none")
end

" Standard Highlighting
call <SID>X("Comment","")
call <SID>X("Todo","")
call <SID>X("Title","")
call <SID>X("Identifier","none")
call <SID>X("Statement","")
call <SID>X("Conditional","")
call <SID>X("Repeat","")
call <SID>X("Structure",s:purple,"")
call <SID>X("Function","")
call <SID>X("Constant",s:orange,"")
call <SID>X("String","")
call <SID>X("Special","")
call <SID>X("PreProc","")
call <SID>X("Operator",s:aqua,"none")
call <SID>X("Type","none")
call <SID>X("Define","none")
call <SID>X("Include","")
"call <SID>X("Ignore","666666","")

" Vim Highlighting
call <SID>X("vimCommand","none")

" C Highlighting
call <SID>X("cType","")
call <SID>X("cStorageClass","")
call <SID>X("cConditional","")
call <SID>X("cRepeat","")

" PHP Highlighting
call <SID>X("PHPVarSelector","")
call <SID>X("PHPKeyword","")
call <SID>X("PHPRepeat","")
call <SID>X("PHPConditional","")
call <SID>X("PHPStatement","")
call <SID>X("PHPMemberSelector","")

" Ruby Highlighting
call <SID>X("rubySymbol","")
call <SID>X("rubyConstant","")
call <SID>X("rubyAttribute","")
call <SID>X("rubyInclude","")
call <SID>X("rubyLocalVariableOrMethod","")
call <SID>X("rubyCurlyBlock","")
call <SID>X("rubyStringDelimiter","")
call <SID>X("rubyInterpolationDelimiter","")
call <SID>X("rubyConditional","")
call <SID>X("rubyRepeat","")

" Python Highlighting
call <SID>X("pythonInclude","")
call <SID>X("pythonStatement","")
call <SID>X("pythonConditional","")
call <SID>X("pythonFunction","")

" JavaScript Highlighting
call <SID>X("javaScriptBraces","")
call <SID>X("javaScriptFunction","")
call <SID>X("javaScriptConditional","")
call <SID>X("javaScriptRepeat","")
call <SID>X("javaScriptNumber","")
call <SID>X("javaScriptMember","")

" HTML Highlighting
call <SID>X("htmlTag","")
call <SID>X("htmlTagName","")
call <SID>X("htmlArg","")
call <SID>X("htmlScriptTag","")

" Diff Highlighting
call <SID>X("diffAdded","")
call <SID>X("diffRemoved","")

" Delete Functions
delf <SID>X
delf <SID>rgb
delf <SID>colour
delf <SID>rgb_colour
delf <SID>rgb_level
delf <SID>rgb_number
delf <SID>grey_colour
delf <SID>grey_level
delf <SID>grey_number
endif
将其添加到C突出显示段落:
call <SID>X("Statement","")
原文链接:https://www.f2er.com/bash/384772.html

猜你在找的Bash相关文章