parsed.org

Tips by tag: autocomplete

Add this to your .vimrc:

autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete

Try it out:

$ touch index.html
$ vim index.html
type: <ht[CTRL-X][CTRL-O]
autocompleteccsshtmljavascriptphppythonvimvimrcxml

You can use M-/ to complete strings that emacs has seen in documents you are editing. It's useful for completing (or cycling through) long variable and function names to prevent misspellings.

autocompleteeditorsemacskeystrokes
Man Page Completion by cygnus on Dec 31, 2005 04:13 PM

You can complete man page names as well as file names. Put these lines in your ~/.zshrc:

setopt SH_WORD_SPLIT
function man_var () {
   man_pages=( /usr/share/man*/*(N:t:r:r) )
   compctl -k man_pages man
   reply=( $man_pages )
}
compctl -K man_var man; man_pages=()

Now type man foo and the hit TAB to get a list of all man pages beginning with foo.

(Note: this tip taken essentially verbatim [after testing and fixing] from http://www.unixtips.org/index.php3?catList=30.)

autocompleteextrasmanpageszsh
RSS