And this, from someone who lurves Emacs. ;) Nice one, Zak. :D

On Sun, Jul 27, 2008 at 11:25 AM, Zak B. Elep <[EMAIL PROTECTED]> wrote:
> On Sat, Jul 26, 2008 at 10:16 PM, Gene Ordanza II
> <[EMAIL PROTECTED]> wrote:
>> Hi All,
>>
>> I'm using vim editor for Python programming and would like to automate some
>> tasks.  I would like to map a single key to do the following:
>
> [...]
>
>> 'appreciate it if you can give some tips or pointers.
>
> You probably want to encapsulate that into a function in your .vimrc:
>
> ,----
> | " automatically run Python on file if it begins with `#!' and contains
> | " `python' in the first line
> | function RunPython()
> |   if getline(1) =~ "^#!"
> |     if getline(1) =~ "python"
> |       !python <afile>
> |     endif
> |   endif
> | endfunction
> |
> | au BufWritePost * call RunPython()
> `----
>
> This even saves you a keymap, so just  doing `:w' automatically calls
> RunPython() on the file just after saving it.
>
> And, for the Emacs folks, there's also the equivalent (and more
> robust) shebang.el[1] library.
>
> [1]  http://harts.net/reece/emacs/shebang.el
>
> --
> Zak B. Elep || http://zakame.spunge.org
> [EMAIL PROTECTED] || [EMAIL PROTECTED] || [EMAIL PROTECTED]
> 1486 7957 454D E529 E4F1 F75E 5787 B1FD FA53 851D
> _________________________________________________
> Philippine Linux Users' Group (PLUG) Mailing List
> http://lists.linux.org.ph/mailman/listinfo/plug
> Searchable Archives: http://archives.free.net.ph
>



-- 
Ian Dexter R. Marquez
http://feeds.iandexter.net/Coredump
Norah Jones – Wish I Could
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
http://lists.linux.org.ph/mailman/listinfo/plug
Searchable Archives: http://archives.free.net.ph

Reply via email to