vim:ko

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
vim:ko [2024/06/08 05:51] – 제거됨 - 바깥 편집 (Unknown date) 127.0.0.1vim:ko [2026/08/10 00:17] (현재) – 바깥 편집 127.0.0.1
줄 1: 줄 1:
 +{{tag>[editor vim cli]}}
 +
 +====== vim ======
 +Vi 계열의 modal text editor. 터미널에서 파일 편집, diff, quickfix, session 작업에 사용한다.
 +
 +===== Summary =====
 +  * Normal, Insert, Visual, Command-line mode를 오가며 키 중심으로 편집한다.
 +  * 이 페이지의 로컬 버전 확인은 2026-08-10 기준 ''VIM 8.0''에서 수행했다.
 +
 +===== Installation =====
 +2026-08-10 기준 Vim 공식 다운로드 페이지는 Debian package, macOS Homebrew, Windows winget, Unix source build를 안내한다. Fedora/RHEL에서는 배포판의 ''vim-enhanced'' package를 사용한다.
 +
 +<code bash>
 +# Debian / Ubuntu
 +sudo apt update
 +sudo apt install vim
 +
 +# RHEL / Fedora
 +sudo dnf install vim-enhanced
 +
 +# macOS
 +brew install vim
 +</code>
 +
 +<code powershell>
 +# Windows
 +winget install vim.vim
 +</code>
 +
 +<code bash>
 +vim --version
 +</code>
 +
 +===== Usage =====
 +<code bash>
 +vim FILE
 +vim -d OLD NEW
 +vim +LINE FILE
 +vim -R FILE
 +</code>
 +
 +  * ''<color #c3c3c3>**vim**</color> <color #22b14c>[OPTIONS]</color> <color #7092be>FILE...</color>''
 +  * ''<color #c3c3c3>**vim**</color> <color #22b14c>-d</color> <color #7092be>FILE1 FILE2</color>''
 +  * ''<color #c3c3c3>**vim**</color> <color #22b14c>+LINE</color> <color #7092be>FILE</color>''
 +
 +===== Basic Editing =====
 +  * <kbd>i</kbd>: Insert mode로 전환한다.
 +  * <kbd>Esc</kbd>: Normal mode로 돌아간다.
 +  * '':w'': 저장한다.
 +  * '':q'': 종료한다. 변경 사항이 있으면 종료하지 않는다.
 +  * '':wq'': 저장하고 종료한다.
 +  * '':q!'': 저장하지 않고 강제 종료한다.
 +  * ''/PATTERN'': 앞으로 검색하고 <kbd>n</kbd>으로 다음 결과로 이동한다.
 +
 +===== Options =====
 +  * ''<color #22b14c>**-d**</color>'': diff mode로 파일을 연다.
 +  * ''<color #22b14c>**-R**</color>'': read-only mode로 시작한다.
 +  * ''<color #22b14c>**-u**</color> <color #7092be>VIMRC</color>'': 지정한 초기화 파일을 사용한다. ''NONE''은 사용자 설정을 건너뛴다.
 +  * ''<color #22b14c>**-c**</color> <color #7092be>COMMAND</color>'': 첫 파일을 읽은 뒤 Ex command를 실행한다.
 +  * ''<color #22b14c>**-S**</color> <color #7092be>SESSION</color>'': session 파일을 불러온다.
 +
 +===== Config =====
 +사용자 설정은 보통 ''~/.vimrc''에 둔다. 다음은 기존 페이지에 기록되어 있던 설정 예시이다.
 +
 +<code vim>
 +if has("syntax")
 +    syntax on
 +endif
 +
 +set hlsearch
 +set nu
 +set autoindent
 +set ts=4
 +set sts=4
 +set laststatus=2
 +set shiftwidth=4
 +set showmatch
 +set smartcase
 +set smarttab
 +set smartindent
 +set ruler
 +set fileencodings=utf8,euc-k
 +</code>
 +
 +설정 문제를 분리하려면 먼저 사용자 설정 없이 실행한다.
 +
 +<code bash>
 +vim -u NONE -N FILE
 +</code>
 +
 +===== Troubleshooting =====
 +  * swap 경고가 나타나면 다른 Vim process가 파일을 편집 중인지 먼저 확인한다. 복구가 필요하면 ''vim -r FILE''을 사용한다.
 +  * terminal color나 key 문제가 있으면 ''$TERM''과 terminal emulator 설정을 확인한다.
 +  * 설치된 feature는 ''vim --version''의 ''+FEATURE'' 또는 ''-FEATURE'' 표기로 확인한다.
 +
 +===== Help =====
 +++++ vim --help (로컬 출력 중 주요 항목) |
 +<code text>
 +VIM - Vi IMproved
 +
 +usage: vim [arguments] [file ..]       edit specified file(s)
 +   or: vim [arguments] -               read text from stdin
 +   or: vim [arguments] -t tag          edit file where tag is defined
 +   or: vim [arguments] -q [errorfile]  edit file with first error
 +
 +Arguments:
 +   --                   Only file names after this
 +   -v                   Vi mode (like "vi")
 +   -e                   Ex mode (like "ex")
 +   -R                   Readonly mode (like "view")
 +   -d                   Diff mode (like "vimdiff")
 +   -y                   Easy mode (like "evim", modeless)
 +   -r                   List swap files and exit
 +   -r (with file name)  Recover crashed session
 +   -n                   No swap file, use memory only
 +                      Start at end of file
 +   +<lnum>              Start at line <lnum>
 +   --cmd <command>      Execute <command> before loading any vimrc file
 +   -c <command>         Execute <command> after loading the first file
 +   -S <session>         Source file <session> after loading the first file
 +   -u <vimrc>           Use <vimrc> instead of any .vimrc
 +   --clean              'nocompatible', Vim defaults, no plugins, no viminfo
 +   -h  or  --help       Print Help (this message) and exit
 +   --version            Print version information and exit
 +</code>
 +++++
 +
 +===== See Also =====
 +  * [[vi:ko|vi]]
 +  * [[vim:nvim:ko|nvim]]
 +  * [[nano:ko|nano]]
 +
 +===== History =====
 +  * codex:: 2026-08-10 Expanded the vim namespace index into a concise CLI page while preserving the existing vimrc example.
 +  * codex:: 2026-07-12 Added nvim page link and normalized vim namespace index markup.
 +
 +{{indexmenu>.#1|js}}