【问题标题】:How to write python commands for gedit?如何为gedit编写python命令?
【发布时间】:2013-10-17 09:40:32
【问题描述】:

我的 MacVim 经历非常不成功。 Vim 很棒,但我很懒,没有时间学习 Vim 脚本。

所以我切换到 gedit,希望直接使用 python(这是我最喜欢的语言)。 我很想知道如何做这 4 件基本的事情:

  1. 编写一个通过快捷方式激活的 python 脚本。
  2. 将选定的文本(或所有文件)作为 python 脚本的输入
  3. 打印输出代替输入(或在新行之后或换行)
  4. 使命令在菜单栏中可用(可单击)。

【问题讨论】:

    标签: python text-editor shortcut gedit


    【解决方案1】:

    您可以使用

    导入 gedit API
    from gi.repository import GObject, Gedit
    

    创建的 python 文件应该与 .plugin 文件一起存在。然后可以由 Gedit 加载。

    extension interfaces 必须根据插件使用。

    这是一个很好的tutorial,我在谷歌上找到的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-01-07
      • 1970-01-01
      • 2023-03-05
      • 1970-01-01
      • 2010-10-10
      • 2016-07-08
      • 1970-01-01
      相关资源
      最近更新 更多