Is there any way to put a piece of text in between quotation marks/parenthesis by pressing keys?

Something I really like about coding programs like Kate, is that it’s very comfortable for writing text. Two of the features I would love to see and use on LibreOffice writer is:

  • Putting in between quotation marks (or parenthesis) a piece of text by selecting it and pressing " or ( keys.
  • Removing line breaks by pressing Ctrl + J.

Is there any way to do that?

Basically this Q&A site isn’t the place for feature requests. That would be bugs.documentfoundation.org.
On the other hand, there are concerns that do not necessarily require an addition to issued software, but can be served with a little programming by users.
In this case, I see a little extra problem in the plethora of locales that can handle quotes very differently. Simple “straight” quotes will not cause a problem.
Concerning the removal of line breaks you need to make clear if you actually mean hard line breaks or paragraph breaks. They need to be handled differently.

Addendum
As I expected and now checked, the mentioned program ‘Kate’ is basically an ASCII editor tuned for programming purposes. There are many of the kind.
The fundamental difference to a text processing program like Writer is the marginal role of formatting , text attributes, styles, …
Surely you wouldn’t expect ‘Kate’ to support character styles, frames, tables …
Why do you expect Writer to do the tricks Kate is made for?
Let’s continue to distinguish hammers from screw drivers.

2 Likes

Regarding first request, this may be possible with a macro but I never wrote any.

Removing line breaks: I don’t know what is your present understanding of Writer concepts. In a document processing application, there are two types of visual “line breaks”.

  • the most important one is paragraph break: it delimits a semantic unit in your text and is displayed as a block of lines (colloquially called a … paragraph!). You can act globally on a paragraph with a paragraph style.
  • the second one is a mere “formatting effector” which does not break a paragraph. It simply causes next characters to be sent to next line.

They have not the same encoding, if any. You can remove any of them with Bksp or Del. This is not the same semantics as Ctrl+J as the latter need not be invoked from the exact end-of-line position.

1 Like

Just for fun I had made a raw sketch for the tasks Moshpirit mentioned.
Since the sketch now exists I post it here included with the attachment.
It is sloppy, not recommended, and not made for my own use.
textRangesTest.odt (30.2 KB)

1 Like

It is possible but I don’t recommend it, because it uses global Key Handler so it could be problematic. You also must run Key Handler at start of your work and turn off it at final. Description is in ODT file
key-handler.odt (51.9 kB)

Easier is to make two macros for two keyboard shortcuts → one to add the paranthesis and 2nd to add the quotation marks. It is safe in contrast to Key Handler. Like in Lupp’s example.

I don’t understand to 2nd part of Ask. What do you need? Jump with visible cursor to the end of line and if there is Enter or Shift+Enter then delete it? And then return with cursor to the primal position?
Or remove line breaks (Enter/ Shift+Enter) from selection?

1 Like

This is what Kate offers - according to

discovered that if you select all the text in Kate, then issue the Ctrl-J, all the separate lines will be joined into one line.

Cited from

could be useful, when moving typical text-editor lines to Writer/Word etc. as usually every line gets a paragraph, when you paste this…

1 Like