본문 바로가기
Project/Ubuntu

[Vim Plugin] YouCompleteMe

by FastBench 2024. 5. 12.

이걸 깔고 엄청 후회를 했다.

왜 진작 깔지 않았을까.

github 링크

https://github.com/ycm-core/YouCompleteMe

 

GitHub - ycm-core/YouCompleteMe: A code-completion engine for Vim

A code-completion engine for Vim. Contribute to ycm-core/YouCompleteMe development by creating an account on GitHub.

github.com

README 를 읽어보니, 설치방법이 여간 귀찮은게 아니다. 그래서 그냥 Vundle 로 설치하기로 했다.

(Vundle : Vim plugin 을 관리하는 Plugin)

 

Vundle 설치

다운로드

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

Vim 설정

set nocompatible              " 필수
filetype off                  " 필수

" Vundle 설정
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" 여기에 설치하고 싶은 플러그인을 추가
Plugin 'VundleVim/Vundle.vim'
" 예시: Plugin 'tpope/vim-fugitive'
call vundle#end()            " 플러그인 설정 끝
filetype plugin indent on    " 필수

Plugin 설치

Vim 열고 아래 명령어 입력

:PluginInstall

 

Vundle Plugin 설치가 완료되었다.

 

기타 Vundle 명령어

# .vimrc 에 추가한 모든 플러그인 설치
:PluginInstall 

# 설치된 모든 플러그인 업데이트
:PluginUpdate

# 플로그인 제거 (.vimrc 에서 먼저 해당 라인 삭제 필요)
:PluginClean

# 현재 설치된 플러그인 목록 출력
:PluginList

 

YouCompleteMe 설치

필요 패키지 설치

sudo apt-get install build-essential cmake vim-nox python3-dev
sudo apt-get install mono-complete golang nodejs default-jdk npm

본인의 경우 golang 은 따로 설치함. 

Vundle 을 통한 플러그인 설치

.vimrc 의 Plugin 을 입력하는 라인에 추가한다.

Plugin 'ycm-core/YouCompleteMe'

그후 Vim 을 재시작후 :PluginInstall

컴파일 및 설치

기본적으로 파이썬과 C-family 의 자동 완성을 지원하지만, 추가언어 지원을 위해 컴파일시 해당 옵션 포함 필요할 수 있음

cd ~/.vim/bundle/YouCompleteMe
python3 install.py --all

YCM 구성

프로젝트에 맞춰서 .ycm_extra_conf.py 설정이 필요할 수 있음. (gcc 옵션 이라던지..)

'Project > Ubuntu' 카테고리의 다른 글

WSL2 D드라이브로 마이그레이션하기  (0) 2024.04.04
멀티 OS 설치 - Windows11, Ubuntu 22.04)  (0) 2023.11.19

댓글