overleaf / overleaf

A web-based collaborative LaTeX editor
GNU Affero General Public License v3.0
14.12k stars 1.45k forks source link

Hard line break in the editor to make code more readable #323

Open ASalvail opened 9 years ago

ASalvail commented 9 years ago

Something I miss from Emacs Auctex extensions is the capacity to set a specific line length and have the editor automatically insert a line break each time a word is written that goes over that limit.

Soft line break is achievable by resizing the editor window size, but this method has several problem :

To implement this : probably add an option in the settings to specify the length (with 0 for no automatic hard line breaks). Another companion feature would be to reformat a selection. For example, you made modifications to the center of a paragraph and now a line is only half full. This companion feature would readjust all selected lines to maximally use each line by moving the line breaks.

Thanks for considering this!

lsawade commented 5 years ago

It's been a long time since this was brought up, but I was surprised it hasn't been implemented! I assume it's not an easy task, but I would like hard-wrapping as well! Cheers!

frentello commented 4 years ago

Yeah the ticket is now almost 5 years up. I would love to see this feature in the hopefully near future

beltrame commented 4 years ago

It's very much needed

bvanheerden commented 3 years ago

Just commenting to say it's 2021 and still this feature would be great.

Gabriel-p commented 3 years ago

This is the second most upvoted request and it has been opened for 6 years now. Any ETA on this?

ASalvail commented 3 years ago

For what it's worth, I still think this would be a great addition! I've been doing them manually for all those years, I wouldn't mind a break.

rconnorlawson commented 3 years ago

For what it's worth, there's a TamperMonkey script implementing a paragraph reflow operation like Vim's gq command. I haven't tried it myself, but found it on the same day I found this bug. This doesn't address the OP's main request though.

I use vim mode and would love for gq to work out of the box!

tikacp commented 2 years ago

would be highly appreciated, indeed

vbharadwaj-bk commented 2 years ago

Would also appreciate automatic line breaks. I prefer to version-control my LaTeX, and line-level changes are much more meaningful when the line doesn't extend to an entire paragraph.

ifigueroap commented 1 year ago

2022 and still no hard breaks nor reflow... Emacs+ AucTex is still the superior editor indeed

ckarren commented 1 year ago

Vim mode in Overleaf is hardly usable without hard wraps. If I didn't have to use Overleaf for collabs I would avoid it and stick to vimtex.

LarssonOliver commented 1 year ago

I'd also like this feature! Maybe some day...

Jackozee commented 1 year ago

Yes, please. Or even just adding support for the gqq command and related ones.

marinegor commented 1 year ago

I gladly join everyone in this thread -- using git/github diff tool is so much easier when each sentence is a separate line or few of them. It doesn't break any latex code, but allows you to easily go back to earlier word choice options that you decide you like more.

ulysses4ever commented 12 months ago

@ckarren

Vim mode in Overleaf is hardly usable without hard wraps.

I thought exactly the same until I saw people here mentioning user scripts (e.g. TamperMonkey-based) to customize the shortcuts. E.g. this script remaps j to gj and k to gk -- and this goes a long way! Of course, 0/$ are not as usable, but still it's a big improvement. Highly recommend! Actually, they redefine 0/$ so that they act on visual lines, it seems.

Ahmad-Fermion commented 8 months ago

It is very unfortunate that this feature is still not available!

VianaSamuel commented 7 months ago

This feature would be so useful. It's a pity it hasn't been added yet.

nonodev96 commented 2 weeks ago

Is there any current way to change the default word wrap?

I've tried to modify with TamperMonkey and CodeMirror, it's all very confusing.

(function () {
    'use strict';
    window.addEventListener("UNSTABLE_editor:extensions", (event) => {
        const { CodeMirror, CodeMirrorVim, extensions } = event.detail;
        const { 
          Decoration, EditorSelection, EditorView, Prec, StateEffect, 
          StateField, ViewPlugin, WidgetType, hoverTooltip, keymap, syntaxTree 
        } = CodeMirror

        console.log({ Decoration, EditorSelection, EditorView, Prec, StateEffect });

    });
})();