Change the default editor for files opened in the terminal? (e.g. set it to TextEdit/Coda/Textmate)

后端 未结 8 1289
-上瘾入骨i
-上瘾入骨i 2020-12-22 17:00

Is there a way to make files opened for editing in the terminal open in Textedit instead?

For example, where a command might open a file for editing (like git

相关标签:
8条回答
  • 2020-12-22 17:54

    Set your editor to point to this program:

    /Applications/TextEdit.app/Contents/MacOS/TextEdit
    

    With SVN, you should set SVN_EDITOR environment variable to:

    $ export SVN_EDITOR=/Applications/TextEdit.app/Contents/MacOS/TextEdit
    

    And then, when you try committing something, TextEdit will launch.

    0 讨论(0)
  • 2020-12-22 17:56

    If you want the editor to work with git operations, setting the $EDITOR environment variable may not be enough, at least not in the case of Sublime - e.g. if you want to rebase, it will just say that the rebase was successful, but you won't have a chance to edit the file in any way, git will just close it straight away:

    git rebase -i HEAD~
    Successfully rebased and updated refs/heads/master.
    

    If you want Sublime to work correctly with git, you should configure it using:

    git config --global core.editor "sublime -n -w"
    

    I came here looking for this and found the solution in this gist on github.

    0 讨论(0)
提交回复
热议问题