Reuse last externally executed command in VIM
In VIM, I want to execute a command (like :!mkdir src/main/scala/xxx
)
Then, I want to also make a sub开发者_运维问答directory of the just created directory.
Can I have VIM retype the last used command and then I append the sub directory name to it
(So I can have :!mkdir scr/main/scala/xxx/yyy
without retyping the whole stuff).
Can't you just hit : then the up arrow to go through your command history?
:!mkdir test
:!!/test2
will do what you want, see :h :!. Citation from there:
Any '!' in {cmd} is replaced with the previous external command (see also 'cpoptions').
// Why don't you use -p
switch to mkdir
? mkdir -p test/test2/test3/...
will create directory with all its parents if they do not exist.
精彩评论