This repository has been archived by the owner on May 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.vimrc
402 lines (332 loc) · 12.5 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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
set nocompatible
execute pathogen#infect()
"filetype plugin on " enable plugins
runtime ftplugin/man.vim
runtime macros/matchit.vim
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
set incsearch "incremental search
set ignorecase "ignore case in searchs
set smartcase "Ignore command ignorecase if the is some uppercase letter"
set scrolloff =1 "at least 1 line of margin in top and bottom
set history =50
set autoread "autorefresh files when updated by another program
set ruler "add ruler with line, column at the bottom-right
set tabstop =4
set shiftwidth =4
set expandtab "tabs are filled with spaces
set langmenu =es_es.utf8
set encoding =utf-8 "file encoding
set cindent "indentation c style
set cinkeys-=0# "Following two lines are for python, so that it doesn't place it in the first column
set indentkeys-=0#
set showmatch "show matching parenthesis.
set showcmd "show partial commands"
set showmode "show current mode.
set nobackup "do not backup files.
set hlsearch "highlight search"
"Read .cpp when opening .h and also the contrary
"au BufRead,BufNewFile *.h exe "bel vsplit" fnameescape(expand("<amatch>:r").".cpp")
"au BufRead,BufNewFile *.cpp exe "vsplit" fnameescape(expand("<amatch>:r").".h")
au CursorHold * checktime
set backspace=indent,start,eol "indent ->allows to delete indents
"eol ->allows to delete line breaks.
"start ->allows to move before the
"beginning of the editing.
set shortmess+=T "No hace falta pulsar <Enter> cuando hay un error.
"colorscheme torte "color scheme.
"colorscheme DarkBlue
"set guifont=Consolas:h14:b:cANSI
"set guifont=Monospace\ Bold:h14:b:cANSI
set nu "line numbers in the left
"pliegues activados.
set foldenable
"activar plegado por tabulación.
"set foldmethod=indent
"activar plegado manual.
set foldmethod=manual
"nivel de plegado a partir de 1 tabulación.
set foldlevel=10
" omnicppcomplete options
" No incluyo boost porque se me va el archivo de tags a 3 GB y se queda sin
" memoria.
noremap <C-x><C-x><C-T> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --exclude='*.qml' --exclude='*.js' --exclude='*.png' --exclude='*.jpg' --exclude='*.so' -f /home/jose-seco/dev/tags_default_cpp /usr/include/c++/5.4.0/ /home/mirada/workspace/product-inspire<CR><CR>
set tags+=/home/jose-seco/dev/tags_default_cpp
"noremap <C-x><C-x><C-U> :!ctags -R --js-kinds=+p --fields=+iaS --extra=+q --exclude='*.qml' --exclude='*.cpp' -f /home/jose-seco/dev/tags_default_js /home/mirada/workspace/product-inspire<CR><CR>
"set tags+=/home/jose-seco/dev/tags_default_js
"Autocomplete options.
set completeopt=menu,menuone,preview
" --- OmniCppComplete ---
" -- configs --
let OmniCpp_MayCompleteDot = 1 " autocomplete with .
let OmniCpp_MayCompleteArrow = 1 " autocomplete with ->
let OmniCpp_MayCompleteScope = 1 " autocomplete with ::
let OmniCpp_SelectFirstItem = 2 " select first item (but don't insert)
let OmniCpp_NamespaceSearch = 2 " search namespaces in this and included files
let OmniCpp_ShowPrototypeInAbbr = 1 " show function prototype (i.e. parameters) in popup window
let OmniCpp_LocalSearchDecl = 1 " don't require special style of function opening braces
" -- ctags --
" noremap <ctrl-x>+<ctrl-t> to generate ctags for current folder:
noremap <C-x><C-t> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR>
" add current directory's generated tags file to available tags
set tags+=./tags
" Setup the tab key to do autocompletion
function! CompleteTab()
let prec = strpart( getline('.'), 0, col('.')-1 )
if prec =~ '^\s*$' || prec =~ '\s$'
return "\<tab>"
else
return "\<c-x>\<c-o>"
endif
endfunction
inoremap <c-tab> <c-r>=CompleteTab()<cr>
nnoremap <silent> <F6> :TlistToggle<CR>
nnoremap <silent> <F7> :NERDTreeToggle /home/jose-seco/workspace/product-inspire/<CR>
:NERDTreeToggle<CR>
"Mapas de distintas teclas
noremap <F8> : mksession! /home/jose-seco/dev/nacho_vim_session<CR>
noremap <F9> : source /home/jose-seco/dev/nacho_vim_session<CR>
"set backupdir =C:\temp
set noswapfile "no generar archivos de swap. Si se va la luz me quedo sin los cambios, pero es menos molesto.
set autowrite "salva el archivo actual al cambiar de buffer.
set sessionoptions+=curdir
set sessionoptions+=folds
set sessionoptions+=help
set sessionoptions+=tabpages
set sessionoptions-=options
set sessionoptions-=localoptions
autocmd BufRead *.qs set syntax=javascript "Si se lee un qs la sintaxis es javascript.
autocmd BufRead *.vim set syntax=vim
autocmd BufRead *.sh set syntax=sh
au BufRead *.html set filetype=htmlm4 "Syntax of html + javascript
"au BufRead *.gsp set filetype=htmlm4 "Syntax of html + javascript
"****************** Configuring a.vim **********************"
" Mappings for C and C++
"***********************************************************"
autocmd FileChangedShell *
\ echohl WarningMsg |
\ echo "File has been changed outside of vim." |
\ echohl None
"nnoremap <C-Tab> gt<CR>
"nnoremap <S-C-Tab> gT<CR>
noremap <C-right> <ESC>gt<CR>
noremap <C-left> <ESC>gT<CR>
nnoremap <C-n> :tabe<CR>
" """"""""""""""""""""""""""""""""""""
" Barra de status.
" """"""""""""""""""""""""""""""""""""
"Poner el formato a la status line.
set statusline=%F%m%r%h%w\ [format=%{&ff}]\ [type=%Y]\ [ascii=\%03.3b]\ [hex=\%02B]\ [pos=%04l,%04v]\ [%p%%]\ [len=%L]
"Hacer la barra de status visible.
set laststatus=2
"Hacer la barra de status invisible.
"set laststatus=0
""""""""""""""""""""""""""""""""""""""
" """"""""""""""""""""""""""""""""
" Marcadores de linea y columna.
" """"""""""""""""""""""""""""""""
set cursorline
"quitar el cursor line.
"set nocursorline
"Poner el marcador de columna.
"set cursorcolumn
"Quitar el marcador de columna.
"set nocursorcolumn
"""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""
"Mapeos propios (de Nacho)
""""""""""""""""""""""""""""""""""""""
"Mapear en modo inserción el Ctrl + S a salvar.
inoremap <C-s> <ESC>:w<CR>
inoremap <C-S> <ESC>:w<CR>
"Mapear la combinación luf para hacer un LookupFile.
nnoremap luf :LookupFile<CR>
"Mapear te para hacer un :tabedit %
nnoremap te :tabedit %<CR>
"""""""""""""""""""""""""""""""""""""""
"Ver también los caracteres no visibles.
"set list
"Que no se vean los caracteres no visibles.
set nolist
" Experimental, pongo esta variable global a 1 para que solamente tome paths
" locales.
let g:alternateRelativeFiles = 1
let mapleader = "_"
nnoremap <leader>ic :call IntroduceConstant()<CR>
nnoremap <leader>rp :call ReorderParameters()<CR>
nnoremap <leader>rvp :call RemoveParameter()<CR>
nnoremap <leader>rv :call RenameVariable()<CR>
nnoremap <leader>lvp :call LocalVariableToParameter()<CR>
vnoremap <leader>em :call ExtractMethod()<CR>
"Select inner word.
nnoremap <space> viw
"Lower line one line.
nnoremap + ddp
"Rise line one line.
nnoremap - ddkP
"Delete line in insert mode.
inoremap <c-d> <esc>ddi
"Uppercase inner word
inoremap <c-u> <esc>viwUi
"Uppercase inner word.
nnoremap <c-u> viwU<esc>
"Seleccionar el interior de parentesis
nnoremap <c-z> vi{
"Seleccionar e indentar.
nnoremap <c-k><c-f> vi{=
"Seleccionar e indentar el archivo entero.
nnoremap <c-i> ggVG=
"Mapear _ev a abrir _vimrc.
nnoremap <leader>ev :tabe $MYVIMRC<CR>
"Reload _vimrc.
nnoremap <leader>sv :source $MYVIMRC<CR>
"Surround word with "
:nnoremap <leader>" viw<esc>i"<esc>hbi"<esc>lel
"Surround word with '
:nnoremap <leader>' viw<esc>i'<esc>hbi'<esc>lel
"Surround with ()
:nnoremap <leader>( viw<esc>i)<esc>hbi(<esc>lel
"Surround selected text with ".
:vnoremap <leader>a" `<vi"<esc>`>i"<esc>
"Escape of insert mode with kj
:inoremap kj <esc>
"Ctrl +W para cerrar pestañas.
:nnoremap <c-x> :clo<cr>
"Ctrl + E para una nueva pestaña.
:nnoremap <c-e> :tabe<cr>
"Ctrl+Inicio para ir al primer tab.
:nnoremap <c-Home> :tabr<cr>
"Ctrl+Fin para ir al ultimo tab.
:nnoremap <c-End> :tabl<cr>
"_so para ordenar una lista.
:vnoremap <leader>so :sort<cr>
"set syntax=cpp
:nnoremap <leader>cpp :set syntax=cpp<cr>
"set syntax=js
:nnoremap <leader>js :set syntax=js<cr>
"move tab + 1
:nnoremap <c-+> :tabm +1<cr>
"move tab - 1
:nnoremap <c--> :tabm -1<cr>
"no higlight mapped to _nh
:nnoremap _nh :noh<cr>
"close all tabs.
:nnoremap <leader>ca :tabdo tabc<cr>
"remove writing restrictios for this file.
:nnoremap <leader>rwr :!chmod a+w %<cr>:edit<cr>
"Syntastic
"Disable includes.
let g:syntastic_cpp_no_include_search = 1
"Disable default includes.
"Check on open and on save.
let g:syntastic_check_on_open=1
"Error in command line.
let g:syntastic_echo_current_error=1
"
"int count = FILLING_RULE::RecordCount( );
let g:syntastic_cpp_no_default_include_dirs = 1
"Delete include errors.
let g:syntastic_cpp_remove_include_errors = 1
"Set syntastic checkers.
let g:syntastic_cpp_checkers = ['cppcheck', 'cpplint', 'clang-tidy', 'clang-check','gcc' ]
"Args for cpplint here.
let g:syntastic_cpp_cpplint_args = "--filter=-whitespace,-build/include_order,-build/include"
let g:syntastic_cpp_gcc_args = "-Wmissing-include-dirs -std=c++14"
"Show errors for all checkers.
let g:syntastic_aggregate_errors = 1
let g:syntastic_python_pylint_args = "--rcfile=~/.vim/pylint.rc"
"enable pylint for python"
let g:syntastic_python_checkers = ['pylint']
let g:Tlist_Ctags_Cmd = '/usr/bin/ctags'
let g:Tlist_WinWidth = 50
"Autocomplete menu colors.
:highlight Pmenu guibg=CornflowerBlue
:highlight Pmenu guifg=Black
:highlight PmenuSel guibg=Black
:highlight PmenuSel guifg=CornflowerBlue
"Create doxygen header of function.
:nnoremap <leader>d :Dox<CR>
let g:DoxygenToolkit_paramTag_post = " [in] "
"Directory of execution is that of Forandesa.
"cd c:\workcopy\ForanDesa\src\
"Try to get the correct directory.
autocmd BufReadPost *.cpp cd %:p:h/
autocmd BufReadPost *.h cd %:p:h/
autocmd BufReadPost *.hh cd %:p:h/
autocmd BufReadPost *.c cd %:p:h/
autocmd BufReadPost *.qs cd %:p:h/
autocmd BufReadPost *.fcs cd %:p:h/
autocmd TabEnter *.* cd %:p:h/
"Save automatically all files when focus lost.
":au FocusLost * silent! wa
"Commands for differences svn.
:nnoremap <leader>diff :VCSDiff<cr>
:nnoremap <leader>bla :VCSAnnotate<cr>
"Set ant as make program.
":set makeprg=ant<cr>
"Rainbow parenthesis plugin.
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
"Deactivate the plugin for now.
":RaibowParenthesesActivate<CR>
":RainbowParenthesesToggle<CR>
let g:rbpt_colorpairs = [
\ ['brown', 'RoyalBlue3'],
\ ['Darkblue', 'SeaGreen3'],
\ ['darkgray', 'DarkOrchid3'],
\ ['darkgreen', 'firebrick3'],
\ ['darkcyan', 'RoyalBlue3'],
\ ['darkred', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['brown', 'firebrick3'],
\ ['gray', 'RoyalBlue3'],
\ ['black', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['Darkblue', 'firebrick3'],
\ ['darkgreen', 'RoyalBlue3'],
\ ['darkcyan', 'SeaGreen3'],
\ ['darkred', 'DarkOrchid3'],
\ ['red', 'firebrick3'],
\ ]
"CtrlP Configuration
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
"Set list of characters to be seen when using command :set list. Whatever is not this is then a simple whitespace
:set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<
"You complete me pluging
"Ag plugin "
let g:ackprg = 'ag --nogroup --nocolor --column'
"Surround by tags of comments.
"nnoremap yss<%-- <leader>mmm
"Map to show words like this in this file and jump to one of them
nnoremap [I [I:let nr = input("Which one: ")<Bar>exe "normal " . nr ."[\t"<CR>
"Map MRU to the same command but not in caps.
nnoremap :mru<CR> :MRU<CR>
"Tabular plugin is loaded
let g:tabular_loaded = 1
"Make tabularize be invoked by Tab
:command Tab Tabularize<CR>