ls
是一个 命令command
:command
查看所有用户定义的命令:command TOhtml
查询指定的命令:command DeleteFirst 1delete
:command
自定义命令commandDeleteFirst
1delete
删除第1行:DeleteFirst
:command Delete5Lines .,+5delete
:Delete5Lines
:command! Delete5Lines .,+4delete
:Delete5Lines
:normal '<v'>
normal
模 式执行后续命令'<
跳到原选区开头v
进入字符可视化'>
跳到原选区结尾command RestoreSelection normal '<v'><cr>
:RestoreSelection
:call Init()
:command Init :call Init()
:call Init()
:Init
:command Init
:h command
:command! -nargs=0 DeleteFirst 1delete
:command! -nargs=0 Delete5Lines .,+4delete
:command -nargs=1 Say :echo "<args>"
:Say oeasy say easy
实验函数
:call Oeasy("oeasy","o2z","o3z")
定义命令
:command -nargs=* Oeasy :call Oeasy(<args>)
执行命令
:Oeasy "111","222","333"
但是不能执行
:Oeasy 111,222,333
重新定义命令
:command! -nargs=* Oeasy :call Oeasy(<q-args>)
执行命令
:h command
/range
:command -range SaveIt :<line1>,<line2>write! save_file
:delcommand SaveIt
:comclear