Summary
This feature will support the "indent with tabs, align with spaces" principle/convention (used by gofmt and many style guides). Files would look correct at any tab-width setting whilst keeping the flexibility to work in spaces-only environments. Auto-indent would reduce friction for heavily indented code/text.
Conditions of Satisfaction
- Config changes
expand_tabs(bool, defaultfalse): whenfalse, Tab inserts a literal\t; whentrue, Tab insertsshift_widthspaces.shift_widthconfig (int, default 4, range 1–16): number of spaces inserted per Tab press whenexpand_tabs = true. Existingtab_spacesretains its meaning as the visual column-width of\tin view/normal mode.
- Tab display expansion: during the highlight pass,
\tcharacters are expanded to spaces (tab-stop math) so that chroma colouring and line-wrapping see consistent column widths. Edit-mode tab display continues to follow terminal tab stops (textarea widget limitation). - Auto-indent on Enter /
o/O: when the user opens a new line, leading whitespace from the current line is copied to the new line, placing the cursor after the indentation. Works with both tab and space indentation; reuses the existinglineIndent()helper. :TabsToSpacescommand / "Convert Tabs to Spaces" palette entry: replaces every\tin the active buffer withtab_spacesspaces and marks the file modified.- Both new config keys should be vault overridable (following the same pattern as
tab_spaces).
External Resources
N/A
## Summary
This feature will support the "indent with tabs, align with spaces" principle/convention (used by `gofmt` and many style guides). Files would look correct at any tab-width setting whilst keeping the flexibility to work in spaces-only environments. Auto-indent would reduce friction for heavily indented code/text.
## Conditions of Satisfaction
- [x] **Config changes**
- [x] `expand_tabs` (bool, default `false`): when `false`, Tab inserts a literal `\t`; when `true`, Tab inserts `shift_width` spaces.
- [x] `shift_width` config (int, default 4, range 1–16): number of spaces inserted per Tab press when `expand_tabs = true`. Existing `tab_spaces` retains its meaning as the visual column-width of `\t` in view/normal mode.
- [x] **Tab display expansion**: during the highlight pass, `\t` characters are expanded to spaces (tab-stop math) so that chroma colouring and line-wrapping see consistent column widths. Edit-mode tab display continues to follow terminal tab stops (textarea widget limitation).
- [x] **Auto-indent on Enter / `o` / `O`**: when the user opens a new line, leading whitespace from the current line is copied to the new line, placing the cursor after the indentation. Works with both tab and space indentation; reuses the existing `lineIndent()` helper.
- [x] **`:TabsToSpaces` command / "Convert Tabs to Spaces" palette entry**: replaces every `\t` in the active buffer with `tab_spaces` spaces and marks the file modified.
- [x] Both new config keys should be vault overridable (following the same pattern as `tab_spaces`).
## External Resources
N/A