how to map 'Esc' key to 'jk' in spacevim

1.2k Views Asked by At

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?

1

There are 1 best solutions below

2
On BEST ANSWER

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