-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
264 lines (217 loc) · 6.78 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
set nocompatible " be iMproved
filetype off " required!
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle
" required!
Plugin 'gmarik/Vundle.vim'
" My bundles here:
" UltiSnips for snipets
Plugin 'SirVer/UltiSnips'
"let g:UltiSnipsExpandTrigger="<c-tab>"
"let g:UltiSnipsListSnippets="<c-s-tab>"
let g:UltiSnipsExpandTrigger="<C-j>"
let g:UltiSnipsJumpForwardTrigger="<C-j>"
let g:UltiSnipsJumpBackwardTrigger="<C-k>"
" Snippets are separated from the engine
Plugin 'honza/vim-snippets'
" Command T plugin
Plugin 'wincent/Command-T'
"let g:CommandTMatchWindowAtTop = 1
"let g:CommandTMatchWindowReverse = 1
Plugin 'Valloric/YouCompleteMe'
let g:ycm_global_ycm_extra_conf = "/home/sik/.vim/ycm_extra_conf.py"
let g:ycm_confirm_extra_conf = 0
"let g:ycm_server_log_level = 'debug'
"let g:ycm_key_list_previous_completion=['<Up>']
"YcmCompleter GoToDefinitionElseDeclaration<CR>
"Plugin to visualize tabs
Plugin 'nathanaelkane/vim-indent-guides'
"let g:indent_guides_auto_colors = 0
"hi IndentGuidesOdd ctermbg=black
"hi IndentGuidesEven ctermbg=darkgrey
"Plugin to change between .h and .cpp
"Bundle 'a.vim'
Plugin 'LaTeX-Box-Team/LaTeX-Box'
let g:LatexBox_latexmk_options = "-xelatex -pdf -pvc"
" From https://github.com/LaTeX-Box-Team/LaTeX-Box/issues/105
let g:LatexBox_latexmk_async=1 "ho deia l'error del vim...
let g:LatexBox_quickfix=2
let g:LatexBox_latexmk_preview_continuously=1
"-pdfps -pvc"
"Bundle 'Conque-Shell'
"Close buffer plugin
Plugin 'butane.vim'
"Increment indexes
Plugin 'increment.vim'
"Search and replace on multiple files
"Bundle 'EasyGrep'
Plugin 'dkprice/vim-easygrep'
""" Editing Stuff -- Vim as generic IDE
" Generic edtion
Plugin 'surround.vim' " To insert '', [], (), {}... surrounding the selection
Plugin 'abolish.vim' " camelCase snake_case search insensitivity (and more)
Plugin 'repeat.vim'
Plugin 'tpope/vim-repeat' " remap . for plugins
Plugin 'tommcdo/vim-exchange' " use vim-exchange to swap words, text, etc..
Plugin 'Raimondi/delimitMate' " Add closing brakeds and quotes
" use git from vim
Plugin 'tpope/vim-fugitive'
Plugin 'gitv'
Plugin 'airblade/vim-gitgutter'
"" Languages
Plugin 'rykka/riv.vim' " reST
" Python Stuff
Plugin 'ivanov/vim-ipython' " conection with ipython
Plugin 'scrooloose/Syntastic' " PEP-8 style checking
Plugin 'plantuml-syntax' " UML markdown text
"Bundle 'clang-complete'
"Bundle 'highlight_current_line.vim'
" Navigation Stuff
Plugin 'Lokaltog/vim-easymotion'
Plugin 'Tagbar'
nmap <F11> :TagbarToggle<CR>
Plugin 'TaskList.vim'
map <sHFIT><F11> <Plug>TaskList
Plugin 'ZoomWin'
Plugin 'Gundo'
map <Ctrl-U> :GundoToggle<CR>
Plugin 'ack.vim'
nmap <leader>a <Esc>:Ack!
" Bundle 'Powerline'
Plugin 'bling/vim-airline'
"let g:airline_powerline_fonts = 1
" Spreatsheed stuff
Plugin 'Tabular'
Plugin 'dhruvasagar/vim-table-mode'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" 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
" Put your non-Plugin stuff after this line
" My commands
" Set color scheme that I like.
if $TERM == "xterm-256color"
set t_Co=256
endif
colorscheme default
if has("gui_running")
"colorscheme vividchalk
colorscheme zenburn
"colorscheme blue
"set background=dark
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
set guioptions-=r "remove right-hand scroll bar
set guioptions-=L "remove left-hand scroll bar
else
"colorscheme darkblue
"colorscheme blue
colorscheme zenburn
"colorscheme vividchalk
endif
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_auto_colors = 1
"hi IndentGuidesOdd guibg=lightgray ctermbg=3
"hi IndentGuidesEven guibg=darkgray ctermbg=4
" To avoid clang message of not compiling small files
set cmdheight=2
" Show line number
" relative when normal mode, absolute otherwise
set relativenumber
autocmd InsertEnter * :set number
autocmd InsertLeave * :set relativenumber
" Highlight current line
set cursorline
" Show Clumn line
set colorcolumn=80
" Show autocomplete list of commands
set wildmenu
" Change leader key to ","
let mapleader = ","
"" IDE-related configuration
function! Preserve(command)
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
execute a:command
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
"remove spaces at the end of the line
nmap _$ :call Preserve("%s/\\s\\+$//e")<CR>
" auto-indent the current file
nmap _= :call Preserve("normal gg=G")<CR>
" YCM go to definition
nnoremap <leader>gd :YcmCompleter GoToDefinitionElseDeclaration<CR>
"Buffer navigation
"map <leader>n :bn<cr>
"map <leader>p :bp<cr>
"map <leader>d :bd<cr>
"map <leader>l :ls<cr>
noremap <leader>bd :Bclose<CR> " Close the buffer.
noremap <leader>bl :ls<CR> " List buffers.
noremap <leader>bn :bn<CR> " Next buffer.
noremap <leader>bp :bp<CR> " Previous buffer.
noremap <leader>bt :b#<CR> " Toggle to most recently used buffer.
noremap <leader>bx :Bclose!<CR> " Close the buffer & discard changes.
nnoremap <silent> <Leader>bb :CommandTBuffer<CR>
"Able and disable spellcheck in english
set spell spelllang=en_gb
noremap <F2> :setlocal spell! spelllang=en_gb<CR>
nmap <leader>s :setlocal spell! spelllang=en_gb<CR>
"spaces instead of tab
set expandtab
set tabstop=2
set shiftwidth=2
"moving in warped lines
nnoremap H g0
nnoremap L g$
vnoremap H g0
vnoremap L g$
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
nnoremap <Down> gj
nnoremap <Up> gk
vnoremap <Down> gj
vnoremap <Up> gk
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
inoremap jk <esc>
inoremap kj <esc>
"set guifont=DejaVu\ Sans\ Mono\ 10
set guifont=Monospace\ 12
"braking hte habit of using the arrowkeys
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
" airline configuration
set showcmd "Show what you are tiping in normal mode
set laststatus=2 "workaround for showing airline when no split
set noshowmode "remove the old status bar -- INSERT --
" search highligting toggle
map <F12> :set nohls<CR>:let @s = @/<CR>:let @/ = ""<CR>:set hls<CR>
" latex stuff
filetype plugin on
set grepprg=grep\ -nH\ $*
let g:tex_flavor='latex'
" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,eol:¬