vim顏色設定

2021-08-09 05:15:34 字數 1354 閱讀 3898

vim 都是 通過 hi 這個命令來設定

例:設定關鍵字為藍色非粗體 :

hi identifier ctermfg=blue cterm=none(bold 就設定成粗體)

hi comment ctermfg=darkgreen

hi string ctermfg=darkred

hi type ctermfg=yellow

hi number ctermfg=darkblue

hi constant ctermfg=blue

hi statement ctermfg=darkyellow

可以通過 :hi  看更多顏色設定

在vim中,如果開啟了語法功能,其中的一些關鍵字會顯示為粗體,如果你想將粗體功能關閉,可以使用如下方法。

例如要將型別的粗體顯示關閉,

先到 vim72/syntax/ 目錄下,查詢相應的語法檔案,例如c語言對應的是c.vim。

開啟vim,可以看到,int unsigned 之類的名稱是 type。

隨便開啟乙個c檔案,鍵入命令 hi,你會看到所有的顏色定義,找到 type,可能是一下樣子:

type 

***   term=underline  ctermfg=10 guifg=#60ff60  gui=bold

到colors 目錄下,找到你現在用的主題檔案,開啟

:echo g:colors_name

如果值為空,那麼預設為:default主題

在其中加上:

hi  type  gui=none

儲存。重新開啟c檔案,就會看到型別已經變為正常模式,不是粗體。

用以上方法,你可以改變你想改變的關鍵字的顯示方式。我新增的一些自定義如下:

hi type gui=none

hi conditional term=none cterm=none ctermfg=yellow guifg=#ffff60 gui=none

hi repeat term=none cterm=none ctermfg=yellow guifg=#ffff60 gui=none

hi keyword term=none cterm=none ctermfg=yellow guifg=#ffff60 gui=none

hi operator term=none cterm=none ctermfg=yellow guifg=#ffff60 gui=none

hi statement term=none cterm=none ctermfg=yellow guifg=#ffff60 gui=none

hi label term=none cterm=none ctermfg=yellow guifg=#ffff60 gui=none

SecureCRT 設定 vim 顏色

1 設定 securecrt 相應的 session options 如下 terminal emulation 勾選 ansi color use color scheme 2 在 bashrc 中新增 export term xterm 3 修改使用者目錄下的 vimrc 檔案 set noco...

vim的顏色修改,高亮設定。

放到 vim colors 下 linux 或者 home vim colors 下 windows 再在你的.vimrc檔案中加一句colorscheme vim 代表你剛才下的colorscheme 或者你直接到裡面加一句colorscheme morning 這個morning是自帶的乙個 1...

如何設定vim裡字型顏色

安裝vim vim安裝 安裝yum yinstall vim vi 不變色 在shell終端輸入如下命令 echo term 果然不是xterm,怪不得沒有顏色。解決辦法 開啟shell配置檔案,bash profile或.bashrc加入下面一行 term xterm export term.ba...