3 minute read

처음 노트북에 wsl2를 설치해서 우분투를 사용하면서 ‘ vim’이라는 것을 처음 접했다. 뭔 요상한 것이 튀어나와서 방향키도 어떻게 누르는지 모르겠고, 입력도 안되고 화면 나가지지도 않아서 이게 뭔가 싶었다. 그게 알고보니 vim이었다. 궁금해서 찾아보고 연습해봤다. 묘한 매력을 느꼈다. 이상하게 다른 IDE보다 정이 가고 잘 사용해보고 싶은 그런 느낌…

vim 사용하는 것이 아직도 익숙하지는 않지만 손 움직임을 적게해줘서 피로도가 적은 것 같았다. 터미널에서 바로 vim 쓰는 것은 익숙하지 않아서 vscode에서 vim extension을 설치해서 쓰려고 하였다. 근데 한글을 쓸 때 자꾸 글자가 씹히는? 뭐라고 설명해야될지 모르겠는데 제대로 타이핑이 되지 않는 문제가 있었다.

해결해보려고 별짓을 다했는데 아직 구체적인 해결법이 없는 듯 하였다. 그래서 vim을 조금씩 세팅해서 쓰면서 익숙해지기로 마음 먹었다. 지금은 syntastic만 설치해서 쓰고 있는데 차차 공부해서 나만의 세팅을 해봐야겠다.

vim 관련 링크

현재 나의 vimrc (2021-02-08)

" Plugin manager
" " set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'Raimondi/delimitMate'
" Plugin 'jiangmiao/auto-pairs'
Plugin 'Syntastic'
Plugin 'scrooloose/nerdtree'
Plugin 'vim-airline/vim-airline'
call vundle#end()

" To ignore plugin indent changes, instead use: 
" filetype plugin on 
" 
" Brief help 
" :PluginList - lists configured plugins 
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate 
" :PluginSearch foo - searches for foo; append `!` to refresh local cache 
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal 
" 
" see :h vundle for more details or wiki for FAQ 
" Put your non-Plugin stuff after this line

" Syntastic
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0

" setting python
" Check pylint for python
let g:syntastic_python_checkers=['pep8']

let g:syntastic_cpp_compiler = 'g++'
let g:syntastic_cpp_compiler_options = "-std=c++17 -Wall -Wextra -Wpedantic"

" Auto pairs
" delimitmate
let delimitMate_expand_cr=1
filetype indent plugin on


" custom setting
set number " set number
colorscheme jellybeans " color scheme
set cursorline          " highlight current line
set showmatch           " highlight matching [{()}]
set autoindent " 자동 들여쓰기
set smartindent " 전처리기에 대해서는 들여쓰기 하지 않음
set cindent " C 스타일의 코드
set tabstop=4 " Tab 너비
set softtabstop=4 " number of spaces in tab when editing
set expandtab " tabs are spaces 탭 대신 스페이스
set shiftwidth=4 " 자동 인덴트할 때 너비


" default, using system clipboard
" set cb=unnamed
" vim on WSL : synchronize system clipboard
let s:clip = '/mnt/c/Windows/System32/clip.exe' 
if executable(s:clip)
    augroup WSLYank
        autocmd!
        autocmd TextYankPost * call system('echo '.shellescape(join(v:event.regcontents, "\<CR>")).' | '.s:clip)
    augroup END
end

" 마지막 수정 위치 기억
autocmd BufReadpost *
            \if line("'\'") > 1 && line("'\'") <= line("$") |
            \ exe "nomal! g'\"" |
            \ endif

" Finding Files:
" Search down into subfolders
" provides tab-competion for all file-related tasks
set path+=**
" Display all matching files when we tab complete
set wildmenu

" airline, to use buffer effectively
let g:airline#extensions#tabline#enabled = 1              " vim-airline 버퍼 목록 켜기
let g:airline#extensions#tabline#fnamemod = ':t'          " vim-airline 버퍼 목록 파일명만 출력
let g:airline#extensions#tabline#buffer_nr_show = 1       " buffer number를 보여준다
let g:airline#extensions#tabline#buffer_nr_format = '%s:' " buffer number format
nnoremap <F5> :bprevious!<Enter>    " 이전 버퍼로 이동
nnoremap <F6> :bnext!<Enter>        " 다음 버퍼로 이동
nnoremap <F4> :bp <BAR> bd #<Enter> " 현재 버퍼를 닫고 이전 버퍼로 이동"

" NERDTree
" <F3> NERDTree
map <C-b> :NERDTree<cr>
" NERDTree로 파일을 열면 NERDTree창은 자동으로 닫히게 하는 옵션
let NERDTreeQuitOnOpen=1
"숨겨진 파일까지 표시
let NERDTreeShowHidden=1