This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Distributed Git not compiled under Cygwin?


On 12/29/2011 03:44 PM, cxira wrote:
> I moved away from msysgit because it wasn't displaying colors properly in
> mintty. As for a vim script, I put together something that executes `chmod
> 0644` when saving new files only:
> 
> " Change permissions on new files to be 0644 in cygwin
> augroup filePerms
>     autocmd!
>     autocmd BufWritePre * call NewFileTest()
> augroup END
> function! NewFileTest()
>     if !filereadable(expand('<afile>'))
>         " If the file cannot be found pre-write, add a post-write command
>         autocmd filePerms BufWritePost * call NewFileAlter()
>     endif
> endfunction
> function! NewFileAlter()
>     " Remove command after it is executed once
>     autocmd! filePerms BufWritePost
>     " Change permissions
>     silent execute "!C:\\cygwin\\bin\\bash.exe -c \"/usr/bin/chmod 0644 '" .
> substitute(expand("<afile>"), "^\\(.\\):/", "/cygdrive/\\1/", "") . "'\""
> endfunction
> 
> There's a very brief appearance of the command prompt when I save a new
> file, but I think it's a suitable and portable solution. Thanks for the
> help.

Good stuff.  You can avoid the window that pops up by using the run.exe
program to kick off your chmod command rather than bash.  It's available
in the run package.

-Jeremy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]