aboutsummaryrefslogtreecommitdiff
path: root/stow/vim/dot-vimrc
blob: 9520648daddd70f5ca5f4d0fd572fabd41f823d1 (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
"        _
" __   _(_)_ __ ___  _ __ ___
" \ \ / / | '_ ` _ \| '__/ __|
"  \ V /| | | | | | | | | (__
"   \_/ |_|_| |_| |_|_|  \___|
"

let mapleader = ","

call plug#begin('~/.vim/plugged') "Update with PlugInstall
Plug 'PotatoesMaster/i3-vim-syntax'
Plug 'junegunn/goyo.vim'
Plug 'junegunn/fzf.vim'
Plug 'junegunn/limelight.vim'
Plug 'arcticicestudio/nord-vim'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'vimwiki/vimwiki'
Plug 'vim-airline/vim-airline'
Plug 'psliwka/vim-smoothie'
"Plug 'vim-syntastic/syntastic'
Plug 'dense-analysis/ale'
"Plug 'Shougo/deoplete.nvim', {'do': ':UpdateRemotePlugins' }
"Plug 'Shougo/deoplete-clangx'
"Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'Valloric/YouCompleteMe'
"Plug 'OmniSharp/omnisharp-vim'
Plug 'dylanaraps/wal.vim'
"Plug 'ThePrimeagen/vim-be-good'
call plug#end()

" Basic settings
set nocompatible
set encoding=utf-8
set number relativenumber
set tabstop=4
set shiftwidth=4
set scrolloff=2
set wildmode=longest,list,full
set splitbelow
set splitright
set vb " No bell
" Searching
set ignorecase
set wrapscan
set incsearch
set nohlsearch

" Filetypes
filetype indent plugin on
au BufRead,BufNewFile *.pu,*.puml,*.pumlc set filetype=plantuml
au BufRead,BufNewFile *.g set filetype=antlr3
au BufRead,BufNewFile *.g4 set filetype=antlr4
au BufRead,BufNewFile *.sent set filetype=sent
let g:tex_flavor = "latex"

" hlnext: Highlighting searches
nnoremap <silent> n n:call HLNext(0.1)<CR>
nnoremap <silent> N N:call HLNext(0.1)<CR>
function! HLNext(blinktime)
	set invcursorline
	redraw
	exec 'sleep'.float2nr(a:blinktime*1000).'m'
	set invcursorline
	redraw
endfunction

" dragvisuals: dragging visual blocks
vmap  <expr>  <LEFT>   DVB_Drag('left')
vmap  <expr>  <RIGHT>  DVB_Drag('right')
vmap  <expr>  <DOWN>   DVB_Drag('down')
vmap  <expr>  <UP>     DVB_Drag('up')
vmap  <expr>  D        DVB_Duplicate()

" Showing tabs
"exec "set listchars=tab:\uBB\uBB,trail:\uB7,nbsp:~"
exec "set listchars=tab:\uBB·,trail:\uB7,nbsp:~"
nnoremap <leader>l :set list!<CR>

" For deoplete

"let g:deoplete#enable_at_startup = 1
"
"call deoplete#custom#option({
"\ 'auto_complete': v:true,
"\ 'auto_complete_delay': 0,
"\ 'smart_case': v:true,
"\ })
"
"call deoplete#custom#option('sources', {
"\ '_': ['ale'],
"\})

" For CoC
"inoremap <silent><expr> <c-space> coc#refresh()

" For YouCompleteMe
let g:ycm_auto_trigger = 1
let g:ycm_autoclose_preview_window_after_insertion = 1

" For syntastic
"set statusline+=%#warningmsg#
"set statusline+=%{SyntasticStatuslineFlag()}
"set statusline+=%*
"let g:syntastic_cs_checkers = ['code_checker']
"let g:syntastic_enable_signs = 1
"let g:syntastic_aggregate_errors = 1
"let g:syntastic_always_populate_loc_list = 1
"let g:syntastic_auto_loc_list = 2
"let g:syntastic_check_on_open = 1
"let g:syntastic_check_on_wq = 0

" For omnisharp
"let g:OmniSharp_server_stdio = 1
"let g:OmniSharp_server_path = '/home/taamas/repos/omnisharp-roslyn/artifacts/scripts/OmniSharp.Stdio'
"let g:OmniSharp_selector_ui = 'fzf'

" For cursor shape with tmux
if exists('$TMUX')
    let &t_SI = "\<Esc>Ptmux;\<Esc>\e[5 q\<Esc>\\"
    let &t_EI = "\<Esc>Ptmux;\<Esc>\e[2 q\<Esc>\\"
else
    let &t_SI = "\e[5 q"
    let &t_EI = "\e[2 q"
endif

"if empty($TMUX)
"  let &t_SI = "\<Esc>]50;CursorShape=1\x7" " Vertical bar in insert mode
"  let &t_EI = "\<Esc>]50;CursorShape=0\x7" " Block in normal mode
"else
"  let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
"  let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
"endif

