qpkorr / vim-renamer

Git repo for http://www.vim.org/scripts/script.php?script_id=1721
MIT License
82 stars 11 forks source link

Be able to batch create files ? #7

Closed jon301 closed 5 years ago

jon301 commented 7 years ago

Hi !

I'd like to know if it would be possible to create multiple files with this plugin ? Currently, when you add new lines and then run :Ren, you get the following message : Dir contains 10 writeable files, but there are 12 listed in buffer. These numbers should be equal

It would be awesome to have this feature ! If you think it's not possible, do you know an alternative to do that by any chance ?

Thanks for your help !

qpkorr commented 7 years ago

Hey - sorry for not getting back to you. I hear you on this feature - but I'm not sure about the details. If there were 10 files in the directory initially, but 12 when you hit :Ren - can it be assumed that the last two filenames should be created from scratch, and the first 10 should be renamed? What if someone accidentally inserts an extra file in the middle of the list - the script would renamer everything after it incorrectly.

I certainly hope you solved all your problems - but out of curiosity, a little playing around yielded this snippet, to be run from the vim command line when your buffer contains a list of file names to create: :for f in getline(1,'$')|call writefile([], f)|endfor

qpkorr commented 5 years ago

Closing as too slow to respond (even by my standards!)