Vscode: how to jump over symbol?

Created on 26 Jun 2016  路  14Comments  路  Source: microsoft/vscode

  • VSCode Version: 1.2.1
  • OS Version: fedora 21

Steps to Reproduce:



    1. 2.

how to jump over symbol? like bracket, quotation

editor feature-request

Most helpful comment

What the OP means is the ability to jump out/over the closing character (", ', ), ], }).

Try
var test = [{'key1': "value1", 'key2': "value2"}];
right arrow is the only way to jump over the closing character.
I'd like a more convenient key (or ability to define a more convenient key) to do that.

All major editors offer this ability:
Atom (http://stackoverflow.com/questions/30274597/jump-over-end-parenthesis-bracket-quotation-in-atom-editor-with-tab)
Sublime (via key bindings)
Brackets (via tab-out plugin)

there is already an extension
https://github.com/albertromkes/tabout
seems to work great but conflicts with code snippet code stops.
It would be nice to be able to define a different key or key combination.

All 14 comments

@alexandrudima assuming he is talking about word navigation in the editor.

what ?

@Luncher I am sorry I don't understand what you mean. Can you please explain more specifically your question?

@alexandrudima thanks for you reply.
I mean when i input brackets auto completed, then enter other characters. When I entered the end , how the cursor out of the brackets it ?

input:
(abc + tab

I hope to achieve:

(abc) cursor here

I think that the question here is: After entering a symbol that is a part of opening/closing symbols pair (opening/closing bracket, quotation marks, etc.), and with the autoComplete option on, which button to use to get your cursor out of that symbol pair. Eg. you enter an opening bracket, the closing bracket gets autocompleted, but your cursor stays between them. Which button will let you move the cursor to the right of the closing bracket.
For now, that's only the right arrow I think. @Luncher is saying that it should be possible with tab button. It would be great in my opinion, just like in Visual Studio. I'm pretty surprised it isn't available in VSCode, maybe I just didn't find it...

What the OP means is the ability to jump out/over the closing character (", ', ), ], }).

Try
var test = [{'key1': "value1", 'key2': "value2"}];
right arrow is the only way to jump over the closing character.
I'd like a more convenient key (or ability to define a more convenient key) to do that.

All major editors offer this ability:
Atom (http://stackoverflow.com/questions/30274597/jump-over-end-parenthesis-bracket-quotation-in-atom-editor-with-tab)
Sublime (via key bindings)
Brackets (via tab-out plugin)

there is already an extension
https://github.com/albertromkes/tabout
seems to work great but conflicts with code snippet code stops.
It would be nice to be able to define a different key or key combination.

The mentioned TabOut extension also suffers from being a tab-in instead of only a tab-out. This interferes with actually trying to tab space your code. So if you are at the start of a line that begins with a quote, instead of adding a tab space, it brings you into the quote.

@cjr8020 You are the sole master of the keyboard shortcuts :). You can change any keybinding you wish. e.g.:

{ "command": "-tabout" },
{ "key": "ctrl+t", "command": "-tabout" }

If it helps, you can use ctrl + F to substitute the right arrow key in any situation without editing the init Script.

I tried TabOut but remapping it to some other command such as ctrl+t to avoid breaking snippet expansion it's basically the same as just hitting ctrl+f. So basically I used the same approach I was using in Sublime to solve this with the following key bindings:

  {
    "key": "shift+'",
    "command": "editor.action.insertSnippet",
    "when": "editorTextFocus",
    "args": { "snippet": "\"$1\"$0" }
  },
  {
    "key": "`",
    "command": "editor.action.insertSnippet",
    "when": "editorTextFocus",
    "args": { "snippet": "`$1`$0" }
  },
  {
    "key": "shift+9",
    "command": "editor.action.insertSnippet",
    "when": "editorTextFocus",
    "args": { "snippet": "($1)$0" }
  },
  {
    "key": "[",
    "command": "editor.action.insertSnippet",
    "when": "editorTextFocus",
    "args": { "snippet": "[$1]$0" }
  },
  {
    "key": "shift+[",
    "command": "editor.action.insertSnippet",
    "when": "editorTextFocus",
    "args": { "snippet": "{$1}$0" }
  }

+1

This is pretty much the last thing keeping me from jumping over.

+1

This might be a solution without installing extensions. Not sure if this solves the problem completely but I'm satisfied with it.

"Preferences" -> "Keyboard Shortcuts" -> "cursorRight" -> "^ F" (ctrl+F on Mac).

The default key binding could be changed at your wish. This only moves the cursor right one character so it only works for one pair of symbols.

As this is solvable via keybinding customization, I will close the issue for now.

Was this page helpful?
0 / 5 - 0 ratings