-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
188 lines (152 loc) · 4.54 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
set nocompatible
filetype off
syntax on
set tabstop=2
"set expandtab
set softtabstop=2
set shiftwidth=2
set noexpandtab
set number
set rnu
set smartindent
set laststatus=2
set ruler
set guicursor= " elimina un error de nvim con simbolos raros
set autochdir
set cursorline
" let g:spellfile_URL = 'http://ftp.vim.org/pub/vim/runtime/spell/'
" set spell spelllang=es,en_us
" set complete+=kspell
" =============== STATUS BAR =================
" ============================================
set statusline=
set statusline+=\[%n]
set statusline+=%{StatuslineGit()} "Git
set statusline+=%1*\ %f\ "File+path
set statusline+=%2*\ %y\ "FileType
set statusline+=Line: " Current Line
set statusline+=%3*\%l/%L\ " Current Line\Total lines
set statusline+=col:
set statusline+=\%c
set statusline+=%=
set statusline+=%7*\%p%%
set statusline+=\%{strftime(\"%H:%M\")} " Hora
set title titlestring=...%{strpart(expand(\"%:p:h\"),stridx(expand(\"%:p:h\"),\"/\",strlen(expand(\"%:p:h\"))-12))}%=%n.\ \ %{expand(\"%:t:r\")}\ %m\ %Y\ \ \ \ %l\ of\ %L
function! GitBranch()
return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
endfunction
function! StatuslineGit()
let l:branchname = GitBranch()
return strlen(l:branchname) > 0?' '.l:branchname.' ':''
endfunction
" =============== CONFIG =====================
" ============================================
" Cambiar el esc por al caps
au VimEnter * :silent !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'
au VimLeave * :silent !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Caps_Lock'
" ================
" anadir nueva linea en blanco
nmap oo o<Esc>k
" ================
" guardar archivos todos
inoremap <C-s> <ESC>:wa<CR>
nnoremap <C-s> :wa<CR>
" ================
" buscar un archivo
" set path+=**
set clipboard=unnamedplus
" moverse por window Alt-[h,j,k,l]
inoremap <A-h> <C-\><C-N><C-w>h
inoremap <A-j> <C-\><C-N><C-w>j
inoremap <A-k> <C-\><C-N><C-w>k
inoremap <A-l> <C-\><C-N><C-w>l
nnoremap <A-h> <C-w>h
nnoremap <A-j> <C-w>j
nnoremap <A-k> <C-w>k
nnoremap <A-l> <C-w>l
" Maps Alt-[h,j,k,l] to resizing a window split
map <silent> <A-C-h> <C-w><
map <silent> <A-C-j> <C-W>-
map <silent> <A-C-k> <C-W>+
map <silent> <A-C-l> <C-w>>
" Maps Alt-[s.v] to horizontal and vertical split respectively
map <silent> <A-s> :split<CR>
map <silent> <A-v> :vsplit<CR>
" WILDMENU, para autocomplete de busquedas de archivos
set wildmenu wildmode=longest:full,full
set wildignore+=**/node_modules/**
set wildignore+=node_modules/**
set wildignore+=*/tmp/*,*.so,*.swp,*.zip
set wildignore+=*.pyc,*/env,*/_pycache_
command! MakeTags !ctags -R *
" ================
" Tab navigation
nnoremap <C-h> :tabprev<CR>
nnoremap <C-l> :tabnext<CR>
nnoremap <C-t> :tabnew<CR>
inoremap <C-h> <Esc>:tabprev<CR>
inoremap <C-l> <Esc>:tabnext<CR>
inoremap <C-t> <Esc>:tabnew<CR>
nnoremap <C-delete> :tabclose<CR>
" alternative
" next tab: gt
" prior tab: gT
" number tab: nnn gt
" ================
" Autocomplete vim
" para el archivo: ctrl + n
" just this file: ^x^n
" find file path: ^x^f
" for tags only: ^x^]
" ^n o ^p para moverse
" Edit vimr configuration file
nnoremap <Leader>ve :e $MYVIMRC<CR>
" " Reload vimr configuration file
nnoremap <Leader>vr :source $MYVIMRC<CR>
" ++++++++++++++++++++++++++++++++++
" ============= AUTOCOMPLETE =================
" ============================================
" al terminar salir de brackets
" ino " ""<left>
" ino ' ''<left>
" ino ( ()<left>
" ino [ []<left>
" ino { {}<left>
" ino {<CR> {<CR>}<ESC>O
" ino {;<CR> {<CR>};<ESC>O
""'inoremap <S-Tab> <esc>lA
""inoremap <c-j> <esc>ji
""inoremap <c-k> <esc>ki
""inoremap <c-h> <esc>i
""inoremap <c-l> <esc>2li
" map <leader>g :Ack
" noremap <Up> <Nop>
" noremap <Down> <Nop>
" noremap <Left> <Nop>
" noremap <Right> <Nop>
" Crear los ctags (instalar exuberant-ctags)
" command! MakeTags !ctags -R .
"Session
"map <C-s> :mksession .mysession.vim!<CR>
" HTML
" :iabbrev </ </<C-X><C-O>
" func! PrintFirstAndLastLine() range
" echo a:firstline
" echo a:lastline
" endfu
" com! -range -nargs=* FL <line1>,<line2>call PrintFirstAndLastLine()
" FUNCIONES
" function! HighlightSearch()
" if &hls
" return 'H'
" else
" return ''
" endif
" endfunction
" cnoremap w!! call SudoSaveFile()
" function! SudoSaveFile() abort
" execute (has('gui_running') ? '' : 'silent') 'write !env SUDO_EDITOR=tee sudo -e % >/dev/null'
" let &modified = v:shell_error
" endfunction
" GIST
" set statusline=[%n]\ %<%F\ \ \ [%M%R%H%W%Y][%{&ff}]\ \ %=\ line:%l/%L\ col:%c\ \ \ %p%%\ \ \ @%{strftime(\"%H:%M:%S\")}