""" Prelimimary settings " Vim, not vi set nocompatible set ignorecase syntax enable set encoding=utf8 set fileencodings=utf8,latin1 set background=dark set shell=bash " *the* shell set backspace=2 " allow backspacing over everything in insert mode set showbreak=@ " glyph to mark continuation of a wrapped line set showmatch " when a bracket is inserted, briefly jump to the match set matchtime=7 " 10ths of a second to show match set scrolloff=2 " keep this many lines of context around cursor set autoindent " if previous line is indented, so will the next one set history=500 " keep 100 lines of command line history set ruler " show the cursor position all the time set vb t_vb= " don't ring any kind of bell, ever set showcmd " display incomplete commands set showmode " display mode, normal or insert set incsearch " do incremental searching set report=0 " threshold for reporting changes, 0 = always set shiftwidth=4 " number of spaces to use for each step of (auto)indent set softtabstop=4 " number of spaces that a counts for while editing set tabstop=4 " number of spaces that a in the file counts for set esckeys " make use of function keys possible set hidden " when off a buffer is unloaded when it is abandoned set autowrite " automagically write buffers when switching away from them set smarttab " indent next line as the previous set whichwrap=b,s,<,>,[,] " when to wrap when moving, see ':help whichwrap' set cmdheight=1 " massage buffer size set autoread " automagically re-read the file when it has changed set grepprg=grep\ -e\ -n " give extended regex support in grep set viewdir=~/.vimviews " store views here " Barra de status set laststatus=2 "set statusline=%4*%m%3*%<%F\ buffer=%n%3*\ byte=0x%B%=%{SpellCheck()}\ %{CurTime()}\ Saladino\ %5*\ L:\ %l\ C:\ %c\ %p%% set statusline=%m%<%F\ buffer=%n\ byte=0x%B%=%{SpellCheck()}\ %{CurTime()}\ Saladino\ \ L:\ %l\ C:\ %c\ %p%% hi StatusLine term=NONE cterm=NONE ctermfg=NONE ctermbg=blue hi StatusLineNC term=NONE cterm=NONE ctermfg=NONE ctermbg=darkgray fu! CurTime() let ftime="" let ftime=ftime." ".strftime("%b,%d %y %H:%M:%S") return ftime endf fu! SpellCheck() if &spell return "SpellLang=".&spelllang else return "SpellCheck=off" endif endf " "set path=./** "" visualbell = No pita, invierte los colores de la pantalla ""set vb "set incsearch " do incremental searching "set showmatch " see matches on {} and () " "set so=7 "7 lineas antes de el final empieza el scroll "" get rid of "if has("user_commands") " " remove ^M from the file " com! RemoveCtrlM :%s/^M/\r/g "endif " " "" Only do this part when compiled with support for autocommands. "if has("autocmd") " "" Algunas cabeceras para archivos de tipos comunes "" mirar :help template " " au BufNewFile *.tex 0r ~/.vim/headers/tex " " au BufNewFile *.c,*.cc,*.cpp 0r ~/.vim/headers/c " " au BufNewFile *.java 0r ~/.vim/headers/java " " au BufNewFile *.py 0r ~/.vim/headers/python " " au BufNewFile [mM]akefile 0r ~/.vim/headers/makefile " au BufNewFile build.xml 0r ~/.vim/headers/build.xml " " au BufRead,BufNewFile *.t setfiletype=perl " " " "filetype plugin indent on " "" Cargamos los comandos propios de cada Lenguaje "" "" au FileType c,cpp,h,cc,java call LoadProgCommands() "" au FileType c,cpp,h,cc,java 0r ~/.vim/commands/java " " au FileType tex call LoadTexCommands() " au FileType c,cpp,h,cc call LoadCCommands() " au FileType java call LoadJavaCommands() " au FileType python call LoadPythonCommands() " au FileType cs call LoadCSCommands() " au FileType perl call LoadPerlCommands() " " au BufNewFile *.c,*.cc,*.cpp,*.h,*.java,*.py,[mM]akefile,build.xml ks|call WriteHeader()|'s " " ""Al cerrar "" " au BufWritePre *.c,*.cc,*.cpp,*.h,*.java,*.py,[mM]akefile,build.xml ks|call LastMod()|'s " au FileWritePre *.c,*.cc,*.cpp,*.h,*.java,*.py,[mM]akefile,build.xml ks|call LastMod()|'s " " " "endif "has(autocmd) " ""Normal-time keybindings "map :tabnext "map :tabprevious "map t :tabnew "map td :tabclose "map tm :tabmove ""Insert-time keybindings "imap ,t 0i//TODO: " "autocmd FileType java inoremap $r return "au FileType java inoremap System.out.println();hi " ""----------PLUGINS CONFIG---------------" """Configurao para o plugin taglist "let Tlist_Ctags_Cmd = '/usr/bin/ctags-exuberant' "let Tlist_Use_Right_Window = 0 "let Tlist_Sort_Type = "name" ""let Tlist_Auto_Open = 1 ""let Tlist_Display_Prototype = 1 ""let Tlist_Inc_Winwidth = 0 ""let Tlist_Key = '\l' " ""Configurao para o plugin tagexplorer "let TE_Ctags_Cmd = '/usr/bin/ctags' "let TE_Use_Right_Window = 1 "let TE_Sort_Type = "name" " ""----------FUNCIONES--------------------" "" "fun LoadProgCommands() " "" com Main call Main() " nmap :Tlist " nmap :TagExplorer "endfun " ""LaTex "" "function LoadPerlCommands() " nmap :!perl % "endfunction "function LoadTexCommands() " " "maps " nmap :TexPdf " nmap :TexOpen " nmap :! ispell % " " " com! -nargs=0 TexPdf call TexPdf(expand("%")) " com! -nargs=0 TexOpen call TexPdf(expand("%"))|call TexOpen(expand("%<")) " "endfunction " "function LoadCCommands() " "" set foldmethod=syntax " " nmap :foldopen " nmap :Tlist " nmap :TagExplorer " set textwidth=80 " ""Comentarios " " "" F1 comentar lineas " map 0i/* $a */j " imap 0i/* $a */j " " " F2 descomentar lo que F1 ha comentado: no sirve para comentarios genricos " map 03x$xxxj " imap 03x$xxxj " " "Insertar linea para comentario " map o/a*58.yyp0xA/ko " map o/a*58.yyp0xA/ko " ""Compilar nmap :w:make nmap :make test " " " com! Main call Main() " " " fun! Main() " exe "normal Oint main(int argc, char* argv[]){\n\n}" " exe "normal O " " endfun " " "endfunction " "fun LoadCSCommands() "" source ~/.vim/commands/cs.vim "endfun " " "fun LoadJavaCommands() " " nmap :w:!ant:cw " nmap :Tlist " nmap :TagExplorer " " " com Main call Main() " com New call New() " " " fun New() " exe "normal Opublic class " . expand('%:t:r') . "{\n\n}" " exe "normal O" " endfun " " " fun Main() " exe "normal Opublic static void main(String[] args){\n\n}" " exe "normal O " " endfun " "endfun " "fun LoadPythonCommands() " " " nmap :w:!python '%:t' " nmap :Tlist " nmap :TagExplorer " " "" com Main call Main() "" com New call New() " " "" fun New() "" exe "normal Opublic class " . expand('%:t:r') . "{\n\n}" "" exe "normal O" "" endfun " " "" fun Main() "" exe "normal Opublic static void main(String[] args){\n\n}" "" exe "normal O " "" endfun " "endfun " "" TexPdf "" Crea um documento pdf utilizando el programa pdflatex "" " "function! TexPdf (filename) " w " let texfile = a:filename " exec "!pdflatex ".expand("%:t") " if v:shell_error != "" " echo "pdflatex error\n" " return " endif " silent exec "!pdflatex ".expand("%:t") "endfunction " "fun! TexOpen (filename) " call TexPdf(filename.".tex") " let pdffile = a:filename.".pdf" " exec "!xpdf "pdffile "endfun " "fun WriteHeader() " " " exe "1," . 5 . "g//s//file: " . expand("%:t") " exe "1," . 5 . "g//s//created: " . strftime("%Y-%m-%d, %T") " "endfun "function LastMod() " " exe "1," . 5 . "g/modified/s/modified: .*/modified: " . strftime("%Y-%m-%d, %T") " "endfunction " "function! CleverTab() "" Ortogonaliza el uso de TAB para autocompletar. Vim tiene el comando CTRL-N "" para realizar esta funcin, con esta funcin y el correspondiente mapeo a la "" tecla TAB obtenemos la funcin en la tecla pero sin dejar de obtener un "" verdadero caracter tab cuando lo necesitamos "" el mapeo a utilizar es este: "" inoremap =CleverTab() " if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$' " return "\" " else " return "\" "endfunction " "set t_ku=OA "set t_kd=OB "set t_kl=OD "set t_kr=OC " set viminfo='10,\"100,:20,%,n~/.viminfo au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif