=================================

== vundle (vim bundle 관리)


  https://github.com/VundleVim/Vundle.vim#quick-start


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

# vi ~/.vimrc

" Vundle

set nocompatible

filetype off

set rtp+=~/.vim/bundle/Vundle.vim

call vundle#begin()

Plugin 'VundleVim/Vundle.vim'


call vundle#end()

filetype plugin indent on



## plugin 추가

.vimrc 에 Plugin 추가 후

  : so %

  : PluginInstall

또는 

  : source %

  # vim +PluginInstall +qall


아래 에러가 발생한다면 "sudo apt-get install -y vim" 으로 전체 버전을 설치한다. 기본적으로 tiny 버전이 설치되어있기 때문이다.

Sorry, the command is not available in this version: filetype off


## plugin 삭제

.vimrc 에 Plugin 제거 후

  : so %

  : PluginClean





=================================

== YouCompleteMe(YCM : 자동 완성 기능) 


  https://github.com/Valloric/YouCompleteMe#ubuntu-linux-x64


## 기본 패키지 설치

# apt-get install -y build-essential cmake python-dev python3-dev


## vundle 설치 후 YouCompleteMe 설치

# vi ~/.vimrc

  Plugin 'Valloric/YouCompleteMe'

  (~/.vimrc 에 plugin 추가 설치)

:w

:so %

:PluginInstall

:q


# cd ~/.vim/bundle/YouCompleteMe

# git submodule update --init --recursive

# ./install.py --clang-completer

  (모든 언어 지원시 # ./install.py --all)



## .vimrc에 아래 내용 추가

## 변수나 함수에서 \g, \gg, .. 로 사용 가능

## 자동완성은 CTRL + SPACE

## 점프 후 뒤돌아갈떈 CTRL + o

## 점프 후 뒤돌아간 후 다시 앞으로 갈땐 CTRL + i

" <YouCompleteMe> {{

let g:ycm_global_ycm_extra_conf = '~/.vim/.ycm_extra_conf.py'

let g:ycm_confirm_extra_conf = 0

let g:ycm_key_list_select_completion = ['<C-j>', '<Down>']

let g:ycm_key_list_previous_completion = ['<C-k>', '<Up>']

let g:ycm_autoclose_preview_window_after_completion = 1

let g:ycm_min_num_of_chars_for_completion = 1

let g:ycm_auto_trigger = 0

let g:ycm_python_binary_path = '/usr/bin/python3'


nnoremap <leader>g :YcmCompleter GoTo<CR>

nnoremap <leader>gg :YcmCompleter GoToImprecise<CR>

nnoremap <leader>d :YcmCompleter GoToDeclaration<CR>

nnoremap <leader>t :YcmCompleter GetType<CR>

nnoremap <leader>p :YcmCompleter GetParent<CR>

" }}



## 소스 프로젝트 최상위 폴더에 다음 파일을 두고 설정을 변경하면서 사용

# wget https://raw.githubusercontent.com/Valloric/ycmd/master/cpp/ycm/.ycm_extra_conf.py

(ex. '-I./include', 추가하면 프로젝트의 include 폴도의 헤더 인식)