Kate for Python

Kate for Python

I have been working with many text editors; from Cygnus EDitor (CED) on Amiga in pre-internet days, nano, joe, vi on Solaris , Notepad, Context Editor, Scite, Notepad++ ... and stay with Sublime Text for years...

When I installed Manjaro on my laptop this year (April 2021.), I was curious about the Kate - KDE Advanced Text Editor which comes preinstalled with KDE flavor. I was quite pleasantly surprised with out-of-the-box look and feel. It is snappy, fast, very configurable and easy to use (at least for me) since it looks like Sublime Text or VS Code older brother with a new hairstyle.

Since I work with Python and SQL as my main tools, I have tried to set up Kate for this purpose. And it worked quite nicely. How ? I will show...

First, I need to enable Kate's Build Plugin:

  • Settings → Configure Kate → Plugins → Build Plugin → ✔️

Article content

then, I need to set the Build

  • View → Tool Views → Show Build Output → ✔️

No alt text provided for this image

You will see the Target Set with four lines (Build, Clean, Config and ConfigClean).

  • Click on Clean and delete it, as well as Config and ConfigClean.

Now you should see just Target Set with Build row.

No alt text provided for this image

Set Build

  • Double click on Target Set and change name to Python or whatever you want to see.
  • Double-click on make and replace it with <path-to-the-venv> "%f"

Article content
Tool-tip for available file related arguments

  • You may double-click on Build too and change it to whatever you like better (run)

Now, we could make our lives easier and add shortcut for run this build:

  • Go to Settings → Configure Shortcuts → search for "build" → Build Target → Custom → F5 (or whatever you like)

Done! Open Python script and press F5 for start interpreter.


You may add many builds either for different Python virtual environments (if you prefer) and/or other language triggers, which I show you on the next picture.

Article content
Builds for various languages


Then, I needed some editing tools which I use in Sublime Text... and found it is quite easy to extend the Kate editor with JavaScript, Python or Lua scripts as well as any other Command Line Interface (CLI) apps.

I started with Python extension scripts for exploration, then went to Lua scrips for better speed. Also, I am using couple of CLI apps for some other tasks like base64 encoder/decoder written in GO, jq for JSON file verification, ...

[1.] https://github.com/igorp74/Python_utils

[2.] https://github.com/igorp74/Lua_utils

[3.] TODO: JavaScript functions & extensions (pending...)


It is so easy to extend Kate per your liking in many different ways. Also, I am glad to see new improvements in the new versions of Kate.

Why Kate ?

Open Source, Powerful, Extensible, easier to configure than Sublime or Notepad++ (subjective).

Like
Reply

Refreshed a bit this article and added some of my Lua_utils.

Like
Reply

How did you know "%f" was needed ? I'm looking for documentation and I just can't find anything related

Like
Reply

Thanks a lot. There seems to be some added functionality with newer Kate versions, but this got me on the right track.

To view or add a comment, sign in

More articles by Igor Perković

  • What ToDo with AI ?

    Short story I co-create the ToDo app with AI (Google Gemini 2.5 Flash) and it is an awesome experience! Long story I…

    1 Comment
  • CSV, the final frontier...

    What is the right tool for the job ? Being a Data Engineer, I am constantly working on data transformation; move them…

    3 Comments
  • Date difference in Notion

    Notion could be used to calculate date difference in years, months and days within a database table. I was playing with…

Others also viewed

Explore content categories