在 Vim 中,
:%!ls
Run Code Online (Sandbox Code Playgroud)
执行ls命令并将其输出打印到当前可编辑文件。
但是分别是什么意思%和什么!意思vim?
是否可以执行ls而不将其输出写入文档?
mur*_*uru 17
在 Vim 中,运行:h :!并:h :%了解每个函数的作用。
现在,:%用于使用 shell 命令运行的输出替换文件的内容:!。如果您不想接触文件的内容,请不要使用%. 做就是了:
:!ls
Run Code Online (Sandbox Code Playgroud)
根据VIM 教程:
%
Move cursor to the matching bracket.
Place cursor on {}[]() and type "%".
Run Code Online (Sandbox Code Playgroud)
!
filter through external command
Any UNIX command can be executed from the vi command line by typing an "!" before the UNIX command.
Autowrite can be intentionally avoided by using "!" to avoid the save when switching files.
Run Code Online (Sandbox Code Playgroud)
小智 5
我有同样的问题,并在 中找到了这个:h cmdline-special,这就是我要找的意思:
% Is replaced with the current file name. *:_%* *c_%*
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11373 次 |
| 最近记录: |