How to write consecutive named files in Vim? -
I need it many times, and only now it has happened to me, maybe Vim can do this for me I often I save those files that are many, and whose names do not matter (they are anyway temporary).
I have a file that is full of files: file001.txt, file002.txt ... (they are not actually named "filexxx.txt" - but for discussion .. .) I often save a new one, and name it for example, file434.txt. Now there is something that I often do, I would like to skip the part that examines the naming.
Is there a way to test the last file XXXx.txt in the script, and a vim script can be created to save the current buffer file xxx + 1 as I write something like this How should I go about?
Keep match the following code, which matches the next filtered filename "Above 0 Count". If the pattern is used by printf (), then use% d for the integer and% integer for% 03d which is the pad with zero of length 3. Function! GetNextUnused (pattern) filebrandable (printf (a : Pattern, i)) at the end of i = = 1, printf (a: pattern, i) endfunction "Edit the next unused file name that matches the given pattern command! Nargs = 1 EditNextUnused: Execute ': e'. GetNextUnused ('& lt; args & gt;') "Write the current buffer to the next unused file name that matches the given pattern command! -nargs = 1 WriteNextUnused: Execute 'w'. GetNextUnused ('& lt; Args & gt; ') "Try to use": EditApplicationNot used temp% d.txt "" or "": WriteNextUnused path / per / file% 03d.extension "
In a directory where temp0000.txt is used by temp0100.txt all already and you do : WriteNextUnused temp% 04d.txt < / Code >, Write the current buffer on temp0101.txt .
Comments
Post a Comment