Vim icon indicating copy to clipboard operation
Vim copied to clipboard

incorrect indent with `O`

Open isudfv opened this issue 2 years ago • 3 comments

Describe the bug O should insert a line above current place and the indent should be the same as other lines. It works well inside a block, but one tab less when O is pressed at the end of the block.

Strangely, there is a flash before the cursor goes to the wrong place.

To Reproduce Steps to reproduce the behavior:

动画

And the indent is correct using Ctrl + Shift + Enter without vim

动画2

  • Extension (VsCodeVim) version: v1.22.2
  • VSCode version: 1.64.2
  • OS: Windows 10

isudfv avatar Mar 09 '22 10:03 isudfv

Note that vscodevim is following vanilla vim for Shift-O, I guess: vim_20220309_1934

On the other hand, for o vanilla vim also only opens a new line without indentation ... vim_20220309_1950

For workaround, consider to just use the keystrokes ko to move the cursor the the line above the closing bracket and then open a line (i.e., just don't use Shift-O). Also, Shift-O can be remapped (maybe to ko, or to Ctrl-Shift-Enter).

There was a recent fix for this just added: https://github.com/VSCodeVim/Vim/pull/7424 I would say the logic of the PR was that both o and Shift-o should keep the indentation of the current line.

northernocean avatar Mar 10 '22 01:03 northernocean

It works fine on 1.21.10

quietw0lf avatar Mar 27 '22 13:03 quietw0lf

it still does not work on 1.23.1

quietw0lf avatar Jul 18 '22 03:07 quietw0lf

This issue still exists. Using ko for now.

0xtimsb avatar Aug 17 '23 03:08 0xtimsb

it still does not work on 1.25.2

antct avatar Aug 21 '23 09:08 antct

dirty fix

{
  "before": ["O"],
  "commands": ["editor.action.insertLineBefore"],
  "after": ["i"]
},

not using ko since it wont work on the top of the file

qazxcdswe123 avatar Sep 06 '23 07:09 qazxcdswe123