zed/crates/vim/src
David Alecrim bcf4c71fdb
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
2026-04-22 16:40:49 +00:00
..
digraph
helix editor: Fix multi-line cursor expansion when multi-byte characters are involved (#51780) 2026-03-19 16:21:03 +00:00
normal vim: Preserve system clipboard when pasting over visual selection (#52948) 2026-04-21 14:41:42 -06:00
test editor: Fix soft-wrap in auto-height editors (#54051) 2026-04-18 00:55:44 +02:00
change_list.rs editor: Remove buffer and display map fields from SelectionsCollection (#42175) 2025-11-07 11:21:14 +01:00
command.rs terminal: Use system shell for non-terminal uses (like spinning up external agents) (#51741) 2026-04-21 08:06:40 +00:00
digraph.rs vim: Downgrade user config error from panic to log (#42070) 2025-11-06 08:37:04 +00:00
helix.rs vim: Ensure vgl does not select newline in helix mode (#54238) 2026-04-22 13:08:32 +00:00
indent.rs Reduce amount of monomorphizations from FnMut closures (#49453) 2026-02-18 12:00:02 +01:00
insert.rs Reduce amount of monomorphizations from FnMut closures (#49453) 2026-02-18 12:00:02 +01:00
mode_indicator.rs Customizable vim mode text color (#46639) 2026-01-13 15:38:13 -06:00
motion.rs vim: Fix % for multiline comments and preprocessor directives (#53148) 2026-04-07 02:51:54 +00:00
normal.rs vim: Respect auto_indent setting in o/O commands (#53620) 2026-04-22 16:40:49 +00:00
object.rs Require multibuffer excerpts to be ordered and nonoverlapping (#52364) 2026-04-01 17:25:32 +00:00
replace.rs Improve clipboard support on Windows (#51807) 2026-03-18 22:09:26 -04:00
rewrap.rs helix: Add support for line length in reflow command (#52152) 2026-03-23 11:09:54 +00:00
state.rs vim: Fix incorrect bracket matching for symmetric quotes in cs operator (#52321) 2026-04-16 22:10:25 -06:00
surrounds.rs vim: Fix incorrect bracket matching for symmetric quotes in cs operator (#52321) 2026-04-16 22:10:25 -06:00
test.rs settings: Add auto completion to command aliases setting (#54496) 2026-04-22 15:09:09 +01:00
vim.rs vim: Preserve system clipboard when pasting over visual selection (#52948) 2026-04-21 14:41:42 -06:00
visual.rs vim/helix: Use grapheme count on replace (#51776) 2026-03-25 23:19:55 +00:00