Vim Tips Wiki
Register
Advertisement

You may need to create directories from a text file wherein each line defines a category from which a directory should be created.

So here is the command to use :

%g/\<\w\+\>/ y A | exe ' !mkdir '. shellescape(substitute(substitute(@a, '\n\+\s*', '', ''), '\s*\n\+', '', '')) | let @a =""

and the silent version :

%g/\<\w\+\>/ y A | exe 'silent !mkdir '. shellescape(substitute(substitute(@a, '\n\+\s*', '', ''), '\s*\n\+', '', '')) | let @a =""

Comments[]

This is not much use without a short example and a reason why Vim should be used to create directories. Why not edit a script to do the work and run it from the shell? JohnBeckett (talk) 00:00, June 6, 2016 (UTC)

Advertisement