←back to thread

631 points cratermoon | 3 comments | | HN request time: 0.654s | source
Show context
chrismorgan ◴[] No.44462001[source]
> Like, just to calibrate here: you know how some code editors will automatically fill in a right bracket or quote when you type a left one? You type " and the result is "|"? Yeah, that drives me up the wall. It saves no time whatsoever, and it’s wrong often enough that I waste time having to correct for it.

I have not yet figured out why anyone would choose this behaviour in a text editor. You have to press something to exit the delimited region anyway, whether that be an arrow key or the closing delimiter, so just… why did the first person even invent the idea, which just complicates things and also makes it harder to model the editor’s behaviour mentally? Were they a hunt-and-peck typist or something?

In theory, it helps keep your source valid syntax more of the time, which may help with syntax highlighting (especially of strings) and LSP/similar tooling. But it’s only more of the time: your source will still be invalid frequently, including when it gets things wrong and you have to relocate a delimiter. In practice, I don’t think it’s useful on that ground.

replies(13): >>44462030 #>>44462032 #>>44462150 #>>44462206 #>>44462213 #>>44462300 #>>44462368 #>>44462389 #>>44462450 #>>44463659 #>>44463863 #>>44464038 #>>44466698 #
BlindEyeHalo ◴[] No.44462150[source]
I think it is practical when highlighting text and then pressing " once puts quotes and the start and the end of the highlighted region.

But I agree that in normal input it is often annoying.

replies(1): >>44462189 #
1. matejn ◴[] No.44462189[source]
I hate that even more, especially since Visual Studio introducted it. I had the habit of selecting some text, and then typing to replace it. Now when my replacement starts with a parenthesis or quote, the text just gets surrounded instead!

Maybe this is just an XKCD moment https://xkcd.com/1172/ ...

replies(1): >>44462267 #
2. jeffhuys ◴[] No.44462267[source]
I think for the feature of wrapping, it is useful enough + just typing a->backspace->" is easy enough that I think it's a net win
replies(1): >>44466722 #
3. pxc ◴[] No.44466722[source]
But there have been sensible bindings for doing this forever, e.g.: https://github.com/tpope/vim-surround

There's no need to break normal editing behavior.