diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index fbb361e68..1edbd1f42 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -136,6 +136,25 @@ let g:spacevim_home_files_number = 6 " < let g:spacevim_enable_guicolors = 0 +"" +" @section escape_key_binding, options-escape_key_binding +" @parentsection options +" Set the key binding for switch to normal mode in insert mode. +" Default is `jk`, to disable this key binding, set this option to empty +" string. +" > +" escape_key_binding = 'jk' +" < + +"" +" Set the key binding for switch to normal mode in insert mode. +" Default is `jk`, to disable this key binding, set this option to empty +" string. +" > +" let g:spacevim_escape_key_binding = 'jk' +" < +let g:spacevim_escape_key_binding = 'jk' + "" " @section enable_googlesuggest, options-enable_googlesuggest " @parentsection options @@ -1195,6 +1214,11 @@ function! SpaceVim#end() abort cnoremap <C-b> <Left> " @bug_vim with <silent> command line can not be cleared cnoremap <expr> <C-k> repeat('<Delete>', strchars(getcmdline()) - getcmdpos() + 1) + + "Use escape_key_binding switch to normal mode + if !empty(g:spacevim_escape_key_binding) + exe printf('inoremap %s <esc>', g:spacevim_escape_key_binding) + endif endif call SpaceVim#server#connect() diff --git a/autoload/SpaceVim/default.vim b/autoload/SpaceVim/default.vim index f49d28008..e3b9e58d2 100644 --- a/autoload/SpaceVim/default.vim +++ b/autoload/SpaceVim/default.vim @@ -209,9 +209,6 @@ function! SpaceVim#default#keyBindings() abort nnoremap <silent><C-Down> :<C-u>wincmd j<CR> - "Use jk switch to normal mode - inoremap jk <esc> - "]<End> or ]<Home> move current line to the end or the begin of current buffer nnoremap <silent>]<End> ddGp`` nnoremap <silent>]<Home> ddggP`` diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 95de60424..28342b532 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -43,32 +43,33 @@ CONTENTS *SpaceVim-contents* 23. enable_vimfiler_welcome...|SpaceVim-options-enable_vimfiler_welcome| 24. enable_ycm.............................|SpaceVim-options-enable_ycm| 25. error_symbol.........................|SpaceVim-options-error_symbol| - 26. filemanager...........................|SpaceVim-options-filemanager| - 27. filetree_direction.............|SpaceVim-options-filetree_direction| - 28. guifont...................................|SpaceVim-options-guifont| - 29. home_files_number...............|SpaceVim-options-home_files_number| - 30. info_symbol...........................|SpaceVim-options-info_symbol| - 31. keep_server_alive...............|SpaceVim-options-keep_server_alive| - 32. language.................................|SpaceVim-options-language| - 33. lint_on_the_fly...................|SpaceVim-options-lint_on_the_fly| - 34. max_column.............................|SpaceVim-options-max_column| - 35. plugin_bundle_dir...............|SpaceVim-options-plugin_bundle_dir| - 36. plugin_manager_processes.|SpaceVim-options-plugin_manager_processes| - 37. realtime_leader_guide.......|SpaceVim-options-realtime_leader_guide| - 38. relativenumber.....................|SpaceVim-options-relativenumber| - 39. retry_cnt...............................|SpaceVim-options-retry_cnt| - 40. sidebar_width.......................|SpaceVim-options-sidebar_width| - 41. snippet_engine.....................|SpaceVim-options-snippet_engine| - 42. statusline_iseparator.......|SpaceVim-options-statusline_iseparator| - 43. statusline_left_sections.|SpaceVim-options-statusline_left_sections| - 44. statusline_separator.........|SpaceVim-options-statusline_separator| - 45. terminal_cursor_shape.......|SpaceVim-options-terminal_cursor_shape| - 46. vim_help_language...............|SpaceVim-options-vim_help_language| - 47. vimcompatible.......................|SpaceVim-options-vimcompatible| - 48. warning_symbol.....................|SpaceVim-options-warning_symbol| - 49. windows_index_type.............|SpaceVim-options-windows_index_type| - 50. windows_leader.....................|SpaceVim-options-windows_leader| - 51. windows_smartclose.............|SpaceVim-options-windows_smartclose| + 26. escape_key_binding.............|SpaceVim-options-escape_key_binding| + 27. filemanager...........................|SpaceVim-options-filemanager| + 28. filetree_direction.............|SpaceVim-options-filetree_direction| + 29. guifont...................................|SpaceVim-options-guifont| + 30. home_files_number...............|SpaceVim-options-home_files_number| + 31. info_symbol...........................|SpaceVim-options-info_symbol| + 32. keep_server_alive...............|SpaceVim-options-keep_server_alive| + 33. language.................................|SpaceVim-options-language| + 34. lint_on_the_fly...................|SpaceVim-options-lint_on_the_fly| + 35. max_column.............................|SpaceVim-options-max_column| + 36. plugin_bundle_dir...............|SpaceVim-options-plugin_bundle_dir| + 37. plugin_manager_processes.|SpaceVim-options-plugin_manager_processes| + 38. realtime_leader_guide.......|SpaceVim-options-realtime_leader_guide| + 39. relativenumber.....................|SpaceVim-options-relativenumber| + 40. retry_cnt...............................|SpaceVim-options-retry_cnt| + 41. sidebar_width.......................|SpaceVim-options-sidebar_width| + 42. snippet_engine.....................|SpaceVim-options-snippet_engine| + 43. statusline_iseparator.......|SpaceVim-options-statusline_iseparator| + 44. statusline_left_sections.|SpaceVim-options-statusline_left_sections| + 45. statusline_separator.........|SpaceVim-options-statusline_separator| + 46. terminal_cursor_shape.......|SpaceVim-options-terminal_cursor_shape| + 47. vim_help_language...............|SpaceVim-options-vim_help_language| + 48. vimcompatible.......................|SpaceVim-options-vimcompatible| + 49. warning_symbol.....................|SpaceVim-options-warning_symbol| + 50. windows_index_type.............|SpaceVim-options-windows_index_type| + 51. windows_leader.....................|SpaceVim-options-windows_leader| + 52. windows_smartclose.............|SpaceVim-options-windows_smartclose| 3. Configuration...........................................|SpaceVim-config| 4. Commands..............................................|SpaceVim-commands| 5. Functions............................................|SpaceVim-functions| @@ -418,6 +419,15 @@ Set the error symbol for SpaceVim's syntax maker. Default is '✖'. error_symbol = "+" < +============================================================================== +ESCAPE_KEY_BINDING *SpaceVim-options-escape_key_binding* + +Set the key binding for switch to normal mode in insert mode. Default is `jk`, +to disable this key binding, set this option to empty string. +> + escape_key_binding = 'jk' +< + ============================================================================== FILEMANAGER *SpaceVim-options-filemanager* @@ -715,6 +725,13 @@ Enable true color support in terminal. Default is 0. let g:spacevim_enable_guicolors = 1 < + *g:spacevim_escape_key_binding* +Set the key binding for switch to normal mode in insert mode. Default is `jk`, +to disable this key binding, set this option to empty string. +> + let g:spacevim_escape_key_binding = 'jk' +< + *g:spacevim_enable_googlesuggest* Enable/Disable Google suggestions for neocomplete. Default is 0. > diff --git a/docs/documentation.md b/docs/documentation.md index bb8b3a426..99b3130ef 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -325,6 +325,12 @@ The different key bindings between SpaceVim and origin vim are shown as below. windows_smartclose = '' ``` +- The `jk` key has been mapped to `<Esc>` in insert mode. To disable this key binding, set `escape_key_binding` to empty string. + ```toml + [options] + escape_key_binding = '' + ``` + - The `Ctrl-a` binding on the command line can auto-complete variable names, but in SpaceVim it moves to the cursor to the beginning of the command line. - The `Ctrl-b` binding on the command line is mapped to `<Left>`, which will move cursor to the left. - The `Ctrl-f` binding on the command line is mapped to `<Right>`, which will move cursor to the right.