summaryrefslogtreecommitdiff
path: root/vimrc
blob: 5d78cccd1dbd1b6c5b71f1b7319c3d626efbf4b4 (plain)
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
402
403
404
405
406
407
408
409
410
411
412
413
set nocompatible
filetype off

call plug#begin('~/.vim/plugged')

Plug 'vim-scripts/a.vim'
Plug 'vim-scripts/po.vim'
Plug 'jamessan/vim-gnupg'
Plug 'vim-scripts/ShowTrailingWhitespace'

Plug 'vim-scripts/vcscommand.vim'
Plug 'tpope/vim-fugitive'
Plug 'gregsexton/gitv'
Plug 'airblade/vim-gitgutter'

Plug 'ctrlpvim/ctrlp.vim'
Plug 'ervandew/supertab'

Plug 'Lokaltog/vim-easymotion'
Plug 'mattn/calendar-vim', {'on': ['Calendar', 'CalendarH', 'CalendarT', 'CalendarVR']}
Plug 'vim-scripts/paredit.vim'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'mileszs/ack.vim'
if executable('ag')
	let g:ackprg = 'ag --vimgrep'
endif
Plug 'kana/vim-operator-user'

Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'

Plug 'scrooloose/syntastic'
Plug 'Valloric/YouCompleteMe', {'do': './install.sh --clang-completer --system-libclang', 'frozen': 1}
Plug 'vim-scripts/DoxygenToolkit.vim'
Plug 'antoyo/vim-licenses'
let g:licenses_copyright_holders_name = "Joaquín Aguirrezabalaga <kinote@kinote.org>"

Plug 'sgur/vim-editorconfig'

" Filetypes
Plug 'vimoutliner/vimoutliner'

Plug 'rhysd/vim-clang-format', {'for': ['c', 'cpp']}

Plug 'peterhoeg/vim-qml', {'for': 'qml'}

Plug 'hynek/vim-python-pep8-indent', {'for': 'python'}

Plug 'solarnz/thrift.vim', {'for': 'thrift'}

Plug 'saltstack/salt-vim', {'for': 'salt'}

Plug 'pearofducks/ansible-vim', {'for': 'ansible'}

Plug 'kurayama/systemd-vim-syntax', {'for': 'systemd'}

Plug 'kergoth/vim-bitbake', {'for': 'bitbake'}

Plug 'fatih/vim-go', {'for': 'go'}

Plug 'guns/vim-clojure-static', {'for': 'clojure'}
Plug 'tpope/vim-fireplace', {'for': 'clojure'}

Plug 'rust-lang/rust.vim', {'for': 'rust'}
let g:rustfmt_autosave = 1
Plug 'cespare/vim-toml', {'for': 'toml'}

Plug 'othree/xml.vim', {'for': 'xml'}
Plug 'timcharper/textile.vim', {'for': 'textile'}

Plug 'elzr/vim-json', {'for': 'json'}
let g:vim_json_syntax_conceal = 0

Plug 'othree/html5.vim'
let g:html_exclude_tags = ['html', 'script', 'style']
Plug 'pangloss/vim-javascript'
Plug 'posva/vim-vue'

Plug 'leafgarland/typescript-vim'
Plug 'Quramy/tsuquyomi'

Plug 'Glench/Vim-Jinja2-Syntax'

Plug 'mustache/vim-mustache-handlebars'

Plug 'glensc/vim-syntax-lighttpd', {'for': 'lighttpd'}

" Text editing
Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
let g:limelight_conceal_ctermfg = 240
Plug 'reedes/vim-pencil'

" Markdown
Plug 'godlygeek/tabular'
Plug 'gabrielelana/vim-markdown'
"let g:markdown_enable_conceal = 1
Plug 'chmp/mdnav'

"Plug 'jjaderberg/vim-ft-asciidoc'
"let g:asciidoc_use_defaults = ['editing', 'navigating', 'compiling', 'options']
"let g:asciidoc_use_defaults = ['folding', 'editing', 'navigating', 'compiling', 'options']

" Asciidoctor
Plug 'dahu/vimple'
Plug 'dahu/Asif'
Plug 'Raimondi/VimRegStyle'
Plug 'dahu/vim-asciidoc'

Plug 'Rykka/riv.vim'
Plug 'Rykka/InstantRst'

Plug 'gyim/vim-boxdraw'

" Style and decorations
Plug 'bling/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'asenac/vim-airline-loclist'
let g:airline_theme='jellybeans'
let g:airline_left_sep=''
let g:airline_right_sep=''
"let g:airline_section_z=''
"let g:airline#extensions#syntastic#enabled = 1
let g:airline#extensions#whitespace#enabled = 0
let g:airline#extensions#loclist#enabled = 1
Plug 'nanotech/jellybeans.vim'

