this post was submitted on 04 Jun 2024
9 points (100.0% liked)

KDE & Plasma users

2798 readers
3 users here now

KDE is an international technology team creating user-friendly free and open source software for desktop and portable computing. KDE's software runs on GNU/Linux, BSD and other operating systems, including Windows.

founded 4 years ago
MODERATORS
 

I have a plain text journal/log that I write and edit in Kate. This contains a number of floating point numbers and I often copy and paste them into Kcalc or LibreOffice Calc.

I would like to be able to double click on one of them and have it all selected so I can copy it into the clipboard. This does not work because it only selects the digits on one side of the decimal or the other which forces me to use the mouse to select the whole number - which is slower and more work for me.

When I'm doing this, I'm doing it a lot, so speed makes a difference to me.

Is there a way to temporarily tell Kate that the period/decimal is a word character so the double click will work?

Some of my numbers also have commas in them as thousands separators for readability, so including the comma as a word character would be nice as well.

This behavior would not be good as a permanent setting unless I could restrict it to something like a particular Kate profile... because I need the normal behavior the rest of the time.

Any ideas would be appreciated.

top 5 comments
sorted by: hot top controversial new old
[–] tubbadu@lemmy.kde.social 3 points 5 months ago (1 children)

I have no idea if there's a "normal" way to do it, but in case you don't find anything better and if you're willing to spend a bit of time tinkering, an option could be writing a kate plugin. I did it only once, so my knowledge is extremely poor, but it should be possible to connect to the "text selected" signal, and everytime some text is selected, you read the text document and search if there's a comma or a period etc and in case select the whole number

[–] josephj11@lemmy.kde.social 4 points 5 months ago (1 children)

Sometimes asking a question makes you think of an answer.

I think I have a good workaround for now.

I'm writing an AutoKey script to do it using a Python regex. The added benefit of doing it this way is that it will work almost anywhere, not just in Kate.

[–] tubbadu@lemmy.kde.social 3 points 5 months ago (1 children)

This is very nice! If you achieve to make it work please share it!

[–] josephj11@lemmy.kde.social 2 points 5 months ago

I've got it working, but I have to use it a while to see if it's stable.

[–] 56_@lemmy.ml 3 points 5 months ago

I'm pretty sure kate has different word selection rules for different languages. I have no idea how to configure these though.