Updated:

less than 1 minute read

설명


설치

  1. dnf install ruby
  2. curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  3. vim ~/.vimrc
    call plug#begin()
        Plug 'quark-zju/vim-cpp-auto-include'
    call plug#end()
    	
    autocmd BufWritePre ~/**.cpp :ruby CppAutoInclude::process
    
  4. vim 실행 후 :PlugInstall 입력


확인

  • 코드 작성 후 저장 시 자동 헤더 추가/삭제
  • before
     int main(void) {
         vector<int> test;
    	
         return 0;
     }
    
  • after
     #include <vector>
    	
     using namespace std;
    	
     int main(void) {
         vector<int> test;
    	
         return 0;
     }