Plug 'DougBeney/pickachu'

call plug#end()

filetype plugin indent on

if has("patch-8.0-1085")
	packadd termdebug
endif

syntax on
set bg=dark

let g:jellybeans_overrides = {
\    'Normal'     : {'256ctermbg': 'None'},
\    'NonText'    : {'256ctermbg': 'None'},
\    'CursorLine' : {'256ctermbg': 232},
\    'DiffAdd'    : {'256ctermbg': 236, '256ctermfg': 'None'},
\    'DiffDelete' : {'256ctermbg': 246, '256ctermfg': 236},
\    'DiffChange' : {'256ctermbg': 235, '256ctermfg': 'None'},
\    'DiffText'   : {'256ctermbg': 54,  '256ctermfg': 'None', 'attr': ''},
\    'ShowTrailingWhitespace' : {'256ctermbg': 198, '256ctermfg': 233},
\    'String'     : {'256ctermfg': 148},
\    'ColorColumn': {'256ctermbg': 233},
\}
colorscheme jellybeans

let &colorcolumn="80,120"

set backspace=indent,eol,start
set modeline
set modelines=5
set showmatch
set tw=0
set incsearch
set hidden
set cursorline
set wildmode=longest,list:longest,list:full
set laststatus=2 "Show always the statusline

"au BufWritePost ~/.vimrc so ~/.vimrc
au BufWritePost ~/.Xresources !xrdb ~/.Xresources