"if &term =~ '^screen'
"  " tmux will send xterm-style keys when its xterm-keys option is on
"  execute "set <xUp>=\e[1;*A"
"  execute "set <xDown>=\e[1;*B"
"  execute "set <xRight>=\e[1;*C"
"  execute "set <xLeft>=\e[1;*D"
"endif

" For vim-airline
if !exists('g:airline_symbols')
	let g:airline_symbols = {}
endif
let g:airline_left_sep=''
let g:airline_right_sep=''
let g:airline_symbols.linenr = '🔃'
let g:airline_symbols.maxlinenr = '↩'

" For vimwiki
" filetype plugin on
let g:vimwiki_ext2syntax = {'.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
let g:vimwiki_list = [{'path': '~/docs/vimwiki/', 'syntax': 'markdown', 'ext': '.md'},
	\ {'path': '~/docs/notas/', 'syntax': 'markdown', 'ext': '.md'},
	\ {'path': '~/games/dungeonesYDragones/tarkba/vimwiki/', 'syntax': 'markdown', 'ext': '.md'},
	\ {'path': '~/games/dungeonesYDragones/creaciones/vimwiki/', 'syntax': 'markdown', 'ext': '.md'}]

" Vertical split character
set fillchars+=vert:█

" Shortcuts for split navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
map <A-h> <C-w><
map <A-j> <C-w>+
map <A-k> <C-w>-
map <A-l> <C-w>>
map <A-H> <C-w>10<
map <A-J> <C-w>5+
map <A-K> <C-w>5-
map <A-L> <C-w>10>

" Shortcuts for opening netrw
nnoremap <leader>f :40Vexplore<CR>
nnoremap <leader>F :40Lexplore<CR>

" FZF
nnoremap <C-p> :Files<CR>

" Moving -here-
nnoremap <leader>h :cd %:h<CR>

nnoremap <C-n> :tabnew<CR>
"nnoremap <Tab> gt "Can't be set without also remapping <C-i>
"nnoremap <S-Tab> gT

nnoremap <leader>vrc :80vsp ~/.vimrc<CR>
nnoremap <leader>S :!tmux split-window -l '40\%'<CR><CR>

nnoremap <leader>/ /grtfjx<CR>

""" Color
colorscheme nord

" Syntax
syntax enable
syntax on

" Line number color
highlight LineNr ctermfg=12
highlight LineNr cterm=NONE
highlight CursorLineNr ctermfg=5
highlight CursorLineNr cterm=underline

" Completion color
highlight Pmenu ctermbg=blue ctermfg=black
highlight PmenuSel ctermbg=darkblue ctermfg=white

" Panel border color
"highlight VertSplit ctermbg=black ctermfg=darkblue

" Symbol pairs match color
highlight MatchParen ctermbg=cyan ctermfg=black

" Errors colors
highlight Error ctermbg=red ctermfg=black
highlight SpellBad ctermbg=red ctermfg=black

" Comments colors
highlight Comment ctermfg=green

" Line size marking
highlight ColorColumn ctermbg=darkblue ctermfg=black
"Redjail Bomb (thx Damian Conway!)
"highlight ColorColumn ctermbg=red ctermfg=blue
"exec 'set colorcolumn='.join(range(2,80,3), ',')

"Clean trailing whitespaces on save
autocmd BufWritePre * %s/\s\+$//e

" Autoupdate ~/.Xresources
autocmd BufWritePost ~/.Xresources !xrdb %

" Generate ~/.mainpage/urls on ~/.config/qutebrowser save
autocmd BufWritePost ~/.config/qutebrowser/config.py !grep -e \'.*\':\ \'.*{}.*\' "$HOME/.config/qutebrowser/config.py" | grep -v DEFAULT | sed 's/,//; s/^\ *//' > ~/.mainpage/urls

""" Remaps """

nnoremap Y y$
nnoremap <leader>ss :set spell!<CR>
nnoremap <leader>sl :set spelllang=
nnoremap <leader>sL :setlocal spelllang=
nnoremap <leader>e :Errors<Enter>
nnoremap <leader>x :w<CR>:! ./%
inoremap <leader>w <Esc>:w<Enter>
inoremap <leader><leader> <Esc>/<++><Enter>cf>
nnoremap <leader>p "+p
nnoremap <leader>y "+yy
vnoremap <leader>y "+y
nnoremap <leader>d "+dd
vnoremap <leader>d "+d

" For Goyo
function! s:goyo_enter()
	silent !tmux set status off
endfunction

function! s:goyo_leave()
	silent !tmux set status on
endfunction

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

let g:goyo_linenr = 1
nnoremap <leader>G :Goyo \| set linebreak<CR>:e<CR>

" For LimeLight
let g:limelight_conceal_ctermfg = 7

"" git
nnoremap <leader>gs :!git status<CR>
"nnoremap <leader>gpull :!git pull<CR>
nnoremap <leader>ga :!git add %<CR>
nnoremap <leader>gp :!git push<CR>
nnoremap <leader>gc :!git commit -m "