-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
238 lines (186 loc) · 6.35 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
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'ervandew/supertab'
Plugin 'Valloric/YouCompleteMe'
Plugin 'SirVer/ultisnips'
Plugin 'scrooloose/syntastic'
Plugin 'Raimondi/delimitMate'
Plugin 'majutsushi/tagbar'
Plugin 'honza/vim-snippets'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/nerdcommenter'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'kshenoy/vim-signature'
Plugin 'easymotion/vim-easymotion'
Plugin 'dyng/ctrlsf.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'mbbill/undotree'
Plugin 'fatih/vim-go'
Plugin 'nathanaelkane/vim-indent-guides'
call vundle#end()
filetype plugin indent on " required
" Brief help
" :PluginList - list configured plugins
" :PluginInstall(!) - install (update) plugins
" :PluginSearch(!) foo - search (or refresh cache first) for foo
" :PluginClean(!) - confirm (or auto-approve) removal of unused plugins
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Plugin commands are not allowed.
" Put your stuff after this line
" Set mapping shortcut for plugin
" <TagBar>
nmap <F3> :TagbarToggle<CR>
" <SuperTab>
let g:SuperTabClosePreviewOnPopupClose = 1
let g:SuperTabDefaultCompletionType = '<C-j>'
" <YouCompleteMe>
set completeopt-=preview
" let g:ycm_autoclose_preview_window_after_completion = 1
" let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_global_ycm_extra_conf = "~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py"
let g:ycm_confirm_extra_conf = 0
let g:ycm_use_ultisnips_completer = 1
let g:ycm_key_list_select_completion = ['<C-j>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-k>', '<Up>']
" <UltiSnip>
let g:UltiSnipsSnippetsDir=$HOME.'/.vim/bundle/vim-snippets/UltiSnips/'
let g:UltiSnipsSnippetDirectories=["UltiSnips"]
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<C-tab>"
" <NerdTree>
nmap <F2> :NERDTreeToggle<CR>
" <Syntastic>
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list=0
let g:syntastic_auto_loc_list=0
let g:syntastic_check_on_open=0
let g:syntastic_check_on_wq=0
let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': [],'passive_filetypes': [] }
let g:syntastic_error_symbol = "X"
let g:syntastic_warning_symbol = "⚠"
let g:syntastic_python_checkers = ['pylint']
let g:syntastic_c_checkers = ['/usr/bin/gcc']
let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:check_flag=1
function! SyntasticCheckOption()
if g:check_flag
SyntasticCheck
Errors
let g:check_flag=0
else
lclose
let g:check_flag=1
endif
endfunction
nnoremap <F4> :call SyntasticCheckOption()<CR>
" <Solarized colorscheme>
syntax enable
syntax on
set t_Co=16
set background=dark
colorscheme solarized
" <Airline>
set laststatus=2
let g:airline#extensions#tabline#enabled=1
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
" <NerdCommenter>
let g:NERDSpaceDelims=1
" <Easymotion>
map <leader> <Plug>(easymotion-prefix)
" <CtrlSF>
map <C-P> <Plug>CtrlSFPrompt
let g:ctrlsf_default_root = 'project'
" <vim-go>
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_fields = 1
let g:go_highlight_types = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
let g:go_fmt_command = "goimports"
let g:go_fmt_fail_silently = 1
let g:go_play_open_browser = 0
let g:go_get_update = 0
" <Indent Guides>
let g:indent_guides_enable_on_vim_startup = 1
" <UndoTree>
map <F5> :UndotreeToggle<CR>
" My custom setting
set number
set autoindent
set hlsearch
set incsearch
autocmd BufRead,BufNewFile *.py set softtabstop=4 shiftwidth=4
autocmd BufRead,BufNewFile *.sh set softtabstop=2 shiftwidth=2
autocmd BufRead,BufNewFile *.h set softtabstop=2 shiftwidth=2
autocmd BufRead,BufNewFile *.c set softtabstop=2 shiftwidth=2
autocmd BufRead,BufNewFile *.cpp set softtabstop=2 shiftwidth=2
autocmd BufRead,BufNewFile *.cc set softtabstop=2 shiftwidth=2
autocmd BufRead,BufNewFile *.html set softtabstop=2 shiftwidth=2
autocmd BufRead,BufNewFile *.css set softtabstop=4 shiftwidth=4
autocmd BufRead,BufNewFile *.css set softtabstop=4 shiftwidth=4
set expandtab
set cursorline
set mouse=a
if has('unnamedplus')
set clipboard+=unnamed,unnamedplus
else
set clipboard+=unnamed
endif
" Remap clipboard
nnoremap <C-v> "+p
vmap <C-c> "+y
" Remap Ctrl - W
nnoremap <C-k> <C-W><C-K>
nnoremap <C-j> <C-W><C-J>
nnoremap <C-l> <C-W><C-L>
nnoremap <C-h> <C-W><C-H>
" Remap page up / down
map <S-j> <C-F>
map <S-k> <C-B>
" Remap Tab - W
nnoremap <S-Tab> :bnext<CR>
cnoreabbrev Q bd
" Remap Ctags
nnoremap <S-I> <C-]>
nnoremap <S-O> <C-T>
" Compile key
autocmd BufRead *.py nmap <F12> :w !python %<CR>
autocmd BufRead *.sh nmap <F12> :w !bash %<CR>
autocmd BufRead *.c nmap <F12> :!gcc --o "%:p:r.out" "%:p" && "%:p:r.out"<CR>
autocmd BufRead *.cpp nmap <F12> :!g++ -o "%:p:r.out" "%:p" && "%:p:r.out"<CR>
autocmd BufRead *.cc nmap <F12> :!g++ -o "%:p:r.out" "%:p" && "%:p:r.out"<CR>
autocmd FileType go nmap <F12> <Plug>(go-run)
" CompleteNewFile
autocmd bufnewfile *.py so /home/evan/.vim/header/python_header.txt
autocmd bufnewfile *.sh so /home/evan/.vim/header/shell_header.txt
autocmd bufnewfile *.h so /home/evan/.vim/header/c_h_header.txt
autocmd bufnewfile *.c so /home/evan/.vim/header/c_header.txt
autocmd bufnewfile *.cpp so /home/evan/.vim/header/c++_header.txt
autocmd bufnewfile *.cc so /home/evan/.vim/header/c++_header.txt
autocmd bufnewfile CMakeLists.txt so /home/evan/.vim/header/CMakeLists_header.txt
autocmd bufnewfile Makefile so /home/evan/.vim/header/make_header.txt
" [Shortcuts Mapping Table]
" F2 = NerdTree
" F3 = TagBar
" F4 = SyntasticCheck
" F12 = Compile code immediately
" Shift - Tab = Switch buffer
" Ctrl - p = CtrlP finding
" Ctrl - c = Copy to clipboard in visual mode
" Ctrl - v = paste from clipboard in normal mode
" Ctrl - h = Move left
" Ctrl - l = Move right
" Ctrl - j = Move down
" Ctrl - k = Move up
" Tab = Youcompleteme & UltiSnips