VSCodeVim / VSCodeVim/Vim

Shift+o doesn't respect indentation setting (when using Autoindent)

Open
#8,651 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

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:

  1. Open a new file in VS Code, set indentation to spaces, enable "Vim: Autoindent", and use the following text:
def test():

····print("test")

····return
  1. Go to line 3.
  2. If I press o, a new line begins below the cursor and inserts spaces:
def test():

····print("test")
····|

····return
  1. 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in VS Code with VSCodeVim using the Python example, spaces indentation, and Vim: Autoindent enabled. Compare the behavior of o and Shift+o, then trace their key handling and verify that both insert the new line using the configured indentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.