-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Adds the evil-remap package to spacemacs layers #5465
Conversation
Spacemacs is intended (at least in part) for vimmers who have never used emacs, but may already be very comfortable in vim. Often one of the first things you learn in vim is to put something like `imap jj <Esc> " use jj for returning to normal mode` in their .vimrc Spacemacs already covers this case pretty well, but there are lots of other changes you might want to make. Another common one: `nnoremap ; : " set ; to summon ex-mode` Unfortunately, today there are many ways to set a keybinding in emacs. global-set-key, local-set-key, define-key, etc. Worse still, most of the documentation online doesn't take evil into account. Also, keys aren't defined simply, via a string. You have to use (kbd "blah") instead.I personally ran into this problem when starting with spacemacs. I wanted to map a key in normal mode, but global-set-key was getting overridden by the already defined behavior of that key in normal mode (a more specific binding). Evil-remap allows vim-users to bind keys simply. The functions all follow the same format as vim: <mapping_type> <key to map> <behavior to map it to> This layer is very simple, since it's my first foray into emacs lisp. Based on the documentation for creating a layer, I took the package definition from my additional-packages and changed the require call to be a use-package call. I also added documentation based on the documentation on the package itself. I tested it locally in my private layers, then moved it to make this PR.
Thank you for the PR. I'm not sure about this package because I feel that it does not serve the user well in the end for at least these reasons:
|
Do we have good documentation surrounding this today? If not, that may be a good alternative to this. One of the most common beginner questions on gitter is "How can I bind x function to y keys, in z modes?"
Huh, I've always heard it as the principle of least surprise. Threw me for a second. I'm not sure I understand the package well enough to answer this one.
It does not.
Yeah, someone recommended on gitter that if I was going to use the package that I should make a layer of it :) It was a pain to set up manually, since all the other packages I've used have been on Melpa or elpa, and since I had to explicitly |
solves #5426 <3 |
Given that this has not been merged, how does one go about |
@Kazark There is an example in the PR itself. (define-key evil-normal-state-map (kbd ";") 'evil-ex) Put this inside |
@sdwolfz Thanks. That's the bootstrapping I needed as a complete n00b. One of the things I am looking forward to here is a chance to dive a little deeper into Lisp. I would much rather work in Lisp than VimScript, despite being moderately good at VimScript, which is one of the things that attracts me to Spacemacs. I am a diehard functional programmer, but have lamentably little experience with Lisps. Anyhow, thanks. |
This PR 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 PR is still need merging! |
Rationale
Spacemacs is intended (at least in part) for vimmers who have
never used emacs, but may already be very comfortable in vim. Often one
of the first things you learn in vim is to put something like
imap jj <Esc> " use jj for returning to normal mode
in your .vimrc
Spacemacs already covers this case pretty well, but there are lots of
other changes you might want to make. Another common one:
nnoremap ; : " set ; to summon ex-mode
Unfortunately, today there are many ways to set a keybinding in emacs.
global-set-key, local-set-key, define-key, etc. Worse still, most of the
documentation online doesn't take evil into account. Also, keys aren't
defined simply, via a string. You have to use (kbd "blah") instead.I
personally ran into this problem when starting with spacemacs. I wanted
to map a key in normal mode, but global-set-key was getting overridden
by the already defined behavior of that key in normal mode (a more
specific binding).
Evil-remap allows vim-users to bind keys simply. The functions all
follow the same format as vim:
<mapping_type> <key to map> <behavior to map it to>
Implementation
This layer is very simple, since it's my first foray into emacs lisp.
Based on the documentation for creating a layer, I took the package
definition from my additional-packages and changed the require call to
be a use-package call. I also added documentation based on the
documentation on the package itself. I tested it locally in my private
layers, then moved it to make this PR.