Sample Header Ad - 728x90

How to write a plugin or script for Kate that takes a unicode code point and inserts the corresponding unicode character at cursor?

2 votes
2 answers
658 views
Entering arbitrary Unicode characters according to their code point is simple e.g. in Gedit (press Ctrl+Shift+u, enter the (hex) code point, press enter). One can even use the terminal. For example, executing echo -e '\u2603' produces a snowman, ☃. Here 2603 is, again, the code point in hex. KDE's Kate, however, currently (as of Version 19.12.3) does not seem to have similar functionality. True, one can use Gedit or the terminal to produce the symbol, which can then be copied and pasted into Kate. But this is awkward. At the same time, Kate does support plugins and scripts. Unfortunately, I have not been able to find any tutorials for how to write them (except [this one](https://kate-editor.org/2004/01/06/writing-a-kate-plugin/) , from 2004, which is so terse that it hardly qualifies as a tutorial, and anyway is probably obsolete). It would be nice if the plugin were to implement the same functionality as Gedit, since its method of entering Unicode characters seems to be a pretty standard way to do it. But it doesn't have to be done that way. Maybe the Kate plugin (or Kate script?) could work like this: upon pressing a keyboard shortcut, a standard KDE pop-up dialog appears, prompting you to enter the Unicode hex code. Once the code is entered, we press 'enter', and the corresponding Unicode character is inserted at the current location of the cursor in Kate. No doubt there are other methods of entering that would make sense. The key is that the Unicode character must be entered at the current location of the cursor. Is something like this possible to do in Kate using plugins (or scripts)? How difficult might it be to write the appropriate plugin (or script)? How would one go about writing and installing such a plugin?
Asked by linguisticturn (171 rep)
Apr 13, 2022, 09:22 PM
Last activity: Feb 24, 2023, 11:19 AM