Hotkey to go to the beginning or end of the paragraph (Alt + Left/Right)

I loved this shortcut, but it has been removed and there is no alternative.

Use case or problem

I am often creating PDF summaries and need to copy texts and paste in Obsidian, but it comes with the original line break, an easy way to correct it is by selecting all paragraphs Alt + LMB, so I go to the end of the paragraph Alt + Right and just press Del, and that’s it, the text is corrected.

The End key goes to the end of the line, which is not the same thing, a paragraph can have several lines.

Proposed solution

Could the option to set a hotkey for it again be added?

Or Alt + End/Home; Ctrl/Alt + PgUp/PgDown; or anything who makes sense.

What platform are you on? If you’re on Mac (and I think Linux?) ctrl-a and ctrl-e will take you to, respectively, the beginning and end of the current line.

Windows
Ctrl + A = select all
Ctrl + E = toggle between edit and preview mode

1 Like

ON Windows, I would do it with a combination of autohotkey and vim mode.

Sorry, but I have no idea how to do that.

I know Autohotkey is software, but it seems quite complex to use (I’m not a developer), and I’ve never understood what this Vim Mode is.

You kinda have the same I have here.

Also I send the AHK code I am using. No need to know any code. Just install the program. copy and past this code into a .txt file and rename it to .ahk and run it. After that just select the text in obsidian and press win + a. Just pay attention because it sometimes acts weird and I am not sure why.

#a::
Clipboard := ""
Loop, {
    		SendInput, ^c
    		ClipWait, 0.5
    		If (ErrorLevel = 0)
        		Break
		}
        
ToolTip Clipboard data type: %A_EventInfo%

StringReplace, Clipboard, Clipboard,  `r`n,%A_Space%, All 

Sleep 1000
ToolTip  ; Turn off the tip.
SendInput %Clipboard%
return
1 Like

Vim is a text editor with its roots in the Jurassic, and about as user-friendly as anything else was then. But it is extremely powerful, and has all the commands you need to go anywhere in a file, all expressed in keystrokes. Autohotkey is a Windows program that lets you write sequences of keystrokes — for controlling other programs — and then fire off the whole lot with a single key chord of your choice. So, for example, I am able to move around the text, and delete it, sentence by sentence. That, for me, is a requirement if I am to write fluent prose. I’m pretty certain there is a vim command to get to the end of a paragraph, and that could be triggered by the keystroke of your choice in AHK.

I’d be happy to sketch something out but BUT vim is nothing like any word processor you have used. Text is entered in one “mode” and manipulated in another. So you have to know how to get out of it before you enter. It is probably better to use the simple AHK script above.

2 Likes

I think this code is not working, it copies the paragraph and pastes it 2x.

are you sure you are doing it right? it should replace the selected paragraph with the modified one.

here is the whole file, maybe it works if you run the whole file

; Win + B
; Replaces the selected text with ,a removed of all linebreaks only, version
; Win + A
; Replaces the selected text with ,a removed of all linebreaks and added a linebreak after every period, version


#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#Persistent
return

;......................................

#b::
Clipboard := ""
Loop, {
    		SendInput, ^c
    		ClipWait, 0.5
    		If (ErrorLevel = 0)
        		Break
		}
        
ToolTip Clipboard data type: %A_EventInfo%

StringReplace, Clipboard, Clipboard,  `r`n,%A_Space%, All 
ClipSaved := ClipboardAll   ; Save the entire clipboard to a variable of your choice.
; ... here make temporary use of the clipboard, such as for pasting Unicode text via Transform Unicode ...
Clipboard := ClipSaved   ; Restore the original clipboard. Note the use of Clipboard (not ClipboardAll).
clipboard := RegExReplace(clipboard,"\. +",".`n")

Sleep 1000
ToolTip  ; Turn off the tip.
SendInput %Clipboard%
return

; ....................................................

#a::
Clipboard := ""
Loop, {
    		SendInput, ^c
    		ClipWait, 0.5
    		If (ErrorLevel = 0)
        		Break
		}
        
ToolTip Clipboard data type: %A_EventInfo%

StringReplace, Clipboard, Clipboard,  `r`n,%A_Space%, All 

Sleep 1000
ToolTip  ; Turn off the tip.
SendInput %Clipboard%
return

Now I get it, I was trying to use it to go to the beginning of the paragraph!