vim has a really great feature for defining keybindings.
from the vim docs:
:cno[remap] {lhs} {rhs} |mapmode-c| *:cno* *:cnoremap*
Map the key sequence {lhs} to {rhs} for the modes
where the map command applies. Disallow mapping of
{rhs}, to avoid nested and recursive mappings. Often
used to redefine a command.
Basically, the :cnoremap
command creates a keybinding, but forbids any further redefinitions of it. This made defining keybindings in vim always easy for me. However, in emacs i don't know such a command - currently I use commands like (global-set-key [f8] 'my/copy-to-clipboard)
to define my keybindings. Unfortunately, this is really a pain, because other packages can easily remap that (in my case, the evil
package).
How can i define a keybinding in emacs, which can't be modified, once it is set?
Important edit: I don't want to restrict what can be done to lhs
- I want just prevent a redefinition/modification of rhs
.