-
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
Creating bindings for certain modes and certain states #1771
Comments
This is called |
For discoverability note that for now guide-key does not work with major-mode specific key bindings, you have to use |
@syl20bnr can you be explicit or point me to the right docs for this please? As I'm reading that I can't map keys in the same way, I'm forced to use TBH, using Could one define a normal mode mapping just for python mode that had |
First you can choose the keys for the leaders: https://github.com/syl20bnr/spacemacs/blob/develop/core/templates/.spacemacs.template#L81-L94 Then you can set bindings for a specific mode using its key binding map: (evil-define-key 'normal omnisharp-mode-map (kbd "g R") 'omnisharp-rename) Fore more info look at the code in spacemacs with |
This doesn't load for me @syl20bnr :
This example maps so for python one would use
Not sure what Thanks for the guidence though, I'll go through them |
This is because the map is not yet available, you have to defer the define with (eval-after-load 'omnisharp
`(evil-define-key 'normal omnisharp-mode-map (kbd "g R") 'omnisharp-rename)) With several expression you have to use a progn: (eval-after-load 'omnisharp
`(progn
(evil-define-key 'normal omnisharp-mode-map (kbd "g R") 'omnisharp-rename)
(evil-define-key 'normal omnisharp-mode-map (kbd "g R") 'omnisharp-rename))) |
when i said it didn't load I was referring to the hyperlink, I just got a 404 message from that. I'm not finding this obvious from reading the |
I forgot to remove the link :-) |
Oh right no worries :) Yeah, I can have a play with what's here thanks And yes I agree - I proposed here #1735 (comment) that there was a walk through of a basic cheers though :) |
It doesn't seem that theres anyway to have functionality like VIms
after
directory (or not an obvious one).In vim, within
~/.vim/after/ftplugin/python.vim
one could enter commandswhich would only be active for python files.
Or whatever (probably something more sensible...)
Is there a way to get this behaviour from Evil / Spacemacs?
The text was updated successfully, but these errors were encountered: