I am trying to use different keybindings for basic movement and deletion in emacs. What I would like to use are the following keybindings:
- Ctrl+i/k/j/l : up/down/left/right
- Ctrl+u/o : backward/forward word
- Ctrl+d/f : delete left/right
- Ctrl+e/r : delete word left/right
- Ctrl+Alt+e/r : delete to begining/end of line
- Ctrl+c/x/v : copy/cut/paste
- Ctrl+m Alt+m : search history backwards/forwards
- etc
Which I managed to make work in most of the cases. Nevertheless I still face two problems:
- Some major modes keybindings takes precedence over my settings. For example some python mode might set C-j to newline-and-indent, and I have to figure out each problem for each minor mode I am using, find the correct keymap and free my key. Tedious.
- Some major modes use a slightly modified command for basics movements. For example org-mode might use org-end-of-line for C-e instead of end-of-line. This allows to jump to the end of the line, without taking into account the tags on the right. Or some mode would change the delete backward command to a custom one, more fitted to the desired task. Same for C-n and C-p that often change signification through modes. These are some sine features that I would like to use without explicitely search for them, find their command names, rebind them for each major mode I use. I want my C-k to work the same as would C-n in every mode I use, without having to do anything.
So my question is, how can I create a minor mode, containing all my keybindings, that would precede all other mode's keybindings, and that would do something like:
C-n : "please bind C-k (my preference for down movement) to whatever command C-n was meant to be bound to in this mode"
I guess I have to create a minor mode for this, maybe have to load it through a hook in before each major mode, and use some emacs function that returns the function bound to a given keybinding.
Any idea on how to do that?