# vim: Respect auto_indent setting in o/O commands \(\#53620\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/bcf4c71fdbfefcb853fd3e64cb8d1ae3daf90821)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: bcf4c71fdbfefcb853fd3e64cb8d1ae3daf90821

Requested commit: bcf4c71fdbfefcb853fd3e64cb8d1ae3daf90821

Commit: bcf4c71fdbfefcb853fd3e64cb8d1ae3daf90821

Tree: a2a98ad89e11cf4e5548d970b6e248adb37b0958

Author: David Alecrim

Committer: GitHub

## Message

```
vim: Respect auto_indent setting in o/O commands (#53620)

## Summary

Closes #53570

- `o` and `O` in normal mode were unconditionally copying the current
line's indentation into the new line, ignoring the `auto_indent` setting
entirely
- When `auto_indent: "none"` is set, new lines created by `o`/`O` now
start at column 0 as expected
- When `auto_indent` is `preserve_indent` or `syntax_aware`, behavior is
unchanged

The fix reads `language_settings_at` for the relevant row and splits
edits into two paths: `editor.edit()` (no autoindent) for `None`, and
`editor.edit_with_autoindent()` for everything else — mirroring the
approach already used by the non-vim `Newline` action.

## Test plan

- Added `test_o_auto_indent_none`: verifies `o`/`O` produce column-0
lines with `auto_indent: "none"`, including edge cases (first line,
empty line)
- Added `test_o_preserve_indent`: verifies `o`/`O` copy the current
line's indentation with `auto_indent: "preserve_indent"` (regression
guard)
- Existing neovim-backed tests (`test_o`, `test_insert_line_above`,
`test_o_comment`) continue to pass

Release Notes:

- Fixed vim `o`/`O` commands ignoring the `auto_indent: "none"` setting,
causing new lines to inherit indentation instead of starting at column 0
```

## Parents

- [2d30f95676a812643ff3d89de9c4a0f636fa1969](https://git.cafe/gitcafe/zed/commit/2d30f95676a812643ff3d89de9c4a0f636fa1969?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/bcf4c71fdbfefcb853fd3e64cb8d1ae3daf90821?format=markdown)
