Skip to main content
As said in the comments, "... and the question is..?" --- thanks
Source Link
Rmano
  • 758
  • 5
  • 18

I have seen this very interesting article: http://dustycloud.org/blog/vcs-friendly-patchable-document-line-wrapping/ --- basically it is a suggestion for hard-breaking lines of text (for example, in markdown or LaTeX sources) to achieve both easy readability and easy "diff"-ability.

Basically, when I write in LaTeX normally I follow the classical way of "one line per phrase" (hard new line at full stop), and the mandatory blank line for paragraph. This is unfortunately almost unreadable in a diff of a very long phrase, especially if the change is near the end.

The suggested format is to have a line format (a la gqip) for every phrase, but keeping the phrases on their own. For example:

This is a short phrase. This, instead, is a very long, probably too long for English, phrase, but in other languages very long phrases are quite common, really --- and so on and so on.

should be formatted as (this has setl tw=60 to be more dramatic)

This is a short phrase. 
This, instead, is a very long, probably too long for
English, phrase, but in other languages very long phrases
are quite common, really --- and so on and so on.

I can go from the first form to the lastfinal one by hand:

  1. format the paragraph with gqip;
  2. go to the first full stop (or question mark, or a symbol meaning the end of the sentence);
  3. if it is the end of the paragraph, stop;
  4. otherwise, insert a linebreak,linebreak;
  5. then go to the next line, issue aformat again the rest of the paragraph as in point 1 above (still searching how to do this effectively --- clearly gqt.gqip command,do not work here unless I temporarily add a blank line above);
  6. repeat until the end of the paragraph.

