Simple script to facilitate using Vim with Zope
Hi all (Vim list: apologies if any interested parties are already on the Zope list .. ) Here's a reallllllly simple script to facilitate filesystem editing of Zope content with Vim. It uses python to cobble together ncftp and bash. Basically how it works is this: recursively checkout the whole toot using FTP or WebDAV or whatever works for you. This may require some bending over backwards as Specialists and Racks and so forth all have their little idiosyncrasies in how they come down to the filesystem (for example, some you can cd into, but they don't get picked up by an ftp 'get -R' command). Anyway, now edit with Vim. When you write, Vim leaves behind a '...~' backup file. Now run the below script from the root of your local dir. It puts only the changed files and renames the backups to '...#put'. Works for me :) Regards, jean #!/usr/bin/python # # Jean Jordaan # Modified: Fri 10 Aug 2001 03:24:47 PM SAST ''' ''' import os, sys args = os.popen(' find . -name "*~" ').readlines() error = 0 for arg in args: remote_path = os.path.dirname(arg[1:-2]) backup_file = arg[:-1] local_file = arg[:-2] moved_file = arg[:-2]+'#put' os.system('echo ncftpput -f ncftpput.cfg -P 9021 %s %s' % (remote_path, local_file) ) error = os.system('ncftpput -f ncftpput.cfg -P 9021 %s %s' % (remote_path, local_file) ) if error: break os.system('echo mv %s %s' % (backup_file, moved_file) ) error = os.system('mv %s %s' % (backup_file, moved_file) ) if error: break
participants (1)
-
Jean Jordaan