On Sat, Jun 03, 2006 at 12:52:26PM +0200, Danny wrote:
When I create a new file with Vim, how can I change the permissions to
executable automatically.

At the moment I have to create the file, exit vim, and then chmod 744.

Here is what I use in my vimrc:

   au BufWritePost *.sh :exe "silent !chmod a+x <afile>" | silent :w!

You need to change '*.sh' to '*' if you want to do this for all extensions.

This "au BufWritePost" line above is actually improved version over
my older vimtip http://www.vim.org/tips/tip.php?tip_id=709

But this vimtip has other related tricks that you might find useful.

Yakov

P.S. Unfortunately, vimtips are uneditable as of now.

Reply via email to