Monday, May 2, 2016

Vim

커서 이동


e 
    Move to the end of a word.

w 
    Move forward to the beginning of a word.

3w 
    Move forward three words.

W 
    Move forward a WORD (any non-whitespace characters).

b 
    Move backward to the beginning of a word.

3b 
    Move backward three words.

$ 
    Move to the end of the line.

0 
    Move to the beginning of the line.

^ 
    Move to the first non-blank character of the line.

) 
    Jump forward one sentence.

( 
    Jump backward one sentence.

} 
    Jump forward one paragraph.

{ 
    Jump backward one paragraph.

H 
    Jump to the top of the screen.

M 
    Jump to the middle of the screen.

L 
    Jump to the bottom of the screen.

10<PageUp> or 10<CTRL-B>
    Move 10 pages up.

5<PageDown> or 5<CTRL-F>
    Move 5 pages down.

G 
    Jump to end of file.

1G 
    Jump to beginning of file (same as gg).

50G 
    Jump to line 50.

'm 
    Jump to the beginning of the line of mark m.

`m 
    Jump to the cursor position of mark m.

''
    Return to the line where the cursor was before the latest jump.
    (Two single quotes.)

``
    Return to the cursor position before the latest jump (undo the jump).
    (Two back ticks. This is above the Tab key on some keyboards.)

 % 
    Jump to corresponding item, e.g. from an open brace to its matching closing brace.

기타


# 패턴 치환
# \1 : 첫번째 패턴일치 변수
%s/^\([0-9]\)/#\1/g
%s/\(.*\)/\1/g


# 옆창
vi -c "20vs ./"
shift + o  # 선택파일 열기


# 파일전체 경로라면 맨앞 글자에서
Ctrl + w + f


# SYNTAX 색깔 없애기
set syntax=off


# syntax 색깔 바꾸기
set filetype=php


# Ctrl + v
수직 선택 모드


# v 모드에서
> 탭삽입


# 함수 원형 알아내기
[i


# 변수 선언부로 이동
gd


# 소스를 정렬 (전체 선택은 v -> G)
v로 블록 지정후 = 누르기


# 마킹
m[임의의 알파벳]


# 마킹 이동
'[마킹한 알파벳]
`[마킹한 알파벳]


# 파일에 암호 걸기
:X


# 파일 암호 풀기
set key=


# fold 끄기
set foldlevel=1



# 한번 적은 패턴 붙여넣기 연속하기
기록 -> ESC -> .


# 대소문자 변환하기
u or U


# 대소문자 구분 안하고 검색하기
set ic
set noic


#선택부분 치환하기
v로 선택 -> Shift+: s///g
:'<,'>s/test/tttt/g


# Folding
http://wiki.kldp.org/wiki.php/ViEditorTips
zE 는 모든 fold 를 제거 


# color 바꾸기
:colorscheme [tab]
:colorscheme [ctrl+d]


# cursor가 위치한 파일 열기
ctrl + w + f


# Tab function
새탭열기 => :tabnew
탭탐색기 => :Texplorer (:Te)
탭 이동(다음) => :gt
탭 이동(이전) => :gT


#Split function
수직나누기 => :sp
수평나누기 => :vs
창 이동    => ctrl+ww OR ctrl+w[h/j/k/l] (vim 이동 명령)
창 최대화  => ctrl+w_
창 사이즈 변경 => 20ctrl+w_


# MARKING
m + MARK
    GLOBAL => [A-Z]
    LOCAL  => [a-z]
    Auto   => [0-9]


# omnifunc
" onmifunc use per file types
" ctrl+x ctrl+o or ctrl+n ctrl+p
"
filetype plugin indent on
set omnifunc=ccomplete#Complete 
set omnifunc=htmlcomplete#Complete 
set omnifunc=csscomplete#Complete
set omnifunc=phpcomplete#Complete
set omnifunc=javascriptcomplete#Complete

complete => CTRL n + p
prototype => CTRL x + o


# Paren
" Highlighting matching parens configuration
" pi_paren options:
"    :NoMatchParen
"    :DoMatchParen
"    :help pi_paren.txt
" pi_paren off
"let loaded_matchparen = 1

기타




Post a Comment