簡體   English   中英

嘗試在 git 中設置新編輯器

[英]Trying to setup a new editor in git

我正在嘗試為我的 windows XP 盒子上安裝的 git 版本 1.8.0.msysgit.0 隨附的 VI 編輯器找到一個很好的替代品。 我瀏覽了這里的論壇並嘗試了他們的一些建議。 我一定是錯過了什么,因為他們不為我工作。 我已經從 git 命令行嘗試了這個:

git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst"

我還嘗試了另一種使用 shell 的方法。 在那里,我在 C 的根目錄上創建了一個名為 shell 的文件夾:然后我創建了一個名為 npp.sh 的 sh 文件,其中包含以下內容:

#!/bin/sh
"c:/Program Files/Notepad++/notepad++.exe" -multiInst "$*"

之后我輸入了這個命令:

git config --global core.editor C:/shell/npp.sh

在這兩種情況下,如果我在 git 命令行上輸入 notepad++,我都會收到消息sh.exe": notepad++: command not found

事實證明這非常困難。 /c/Program\\ Files/Notepad++/notepad++.exe從Git bash可以很好地執行,但似乎不適用於git config core.editor

但是,您可以為Notepad ++創建一個Bash 別名 ,並將其用作您的core.editor 有關詳細信息,請參見此答案

我遇到了這個問題,git 文檔啟發了我。

https://docs.github.com/en/get-started/getting-started-with-git/associating-text-editors-with-git

“使用 Notepad++ 作為您的編輯器”下的部分提供了答案。

在 Git Bash 中運行以下命令,你就走了。

$ git config --global core.editor "'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"

如果要在設置 notepad++ 后打開全局 git 配置文件,請使用:

$ git config --global -e

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM