Tuesday, December 1, 2009

Re: How to change the mode for a new file automatically?

On Wed, December 2, 2009 4:47 am, Peng Yu wrote:
> When I edit a new .sh file, I always want to 'chmod +x'. I'm wondering
> if there is a way to make this process automated in vim?

You can use an autocommand. Try something like this (I can't test right
now, because I am on Windows currently):

au BufWritePost *.sh if !executable(expand("%")) | let
v:fcs_choice="reload" | :exe ":!chmod +x %" | unlet v:fcs_choice='' |
endif

regards,
Christian
--
:wq

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

No comments: