gedit: 行間のスペースを増やすにはどうすればいいですか?

gedit: 行間のスペースを増やすにはどうすればいいですか?

奇妙なフォントで gedit を使用していますが、行が互いに上書きされることがあります。行間の間隔を変更できますか?

答え1

外部ツール プラグインを使用すると、行間の間隔を変更できます。

具体的には、作業ファイル上でスクリプトを実行できるようにし、gedit がコンピューター上の他のプログラムと対話できるようにすることで、gedit を拡張します。

外部ツール プラグインを有効にするには、以下を選択します。

Gedit ---- 設定 ---- プラグイン ---- 外部ツール。

プラグインを有効にしたら、ニーズに合わせて設定する必要があります。

構成オプションは、以下を選択することで利用できます。

ツール ---- 外部ツールを管理します。

効果的に使用するにはスクリプトの知識が必要です。

ダイアログが表示され、ツールの追加を開始できます。

ツールを実行するには、次の場所に移動します。

ツール ---- 外部ツール、または該当する場合は関連するショートカット キーを使用します。

ツールの保存と手動編集: /usr/share/gedit/plugins/externaltools/tools。

Gedit の LineSpacing プラグインの例:

http://natural966.wordpress.com/2012/08/19/my-linespacing-plugin-for-gedit-3/

2 つのファイルで構成されます。

行間隔プラグイン:

[Plugin]
Loader=python
Module=linespacing
IAge=3
Name=Line-spacing
Description=Increase or decrease space between lines
Authors=
Copyright=
Website= 

行間隔.py:

from gi.repository import GObject, Gtk, Gedit

UI_XML = """<ui>
<menubar name="MenuBar">
    <menu name="ToolsMenu" action="Tools">
      <placeholder name="ToolsOps_3">
        <menuitem name="LineSpacingAction0" action="LineSpacingAction0"/>
        <menuitem name="LineSpacingAction1" action="LineSpacingAction1"/>
        <menuitem name="LineSpacingAction2" action="LineSpacingAction2"/>
      </placeholder>
    </menu>
</menubar>
</ui>"""

class LineSpacing(GObject.Object, Gedit.WindowActivatable):
    __gtype_name__ = "LineSpacing"
    window = GObject.property(type=Gedit.Window)

    def __init__(self):
        GObject.Object.__init__(self)

    def _add_ui(self):
        manager = self.window.get_ui_manager()
        self._actions = Gtk.ActionGroup("LineSpacingActions")
        self._actions.add_actions([
            ('LineSpacingAction0', Gtk.STOCK_INFO, "Reset Line spacing", 
                "<Control><Alt>0", "Reset Line spacing", 
                self.on_linespacing_action_activate0),
            ('LineSpacingAction1', Gtk.STOCK_INFO, "Decrease Line spacing", 
                "<Control><Alt>8", "Decrease Line spacing", 
                self.on_linespacing_action_activate1),
            ('LineSpacingAction2', Gtk.STOCK_INFO, "Increase Line spacing", 
                "<Control><Alt>9", "Increase Line spacing", 
                self.on_linespacing_action_activate2),
        ])
        manager.insert_action_group(self._actions)
        self._ui_merge_id = manager.add_ui_from_string(UI_XML)
        manager.ensure_update()

    def do_activate(self):
        self._add_ui()

    def do_deactivate(self):
        self._remove_ui()

    def do_update_state(self):
        pass

    def on_linespacing_action_activate0(self, action, data=None):
        view = self.window.get_active_view()
        if view:
            view.set_pixels_below_lines(0)
            view.set_pixels_inside_wrap(0)

    def on_linespacing_action_activate1(self, action, data=None):
        view = self.window.get_active_view()
        if view:
            if view.get_pixels_below_lines() >= 0:
                view.set_pixels_below_lines(view.get_pixels_below_lines() - 1)
            if view.get_pixels_inside_wrap() >= 0:
                view.set_pixels_inside_wrap(view.get_pixels_inside_wrap() - 1)

    def on_linespacing_action_activate2(self, action, data=None):
        view = self.window.get_active_view()
        if view:
            view.set_pixels_below_lines(view.get_pixels_below_lines() + 1)
            view.set_pixels_inside_wrap(view.get_pixels_inside_wrap() + 1)

    def _remove_ui(self):
        manager = self.window.get_ui_manager()
        manager.remove_ui(self._ui_merge_id)
        manager.remove_action_group(self._actions)
        manager.ensure_update()

出典:

http://natural966.wordpress.com/2012/08/19/my-linespacing-plugin-for-gedit-3/

http://www.micahcarrick.com/writing-plugins-for-gedit-3-in-python.html

https://wiki.gnome.org/Projects/Vala/Gedit3PluginSample

答え2

gedit 3の行間調整用の小さなプラグインを作成しました

gedit プラグインの行間

'linespaces.plugin' と 'linespaces.py' をダウンロードし、 '~/.local/share/gedit/plugins/' に移動します。

'linespaces.py' で 'pixels' を設定します

実行してgedit設定 -> プラグイン -> 行間を選択

関連情報