Gary,

On 2010-03-11 03:19, Gary Johnson wrote:
On 2010-03-11, Philip Rhoades wrote:
People,

I have this in my vimrc:

        autocmd BufWritePost   *.rb         !chmod 770 %

but I would like to make the chmod conditional on the file NOT already
currently being executable - do I need a function to do this?

One of these should help:

     getfperm()
     executable()

As an example, you could write your autocommand like this:

     autocmd BufWritePost *.rb if getfperm(expand("%")) !~ '^..x..x...$' | 
!chmod 770 % | endif

That's on one line.


Thanks!

Phil.
--
Philip Rhoades

GPO Box 3411
Sydney NSW      2001
Australia
E-mail:  [email protected]

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to