首页 > 解决方案 > 在 git commit 期间固定光标位置

问题描述

我一直在用xed写我的提交信息。 xed记住每个文件的最后一个光标位置。由于.git/COMMIT_EDITMSG每个提交消息都会重用该文件,xed因此在我提交上一次提交时,光标会在我所在的位置打开。必须手动将光标重新定位回第一行是一个 PITA。

[X]:我希望光标在哪里。

[Y]:光标所在位置。

[X]

# Please enter the commit [Y] message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch develop
# Your branch is up to date with 'origin/develop'.
#

标签: gitgit-commit

解决方案


可以告诉xed在某一行打开。在.gitconfig中,只需替换

[core]
  editor = xed

经过

[core]
  editor = xed +1

xed +lineNumber告诉xed在该行打开文件lineNumber

+1告诉它在第一行打开文件。


推荐阅读