t9md / atom-vim-mode-plus

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

ci{ ci( and ci[ don't work outside brackets, but ci' and ci" work #949

Closed turnspike closed 6 years ago

turnspike commented 6 years ago

:clipboard: Check list

Platform: Macos 10.12.6
Atom    : 1.22.0
Electron: 1.6.15
Chrome  : 56.0.2924.87
Node    : 7.4.0

vim-mode is not installed.

:eyes: Observed behavior

ci' and ci" work great ci{ ci( and ci[ don't work at all if cursor is outside brackets

:ok_hand: Works:

<cursor>myFunction("parameter")    # normal mode
ci"
myFunction("<cursor>")    # insert mode
myFunction("par<cursor>ameter")    # normal mode
ci(
myFunction(<cursor>)    # insert mode
<cursor>myFunction("parameter")    # normal mode
f(ci)
myFunction(<cursor>)    # insert mode

:sob: Doesn't work:

<cursor>myFunction("parameter")    # normal mode
ci(
# expected: myFunction(<cursor>)    # insert mode
# actual: <cursor>myFunction("parameter")    # insert mode

According to the Keybinding-Resolver it is hitting "inner-parenthesis" but it is not changing the content. Screenshot attached. error

I've also tried rm -rf ~/.atom and installing just vim-mode-plus and I get the same issue.

:pray: Why it's important to me

I work with Ruby a lot and this issue totally kills my VIM workflow.

turnspike commented 6 years ago

I tried this workaround:

'atom-text-editor.vim-mode-plus.normal-mode':

  'c i (': 'keystroke f ) c i )'
  'c i <': 'keystroke f > c i >'
  'c i {': 'keystroke f } c i }'

It fires the keystrokes but the cursor still doesn't change position. However pressing eg f)ci) works fine.

t9md commented 6 years ago

You cannot find forwading inner-pair, it only can find enclosed pair. So what you are trying is non-supported in pure-Vim and vmp's normal i).

But vmp have enhanced command named inner-pair-allow-forwarding.

Find example keymap from my dotfiles. https://github.com/t9md/dotfiles

turnspike commented 6 years ago

@t9md you're right, I just tried it in vanilla Vim and it doesn't work. Thank you very much, I will look into inner-pair-allow-forwarding. And cheers for the awesome Atom plugin.