Files
config/.vim/vimrc
2022-06-24 12:38:42 +08:00

117 lines
3.0 KiB
VimL

"
set autoindent
set backspace=indent,eol,start
set cursorline
set encoding=utf8
set expandtab
set fileencoding=utf8
set fileencodings=ucs-bom,utf8,cp950,gbk,latin1
set guifont=Inconsolata:h12
set hlsearch
set ignorecase
set incsearch
set laststatus=2
set lazyredraw
set list
set listchars=tab:▷⋅,trail
set mouse=
set nobomb
set nocompatible
set nofoldenable
set ruler
set scrolloff=3
set secure
set shiftwidth=4
set showmatch
set smartcase
set t_Co=256
set visualbell
set wildmenu
if !has('nvim')
set re=1
endif
"
let g:DisableAutoPHPFolding = 1
let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*']
let g:indent_guides_auto_colors = 0
let g:indent_guides_enable_on_vim_startup = 1
hi IndentGuidesEven ctermbg=8
hi IndentGuidesOdd ctermbg=236
"
" mapping
cnoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
cnoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
map q: :q
nmap <Esc>[Z <C-w>W
nmap <F8> :TagbarToggle<CR>
nmap <Tab> <C-w>w
nnoremap <silent> p p`]
vmap <C-v> <Plug>(expand_region_shrink)
vmap v <Plug>(expand_region_expand)
vnoremap <silent> p p`]
vnoremap <silent> y y`]
"
filetype off
let g:polyglot_disabled = ["autoindent", "sensible"]
let g:snipMate = {'snippet_version': 1}
"
call plug#begin('~/.vim/plugged')
Plug 'DataWraith/auto_mkdir'
Plug 'MarcWeber/vim-addon-mw-utils'
Plug 'bonsaiben/bootstrap-snippets'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'editorconfig/editorconfig-vim'
Plug 'garbas/vim-snipmate'
Plug 'godlygeek/csapprox'
Plug 'gregsexton/gitv'
Plug 'honza/vim-snippets'
Plug 'itchyny/lightline.vim'
Plug 'luochen1990/rainbow'
Plug 'joshdick/onedark.vim'
Plug 'majutsushi/tagbar'
Plug 'motus/pig.vim'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'scrooloose/nerdtree'
Plug 'sheerun/vim-polyglot'
Plug 'spf13/PIV'
Plug 'terryma/vim-expand-region'
Plug 'tomtom/tlib_vim'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
call plug#end()
"
" color schema
set background=dark
colo onedark
highlight Search cterm=none ctermbg=blue
syntax on
"
filetype plugin indent on
let g:ctrlp_use_caching = 0
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f']
let g:rainbow_active = 1
let g:SuperTabDefaultCompletionType = "context"
let g:vim_json_syntax_conceal = 0
let mapleader="\<Space>"
"
" other
au BufNewFile,BufRead *.go set filetype=go
au BufNewFile,BufRead *.sls set filetype=yaml
au BufNewFile,BufRead *.sls set shiftwidth=2
au BufNewFile,BufRead *.mk set noexpandtab
au BufNewFile,BufRead *.psgi setf perl
au BufNewFile,BufRead *.rb set shiftwidth=2
au BufNewFile,BufRead *.yaml set shiftwidth=2
au BufNewFile,BufRead *.yml set shiftwidth=2
au BufNewFile,BufRead GNUmakefile set noexpandtab
au BufNewFile,BufRead Makefile set noexpandtab
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
autocmd BufEnter * silent! lcd %:p:h
autocmd BufReadPost COMMIT_EDITMSG exe "normal! gg"
map <C-n> :NERDTreeToggle<CR>
"
" Local
if filereadable("~/.vim/vimrc.local")
source ~/.vim/vimrc.local
endif