Vim
Vim copied to clipboard
Shift+o doesn't respect indentation setting (when using Autoindent)
Describe the bug My indentation is set to spaces. When using o to add a new line below the cursor, it starts indented with spaces but when pressing O (Shift+o) to add a line above the cursor, it sometimes uses tabs instead.
To Reproduce Steps to reproduce the behavior:
- Open a new file in VS Code, set indentation to spaces, enable "Vim: Autoindent", and use the following text:
def test():
····print("test")
····return
- Go to line 3.
- If I press o, a new line begins below the cursor and inserts spaces:
def test():
····print("test")
····|
····return
- If I press Shift+o instead, a new line begins above the cursor and inserts tabs:
def test():
→ |
····print("test")
····return
Expected behavior Respect the indentation setting in all cases.
Screenshots
Environment (please complete the following information):
- Extension (VsCodeVim) version: v1.26.0
- VSCode version: v1.83.0
- OS: Windows 10
Additional context n/a
I don't think I am able to reproduce this on 1.26.2.
If I use Shift+o it seems to do the behavior you suggest, but it is hard to say because the way VSCode deletes indentation. For example, if you open a new line, press space 8 times, then press backspace it will delete 4 spaces (depending on your settings). So it simulates deleting a 'tabwidth' even if you just typed in spaces.
If I am on a closing brace, and type shift-o
it doesn't create the indentation for the code block just above. This is also true anywhere on the line where the closing brace is.