t9md / atom-vim-mode-plus

vim-mode improved
https://atom.io/packages/vim-mode-plus
MIT License
1.4k stars 112 forks source link

`ci"<space>` not working on US Intl with dead keys #668

Open iurimadeira opened 7 years ago

iurimadeira commented 7 years ago

I'm using an US international keyboard with dead keys. When trying to do a ci"<space> or ci'<space>, nothing happens. It does with Vim, but not with Atom vim-mode-plus.

t9md commented 7 years ago

What's dead-key? In normal case only c i ' change inner-single-quote. Why you need extra space key? How is the result when you invoke inner-quotes from command palette after c enter operator-pending mode?

iurimadeira commented 7 years ago

Dead keys are the ones that don't have any character immediately printed when pressed. They are mainly used in layouts that have accents in letters, like é or ã. I'm brazilian, by the way.

In this layout, to have an é printed, you have to press the ', then e. To have only ', you have to press ', then <space>.

It does work if I invoke the quotes from command palette.

PaulPorfiroff commented 7 years ago

@iurimadeira, it's likely to be an issue with atom-keymap, which handles keybindings.

An easy way to see how Atom recognizes your keystrokes is executing key-binding-resolver:toggle command from Command Palette. Then call any command, bound to keysym, emitted using dead key. To keep things fair, you may also want to disable vim-mode-plus package beforehand.

Put something like this to your keymap:

'atom-workspace':
  '\'': 'command-palette:toggle'

This should also work in insert mode of vim-mode-plus (in case you haven't disabled it).

What's the resolver's output for ' space in this case?

PaulPorfiroff commented 7 years ago

Oh, by the way, what OS do you use? It seems like dead keys are currently can't be used in keybindings under Windows.

dos5gw-dev commented 7 years ago

It seems Atom now recognizes this keystroke sequence [ ' ] then [ A ] as ( á ), but it still not working in vim-mode-plus keybinding resolver show the sequence as ( á ). It also register and show 'DEAD' when [ ' ] is pressed. also, it does't work in Vim or gVim without remaping, but it does in NeoVim We write double quote marks with [shift]+[ ' ] then [ space ] and maybe it would be more difficult because in NeoVim, without touch the config. It can be only written with [ shift ]+[ ' ] and then [ ' ] again to put two double quote marks and then delete one of them with [ backspace ]

t9md commented 7 years ago

I think I'm not understanding situation correctly. I don't have experience to type á with two keystroke.

Anyway, when default keymap doesn't work, general way to solve issue is set keymap manually on your keymap.cson with keymap observed via keybinding-resolver.

So typical steps to do tjat is...

  1. Start keybinding-resolver.
  2. Observe how Atom recognize your keystroke.
  3. Define keymap to your keymap.cson using keystroke you observed in step2.

E.g. Bellow is default keymap definition for inner-single-quote. If it's not work, what you can do is replace i ' part with keystroke which you can type easily and Atom can recognize(find this through keybinding-resolver).

'atom-text-editor.vim-mode-plus.operator-pending-mode, atom-text-editor.vim-mode-plus.visual-mode':
  "i '": 'vim-mode-plus:inner-single-quote'
t9md commented 6 years ago

This comment might be help too. https://github.com/t9md/atom-vim-mode-plus/issues/661#issuecomment-347004839