logoalt Hacker News

rgoulteryesterday at 11:46 AM2 repliesview on HN

> \n is ^J (ctrl-J) so there's some logic there

The same 'j' as vi uses for 'hjkl'. https://vi.stackexchange.com/questions/42426/why-did-vi-use-...


Replies

microgptyesterday at 12:51 PM

also the same 'j' found in words like 'jujuism', 'jejunities', and 'bejeezus', also by a magical coincidence the same one in most Latin fonts, and even some random text strings such as 'pj$4'

But I suppose you're saying ASCII 10 was chosen as newly because it aligns with the down arrow on keyboards of the time. Maybe.

show 2 replies
snarkconjectureyesterday at 2:51 PM

No, it's ^J because `J` is 0x4A in ASCII and `\n` is 0x0A, just as `I` is 0x49 and `\t` (tab, ^I) is 0x09.

In the stone age, pressing CTRL flipped that bit, so ^J is literally "ctrl-J".

show 1 reply