-
Notifications
You must be signed in to change notification settings - Fork 1
/
vimrc
289 lines (262 loc) · 6.79 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
syntax enable
filetype on
filetype plugin on
filetype indent on
" {{{ plugin
call plug#begin('~/.vim/bundle')
Plug 'lucidstack/ctrlp-mpc.vim'
Plug 'vim-airline/vim-airline'
" Plug 'davidhalter/jedi-vim', { 'for': 'python' }
Plug 'easymotion/vim-easymotion'
Plug 'jiangmiao/auto-pairs'
" Plug 'jlanzarotta/bufexplorer'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'junegunn/rainbow_parentheses.vim'
" Plug 'klen/python-mode'
Plug 'majutsushi/tagbar'
"Plug 'w0rp/ale'
Plug 'mattn/emmet-vim'
" Plug 'scrooloose/syntastic'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'sickill/vim-monokai'
Plug 'terryma/vim-multiple-cursors'
Plug 'tomasr/molokai'
Plug 'plasticboy/vim-markdown'
Plug 'tpope/vim-fugitive'
Plug 'maksimr/vim-jsbeautify'
Plug 'Valloric/YouCompleteMe'
Plug 'Yggdroot/indentLine'
Plug 'mhinz/vim-signify'
call plug#end()
" }}}
" settings {{{
set conceallevel=0
set lazyredraw
set tags=tags
set completeopt=longest,menu
set nocompatible
set nobackup
set nowritebackup
set nowb
set guifont=Sauce\ Code\ Powerline:h11
set noswapfile
set ffs=unix,dos,mac
" set modeline
set guiheadroom=0
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set encoding=utf-8
set fenc=utf-8
set fencs=utf-8,gbk,gb18030,gb2312,cp936,usc-bom,euc-jp
set enc=utf-8
set scrolloff=10
set autoread
set autoindent
set smartindent
set foldmethod=indent
set foldenable
set showmode
set showcmd
set hidden
set wildmenu
set wildmode=list:longest
set visualbell
set cursorline
" set cursorcolumn
set ttyfast
set ruler
set backspace=indent,eol,start
set laststatus=2
set relativenumber
set ignorecase
set autochdir
set smartcase
set smarttab
set gdefault
set incsearch
set magic
set mat=2
set showmatch
set hlsearch
set wrap
set textwidth=79
set formatoptions=qrn1
set colorcolumn=85
set laststatus=2
set runtimepath+=$HOME/.vim/
" }}}
" {{{ colors
set t_Co=256
"set background=dark
colorscheme molokai
" }}}
" keymappings {{{
let mapleader = ","
nnoremap / /\v
vnoremap / /\v
nnoremap <tab> %
vnoremap <tab> %
" nnoremap <up> <nop>
" nnoremap <down> <nop>
" nnoremap <left> <nop>
" nnoremap <right> <nop>
" inoremap <up> <nop>
" inoremap <down> <nop>
" inoremap <left> <nop>
" inoremap <right> <nop>
nnoremap j gj
nnoremap k gk
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
nnoremap ; :
inoremap jj <ESC>
map <leader>tq :tabprevious<cr>
map <leader>tw :tabnext<cr>
map <leader>te :tabnew<cr>
map <leader>hc :nohl<cr>
map 0 ^
map <leader>4 $
map <leader>6 ^
map <leader>ww <C-W>w
map <leader>wr <C-W>r
map <leader>wc <C-W>c
map <leader>wq <C-W>q
map <Leader>wj <C-W>j
map <Leader>wk <C-W>k
map <Leader>wh <C-W>h
map <Leader>wl <C-W>l
map <Leader>wv <C-W>v
map <Leader>ws <C-W>s
nnoremap <leader>bf :b<space>
nnoremap <Leader>bb :bnext<CR>
nnoremap <Leader>q :bprevious<CR>
nnoremap <Leader>w :bnext<CR>
nnoremap <leader>bp :bprevious<CR>
nnoremap <leader>bn :bnext<CR>
nnoremap <leader>bd :bd<CR>
nnoremap <leader>bw :bw<CR>
nnoremap <leader>b1 :b1<CR>
nnoremap <leader>b2 :b2<CR>
nnoremap <leader>b3 :b3<CR>
nnoremap <leader>b4 :b4<CR>
nnoremap <leader>b5 :b5<CR>
nnoremap <leader>b6 :b6<CR>
nnoremap <leader>b7 :b7<CR>
nnoremap <leader>b8 :b8<CR>
nnoremap <leader>b9 :b9<CR>
" }}}
" plugin-settings {{{
" easymotion
let g:EasyMotion_smartcase = 1
let g:EasyMotion_skipfoldedline=0
nmap s <Plug>(easymotion-overwin-f2)
" <Leader><Leader>w : word down
" <Leader><Leader>b : word up
" <Leader><Leader>s : search up and down
" <leader><Leader>f : forward
" <Leader><Leader>j : line head down
" <Leader><Leader>k : line head up
" vim-airline
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFllg()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" nerdtree
let NERDTreeShowHidden=1
map <leader>nn :NERDTreeToggle<cr>
map <leader>nb :NERDTreeFromBookmark
map <leader>nf :NERDTreeFind<cr>
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") &&b:NERDTreeType == "primary") | q | endif
" vim markdown
map [[ <Plug>Markdown_MoveToPreviousHeader
map ]] <Plug>Markdown_MoveToNextHeader
map ][ <Plug>Markdown_MoveToNextSiblingHeader
map [] <Plug>Markdown_MoveToPreviousSiblingHeader
map ]c <Plug>Markdown_MoveToCurHeader
map ]u <Plug>Markdown_MoveToParentHeader
" rainbow parenthese
augroup rainbow_lisp
autocmd!
autocmd FileType lisp,clojure,scheme,python RainbowParentheses
augroup END
" taglist
" nmap <Leader>tt :TlistToggle(CR)
" YouCompleteMe
let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
" tagbar
nmap <Leader>tb :TagbarToggle<CR>
let g:tagbar_ctags_bin='/usr/bin/ctags'
let g:tagbar_width=30
autocmd BufReadPost *.cpp,*.c,*.h,*.hpp,*.cc,*.cxx call tagbar#autoopen()
" emmet-vim
let g:user_emmet_install_global = 0
autocmd FileType html,css EmmetInstall
" ale
let g:ale_linters = {
\ 'python': ["flake8"],
\ 'go': ["gofmt"],
\}
" python-mode
let g:pymode_python = 'python'
let g:pymode_lint = 1
let g:pymode_lint_on_write = 1
let g:pymode_syntax = 1
let g:pymode_syntax_all = 1
let g:pymode_lint_on_fly = 0
" rust.vim
let g:rustfmt_autosave = 1
" ctrlp-mpc.vim
let g:ctrlp_extensions = ["buffertag", "tag", "line", "dir", "tmux", "mpc"]
" jedi-vim
"let g:jedi#goto_command = "<leader>d"
"let g:jedi#goto_assignments_command = "<leader>g"
"let g:jedi#goto_definitions_command = ""
"let g:jedi#documentation_command = "K"
"let g:jedi#usages_command = "<leader>n"
"let g:jedi#completions_command = ",<tab>"
"let g:jedi#rename_command = "<leader>r"
"let g:jedi#popup_select_first = 1
"" doc in tab not buffer
"let g:jedi#use_tabs_not_buffers = 0
" }}}
" deoplete
let g:deoplete#enable_at_startup = 1
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<cr>"
" vim-multiple-cursors
let g:multi_cursor_use_default_mapping=0
let g:multi_cursor_start_word_key = '<C-n>'
let g:multi_cursor_select_all_word_key = '<A-n>'
let g:multi_cursor_start_key = 'g<C-n>'
let g:multi_cursor_select_all_key = 'g<A-n>'
let g:multi_cursor_next_key = '<C-n>'
let g:multi_cursor_prev_key = '<C-p>'
let g:multi_cursor_skip_key = '<C-x>'
let g:multi_cursor_quit_key = '<Esc>'
" misc {{{
if has("autocmd")
au BufRead * normal zR
endif
if has("unix")
let s:uname = system("uname -s")
if s:uname == "Darwin\n"
let g:tagbar_ctags_bin = "~/.scripts/ctags-osx"
elseif s:uname == "Linux\n"
let g:tagbar_ctags_bin = "~/.scripts/ctags-linux"
endif
endif
" }}}
" vim:foldmethod=marker:foldlevel=0