6
Lensflare
286d

How do you type with pairs of characters like () [] <> "" etc.?
Do you type them both, then move the cursor back and type the stuff inside or do you type the first of the pair, then type the stuff inside and then close it with the second of the pair?

I just realized I do both techniques, apparently randomly, which weirds me out.
Also my IDE often places the second character of the pair automatically.

Comments
  • 4
    Due to editors I do open-type-close, but on simple editors I do open-close-goback-type
  • 3
    I do both and move the cursor back. Editors and IDES seem to be so random about when they do and don't autocomplete
  • 3
    The Xed text editor auto-inserts the second quotation mark, but does not skip it when pressing it the second time, so I have to skip around it.
  • 1
    I do the pair first and then go back to fill the contents. Which is often annoying when typing " triggers ide to autocomplete with a second ", and when I automatically type the 2nd " I have """.
    Some ides cope with that nicely by upserting the 2nd of the pair. Some don't
  • 4
    I always type both right away cause I'm on a shitty german keyboard layout where [] and {} are fucking hard to reach (right alt + 6, 7, 8, 9)

    Also < and > are a fucking abomination.
  • 0
    @Isirant I know the pain and I lived with it for so many years until I finally decided to remap my keyboard to make it sane for coding. I got used to it much faster than I anticipated.
  • 1
    I type them when I need them. open-type-close

    Honestly? I prefer typing them manually instead of having the editor automagically add them because it often does so in an annoying way, and fixing its mistakes takes more effort than if I just typed everything.

    Some editors automatically add the closing bracket, but retain the cursor inside, which is nice. The better ones also allow overtyping that automatic closing bracket. Those are nice. It’s easy to confuse these, though, leading to doubled end quotes, for example. (or it doesn’t support all pairs like ``)

    Other editors add both brackets when you type an opening character, but put your cursor after both of them — and delete both if you backspace to delete just the closing bracket. Pisses me off to no end.

    Worse ones predict that you want a multi line snippet, and automatically insert it. Now your cursor is somewhere else and you have to parse what garbage it added so you can remove it — and then watch as it likely adds that same multi line snippet again. Ugh.

    No thank you.
    Open-type-close for me, tyvm!
  • 1
    Open-type-close most of the time, open-close-back-type specifically for generics / diamond brackets because they aren't colored so if the IDE miscounts them it's a bit harder to fix.
  • 1
    Open-close-goback for me
  • 1
    I cant stand IDEs and most editors; i turn off the auto-close options for the few i use.

    Open-contents-close always.

    But i am aware that im a dinosaur with coding practices.
Add Comment