Kevin
Kevin

不折腾会死星人

VIM常用命令

不知道发啥,发quick note里的第一篇作为新手任务。

concatenate strings

%s/^/('/ | %s/$/'),/ | %s/\n//g | %s/,$//

%s/^/'/ | %s/$/',/ | %s/\n//g | %s/,$//

%s/^\n$//g|%s/$/‘,/|%s/^/‘/|%s/\n//g|s/,$//

replace pattern

1,$s/\(hello.\)\(world.\)/\2\1\0/

\1 : first matched pattern: hello.*

\2: second matched pattern : world.*

\0: the whole pattern

.s/(\([0-9]*\))/{\1}/

\1: the matched pattern in ()

\0: the whole pattern

w !sudo tee %

remove duplicated new line

%s/^\n$//g

remove new line

%s/\n//g

remove empty line

g/^$/d

remove lines start with #:

g/^#.*$/d

remove duplicated line

:sort

:g/^\(.*\)$\n\1$/d

remove duplicated spaces

:%s/\s\s*/ /g

remove line without xxx

:v/xxx/d

select registers

"a

system clipboard

"+

recording a macro

q

running a macro

@

CC BY-NC-ND 2.0 版权声明

喜欢我的文章吗?
别忘了给点支持与赞赏,让我知道创作的路上有你陪伴。

加载中…

发布评论