visual-studio-codevscodevim

VS Code How to Jump OUT of a bracket


In the middle of a pair of brackets, I want to move the cursor OUT of the bracket. That is

(This is some| text) --> (This is some text)|

I notice that there is a Go to Bracket command which moves the cursor TO the bracket, i.e.,

(This is some| text) --> (This is some text|)

In this simple example, simply chaining this command with a TabOut would do the trick. However, in some more complicated examples (like \left(\right) in LaTeX), TabOut will not work.

Also, Vim command ]% will solve the problem; but it doesn't work in VS Code.


Edit: the plugin pointed out by @rioV8 is very helpful. However, the simple regex moves after the next bracket, instead of moving out of the current scope. Consider a more complicated example:

# vim command ]%a
(This |is {some} text) -> (This is {some} text)|

# Select By plugin
(This |is {some} text) -> (This is {some}| text)

Solution

  • You can use the extension Select By

    Define the following key binding:

      {
        "key": "ctrl+f6",  // or any other key combo
        "when": "editorTextFocus",
        "command": "moveby.regex",
        "args": {
          "regex": "\\)",
          "properties": ["next", "end"]
        }
      }