Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Associating text editors with Git #11630

Open
wesleifreitas opened this issue Aug 26, 2015 · 10 comments
Open

Associating text editors with Git #11630

wesleifreitas opened this issue Aug 26, 2015 · 10 comments

Comments

@wesleifreitas
Copy link

I love Brackets and as a user, I'd like a way to associate him as Git text editor.

Already realized the following to the Brackets with no success:

https://help.github.com/articles/associating-text-editors-with-git/

Thank you.

@petetnt
Copy link
Collaborator

petetnt commented Aug 26, 2015

Nice idea 👍

After configuring core.editor:

git config --global core.editor "brackets"

Brackets already correctly opens the COMMIT_EDITMSG file, so only thing needed to implement in brackets-shell / cmd-line integration this would be "don't return until Brackets exits" behavior behind a -w or -wait flag

@wesleifreitas
Copy link
Author

Exactly!

@abose
Copy link
Contributor

abose commented Aug 27, 2015

tagging @zaggino

@zaggino
Copy link
Contributor

zaggino commented Aug 28, 2015

there scripts would need to be modified: https://github.com/adobe/brackets-shell/tree/master/scripts

for windows, it should be easy, just remove the start bit from https://github.com/adobe/brackets-shell/blob/master/scripts/brackets.bat

for mac/linux, it's this file: https://github.com/adobe/brackets-shell/blob/master/scripts/brackets but it has been a while since I've done any shell scripts

@zaggino
Copy link
Contributor

zaggino commented Aug 28, 2015

i'm guessing you guys could try to find those script files on your drives using which and try to alter them to support the -w flag?

@petetnt
Copy link
Collaborator

petetnt commented Aug 28, 2015

@zaggino I was going to do the Windows part myself but didn't get around to do it because something (I think the folder being in PATH?) locks the files from editing. I can try again later today.

@zaggino
Copy link
Contributor

zaggino commented Aug 28, 2015

there's no reason it should be locked ... but I'm not familiar where installer places those, maybe UAC is blocking it?

@petetnt
Copy link
Collaborator

petetnt commented Aug 28, 2015

@zaggino yeah it's an UAC problem, might have been too sleepy to figure that out 🐹

Some progress:

Modifying the brackets.cmd like this can be used to wait for exit:

@echo off

SET WAIT_FOR_EXIT=

FOR %%a IN (%*) DO (
  IF /I "%%a"=="-w" SET WAIT_FOR_EXIT=YES
  IF /I "%%a"=="--wait" SET WAIT_FOR_EXIT=YES
)
  echo "waiiiit"
IF "%WAIT_FOR_EXIT%"=="YES" (
  echo "waiiiit"
  start  /WAIT Brackets.exe %* 
) ELSE (
  start Brackets.exe %*   
)

However, associating it with core.editor won't work. Why? Because running git commit launches the core.editor in the MinGW context, which means that this block will be run from brackets-file:

if [ "$OS_NAME" == "MinGW" ]; then
    # Suprisingly MING32 platform recognizes
    # windows "start" command. Use this against
    # launching .exe as the later is blocking.
    start "Brackets.exe" "$@"
else

But that start command won't accept the /wait parameter.

Investigating...

@zaggino
Copy link
Contributor

zaggino commented Aug 29, 2015

I don't think you need to pass /wait parameter to Brackets.exe. You just need to get rid of the start keyword in case you want the script to wait.

@HollyJHuber
Copy link

git config --global core.editor "brackets -n -W"

works for me using git version 2.13.1 and Brackets 1.9

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants
@zaggino @abose @wesleifreitas @petetnt @ficristo @HollyJHuber and others