Vim Basics
설치
sudo pacman -S vim
Manually build
sudo apt install libncurses5-dev libgtk2.0-dev libatk1.0-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev \
python3-dev ruby-dev lua5.2 liblua5.2-dev libperl-dev git
git clone https://github.com/vim/vim.git -b v8.2.5047 --depth 1 \
&& cd vim
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-python3interp=yes \
--with-python3-config-dir=$(python3-config --configdir) \
--enable-perlinterp=yes \
--enable-luainterp=yes \
--enable-gui=gtk3 \
--enable-cscope \
--prefix=/usr/local
make VIMRUNTIMEDIR=/usr/local/share/vim/vim82 -j$(expr $(expr $(nproc) \* 6) \/ 5)
sudo make install
sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/vim 1
sudo update-alternatives --set editor /usr/local/bin/vim
sudo update-alternatives --install /usr/bin/vi vi /usr/local/bin/vim 1
sudo update-alternatives --set vi /usr/local/bin/vim
With Vundle
https://raw.githubusercontent.com/hhk7734/conf/master/.vimrc
wget https://raw.githubusercontent.com/hhk7734/conf/master/.vimrc -O ~/.vimrc
sudo apt-get install -y git cmake python3-dev g++ \
&& git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim \
&& vim +PluginInstall +qall \
&& echo -e "\ncolor dracula" >> ~/.vimrc \
&& cd ~/.vim/bundle/YouCompleteMe \
&& python3 ./install.py --clang-completer
https://raw.githubusercontent.com/hhk7734/conf/master/.ycm_extra_conf.py
wget https://raw.githubusercontent.com/hhk7734/conf/master/.ycm_extra_conf.py -O ~/.vim/.ycm_extra_conf.py \
&& printf "\nlet g:ycm_global_ycm_extra_conf = '%s/.vim/.ycm_extra_conf.py'" $HOME >> ~/.vimrc
Without Vundle
https://raw.githubusercontent.com/hhk7734/conf/master/without_vundle_vimrc/.vimrc
wget https://raw.githubusercontent.com/hhk7734/conf/master/without_vundle_vimrc/.vimrc -O ~/.vimrc
Normal mode
:h key-notation
: key notation
u
: undo<C-R>
: redo
=
: align ex) gg=G, =3<C-K>
: clang-format (설정한 경우)
:! <command>
: shell에서 \<command>를 실행합니다.:r[ead]! <command>
: stdout -> vim:w[rite]! <command>
: vim -> stdin:sh
: 쉘로 가기<C-D>
: 쉘에서 돌아오기
<C-A>
: 숫자 증가<C-X>
: 숫자 감소
Visual mode
u
: 소문자로 변환U
: 대문자로 변환