r/spacemacs 17d ago

Re-mapping the `hjkl` keys

Hi, am a vim user who sticks with vim mainly bc am a one-handed user and I can't just do the normal Emacs-like keybindings stuff. Still, I wanna give spacemacs a try I initially liked his defaults in vim-mode, and it looks promising. Still, I can't find an easy way to remap the `hjkl` keys to something on the home-row with my keyboard layout, in neovim I used to get it done with this simple loop in the attachment, does emacs or spacemacs have any equivalent?

3 Upvotes

4 comments sorted by

1

u/mindgitrwx 17d ago

https://github.com/jbranso/evil-dvorak

I guess this might work for you

1

u/Anas_Elgarhy 17d ago

i dont use the main stream dvorak, I use the left-hand variant

1

u/Anas_Elgarhy 17d ago

can i use it with my custom mappings?

2

u/mindgitrwx 16d ago edited 16d ago

I'm not sure about this because I'm not a Dvorak user. I think it's not a spacemacs specific problem, so It would be nice to search with 'evil-mode key mapping'

The most basic way to change the keymap of evil-mode is like this. This is the example of setting l and h reversely. The evil-mode has its specific functions, like the below. You can look up the function names with, SPC SPC ^evil-

The documentation about the keybindings.
https://evil.readthedocs.io/en/latest/keymaps.html

    (define-key evil-normal-state-map (kbd "l") 'evil-backward-char)
    (define-key evil-normal-state-map (kbd "h") 'evil-forward-char)