OMG I found a way to make ENTER=New Paragraph

This has been a long journey for me. I feel like I’ve been cured of a chronic disease. Or maybe I was constipated for a year and half and now I’ve finally had the satisfactory trip to the toilet LOL

Non-coder/writer types may recognize this problem: I want to type like I do in other software, where one actuation of the ENTER key gives you a paragraph break, and (to a lesser degree of familiarity, maybe) CONTROL + ENTER gives you a line break/feed - i.e. \n

I limped along forever just using my dim understanding of CSS to copy and paste together solutions to make things look right in Preview mode, then copy/paste to my “real” writing app when I needed to export something from note archive to IRL.

Well, recently I changed my writing workflow and started doing more pre-writing/outlining in Obsidian. I used Pandoc to translate to the ancient language of Scrivener (RTF) and everything broke.

Sooo…

I finally got motivated enough to solve the dialectic:

I must use a single ENTER to make a paragraph break because I started using Bank Street Writer when I was nine years old LOL

vs

I must use two line breaks to make a “paragraph” in order for the Markdown code to work.

I followed the steps in this tutorial: How To Create Application Specific Shortcut Keys With AutoHotkey | CodePre.com

…and this is what I came up with

#IfWinActive, ahk_exe Obsidian.exe
Enter::
Send, {ENTER}{ENTER} 
return 

^Enter::
Send, {ENTER}
return

Now when I am working in Obsidian (and only then), the “keyboard” spits out two line breaks every time hit the ENTER key.

When I hit CONTROL+ENTER I get a single line break.

So everything works the way I’m used to, and the Markdown code renders the way I expect in every destination.

WOW - so relieved. This has bothered me with increasing severity for over a year. I would have fled to another software if there was anything close to a viable option.

The only drawback I encounter so far (just one Pomodoro of use) is at the end of a list. I hit enter twice, which sends 4x ENTER to Obsidian, which in turn gives me one more line feed than I want. So I just hit ENTER ENTER BACKSPACE.

NBD - not compared the nightmare from which I’m waking.

Anyway, HTH someone. If someone had turned me on to this a year ago it would have saved so much frustration.

Michael

P.S. I’m not a coder, I work like a monkey with a stick, just copy/pasting, modifying until something works. If you want to modify this the AHK forum can offer much better help than I can: AutoHotkey Community - Index page

PPS there is a feature request for this type of ENTER behavior to be built into Obsidian. Maybe if everyone in a predicament similar to mine clicks the heart to +1 that request, they will add it: Enter=New Paragraph as default - Feature requests - Obsidian Forum

11 Likes

Thanks for this, I initially used css to manipulate paragraph spacing, but it just applied the setting to any paragraph spacing and did not discriminate between line break and new paragrah. Since I am already using ahk, this is a great solution!