-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc.awesome.dot
257 lines (216 loc) · 8.01 KB
/
vimrc.awesome.dot
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
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/syntastic'
Plugin 'bronson/vim-trailing-whitespace'
Plugin 'JamshedVesuna/vim-markdown-preview'
Plugin 'altercation/vim-colors-solarized' "<<-FIX: Remove thiszz/flazz/:
Plugin 'christoomey/vim-tmux-navigator'
" If complains about YcmRestartServer, better run install.py
" ~/.vim/vundle/YouCompleteMe/install.py --help
" ~/.vim/vundle/YouCompleteMe/install.py --clang-completer --go-completer
Plugin 'Valloric/YouCompleteMe'
" Added for go <-start
Plugin 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
Plugin 'fatih/molokai'
Plugin 'AndrewRadev/splitjoin.vim'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'ekalinin/Dockerfile.vim'
" Added for go <-end
Plugin 'flazz/vim-colorschemes'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'tpope/vim-unimpaired'
call vundle#end()
filetype plugin indent on " required
" Solarized Plugin{{{
syntax enable
set background=dark
if &t_Co >=256 || has("gui_running")
colorscheme solarized
endif
" }}}
"
" Common setings{{{
let mapleader=","
set nowrap " don't wrap lines
set tabstop=4 " a tab is four spaces
set shiftwidth=4 " number of spaces to use for autoindenting
set softtabstop=4 " a tab is four spaces
set backspace=indent,eol,start
" allow backspacing over everything in insert mode
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
set number " always show line numbers
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set showmatch " set show matching parenthesis
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase,
" case-sensitive otherwise
set smarttab " insert tabs on the start of a line according to
" shiftwidth, not tabstop
set hlsearch " highlight search terms
set incsearch " show search matches as you type
set history=1000 " remember more commands and search history
set undolevels=1000 " use many muchos levels of undo
set wildignore=*.swp,*.bak,*.pyc,*.class
set title " change the terminal's title
set visualbell " don't beep
set noerrorbells " don't beep
set nobackup
set noswapfile
set list
set listchars=tab:▸\ ,eol:¬
set expandtab
autocmd filetype html,xml set listchars-=tab:>.
" }}}
"
" Autocmd for aterating defaults {{{
" }}}
"
"
" Mapped Keys {{{
nmap <leader>l :set list!<CR>
nmap <silent> <leader>ev :e $MYVIMRC<CR> "edit .vimrc
nmap <silent> <leader>sv :so $MYVIMRC<CR> "source .vimrc
" }}}
"
"
" UltiSnips not working with paste set
" set paste
"
"NERDTree
noremap <Leader>f :NERDTreeToggle<Enter>
nnoremap <silent> <Leader>v :NERDTreeFind<CR>
"
" vim-markdown-preview {{{
" pip install grip
" 0 - depends on markdown perl plugin
" 1 - for github style
let vim_markdown_preview_github=1
" 0, not on buffer write 1 - display image on ctrl-p, 2 - preview on write
" with image, 3- preview on write without image rendering
let vim_markdown_preview_toggle=3
"}}}
"
"{{{
" Ctags
set tags+=~/git/coremw/.vim/tags/cpp
set tags+=~/git/coremw/src/tags
map <C-F12>: !ctags -R --sort=yes --c++kinds=+p --fields=+iaS --extra=+q .<CR>
" OmniCppComplete
let OmniCpp_NamespaceSearch = 1
let OmniCpp_GlobalScopeSearch = 1
let OmniCpp_ShowAccess = 1
let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameters
let OmniCpp_MayCompleteDot = 1 " autocomplete after .
let OmniCpp_MayCompleteArrow = 1 " autocomplete after ->
let OmniCpp_MayCompleteScope = 1 " autocomplete after ::
let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]
" automatically open and close the popup menu / preview window
au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
set completeopt=menuone,menu,longest,preview
au BufNewFile,BufRead,BufEnter *.cpp,*.hpp set omnifunc=omni#cpp#complete#Main
""}}}
if filereadable("~/git/coremw/.vim/cscope.out")
cs add ~/git/coremw/.vim/cscope.out ~/git/coremw
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
" {{{ enN
set exrc " To source .vimrc if present in cwd, to enable project-specific configuration
set secure " Secure it, restrict unsafe commands from non-default vimrc
" }}}
" {{{ vim-go customization
" https://github.com/fatih/vim-go-tutorial#quick-setup
" gofmt and rewrite the import declarations
let g:go_fmt_command = "goimports"
"
autocmd BufNewFile,BufRead *.go setlocal expandtab tabstop=4 softtabstop=4 shiftwidth=4
set rtp+=$GOPATH/src/github.com/golang/lint/misc/vim
autocmd BufWritePost,FileWritePost *.go execute 'GoLint' | cwindow
" }}}
" {{{ Added 01/sep/1028
" Write the file automatically, if we call :make {eg, :GoBuild,GoTest etc, it will
" automatically savea the file before compiling
set autowrite
" To make it easier to jump between errors in quickfix list:
map <C-n> :cnext<CR>
map <C-m> :cprevious<CR>
nnoremap <leader>a :cclose<CR>
" Shortcuts for building Go programs
" autocmd FileType go nmap <leader>b <Plug>(go-build)
" autocmd FileType go nmap <leader>r <Plug>(go-run)
autocmd FileType go nmap <leader>t <Plug>(go-test)
autocmd FileType go nmap <leader>c <Plug>(go-coverage-toggle)
autocmd FileType go nmap <leader>i <Plug>(go-info)
" run :GoBuild or :GoTestCompile based on the go file
function! s:build_go_files()
let l:file = expand('%')
if l:file =~# '^\f\+_test\.go$'
call go#test#Test(0, 1)
elseif l:file =~# '^\f\+\.go$'
call go#cmd#Build(0)
endif
endfunction
autocmd FileType go nmap <leader>b :<C-u>call <SID>build_go_files()<CR>
autocmd Filetype go command! -bang A call go#alternate#Switch(<bang>0, 'edit')
autocmd Filetype go command! -bang AV call go#alternate#Switch(<bang>0, 'vsplit')
autocmd Filetype go command! -bang AS call go#alternate#Switch(<bang>0, 'split')
autocmd Filetype go command! -bang AT call go#alternate#Switch(<bang>0, 'tabe')
" Use only quickfix list not location list
let g:go_list_type = "quickfix"
" vim-go default is snake_case
let g:go_addtags_transform = "camelcase"
" highligt types, fields
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_operators = 1
let g:go_highlight_extra_types = 1
" default settings, add if more
let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck']
" Run on every save
let g:go_metalinter_autosave = 1
let g:go_metalinter_autosave_enabled = ['vet', 'golint']
let g:go_metalinter_deadline = "5s"
" use godef instead of guru, FIXME: Find which is better for you
let g:go_def_mode = 'godef'
let g:go_auto_type_info = 1
let g:go_auto_sameids = 1
set updatetime=100
" For SirVer/ultisnips
filetype plugin indent on
" make YCM compatible with UltiSnips (using supertab)
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
let g:SuperTabDefaultCompletionType = '<C-n>'
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
" Check :help go-settings
" Trial, remove them after
let g:rehash256 = 1
let g:molaki_original = 1
colorscheme molokai
" For vim-airline, install powerline font
" git clone https://github.com/powerline/fonts; cd fonts/; ./install.sh
" Set terminal profile to use a powerline font of your choice
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#syntastic#enabled = 1
let g:airline_theme='powerlineish'
let g:airline_powerline_fonts = 1
set laststatus=2
" close help buffer using q
autocmd FileType help noremap <buffer> q :q<cr>
" }}}