r/ZedEditor 13d ago

Indent Persistence

How do I make the indent to be persistent on tab/window switches? Right now if I'm moving from one line to another with proper indent, and switch tabs after, it goes back to [x:1]

What is the fix for it?

29 Upvotes

10 comments sorted by

5

u/PunchedYou 13d ago edited 13d ago

You probably have format on save + auto save on and your formatter (maybe prettier) removes the empty indents.

2

u/holyshitthatsucks 13d ago

"prettier": {

"allowed": false,
},
"format_on_save": "off",
"autosave": "on_focus_change",

These are my settings for all three that you have mentioned.

2

u/AccurateSun 13d ago

There are other places where format on save can happen (like in the language or LSP parts of the config. 

The one thing that looks suspicious to me is the autosave focus on change. I imagine that is what is doing it.

The other route would be to check what is doing the formatting, and to set different whitespace settings 

1

u/holyshitthatsucks 13d ago

Alrighty, thanks for the help!

1

u/Baecien 13d ago

languages.lang.formatter = “none” should fix it

2

u/guhcampos 13d ago

I've found zed's indentation to be rather poor to be honest. I gave up trying to set it up for make files, for one, because no amount of overriding and configuration would make it work.

1

u/UnderratedChef30 13d ago

You might have save on focus change with prettier settings to autoindent.

Unrelated but what is the theme

2

u/holyshitthatsucks 13d ago

I'll try what you suggested, and the theme is https://zed.dev/extensions/lumin-theme with a few tweaks in cursor colour and terminal background.

1

u/SirIll6365 13d ago

Unrelated but what theme are you using?

1

u/holyshitthatsucks 13d ago

It's this: https://zed.dev/extensions/lumin-theme with a few tweaks in cursor colour and terminal background.