Skip to content
This repository was archived by the owner on Oct 25, 2022. It is now read-only.

Initial attempt at evil-based key bindings #2

Merged
merged 73 commits into from
Nov 6, 2015
Merged

Initial attempt at evil-based key bindings #2

merged 73 commits into from
Nov 6, 2015

Conversation

justbur
Copy link
Member

@justbur justbur commented Oct 27, 2015

cc @TheBB @syl20bnr

I'm not done with this, but this is at least a starting point. I think some of the choices need some work. I didn't know where to put rename for instance. I also need to fix the popups.

Please give feedback on what you'd like to see changed. Here's a table showing the basic ideas

Command Old New
cherry pick a/A
branch b
bisect B
commit c
diff d/D
help h/?
ediff e/E
fetch f
pull F
ignore i/I
jump j g
delete k x
untrack K X
log l/L
merge m
remote M
next section n C-j
submodule o C-o
prev section p C-k
push P
rebase r
refresh g gr
rename R
stage s/S
tag t
notes T
unstage u/U
revert v/V o/O
am w
patch W
reset x C-r
show-refs y
cherry Y
stash z/Z
git-cmd :
run !

Other/Additions

Command New
evil-goto-first-line gg
evil-goto-line G
evil-search-next n
evil-search-previous N
set-mark-command v or V
evil-ex :
evil-search-forward /
evil-scroll-up C-u (if C-u scroll enabled)
evil-scroll-page-up C-b
evil-scroll-down C-d
evil-scroll-page-down C-f
magit-section-forward-sibling gj or ]
magit-section-backward-sibling gk or [
evil-emacs-state C-z
evil-next-visual-line j
evil-previous-visual-line k

@justbur
Copy link
Member Author

justbur commented Oct 27, 2015

@tarsius what's the easiest way to move popup commands?

@TheBB
Copy link
Member

TheBB commented Oct 27, 2015

@justbur magit-change-popup-key.

@TheBB
Copy link
Member

TheBB commented Oct 27, 2015

I tried this yesterday. Let me be more specific. :-P

(magit-change-popup-key 'magit-dispatch-popup :action ?k ?K)

For example. The popup argument is the symbol of the function that triggers the popup.

@justbur
Copy link
Member Author

justbur commented Oct 27, 2015

@TheBB I can give you access to my branch if you want to help :-P
On Tue, Oct 27, 2015 at 9:51 AM Eivind Fonn notifications@github.com
wrote:

I tried this yesterday. Let me be more specific. :-P

(magit-change-popup-key 'magit-dispatch-popup :action ?k ?K)

For example. The popup argument is the symbol of the function that
triggers the popup.


Reply to this email directly or view it on GitHub
#2 (comment).

@TheBB
Copy link
Member

TheBB commented Oct 27, 2015

Sure, why not.

@justbur
Copy link
Member Author

justbur commented Oct 27, 2015

@TheBB ok you should have access now. I'm just on master. I added a TODO list in the header.

In principle this will be simpler than normal, because there should be
less conflicts.
(evil-define-key 'motion git-rebase-mode-map (kbd "RET") 'git-rebase-show-commit)
(evil-define-key 'motion git-rebase-mode-map (kbd "SPC") 'magit-diff-show-or-scroll-up)
(evil-define-key 'motion git-rebase-mode-map (kbd "!") 'git-rebase-exec) ; was x
(evil-define-key 'motion git-rebase-mode-map (kbd "c") 'git-rebase-pick)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since p isn't used for anything else, you could use it here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I was trying to think of a use for p

@justbur
Copy link
Member Author

justbur commented Oct 27, 2015

@tarsius For the popups, it seems like magit-dispatch-popup might be the only one where the keybindings need to change to be consistent with the bindings in the magit buffers here. Are there any other popups that you know of that have bindings that would need to change?

To give an example, magit-log-popup has a binding for magit-log-head (bound to h), but that's ok with me because there's no other way to reach magit-log-head outside of the popup. I'm looking for commands that have one key bound to them in a buffer but another in a popup.

@nixmaniack
Copy link

Yes, that's right. It was resolved with C-jk which is what was the expected behaviour at that time. But just mentioning as I wanted jk there as well, so that we can have consensus on jk for visual line movement and have C-jk for magit section navigation.

@cpaulik
Copy link

cpaulik commented Nov 5, 2015

@justbur I would like C-jk to move by sections because it is easier to type than gj and gk when browsing through several sections. And also easier than [] on a 🇩🇪 keyboard.

@justbur
Copy link
Member Author

justbur commented Nov 5, 2015

@cpaulik @nixmaniack You're only answering part of my question. Perhaps I wasn't clear. There are two types of section movement magit-section-forward and magit-section-forward-sibling. The second usually jumps further. Since I don't have a strong opinion on this, I'd like to know which keys should go to both commands. The table at the beginning of this issue shows the current state. I'd like to come up with better movement commands (based on your recommendation) and make them consistent across all the maps.

Right now, I hear you say C-jk should be the shorter magit-section-forward and magit-section-backward. Would you have any other keys for those commands? What would you put on the longer jumping magit-section-forward-sibling and magit-section-backward-sibling?

This should have the same effect as trying to populate all the keys
initially, but is much cleaner and less error prone.
C-u is only scroll-up if evil-want-C-u-scroll is non-nil
Was an artifact from an old idea for J and K
@nixmaniack
Copy link

This is what is expected right now.
"j" evil-next-visual-line
"k" evil-previous-visual-line
"\C-j" magit-section-forward
"\C-k" magit-section-backward

Since I don't use magit-section-{forward,backward}-sibling (that often), but if you ask for suggestion M-jk might be the next better spot as in magit they're on M-np iirc.

@justbur
Copy link
Member Author

justbur commented Nov 5, 2015

I think gj and gk are good fits for the -sibling commands.

C-j/C-k move by section, and gj/gk move by section-sibling

Also, fix up comments in header
@justbur
Copy link
Member Author

justbur commented Nov 5, 2015

@cpaulik @nixmaniack pushed the changes. Refer to the table at the beginning of the issue. I think you will both be happy

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants