Vim: Bug: Mac OS Multiple Line Highlight and Tab to Indent Fails

Created on 3 Nov 2017  路  6Comments  路  Source: VSCodeVim/Vim

Highlighting multiple lines and then hitting tab to indent does not work. Using shift-tab to undent (de-indent?) - works as expected.

VSCode Version: 1.17.2
OS Version: mac OS sierra - 10.12.6

Steps to Reproduce:

highlight multiple lines
click tab - no effect
if pre-indented - shift-tab works as expected
Extensions:
vscodevim - 0.10.2
donjayamanne.python 0.7.0
esbenp.prettier-vscode 0.24.0
PeterJausovec.vscode-docker 0.0.20
ms-vscode.azure-account 0.1.3

Reproduces without extensions: No

Works as expected without the extensions...

Buggy capture - imagine tab being hit where nothing happens...

indent-undent-bug

Most helpful comment

Possible solution. In "settings.json":

```
"vim.visualModeKeyBindingsNonRecursive": [
{
"before": [""],
"after": [ ">","g","v" ],
},
{
"before": [""],
"after": [ "<","g","v" ],
},
],

"vim.normalModeKeyBindingsNonRecursive": [
{
"before": [""],
"after": [ ">",">" ],
},
{
"before": [""],
"after": [ "<","<" ],
}
],
```

All 6 comments

In Vim, the Tab key only adds an indent in Insert mode. The Tab key has no effect in Visual mode. Instead, the > and < keys are used to indent and unindent a block in Visual mode, respectively.

While this may not be a bug, it could be a valid feature request.

Interesting - without the extension enabled vscode will indent on a multi-line highlight.

Please consider this a feature request! (thanks for the < > tip)

Just tried the < > keys - it loses the highlight after a single tap.. not working as I'd prefer there either.

I really want this feature.

It may not be the expected behavior in Vim, but is inconsistent that Shift-Tab works to reduce indentation, but Tab does not work to increase the indentation. It should at least be consistent in that regard.

Also, I now tried the < and > to decrease and increase indentation, as suggested by @westim above, but although it works, it does not preserve the visual mode selection, so it does not work to continue altering the indentation by pressing the key more than once.

Possible solution. In "settings.json":

```
"vim.visualModeKeyBindingsNonRecursive": [
{
"before": [""],
"after": [ ">","g","v" ],
},
{
"before": [""],
"after": [ "<","g","v" ],
},
],

"vim.normalModeKeyBindingsNonRecursive": [
{
"before": [""],
"after": [ ">",">" ],
},
{
"before": [""],
"after": [ "<","<" ],
}
],
```

I can confirm that @pablospe's workaround above works like a charm. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cckowin picture cckowin  路  3Comments

gerardmrk picture gerardmrk  路  3Comments

rajinder-yadav picture rajinder-yadav  路  3Comments

stefanoio picture stefanoio  路  3Comments

AndersenJ picture AndersenJ  路  3Comments