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

Like my work?
Don't forget to support or like, so I know you are with me..

Loading...
1

Want to read more ?

Login with one click and join the most diverse creator community.