Resize windows
command :reseze
/ :res
To set window height to 60
:resize 60
To change the height by increments of 5
:res +5
:res -5
To change window width :vertical resize
:vertical resize 80
:vertical resize +5
:vertical resize -5
key C-w ...
C-w +
/C-w -
: height +1 / -1 rowC-w <
/C-w >
: width +1 / -1 column
Split window
C-w s
/C-w v
: split window horizontal / vertical:split/sp [path]
/:vsplit/vs [path]
: split window horizontal / vertical and open a file optional
Delete window
C-w o
/C-w C-o
: will delete all other windows
Move between windows
C-w <ARROW>
: will move to windowspointed to
Diffsplit
set diffopt+=iwhite
: ignore white spacedo
: copy from other windowdp
: copy to other window]c
: 次の差分へ移動[c
: 前の差分へ移動
Mark
Normal operations
- Each file can have mark
a
–– use a lowercase mark to jump within a file. - There is only one file mark
A
–– use an uppercase mark to jump between files.
Regexp
Copy & Paste
- y (yank) d (delete) c (change) すると、その文字列は
無名レジスタ
に蓄えられます。 "ayy
とか"bdw
とすると、明示的に a レジスタや b レジスタに書き込みます。- 明示的にレジスタを指定して貼り付ける時は
"ap
や"bP
などとします。
レジスタを表示
:di
:reg
0 レジスタ
y
-> 内容1を無名レジスタ
に格納d
-> 内容2を無名レジスタ
に格納、もともと無名レジスタ
に格納していた内容1を0レジスタ
に退避d
-> 内容3を無名レジスタ
に格納、もともと無名レジスタ
に格納していた内容2を0レジスタ
に退避 しない
これで、y
した内容を"0p
で貼り付けできる
d
を実行時は、無名レジスタ
を 退避しない
Highlight
色がなくなったとき
set filetype=c
Search & Rplace
When searching:
.
,*
,,
[
,^
, and$
are metacharacters.+
,?
,|
,&
,{
,(
, and)
must be escaped to use their special function./
is/
(use backslash + forward slash to search for forward slash)t
is tab,s
is whitespace (space or tab)n
is newline,r
is CR (carriage return = Ctrl-M = ^M){#}
is used for repetition./foo.{2}
will match foo and the two following characters. Theis not required on the closing
}
so/foo.{2}
will do the same thing.(foo)
makes a backreference tofoo
. Parenthesis without escapes are literally matched. Here theis required for the closing
)
.
When replacing:
r
is newline,n
is a null byte (0x00).&
is ampersand(&
is the text that matches the search pattern).
近期评论