사용자 도구

사이트 도구


wiki:os:unix:editor:vi

VI, VIM

  • description : VI 사용법 및 Tip 기술
  • author : 주레피
  • email : dhan@repia.com
  • lastupdate : 2020-06-04

Case Study

.vimrc 설정

filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab

> Tab key == 4 spaces and auto-indent after curly braces in Vim 파일내 ^M 제거

ESC
:
1,$ s/^M//g
Enter
':' 명령어 모드로 진입 (ESC + ':')
정규표현식 작성
1,$ mean 1줄 부터 마지막 줄까지
^M → Ctrl키를 누른 상태에서 vm 이어서 타이핑
s/찾을 문자열/대체 문자열/g


탭 사이트 조절

:
set tabstop=4
기본은 space 8


라인 표시

:
set nu
반대는 set nonu


Ctags 사용법

/var/services/web/dokuwiki/data/pages/wiki/os/unix/editor/vi.txt · 마지막으로 수정됨: 2023/06/01 11:40 저자 dhan