Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit

  • Loading branch information...
commit 02c0ba823c0ebcbe995538a04cc69573b0df142f 0 parents
@kemayo authored
Showing with 49 additions and 0 deletions.
  1. +9 −0 smarthome.gedit-plugin
  2. +40 −0 smarthome.py
9 smarthome.gedit-plugin
@@ -0,0 +1,9 @@
+[Gedit Plugin]
+Loader=python
+Module=smarthome
+IAge=2
+Name=Smart Home
+Description=Make HOME and END keys move to first/last characters on line first before going to the start/end of the line.
+Authors=David Lynch <kemayo@gmail.com>
+Copyright=Copyright © 2009 David Lynch <kemayo@gmail.com>
+Website=http://github.com/kemayo/gedit-smarthome
40 smarthome.py
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 ts: 4 -*-
+#
+# Make HOME and END keys move to first/last characters on line first before
+# going to the start/end of the line. (It's just a gksourceview2 property.)
+#
+# Copyright (C) 2009 David Lynch (kemayo@gmail.com)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import gedit
+
+
+class SmartHome(gedit.Plugin):
+
+ def activate(self, window):
+ for view in window.get_views():
+ view.set_smart_home_end(True)
+
+ tab_added_id = window.connect("tab_added", lambda w, t: t.get_view().set_smart_home_end(True))
+ window.set_data("SmartHomePluginHandlerId", tab_added_id)
+
+ def deactivate(self, window):
+ tab_added_id = window.get_data("SmartHomePluginHandlerId")
+ window.disconnect(tab_added_id)
+ window.set_data("SmartHomePluginHandlerId", None)
+
+ for view in window.get_views():
+ view.set_smart_home_end(False)
+
Please sign in to comment.
Something went wrong with that request. Please try again.