Skip to content

GtkSourceView

GtkSourceView is a free and open-source software library that provides syntax highlighting and text editing features for programming languages in the GTK+ toolkit. It is a part of the GNOME project and was first released in 2001.

GtkSourceView provides a text widget that can display syntax-highlighted text. It supports more than 60 programming languages, including popular ones such as C, C++, Java, Python, Ruby, and PHP. The library also provides auto-indentation, code folding, and bracket matching features, as well as the ability to display line numbers and highlight the current line.

GtkSourceView can be used in any GTK+ application that requires text editing, such as text editors, integrated development environments (IDEs), and even web browsers. It has been integrated into several popular applications, including Gedit, Anjuta, and GNOME Builder.

GtkSourceView is written in the C programming language and uses the GObject system, which allows it to be easily integrated into any GTK+ application. It also provides bindings for other programming languages such as Python, Ruby, and Vala. This project provides the bindings for Kotlin/Native.

GtkSourceView is licensed under the GNU Lesser General Public License (LGPL), which means that it can be freely used, modified, and distributed by anyone, including commercial entities. It is actively developed and maintained by a community of developers and contributors, and new releases are made regularly.

In summary, GtkSourceView is a versatile and powerful library that provides syntax highlighting and text editing features for programming languages in the GTK+ toolkit. It is easy to use, can be integrated into any GTK+ application, and supports many popular programming languages.

How to enable it

GtkSourceView bindings are not generated by default and they need to be enabled manually. To do it you need to move the GtkSourceView library section in the gtkkn.json from ignoredLibraries to libraries.

Click to expand/collapse
Index: gtkkn.json
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/gtkkn.json b/gtkkn.json
--- a/gtkkn.json    (revision f3029befd509ed10bcd72900c1a3125356e116dc)
+++ b/gtkkn.json    (date 1682245091765)
@@ -74,14 +74,14 @@
       "name": "adw",
       "module": "adwaita",
       "girPrefix": "Adw-1"
-    }
-  ],
-  "ignoredLibraries": [
+    },
     {
       "name": "gtksource",
       "module": "extra:gtksource",
       "girPrefix": "GtkSource-5"
-    },
+    }
+  ],
+  "ignoredLibraries": [
     {
       "name": "he",
       "module": "extra:libhelium",

Requirements

To generate the bindings,, you need to have GtkSourceView installed on your system:

sudo apt install libgtksourceview-5-dev