11

我正在尝试在 Geany 编辑器中为 Kivy '.kv' 文件创建自定义语法突出显示。尽管特定的文件类型似乎与我遇到的问题无关,但因为我为使语法突出显示适用于自定义文件类型所做的任何努力都会导致完全未突出显示的文件。我相信我已经在这方面做了功课,但似乎没有任何效果。

我已将以下内容添加到 ~/.config/geany/filetype_extensions.conf

Kivy=*.kv;

我在 ~/.config/geany/filedefs/ 中还有一个名为“filetypes.Kivy.conf”的自定义类型定义文件。我尝试将此文件基于 /usr/share/geany/ 中的几个库存类型定义文件,并且该文件从未在 Geany 中应用任何语法突出显示。现在,只是为了实验,我的 'filetypes.Kivy.conf' 文件如下所示:

# For complete documentation of this file, please see Geany's main documentation
[settings]
# default extension used when saving files
extension=kv

# single comments, like # in this file
comment_single=#

[keywords]
# all items must be in one line
primary=size canvas
secondary=pos size

[indentation]
width=4
# 0 is spaces, 1 is tabs, 2 is tab & spaces
type=0

这非常松散地基于股票 XML 定义文件,但就像我说的那样,我已经尝试了许多其他股票文件。在许多情况下,我只将 'extension=' 值更改为 kv 并且仍然没有应用突出显示,即使在 Geany 中转到 Document>Set Filetype 并选择几乎任何随机文件类型(除了我的自定义条目)都会在其中产生某种突出显示我的 .kv 文件。甚至在使用未修改的股票定义内容时也是如此,否则当在 Geany 中特别选择时,它在我的 .kv 文件上工作正常!

此外,Kivy 文件类型在 Geany 内的 Document>Set Filetype 中默认列出和选择,所以我必须在这里做点什么!

我意识到有人问过这个类似的问题,但解决方案似乎与我的情况无关,因为我已经尝试了这个网站和许多其他网站上的所有相关主题。我的 Geany 版本是 1.22,我正在运行 Arch Linux。这让我发疯 - 有什么建议吗?

谢谢!

4

1 回答 1

9

Set lexer_filetype= property in the [settings] section of your filetype file. Working highlighting requires that there is a lexer that could be used for highlighting the .kv-files.

For more info see http://www.geany.org/manual/#lexer-filetype

于 2013-02-27T13:55:42.680 回答