- 编辑
- 粘贴文本
- 粘贴文本自动缩进
- 文本操作命令
- 文本插入命令
- Increase/Decrease numbers
- Replace text with iedit
- iedit states key bindings
- Examples
- 注释(Commentings)
- 多方式编码
- 粘贴文本
编辑
粘贴文本
粘贴文本自动缩进
文本操作命令
文本相关的命令 (以 x
开头):
Key Binding | Description | |
---|---|---|
SPC x a & |
align region at & | |
SPC x a ( |
align region at ( | |
SPC x a ) |
align region at ) | |
SPC x a [ |
align region at [ | |
SPC x a ] |
align region at ] | |
SPC x a { |
align region at { | |
SPC x a } |
align region at } | |
SPC x a , |
align region at , | |
SPC x a . |
align region at . (for numeric tables) | |
SPC x a : |
align region at : | |
SPC x a ; |
align region at ; | |
SPC x a = |
align region at = | |
SPC x a ¦ |
align region at ¦ | |
SPC x a |
align region at | |
SPC x a a |
align region (or guessed section) using default rules (TODO) | |
SPC x a c |
align current indentation region using default rules (TODO) | |
SPC x a l |
left-align with evil-lion (TODO) | |
SPC x a L |
right-align with evil-lion (TODO) | |
SPC x a r |
align region using user-specified regexp (TODO) | |
SPC x a m |
align region at arithmetic operators (+-*/) (TODO) |
|
SPC x c |
count the number of chars/words/lines in the selection region | |
SPC x d w |
delete trailing whitespaces | |
SPC x d SPC |
Delete all spaces and tabs around point, leaving one space | |
SPC x g l |
set lanuages used by translate commands (TODO) | |
SPC x g t |
translate current word using Google Translate | |
SPC x g T |
reverse source and target languages (TODO) | |
SPC x i c |
change symbol style to lowerCamelCase |
|
SPC x i C |
change symbol style to UpperCamelCase |
|
SPC x i i |
cycle symbol naming styles (i to keep cycling) | |
SPC x i - |
change symbol style to kebab-case |
|
SPC x i k |
change symbol style to kebab-case |
|
SPC x i _ |
change symbol style to under_score |
|
SPC x i u |
change symbol style to under_score |
|
SPC x i U |
change symbol style to UP_CASE |
|
SPC x j c |
set the justification to center (TODO) | |
SPC x j f |
set the justification to full (TODO) | |
SPC x j l |
set the justification to left (TODO) | |
SPC x j n |
set the justification to none (TODO) | |
SPC x j r |
set the justification to right (TODO) | |
SPC x J |
move down a line of text (enter transient state) | |
SPC x K |
move up a line of text (enter transient state) | |
SPC x l d |
duplicate line or region (TODO) | |
SPC x l s |
sort lines (TODO) | |
SPC x l u |
uniquify lines (TODO) | |
SPC x o |
use avy to select a link in the frame and open it (TODO) | |
SPC x O |
use avy to select multiple links in the frame and open them (TODO) | |
SPC x t c |
swap (transpose) the current character with the previous one | |
SPC x t w |
swap (transpose) the current word with the previous one | |
SPC x t l |
swap (transpose) the current line with the previous one | |
SPC x u |
set the selected text to lower case (TODO) | |
SPC x U |
set the selected text to upper case (TODO) | |
SPC x w c |
count the number of occurrences per word in the select region (TODO) | |
SPC x w d |
show dictionary entry of word from wordnik.com (TODO) | |
SPC x TAB |
indent or dedent a region rigidly (TODO) |
文本插入命令
文本插入相关命令(以 i
开头):
Key binding | Description |
---|---|
SPC i l l |
insert lorem-ipsum list |
SPC i l p |
insert lorem-ipsum paragraph |
SPC i l s |
insert lorem-ipsum sentence |
SPC i p 1 |
insert simple password |
SPC i p 2 |
insert stronger password |
SPC i p 3 |
insert password for paranoids |
SPC i p p |
insert a phonetically easy password |
SPC i p n |
insert a numerical password |
SPC i u |
Search for Unicode characters and insert them into the active buffer. |
SPC i U 1 |
insert UUIDv1 (use universal argument to insert with CID format) |
SPC i U 4 |
insert UUIDv4 (use universal argument to insert with CID format) |
SPC i U U |
insert UUIDv4 (use universal argument to insert with CID format) |
Increase/Decrease numbers
Key Binding | Description |
---|---|
SPC n + |
increase the number under point by one and initiate transient state |
SPC n - |
decrease the number under point by one and initiate transient state |
In transient state:
Key Binding | Description |
---|---|
+ |
increase the number under point by one |
- |
decrease the number under point by one |
Any other key | leave the transient state |
Tips: you can increase or decrease a value by more that once by using a prefix argument (i.e. 10 SPC n +
will add 10 to the number under point).
Replace text with iedit
SpaceVim uses powerful iedit mode to quick edit multiple occurrences of a symbol or selection.
Two new modes: iedit-Normal
/iedit-Insert
The default color for iedit is red
/green
which is based on the current colorscheme.
iedit states key bindings
State transitions:
Key Binding | From | to |
---|---|---|
SPC s e |
normal or visual | iedit-Normal |
In iedit-Normal mode:
iedit-Normal
mode inherits from Normal
mode, the following key bindings are specific to iedit-Normal
mode.
Key Binding | Description |
---|---|
Esc |
go back to Normal mode |
i |
switch to iedit-Insert mode, same as i |
a |
switch to iedit-Insert mode, same as a |
I |
go to the beginning of the current occurrence and switch to iedit-Insert mode |
A |
go to the end of the current occurrence and switch to iedit-Insert mode |
<Left> /h |
Move cursor to left |
<Right> /l |
Move cursor to right |
0 /<Home> |
go to the beginning of the current occurrence |
$ /<End> |
go to the end of the current occurrence |
D |
delete the occurrences |
S |
delete the occurrences and switch to iedit-Insert mode |
gg |
go to first occurrence |
G |
go to last occurrence |
n |
go to next occurrence |
N |
go to previous occurrence |
p |
replace occurrences with last yanked (copied) text |
<Tab> |
toggle current occurrence |
In iedit-Insert mode:
Key Binding | Description |
---|---|
Esc |
go back to iedit-Normal mode |
<Left> |
Move cursor to left |
<Right> |
Move cursor to right |
<C-w> |
delete words before cursor |
<C-K> |
delete words after cursor |
Examples
注释(Commentings)
注释(comment)通过下面的工具来处理 nerdcommenter, 它用下面的按键来界定范围.
Key Binding | Description |
---|---|
SPC ; |
comment operator |
SPC c h |
hide/show comments |
SPC c l |
comment lines |
SPC c L |
invert comment lines |
SPC c p |
comment paragraphs |
SPC c P |
invert comment paragraphs |
SPC c t |
comment to line |
SPC c T |
invert comment to line |
SPC c y |
comment and yank |
SPC c Y |
invert comment and yank |
小提示: 用 SPC ; SPC j l
组合键高效的注释一个文本块的所有内容.
多方式编码
SpaceVim 默认使用 utf-8 码进行编码. 下面是 utf-8 编码的四个设置:
- fileencodings (fencs): ucs-bom,utf-8,default,latin1
- fileencoding (fenc): utf-8
- encoding (enc): utf-8
- termencoding (tenc): utf-8 (only supported in vim)
修复混乱的显示:SPC e a
是自动选择文件编码的按键映射. 在选择好文件编码方式后, 你可以运行下面的代码来修复编码:
set enc=utf-8
write