...but I am sure that Is there should be a better way. (I can try to write a little script for this, or defineapply such a key that do the steps all right, but I'd like to know if there is some magic that can change thetype of formatting gqip command to automatically do it).

Updateautomatically I use

nnoremap <leader>. f.a<CR>^[gqt.

(the ^[ isto a literal escape) which is handy, but fails if the paragraph has just one phrase...)?

I have seen this very interesting article: http://dustycloud.org/blog/vcs-friendly-patchable-document-line-wrapping/ --- basically it is a suggestion for hard-breaking lines of text (for example, in markdown or LaTeX sources) to achieve both easy readability and easy "diff"-ability.

Basically, when I write in LaTeX normally I follow the classical way of "one line per phrase" (hard new line at full stop), and the mandatory blank line for paragraph. This is unfortunately almost unreadable in a diff of a very long phrase, especially if the change is near the end.

The suggested format is to have a line format (a la gqip) for every phrase, but keeping the phrases on their own. For example:

This is a short phrase. This, instead, is a very long, probably too long for English, phrase, but in other languages very long phrases are quite common, really --- and so on and so on.

should be formatted as (this has setl tw=60 to be more dramatic)

This is a short phrase. 
This, instead, is a very long, probably too long for
English, phrase, but in other languages very long phrases
are quite common, really --- and so on and so on.

I can go from the first to the last by hand:

  1. go to the first full stop,
  2. insert a linebreak,
  3. then go to the next line, issue a gqt. command,
  4. repeat until the end of the paragraph.

...but I am sure that there should be a better way. (I can try to write a little script for this, or define a key that do the steps all right, but I'd like to know if there is some magic that can change the gqip command to automatically do it).

Update I use

nnoremap <leader>. f.a<CR>^[gqt.

(the ^[ is a literal escape) which is handy, but fails if the paragraph has just one phrase...)

I have seen this very interesting article: http://dustycloud.org/blog/vcs-friendly-patchable-document-line-wrapping/ --- basically it is a suggestion for hard-breaking lines of text (for example, in markdown or LaTeX sources) to achieve both easy readability and easy "diff"-ability.

Basically, when I write in LaTeX normally I follow the classical way of "one line per phrase" (hard new line at full stop), and the mandatory blank line for paragraph. This is unfortunately almost unreadable in a diff of a very long phrase, especially if the change is near the end.

The suggested format is to have a line format (a la gqip) for every phrase, but keeping the phrases on their own. For example:

This is a short phrase. This, instead, is a very long, probably too long for English, phrase, but in other languages very long phrases are quite common, really --- and so on and so on.

should be formatted as (this has setl tw=60 to be more dramatic)

This is a short phrase. 
This, instead, is a very long, probably too long for
English, phrase, but in other languages very long phrases
are quite common, really --- and so on and so on.

I can go from the first form to the final one by hand:

  1. format the paragraph with gqip;
  2. go to the first full stop (or question mark, or a symbol meaning the end of the sentence);
  3. if it is the end of the paragraph, stop;
  4. otherwise, insert a linebreak;
  5. then go to the next line, format again the rest of the paragraph as in point 1 above (still searching how to do this effectively --- clearly gqip do not work here unless I temporarily add a blank line above);
  6. repeat until the end of the paragraph.

Is there a way to apply such a type of formatting automatically to a paragraph?

Added vimtex plugin to the tag list
Link
Rmano
  • 758
  • 5
  • 18
Added the sequence I use
Source Link
Rmano
  • 758
  • 5
  • 18

I have seen this very interesting article: http://dustycloud.org/blog/vcs-friendly-patchable-document-line-wrapping/ --- basically it is a suggestion for hard-breaking lines of text (for example, in markdown or LaTeX sources) to achieve both easy readability and easy "diff"-ability.

Basically, when I write in LaTeX normally I follow the classical way of "one line per phrase" (hard new line at full stop), and the mandatory blank line for paragraph. This is unfortunately almost unreadable in a diff of a very long phrase, especially if the change is near the end.

The suggested format is to have a line format (a la gqip) for every phrase, but keeping the phrases on their own. For example:

This is a short phrase. This, instead, is a very long, probably too long for English, phrase, but in other languages very long phrases are quite common, really --- and so on and so on.

should be formatted as (this has setl tw=60 to be more dramatic)

This is a short phrase. 
This, instead, is a very long, probably too long for
English, phrase, but in other languages very long phrases
are quite common, really --- and so on and so on.

I can go from the first to the last by hand:

  1. go to the first full stop,
  2. insert a linebreak,
  3. then go to the next line, issue a gqt. command,
  4. repeat until the end of the paragraph.

...but I am sure that there should be a better way. (I can try to write a little script for this, or define a key that do the steps all right, but I'd like to know if there is some magic that can change the gqip command to automatically do it).

Update I use

nnoremap <leader>. f.a<CR>^[gqt.

(the ^[ is a literal escape) which is handy, but fails if the paragraph has just one phrase...)

I have seen this very interesting article: http://dustycloud.org/blog/vcs-friendly-patchable-document-line-wrapping/ --- basically it is a suggestion for hard-breaking lines of text (for example, in markdown or LaTeX sources) to achieve both easy readability and easy "diff"-ability.

Basically, when I write in LaTeX normally I follow the classical way of "one line per phrase" (hard new line at full stop), and the mandatory blank line for paragraph. This is unfortunately almost unreadable in a diff of a very long phrase, especially if the change is near the end.

The suggested format is to have a line format (a la gqip) for every phrase, but keeping the phrases on their own. For example:

This is a short phrase. This, instead, is a very long, probably too long for English, phrase, but in other languages very long phrases are quite common, really --- and so on and so on.

should be formatted as (this has setl tw=60 to be more dramatic)

This is a short phrase. 
This, instead, is a very long, probably too long for
English, phrase, but in other languages very long phrases
are quite common, really --- and so on and so on.

I can go from the first to the last by hand:

  1. go to the first full stop,
  2. insert a linebreak,
  3. then go to the next line, issue a gqt. command,
  4. repeat until the end of the paragraph.

...but I am sure that there should be a better way. (I can try to write a little script for this, or define a key that do the steps all right, but I'd like to know if there is some magic that can change the gqip command to automatically do it).

I have seen this very interesting article: http://dustycloud.org/blog/vcs-friendly-patchable-document-line-wrapping/ --- basically it is a suggestion for hard-breaking lines of text (for example, in markdown or LaTeX sources) to achieve both easy readability and easy "diff"-ability.

Basically, when I write in LaTeX normally I follow the classical way of "one line per phrase" (hard new line at full stop), and the mandatory blank line for paragraph. This is unfortunately almost unreadable in a diff of a very long phrase, especially if the change is near the end.

The suggested format is to have a line format (a la gqip) for every phrase, but keeping the phrases on their own. For example:

This is a short phrase. This, instead, is a very long, probably too long for English, phrase, but in other languages very long phrases are quite common, really --- and so on and so on.

should be formatted as (this has setl tw=60 to be more dramatic)

This is a short phrase. 
This, instead, is a very long, probably too long for
English, phrase, but in other languages very long phrases
are quite common, really --- and so on and so on.

I can go from the first to the last by hand:

  1. go to the first full stop,
  2. insert a linebreak,
  3. then go to the next line, issue a gqt. command,
  4. repeat until the end of the paragraph.

...but I am sure that there should be a better way. (I can try to write a little script for this, or define a key that do the steps all right, but I'd like to know if there is some magic that can change the gqip command to automatically do it).

Update I use

nnoremap <leader>. f.a<CR>^[gqt.

(the ^[ is a literal escape) which is handy, but fails if the paragraph has just one phrase...)

Use the correct LaTeX name.
Source Link
Rmano
  • 758
  • 5
  • 18
Loading
Source Link
Rmano
  • 758
  • 5
  • 18
Loading