t9md / atom-vim-mode-plus

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

[small bug] Pressing `%` while peyond last character of a line doesn't detect matching brace like in Vim/NeoVim. #1074

Open trusktr opened 6 years ago

trusktr commented 6 years ago

There's one small issue that trips me up:

Suppose that we have the following code, and note the position of the white cursor (screenshot of Vim):

screen shot 2018-05-27 at 10 22 59 pm

Now suppose we press v to enter visual line mode, then we press $ to go to the end of the line so that we have the following selection:

screen shot 2018-05-27 at 10 24 09 pm

Note that the cursor is now after the { character of the first line.

I would now like to press % to go to the matching } character.

Expected:

In Vim, pressing % will detect the { character that is in front of the cursor and take us to the matching } character, which looks like this:

screen shot 2018-05-27 at 10 26 02 pm

Actual:

In Atom with vim-mode-plus, pressing % will not work, the cursor will stay in place. Starting with the cursor in the same place, here is a screenshot after pressing v$%:

screen shot 2018-05-27 at 10 27 12 pm

As you can tell, only the first line is highlighted because vim-mode-plus did not move to the matching } character.


It would be great to be anywhere on a line, and to be able to type V$% to highlight an entire block.

This works great in Vim/NeoVim, but doesn't work in vim-mode-plus at the moment.


debug info with package info ```json { "atom": "1.27.1", "platform": "darwin", "release": "17.5.0", "vmpVersion": "1.32.0", "vmpConfig": { "automaticallyEscapeInsertModeOnActivePaneItemChange": true, "keymapYToYankToLastCharacterOfLine": true, "wrapLeftRightMotion": true, "blackholeRegisteredOperators": [], "startInInsertModeScopes": [], "charactersToAddSpaceOnSurround": [], "highlightSearchExcludeScopes": [], "flashOnOperateBlacklist": [] }, "activeCommunityPackages": [ "atom-material-syntax: 1.0.8", "atom-vim-like-tab: 1.5.1", "hey-pane: 1.1.0", "highlight-line: 0.12.0", "highlight-selected: 0.13.1", "keystroke: 0.4.0", "minimap: 4.29.8", "minimap-highlight-selected: 4.6.1", "minimap-quick-highlight: 1.0.1", "one-tab: 0.10.0", "quick-highlight: 0.13.0", "teletype: 0.13.2", "vim-mode-plus: 1.32.0", "vim-mode-plus-keymaps-for-surround: 0.2.1", "language-pug: 0.0.22", "platformio-ide-terminal: 2.8.1" ] } ```
trusktr commented 6 years ago

As a workaround, I added this to my keymaps:

'.editor.vim-mode-plus.visual-mode':
    '$': 'keystroke $ h'

So that it moves one character back, then pressin % works. I also have this same setting in Vim, so it is nice. :)