Wednesday, November 24, 2010

A snippet which improve supertab.vim

(Uh... I don't know whether I can post it here. Please tell me if I did something improper.)

Hello, I'm a vim beginner.
I use supertab.vim to complete my code, but I found it's "context" completion is strange when I wrote html.
So I add some code in it:

" Some My Own Options {{{
let g:SuperTabDefaultCompletionType = "context"

function! MyContext()
    let curline = getline('.')
    let cnum = col('.')
    if curline =~ '^.\{' . (cnum-3) . '}' . '</'
        return "\<c-x>\<c-o>"
    endif
endfunction

let g:SuperTabCompletionContexts =
    \ ['MyContext', 's:ContextText', 's:ContextDiscover']
"}}}

now if I type "<html></[tab]" it will close the tab with omni-completion.
Hope it's useful.
Or if you know more clever solution, please advise me.

--
Lai, Yu-Hsuan

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: