vim 에서 자동으로 자동완성을 해주는 플러그인을 설치해 보도록 하겠습니다.
제가 설치한 환경은 Cygwin에 설치된 vim 입니다.
AutoComplPop : http://www.vim.org/scripts/script.php?script_id=1879
L9 : http://www.vim.org/scripts/script.php?script_id=3252
위 플러그인을 /usr/share/vim/vim73 이하 autoload, doc, plugin 폴더에 각각 설치합니다.
마지막으로 .vimrc에 아래 코드를 추가합니다.
function! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col-1]!~'\k'
return "\<TAB>"
else
if pumvisible()
return "\<C-P>"
else
return "\<C-N>\<C-P>"
end
endif
endfunction
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
inoremap <expr> <CR> pumvisible() ? "<C-Y><CR>" : "<CR>"