Hotkey for toggling "Readable line lenght"

Use case or problem

I make heavy use of tables thanks to the amazing community plugin “Advanced Tables”

I find myself having to turn off

settings > Editor > “Readable line lenght”

many times a day, for editing tables with more space.

But for notes where I don’t edit tables I like keeping “Readable line lenght” on.

Proposed solution

What I’d like to ask it to be able to toggle this function on and off, from hotkeys.

I make heavy use of hotkeys and vim mode. And even thought the settings for Readable line lenght can be quickly accessed, it is still not as comfortable having to use the mouse every time for it.

Would really appreaciate being able to map a hotkey to it.

Thanks a lot!

PS: I couldn’t find other mentions of this request, feel free to let me know if this already exists somewhere, thanks!

23 Likes

That exact thing, for editing tables, was on my list of things to file. Thanks.

2 Likes

awesome, happy to know I’m not the only one @elmsfeuer

1 Like

It would be great to have it. Sometimes I need to see everything on full width and now I need to change it on the config pane.

1 Like

exactly, a hotkey would be extremly useful!

I’d like to bump this one up. I keep running into it and it would be great to have a hot key for this

3 Likes

Recently I faced the same problem and I was thinking about a hotkey solution to it. +1 for this. Another more general solution for this could be creating hotkeys for toggling css snippets

1 Like

If anyone is using auto hot key in windows you can write a script to toggle the readable line length setting. I’ve shared mine. The only challenge is, you’d need to use window spy to edit the numbers

; Readable line toggle for ctrl+shift+L
#IfWinActive ahk_exe Obsidian.exe
^+l::
WinGetPos, , , CurrentWinWidth
CoordMode Mouse, Screen
MouseGetPos MouseXBefore, MouseYBefore
; make the window full screen if it isn't
; do this by checking if the width matches full screen width
If (CurrentWinWidth < 2560) {
    Send {F11}
}
Sleep 100
; open settings
Send ^,
; Click on "Editor"
MouseClick, Left, 324, 309, 1
Sleep 100
; Click on the readable line length toggle
MouseClick, Left, 2186, 368, 1
; Close settings
Send {Esc}
; If the window was not full screen before escape from full screen
If (CurrentWinWidth < 2560) {
    Send {F11}
}
; Move the mouse back to where it was before
MouseMove, %MouseXBefore%, %MouseYBefore%
return
3 Likes

Are you sure that this can work for everyone? I guess the placement of buttons is affected by theme and css that one uses

This is important!

1 Like

You are correct that the placement of buttons will be affected. Which is why Window Spy is needed to figure out what numbers to insert into the mouse click locations and window size parameters

1 Like

interesting, I have never used this feature of AHK, because I though it is going be very finicky for this reason, maybe I should look into it again

+1 for this feature. I end up needing to turn on/off the reading line length multiple times per day (mostly for editing tables). Having a hotkey for this would be super helpful!!! Please prioritize, thanks! :slight_smile:

2 Likes

definitely happy to see you agree!

It would also be nice to be able to set “Readable line length” separately for preview mode and edit mode.

2 Likes

I would personally really love to see YAML metadata for this setting. There are some pages I will always want to see with readable line length off, like huge dataview tables, while generally I prefer readable line length on.

2 Likes

Also though about it, but I don’t know how to fix this with cssclass

1 Like

This is one of those features which should be relatively easy to implement but would make a huge difference in daily work → especially as a computer science student I am toggling a lot between “Readable Line Lenght” on and off when embedding code in my markdown notes.

Really wish I had this (without a plugin). It would make reading certain content way easier.

i use these plugin to toggle snippets easily:

and use this snippet to basically override readable length

.markdown-preview-view.is-readable-line-width .markdown-preview-sizer{
	max-width: 95%;
	width:100rem;
}

it is not the best solution, obviously the direct hotkey is better, but it is serviceable