1
0
forked from x/ContextOS
2020-08-30 12:42:45 +08:00

128 lines
2.8 KiB
VimL

"安装plug-vim {{{
"$ curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
"
"安装vim各种插件
":PlugInstall
"
"}}}
"插件列表"{{{
call plug#begin()
Plug 'vim-scripts/matrix.vim--Yang'
Plug 'vim-airline/vim-airline'
Plug 'airblade/vim-gitgutter'
Plug 'scrooloose/nerdtree'
let g:NERDTreeWinPos="right"
Plug 'mbbill/echofunc'
Plug 'kien/ctrlp.vim'
let g:ctrlp_cmd='CtrlPBuffer'
Plug 'vim-scripts/tComment'
Plug 'tpope/vim-fugitive'
Plug 'gcmt/taboo.vim'
set sessionoptions+=tabpages,globals
Plug 'fatih/vim-go'
let g:go_version_warning=0
let g:go_highlight_functions=1
Plug 'chr4/nginx.vim'
Plug 'othree/html5.vim'
Plug 'vim-scripts/python.vim'
Plug 'plasticboy/vim-markdown'
Plug 'vim-syntastic/syntastic'
call plug#end()
"}}}
" 基本配置"{{{
set cc=80
set nowrap
set number
set relativenumber
set cursorline
set cursorcolumn
set scrolloff=3
set t_Co=256
set mouse=a
" 缓存
set hidden
set autowrite
set encoding=utf-8
" 搜索
set hlsearch
set incsearch
set nowrapscan
set smartcase
set ignorecase
set showmatch
set matchtime=2
" 缩进
set cindent
set expandtab
set tabstop=4
set shiftwidth=4
set backspace=indent,eol,start
" 折叠
set foldenable
set foldmethod=marker
"}}}
"按键映射"{{{
nnoremap <C-H> <C-W>h
nnoremap <C-J> <C-W>j
nnoremap <C-K> <C-W>k
nnoremap <C-L> <C-W>l
nnoremap <Space> :
"}}}
" 编程配置{{{
set keywordprg=man\ -a
set splitbelow
set splitright
let javaScript_fold=1
function! Config(type)
if a:type == "go"
set foldmethod=syntax
set foldnestmax=3
elseif a:type == "shy"
set filetype=shy
set commentstring=#%s
elseif a:type == "json"
set foldmethod=syntax
elseif a:type == "conf"
set filetype=nginx
elseif a:type == "xml"
set filetype=xml
elseif a:type == "css"
set filetype=css
set foldmethod=marker
set foldmarker={,}
elseif a:type == "js"
set filetype=javascript
source ~/.vim/syntax/javascript.vim
set foldmethod=marker
set foldmarker={,}
endif
endfunction
autocmd BufNewFile,BufReadPost *.go call Config("go")
autocmd BufNewFile,BufReadPost *.shy call Config("shy")
autocmd BufNewFile,BufReadPost *.json call Config("json")
autocmd BufNewFile,BufReadPost *.conf call Config("conf")
autocmd BufNewFile,BufReadPost *.wxml call Config("xml")
autocmd BufNewFile,BufReadPost *.wxss call Config("css")
autocmd BufNewFile,BufReadPost *.js call Config("js")
if filereadable(expand("~/.auto.vim")) | source ~/.auto.vim | endif
if filereadable(expand("~/.local.vim")) | source ~/.local.vim | endif
autocmd BufReadPost * normal `"
"}}}
"主题色系"{{{
colorscheme torte
highlight Comment ctermfg=cyan ctermbg=darkblue
highlight PmenuSel ctermfg=darkblue ctermbg=cyan
highlight Pmenu ctermfg=cyan ctermbg=darkblue
"}}}