how can I map 'esc' key to 'jk' or 'jj' in spacevim? What is the configuration file for spacevim. Is there any legendary spacevim config you can share?
Asked
Active
Viewed 1,156 times
1
-
1You need to find some way to add `inoremap jj
` in your config. I'm not familiar with SpaceVim, but it should provide a way to add the configuration in vimscript. – jubnzv Mar 16 '21 at 12:47 -
1You can ask in their issue tracker. Using those "vim distribution" is not recommended, since you don't know what/where they've configured and why do you need it. Sooner or later it will drive you crazy. Config your own vim, try to understand the config in your vimrc. – Kent Mar 16 '21 at 14:03
-
@jubnzv I have tried doing it in my own vimrc file but it didn't work, thanks for your help – Emad Baqeri Mar 16 '21 at 19:59
-
@Kent yeah I think this is the best way of working with vim. but there is something that makes to use vimdstros are the boiler plate themes and packages that they have – Emad Baqeri Mar 16 '21 at 20:00
-
I would like to mention that the file you are going to edit is going to be `~/.vimrc` file and in other forks or distros of vim or nvim you should find the proper config file or it may break your vim. – Emad Baqeri Jun 10 '21 at 07:47
1 Answers
1
As @jubnzv mentioned, you need to find a way to add inoremap jj <Esc>
in your config. In spacevim, you can do it with the Bootstrap functions.
SpaceVim provides two kinds of bootstrap functions for custom configurations and key bindings, namely bootstrap_before and bootstrap_after.
First, enable the bootstrap in your config, the default path is ~/.SpaceVim.d/init.toml
[options]
bootstrap_before = 'myspacevim#before'
bootstrap_after = 'myspacevim#after'
Next, create file ~/.SpaceVim.d/autoload/myspacevim.vim
with the following contents
function! myspacevim#before() abort
endfunction
function! myspacevim#after() abort
inoremap jj <Esc>
endfunction
More detail in the official document here: https://spacevim.org/documentation/#concepts

Shawn
- 26
- 3
-
In the documentation I read that remapping jk to escape should be the default. https://spacevim.org/documentation/ Why is this not the case when I actually install it? – Joop Jan 01 '22 at 07:38
-
1I found that the default behaviour to remap jk to escape could be disabled if the option `vimcompatible = true` is set. Changing it to `false` fixed the issue for me. I do not know what other side-effects it causes though. – Joop Jan 01 '22 at 07:43