Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Initial commit

  • Loading branch information...
commit 02c0ba823c0ebcbe995538a04cc69573b0df142f 0 parents
David Lynch authored March 17, 2009
9  smarthome.gedit-plugin
... ...
@@ -0,0 +1,9 @@
  1
+[Gedit Plugin]
  2
+Loader=python
  3
+Module=smarthome
  4
+IAge=2
  5
+Name=Smart Home
  6
+Description=Make HOME and END keys move to first/last characters on line first before going to the start/end of the line.
  7
+Authors=David Lynch <kemayo@gmail.com>
  8
+Copyright=Copyright © 2009 David Lynch <kemayo@gmail.com>
  9
+Website=http://github.com/kemayo/gedit-smarthome
40  smarthome.py
... ...
@@ -0,0 +1,40 @@
  1
+# -*- coding: utf-8 ts: 4 -*-
  2
+#
  3
+# Make HOME and END keys move to first/last characters on line first before
  4
+# going to the start/end of the line. (It's just a gksourceview2 property.)
  5
+#
  6
+# Copyright (C) 2009 David Lynch (kemayo@gmail.com)
  7
+#
  8
+#	This program is free software: you can redistribute it and/or modify
  9
+#	it under the terms of the GNU General Public License as published by
  10
+#	the Free Software Foundation, either version 3 of the License, or
  11
+#	(at your option) any later version.
  12
+
  13
+#	This program is distributed in the hope that it will be useful,
  14
+#	but WITHOUT ANY WARRANTY; without even the implied warranty of
  15
+#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
  16
+#	GNU General Public License for more details.
  17
+
  18
+#	You should have received a copy of the GNU General Public License
  19
+#	along with this program.	If not, see <http://www.gnu.org/licenses/>.
  20
+
  21
+import gedit
  22
+
  23
+
  24
+class SmartHome(gedit.Plugin):
  25
+
  26
+	def activate(self, window):
  27
+		for view in window.get_views():
  28
+			view.set_smart_home_end(True)
  29
+
  30
+		tab_added_id = window.connect("tab_added", lambda w, t: t.get_view().set_smart_home_end(True))
  31
+		window.set_data("SmartHomePluginHandlerId", tab_added_id)
  32
+
  33
+	def deactivate(self, window):
  34
+		tab_added_id = window.get_data("SmartHomePluginHandlerId")
  35
+		window.disconnect(tab_added_id)
  36
+		window.set_data("SmartHomePluginHandlerId", None)
  37
+
  38
+		for view in window.get_views():
  39
+			view.set_smart_home_end(False)
  40
+

0 notes on commit 02c0ba8

Please sign in to comment.
Something went wrong with that request. Please try again.