edit icon indicating copy to clipboard operation
edit copied to clipboard

Unindent when backspacing at the start of an indentation

Open stianhoiland opened this issue 6 months ago • 4 comments

A feature that some "tab = spaces" guys enjoy is the hungry backspace, where backspace removes consecutive whitespace characters. The feature could be limited to only consecutive space characters or also work for other whitespace such as tabs, though the latter case seems a little pathological.

stianhoiland avatar May 20 '25 02:05 stianhoiland

I've never heard of the hungry backspace, I've always used Ctrl + Shift + Left (and then Right). I'm just happy it supports Ctrl + Backspace for word removal...

Szeraax avatar May 20 '25 05:05 Szeraax

I don't remember where I picked it up first. Maybe Xcode? I'm not sure, but afterwards it was hard to live without. Fortunately there are usually plugins for this functionality and if not it's easy to script up for most editors that support scripting. Now that I've switched to the superior indentation whitespace character I don't personally need this functionality, but since Edit doesn't have a persistent tabs/spaces option yet, and defaults to spaces, I found myself backspacing way too much and missed the hungry backspace.

stianhoiland avatar May 20 '25 07:05 stianhoiland

Is there a plugin for VS Code or another editor (outside of macOS and Xcode) where I could check that behavior out?

lhecker avatar May 20 '25 16:05 lhecker

While I've never known it as the "hungry backspace", this has been the behavior I've experienced in several editors, including VS Code.

  • I've always assumed it was the default behavior of VS Code, but it could perhaps be thanks to the EditorConfig.EditorConfig extension.
  • Neovim has this behavior (probably thanks to its builtin EditorConfig support).
  • Helix (written in Rust) has this behavior, but it also has indent sizes for many languages hard-coded into its default config, so perhaps not completely applicable as a code example.

spenserblack avatar May 21 '25 15:05 spenserblack