vim 자동완성 플러그인

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에 아래 코드를 추가합니다.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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>"

출처 : http://arth.tistory.com/33

Hugo로 만듦
Jimmy의 Stack 테마 사용 중