"imap jj <Esc>" not working
haifengkao opened this issue · 3 comments
Check if applicable
- I have searched the existing issues (required)
- I reproduced the issue with an empty Neovim configuration (
init.vim
orinit.lua
) - I'm willing to help fix the problem and contribute a pull request
Describe the bug
imap jj <Esc>
in init.vim not working at all.
neovim can correctly jump to normal mode by jj
.
but the setting isn't effective with ShadowVim
How to reproduce?
- open any file in xcode
- type
jj
to switch to normal mode jj
shows on the screen which is not expected
Neovim configuration
imap jj <Esc>
Environment
ShadowVim 0.2.0 (3)
$ sw_vers -productVersion
13.0.1
$ uname -m
arm64
$ whereis nvim
nvim: /opt/homebrew/bin/nvim /opt/homebrew/share/man/man1/nvim.1
$ nvim --version
NVIM v0.9.0
Build type: Release
LuaJIT 2.1.0-beta3
系統 vimrc 設定檔: "$VIM/sysinit.vim"
$VIM 預設值: "/opt/homebrew/Cellar/neovim/0.9.0/share/nvim"
Run :checkhealth for more info
$ xcodebuild -version
Xcode 14.1
Build version 14B47b
$ defaults read -app Xcode KeyBindingsMode
Default
$ defaults read -app Xcode DVTTextAutoCloseBlockComment
exit status: 1
$ defaults read -app Xcode DVTTextAutoInsertCloseBrace
exit status: 1
$ defaults read -app Xcode DVTTextEditorTrimTrailingWhitespace
exit status: 1
$ defaults read -app Xcode DVTTextEnableTypeOverCompletions
exit status: 1
$ defaults read -app Xcode DVTTextIndentCaseInC
exit status: 1
$ defaults read -app Xcode DVTTextUsesSyntaxAwareIndenting
exit status: 1
That's expected, because the Insert mode since 0.2.0 is handled by Xcode, so the imap
bindings are not triggered.
But I know that the imap jk <Esc>
binding is really popular so I think I will implement the imap
support directly in ShadowVim at some point. However I have plenty of other subjects to tackle first (e.g. :
prompt) so I don't know when it will be supported.
Personally I use the Caps-lock key as an alternative to Esc
, thanks to Karabiner Elements. But if you really can't live without imap
, you can add this autocmd
in your Neovim config:
autocmd InsertEnter * SVSetInputNvim
This will let Neovim handle all keyboard events, even in Insert mode. This is not recommended though, as it might mess up Xcode's auto-completion and indentation as well as typing performance.
By the way are you using Chinese characters in your source code? I'm afraid there might be some issues because I'm not entirely sure the character ranges from Neovim are compatible with the ones from Xcode's Accessibility API.
Thanks.