mirror of
https://github.com/amix/vimrc
synced 2025-02-28 14:12:51 +08:00

- se agregó /inicioVim.command que es una manera de ejecutar vim con NERDTree activado - se agregó /pendiente.txt para agregar ítems sobre las modificaciones que hay que hacer - se corrigió el mapeo 'ino ñjaf <esc>': se le quitó un espacio que tenía al final, que hacía que cuando el cursor estaba en EOL hacía retorno de carro y salto de línea - se activaron los números relativos por defecto - se agregó la secuencia $b tanto en modo VISUAL como INSERT para agregar 'begin' y 'end' automáticamente - se agregó un mapeo $$ en modo INSERT para poder salir de los paréntesis cuando el cursor está sobre el paréntesis de cierre. Eso hace más cómo el uso de los mapeos que colocan los diferentes tipos de paréntesis automáticamente
145 lines
4.3 KiB
VimL
145 lines
4.3 KiB
VimL
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
" Important:
|
|
" This requries that you install https://github.com/amix/vimrc !
|
|
"
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
" => GUI related
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
" Set font according to system
|
|
if has("mac") || has("macunix")
|
|
set gfn=Hack:h14,Source\ Code\ Pro:h15,Menlo:h15
|
|
elseif has("win16") || has("win32")
|
|
set gfn=Hack:h14,Source\ Code\ Pro:h12,Bitstream\ Vera\ Sans\ Mono:h11
|
|
elseif has("gui_gtk2")
|
|
set gfn=Hack\ 14,Source\ Code\ Pro\ 12,Bitstream\ Vera\ Sans\ Mono\ 11
|
|
elseif has("linux")
|
|
set gfn=Hack\ 14,Source\ Code\ Pro\ 12,Bitstream\ Vera\ Sans\ Mono\ 11
|
|
elseif has("unix")
|
|
set gfn=Monospace\ 11
|
|
endif
|
|
|
|
" Disable scrollbars (real hackers don't use scrollbars for navigation!)
|
|
set guioptions-=r
|
|
set guioptions-=R
|
|
set guioptions-=l
|
|
set guioptions-=L
|
|
|
|
" Colorscheme
|
|
set background=dark
|
|
colorscheme peaksea
|
|
|
|
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
" => Fast editing and reloading of vimrc configs
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
map <leader>e :e! ~/.vim_runtime/my_configs.vim<cr>
|
|
autocmd! bufwritepost vimrc source ~/.vim_runtime/my_configs.vim
|
|
|
|
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
" => Turn persistent undo on
|
|
" means that you can undo even when you close a buffer/VIM
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
try
|
|
set undodir=~/.vim_runtime/temp_dirs/undodir
|
|
set undofile
|
|
catch
|
|
endtry
|
|
|
|
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
" => Command mode related
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
" Smart mappings on the command line
|
|
cno $h e ~/
|
|
cno $d e ~/Desktop/
|
|
cno $j e ./
|
|
cno $c e <C-\>eCurrentFileDir("e")<cr>
|
|
|
|
" $q is super useful when browsing on the command line
|
|
" it deletes everything until the last slash
|
|
cno $q <C-\>eDeleteTillSlash()<cr>
|
|
|
|
" Bash like keys for the command line
|
|
cnoremap <C-A> <Home>
|
|
cnoremap <C-E> <End>
|
|
cnoremap <C-K> <C-U>
|
|
|
|
cnoremap <C-P> <Up>
|
|
cnoremap <C-N> <Down>
|
|
|
|
" Map ½ to something useful
|
|
map ½ $
|
|
cmap ½ $
|
|
imap ½ $
|
|
|
|
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
" => Parenthesis/bracket
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
" autocompletado de (, ", ', [, [[[, {{{}}} en modo VISUAL
|
|
vnoremap $1 <esc>`>a)<esc>`<i(<esc>
|
|
vnoremap $2 <esc>`>a]<esc>`<i[<esc>
|
|
vnoremap $3 <esc>`>a}<esc>`<i{<esc>
|
|
vnoremap $$ <esc>`>a"<esc>`<i"<esc>
|
|
vnoremap $q <esc>`>a'<esc>`<i'<esc>
|
|
vnoremap $e <esc>`>a"<esc>`<i"<esc>
|
|
vnoremap $f <esc>`<a<space>{{{<esc>`>i}}}<esc>
|
|
vnoremap $b <esc>`<Obegin<esc>`>oend<esc>`<V`>>
|
|
|
|
" autocompletado de (, ", ', [, {{{}}} en modo INSERT
|
|
inoremap $1 ()<esc>i
|
|
inoremap $2 []<esc>i
|
|
inoremap $3 {}<esc>i
|
|
inoremap $4 {<esc>o}<esc>O
|
|
inoremap $q ''<esc>i
|
|
inoremap $e ""<esc>i
|
|
inoremap $f {{{<esc>o}}}<esc>O<esc>i
|
|
inoremap $b begin<cr><bs>end<esc>O
|
|
|
|
" saltarse del paréntesis final sin tener que salir del modo INSERT
|
|
inoremap $$ <esc>la
|
|
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
" => General abbreviations
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
|
|
|
|
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
" => Omni complete functions
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
|
|
|
|
|
|
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
" => Helper functions
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
func! DeleteTillSlash()
|
|
let g:cmd = getcmdline()
|
|
|
|
if has("win16") || has("win32")
|
|
let g:cmd_edited = substitute(g:cmd, "\\(.*\[\\\\]\\).*", "\\1", "")
|
|
else
|
|
let g:cmd_edited = substitute(g:cmd, "\\(.*\[/\]\\).*", "\\1", "")
|
|
endif
|
|
|
|
if g:cmd == g:cmd_edited
|
|
if has("win16") || has("win32")
|
|
let g:cmd_edited = substitute(g:cmd, "\\(.*\[\\\\\]\\).*\[\\\\\]", "\\1", "")
|
|
else
|
|
let g:cmd_edited = substitute(g:cmd, "\\(.*\[/\]\\).*/", "\\1", "")
|
|
endif
|
|
endif
|
|
|
|
return g:cmd_edited
|
|
endfunc
|
|
|
|
func! CurrentFileDir(cmd)
|
|
return a:cmd . " " . expand("%:p:h") . "/"
|
|
endfunc
|