t9md / atom-keystroke

define multi keystroke commands easily
https://atom.io/packages/keystroke
MIT License
17 stars 2 forks source link

`i` to enter insert mode is not working #2

Closed zhaocai closed 8 years ago

zhaocai commented 8 years ago

The following keystroke intends to insert white-space without leaving normal-mode. But it is not working. I guess it is related to i to enter insert mode.

'atom-text-editor.vim-mode-plus.normal-mode':
  'shift-space': 'keystroke:insert-space'
{
  name: "insert-space"
  keystroke: "i space escape l"
  scope: "atom-text-editor.vim-mode-plus.normal-mode"
}
t9md commented 8 years ago

Basically you can not use key which is not directly mapped to some command(like space in insert-mode which directly insert text).

I don't know it's technically fixable or not.

zhaocai commented 8 years ago

Thanks for the info.

zhaocai commented 8 years ago

Issue in one sentence

How to reset/remove the hovering pending count with a function or command?

Objective

Insert activeVimState.getCount() whitespaces without leaving normal mode.

### init.coffee 
# same code from your dotfiles
getActiveVimState = ->
  getEditorState(getEditor())
###

insertWhitespace = ->
  return unless editor = atom.workspace.getActiveTextEditor()
  v = getActiveVimState()
  space = ' '
  if v.hasCount()
    space = Array(v.getCount() + 1).join space
    atom.commands.dispatch('atom-text-editor.vim-mode-plus', 'vim-mode-plus:reset-normal-mode')
  editor.insertText(space)

Problem

Can not find a way to reset/remove the hovering pending count.

pending-count

Tested Methods

t9md commented 8 years ago

Havent't investigated yet, from what you want to do. Itms straight forward to create operator to insert space which take number of spaces from count you specify. Vmp's wiki section have instruction for vmp plugin.

t9md commented 8 years ago

this is example

https://github.com/t9md/atom-vim-mode-plus/wiki/Extend-vmp-in-init-file#basic-insertspaces-operator-which-insert-specified-count-of-spaces

zhaocai commented 8 years ago

Thank you 😀 That is extremely helpful.