this will apply to a finite subset of subscribers

    * you must have bash
    * you must have python
    * your python must have BeautifulSoup
    * you must want a slick way to get the latest netrw

and i know there are already scripts to update wide swaths
of plugins, but i had such fun writing this, and it *just
worked* -- i just had to share

in your ~/bin path, place:

<cfnn>
#!/bin/bash
#  check for new netrw
date '+%d %b %Y  %H:%M  %a'
mv="v`grep '^" Version' ~/.vim/autoload/netrw.vim | awk '{ print $3 }'`"
echo "my netrw version is $mv" 
cv=`~/py/cfnn`
echo "charles version is $cv" 
if [ $mv == $cv ]; then
    echo 'no netrw upgrade available'
else
    echo 'a netrw upgrade is coming your way'
    mv -v ~/.vim/netrw.vba ~/.vim/netrw_save_path/netrw.vba_save_$mv
    wget http://mysite.verizon.net/astronaut/vim/vbafiles/netrw.vba.gz
    gunzip netrw.vba.gz
    mv -v netrw.vba ~/.vim
    gvim ~/.vim/netrw.vba
fi
dsh 27 
</cfnn>

a diversion, but to use this you'll also want 'dsh' on your
~/bin path:

<dsh>
#!/usr/bin/python
from sys import argv
if len(argv) < 2:
    ds = 60
else:
    ds = int(argv[1])
s = "-" * ds
print "%s" % s
</dsh>

and the real magic happens on my ~/py path:

<cfnn>
#!/usr/bin/python
import httplib2
from BeautifulSoup import BeautifulSoup
collections_soup = BeautifulSoup()
url = "http://mysite.verizon.net/astronaut/vim/index.html";
page = httplib2.Http(cache="/home/scott/.netrwcache").request(url,"GET")
collections_soup.feed(page[1])
for collection in collections_soup('a'):
    if collection['href'] == '#NETRW':
        print collection.findNext('td').contents[0]
        break
</cfnn>

and that's all there is to it

~/py/cfnn returned 'v135', which is different from 'v135r',
so the calling ~/bin/cfnn saved the old netrw, grabbed the
new one, dropped it in place, and dropped me in the middle
of it ready to :so %

sc



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui