edkolev / evil-lion

Evil align operator
131 stars 12 forks source link

provide a way to customize the keybinds #6

Closed ninrod closed 7 years ago

ninrod commented 7 years ago

Hi, thanks for the package.

Please consider providing a way for the user to customize the keybinds. I for one already use the gl bind for something else.

edkolev commented 7 years ago

Do you think a custom variable would be enough? Or something like evil-exchange's (evil-exchange-cx-install) would be what you need?

(evil-exchange-cx-install) doesn't work reliably for my anymore. It was OK some time ago, but it just broke at some point when my init.el grew some more.

Hence, I'm not sure if it would be a good idea to add something like it.

ninrod commented 7 years ago

Hi! I think a custom variable would be simple and sufficient. First thought that comes to mind is something like: (setq evil-lion-enable-default-binds nil). If I set this, then evil-lion does not bind the commands.

Then I can proceed and bind the individual commands to my liking.

Sounds good?

edkolev commented 7 years ago

Hi!

These 3 custom vars have now been added (but not yet documented in the README):

Usage 1 - use g a and g A instead of g l/L (mnemonic a align):

(setq evil-lion-left-align-key (kbd "g a"))
(setq evil-lion-right-align-key (kbd "g A"))
(evil-lion-mode)

Usage 2 - advanced, map the functions to whatever make sense to you:

(setq evil-lion-enable-default-binds nil)

(evil-define-minor-mode-key 'normal 'evil-lion-mode
   (kbd "g a") 'evil-lion-left
   (kbd "g A") 'evil-lion-right)
(evil-define-minor-mode-key 'visual 'evil-lion-mode
   (kbd "g a") 'evil-lion-left
   (kbd "g A") 'evil-lion-right)

(evil-lion-mode)

Usage 3 - advanced, don't use evil-lion-mode at all; for example map only in prog-mode:

   (evil-define-key 'normal prog-mode-map
     (kbd "g l") 'evil-lion-left
     (kbd "g L") 'evil-lion-right)

   (evil-define-key 'visual prog-mode-map
     (kbd "g l") 'evil-lion-left
     (kbd "g L") 'evil-lion-right)

I hope I don't have a typo somewhere above.

Please let me know what you end up using :)

ninrod commented 7 years ago

Thank you!

Oh, I see, so evil-lion-mode is just a convenience minor mode to provide some keybinds, is that right? If so, then I like the third approach very much. I don't call evil-lion-mode at all and then proceed to bind the commands individually to my liking. (which is a breeze using noctuid's general.el).

Is that correct? If so, I think the third approach is simple and effective enough that you could leave 1 and 2 out.

edkolev commented 7 years ago

Yes, it's just a convenience mode. I've added details about the 3rd option here https://github.com/edkolev/evil-lion#customization

I decided to keep these 2 custom variables: evil-lion-left-align-key, evil-lion-right-align-key

ninrod commented 7 years ago

Awesome. I think we can close this now. Thanks again!