Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing a hunk with git add -i is weird #4112

Closed
nugend opened this issue Dec 8, 2015 · 9 comments
Closed

Editing a hunk with git add -i is weird #4112

nugend opened this issue Dec 8, 2015 · 9 comments
Labels
Bug :-( Evilified Key Bindings stale marked as a stale issue/pr (usually by a bot)

Comments

@nugend
Copy link

nugend commented Dec 8, 2015

No standard insert mode seems to be supported, so removing a '-' line involves cutting and pasting a space. Normal mode doesn't work correctly so normal motion keys can't be used. No undo, etcetera.

Pretty weird in general.

@StreakyCobra
Copy link
Contributor

Could you give some reproduction steps? I mean, not how to have changes on the git repo, but what you are doing then. On my side git add -i doesn't involve $EDITOR, and in spacemacs this is done within magit with its own bindings.

@nugend
Copy link
Author

nugend commented Dec 8, 2015

I'm not sure what to describe, sorry. I added a file using git add -i, used the 'e' command to edit the hunk, and was dropped into spacemacs with aforementioned weird behavior.

My $VISUAL is also set to emacs if that helps?

@StreakyCobra
Copy link
Contributor

Ok, a wrong configuration on my side, sorry. Yes it's not usable as it is. It's defaulting to diff mode, and there is some weird behaviours there :-/

@justbur It's weird because it's evilified, but there is no normal state, it's inserting characters like in insert state, but SPC is triggering the spacemacs leader. If you have an idea how to correct this properly :-)

@justbur
Copy link
Contributor

justbur commented Dec 9, 2015

The short answer is C-z gets you into emacs state from which all of the emacs bindings are available.

The issue is that you are in evilified state, which is not a proper editing state and is also difficult to get out of. I'm not sure what the right answer is here. Here are two possibilities

  1. Enhance evilified state for diff mode so that the operations you need to use in this case are bound to a key
  2. Don't use evilification here and just use normal state (or emacs state for holy mode people), so that all of the editing commands are available.

@justbur
Copy link
Contributor

justbur commented Dec 9, 2015

@syl20bnr ☝️

@nugend
Copy link
Author

nugend commented Dec 10, 2015

My guess is normal state since the purpose of editing hunks is that you edit them, not just changing '+' and '-'

Otherwise git interactive add would actually take care of that part (I mean, it's the one git command I know of that doesn't just dump you into the editor).

FWIW, I think the evilified state for rebase -i stinks on ice. I should actually look up the way to turn that off...

@justbur
Copy link
Contributor

justbur commented Dec 10, 2015

@nugend are you on master or develop?
If it's master, I think this should work to disable in both of those modes:

  (with-eval-after-load 'diff-mode
    (push 'diff-mode evil-emacs-state-modes)
    (setq evil-evilified-state-modes (delq 'diff-mode evil-evilified-state-modes)))
  (with-eval-after-load 'git-rebase-mode
    (push 'git-rebase-mode evil-emacs-state-modes)
    (setq evil-evilified-state-modes (delq 'git-rebase-mode evil-evilified-state-modes)))

@justbur
Copy link
Contributor

justbur commented Dec 10, 2015

☝️ in dotspacemacs/user-config

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug :-( Evilified Key Bindings stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

No branches or pull requests

3 participants