Alex
Alex

Reputation: 1728

disable vscode change tab on 'gt'

I use VIM extension in VSCode. One of my favourite commands is to use gt<character> (ie: 'gtc' to jump to the nearest 'c' character) to jump to a specific character. In a recent update, when I press "gt", VSCode changes tab rather than allowing me to complete my vim command. Does anyone know how to disable this behaviour? Is it coming from VSCode or the VIM extension?

Upvotes: 0

Views: 922

Answers (2)

miscreant
miscreant

Reputation: 621

If you're using VSCodeVim, their GitHub page has examples for things like this. Simply edit your settings.json to remap "g,t" to "f" in normal mode:

"vim.normalModeKeyBindingsNonRecursive": [
    { "before": ["g", "t"], "after": ["f"], },
]

You may or may not want to do the same for "vim.visualModeKeyBindings" if you use it while making selections as well.

Upvotes: 0

isAif
isAif

Reputation: 2364

In vim gt is used to go to next tab and gT is used to go to previous tab. As vscode vim implements the functionality of vim, you can expect the same behaviour in Vscode if you are using the the vim plugin.

The feature you are looking for can be accomplished by f i.e. to go to next c character press fc.

You can use ; to cycle forward in the direction of the search and , to cyle opposite to direction of the search. For example, ; goes to next occurrence of same character in the line and , goes to previous occurrence.

Then there is F to go to previous occurrence of a character. Here the direction of search is backwards, therefore ; goes to previous occurrence of same character in the line and , goes to next occurrence.

Upvotes: 4

Related Questions