Autocompletación en vim.
Cuando programas en vim puedes usar C-x-o para obtener una lista de las posibles funciones, estructuras o clases que deseas escribir basada en sus primeras letras.
Por ejemplo si estás escribiendo en PHP: in_ [C-x-o] completará a in_array()
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 | Omni completion *new-omni-completion* This could also be called "intellisense", but that is a trademark. It is a smart kind of completion. The text in front of the cursor is inspected to figure out what could be following. This may suggest struct and class members, system functions, etc. Use CTRL-X CTRL-O in Insert mode to start the completion. |i_CTRL-X_CTRL-O| The 'omnifunc' option is set by filetype plugins to define the function that figures out the completion. Currently supported languages: C (X)HTML with CSS JavaScript PHP Python Ruby SQL XML any language with syntax highlighting You can add your own omni completion scripts. When the 'completeopt' option contains "menu" then matches for Insert mode completion are displayed in a (rather primitive) popup menu. |
Fuente: http://vimdoc.sourceforge.net/htmldoc/version7.html#new-omni-completion
Configuración:
En el archivo vimrc debes especificar al menos lo siguiente si te dedicas al desarrollo con PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | filetype on filetype plugin on autocmd FileType php set omnifunc=phpcomplete#CompletePHP autocmd FileType html set omnifunc=htmlcomplete#CompleteTags autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS autocmd FileType css set omnifunc=csscomplete#CompleteCSS autocmd FileType sql set omnifunc=sqlcomplete#Complete # los capos pa'l ruby tb quieren su parte autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete # mostrar posibilidades en un menu # e información extra en una ventana set completeopt=menu,preview |
Puedes agregarlo a tu configuración personal ~/.vimrc o hacerlo global en /etc/skel/.vimrc. Usa “locate .vimrc” si no ubicas .vimrc en tu sistema.
Notas:
* Requiere vim 7
* En zenwalk (y seguramente otras distros de 1-CD) instala Exuberant Ctags
RSS feed para comentarios en este post
TrackBack URL




