sc <[email protected]> writes:
> On Thursday 24 September 2009, Harry Putnam wrote:
>
>> Can anyone tell me how to do that... or maybe just write a
>> separate setting that causes the file to be chmod to 755 on
>> save.
>
> with the following in your .vimrc:
>
> "http://vim.wikia.com/wiki/Setting_file_attributes_without_reloading_a_buffer
> function! SetExecutableBit()
> if &modified
> write
> endif
> let fname = expand("%:p")
> checktime
> execute "au FileChangedShell " . fname . " :echo"
> silent !chmod 754 %
> checktime
> execute "au! FileChangedShell " . fname
> endfunction
> command! Xbit call SetExecutableBit()
>
> the command :Xbit will set the executable bit (to 754 -- you
> can change that) as well as save
I don't see that here.
Starting with no file named new.pl
I do:
vim new.pl
As the file opens perl-support templates do there magic and insert
certain things.
I then write something too ... then do :Xbit
I'm tossed into a blank buffer where even my ruler has disappeared.
If I do :q ... then vim stops and I see the new.pl with chmod 755
I'm guessing the part of getting dumped into a blank buffer in cmd
mode is not supposed to happen?
Copying direct from .vimrc
function! SetExecutableBit()
if &modified
write
endif
let fname = expand("%:p")
checktime
execute "au FileChangedShell " . fname . " :echo"
silent !chmod 755 %
checktime
execute "au! FileChangedShell " . fname
endfunction
command! Xbit call SetExecutableBit()
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---