.gvimrc 編集


"<TAB>で補完
" {{{ Autocompletion using the TAB key
" This function determines, wether we are on the start of the line text (then tab indents) or
" if we want to try autocompletion
function! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<TAB>"
else
if pumvisible()
return "\<C-N>"
else
return "\<C-N>\<C-P>"
end
endif
endfunction
" Remap the tab key to select action with InsertTabWrapper
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
" }}} Autocompletion using the TAB key
inoremap <expr> <CR> pumvisible() ? "\<C-Y>\<CR>" : "\<CR>"

autocomplpop.vim 編集

自動補完時に、最初の候補を選択状態にする。(通常、未選択状態のためTABを2回押す必要がある。)
"return "\<C-p>\<Down>"
return "\<C-p>\<Down>\<C-p>"