-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
325 lines (246 loc) · 10.6 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
" -----------------------------------------------------------
" General
" -----------------------------------------------------------
set nocompatible "funciones avanzadas
set encoding=utf-8 "otra opcion es latin1
if has("gui_running")
set guioptions=ae
endif
set nowrap
set clipboard=unnamed "para que se use siempre el registro * en lugar del unnamed
set backupdir=$HOME/.vim/temp//
set directory=$HOME/.vim/temp//
set undodir=$HOME/.vim/temp//
"--------------------------------------------------------------------------
" usabilidad
"--------------------------------------------------------------------------
set incsearch "busqueda visual chachi
set smartcase
if has("gui_running")
set autochdir "cambia el directorio actual al del fichero abierto
endif
"teclas de funcion: gestion de buffers
"----------------------------------
set hidden "no me importa que haya buffers ocultos
map <F5> :e<CR> " F5:refresh
imap <F5> <Esc>:e<CR>
map <F7> :bp<CR> " F7:anterior
imap <F7> <Esc>:bp<CR>
map <F8> :bn<CR> " F8:siguiente
imap <F8> <Esc>:bn<CR>
map <F10> :bd<CR> " F10:cerrar
imap <F10> <Esc>:bd<CR>
"para navegar por la ayuda:
nnoremap <C-+> <C-]>
"para cambiar de tab rápidamente
"-------------------------------
map <C-Tab> :tabnext<CR>
imap <C-Tab> <Esc>:tabnext<CR>
map <C-S-Tab> :tabprevious<CR>
imap <C-S-Tab> <Esc>:tabprevious<CR>
if has("win32") "en Windows... copy-paste con ctrl-c y ctrl-v
if has("gui_running")
" ---- Windows Like Copy-Paste keys ----
" CTRL-v is paste
inoremap <C-v> <esc>"*pa
cnoremap <C-v> <C-r>*
" CTRL-x is cut (in visual mode only)
vnoremap <C-x> "*d
" CTRL-c is copy (in visual mode only)
vnoremap <C-c> "*y
endif
endif
"if has("win32") || has("mac") "en Windows y Mac... el leader puede ser º (es como el \ pero sin altgr)
" let mapleader="º"
let mapleader=" "
let maplocalleader=" "
"endif
"--------------------------------------------------------------------------
" indenting done right
"--------------------------------------------------------------------------
set tabstop=4
set expandtab
set shiftwidth=4
"--------------------------------------------------------------------------
" aspecto
"--------------------------------------------------------------------------
set number
syntax on "colorear sintaxis
if has("gui_running")
set columns=220 "columnas
set lines=150 "filas
endif
set textwidth=0 "rompe autom. a los X caracteres con un CRLF
if has("gui_running") "El tipo de letra en una gui...
if has("gui_macvim") " |
set guifont=Ubuntu\ Mono\ derivative\ Powerline:h12 " ---en Mac OS X
elseif has("win32") " |
" set guifont=Ubuntu_Mono_derivative_Powerlin:h9:cANSI " ---en Windows
set guifont=Fira\ Code\ Medium:h9:cANSI " ---en Windows
else " |
set guifont=Droid\ Sans\ Mono\ 8 " ·--elsewhere
endif
endif
set relativenumber
set showcmd "muestra el comando en la statusline
if has("win32") "si es windows, intentamos maximizar la ventana
au GUIEnter * simalt ~x
endif
set listchars=tab:→\ ,trail:·,precedes:«,extends:»,eol:¶,space:·
set foldmethod=syntax
set nofoldenable
set renderoptions=type:directx
" set encoding=utf-8
"--------------------------------------------------------------------------
"--------------------------------------------------------------------------
" FTP AL HOST
"
" para hacer FTP lo lógico es esto:
let g:netrw_ftpmode="ascii"
"
" usuario y password de ftp en fichero aparte, en windows. En otros sistemas
" mejor usar .netrc
let g:netrw_ftp_cmd= "ftp -s:" . $HOME . "\\MACHINE.ftp"
" al hacer logon con el fichero salen mensajes en la ventana de mensajes... me
" la cargo:
let g:netrw_use_errorwindow =0
"
" FTPs al host: así me ahorro el mvsp1 y las comillas al inicio y al final:
command! -nargs=+ Host e ftp://mvsp1/\'<args>\'
command! -nargs=+ PLI e ftp://mvsp1/'sys1.cage.fuentes(<args>)' | setlocal filetype=pli
command! -nargs=+ INC e ftp://mvsp1/'cage.maclib(<args>)' | setlocal filetype=pli
command! -nargs=+ JCL e ftp://mvsp1/'sys1.cage.jcllib(<args>)' | setlocal filetype=jcl
command! -nargs=+ JCLD e ftp://mvsp1/'sys1.cage.jcllib(<args>)' | setlocal filetype=sh
command! -nargs=+ FILE e ftp://mvse1/'<args>'
"--------------------------------------------------------------------------
"--------------------------------------------------------------------------
" Limpiar un JSON fácilmente
command! LimpiarJSON %!python -m json.tool
"--------------------------------------------------------------------------
"--------------------------------------------------------------------------
" En VISUAL si pulsas ":" se lleva el texto seleccionado a la linea de
" comandos
vnoremap : y:<C-r>"<C-b>
"--------------------------------------------------------------------------
"-----------------------------------------------------------------------
" para hacer querys rapidamente, meter ' al principio y ', al final
" ------------------------------------------------------------------------
command! -bar Lista :%s/^/\'/g|:%s/$/\'\,/g
"-----------------------------------------------------------------------
" para abrir URLs (o cualquier puta cosa) a lo bruto en windows con start
"-----------------------------------------------------------------------
nmap ggg :!start "<c-r><c-a>"<CR>
command! SqlIn %s/\s\+$// | %s/.*/'&'/ | %s/\n/,/g | %s/,$// | yy
" ------------------------------------------------------------------------
" Plugin: vim-plug
" ------------------------------------------------------------------------
call plug#begin('~/.vim/plugged')
Plug 'junegunn/fzf'
Plug 'sanchon/misChuletas'
Plug 'tpope/vim-sensible'
Plug 'vim-airline/vim-airline'
Plug 'tomtom/tcomment_vim'
Plug 'sanchon/PLI-Tools'
Plug 'sanchon/jcl.vim'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
Plug 'tpope/vim-capslock'
Plug 'mbbill/undotree'
Plug 'preservim/nerdtree'
Plug 'vim-syntastic/syntastic'
Plug 'vim-pandoc/vim-pandoc'
Plug 'vim-pandoc/vim-pandoc-syntax'
Plug 'bronson/vim-visual-star-search'
Plug 'klen/python-mode'
Plug 'yegappan/mru'
Plug 'easymotion/vim-easymotion'
Plug 'thinca/vim-fontzoom'
Plug 'flazz/vim-colorschemes'
Plug 'airblade/vim-gitgutter'
Plug 'sk1418/HowMuch'
Plug 'dbeniamine/todo.txt-vim'
Plug 'vifm/vifm.vim'
Plug 'skanehira/preview-markdown.vim'
Plug 'vimwiki/vimwiki'
Plug 'dhruvasagar/vim-open-url'
Plug 'vim-ctrlspace/vim-ctrlspace'
call plug#end()
" ------------------------------------------------------------------------
" Colorscheme
" ------------------------------------------------------------------------
if has("gui_running")
colorscheme tchaba
endif
" ------------------------------------------------------------------------
" Plugin:NerdTree
" ------------------------------------------------------------------------
map <leader>n :NERDTreeToggle<CR>
map <leader>N :NERDTreeFind<CR>
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
" ------------------------------------------------------------------------
" Plugin:Gundo
" ------------------------------------------------------------------------
map <leader>g :GundoToggle<CR>
" ------------------------------------------------------------------------
" Plugin:Airline (ojo, necesitas una "patched font" para que mole)
" ------------------------------------------------------------------------
if has("gui_running")
let g:airline_powerline_fonts=1 "(estos simbolitos no funcionan en la shell)
endif
let g:airline#extensions#branch#enabled = 1
" let g:bufferline_echo = 0
let g:airline#extensions#tabline#enabled = 1
" let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
let g:airline_section_b =airline#section#create_left(['%{CapsLockStatusline()}'])
" ------------------------------------------------------------------------
" Plugin: Pandoc
" ------------------------------------------------------------------------
let g:pandoc#spell#enabled=0
let g:pandoc#keyboard#enabled=1
let g:pandoc#folding#level=20
let g:pandoc#filetypes#handled = ["pandoc","markdown"]
let g:pandoc#command#templates_file = split(&runtimepath, ",")[0]."/vim-pandoc-templates"
command! PandocAutoEjecutarMyRevealJsWeb let g:pandoc#command#autoexec_command = "Pandoc #myRevealJsWeb" | let g:pandoc#command#autoexec_on_writes = 1
" ------------------------------------------------------------------------
" Plugin: Fontzoom
" ------------------------------------------------------------------------
let g:fontzoom_no_default_key_mappings = 1 "por defecto son + y -
map <leader>+ <plug>(fontzoom-larger)
map <leader>- <plug>(fontzoom-smaller)
" ------------------------------------------------------------------------
" Plugin: HowMuch
" ------------------------------------------------------------------------
vmap <leader>= <Plug>AutoCalcAppendWithEq
vmap <leader>== <Plug>AutoCalcAppendWithSum
vmap <leader>=== <Plug>AutoCalcAppendWithEqAndSum
" ------------------------------------------------------------------------
" Plugin: Todo.txt-vim
" ------------------------------------------------------------------------
" activar el autocompletado de proyectos y contextos
au filetype todo setlocal omnifunc=todo#Complete
" Auto completar proyectos
au filetype todo imap <buffer> + +<C-X><C-O>
" Auto completar contextos
au filetype todo imap <buffer> @ @<C-X><C-O>
" ------------------------------------------------------------------------
" Plugin: Preview-Markdown
" ------------------------------------------------------------------------
let g:preview_markdown_vertical = 1
let g:preview_markdown_auto_update = 1
" ------------------------------------------------------------------------
" Plugin: vimwiki
" ------------------------------------------------------------------------
let g:vimwiki_list = [{
\ 'path':'~\notas',
\ 'syntax':'markdown',
\ 'ext': '.md',
\}]
let g:vimwiki_global_ext = 0
let g:vimwiki_markdown_link_ext = 1
let g:vimwiki_url_maxsave=0
" ------------------------------------------------------------------------
" Plugin: vim-open-url
" ------------------------------------------------------------------------
nmap gb <Plug>(open-url-browser)
xmap gb <Plug>(open-url-browser)