Vim Tips Wiki
(Created page with "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 : <nowiki>%g...")
Tags: Visual edit apiedit
 
No edit summary
Tags: Visual edit apiedit
Line 3: Line 3:
 
So here is the command to use :
 
So here is the command to use :
   
<nowiki>%g/\<\w\+>/ y A | exe ' !mkdir '. shellescape(substitute(substitute(@a, '\n\+\s*', '', ''), '\s*\n\+', '', '')) | let @a =""</nowiki>
+
<nowiki>%g/\<\w\+\>/ y A | exe ' !mkdir '. shellescape(substitute(substitute(@a, '\n\+\s*', '', ''), '\s*\n\+', '', '')) | let @a =""</nowiki>
   
 
and the silent version :
 
and the silent version :
   
<nowiki>%g/\<\w\+>/ y A | exe 'silent !mkdir '. shellescape(substitute(substitute(@a, '\n\+\s*', '', ''), '\s*\n\+', '', '')) | let @a ="" </nowiki>
+
<nowiki>%g/\<\w\+\>/ y A | exe 'silent !mkdir '. shellescape(substitute(substitute(@a, '\n\+\s*', '', ''), '\s*\n\+', '', '')) | let @a ="" </nowiki>

Revision as of 13:33, 5 June 2016

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 =""