inkdropapp / inkdrop-vim

Provides Vim modal control for Inkdrop, blending the best of Vim and Inkdrop
https://www.inkdrop.app/
MIT License
101 stars 9 forks source link

How to unmap default keybinds #19

Closed oniatsu closed 4 years ago

oniatsu commented 4 years ago

Is there any way of unmapping dafault keybinds?

I want to fix confliction of default keybinds.

For example, a substitution command s works so late, because there are some 2 stroke keybinds starting from s. https://github.com/inkdropapp/inkdrop-vim/blob/master/keymaps/vim.json#L130 https://github.com/inkdropapp/inkdrop-vim/blob/master/keymaps/vim.json#L5-L6

The delay makes s command unuseful.

If a developping the unmapping way is difficult, I think these s x keybinds should be removed from default. https://github.com/inkdropapp/inkdrop-vim/blob/master/keymaps/vim.json#L5-L6

craftzdog commented 4 years ago

You can set falsy value to the keystrokes which you wish to unbind in your keymap.cson like so:

".CodeMirror.vim-mode.normal-mode textarea":
  "s h": false
  "s k": false
oniatsu commented 4 years ago

Thanks! But the problem is not solved.

For example, I set some preferences on keyconfig.cson to make every keystrokes starting with s invalid.

".CodeMirror.vim-mode.normal-mode textarea":
  "s h": false
  "s k": false
".sidebar-menu":
  "s l": false
".sidebar-book-filter-menu":
  "s l": false
".note-list-bar":
  "s l": false
  "s h": false
".mde-preview":
  "s h": false
  "s k": false

I typed s h on a main textarea on vim normal mode, then nothing happened. An expected action is replacing a string at cursor to h, because s means substitution action.

Probably, that is because the s h keybind is still valid.

craftzdog commented 4 years ago

Will reply next week

On Fri, Jun 19, 2020 at 19:48 oniatsu notifications@github.com wrote:

Thanks! But the problem is not solved.

For example, I set some preferences on keyconfig.cson to make every keystrokes starting with s invalid.

".CodeMirror.vim-mode.normal-mode textarea": "s h": false "s k": false".sidebar-menu": "s l": false".sidebar-book-filter-menu": "s l": false".note-list-bar": "s l": false "s h": false".mde-preview": "s h": false "s k": false

I typed s h on a main textarea on vim normal mode, then nothing happend. An expected action is replacing a string at cursor to h, because s means substitution action.

Probably, that is why the s h keybind is still valid.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/inkdropapp/inkdrop-vim/issues/19#issuecomment-646569453, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKFMRLSKBLE37T3C2TJDPTRXM657ANCNFSM4OBO35BA .

craftzdog commented 4 years ago

That makes sense. So s h is bound as 'do nothing' and not actually canceling the keybinding. Well, since those keybindings mess the existing default vim behavior, I will remove them.

craftzdog commented 4 years ago

Landed in v2.1.2🎉

oniatsu commented 4 years ago

That works well! Thank you.