:retab
q /
q :
:windo 명령
set guifont=NanumGothicCoding:h10:cHANGEUL
set guifontwide=MS\ Mincho:h10
regedit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink
새로 만들기 - 다중 문자열 값
set encoding=utf-8
q{레지스터이름}
qq
@{레지스터이름}
:help recording
v
=
gg=G
:help =
y
p
p=']
']
`]
:help statusline
highlight
StatusLine
mouse
smartindent
:help smartindent
When typing '#' as the first character in a new line, the indent for that line is removed, the '#' is put in the first column. The indent is restored for the next line. If you don't want this, use this mapping: ":inoremap # X^H#", where ^H is entered with CTRL-V CTRL-H.
d
c
a
i
bold text
yat
mklink
backupcopy
auto
no
:w!
:mks
vim -S 세션파일이름
j
k
set wrap
gj
gk
:help f
3fa
/
file1
file2
ls f
ls file
:e f
:e file1
:e s
step
set wildmenu
textwidth
gq
gggqG
.tx
syntax/xslate.vim
[% ... %]
vat
o
plugin/MatchTagAlways.vim
%
$VIMRUNTIME/macros/matchit.vim
.vimrc
dd
.
:tabnew
@:
,cs
dir/filename
,cl
?
/e
:help s_flags
:sh
:help pattern.txt
+
\+
*
\*
()
{}
magic
\m
\M
\v
\V
nomagic
\|
\&
\@=
\@!
\@<=
\@ : lookbehind. 예제를 보면: {{{ Example matches ~ foo\(bar\)\@= "foobar"의 "foo" foo\(bar\)\@=foo 이건 절대 매치되지 않는다 foo\(bar\)\@! 바로 뒤에 "bar"가 오지 않는 "foo" a.\{-}p\@! "a", "ap", "app", 등. 더 이상 p가 오지 않을 때까지. if \(\(then\)\@!.\)*$ 뒤쪽에 "then"이 오지 않는 "if " \(an\_s\+\)\@<=file "an" 뒤에 공백 또는 라인의 끝 뒤에 오는 "file" \(foo\)\@ (?>atom) }}} 뉴라인 캐릭터를 처리할 때의 차이: * Perl ** ^와 $는 텍스트의 시작과 끝 부분에 매치 ** 'm' 플래그를 써서 텍스트 중간에 삽입된 뉴라인에 매치하게 할 수도 있음 ** 's' 플래그를 써서 .이 뉴라인에도 매치되게 할 수 있음 * Vim ** ^와 $는 항상 중간에 삽입된 뉴라인에도 매치됨 ** \%^와 \%$는 텍스트의 시작과 끝에 매치 ** \_를 . 또는 문자클래스 앞에 붙여서, 뉴라인을 포함하여 매치하게 할 수 있음 *** 예: \s는 뉴라인을 제외한 공백문자. \_s는 뉴라인을 포함한 공백문자. Perl에만 있는 것: * 정규식 안에서 코드 실행: (?{perl code}) * 조건에 따라 달라지는 정규식: (?(condition)true-expr|false-expr) Vim에만 있는 것: * changing the magic-ness of a pattern: \v \V \m \M * sequence of optionally matching atoms: \%[atoms] * \& (which is to \| what "and" is to "or"; it forces several branches to match at one spot) * matching lines/columns by number: \%5l \%5c \%5v * setting the start and end of the match: \zs \ze === # 아예 Perl을 써서 치환 === [http://vim.wikia.com/wiki/Perl_compatible_regular_expressions Perl compatible regular expressions - Vim Tips Wiki] 참고 vim을 컴파일할 때 perl을 지원하게 했다면, (:ver 했을 때 +perl 또는 +perl/dyn이 있으면 됨) :perldo s/searchme/replaceme/g 이런 식으로 쓸 수 있음. 윈도우 gvim 의 경우는 perldo 명령을 실행했을 때 perl**.dll 이 없다고 에러가 날 수 있는데, [http://strawberryperl.com/releases.html strawberry perl]의 해당 버전의 압축파일을 받아서 dll 만 vim이 있는 곳에 넣어 주면 된다. 그런데 perl58.dll이 필요하다고 할 때 perl-5.8.*.* 여러 버전 중에 어떤 건 vim이 죽어버리고 어떤 건 괜찮았으니 확인이 필요. PC에 Perl이 설치되어 있는 경우는 perl 인터프리터를 직접 호출하는 식으로도 쓸 수 있긴 하다: {{{ :%!perl -pi -e 's//\n/' }}} * 그런데 [[주인장]]이 해 봤을 때 이 경우 문제는, lookahead 를 위해서 (?!pattern) 등과 같이 쓸 경우 "!"를 vim이 먼저 해석해버리는지 perl이 제대로 수행되지 않고 에러가 반환되었다. == # 관련 링크 == * http://www.vim.org - Vi Improved 홈페이지 * http://vi.kldp.org/ - Vi 사용자 모임 * [[Vi로문자열치환하기]] * VimPluginTest * KLDPWiki:ViEditor * KLDPWiki:ViEditorTips * [http://kwon37xi.egloos.com/1501256 까먹지말자! : vi/vim notes 번역] * [http://www.ibm.com/developerworks/kr/library/l-vim-script-1/index.html?ca=drs-kr-0506 Vim 편집기로 스크립트 작성하기, Part 1: 변수, 값 및 표현식] * [http://www.ibm.com/developerworks/kr/aix/library/au-vitips.html vi 팁 및 트릭: 친구에게 강렬한 인상을 남길 수 있는 10개의 유용한 명령] * [http://www.ibm.com/developerworks/kr/aix/library/au-vimplugin/index.html Vim 편집기용 사용자 정의 플러그인 개발] * 다른 사람들의 설정파일 ** http://daybreaker.springnote.com/pages/45344 ** http://hisjournal.net/blog/176 * [http://stevelosh.com/blog/2010/09/coming-home-to-vim/ Coming Home to Vim] * [http://kldp.org/node/125263 vim 사용자를 위한 플러그인 매니저 vundle 을 소개 합니다. | KLDP] - 플러그인 매니저 * http://orchistro.tistory.com/category/Computing/vim%20tips * [http://www.popit.kr/adding-custom-file-type-in-vim/ Vim 사용자 정의 파일 타입 꾸미기 | Popit] == # 기타 & Comments == 서버에 있는게 7.0인데, 7.3을 써보고 싶어서 직접 컴파일하려니... 도대체 그 수많은 옵션 중 뭐를 켜줘야 무난한지 모르겠다. 일단은 {{{ ./configure --prefix=/home/gypark/local/ # 이름 겹치지 말라고 --with-vim-name=vim73 --with-ex-name=ex73 --with-view-name=view73 # 이건 아래 features 항목을 big으로 하면 안 해도 되는 것 같긴 한데 --enable-multibyte --enable-hangulinput --with-features=huge # 펄 인터프리터를 추가하는 건 실패했다 --enable-perlinterp=yes }}} * 펄 인터프리터를 추가하려고 했더니 make할 때 Undefined subroutine &ExtUtils::ParseXS::errors called at /home/gypark/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/ExtUtils/xsubpp에러가 난다. 포기. --- 현재 라인의 문자열을 바이그램으로 추출하기 {{{ :map ;b yyp:s/\([^ ]\)\([^ ]\)\@=/\1\2 /gkJ$D }}} ---- [[컴퓨터분류]]
^
$
\%^
\%$
\_
\s
\_s
:perldo s/searchme/replaceme/g
(?!pattern)
Undefined subroutine &ExtUtils::ParseXS::errors called at /home/gypark/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/ExtUtils/xsubpp