Vim Basics

Installation

sudo apt-get update -y \
&& sudo apt-get install -y 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: λŒ€λ¬Έμžλ‘œ λ³€ν™˜
Last updated on