English 中文(简体)
当总括性完全返回时,关键词就不完整?
原标题:vim keyword complete when omni complete returns nothing?

是否试图使用总括完成,如果它不希望使用普通关键词完成的话?

i thougt %omnifunc != should do it...
but what am i missing? Here is my function.

function! CleverTab()
  if pumvisible()
    return "<C-N>"
  endif
  if strpart( getline( . ), 0, col( . )-1 ) =~  ^s*$ 
    return "<Tab>"
  elseif &omnifunc !=   
    return "<C-X><C-O>"
  else
    return "<C-N>"
  endif
endfunction
inoremap <Tab> <C-R>=CleverTab()<CR>
最佳回答
let g:stop_autocomplete=0

function! CleverTab(type)
    if a:type== omni 
        if strpart( getline( . ), 0, col( . )-1 ) =~  ^s*$ 
            let g:stop_autocomplete=1
            return "<TAB>"
        elseif !pumvisible() && !&omnifunc
            return "<C-X><C-O><C-P>"
        endif
    elseif a:type== keyword  && !pumvisible() && !g:stop_autocomplete
        return "<C-X><C-N><C-P>"
    elseif a:type== next 
        if g:stop_autocomplete
            let g:stop_autocomplete=0
        else
            return "<C-N>"
        endif
    endif
    return   
endfunction

inoremap <silent><TAB> <C-R>=CleverTab( omni )<CR><C-R>=CleverTab( keyword )<CR><C-R>=CleverTab( next )<CR>
问题回答

暂无回答




相关问题
Autoupdate VIM Plugins?

Is it possible to update vim plugins automatically?

how to unindent in vim without leaving edit mode?

I m writing a lot of python code recently, and i used the tab-to-space mode in vim. I was just wondering how would i unindent in vim without leaving edit mode for example after i finished if...: block....

Scrolling inside Vim in Mac s Terminal

I ve been googling around trying to figure out if it s possible to use my mouse wheel to scroll while inside Vim in Mac s Terminal, with no luck. It seems as if only X11 or iTerm support this. Before ...

Vim - Deleting XML Comments

How do I delete comments in XML? If the opening and the closing comment tags are on the same line, I use :g/^<!--.*-->$/d to delete the comment. How to delete the comments that are spread ...

Limiting a match in vim to certain filetypes?

I have the following in my .vimrc to highlight lines longer than 80 chars: highlight OverLength ctermbg=red ctermfg=white guibg=#592929 match OverLength /\%81v.*/ This works quite well. However, the ...

Profiling Vim startup time

I’ve got a lot of plugins enabled when using Vim – I have collected plugins over the years. I’m a bit fed up with how long Vim takes to start now, so I’d like to profile its startup and see which of ...

热门标签