"au BufEnter *.rhtml	setf html
au BufEnter *.rbx	setf ruby
au BufEnter *.cls	setf tex
au BufEnter *.docbook	setf xml
au BufEnter *.ms	setf scheme
au BufEnter *.pde	setf cpp
au BufEnter *.ino	setf cpp
au BufEnter *.otl	setf votl
au BufEnter ~/todo/*	setf votl
au BufEnter ~/TODO	setf votl
au BufEnter TODO	setf votl
au BufEnter ~/ACTUALIZACION	setf votl

au BufEnter ~/.mutt/*	setf muttrc
au BufEnter ~/.bash*	setf sh
au BufEnter /etc/apache2/*	setf apache

au BufEnter wscript	setf python
au BufEnter wscript_build	setf python

"au BufEnter *		lcd %:p:h
"
"au BufWritePost ~/.Xresources system("xrdb ~/.Xresources")

au BufEnter ~/ast/*	setf asterisk

let g:changelog_username = "Joaquín Aguirrezabalaga <kinote@kinote.org>"

let g:debianfullname = 'Joaquín Aguirrezabalaga'
let g:debianemail = 'kinote@kinote.org'
let g:debchangelog_fold_enable = 1

"let g:EMAIL = "Joaquin Aguirrezabalaga <kinote@kinote.org>"
inoremap JAE Joaquin Aguirrezabalaga <kinote@kinote.org>

set printoptions=syntax:n
"set printotions="%<%f%h%=Page %N"

" search for tags in current folder or its parents until /
set tags=./tags;/
noremap <F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>

map <F2> :Sexplore<CR>
map <F3> :TagbarToggle<CR>
map <F4> :make<CR>

map <F5> <C-W>=

inoremap <C-c> <Esc><Esc>
imap jk <Esc>

noremap <C-j> <C-W>j<C-W>_
noremap <C-k> <C-W>k<C-W>_
set winminheight=0

map <A-q> gqap

let mapleader=","
let maplocalleader=",,"

"set encoding=utf-8
"set fileencoding=utf-8

let Tlist_WinWidth = 39

set scrolloff=2

set mouse=a

let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1

let g:calendar_monday = 1
let g:calendar_diary = "~/.diary"

let spell_executable = "aspell"
let spell_aspell_tex_args = "-t"

if version >= 700
	set spelllang=es,en_us
endif

let g:haddock_browser = 'x-www-browser'

" Evitar pliegues
set foldlevel=99
set foldlevelstart=99
" Mapear la barra a abrir/cerrar fold
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>

" Print options
set printfont=courier:h8
set printoptions=paper:a4,portrait:y,left:10mm,right:10mm,top:10mm,bottom:10mm

runtime! ftplugin/man.vim

" make cmdline more similar to readline
cnoremap <C-p> <Up>
cnoremap <C-n> <Down>
cnoremap <C-a> <Home>
cnoremap <C-f> <Right>
cnoremap <C-d> <Delete>

let g:omlet_indent_let=0
"let g:omlet_indent_match = 0
"let g:omlet_indent_function = 0

let g:GPGPreferArmor=1

let g:EnhCommentifyUseAltKeys='yes'

let g:vimwiki_list = [{'path': '~/.vimwiki/',
			\ 'index': 'main', 'ext': '.w.gpg'}]
let g:vimwiki_dir_link = 'main'
let g:vimwiki_folding = 1
let g:vimwiki_fold_lists = 1

let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_python_checkers = ['flake8']
let g:syntastic_c_checkers = ['ycm']
let g:syntastic_cpp_checkers = ['ycm']
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_vue_checkers = ['eslint']
let g:syntastic_rst_checkers = ['sphinx']
let local_eslint = finddir('node_modules', '.;') . '/.bin/eslint'
if matchstr(local_eslint, "^\/\\w") == ''
	let local_eslint = getcwd() . "/" . local_eslint
endif
if executable(local_eslint)
	let g:syntastic_javascript_eslint_exec = local_eslint
	let g:syntastic_vue_eslint_exec = local_eslint
endif
let g:syntastic_php_checkers = ['php']
let g:syntastic_sh_checkers = ['sh', 'shellcheck', 'bashate', 'checkbashishms']
let g:syntastic_shell = "/bin/bash"
let g:syntastic_go_checkers = ['go', 'golint', 'govet', 'errcheck']
let g:syntastic_rust_checkers = ['cargo']

let g:ycm_always_populate_location_list = 1
let g:ycm_server_log_level = 'info'
let g:ycm_global_ycm_extra_conf='~/.vim/ycm_extra_conf.py'
let g:ycm_python_binary_path = 'python'
nnoremap <leader>jj :YcmCompleter GoTo<CR>
nnoremap <leader>jd :YcmCompleter GoToDeclaration<CR>
nnoremap <leader>jt :YcmCompleter GetType<CR>
nnoremap <leader>jp :YcmCompleter GetParent<CR>
nnoremap <leader>jf :YcmCompleter FixIt<CR>
nnoremap <leader>m :make<CR>

nnoremap <leader>gg :Goyo<CR>
nnoremap <leader>ll :Limelight!!<CR>

let g:UltiSnipsExpandTrigger = '<C-j>'
let g:UltiSnipsJumpForwardTrigger = '<C-j>'
let g:UltiSnipsJumpBackwardTrigger = '<C-k>'

if executable('clang-format')
	let g:clang_format#command='clang-format'
elseif executable('clang-format-3.6')
	let g:clang_format#command='clang-format-3.6'
endif
let g:clang_format#detect_style_file=1
let g:clang_format#auto_format=0

let g:xml_syntax_folding=1

let g:DoxygenToolkit_briefTag_pre=""

let g:go_fmt_command = "goimports"

" Detect VUE files
augroup filetypedetect
  au! BufRead,BufNewFile *.vue		setfiletype html
augroup END

set directory=~/.vimtmp//
if !isdirectory($HOME."/.vimtmp")
	call mkdir($HOME."/.vimtmp")
endif

" remove trailing whitespace
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>

" Move cursor by display lines when wrapping
noremap <buffer> <silent> k gk
noremap <buffer> <silent> j gj
noremap <buffer> <silent> 0 g0
noremap <buffer> <silent> $ g$

"augroup pencil
"  autocmd!
"  autocmd FileType markdown,mkd,text call pencil#init()
"  autocmd FileType mail call pencil#init({'textwidth': 72})
"augroup END
let g:pencil#softDetectSample = 0

let g:ctrlp_custom_ignore = {
  \ 'dir':  '\.git$\|\.hg$\|\.svn$\|\.yardoc$\|node_modules$\|venv$',
  \ 'file': '\.exe$\|\.so$\|\.dat$\|\.o$'
  \ }
let g:ctrlp_root_markers = ['.ctrlp']

let g:is_posix = 1

let g:goyo_width = 120
let g:goyo_height = '90%'

function! s:goyo_enter()
	if exists('$TMUX')
		silent !tmux set status off
	endif
	set noshowmode
	set noshowcmd
	set scrolloff=999
	"Limelight
endfunction

function! s:goyo_leave()
	if exists('$TMUX')
		silent !tmux set status on
	endif
	set showmode
	set showcmd
	set scrolloff=5
	"Limelight!
endfunction

autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()

nnoremap <Leader>gv :Gitv --all<CR>
nnoremap <Leader>gV :Gitv! --all<CR>
xnoremap <Leader>gV :Gitv! --all<CR>

" Local settings - Run this last
runtime! local.vim