forked from x/ContextOS
182 lines
4.1 KiB
VimL
182 lines
4.1 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
|
|
|
|
let g:go_highlight_functions=1
|
|
Plug 'fatih/vim-go'
|
|
let g:go_version_warning=0
|
|
Plug 'chr4/nginx.vim'
|
|
Plug 'othree/html5.vim'
|
|
Plug 'plasticboy/vim-markdown'
|
|
|
|
" Plug 'vim-airline/vim-airline-themes'
|
|
" Plug 'ntpeters/vim-better-whitespace'
|
|
" Plug 'easymotion/vim-easymotion'
|
|
"
|
|
"
|
|
" let g:Tlist_WinWidth=45
|
|
" let g:Tlist_Exit_OnlyWindow=1
|
|
" let g:Tlist_Enable_Fold_Column=0
|
|
" nnoremap <F2> :TlistToggle<CR>
|
|
"
|
|
" Plug 'rking/ag.vim'
|
|
" nnoremap <C-G> :Ag <C-R>=expand("<cword>")<CR><CR>
|
|
"
|
|
" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
|
|
" nnoremap <C-N> :FZF -q <C-R>=expand("<cword>")<CR><CR>
|
|
"
|
|
" Plug 'godlygeek/tabular'
|
|
" Plug 'vim-scripts/python.vim'
|
|
"
|
|
" Plug 'vim-syntastic/syntastic'
|
|
" Plug 'Valloric/YouCompleteMe'
|
|
" let g:ycm_confirm_extra_conf=1
|
|
" let g:syntastic_enable_signs=1
|
|
" let g:ycm_python_binary_path='/usr/bin/python'
|
|
" nnoremap gd :YcmCompleter GoToDeclaration<CR>
|
|
" nnoremap gD :YcmCompleter GoToReferences<CR>
|
|
"
|
|
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> :
|
|
|
|
cnoremap jk <CR>
|
|
cnoremap W w<CR>
|
|
cnoremap wa wa<CR>
|
|
inoremap jk <Esc>
|
|
"}}}
|
|
" 编程配置{{{
|
|
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
|
|
set tags+=ctx.tags,golang.tags
|
|
" autocmd BufWritePost *.go !goimports -w <afile>
|
|
elseif a:type == "shy"
|
|
set filetype=shy
|
|
set commentstring=#%s
|
|
elseif a:type == "tmpl"
|
|
set foldmethod=indent
|
|
elseif a:type == "conf"
|
|
set filetype=nginx
|
|
elseif a:type == "json"
|
|
set foldmethod=syntax
|
|
elseif a:type == "xml"
|
|
set filetype=xml
|
|
elseif a:type == "css"
|
|
set filetype=css
|
|
set foldmethod=marker
|
|
set foldmarker={,}
|
|
elseif a:type == "txt"
|
|
set noexpandtab
|
|
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 *.tmpl call Config("tmpl")
|
|
autocmd BufNewFile,BufReadPost *.conf call Config("conf")
|
|
autocmd BufNewFile,BufReadPost *.json call Config("json")
|
|
|
|
autocmd BufNewFile,BufReadPost *.wxml call Config("xml")
|
|
autocmd BufNewFile,BufReadPost *.wxss call Config("css")
|
|
autocmd BufNewFile,BufReadPost *.txt call Config("txt")
|
|
autocmd BufNewFile,BufReadPost *.js call Config("js")
|
|
|
|
autocmd BufReadPost * normal `"
|
|
|
|
if filereadable("~/.vim_local")
|
|
source ~/.vim_local
|
|
endif
|
|
|
|
cnoremap RR :source ~/.vimrc<CR>
|
|
|
|
colorscheme torte
|
|
highlight Comment ctermfg=cyan ctermbg=darkblue
|
|
highlight Pmenu ctermfg=cyan ctermbg=darkblue
|
|
highlight PmenuSel ctermfg=darkblue ctermbg=cyan
|
|
"}}}
|
|
"
|
|
nnoremap <F3> :NERDTreeToggle<CR>
|
|
|
|
" " miss
|
|
" highlight StatusLine ctermfg=white ctermbg=black
|
|
" highlight LineNr ctermfg=white ctermbg=black
|
|
" highlight CursorLineNr ctermfg=white ctermbg=black
|
|
"
|
|
" highlight kitMiss ctermfg=white
|
|
" syntax match kitMiss ".*"
|
|
" syntax match kitMiss "\".*\""
|
|
|