* Glen Wagley [Thu,  6 Mar 2003 at 10:52 -0700]
> I still wish I could get autocomplete working in vim.  Now that would
> be SLICK.

" InsertTabWrapper
" (get the plugin from vim.org)
function! InsertTabWrapper(direction)
    let col = col('.') - 1
    if !col || getline('.')[col - 1] !~ '\k'
        return "\<tab>"
    elseif "backward" == a:direction
        return "\<c-p>"
    else
        return "\<c-n>"
    endif
endfunction

inoremap <tab> <c-r>=InsertTabWrapper ("forward")<cr>
inoremap <s-tab> <c-r>=InsertTabWrapper ("backward")<cr>

" Or, if you don't want to remap tab, just type c-n or c-p and it should
" work automatically.
-- 
 Hans Fugal                 | De gustibus non disputandum est.
 http://hans.fugal.net/     | Debian, vim, mutt, ruby, text, gpg
 http://gdmxml.fugal.net/   | WindowMaker, gaim, UTF-8, RISC, JS Bach
---------------------------------------------------------------------
GnuPG Fingerprint: 6940 87C5 6610 567F 1E95  CB5E FC98 E8CD E0AA D460

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to