zed icon indicating copy to clipboard operation
zed copied to clipboard

Option to disable auto-indentation

Open NichtJens opened this issue 1 year ago • 2 comments

Check for existing issues

  • [X] Completed

Describe the feature

I would like to disable auto-indentation either entirely for the whole editor or per language.

I generally prefer no auto-indentation but having this option would also allow for a straight forward workaround in case of issues with the auto-indentation logic (like here #10832).

If applicable, add mockups / screenshots to help present your vision of the feature

No response

NichtJens avatar Oct 19 '24 13:10 NichtJens

If you need a reason or a test - try pasting in yaml files. Holy smokes, is this annoying.

tcurdt avatar Feb 16 '25 01:02 tcurdt

What's the status on this? I literally jump back-and-forth between IDEs because of the (hella annoying) auto-indentation... T_T

iammati avatar May 30 '25 21:05 iammati

Got the same behavior for Haskell: Trying to paste

write2log :: Monad m => String -> LoggT m ()
write2log = undefined

to the beginning of the line where the cursor is

instance (MonadFail m) => MonadFail (LoggT m) where
  fail = LoggT . fail
^ here

to get it like:

instance (MonadFail m) => MonadFail (LoggT m) where
  fail = LoggT . fail

write2log :: Monad m => String -> LoggT m ()
write2log = undefined

but the editor pastes it here:

instance (MonadFail m) => MonadFail (LoggT m) where
  fail = LoggT . fail
  
  write2log :: Monad m => String -> LoggT m ()
  write2log = undefined

The behavior is similar to this: https://github.com/zed-industries/zed/issues/13338#issue-2365404299

Basically, I want to paste my code wherever the cursor is.

oshavrov avatar Jun 28 '25 18:06 oshavrov

Sublime text solves it like this:

  • Just paste your content like it is: ctrl + v
  • Paste your content with automatic identation: ctrl + shift + v

really convinient

Kartoffelpeter avatar Jul 03 '25 05:07 Kartoffelpeter

Just to add, I am not entirely sure we are all asking about the same. In principle, I was asking about a way to disable auto-indentation while editing. The fact that this would be a workaround for issues with indention upon pasting was meant as a bonus.

NichtJens avatar Jul 03 '25 06:07 NichtJens

Same issue with auto-indent being applied when pasting, albeit I can only get it to reproduce with TypeScript files. I tried YAML, but it was not reproducible there.

ariaydejawad avatar Aug 03 '25 04:08 ariaydejawad

Any movement on this?

It's becoming incredibly frustrating when writing Makefiles, eg:

all:
  $(HIDE)| <-- automatically dedents here

side-note: this particular situation could be a problem with the Make extension? but afaik it contains no code, only language *.scm stuff, which is over my head.

stolen-byte avatar Aug 28 '25 07:08 stolen-byte

Same problem in Python

LaTrissTitude avatar Aug 30 '25 18:08 LaTrissTitude

Seems like a duplicate of https://github.com/zed-industries/zed/issues/11780, which was fixed in https://github.com/zed-industries/zed/pull/36259.

injust avatar Aug 30 '25 20:08 injust

"auto_indent": false in my settings.json works like a charm.

oshavrov avatar Aug 30 '25 21:08 oshavrov

Since this is closed, is there another open issue for the ctrl+v/ctrl+shift+v difference for automatic indentation when pasting? Turning off auto-indent completely isn't a solution for some of the cases folks have commented here about.

LPGhatguy avatar Sep 02 '25 20:09 LPGhatguy