autocomplpop 키워트 추천 - Vim plugin

기존 플러그인들은 단축키를 입력해야만 추천 단어를 보여줬다면, 이 넘은 입력을 하고 있으면 자동으로 추천 단어를 보여준다.

단어 선택 및 적용 키는 아래와 같다.

Tab, Enter, Ctrl+p, Ctrl+n

설치는 파일을 받아서 ~/.vim/plugin 에 카피해넣어주시고, 아래의 코드를 ~/.vimrc 에 살짝 추가해주시면 되겠습니다.

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

inoremap <tab> <c-r>=InsertTabWrapper()<cr>

hi Pmenu ctermbg=blue
hi PmenuSel ctermbg=yellow ctermfg=black
hi PmenuSbar ctermbg=blue