[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Vim tip (was Re: Suspend/Resume issues - Custom scripts not running? Mouse frozen?)



On Sun, 22 Feb 2009 20:49:29 +1300
Chris Bannister <mockingbird@earthlight.co.nz> wrote:

> On Sat, Feb 21, 2009 at 06:59:15AM +0100, Javier wrote:

...

> > Don't forget to chmod +x once saved.
> 
> If you use vim for your editing, put this in your .vimrc file:
> 
> " automatically give executable permissions if file begins with #! and
> " contains '/bin/' in the path
> 
> function ModeChange()
>   if getline(1) =~ "^#!"
>     if getline(1) =~ "/bin/"
>       silent !chmod a+x <afile>
>     endif
>   endif
> endfunction
> 
> au BufWritePost * call ModeChange()

Neat!  I was getting rather tired of all those chmod +x 's ...

Celejar
--
mailmin.sourceforge.net - remote access via secure (OpenPGP) email
ssuds.sourceforge.net - A Simple Sudoku Solver and Generator


Reply to: