lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Feat: Allow emacs character navigation in the commit editor.

Open LiamKearn opened this issue 2 years ago • 5 comments

Haven't used go before, testing the waters a little before thinking about a contribution.

This feels like something not a lot of people would use so would there be room open for customisation of these bindings? What is the general stance on keyboard shortcuts / how flexible would we be to something like jumping/deleting words in the commit editor?

Out of curiosity where else in the application would this keypress handling be used? I can see one call to handleEditorKeypress in commitMessageEditor. The gui's PopupHandler stuff seems a bit more open ended and complex for me right now.

I understand most people want to open their $VISUAL or $EDITOR but for me personally having the context (diff/reflog etc) in the background and using a popup is more efficient most of time.

LiamKearn avatar Aug 09 '22 08:08 LiamKearn

Related discussions: #1783 , #795.

I understand most people want to open their $VISUAL or $EDITOR but for me personally having the context (diff/reflog etc) in the background and using a popup is more efficient most of time.

Try adding this to your gitconfig and using the external editor:

[commit]
	verbose = true

mark2185 avatar Aug 09 '22 08:08 mark2185

I'm happy to add these keybindings as the existing ones have limited support across terminals. But yes it would be good to make all the keybindings in handleEditorKeypress configurable (though happy to have some sane defaults and that includes emacs keybindings)

jesseduffield avatar Aug 09 '22 08:08 jesseduffield

Try adding this to your gitconfig and using the external editor.

I didn't know there was a gitconfig for that I'm in the habbit of using status -v and commit -v but I hadn't seen that before. I'll be adding that my config.

I'm still however a sucker for the default commit editor. I might have a look into those other two issues thanks :)

LiamKearn avatar Aug 09 '22 08:08 LiamKearn

I'm still however a sucker for the default commit editor. I might have a look into those other two issues thanks :)

It sure is comfy, until you need a multiline message.

mark2185 avatar Aug 09 '22 08:08 mark2185

I'm still however a sucker for the default commit editor. I might have a look into those other two issues thanks :)

It sure is comfy, until you need a multiline message.

Yeah can't argue against using $EDITOR for that. #1783 is cool but IMO if you're editing that much text you should use an editor.

I think shortcuts are different here, They still preserve the visual UX and make the non EDITOR experience better.

LiamKearn avatar Aug 09 '22 08:08 LiamKearn

@Ryooooooga could you weigh in on this PR: how does it relate to your recent emacs keybindings PR?

jesseduffield avatar Sep 24 '22 06:09 jesseduffield

This PR is about a similar interest to #2183, but is independent.

But yes it would be good to make all the keybindings in handleEditorKeypress configurable

I agree with that.

Ryooooooga avatar Sep 24 '22 11:09 Ryooooooga

Very well! Thanks for making this @LiamKearn

jesseduffield avatar Sep 24 '22 17:09 jesseduffield