VIM自用配置

发布于 2019-05-04  4,373 次阅读


set number

filetype indent on
set shiftwidth=4
set expandtab
set softtabstop=4
set showmatch
set incsearch
set ignorecase
set smartcase
set laststatus=2
set ruler
set cursorline
set hlsearch
filetype off

syntax enable
syntax on

let g:currentmode={
    \ 'n'  : 'Normal',
    \ 'no' : 'NormalOperator Pending',
    \ 'v'  : 'Visual',
    \ 'V'  : 'VLine',
    \ '^V' : 'VBlock',
    \ 's'  : 'Select',
    \ 'S'  : 'SLine',
    \ '^S' : 'SBlock',
    \ 'i'  : 'Insert',
    \ 'R'  : 'Replace',
    \ 'Rv' : 'VReplace',
    \ 'c'  : 'Command',
    \ 'cv' : 'Vim Ex',
    \ 'ce' : 'Ex',
    \ 'r'  : 'Prompt',
    \ 'rm' : 'More',
    \ 'r?' : 'Confirm',
    \ '!'  : 'Shell',
    \ 't'  : 'Terminal'
    \}
set laststatus=2
set noshowmode
set statusline=
set statusline+=%0*\ %n\                                 " Buffer number
set statusline+=%5*\ %<%F%m%r%h%w\                       " File path, modified, readonly, helpfile, preview
set statusline+=%3*                                     " Separator
set statusline+=%2*\ %Y\                                 " FileType
set statusline+=%3*                                     " Separator
set statusline+=%4*\ %{''.(&fenc!=''?&fenc:&enc).''}     " Encoding
set statusline+=\ (%{&ff})                               " FileFormat (dos/unix..)
set statusline+=%=                                       " Right Side
set statusline+=%4*\ col:\ %02v\                         " Colomn number
set statusline+=%3*                                     " Separator
set statusline+=%6*\ ln:\ %02l/%L\ (%3p%%)\              " Line number / total lines, percentage of document
set statusline+=%0*\ %{toupper(g:currentmode[mode()])}\  " The current mode
hi User1 ctermfg=253 ctermbg=239 guibg=#4e4e4e guifg=#dadada
hi User2 ctermfg=237 ctermbg=084 guibg=#303030 guifg=#dadada
hi User3 ctermfg=253 ctermbg=236 guibg=#303030 guifg=#dadada
hi User4 ctermfg=237 ctermbg=228 guibg=#4e4e4e guifg=#dadada
hi User5 ctermfg=237 ctermbg=050 guibg=#4e4e4e guifg=#dadada
hi User6 ctermfg=237 ctermbg=051 guibg=#4e4e4e guifg=#dadada

终有一日, 仰望星空