Navigation Menu

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

Binding y and Y in evil-evilified-state-map #14431

Closed
yyoncho opened this issue Feb 27, 2021 · 8 comments
Closed

Binding y and Y in evil-evilified-state-map #14431

yyoncho opened this issue Feb 27, 2021 · 8 comments
Labels
Evilified Key Bindings PR pending stale marked as a stale issue/pr (usually by a bot)

Comments

@yyoncho
Copy link
Contributor

yyoncho commented Feb 27, 2021

Is there a reason for not having y/Y bindings in evilified-state?

@duianto
Copy link
Collaborator

duianto commented Mar 2, 2021

I don't know what the reason was for choosing some and not other keys.

The evil-evilified-state.el header says:

;; Define a `evilified' evil state inheriting from `emacs' state and
;; setting a minimalist list of Vim key bindings (like navigation, search, ...)
;; The shadowed original mode key bindings are automatically reassigned
;; following a set of rules:
;; Keys such as
;; /,:,h,j,k,l,n,N,v,V,gg,G,C-f,C-b,C-d,C-e,C-u,C-y and C-z
;; are working as in Evil.
;; Other keys will be moved according to this pattern:
;; a -> A -> C-a -> C-A
;; The first unreserved key will be used.
;; There is an exception for g, which will be directly
;; bound to C-G, since G and C-g (latest being an important escape key in Emacs)
;; are already being used.

These possibly useful keys are not bound either: w, b, $ and ^

But they, including y, are bound in the evilified visual state.

This seems to be where the evilified keys are defined:

;; default key bindings for all evilified buffers
(define-key evil-evilified-state-map "/" 'evil-search-forward)
(define-key evil-evilified-state-map ":" 'evil-ex)
(define-key evil-evilified-state-map "h" 'evil-backward-char)
(define-key evil-evilified-state-map "j" 'evil-next-visual-line)
(define-key evil-evilified-state-map "k" 'evil-previous-visual-line)
(define-key evil-evilified-state-map "l" 'evil-forward-char)
(define-key evil-evilified-state-map "n" 'evil-search-next)
(define-key evil-evilified-state-map "N" 'evil-search-previous)
(define-key evil-evilified-state-map "v" 'evil-visual-char)
(define-key evil-evilified-state-map "V" 'evil-visual-line)
(define-key evil-evilified-state-map "gg" 'evil-goto-first-line)
(define-key evil-evilified-state-map "G" 'evil-goto-line)
(define-key evil-evilified-state-map (kbd "C-f") 'evil-scroll-page-down)
(define-key evil-evilified-state-map (kbd "C-b") 'evil-scroll-page-up)
(define-key evil-evilified-state-map (kbd "C-e") 'evil-scroll-line-down)
(define-key evil-evilified-state-map (kbd "C-y") 'evil-scroll-line-up)
(define-key evil-evilified-state-map (kbd "C-d") 'evil-scroll-down)
(define-key evil-evilified-state-map (kbd "C-u") 'evil-scroll-up)
(define-key evil-evilified-state-map (kbd "C-z") 'evil-emacs-state)
(define-key evil-evilified-state-map (kbd "C-w") 'evil-window-map)

@yyoncho
Copy link
Contributor Author

yyoncho commented Mar 2, 2021

Unless someone is against these binding imho they should be added. For me, it is a PITA, e. g. I want to copy something in evilified view-mode and I cant, I have to use a visual selection

@duianto
Copy link
Collaborator

duianto commented Mar 2, 2021

Agreed, it's surprising when the evil keys don't work as expected.

I'll open a PR, someone might think of other useful keys that should be added.

It would also be useful to be able to apply text objects in visual state,
ex: vio for evil-inner-symbol

But I'm not quite sure how to bind those.
I figured out how to bind the text objects in evilified visual state.

@duianto
Copy link
Collaborator

duianto commented Mar 2, 2021

A PR is pending:
[evilified] Add evilified normal keys: yank, navigate #14448

@duianto
Copy link
Collaborator

duianto commented Mar 2, 2021

f, F, t and T were also missing, they are included in the PR.

@duianto
Copy link
Collaborator

duianto commented Mar 14, 2021

The PR: [evilified] Add evilified normal keys: yank, navigate #14448

broke org-agenda:
Evilified normal keys breaks "t" keabinding in agenda #14484

And probably more modes.
That "solution" was to general.

The PR has been reverted.

Let's add the keys for each specific mode where they are missing.

One instance is the *Backtrace* buffer (debugger-mode).

You mentioned: view-mode
Do you have some reproduce steps, I'm still in normal evil-state state when I just call: M-x view-mode

I can't think of any other modes at the moment.

@duianto
Copy link
Collaborator

duianto commented Mar 14, 2021

The debugger-mode already has an evilified section without any bound keys:

:config (evilified-state-evilify-map debugger-mode-map
:mode debugger-mode)))

This seems to work:

    :config (evilified-state-evilify-map debugger-mode-map
              :mode debugger-mode
              :bindings
              "$" 'evil-end-of-line
              "^" 'evil-first-non-blank
              "b" 'evil-backward-word-begin
              "B" 'evil-backward-WORD-begin
              "f" 'evil-find-char
              "F" 'evil-find-char-backward
              "gb" 'debugger-frame
              "t" 'evil-find-char-to
              "T" 'evil-find-char-to-backward
              "w" 'evil-forward-word-begin
              "W" 'evil-forward-WORD-begin
              "y" 'evil-yank
              "Y" 'evil-yank-line)))

by default b is bound to debugger-frame, but it might be expected by evil users to be able to jump to the previous word.

The idea to bind it to: gb debugger-frame
came from evil-collection-debug

@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 Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Evilified Key Bindings PR pending stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

No branches or pull requests

2 participants