[gedit-plugins] Added GPL and PEP-8 to all commander modules



commit c3b6d7319c698479cff0514c8cd382014acf5ed6
Author: Jesse van den Kieboom <jesse icecrew nl>
Date:   Sun Aug 29 14:21:45 2010 +0200

    Added GPL and PEP-8 to all commander modules

 plugins/commander/modules/align.py         |  303 ++++++++++---------
 plugins/commander/modules/bookmark.py      |   63 +++--
 plugins/commander/modules/doc.py           |  285 ++++++++++--------
 plugins/commander/modules/edit.py          |  266 +++++++++--------
 plugins/commander/modules/find/__init__.py |   83 ++++--
 plugins/commander/modules/find/finder.py   |  455 +++++++++++++++-------------
 plugins/commander/modules/find/regex.py    |  263 +++++++++--------
 plugins/commander/modules/find/test.py     |   62 ++--
 plugins/commander/modules/format.py        |  145 +++++----
 plugins/commander/modules/goto.py          |   68 +++--
 plugins/commander/modules/help.py          |   75 +++--
 plugins/commander/modules/move.py          |  129 +++++----
 plugins/commander/modules/reload.py        |   43 ++-
 plugins/commander/modules/set.py           |  173 ++++++-----
 plugins/commander/modules/shell.py         |  224 ++++++++------
 15 files changed, 1479 insertions(+), 1158 deletions(-)
---
diff --git a/plugins/commander/modules/align.py b/plugins/commander/modules/align.py
index a9d81f9..c335fe6 100644
--- a/plugins/commander/modules/align.py
+++ b/plugins/commander/modules/align.py
@@ -1,3 +1,24 @@
+# -*- coding: utf-8 -*-
+#
+#  align.py - align commander module
+#
+#  Copyright (C) 2010 - Jesse van den Kieboom
+#
+#  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 2 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, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330,
+#  Boston, MA 02111-1307, USA.
+
 import commander.commands as commands
 import commander.commands.completion
 import commander.commands.result
@@ -8,204 +29,204 @@ import re
 __commander_module__ = True
 
 class Line:
-	def __init__(self, line, reg, tabwidth):
-		self.tabwidth = tabwidth
-		self.line = line
-		self.matches = list(reg.finditer(line))
+    def __init__(self, line, reg, tabwidth):
+        self.tabwidth = tabwidth
+        self.line = line
+        self.matches = list(reg.finditer(line))
 
-		if not self.matches:
-			self.newline = str(line)
-		else:
-			self.newline = line[0:self.matches[0].start(0)]
+        if not self.matches:
+            self.newline = str(line)
+        else:
+            self.newline = line[0:self.matches[0].start(0)]
 
-	def matches_len(self):
-		return len(self.matches)
+    def matches_len(self):
+        return len(self.matches)
 
-	def new_len(self, extra=''):
-		return len((self.newline + extra).expandtabs(self.tabwidth))
+    def new_len(self, extra=''):
+        return len((self.newline + extra).expandtabs(self.tabwidth))
 
-	def match(self, idx):
-		if idx >= self.matches_len():
-			return None
+    def match(self, idx):
+        if idx >= self.matches_len():
+            return None
 
-		return self.matches[idx]
+        return self.matches[idx]
 
-	def append(self, idx, num, group, add_ws_group):
-		m = self.match(idx)
+    def append(self, idx, num, group, add_ws_group):
+        m = self.match(idx)
 
-		if m == None:
-			return
+        if m == None:
+            return
 
-		if len(m.groups()) <= group - 1:
-			gidx = 0
-		else:
-			gidx = group
+        if len(m.groups()) <= group - 1:
+            gidx = 0
+        else:
+            gidx = group
 
-		if len(m.groups()) <= add_ws_group - 1:
-			wsidx = 0
-		else:
-			wsidx = add_ws_group
+        if len(m.groups()) <= add_ws_group - 1:
+            wsidx = 0
+        else:
+            wsidx = add_ws_group
 
-		if wsidx > gidx:
-			wsidx = gidx
+        if wsidx > gidx:
+            wsidx = gidx
 
-		# First append leading match
-		wsg = m.group(wsidx)
-		numln = len(wsg) - len(wsg.lstrip())
+        # First append leading match
+        wsg = m.group(wsidx)
+        numln = len(wsg) - len(wsg.lstrip())
 
-		self.newline += self.line[m.start(0):m.start(wsidx)]
+        self.newline += self.line[m.start(0):m.start(wsidx)]
 
-		# Then do the indent until gidx is aligned with num
-		bridge = self.line[m.start(wsidx) + numln:m.start(gidx)]
+        # Then do the indent until gidx is aligned with num
+        bridge = self.line[m.start(wsidx) + numln:m.start(gidx)]
 
-		if not '\t' in bridge:
-			bridge = (' ' * (num - self.new_len(bridge))) + bridge
-		else:
-			while self.new_len(bridge) < num:
-				bridge = ' ' + bridge
+        if not '\t' in bridge:
+            bridge = (' ' * (num - self.new_len(bridge))) + bridge
+        else:
+            while self.new_len(bridge) < num:
+                bridge = ' ' + bridge
 
-		self.newline += bridge
+        self.newline += bridge
 
-		# Then append the rest of the match
-		mnext = self.match(idx + 1)
+        # Then append the rest of the match
+        mnext = self.match(idx + 1)
 
-		if mnext == None:
-			endidx = None
-		else:
-			endidx = mnext.start(0)
+        if mnext == None:
+            endidx = None
+        else:
+            endidx = mnext.start(0)
 
-		self.newline += self.line[m.start(gidx):endidx]
+        self.newline += self.line[m.start(gidx):endidx]
 
-	def __str__(self):
-		return self.newline
+    def __str__(self):
+        return self.newline
 
 def __default__(view):
-	"""Align selected text in columns: align
+    """Align selected text in columns: align
 
 Align the selected text in columns separated by white space (spaces and tabs)"""
-	yield regex(view, '\s+')
+    yield regex(view, '\s+')
 
 def _find_max_align(lines, idx, group, add_ws_group):
-	num = 0
-	spaces = re.compile('^\s*')
+    num = 0
+    spaces = re.compile('^\s*')
 
-	# We will align on 'group', by adding spaces to 'add_ws_group'
-	for line in lines:
-		m = line.match(idx)
+    # We will align on 'group', by adding spaces to 'add_ws_group'
+    for line in lines:
+        m = line.match(idx)
 
-		if m != None:
-			if len(m.groups()) <= group - 1:
-				gidx = 0
-			else:
-				gidx = group
+        if m != None:
+            if len(m.groups()) <= group - 1:
+                gidx = 0
+            else:
+                gidx = group
 
-			if len(m.groups()) <= add_ws_group - 1:
-				wsidx = 0
-			else:
-				wsidx = add_ws_group
+            if len(m.groups()) <= add_ws_group - 1:
+                wsidx = 0
+            else:
+                wsidx = add_ws_group
 
-			if wsidx > gidx:
-				wsidx = gidx
+            if wsidx > gidx:
+                wsidx = gidx
 
-			wsg = m.group(wsidx)
+            wsg = m.group(wsidx)
 
-			numln = len(wsg) - len(wsg.lstrip())
+            numln = len(wsg) - len(wsg.lstrip())
 
-			# until the start
-			extra = line.line[m.start(0):m.start(wsidx)]
-			extra += line.line[m.start(wsidx) + numln:m.start(gidx)]
+            # until the start
+            extra = line.line[m.start(0):m.start(wsidx)]
+            extra += line.line[m.start(wsidx) + numln:m.start(gidx)]
 
-			# Measure where to align it
-			l = line.new_len(extra)
-		else:
-			l = line.new_len()
+            # Measure where to align it
+            l = line.new_len(extra)
+        else:
+            l = line.new_len()
 
-		if l > num:
-			num = l
+        if l > num:
+            num = l
 
-	return num
+    return num
 
 def _regex(view, reg, group, additional_ws, add_ws_group, flags=0):
-	buf = view.get_buffer()
+    buf = view.get_buffer()
 
-	bounds = buf.get_selection_bounds()
+    bounds = buf.get_selection_bounds()
 
-	if not bounds or (bounds[1].get_line() - bounds[0].get_line() == 0):
-		raise commander.commands.exceptions.Execute('You need to select a number of lines to align')
+    if not bounds or (bounds[1].get_line() - bounds[0].get_line() == 0):
+        raise commander.commands.exceptions.Execute('You need to select a number of lines to align')
 
-	if reg == None:
-		reg, words, modifier = (yield commander.commands.result.Prompt('Regex:'))
+    if reg == None:
+        reg, words, modifier = (yield commander.commands.result.Prompt('Regex:'))
 
-	try:
-		reg = re.compile(reg, flags)
-	except Exception, e:
-		raise commander.commands.exceptions.Execute('Failed to compile regular expression: %s' % (e,))
+    try:
+        reg = re.compile(reg, flags)
+    except Exception, e:
+        raise commander.commands.exceptions.Execute('Failed to compile regular expression: %s' % (e,))
 
-	if group == None:
-		group, words, modifier = (yield commander.commands.result.Prompt('Group (1):'))
+    if group == None:
+        group, words, modifier = (yield commander.commands.result.Prompt('Group (1):'))
 
-	try:
-		group = int(group)
-	except:
-		group = 1
+    try:
+        group = int(group)
+    except:
+        group = 1
 
-	if additional_ws == None:
-		additional_ws, words, modifier = (yield commander.commands.result.Prompt('Additional Whitespace (0):'))
+    if additional_ws == None:
+        additional_ws, words, modifier = (yield commander.commands.result.Prompt('Additional Whitespace (0):'))
 
-	try:
-		additional_ws = int(additional_ws)
-	except:
-		additional_ws = 0
+    try:
+        additional_ws = int(additional_ws)
+    except:
+        additional_ws = 0
 
-	if add_ws_group == None:
-		add_ws_group, words, modifier = (yield commander.commands.result.Prompt('Group (1):'))
+    if add_ws_group == None:
+        add_ws_group, words, modifier = (yield commander.commands.result.Prompt('Group (1):'))
 
-	try:
-		add_ws_group = int(add_ws_group)
-	except:
-		add_ws_group = -1
+    try:
+        add_ws_group = int(add_ws_group)
+    except:
+        add_ws_group = -1
 
-	if add_ws_group < 0:
-		add_ws_group = group
+    if add_ws_group < 0:
+        add_ws_group = group
 
-	start, end = bounds
+    start, end = bounds
 
-	if not start.starts_line():
-		start.set_line_offset(0)
+    if not start.starts_line():
+        start.set_line_offset(0)
 
-	if not end.ends_line():
-		end.forward_to_line_end()
+    if not end.ends_line():
+        end.forward_to_line_end()
 
-	lines = start.get_text(end).splitlines()
-	newlines = []
-	num = 0
-	tabwidth = view.get_tab_width()
+    lines = start.get_text(end).splitlines()
+    newlines = []
+    num = 0
+    tabwidth = view.get_tab_width()
 
-	for line in lines:
-		ln = Line(line, reg, tabwidth)
-		newlines.append(ln)
+    for line in lines:
+        ln = Line(line, reg, tabwidth)
+        newlines.append(ln)
 
-		if len(ln.matches) > num:
-			num = len(ln.matches)
+        if len(ln.matches) > num:
+            num = len(ln.matches)
 
-	for i in range(num):
-		al = _find_max_align(newlines, i, group, add_ws_group)
+    for i in range(num):
+        al = _find_max_align(newlines, i, group, add_ws_group)
 
-		for line in newlines:
-			line.append(i, al + additional_ws, group, add_ws_group)
+        for line in newlines:
+            line.append(i, al + additional_ws, group, add_ws_group)
 
-	# Replace lines
-	aligned = '\n'.join([str(x) for x in newlines])
+    # Replace lines
+    aligned = '\n'.join([str(x) for x in newlines])
 
-	buf.begin_user_action()
-	buf.delete(bounds[0], bounds[1])
-	buf.insert(bounds[1], aligned)
-	buf.end_user_action()
+    buf.begin_user_action()
+    buf.delete(bounds[0], bounds[1])
+    buf.insert(bounds[1], aligned)
+    buf.end_user_action()
 
-	yield commander.commands.result.DONE
+    yield commander.commands.result.DONE
 
 def regex(view, reg=None, group=1, additional_ws=1, add_ws_group=-1):
-	"""Align selected in columns using a regular expression: align.regex [&lt;regex&gt;] [&lt;group&gt;] [&lt;ws&gt;]
+    """Align selected in columns using a regular expression: align.regex [&lt;regex&gt;] [&lt;group&gt;] [&lt;ws&gt;]
 
 Align the selected text in columns separated by the specified regular expression.
 The optional group argument specifies on which group in the regular expression
@@ -215,10 +236,10 @@ be used to add additional whitespace to the column separation.
 
 The regular expression will be matched in case-sensitive mode"""
 
-	yield _regex(view, reg, group, additional_ws, add_ws_group)
+    yield _regex(view, reg, group, additional_ws, add_ws_group)
 
 def regex_i(view, reg=None, group=1, additional_ws=1, add_ws_group=-1):
-	"""Align selected in columns using a regular expression: align.regex [&lt;regex&gt;] [&lt;group&gt;] [&lt;ws&gt;]
+    """Align selected in columns using a regular expression: align.regex [&lt;regex&gt;] [&lt;group&gt;] [&lt;ws&gt;]
 
 Align the selected text in columns separated by the specified regular expression.
 The optional group argument specifies on which group in the regular expression
@@ -228,4 +249,6 @@ be used to add additional whitespace to the column separation.
 
 The regular expression will be matched in case-insensitive mode"""
 
-	yield _regex(view, reg, group, additional_ws, add_ws_group, re.IGNORECASE)
+    yield _regex(view, reg, group, additional_ws, add_ws_group, re.IGNORECASE)
+
+# vi:ex:ts=4:et
diff --git a/plugins/commander/modules/bookmark.py b/plugins/commander/modules/bookmark.py
index 45f5709..7e47add 100644
--- a/plugins/commander/modules/bookmark.py
+++ b/plugins/commander/modules/bookmark.py
@@ -1,62 +1,85 @@
+# -*- coding: utf-8 -*-
+#
+#  bookmark.py - bookmark interface commander module
+#
+#  Copyright (C) 2010 - Jesse van den Kieboom
+#
+#  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 2 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, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330,
+#  Boston, MA 02111-1307, USA.
+
 import commander.commands
 import commander.commands.exceptions
 
 __commander_module__ = True
 
 def check_bookmark_plugin(window):
-	if not window.get_message_bus().is_registered('/plugins/bookmarks', 'toggle'):
-		raise commander.commands.exceptions.Execute("The bookmarks plugin is not installed, not active or too old")
+    if not window.get_message_bus().is_registered('/plugins/bookmarks', 'toggle'):
+        raise commander.commands.exceptions.Execute("The bookmarks plugin is not installed, not active or too old")
 
 def __default__(view, window):
-	"""Commander interface to the bookmarks plugin: bookmark
+    """Commander interface to the bookmarks plugin: bookmark
 
 This module provides an interface to the bookmarks plugin from gedit-plugins.
 If installed and active, you can add/remove/toggle bookmarks using the
 commander."""
 
-	check_bookmark_plugin(window)
-	window.get_message_bus().send('/plugins/bookmarks', 'toggle', view=view)
+    check_bookmark_plugin(window)
+    window.get_message_bus().send('/plugins/bookmarks', 'toggle', view=view)
 
 def add(view, window):
-	"""Add bookmark: bookmark.add
+    """Add bookmark: bookmark.add
 
 Add bookmark on the current line. If there already is a bookmark on the current
 line, nothing happens."""
 
-	check_bookmark_plugin(window)
-	window.get_message_bus().send('/plugins/bookmarks', 'add', view=view)
+    check_bookmark_plugin(window)
+    window.get_message_bus().send('/plugins/bookmarks', 'add', view=view)
 
 def remove(view, window):
-	"""Remove bookmark: bookmark.remove
+    """Remove bookmark: bookmark.remove
 
 Remove bookmark from the current line. If there is no bookmark on the current
 line, nothing happens."""
 
-	check_bookmark_plugin(window)
-	window.get_message_bus().send('/plugins/bookmarks', 'remove', view=view)
+    check_bookmark_plugin(window)
+    window.get_message_bus().send('/plugins/bookmarks', 'remove', view=view)
 
 def toggle(view, window):
-	"""Toggle bookmark: bookmark.toggle
+    """Toggle bookmark: bookmark.toggle
 
 Toggle bookmark on the current line."""
 
-	check_bookmark_plugin(window)
-	window.get_message_bus().send('/plugins/bookmarks', 'toggle', view=view)
+    check_bookmark_plugin(window)
+    window.get_message_bus().send('/plugins/bookmarks', 'toggle', view=view)
 
 def next(view, window):
-	"""Goto next bookmark: bookmark.next
+    """Goto next bookmark: bookmark.next
 
 Jump to the next bookmark location"""
 
-	check_bookmark_plugin(window)
+    check_bookmark_plugin(window)
 
-	window.get_message_bus().send('/plugins/bookmarks', 'goto_next', view=view)
+    window.get_message_bus().send('/plugins/bookmarks', 'goto_next', view=view)
 
 def previous(view, window):
-	"""Goto previous bookmark: bookmark.previous
+    """Goto previous bookmark: bookmark.previous
 
 Jump to the previous bookmark location"""
 
-	check_bookmark_plugin(window)
+    check_bookmark_plugin(window)
+
+    window.get_message_bus().send('/plugins/bookmarks', 'goto_previous', view=view)
 
-	window.get_message_bus().send('/plugins/bookmarks', 'goto_previous', view=view)
+# vi:ex:ts=4:et
diff --git a/plugins/commander/modules/doc.py b/plugins/commander/modules/doc.py
index 3bbf307..16eb1fe 100644
--- a/plugins/commander/modules/doc.py
+++ b/plugins/commander/modules/doc.py
@@ -1,3 +1,24 @@
+# -*- coding: utf-8 -*-
+#
+#  doc.py - doc commander module
+#
+#  Copyright (C) 2010 - Jesse van den Kieboom
+#
+#  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 2 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, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330,
+#  Boston, MA 02111-1307, USA.
+
 import commander.commands as commands
 import commander.commands.completion
 import commander.commands.result
@@ -7,210 +28,212 @@ import re
 __commander_module__ = True
 
 class Argument:
-	def __init__(self, argtype, typename, name):
-		self.type = argtype.strip()
-		self.type_name = typename.strip()
-		self.name = name.strip()
+    def __init__(self, argtype, typename, name):
+        self.type = argtype.strip()
+        self.type_name = typename.strip()
+        self.name = name.strip()
 
 class Function:
-	def __init__(self, text):
-		self._parse(text)
+    def __init__(self, text):
+        self._parse(text)
 
-	def _parse(self, text):
-		self.valid = False
+    def _parse(self, text):
+        self.valid = False
 
-		parser = re.compile('^\\s*(?:(?:\\b(?:static|inline)\\b)\\s+)?(([a-z_:][a-z0-9_:<>]*)(?:\\s*(?:\\b(?:const)\\b)\\s*)?\\s*[*&]*\\s+)?([a-z_][a-z0-9_:~]*)\\s*\\(([^)]*)\\)(\\s*const)?', re.I)
+        parser = re.compile('^\\s*(?:(?:\\b(?:static|inline)\\b)\\s+)?(([a-z_:][a-z0-9_:<>]*)(?:\\s*(?:\\b(?:const)\\b)\\s*)?\\s*[*&]*\\s+)?([a-z_][a-z0-9_:~]*)\\s*\\(([^)]*)\\)(\\s*const)?', re.I)
 
-		m = parser.match(text)
+        m = parser.match(text)
 
-		if not m:
-			return
+        if not m:
+            return
 
-		self.valid = True
+        self.valid = True
 
-		self.return_type = m.group(1) and m.group(1).strip() != 'void' and m.group(1).strip()
-		self.return_type_name = self.return_type and m.group(2).strip()
+        self.return_type = m.group(1) and m.group(1).strip() != 'void' and m.group(1).strip()
+        self.return_type_name = self.return_type and m.group(2).strip()
 
-		parts = m.group(3).split('::')
-		self.name = parts[-1]
+        parts = m.group(3).split('::')
+        self.name = parts[-1]
 
-		if len(parts) > 1:
-			self.classname = '::'.join(parts[0:-1])
-		else:
-			self.classname = None
+        if len(parts) > 1:
+            self.classname = '::'.join(parts[0:-1])
+        else:
+            self.classname = None
 
-		self.constructor = self.name == self.classname
-		self.destructor = self.name == '~%s' % (self.classname,)
+        self.constructor = self.name == self.classname
+        self.destructor = self.name == '~%s' % (self.classname,)
 
-		self.const = m.group(5) != None
-		self.args = []
+        self.const = m.group(5) != None
+        self.args = []
 
-		argre = re.compile('(([a-z_:][a-z0-9_:<>]*)(?:\\s*(?:\\s*\\bconst\\b\\s*|[*&])\s*)*)\\s*([a-z_][a-z_0-9]*)$', re.I)
+        argre = re.compile('(([a-z_:][a-z0-9_:<>]*)(?:\\s*(?:\\s*\\bconst\\b\\s*|[*&])\s*)*)\\s*([a-z_][a-z_0-9]*)$', re.I)
 
-		for arg in m.group(4).split(','):
-			arg = arg.strip()
+        for arg in m.group(4).split(','):
+            arg = arg.strip()
 
-			if arg == 'void' or arg == '':
-				continue
-			else:
-				m2 = argre.match(arg.strip())
+            if arg == 'void' or arg == '':
+                continue
+            else:
+                m2 = argre.match(arg.strip())
 
-				if not m2:
-					self.valid = False
-					return
+                if not m2:
+                    self.valid = False
+                    return
 
-				arg = Argument(m2.group(1), m2.group(2), m2.group(3))
+                arg = Argument(m2.group(1), m2.group(2), m2.group(3))
 
-			self.args.append(arg)
+            self.args.append(arg)
 
 class Documenter:
-	def __init__(self, window, view, iter):
-		self.window = window
-		self.view = view
-		self.iter = iter
+    def __init__(self, window, view, iter):
+        self.window = window
+        self.view = view
+        self.iter = iter
 
-		bus = self.window.get_message_bus()
+        bus = self.window.get_message_bus()
 
-		self.canplaceholder = bus.lookup('/plugins/snippets', 'parse-and-activate') != None
-		self.placeholder = 1
-		self.text = ''
+        self.canplaceholder = bus.lookup('/plugins/snippets', 'parse-and-activate') != None
+        self.placeholder = 1
+        self.text = ''
 
-	def append(self, *args):
-		for text in args:
-			self.text += str(text)
+    def append(self, *args):
+        for text in args:
+            self.text += str(text)
 
-		return self
+        return self
 
-	def append_placeholder(self, *args):
-		if not self.canplaceholder:
-			return self.append(*args)
+    def append_placeholder(self, *args):
+        if not self.canplaceholder:
+            return self.append(*args)
 
-		text = " ".join(map(lambda x: str(x), args))
-		self.text += "${%d:%s}" % (self.placeholder, text)
-		self.placeholder += 1
+        text = " ".join(map(lambda x: str(x), args))
+        self.text += "${%d:%s}" % (self.placeholder, text)
+        self.placeholder += 1
 
-		return self
+        return self
 
-	def insert(self):
-		if self.canplaceholder:
-			bus = self.window.get_message_bus()
-			bus.send('/plugins/snippets', 'parse-and-activate', snippet=self.text, iter=self.iter, view=self.view)
+    def insert(self):
+        if self.canplaceholder:
+            bus = self.window.get_message_bus()
+            bus.send('/plugins/snippets', 'parse-and-activate', snippet=self.text, iter=self.iter, view=self.view)
 
 def _make_documenter(window, view):
-	buf = view.get_buffer()
+    buf = view.get_buffer()
 
-	bus = window.get_message_bus()
-	canplaceholder = bus.lookup('/plugins/snippets', 'parse-and-activate') != None
+    bus = window.get_message_bus()
+    canplaceholder = bus.lookup('/plugins/snippets', 'parse-and-activate') != None
 
-	insert = buf.get_iter_at_mark(buf.get_insert())
-	insert.set_line_offset(0)
+    insert = buf.get_iter_at_mark(buf.get_insert())
+    insert.set_line_offset(0)
 
-	offset = insert.get_offset()
+    offset = insert.get_offset()
 
-	end = insert.copy()
+    end = insert.copy()
 
-	# This is just something random
-	if not end.forward_chars(500):
-		end = buf.get_end_iter()
+    # This is just something random
+    if not end.forward_chars(500):
+        end = buf.get_end_iter()
 
-	text = insert.get_text(end)
-	func = Function(text)
+    text = insert.get_text(end)
+    func = Function(text)
 
-	if not func.valid:
-		raise commander.commands.exceptions.Execute('Could not find function specification')
+    if not func.valid:
+        raise commander.commands.exceptions.Execute('Could not find function specification')
 
-	doc = Documenter(window, view, insert)
-	return doc, func
+    doc = Documenter(window, view, insert)
+    return doc, func
 
 def gtk(window, view):
-	"""Generate gtk-doc documentation: doc.gtk
+    """Generate gtk-doc documentation: doc.gtk
 
 Generate a documentation template for the C or C++ function defined at the
 cursor. The cursor needs to be on the first line of the function declaration
 for it to work."""
 
-	buf = view.get_buffer()
-	lang = buf.get_language()
+    buf = view.get_buffer()
+    lang = buf.get_language()
 
-	if not lang or not lang.get_id() in ('c', 'chdr', 'cpp'):
-		raise commander.commands.exceptions.Execute('Don\'t know about this language')
+    if not lang or not lang.get_id() in ('c', 'chdr', 'cpp'):
+        raise commander.commands.exceptions.Execute('Don\'t know about this language')
 
-	doc, func = _make_documenter(window, view)
+    doc, func = _make_documenter(window, view)
 
-	# Generate docstring for this function
-	doc.append("/**\n * ", func.name, ":\n")
-	structp = re.compile('([A-Z]+[a-zA-Z]*)|struct\s+_([A-Z]+[a-zA-Z]*)')
+    # Generate docstring for this function
+    doc.append("/**\n * ", func.name, ":\n")
+    structp = re.compile('([A-Z]+[a-zA-Z]*)|struct\s+_([A-Z]+[a-zA-Z]*)')
 
-	for arg in func.args:
-		sm = structp.match(arg.type_name)
-		doc.append(" * @", arg.name, ": ")
+    for arg in func.args:
+        sm = structp.match(arg.type_name)
+        doc.append(" * @", arg.name, ": ")
 
-		if sm:
-			doc.append_placeholder("A #%s" % (sm.group(1) or sm.group(2),))
-		else:
-			doc.append_placeholder("Description")
+        if sm:
+            doc.append_placeholder("A #%s" % (sm.group(1) or sm.group(2),))
+        else:
+            doc.append_placeholder("Description")
 
-		doc.append("\n")
+        doc.append("\n")
 
-	doc.append(" * \n * ").append_placeholder("Description").append(".\n")
+    doc.append(" * \n * ").append_placeholder("Description").append(".\n")
 
-	if func.return_type:
-		sm = structp.match(func.return_type_name)
-		doc.append(" *\n * Returns: ")
+    if func.return_type:
+        sm = structp.match(func.return_type_name)
+        doc.append(" *\n * Returns: ")
 
-		if sm:
-			doc.append_placeholder("A #%s" % (sm.group(1) or sm.group(2),))
-		else:
-			doc.append_placeholder("Description")
+        if sm:
+            doc.append_placeholder("A #%s" % (sm.group(1) or sm.group(2),))
+        else:
+            doc.append_placeholder("Description")
 
-		doc.append("\n")
+        doc.append("\n")
 
-	doc.append(" *\n **/\n")
-	doc.insert()
+    doc.append(" *\n **/\n")
+    doc.insert()
 
 def doxygen(window, view):
-	"""Generate doxygen documentation: doc.doxygen
+    """Generate doxygen documentation: doc.doxygen
 
 Generate a documentation template for the function defined at the
 cursor. The cursor needs to be on the first line of the function declaration
 for it to work."""
 
-	buf = view.get_buffer()
+    buf = view.get_buffer()
+
+    if not buf.get_language().get_id() in ('c', 'chdr', 'cpp'):
+        raise commander.commands.exceptions.Execute('Don\'t know about this language')
 
-	if not buf.get_language().get_id() in ('c', 'chdr', 'cpp'):
-		raise commander.commands.exceptions.Execute('Don\'t know about this language')
+    doc, func = _make_documenter(window, view)
 
-	doc, func = _make_documenter(window, view)
+    # Generate docstring for this function
+    doc.append("/** \\brief ").append_placeholder("Short description")
 
-	# Generate docstring for this function
-	doc.append("/** \\brief ").append_placeholder("Short description")
+    if func.const:
+        doc.append(" (const)")
 
-	if func.const:
-		doc.append(" (const)")
+    doc.append(".\n")
 
-	doc.append(".\n")
+    for arg in func.args:
+        doc.append(" * @param ", arg.name, " ").append_placeholder("Description").append("\n")
 
-	for arg in func.args:
-		doc.append(" * @param ", arg.name, " ").append_placeholder("Description").append("\n")
+    doc.append(" *\n * ")
 
-	doc.append(" *\n * ")
+    if func.constructor:
+        doc.append("Constructor.\n *\n * ")
+    elif func.destructor:
+        doc.append("Destructor.\n *\n * ")
 
-	if func.constructor:
-		doc.append("Constructor.\n *\n * ")
-	elif func.destructor:
-		doc.append("Destructor.\n *\n * ")
+    doc.append_placeholder("Detailed description").append(".\n")
 
-	doc.append_placeholder("Detailed description").append(".\n")
+    if func.return_type:
+        doc.append(" *\n * @return: ")
 
-	if func.return_type:
-		doc.append(" *\n * @return: ")
+        if func.return_type == 'bool':
+            doc.append("true if ").append_placeholder("Description").append(", false otherwise")
+        else:
+            doc.append_placeholder("Description")
 
-		if func.return_type == 'bool':
-			doc.append("true if ").append_placeholder("Description").append(", false otherwise")
-		else:
-			doc.append_placeholder("Description")
+        doc.append("\n")
 
-		doc.append("\n")
+    doc.append(" *\n */\n")
+    doc.insert()
 
-	doc.append(" *\n */\n")
-	doc.insert()
+# vi:ex:ts=4:et
diff --git a/plugins/commander/modules/edit.py b/plugins/commander/modules/edit.py
index a6163c2..55688ea 100644
--- a/plugins/commander/modules/edit.py
+++ b/plugins/commander/modules/edit.py
@@ -1,4 +1,24 @@
-"""Edit files or commands"""
+# -*- coding: utf-8 -*-
+#
+#  edit.py - edit commander module
+#
+#  Copyright (C) 2010 - Jesse van den Kieboom
+#
+#  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 2 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, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330,
+#  Boston, MA 02111-1307, USA.
+
 import os
 import gio
 import gedit
@@ -17,157 +37,157 @@ __commander_module__ = True
 
 @commands.autocomplete(filename=commander.commands.completion.filename)
 def __default__(filename, view):
-	"""Edit file: edit &lt;filename&gt;"""
+    """Edit file: edit &lt;filename&gt;"""
 
-	doc = view.get_buffer()
-	cwd = os.getcwd()
+    doc = view.get_buffer()
+    cwd = os.getcwd()
 
-	if not doc.is_untitled():
-		cwd = doc.get_location().get_parent().get_path()
-	else:
-		cwd = os.path.expanduser('~/')
+    if not doc.is_untitled():
+        cwd = doc.get_location().get_parent().get_path()
+    else:
+        cwd = os.path.expanduser('~/')
 
-	if not os.path.isabs(filename):
-		filename = os.path.join(cwd, filename)
+    if not os.path.isabs(filename):
+        filename = os.path.join(cwd, filename)
 
-	matches = glob.glob(filename)
-	files = []
+    matches = glob.glob(filename)
+    files = []
 
-	if matches:
-		for match in matches:
-			files.append(gio.File(match))
-	else:
-		files.append(gio.File(filename))
+    if matches:
+        for match in matches:
+            files.append(gio.File(match))
+    else:
+        files.append(gio.File(filename))
 
-	if files:
-		window = view.get_toplevel()
-		gedit.commands.load_locations(window, files)
+    if files:
+        window = view.get_toplevel()
+        gedit.commands.load_locations(window, files)
 
-	return commander.commands.result.HIDE
+    return commander.commands.result.HIDE
 
 def _dummy_cb(num, total):
-	pass
+    pass
 
 @commands.autocomplete(newfile=commander.commands.completion.filename)
 def rename(view, newfile):
-	"""Rename current file: edit.rename &lt;newname&gt;"""
+    """Rename current file: edit.rename &lt;newname&gt;"""
 
-	doc = view.get_buffer()
+    doc = view.get_buffer()
 
-	if not hasattr(doc, 'set_location'):
-		raise commander.commands.exceptions.Execute('Your version of gedit does not support this action')
+    if not hasattr(doc, 'set_location'):
+        raise commander.commands.exceptions.Execute('Your version of gedit does not support this action')
 
-	if doc.is_untitled():
-		raise commander.commands.exceptions.Execute('Document is unsaved and thus cannot be renamed')
+    if doc.is_untitled():
+        raise commander.commands.exceptions.Execute('Document is unsaved and thus cannot be renamed')
 
-	if doc.get_modified():
-		raise commander.commands.exceptions.Execute('You have unsaved changes in your document')
+    if doc.get_modified():
+        raise commander.commands.exceptions.Execute('You have unsaved changes in your document')
 
-	if not doc.is_local():
-		raise commander.commands.exceptions.Execute('You can only rename local files')
+    if not doc.is_local():
+        raise commander.commands.exceptions.Execute('You can only rename local files')
 
-	f = doc.get_location()
+    f = doc.get_location()
 
-	if not f.query_exists():
-		raise commander.commands.exceptions.Execute('Current document file does not exist')
+    if not f.query_exists():
+        raise commander.commands.exceptions.Execute('Current document file does not exist')
 
-	if os.path.isabs(newfile):
-		dest = gio.File(newfile)
-	else:
-		dest = f.get_parent().resolve_relative_path(newfile)
+    if os.path.isabs(newfile):
+        dest = gio.File(newfile)
+    else:
+        dest = f.get_parent().resolve_relative_path(newfile)
 
-	if f.equal(dest):
-		yield commander.commands.result.HIDE
+    if f.equal(dest):
+        yield commander.commands.result.HIDE
 
-	if not dest.get_parent().query_exists():
-		# Check to create parent directory
-		fstr, words, modifierret = (yield commands.result.Prompt('Directory does not exist, create? [Y/n] '))
+    if not dest.get_parent().query_exists():
+        # Check to create parent directory
+        fstr, words, modifierret = (yield commands.result.Prompt('Directory does not exist, create? [Y/n] '))
 
-		if fstr.strip().lower() in ['y', 'ye', 'yes', '']:
-			# Create parent directories
-			try:
-				os.makedirs(dest.get_parent().get_path())
-			except OSError, e:
-				raise commander.commands.exceptions.Execute('Could not create directory')
-		else:
-			yield commander.commands.result.HIDE
+        if fstr.strip().lower() in ['y', 'ye', 'yes', '']:
+            # Create parent directories
+            try:
+                os.makedirs(dest.get_parent().get_path())
+            except OSError, e:
+                raise commander.commands.exceptions.Execute('Could not create directory')
+        else:
+            yield commander.commands.result.HIDE
 
-	if dest.query_exists():
-		fstr, words, modifierret = (yield commands.result.Prompt('Destination already exists, overwrite? [Y/n]'))
+    if dest.query_exists():
+        fstr, words, modifierret = (yield commands.result.Prompt('Destination already exists, overwrite? [Y/n]'))
 
-		if not fstr.strip().lower() in ['y', 'ye', 'yes', '']:
-			yield commander.commands.result.HIDE
+        if not fstr.strip().lower() in ['y', 'ye', 'yes', '']:
+            yield commander.commands.result.HIDE
 
-	try:
-		f.move(dest, _dummy_cb, flags=gio.FILE_COPY_OVERWRITE)
+    try:
+        f.move(dest, _dummy_cb, flags=gio.FILE_COPY_OVERWRITE)
 
-		doc.set_location(dest)
-		yield commander.commands.result.HIDE
-	except Exception, e:
-		raise commander.commands.exceptions.Execute('Could not move file: %s' % (e,))
+        doc.set_location(dest)
+        yield commander.commands.result.HIDE
+    except Exception, e:
+        raise commander.commands.exceptions.Execute('Could not move file: %s' % (e,))
 
 def _mod_has_func(mod, func):
-	return func in mod.__dict__ and type(mod.__dict__[func]) == types.FunctionType
+    return func in mod.__dict__ and type(mod.__dict__[func]) == types.FunctionType
 
 def _mod_has_alias(mod, alias):
-	return '__root__' in mod.__dict__ and alias in mod.__dict__['__root__']
+    return '__root__' in mod.__dict__ and alias in mod.__dict__['__root__']
 
 def _edit_command(view, mod, func=None):
-	try:
-		location = gio.File(inspect.getsourcefile(mod))
-	except:
-		return False
+    try:
+        location = gio.File(inspect.getsourcefile(mod))
+    except:
+        return False
 
-	if not func:
-		gedit.commands.load_location(view.get_toplevel(), location)
-	else:
-		try:
-			lines = inspect.getsourcelines(func)
-			line = lines[-1]
-		except:
-			line = 0
+    if not func:
+        gedit.commands.load_location(view.get_toplevel(), location)
+    else:
+        try:
+            lines = inspect.getsourcelines(func)
+            line = lines[-1]
+        except:
+            line = 0
 
-		gedit.commands.load_location(view.get_toplevel(), location, None, line)
+        gedit.commands.load_location(view.get_toplevel(), location, None, line)
 
-	return True
+    return True
 
 def _resume_command(view, mod, parts):
-	if not parts:
-		return _edit_command(view, mod)
+    if not parts:
+        return _edit_command(view, mod)
 
-	func = parts[0].replace('-', '_')
+    func = parts[0].replace('-', '_')
 
-	if len(parts) == 1 and _mod_has_func(mod, func):
-		return _edit_command(view, mod, mod.__dict__[func])
-	elif len(parts) == 1 and _mod_has_alias(mod, parts[0]):
-		return _edit_command(view, mod)
+    if len(parts) == 1 and _mod_has_func(mod, func):
+        return _edit_command(view, mod, mod.__dict__[func])
+    elif len(parts) == 1 and _mod_has_alias(mod, parts[0]):
+        return _edit_command(view, mod)
 
-	if not func in mod.__dict__:
-		return False
+    if not func in mod.__dict__:
+        return False
 
-	if not commands.is_commander_module(mod.__dict__[func]):
-		return False
+    if not commands.is_commander_module(mod.__dict__[func]):
+        return False
 
-	return _resume_command(view, mod.__dict__[func], parts[1:])
+    return _resume_command(view, mod.__dict__[func], parts[1:])
 
 @commands.autocomplete(name=commander.commands.completion.command)
 def command(view, name):
-	"""Edit commander command: edit.command &lt;command&gt;"""
-	parts = name.split('.')
+    """Edit commander command: edit.command &lt;command&gt;"""
+    parts = name.split('.')
 
-	for mod in sys.modules:
-		if commands.is_commander_module(sys.modules[mod]) and (mod == parts[0] or _mod_has_alias(sys.modules[mod], parts[0])):
-			if mod == parts[0]:
-				ret = _resume_command(view, sys.modules[mod], parts[1:])
-			else:
-				ret = _resume_command(view, sys.modules[mod], parts)
+    for mod in sys.modules:
+        if commands.is_commander_module(sys.modules[mod]) and (mod == parts[0] or _mod_has_alias(sys.modules[mod], parts[0])):
+            if mod == parts[0]:
+                ret = _resume_command(view, sys.modules[mod], parts[1:])
+            else:
+                ret = _resume_command(view, sys.modules[mod], parts)
 
-			if not ret:
-				raise commander.commands.exceptions.Execute('Could not find command: ' + name)
-			else:
-				return commander.commands.result.HIDE
+            if not ret:
+                raise commander.commands.exceptions.Execute('Could not find command: ' + name)
+            else:
+                return commander.commands.result.HIDE
 
-	raise commander.commands.exceptions.Execute('Could not find command: ' + name)
+    raise commander.commands.exceptions.Execute('Could not find command: ' + name)
 
 COMMAND_TEMPLATE="""import commander.commands as commands
 import commander.commands.completion
@@ -177,42 +197,44 @@ import commander.commands.exceptions
 __commander_module__ = True
 
 def __default__(view, entry):
-	\"\"\"Some kind of cool new feature: cool &lt;something&gt;
+    \"\"\"Some kind of cool new feature: cool &lt;something&gt;
 
 Use this to apply the cool new feature\"\"\"
-	pass
+    pass
 """
 
 def new_command(view, entry, name):
-	"""Create a new commander command module: edit.new-command &lt;command&gt;"""
+    """Create a new commander command module: edit.new-command &lt;command&gt;"""
 
-	filename = os.path.expanduser('~/.gnome2/gedit/commander/modules/' + name + '.py')
+    filename = os.path.expanduser('~/.gnome2/gedit/commander/modules/' + name + '.py')
 
-	if os.path.isfile(filename):
-		raise commander.commands.exceptions.Execute('Commander module `' + name + '\' already exists')
+    if os.path.isfile(filename):
+        raise commander.commands.exceptions.Execute('Commander module `' + name + '\' already exists')
 
-	dirname = os.path.dirname(filename)
+    dirname = os.path.dirname(filename)
 
-	if not os.path.isdir(dirname):
-		os.makedirs(dirname)
+    if not os.path.isdir(dirname):
+        os.makedirs(dirname)
 
-	f = open(filename, 'w')
-	f.write(COMMAND_TEMPLATE)
-	f.close()
+    f = open(filename, 'w')
+    f.write(COMMAND_TEMPLATE)
+    f.close()
 
-	return __default__(filename, view)
+    return __default__(filename, view)
 
 def save(view):
-	window = view.get_toplevel()
-	gedit.commands.save_document(window, view.get_buffer())
+    window = view.get_toplevel()
+    gedit.commands.save_document(window, view.get_buffer())
 
-	return commander.commands.result.HIDE
+    return commander.commands.result.HIDE
 
 def save_all(view):
-	window = view.get_toplevel()
-	gedit.commands.save_all_documents(window)
+    window = view.get_toplevel()
+    gedit.commands.save_all_documents(window)
 
-	return commander.commands.result.HIDE
+    return commander.commands.result.HIDE
 
 locals()['file'] = __default__
 move = rename
+
+# vi:ex:ts=4:et
diff --git a/plugins/commander/modules/find/__init__.py b/plugins/commander/modules/find/__init__.py
index 1cff188..3dc60cb 100644
--- a/plugins/commander/modules/find/__init__.py
+++ b/plugins/commander/modules/find/__init__.py
@@ -1,3 +1,24 @@
+# -*- coding: utf-8 -*-
+#
+#  __init__.py - find commander module
+#
+#  Copyright (C) 2010 - Jesse van den Kieboom
+#
+#  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 2 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, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330,
+#  Boston, MA 02111-1307, USA.
+
 import commander.commands as commands
 import gedit
 import re
@@ -9,68 +30,70 @@ __commander_module__ = True
 __root__ = ['/', 'find_i', '//', 'r/', 'r//']
 
 class TextFinder(finder.Finder):
-	def __init__(self, entry, flags):
-		finder.Finder.__init__(self, entry)
+    def __init__(self, entry, flags):
+        finder.Finder.__init__(self, entry)
 
-		self.flags = flags
+        self.flags = flags
 
-	def do_find(self, bounds):
-		buf = self.view.get_buffer()
+    def do_find(self, bounds):
+        buf = self.view.get_buffer()
 
-		if self.get_find():
-			buf.set_search_text(self.get_find(), self.flags)
+        if self.get_find():
+            buf.set_search_text(self.get_find(), self.flags)
 
-		ret = map(lambda x: x.copy(), bounds)
+        ret = map(lambda x: x.copy(), bounds)
 
-		if buf.search_forward(bounds[0], bounds[1], ret[0], ret[1]):
-			return ret
-		else:
-			return False
+        if buf.search_forward(bounds[0], bounds[1], ret[0], ret[1]):
+            return ret
+        else:
+            return False
 
 def __default__(entry, argstr):
-	"""Find in document: find &lt;text&gt;
+    """Find in document: find &lt;text&gt;
 
 Quickly find phrases in the document"""
-	fd = TextFinder(entry, gedit.SEARCH_CASE_SENSITIVE)
-	yield fd.find(argstr)
+    fd = TextFinder(entry, gedit.SEARCH_CASE_SENSITIVE)
+    yield fd.find(argstr)
 
 def _find_insensitive(entry, argstr):
-	"""Find in document (case insensitive): find-i &lt;text&gt;
+    """Find in document (case insensitive): find-i &lt;text&gt;
 
 Quickly find phrases in the document (case insensitive)"""
-	fd = TextFinder(entry, 0)
-	yield fd.find(argstr)
+    fd = TextFinder(entry, 0)
+    yield fd.find(argstr)
 
 def replace(entry, findstr, replstr=None):
-	"""Find/replace in document: find.replace &lt;find&gt; [&lt;replace&gt;]
+    """Find/replace in document: find.replace &lt;find&gt; [&lt;replace&gt;]
 
 Quickly find and replace phrases in the document"""
-	fd = TextFinder(entry, gedit.SEARCH_CASE_SENSITIVE)
-	yield fd.replace(findstr, False, replstr)
+    fd = TextFinder(entry, gedit.SEARCH_CASE_SENSITIVE)
+    yield fd.replace(findstr, False, replstr)
 
 def replace_i(entry, findstr, replstr=None):
-	"""Find/replace all in document (case insensitive): find.replace-i &lt;find&gt; [&lt;replace&gt;]
+    """Find/replace all in document (case insensitive): find.replace-i &lt;find&gt; [&lt;replace&gt;]
 
 Quickly find and replace phrases in the document (case insensitive)"""
-	fd = TextFinder(entry, 0)
-	yield fd.replace(findstr, True, replstr)
+    fd = TextFinder(entry, 0)
+    yield fd.replace(findstr, True, replstr)
 
 def replace_all(entry, findstr, replstr=None):
-	"""Find/replace all in document: find.replace-all &lt;find&gt; [&lt;replace&gt;]
+    """Find/replace all in document: find.replace-all &lt;find&gt; [&lt;replace&gt;]
 
 Quickly find and replace all phrases in the document"""
-	fd = TextFinder(entry, gedit.SEARCH_CASE_SENSITIVE)
-	yield fd.replace(findstr, True, replstr)
+    fd = TextFinder(entry, gedit.SEARCH_CASE_SENSITIVE)
+    yield fd.replace(findstr, True, replstr)
 
 def replace_all_i(entry, findstr, replstr=None):
-	"""Find/replace all in document (case insensitive): find.replace-all-i &lt;find&gt; [&lt;replace&gt;]
+    """Find/replace all in document (case insensitive): find.replace-all-i &lt;find&gt; [&lt;replace&gt;]
 
 Quickly find and replace all phrases in the document (case insensitive)"""
-	fd = TextFinder(entry,0)
-	yield fd.replace(findstr, True, replstr)
+    fd = TextFinder(entry,0)
+    yield fd.replace(findstr, True, replstr)
 
 locals()['/'] = __default__
 locals()['find_i'] = _find_insensitive
 locals()['//'] = replace
 locals()['r/'] = regex.__default__
 locals()['r//'] = regex.replace
+
+# vi:ex:ts=4:et
diff --git a/plugins/commander/modules/find/finder.py b/plugins/commander/modules/find/finder.py
index a04dd83..26725e2 100644
--- a/plugins/commander/modules/find/finder.py
+++ b/plugins/commander/modules/find/finder.py
@@ -1,305 +1,328 @@
+# -*- coding: utf-8 -*-
+#
+#  finder.py - finder commander module
+#
+#  Copyright (C) 2010 - Jesse van den Kieboom
+#
+#  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 2 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, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330,
+#  Boston, MA 02111-1307, USA.
+
 from xml.sax import saxutils
 import commander.commands as commands
 import commander.utils as utils
 import gtk
 
 class Finder:
-	FIND_STARTMARK = 'gedit-commander-find-startmark'
-	FIND_ENDMARK = 'gedit-commander-find-endmark'
+    FIND_STARTMARK = 'gedit-commander-find-startmark'
+    FIND_ENDMARK = 'gedit-commander-find-endmark'
+
+    FIND_RESULT_STARTMARK = 'gedit-commander-find-result-startmark'
+    FIND_RESULT_ENDMARK = 'gedit-commander-find-result-endmark'
 
-	FIND_RESULT_STARTMARK = 'gedit-commander-find-result-startmark'
-	FIND_RESULT_ENDMARK = 'gedit-commander-find-result-endmark'
+    def __init__(self, entry):
+        self.entry = entry
+        self.view = entry.view()
 
-	def __init__(self, entry):
-		self.entry = entry
-		self.view = entry.view()
+        self.findstr = None
+        self.replacestr = None
 
-		self.findstr = None
-		self.replacestr = None
+        self.search_boundaries = utils.Struct({'start': None, 'end': None})
+        self.find_result = utils.Struct({'start': None, 'end': None})
 
-		self.search_boundaries = utils.Struct({'start': None, 'end': None})
-		self.find_result = utils.Struct({'start': None, 'end': None})
+        self.unescapes = [
+            ['\\n', '\n'],
+            ['\\r', '\r'],
+            ['\\t', '\t']
+        ]
 
-		self.unescapes = [
-			['\\n', '\n'],
-			['\\r', '\r'],
-			['\\t', '\t']
-		]
+        self.from_start = False
+        self.search_start_mark = None
 
-		self.from_start = False
-		self.search_start_mark = None
+    def unescape(self, s):
+        for esc in self.unescapes:
+            s = s.replace(esc[0], esc[1])
 
-	def unescape(self, s):
-		for esc in self.unescapes:
-			s = s.replace(esc[0], esc[1])
+        return s
 
-		return s
+    def do_find(self, bounds):
+        return None
 
-	def do_find(self, bounds):
-		return None
+    def get_replace(self, text):
+        return self.replacestr
 
-	def get_replace(self, text):
-		return self.replacestr
+    def set_replace(self, replacestr):
+        self.replacestr = self.unescape(replacestr)
 
-	def set_replace(self, replacestr):
-		self.replacestr = self.unescape(replacestr)
+    def set_find(self, findstr):
+        self.findstr = self.unescape(findstr)
 
-	def set_find(self, findstr):
-		self.findstr = self.unescape(findstr)
+    def get_find(self):
+        return self.findstr
 
-	def get_find(self):
-		return self.findstr
+    def select_last_result(self):
+        buf = self.view.get_buffer()
 
-	def select_last_result(self):
-		buf = self.view.get_buffer()
+        startiter = buf.get_iter_at_mark(self.find_result.start)
+        enditer = buf.get_iter_at_mark(self.find_result.end)
 
-		startiter = buf.get_iter_at_mark(self.find_result.start)
-		enditer = buf.get_iter_at_mark(self.find_result.end)
+        buf.select_range(startiter, enditer)
 
-		buf.select_range(startiter, enditer)
+        visible = self.view.get_visible_rect()
+        loc = self.view.get_iter_location(startiter)
 
-		visible = self.view.get_visible_rect()
-		loc = self.view.get_iter_location(startiter)
+        # Scroll there if needed
+        if loc.y + loc.height < visible.y or loc.y > visible.y + visible.height:
+            self.view.scroll_to_iter(startiter, 0.2, True, 0, 0.5)
 
-		# Scroll there if needed
-		if loc.y + loc.height < visible.y or loc.y > visible.y + visible.height:
-			self.view.scroll_to_iter(startiter, 0.2, True, 0, 0.5)
+    def find_next(self, select=False):
+        buf = self.view.get_buffer()
 
-	def find_next(self, select=False):
-		buf = self.view.get_buffer()
+        # Search from the end of the last result to the end of the search boundary
+        bounds = [buf.get_iter_at_mark(self.find_result.end),
+                  buf.get_iter_at_mark(self.search_boundaries.end)]
 
-		# Search from the end of the last result to the end of the search boundary
-		bounds = [buf.get_iter_at_mark(self.find_result.end),
-			      buf.get_iter_at_mark(self.search_boundaries.end)]
+        ret = self.do_find(bounds)
 
-		ret = self.do_find(bounds)
+        # Check if we need to wrap around if nothing is found
+        if self.search_start_mark:
+            startiter = buf.get_iter_at_mark(self.search_start_mark)
+        else:
+            startiter = None
 
-		# Check if we need to wrap around if nothing is found
-		if self.search_start_mark:
-			startiter = buf.get_iter_at_mark(self.search_start_mark)
-		else:
-			startiter = None
+        startbound = buf.get_iter_at_mark(self.search_boundaries.start)
 
-		startbound = buf.get_iter_at_mark(self.search_boundaries.start)
+        if not ret and not self.from_start and (startiter and not startiter.equal(startbound)):
+            self.from_start = True
 
-		if not ret and not self.from_start and (startiter and not startiter.equal(startbound)):
-			self.from_start = True
+            # Try from beginning
+            bounds[0] = buf.get_start_iter()
+            bounds[1] = startiter
 
-			# Try from beginning
-			bounds[0] = buf.get_start_iter()
-			bounds[1] = startiter
+            # Make sure to just stop at the start of the previous
+            self.search_boundaries.end = self.search_start_mark
 
-			# Make sure to just stop at the start of the previous
-			self.search_boundaries.end = self.search_start_mark
+            ret = self.do_find(bounds)
 
-			ret = self.do_find(bounds)
+        if not ret:
+            return False
+        else:
+            # Mark find result
+            buf.move_mark(self.find_result.start, ret[0])
+            buf.move_mark(self.find_result.end, ret[1])
 
-		if not ret:
-			return False
-		else:
-			# Mark find result
-			buf.move_mark(self.find_result.start, ret[0])
-			buf.move_mark(self.find_result.end, ret[1])
+            if select:
+                self.select_last_result()
 
-			if select:
-				self.select_last_result()
+            return True
 
-			return True
+    def _create_or_move(self, markname, piter, left_gravity):
+        buf = self.view.get_buffer()
+        mark = buf.get_mark(markname)
 
-	def _create_or_move(self, markname, piter, left_gravity):
-		buf = self.view.get_buffer()
-		mark = buf.get_mark(markname)
+        if not mark:
+            mark = buf.create_mark(markname, piter, left_gravity)
+        else:
+            buf.move_mark(mark, piter)
 
-		if not mark:
-			mark = buf.create_mark(markname, piter, left_gravity)
-		else:
-			buf.move_mark(mark, piter)
+        return mark
 
-		return mark
+    def find_first(self, doend=True, select=False):
+        words = []
+        buf = self.view.get_buffer()
 
-	def find_first(self, doend=True, select=False):
-		words = []
-		buf = self.view.get_buffer()
+        while not self.findstr:
+            fstr, words, modifier = (yield commands.result.Prompt('Find:'))
 
-		while not self.findstr:
-			fstr, words, modifier = (yield commands.result.Prompt('Find:'))
+            if fstr:
+                self.set_find(fstr)
 
-			if fstr:
-				self.set_find(fstr)
+        # Determine search area
+        bounds = list(buf.get_selection_bounds())
 
-		# Determine search area
-		bounds = list(buf.get_selection_bounds())
+        if self.search_start_mark:
+            buf.delete_mark(self.search_start_mark)
+            self.search_start_mark = None
 
-		if self.search_start_mark:
-			buf.delete_mark(self.search_start_mark)
-			self.search_start_mark = None
+        if not bounds:
+            # Search in the whole buffer, from the current cursor position on to the
+            # end, and then continue to start from the beginning of the buffer if needed
+            bounds = list(buf.get_bounds())
+            self.search_start_mark = buf.create_mark(None, buf.get_iter_at_mark(buf.get_insert()), True)
+            selection = False
+        else:
+            selection = True
 
-		if not bounds:
-			# Search in the whole buffer, from the current cursor position on to the
-			# end, and then continue to start from the beginning of the buffer if needed
-			bounds = list(buf.get_bounds())
-			self.search_start_mark = buf.create_mark(None, buf.get_iter_at_mark(buf.get_insert()), True)
-			selection = False
-		else:
-			selection = True
+        bounds[0].order(bounds[1])
 
-		bounds[0].order(bounds[1])
+        # Set marks at the boundaries
+        self.search_boundaries.start = self._create_or_move(Finder.FIND_STARTMARK, bounds[0], True)
+        self.search_boundaries.end = self._create_or_move(Finder.FIND_ENDMARK, bounds[1], False)
 
-		# Set marks at the boundaries
-		self.search_boundaries.start = self._create_or_move(Finder.FIND_STARTMARK, bounds[0], True)
-		self.search_boundaries.end = self._create_or_move(Finder.FIND_ENDMARK, bounds[1], False)
+        # Set the result marks so the next find will start at the correct location
+        if selection:
+            piter = bounds[0]
+        else:
+            piter = buf.get_iter_at_mark(buf.get_insert())
 
-		# Set the result marks so the next find will start at the correct location
-		if selection:
-			piter = bounds[0]
-		else:
-			piter = buf.get_iter_at_mark(buf.get_insert())
+        self.find_result.start = self._create_or_move(Finder.FIND_RESULT_STARTMARK, piter, True)
+        self.find_result.end = self._create_or_move(Finder.FIND_RESULT_ENDMARK, piter, False)
 
-		self.find_result.start = self._create_or_move(Finder.FIND_RESULT_STARTMARK, piter, True)
-		self.find_result.end = self._create_or_move(Finder.FIND_RESULT_ENDMARK, piter, False)
+        if not self.find_next(select=select):
+            if doend:
+                self.entry.info_show('<i>Search hit end of the document</i>', True)
 
-		if not self.find_next(select=select):
-			if doend:
-				self.entry.info_show('<i>Search hit end of the document</i>', True)
+            yield commands.result.DONE
+        else:
+            yield True
 
-			yield commands.result.DONE
-		else:
-			yield True
+    def cancel(self):
+        buf = self.view.get_buffer()
 
-	def cancel(self):
-		buf = self.view.get_buffer()
+        buf.set_search_text('', 0)
+        buf.move_mark(buf.get_selection_bound(), buf.get_iter_at_mark(buf.get_insert()))
 
-		buf.set_search_text('', 0)
-		buf.move_mark(buf.get_selection_bound(), buf.get_iter_at_mark(buf.get_insert()))
+        if self.search_start_mark:
+            buf.delete_mark(self.search_start_mark)
 
-		if self.search_start_mark:
-			buf.delete_mark(self.search_start_mark)
+    def find(self, findstr):
+        if findstr:
+            self.set_find(findstr)
 
-	def find(self, findstr):
-		if findstr:
-			self.set_find(findstr)
+        buf = self.view.get_buffer()
 
-		buf = self.view.get_buffer()
+        try:
+            if (yield self.find_first(select=True)):
+                while True:
+                    argstr, words, modifier = (yield commands.result.Prompt('Search next [<i>%s</i>]:' % (saxutils.escape(self.findstr),)))
 
-		try:
-			if (yield self.find_first(select=True)):
-				while True:
-					argstr, words, modifier = (yield commands.result.Prompt('Search next [<i>%s</i>]:' % (saxutils.escape(self.findstr),)))
+                    if argstr:
+                        self.set_find(argstr)
 
-					if argstr:
-						self.set_find(argstr)
+                    if not self.find_next(select=True):
+                        break
 
-					if not self.find_next(select=True):
-						break
+                self.entry.info_show('<i>Search hit end of the document</i>', True)
+        except GeneratorExit, e:
+            self.cancel()
+            raise e
 
-				self.entry.info_show('<i>Search hit end of the document</i>', True)
-		except GeneratorExit, e:
-			self.cancel()
-			raise e
+        self.cancel()
+        yield commands.result.DONE
 
-		self.cancel()
-		yield commands.result.DONE
+    def _restore_cursor(self, mark):
+        buf = mark.get_buffer()
 
-	def _restore_cursor(self, mark):
-		buf = mark.get_buffer()
+        buf.place_cursor(buf.get_iter_at_mark(mark))
+        buf.delete_mark(mark)
 
-		buf.place_cursor(buf.get_iter_at_mark(mark))
-		buf.delete_mark(mark)
+        self.view.scroll_to_mark(buf.get_insert(), 0.2, True, 0, 0.5)
 
-		self.view.scroll_to_mark(buf.get_insert(), 0.2, True, 0, 0.5)
+    def get_current_replace(self):
+        buf = self.view.get_buffer()
+        bounds = utils.Struct({'start': buf.get_iter_at_mark(self.find_result.start),
+                               'end': buf.get_iter_at_mark(self.find_result.end)})
 
-	def get_current_replace(self):
-		buf = self.view.get_buffer()
-		bounds = utils.Struct({'start': buf.get_iter_at_mark(self.find_result.start),
-		                       'end': buf.get_iter_at_mark(self.find_result.end)})
+        if not bounds.start.equal(bounds.end):
+            text = bounds.start.get_text(bounds.end)
+            return self.get_replace(text)
+        else:
+            return self.replacestr
 
-		if not bounds.start.equal(bounds.end):
-			text = bounds.start.get_text(bounds.end)
-			return self.get_replace(text)
-		else:
-			return self.replacestr
+    def replace(self, findstr, replaceall=False, replacestr=None):
+        if findstr:
+            self.set_find(findstr)
 
-	def replace(self, findstr, replaceall=False, replacestr=None):
-		if findstr:
-			self.set_find(findstr)
+        if replacestr != None:
+            self.set_replace(replacestr)
 
-		if replacestr != None:
-			self.set_replace(replacestr)
+        # First find something
+        buf = self.view.get_buffer()
 
-		# First find something
-		buf = self.view.get_buffer()
+        if replaceall:
+            startmark = buf.create_mark(None, buf.get_iter_at_mark(buf.get_insert()), False)
 
-		if replaceall:
-			startmark = buf.create_mark(None, buf.get_iter_at_mark(buf.get_insert()), False)
+        ret = (yield self.find_first(select=not replaceall))
 
-		ret = (yield self.find_first(select=not replaceall))
+        if not ret:
+            yield commands.result.DONE
 
-		if not ret:
-			yield commands.result.DONE
+        self.scroll_back = False
 
-		self.scroll_back = False
+        # Then ask for the replacement string
+        if not self.replacestr:
+            try:
+                if replaceall:
+                    self.scroll_back = True
+                    self.select_last_result()
 
-		# Then ask for the replacement string
-		if not self.replacestr:
-			try:
-				if replaceall:
-					self.scroll_back = True
-					self.select_last_result()
+                replacestr, words, modifier = (yield commands.result.Prompt('Replace with:'))
+                self.set_replace(replacestr)
+            except GeneratorExit, e:
+                if replaceall:
+                    self._restore_cursor(startmark)
 
-				replacestr, words, modifier = (yield commands.result.Prompt('Replace with:'))
-				self.set_replace(replacestr)
-			except GeneratorExit, e:
-				if replaceall:
-					self._restore_cursor(startmark)
+                self.cancel()
+                raise e
 
-				self.cancel()
-				raise e
+        # On replace all, wrap it in begin/end user action
+        if replaceall:
+            buf.begin_user_action()
 
-		# On replace all, wrap it in begin/end user action
-		if replaceall:
-			buf.begin_user_action()
+        try:
+            while True:
+                if not replaceall:
+                    rep, words, modifier = (yield commands.result.Prompt('Replace next [%s]:' % (saxutils.escape(self.get_current_replace()),)))
 
-		try:
-			while True:
-				if not replaceall:
-					rep, words, modifier = (yield commands.result.Prompt('Replace next [%s]:' % (saxutils.escape(self.get_current_replace()),)))
+                    if rep:
+                        self.set_replace(rep)
 
-					if rep:
-						self.set_replace(rep)
+                bounds = utils.Struct({'start': buf.get_iter_at_mark(self.find_result.start),
+                                       'end': buf.get_iter_at_mark(self.find_result.end)})
 
-				bounds = utils.Struct({'start': buf.get_iter_at_mark(self.find_result.start),
-				                       'end': buf.get_iter_at_mark(self.find_result.end)})
+                # If there is a selection, replace it with the replacement string
+                if not bounds.start.equal(bounds.end) and (replaceall or not (modifier & gtk.gdk.CONTROL_MASK)):
+                    text = bounds.start.get_text(bounds.end)
+                    repl = self.get_replace(text)
 
-				# If there is a selection, replace it with the replacement string
-				if not bounds.start.equal(bounds.end) and (replaceall or not (modifier & gtk.gdk.CONTROL_MASK)):
-					text = bounds.start.get_text(bounds.end)
-					repl = self.get_replace(text)
+                    buf.begin_user_action()
+                    buf.delete(bounds.start, bounds.end)
+                    buf.insert(bounds.start, repl)
+                    buf.end_user_action()
 
-					buf.begin_user_action()
-					buf.delete(bounds.start, bounds.end)
-					buf.insert(bounds.start, repl)
-					buf.end_user_action()
+                # Find next
+                if not self.find_next(select=not replaceall):
+                    if not replaceall:
+                        self.entry.info_show('<i>Search hit end of the document</i>', True)
 
-				# Find next
-				if not self.find_next(select=not replaceall):
-					if not replaceall:
-						self.entry.info_show('<i>Search hit end of the document</i>', True)
+                    break
 
-					break
+        except GeneratorExit, e:
+            if replaceall:
+                self._restore_cursor(startmark)
+                buf.end_user_action()
 
-		except GeneratorExit, e:
-			if replaceall:
-				self._restore_cursor(startmark)
-				buf.end_user_action()
+            self.cancel()
+            raise e
 
-			self.cancel()
-			raise e
+        if replaceall:
+            if self.scroll_back:
+                self._restore_cursor(startmark)
 
-		if replaceall:
-			if self.scroll_back:
-				self._restore_cursor(startmark)
+            buf.end_user_action()
 
-			buf.end_user_action()
+        self.cancel()
+        yield commands.result.DONE
 
-		self.cancel()
-		yield commands.result.DONE
+# vi:ex:ts=4:et
diff --git a/plugins/commander/modules/find/regex.py b/plugins/commander/modules/find/regex.py
index c1d45c5..b7a6812 100644
--- a/plugins/commander/modules/find/regex.py
+++ b/plugins/commander/modules/find/regex.py
@@ -1,3 +1,24 @@
+# -*- coding: utf-8 -*-
+#
+#  regex.py - regex commander module
+#
+#  Copyright (C) 2010 - Jesse van den Kieboom
+#
+#  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 2 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, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330,
+#  Boston, MA 02111-1307, USA.
+
 import commander.commands as commands
 import finder
 
@@ -8,189 +29,191 @@ __commander_module__ = True
 __root__ = ['regex_i']
 
 class RegexFinder(finder.Finder):
-	def __init__(self, entry, flags = 0):
-		finder.Finder.__init__(self, entry)
+    def __init__(self, entry, flags = 0):
+        finder.Finder.__init__(self, entry)
 
-		self.flags = re.UNICODE | re.MULTILINE | re.DOTALL | flags
-		self.groupre = re.compile('(\\\\)?\\$([0-9]+|{(([0-9]+):([^}]+))})')
+        self.flags = re.UNICODE | re.MULTILINE | re.DOTALL | flags
+        self.groupre = re.compile('(\\\\)?\\$([0-9]+|{(([0-9]+):([^}]+))})')
 
-	def set_find(self, findstr):
-		finder.Finder.set_find(self, findstr)
+    def set_find(self, findstr):
+        finder.Finder.set_find(self, findstr)
 
-		try:
-			self.findre = re.compile(findstr, self.flags)
-		except Exception, e:
-			raise commands.exceptions.Execute('Invalid regular expression: ' + str(e))
+        try:
+            self.findre = re.compile(findstr, self.flags)
+        except Exception, e:
+            raise commands.exceptions.Execute('Invalid regular expression: ' + str(e))
 
-	def do_find(self, bounds):
-		buf = self.view.get_buffer()
+    def do_find(self, bounds):
+        buf = self.view.get_buffer()
 
-		text = bounds[0].get_text(bounds[1])
-		ret = self.findre.search(text)
+        text = bounds[0].get_text(bounds[1])
+        ret = self.findre.search(text)
 
-		if ret:
-			start = bounds[0].copy()
-			start.forward_chars(ret.start())
+        if ret:
+            start = bounds[0].copy()
+            start.forward_chars(ret.start())
 
-			end = bounds[0].copy()
-			end.forward_chars(ret.end())
+            end = bounds[0].copy()
+            end.forward_chars(ret.end())
 
-			return [start, end]
-		else:
-			return False
+            return [start, end]
+        else:
+            return False
 
-	def _transform(self, text, trans):
-		if not trans:
-			return text
+    def _transform(self, text, trans):
+        if not trans:
+            return text
 
-		transforms = {
-			'u': lambda x: "%s%s" % (x[0].upper(), x[1:]),
-			'U': lambda x: x.upper(),
-			'l': lambda x: "%s%s" % (x[0].lower(), x[1:]),
-			'L': lambda x: x.lower(),
-			't': lambda x: x.title()
-		}
+        transforms = {
+            'u': lambda x: "%s%s" % (x[0].upper(), x[1:]),
+            'U': lambda x: x.upper(),
+            'l': lambda x: "%s%s" % (x[0].lower(), x[1:]),
+            'L': lambda x: x.lower(),
+            't': lambda x: x.title()
+        }
 
-		for i in trans.split(','):
-			if i in transforms:
-				text = transforms[i](text)
+        for i in trans.split(','):
+            if i in transforms:
+                text = transforms[i](text)
 
-		return text
+        return text
 
-	def _do_re_replace_group(self, matchit, group):
-		if group.group(3):
-			num = int(group.group(4))
-		else:
-			num = int(group.group(2))
+    def _do_re_replace_group(self, matchit, group):
+        if group.group(3):
+            num = int(group.group(4))
+        else:
+            num = int(group.group(2))
 
-		if group.group(1):
-			return group.group(2)
-		elif num < len(matchit.groups()) + 1:
-			return self._transform(matchit.group(num), group.group(5))
-		else:
-			return group.group(0)
+        if group.group(1):
+            return group.group(2)
+        elif num < len(matchit.groups()) + 1:
+            return self._transform(matchit.group(num), group.group(5))
+        else:
+            return group.group(0)
 
-	def _do_re_replace(self, matchit):
-		return self.groupre.sub(lambda x: self._do_re_replace_group(matchit, x), self.replacestr)
+    def _do_re_replace(self, matchit):
+        return self.groupre.sub(lambda x: self._do_re_replace_group(matchit, x), self.replacestr)
 
-	def get_replace(self, text):
-		try:
-			return self.findre.sub(self._do_re_replace, text)
-		except Exception, e:
-			raise commands.exceptions.Execute('Invalid replacement: ' + str(e))
+    def get_replace(self, text):
+        try:
+            return self.findre.sub(self._do_re_replace, text)
+        except Exception, e:
+            raise commands.exceptions.Execute('Invalid replacement: ' + str(e))
 
 class SemanticFinder(RegexFinder):
-	def __init__(self, entry):
-		RegexFinder.__init__(self, entry, re.IGNORECASE)
+    def __init__(self, entry):
+        RegexFinder.__init__(self, entry, re.IGNORECASE)
 
-	def split_semantic(self, s):
-		# Can be specified in _ separated syntax, or in TitleCase
-		if '_' in s:
-			return s.lower().split('_')
-		else:
-			return [m.group(0).lower() for m in re.finditer('[A-Z]+([^A-Z]+)?', s)]
+    def split_semantic(self, s):
+        # Can be specified in _ separated syntax, or in TitleCase
+        if '_' in s:
+            return s.lower().split('_')
+        else:
+            return [m.group(0).lower() for m in re.finditer('[A-Z]+([^A-Z]+)?', s)]
 
-	def set_find(self, findstr):
-		self.findparts = self.split_semantic(findstr)
-		RegexFinder.set_find(self, '(' + ')(_?)('.join(map(lambda x: re.escape(x), self.findparts)) + ')')
+    def set_find(self, findstr):
+        self.findparts = self.split_semantic(findstr)
+        RegexFinder.set_find(self, '(' + ')(_?)('.join(map(lambda x: re.escape(x), self.findparts)) + ')')
 
-	def set_replace(self, replstr):
-		self.replaceparts = self.split_semantic(replstr)
-		RegexFinder.set_replace(self, replstr)
+    def set_replace(self, replstr):
+        self.replaceparts = self.split_semantic(replstr)
+        RegexFinder.set_replace(self, replstr)
 
-	def copy_case(self, orig, repl):
-		lo = len(orig)
-		lr = len(repl)
+    def copy_case(self, orig, repl):
+        lo = len(orig)
+        lr = len(repl)
 
-		ret = ''
+        ret = ''
 
-		for i in range(min(lr, lo)):
-			if orig[i].isupper():
-				ret += repl[i].upper()
-			else:
-				ret += repl[i].lower()
+        for i in range(min(lr, lo)):
+            if orig[i].isupper():
+                ret += repl[i].upper()
+            else:
+                ret += repl[i].lower()
 
-		if lr > lo:
-			if orig.isupper():
-				ret += repl[lo:].upper()
-			else:
-				ret += repl[lo:].lower()
+        if lr > lo:
+            if orig.isupper():
+                ret += repl[lo:].upper()
+            else:
+                ret += repl[lo:].lower()
 
-		return ret
+        return ret
 
-	def get_replace(self, text):
-		m = self.findre.match(text)
-		groups = m.groups()
+    def get_replace(self, text):
+        m = self.findre.match(text)
+        groups = m.groups()
 
-		ret = []
+        ret = []
 
-		for i in range(len(groups)):
-			ri = i / 2
+        for i in range(len(groups)):
+            ri = i / 2
 
-			if i % 2 == 0:
-				if ri >= len(self.replaceparts):
-					break
+            if i % 2 == 0:
+                if ri >= len(self.replaceparts):
+                    break
 
-				ret.append(self.copy_case(groups[i], self.replaceparts[ri]))
-			else:
-				ret.append(groups[i])
+                ret.append(self.copy_case(groups[i], self.replaceparts[ri]))
+            else:
+                ret.append(groups[i])
 
-		return ''.join(ret)
+        return ''.join(ret)
 
 def __default__(entry, argstr):
-	"""Find regex in document: find.regex &lt;regex&gt;
+    """Find regex in document: find.regex &lt;regex&gt;
 
 Find text in the document that matches a given regular expression. The regular
 expression syntax is that of python regular expressions."""
-	fd = RegexFinder(entry)
-	yield fd.find(argstr)
+    fd = RegexFinder(entry)
+    yield fd.find(argstr)
 
 def _find_insensitive(entry, argstr):
-	"""Find regex in document (case insensitive): find.regex-i &lt;regex&gt;
+    """Find regex in document (case insensitive): find.regex-i &lt;regex&gt;
 
 Find text in the document that matches a given regular expression. The regular
 expression syntax is that of python regular expressions. Matching dicards case."""
-	fd = RegexFinder(entry, re.IGNORECASE)
-	yield fd.find(argstr)
+    fd = RegexFinder(entry, re.IGNORECASE)
+    yield fd.find(argstr)
 
 def replace(entry, findre, replstr=None):
-	"""Find/replace regex in document: find.replace &lt;find&gt; [&lt;replace&gt;]
+    """Find/replace regex in document: find.replace &lt;find&gt; [&lt;replace&gt;]
 
 Quickly find and replace phrases in the document using regular expressions"""
-	fd = RegexFinder(entry)
-	yield fd.replace(findre, False, replstr)
+    fd = RegexFinder(entry)
+    yield fd.replace(findre, False, replstr)
 
 def replace_i(entry, findre, replstr=None):
-	"""Find/replace regex in document (case insensitive): find.replace-i &lt;find&gt; [&lt;replace&gt;]
+    """Find/replace regex in document (case insensitive): find.replace-i &lt;find&gt; [&lt;replace&gt;]
 
 Quickly find and replace phrases in the document using regular expressions"""
-	fd = RegexFinder(entry, re.IGNORECASE)
-	yield fd.replace(findre, False, replstr)
+    fd = RegexFinder(entry, re.IGNORECASE)
+    yield fd.replace(findre, False, replstr)
 
 def replace_all(entry, findre, replstr=None):
-	"""Find/replace all regex in document: find.regex.replace-all &lt;find&gt; [&lt;replace&gt;]
+    """Find/replace all regex in document: find.regex.replace-all &lt;find&gt; [&lt;replace&gt;]
 
 Quickly find and replace all phrases in the document using regular expressions"""
-	fd = RegexFinder(entry, 0)
-	yield fd.replace(findre, True, replstr)
+    fd = RegexFinder(entry, 0)
+    yield fd.replace(findre, True, replstr)
 
 def replace_all_i(entry, findre, replstr=None):
-	"""Find/replace all regex in document: find.regex.replace-all-i &lt;find&gt; [&lt;replace&gt;]
+    """Find/replace all regex in document: find.regex.replace-all-i &lt;find&gt; [&lt;replace&gt;]
 
 Quickly find and replace all phrases in the document using regular expressions"""
-	fd = RegexFinder(entry, re.IGNORECASE)
-	yield fd.replace(findre, True, replstr)
+    fd = RegexFinder(entry, re.IGNORECASE)
+    yield fd.replace(findre, True, replstr)
 
 def replace_semantic(entry, findstr, replstr=None):
-	"""Find/replace in document (semantically): find.regex.replace-s &lt;find&gt; [&lt;replace&gt;]
+    """Find/replace in document (semantically): find.regex.replace-s &lt;find&gt; [&lt;replace&gt;]
 
 Find and replace semantically"""
-	fd = SemanticFinder(entry)
-	yield fd.replace(findstr, False, replstr)
+    fd = SemanticFinder(entry)
+    yield fd.replace(findstr, False, replstr)
 
 def replace_all_semantic(entry, findstr, replstr=None):
-	"""Find/replace in document (semantically): find.regex.replace-s &lt;find&gt; [&lt;replace&gt;]
+    """Find/replace in document (semantically): find.regex.replace-s &lt;find&gt; [&lt;replace&gt;]
 
 Find and replace semantically"""
-	fd = SemanticFinder(entry)
-	yield fd.replace(findstr, True, replstr)
+    fd = SemanticFinder(entry)
+    yield fd.replace(findstr, True, replstr)
+
+# vi:ex:ts=4:et
diff --git a/plugins/commander/modules/find/test.py b/plugins/commander/modules/find/test.py
index c71e947..fa44d97 100644
--- a/plugins/commander/modules/find/test.py
+++ b/plugins/commander/modules/find/test.py
@@ -9,68 +9,70 @@ __commander_module__ = True
 __root__ = ['/', 'find_i', '//', 'r/', 'r//']
 
 class TextFinder(finder.Finder):
-	def __init__(self, entry, flags):
-		finder.Finder.__init__(self, entry)
+    def __init__(self, entry, flags):
+        finder.Finder.__init__(self, entry)
 
-		self.flags = flags
+        self.flags = flags
 
-	def do_find(self, bounds):
-		buf = self.view.get_buffer()
+    def do_find(self, bounds):
+        buf = self.view.get_buffer()
 
-		if self.findstr:
-			buf.set_search_text(self.findstr, self.flags)
+        if self.findstr:
+            buf.set_search_text(self.findstr, self.flags)
 
-		ret = map(lambda x: x.copy(), bounds)
+        ret = map(lambda x: x.copy(), bounds)
 
-		if buf.search_forward(bounds[0], bounds[1], ret[0], ret[1]):
-			return ret
-		else:
-			return False
+        if buf.search_forward(bounds[0], bounds[1], ret[0], ret[1]):
+            return ret
+        else:
+            return False
 
 def __default__(entry, argstr):
-	"""Find in document: find &lt;text&gt;
+    """Find in document: find &lt;text&gt;
 
 Quickly find phrases in the document"""
-	fd = TextFinder(entry, gedit.SEARCH_CASE_SENSITIVE)
-	yield fd.find(argstr)
+    fd = TextFinder(entry, gedit.SEARCH_CASE_SENSITIVE)
+    yield fd.find(argstr)
 
 def _find_insensitive(entry, argstr):
-	"""Find in document (case insensitive): find-i &lt;text&gt;
+    """Find in document (case insensitive): find-i &lt;text&gt;
 
 Quickly find phrases in the document (case insensitive)"""
-	fd = TextFinder(entry, 0)
-	yield fd.find(argstr)
+    fd = TextFinder(entry, 0)
+    yield fd.find(argstr)
 
 def replace(entry, argstr):
-	"""Find/replace in document: find.replace &lt;text&gt;
+    """Find/replace in document: find.replace &lt;text&gt;
 
 Quickly find and replace phrases in the document"""
-	fd = TextFinder(entry, gedit.SEARCH_CASE_SENSITIVE)
-	yield fd.replace(argstr, False)
+    fd = TextFinder(entry, gedit.SEARCH_CASE_SENSITIVE)
+    yield fd.replace(argstr, False)
 
 def replace_i(entry, argstr):
-	"""Find/replace all in document (case insensitive): find.replace-i &lt;text&gt;
+    """Find/replace all in document (case insensitive): find.replace-i &lt;text&gt;
 
 Quickly find and replace phrases in the document (case insensitive)"""
-	fd = TextFinder(entry, 0)
-	yield fd.replace(argstr, True)
+    fd = TextFinder(entry, 0)
+    yield fd.replace(argstr, True)
 
 def replace_all(entry, argstr):
-	"""Find/replace all in document: find.replace-all &lt;text&gt;
+    """Find/replace all in document: find.replace-all &lt;text&gt;
 
 Quickly find and replace all phrases in the document"""
-	fd = TextFinder(entry, gedit.SEARCH_CASE_SENSITIVE)
-	yield fd.replace(argstr, True)
+    fd = TextFinder(entry, gedit.SEARCH_CASE_SENSITIVE)
+    yield fd.replace(argstr, True)
 
 def replace_all_i(entry, argstr):
-	"""Find/replace all in document (case insensitive): find.replace-all-i &lt;text&gt;
+    """Find/replace all in document (case insensitive): find.replace-all-i &lt;text&gt;
 
 Quickly find and replace all phrases in the document (case insensitive)"""
-	fd = TextFinder(entry,0)
-	yield fd.replace(argstr, True)
+    fd = TextFinder(entry,0)
+    yield fd.replace(argstr, True)
 
 locals()['/'] = __default__
 locals()['find_i'] = _find_insensitive
 locals()['//'] = replace
 locals()['r/'] = regex.__default__
 locals()['r//'] = regex.replace
+
+# vi:ex:ts=4:et
diff --git a/plugins/commander/modules/format.py b/plugins/commander/modules/format.py
index 0f9bf89..518e703 100644
--- a/plugins/commander/modules/format.py
+++ b/plugins/commander/modules/format.py
@@ -1,110 +1,133 @@
+# -*- coding: utf-8 -*-
+#
+#  format.py - format commander module
+#
+#  Copyright (C) 2010 - Jesse van den Kieboom
+#
+#  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 2 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, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330,
+#  Boston, MA 02111-1307, USA.
+
 import commander.commands as commands
 
 __commander_module__ = True
 
 def remove_trailing_spaces(view, all=False):
-	"""Remove trailing spaces: format.remove-trailing-spaces [&lt;all&gt;]
+    """Remove trailing spaces: format.remove-trailing-spaces [&lt;all&gt;]
 
 Remove trailing spaces in the selection. If there is no selection, trailing
 spaces are removed from the whole document. When the optional argument
 &lt;all&gt; is specified, trailing spaces will be removed from all
 the open documents."""
 
-	if all:
-		buffers = view.get_toplevel().get_documents()
-	else:
-		buffers = [view.get_buffer()]
+    if all:
+        buffers = view.get_toplevel().get_documents()
+    else:
+        buffers = [view.get_buffer()]
 
-	for buf in buffers:
-		bounds = buf.get_selection_bounds()
+    for buf in buffers:
+        bounds = buf.get_selection_bounds()
 
-		if not bounds:
-			bounds = buf.get_bounds()
+        if not bounds:
+            bounds = buf.get_bounds()
 
-		buf.begin_user_action()
+        buf.begin_user_action()
 
-		try:
-			# For each line, remove trailing spaces
-			if not bounds[1].ends_line():
-				bounds[1].forward_to_line_end()
+        try:
+            # For each line, remove trailing spaces
+            if not bounds[1].ends_line():
+                bounds[1].forward_to_line_end()
 
-			until = buf.create_mark(None, bounds[1], False)
-			start = bounds[0]
-			start.set_line_offset(0)
+            until = buf.create_mark(None, bounds[1], False)
+            start = bounds[0]
+            start.set_line_offset(0)
 
-			while start.compare(buf.get_iter_at_mark(until)) < 0:
-				end = start.copy()
-				end.forward_to_line_end()
-				last = end.copy()
+            while start.compare(buf.get_iter_at_mark(until)) < 0:
+                end = start.copy()
+                end.forward_to_line_end()
+                last = end.copy()
 
-				if end.equal(buf.get_end_iter()):
-					end.backward_char()
+                if end.equal(buf.get_end_iter()):
+                    end.backward_char()
 
-				while end.get_char().isspace() and end.compare(start) > 0:
-					end.backward_char()
+                while end.get_char().isspace() and end.compare(start) > 0:
+                    end.backward_char()
 
-				if not end.ends_line():
-					if not end.get_char().isspace():
-						end.forward_char()
+                if not end.ends_line():
+                    if not end.get_char().isspace():
+                        end.forward_char()
 
-					buf.delete(end, last)
+                    buf.delete(end, last)
 
-				start = end.copy()
-				start.forward_line()
+                start = end.copy()
+                start.forward_line()
 
-		except Exception, e:
-			print e
+        except Exception, e:
+            print e
 
-		buf.delete_mark(until)
-		buf.end_user_action()
+        buf.delete_mark(until)
+        buf.end_user_action()
 
-	return commands.result.HIDE
+    return commands.result.HIDE
 
 def _transform(view, how, all):
-	if all:
-		buffers = view.get_toplevel().get_documents()
-	else:
-		buffers = [view.get_buffer()]
+    if all:
+        buffers = view.get_toplevel().get_documents()
+    else:
+        buffers = [view.get_buffer()]
 
-	for buf in buffers:
-		bounds = buf.get_selection_bounds()
+    for buf in buffers:
+        bounds = buf.get_selection_bounds()
 
-		if not bounds:
-			start = buf.get_iter_at_mark(buf.get_insert())
-			end = start.copy()
+        if not bounds:
+            start = buf.get_iter_at_mark(buf.get_insert())
+            end = start.copy()
 
-			if not end.ends_line():
-				end.forward_to_line_end()
+            if not end.ends_line():
+                end.forward_to_line_end()
 
-			bounds = [start, end]
+            bounds = [start, end]
 
-		if not bounds[0].equal(bounds[1]):
-			text = how(bounds[0].get_text(bounds[1]))
+        if not bounds[0].equal(bounds[1]):
+            text = how(bounds[0].get_text(bounds[1]))
 
-			buf.begin_user_action()
-			buf.delete(bounds[0], bounds[1])
-			buf.insert(bounds[0], text)
-			buf.end_user_action()
+            buf.begin_user_action()
+            buf.delete(bounds[0], bounds[1])
+            buf.insert(bounds[0], text)
+            buf.end_user_action()
 
-	return commands.result.HIDE
+    return commands.result.HIDE
 
 def upper(view, all=False):
-	"""Make upper case: format.upper [&lt;all&gt;]
+    """Make upper case: format.upper [&lt;all&gt;]
 
 Transform text in selection to upper case. If the optional argument &lt;all&gt;
 is specified, text in all the open documents will be transformed."""
-	return _transform(view, lambda x: x.upper(), all)
+    return _transform(view, lambda x: x.upper(), all)
 
 def lower(view, all=False):
-	"""Make lower case: format.lower [&lt;all&gt;]
+    """Make lower case: format.lower [&lt;all&gt;]
 
 Transform text in selection to lower case. If the optional argument &lt;all&gt;
 is specified, text in all the open documents will be transformed."""
-	return _transform(view, lambda x: x.lower(), all)
+    return _transform(view, lambda x: x.lower(), all)
 
 def title(view, all=False):
-	"""Make title case: format.title [&lt;all&gt;]
+    """Make title case: format.title [&lt;all&gt;]
 
 Transform text in selection to title case. If the optional argument &lt;all&gt;
 is specified, text in all the open documents will be transformed."""
-	return _transform(view, lambda x: x.title().replace('_', ''), all)
+    return _transform(view, lambda x: x.title().replace('_', ''), all)
+
+# vi:ex:ts=4:et
diff --git a/plugins/commander/modules/goto.py b/plugins/commander/modules/goto.py
index 341d1b7..26d79bd 100644
--- a/plugins/commander/modules/goto.py
+++ b/plugins/commander/modules/goto.py
@@ -1,4 +1,24 @@
-"""Goto specific places in the document"""
+# -*- coding: utf-8 -*-
+#
+#  goto.py - goto commander module
+#
+#  Copyright (C) 2010 - Jesse van den Kieboom
+#
+#  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 2 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, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330,
+#  Boston, MA 02111-1307, USA.
+
 import os
 
 import commander.commands as commands
@@ -9,33 +29,35 @@ import commander.commands.exceptions
 __commander_module__ = True
 
 def __default__(view, line, column=1):
-	"""Goto line number"""
+    """Goto line number"""
+
+    buf = view.get_buffer()
+    ins = buf.get_insert()
+    citer = buf.get_iter_at_mark(ins)
 
-	buf = view.get_buffer()
-	ins = buf.get_insert()
-	citer = buf.get_iter_at_mark(ins)
+    try:
+        if line.startswith('+'):
+            linnum = citer.get_line() + int(line[1:])
+        elif line.startswith('-'):
+            linnum = citer.get_line() - int(line[1:])
+        else:
+            linnum = int(line) - 1
 
-	try:
-		if line.startswith('+'):
-			linnum = citer.get_line() + int(line[1:])
-		elif line.startswith('-'):
-			linnum = citer.get_line() - int(line[1:])
-		else:
-			linnum = int(line) - 1
+        column = int(column) - 1
+    except ValueError:
+        raise commander.commands.exceptions.Execute('Please specify a valid line number')
 
-		column = int(column) - 1
-	except ValueError:
-		raise commander.commands.exceptions.Execute('Please specify a valid line number')
+    linnum = min(max(0, linnum), buf.get_line_count() - 1)
+    citer = buf.get_iter_at_line(linnum)
 
-	linnum = min(max(0, linnum), buf.get_line_count() - 1)
-	citer = buf.get_iter_at_line(linnum)
+    column = min(max(0, column), citer.get_chars_in_line() - 1)
 
-	column = min(max(0, column), citer.get_chars_in_line() - 1)
+    citer = buf.get_iter_at_line(linnum)
+    citer.forward_chars(column)
 
-	citer = buf.get_iter_at_line(linnum)
-	citer.forward_chars(column)
+    buf.place_cursor(citer)
+    view.scroll_to_iter(citer, 0.0, True)
 
-	buf.place_cursor(citer)
-	view.scroll_to_iter(citer, 0.0, True)
+    return commander.commands.result.HIDE
 
-	return commander.commands.result.HIDE
+# vi:ex:ts=4:et
diff --git a/plugins/commander/modules/help.py b/plugins/commander/modules/help.py
index 3aae646..6594a97 100644
--- a/plugins/commander/modules/help.py
+++ b/plugins/commander/modules/help.py
@@ -1,3 +1,24 @@
+# -*- coding: utf-8 -*-
+#
+#  help.py - help commander module
+#
+#  Copyright (C) 2010 - Jesse van den Kieboom
+#
+#  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 2 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, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330,
+#  Boston, MA 02111-1307, USA.
+
 import sys
 import os
 import types
@@ -10,44 +31,46 @@ from xml.sax import saxutils
 __commander_module__ = True
 
 def _name_match(first, second):
-	first = first.split('-')
-	second = second.split('-')
+    first = first.split('-')
+    second = second.split('-')
 
-	if len(first) > len(second):
-		return False
+    if len(first) > len(second):
+        return False
 
-	for i in xrange(0, len(first)):
-		if not second[i].startswith(first[i]):
-			return False
+    for i in xrange(0, len(first)):
+        if not second[i].startswith(first[i]):
+            return False
 
-	return True
+    return True
 
 def _doc_text(command, func):
-	if not _name_match(command.split('.')[-1], func.name):
-		prefix = '<i>(Alias):</i> '
-	else:
-		prefix = ''
+    if not _name_match(command.split('.')[-1], func.name):
+        prefix = '<i>(Alias):</i> '
+    else:
+        prefix = ''
 
-	doc = func.doc()
+    doc = func.doc()
 
-	if not doc:
-		doc = "<b>%s</b>\n\n<i>No documentation available</i>" % (func.name,)
-	else:
-		parts = doc.split("\n")
-		parts[0] = prefix + '<b>' + parts[0] + '</b>'
-		doc = "\n".join(parts)
+    if not doc:
+        doc = "<b>%s</b>\n\n<i>No documentation available</i>" % (func.name,)
+    else:
+        parts = doc.split("\n")
+        parts[0] = prefix + '<b>' + parts[0] + '</b>'
+        doc = "\n".join(parts)
 
-	return doc
+    return doc
 
 @commands.autocomplete(command=commander.commands.completion.command)
 def __default__(entry, command='help'):
-	"""Show help on commands: help &lt;command&gt;
+    """Show help on commands: help &lt;command&gt;
 
 Show detailed information on how to use a certain command (if available)"""
-	res = commander.commands.completion.command([command], 0)
+    res = commander.commands.completion.command([command], 0)
+
+    if not res:
+        raise commander.commands.exceptions.Execute('Could not find command: ' + command)
 
-	if not res:
-		raise commander.commands.exceptions.Execute('Could not find command: ' + command)
+    entry.info_show(_doc_text(command, res[0][0]), True)
+    return commands.result.DONE
 
-	entry.info_show(_doc_text(command, res[0][0]), True)
-	return commands.result.DONE
+# vi:ex:ts=4:et
diff --git a/plugins/commander/modules/move.py b/plugins/commander/modules/move.py
index d47c97c..21f9886 100644
--- a/plugins/commander/modules/move.py
+++ b/plugins/commander/modules/move.py
@@ -1,3 +1,24 @@
+# -*- coding: utf-8 -*-
+#
+#  move.py - move commander module
+#
+#  Copyright (C) 2010 - Jesse van den Kieboom
+#
+#  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 2 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, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330,
+#  Boston, MA 02111-1307, USA.
+
 import commander.commands as commands
 import gtk
 import re
@@ -5,89 +26,91 @@ import re
 __commander_module__ = True
 
 def _move(view, what, num, modifier):
-	try:
-		num = int(num)
-	except:
-		raise commands.exceptions.Execute('Invalid number: ' + str(num))
+    try:
+        num = int(num)
+    except:
+        raise commands.exceptions.Execute('Invalid number: ' + str(num))
 
-	view.emit('move-cursor', what, num, modifier & gtk.gdk.CONTROL_MASK)
-	return commands.result.HIDE
+    view.emit('move-cursor', what, num, modifier & gtk.gdk.CONTROL_MASK)
+    return commands.result.HIDE
 
 def word(view, modifier, num=1):
-	"""Move cursor per word: move.word &lt;num&gt;
+    """Move cursor per word: move.word &lt;num&gt;
 
 Move the cursor per word (use negative num to move backwards)"""
-	return _move(view, gtk.MOVEMENT_WORDS, num, modifier)
+    return _move(view, gtk.MOVEMENT_WORDS, num, modifier)
 
 def line(view, modifier, num=1):
-	"""Move cursor per line: move.line &lt;num&gt;
+    """Move cursor per line: move.line &lt;num&gt;
 
 Move the cursor per line (use negative num to move backwards)"""
-	return _move(view, gtk.MOVEMENT_DISPLAY_LINES, num, modifier)
+    return _move(view, gtk.MOVEMENT_DISPLAY_LINES, num, modifier)
 
 def char(view, modifier, num=1):
-	"""Move cursor per char: move.char &lt;num&gt;
+    """Move cursor per char: move.char &lt;num&gt;
 
 Move the cursor per char (use negative num to move backwards)"""
-	return _move(view, gtk.MOVEMENT_VISUAL_POSITIONS, num, modifier)
+    return _move(view, gtk.MOVEMENT_VISUAL_POSITIONS, num, modifier)
 
 def paragraph(view, modifier, num=1):
-	"""Move cursor per paragraph: move.paragraph &lt;num&gt;
+    """Move cursor per paragraph: move.paragraph &lt;num&gt;
 
 Move the cursor per paragraph (use negative num to move backwards)"""
-	return _move(view, gtk.MOVEMENT_PARAGRAPHS, num, modifier)
+    return _move(view, gtk.MOVEMENT_PARAGRAPHS, num, modifier)
 
 def regex(view, modifier, regex, num=1):
-	"""Move cursor per regex: move.regex &lt;num&gt;
+    """Move cursor per regex: move.regex &lt;num&gt;
 
 Move the cursor per regex (use negative num to move backwards)"""
-	try:
-		r = re.compile(regex, re.DOTALL | re.MULTILINE | re.UNICODE)
-	except Exception, e:
-		raise commands.exceptions.Execute('Invalid regular expression: ' + str(e))
+    try:
+        r = re.compile(regex, re.DOTALL | re.MULTILINE | re.UNICODE)
+    except Exception, e:
+        raise commands.exceptions.Execute('Invalid regular expression: ' + str(e))
+
+    try:
+        num = int(num)
+    except Exception, e:
+        raise commands.exceptions.Execute('Invalid number: ' + str(e))
 
-	try:
-		num = int(num)
-	except Exception, e:
-		raise commands.exceptions.Execute('Invalid number: ' + str(e))
+    buf = view.get_buffer()
+    start = buf.get_iter_at_mark(buf.get_insert())
 
-	buf = view.get_buffer()
-	start = buf.get_iter_at_mark(buf.get_insert())
+    if num > 0:
+        end = buf.get_end_iter()
+    else:
+        end = start.copy()
+        start = buf.get_start_iter()
 
-	if num > 0:
-		end = buf.get_end_iter()
-	else:
-		end = start.copy()
-		start = buf.get_start_iter()
+    text = start.get_text(end)
+    ret = list(r.finditer(text))
 
-	text = start.get_text(end)
-	ret = list(r.finditer(text))
+    if num < 0:
+        ret.reverse()
 
-	if num < 0:
-		ret.reverse()
+    idx = min(abs(num), len(ret))
 
-	idx = min(abs(num), len(ret))
+    if idx > 0:
+        found = ret[idx - 1]
+        start = buf.get_iter_at_mark(buf.get_insert())
 
-	if idx > 0:
-		found = ret[idx - 1]
-		start = buf.get_iter_at_mark(buf.get_insert())
+        if num < 0:
+            start.backward_char(len(text) - found.start(0))
+        else:
+            start.forward_chars(found.start(0))
 
-		if num < 0:
-			start.backward_char(len(text) - found.start(0))
-		else:
-			start.forward_chars(found.start(0))
+        if modifier & gtk.gdk.CONTROL_MASK:
+            buf.move_mark(buf.get_selection_bound(), start)
+        else:
+            buf.move_mark(buf.get_insert(), start)
+            buf.move_mark(buf.get_selection_bound(), start)
 
-		if modifier & gtk.gdk.CONTROL_MASK:
-			buf.move_mark(buf.get_selection_bound(), start)
-		else:
-			buf.move_mark(buf.get_insert(), start)
-			buf.move_mark(buf.get_selection_bound(), start)
+        visible = view.get_visible_rect()
+        loc = view.get_iter_location(start)
 
-		visible = view.get_visible_rect()
-		loc = view.get_iter_location(start)
+        # Scroll there if needed
+        if loc.y + loc.height < visible.y or loc.y > visible.y + visible.height:
+            view.scroll_to_mark(buf.get_insert(), 0.2, True, 0, 0.5)
 
-		# Scroll there if needed
-		if loc.y + loc.height < visible.y or loc.y > visible.y + visible.height:
-			view.scroll_to_mark(buf.get_insert(), 0.2, True, 0, 0.5)
+    return commands.result.HIDE
 
-	return commands.result.HIDE
+# vi:ex:ts=4:et
diff --git a/plugins/commander/modules/reload.py b/plugins/commander/modules/reload.py
index fe5a9ee..0fb7d64 100644
--- a/plugins/commander/modules/reload.py
+++ b/plugins/commander/modules/reload.py
@@ -1,3 +1,24 @@
+# -*- coding: utf-8 -*-
+#
+#  reload.py - reload commander module
+#
+#  Copyright (C) 2010 - Jesse van den Kieboom
+#
+#  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 2 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, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330,
+#  Boston, MA 02111-1307, USA.
+
 import commander.commands
 import commander.commands.completion
 import commander.commands.exceptions
@@ -9,21 +30,23 @@ __commander_module__ = True
 
 @commander.commands.autocomplete(command=commander.commands.completion.command)
 def __default__(command):
-	"""Force reload of a module: reload &lt;module&gt;
+    """Force reload of a module: reload &lt;module&gt;
 
 Force a reload of a module. This is mostly useful on systems where file monitoring
 does not work correctly."""
 
-	# Get the command
-	res = commander.commands.completion.command([command], 0)
+    # Get the command
+    res = commander.commands.completion.command([command], 0)
+
+    if not res:
+        raise commander.commands.exceptions.Execute('Could not find command: ' + command)
 
-	if not res:
-		raise commander.commands.exceptions.Execute('Could not find command: ' + command)
+    mod = res[0][0]
 
-	mod = res[0][0]
+    while not isinstance(mod, commander.commands.module.Module):
+        mod = mod.parent
 
-	while not isinstance(mod, commander.commands.module.Module):
-		mod = mod.parent
+    commander.commands.Commands().reload_module(mod)
+    return commander.commands.result.DONE
 
-	commander.commands.Commands().reload_module(mod)
-	return commander.commands.result.DONE
\ No newline at end of file
+# vi:ex:ts=4:et
diff --git a/plugins/commander/modules/set.py b/plugins/commander/modules/set.py
index 7e2a6e1..8de0602 100644
--- a/plugins/commander/modules/set.py
+++ b/plugins/commander/modules/set.py
@@ -1,3 +1,24 @@
+# -*- coding: utf-8 -*-
+#
+#  set.py - set commander module
+#
+#  Copyright (C) 2010 - Jesse van den Kieboom
+#
+#  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 2 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, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330,
+#  Boston, MA 02111-1307, USA.
+
 import commander.commands as commands
 import commander.commands.exceptions
 
@@ -7,129 +28,131 @@ import gtksourceview2 as gsv
 __commander_module__ = True
 
 def _complete_options(words, idx):
-	ret = []
+    ret = []
 
-	gb = globals()
+    gb = globals()
 
-	for k in gb:
-		if type(gb[k]) == types.FunctionType and not k.startswith('_'):
-			ret.append(k.replace('_', '-'))
+    for k in gb:
+        if type(gb[k]) == types.FunctionType and not k.startswith('_'):
+            ret.append(k.replace('_', '-'))
 
-	ret.sort()
-	return commands.completion.words(ret)(words, idx)
+    ret.sort()
+    return commands.completion.words(ret)(words, idx)
 
 def _complete_language(words, idx):
-	manager = gsv.language_manager_get_default()
-	ids = manager.get_language_ids()
-	ids.append('none')
-	ids.sort()
+    manager = gsv.language_manager_get_default()
+    ids = manager.get_language_ids()
+    ids.append('none')
+    ids.sort()
 
-	return commands.completion.words(ids)(words, idx)
+    return commands.completion.words(ids)(words, idx)
 
 def _complete_use_spaces(words, idx):
-	return commands.completion.words(['yes', 'no'])(words, idx)
+    return commands.completion.words(['yes', 'no'])(words, idx)
 
 def _complete_draw_spaces(words, idx):
-	ret = ['none', 'all', 'tabs', 'newlines', 'nbsp', 'spaces']
-	return commands.completion.words(ret)(words, idx)
+    ret = ['none', 'all', 'tabs', 'newlines', 'nbsp', 'spaces']
+    return commands.completion.words(ret)(words, idx)
 
 def _complete_value(words, idx):
-	# Depends a bit on the option
-	ret, completion = _complete_options(words, idx - 1)
+    # Depends a bit on the option
+    ret, completion = _complete_options(words, idx - 1)
 
-	if not ret:
-		return None
+    if not ret:
+        return None
 
-	completer = '_complete_' + ret[0].replace('-', '_')
-	gb = globals()
+    completer = '_complete_' + ret[0].replace('-', '_')
+    gb = globals()
 
-	if completer in gb:
-		return gb[completer](words[1:], idx - 1)
-	else:
-		return None
+    if completer in gb:
+        return gb[completer](words[1:], idx - 1)
+    else:
+        return None
 
 @commands.autocomplete(option=_complete_options, value=_complete_value)
 def __default__(view, option, value):
-	"""Set gedit option: set &lt;option&gt; &lt;value&gt;
+    """Set gedit option: set &lt;option&gt; &lt;value&gt;
 
 Sets a gedit option, such as document language, or indenting"""
 
-	option = option.replace('-', '_')
-	gb = globals()
+    option = option.replace('-', '_')
+    gb = globals()
 
-	if option in gb and type(gb[option]) == types.FunctionType:
-		return gb[option](view, value)
-	else:
-		raise commander.commands.exceptions.Execute('Invalid setting: ' + option)
+    if option in gb and type(gb[option]) == types.FunctionType:
+        return gb[option](view, value)
+    else:
+        raise commander.commands.exceptions.Execute('Invalid setting: ' + option)
 
 @commands.autocomplete(language=_complete_language)
 def language(view, language=None):
-	"""Set document language: set.language &lt;language&gt;
+    """Set document language: set.language &lt;language&gt;
 
 Set the document language to the language with the specified id"""
-	if not language or language == 'none':
-		view.get_buffer().set_language(None)
-		return False
+    if not language or language == 'none':
+        view.get_buffer().set_language(None)
+        return False
 
-	manager = gsv.language_manager_get_default()
-	lang = manager.get_language(language)
+    manager = gsv.language_manager_get_default()
+    lang = manager.get_language(language)
 
-	if lang:
-		view.get_buffer().set_language(lang)
-		return False
-	else:
-		raise commander.commands.exceptions.Execute('Invalid language: ' + language)
+    if lang:
+        view.get_buffer().set_language(lang)
+        return False
+    else:
+        raise commander.commands.exceptions.Execute('Invalid language: ' + language)
 
 def tab_width(view, width):
-	"""Set document tab width: set.tab-width &lt;width&gt;
+    """Set document tab width: set.tab-width &lt;width&gt;
 
 Set the document tab width"""
 
-	try:
-		width = int(width)
-	except:
-		raise commander.commands.exceptions.Execute("Invalid tab width: " + str(width))
+    try:
+        width = int(width)
+    except:
+        raise commander.commands.exceptions.Execute("Invalid tab width: " + str(width))
 
-	if width <= 0:
-		raise commander.commands.exceptions.Execute("Invalid tab width: " + str(width))
+    if width <= 0:
+        raise commander.commands.exceptions.Execute("Invalid tab width: " + str(width))
 
-	view.set_tab_width(width)
-	return False
+    view.set_tab_width(width)
+    return False
 
 tab_size = tab_width
 
 @commands.autocomplete(value=_complete_use_spaces)
 def use_spaces(view, value):
-	"""Use spaces instead of tabs: set.use-spaces &lt;yes/no&gt;
+    """Use spaces instead of tabs: set.use-spaces &lt;yes/no&gt;
 
 Set to true/yes to use spaces instead of tabs"""
 
-	setting = value in ('yes', 'true', '1')
-	view.set_insert_spaces_instead_of_tabs(setting)
+    setting = value in ('yes', 'true', '1')
+    view.set_insert_spaces_instead_of_tabs(setting)
 
-	return False
+    return False
 
 @commands.autocomplete({'*': _complete_draw_spaces})
 def draw_spaces(view, *args):
-	"""Draw spaces: set.draw-spaces &lt;none/all/tabs/newlines/nbsp/spaces&gt;
+    """Draw spaces: set.draw-spaces &lt;none/all/tabs/newlines/nbsp/spaces&gt;
 
 Set what kind of spaces should be drawn. Multiple options can be defined, e.g.
 for drawing spaces and tabs: <i>set.draw-spaces space tab</i>"""
-	m = {
-		'none': 0,
-		'all': gsv.DRAW_SPACES_ALL,
-		'tabs': gsv.DRAW_SPACES_TAB,
-		'newlines': gsv.DRAW_SPACES_NEWLINE,
-		'nbsp': gsv.DRAW_SPACES_NBSP,
-		'spaces': gsv.DRAW_SPACES_SPACE
-	}
-
-	flags = 0
-
-	for arg in args:
-		for a in m:
-			if a.startswith(arg):
-				flags = flags | m[a]
-
-	view.set_draw_spaces(flags)
-	return False
+    m = {
+        'none': 0,
+        'all': gsv.DRAW_SPACES_ALL,
+        'tabs': gsv.DRAW_SPACES_TAB,
+        'newlines': gsv.DRAW_SPACES_NEWLINE,
+        'nbsp': gsv.DRAW_SPACES_NBSP,
+        'spaces': gsv.DRAW_SPACES_SPACE
+    }
+
+    flags = 0
+
+    for arg in args:
+        for a in m:
+            if a.startswith(arg):
+                flags = flags | m[a]
+
+    view.set_draw_spaces(flags)
+    return False
+
+# vi:ex:ts=4:et
diff --git a/plugins/commander/modules/shell.py b/plugins/commander/modules/shell.py
index cb4d8b7..188c3de 100644
--- a/plugins/commander/modules/shell.py
+++ b/plugins/commander/modules/shell.py
@@ -1,3 +1,24 @@
+# -*- coding: utf-8 -*-
+#
+#  shell.py - shell commander module
+#
+#  Copyright (C) 2010 - Jesse van den Kieboom
+#
+#  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 2 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, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330,
+#  Boston, MA 02111-1307, USA.
+
 import subprocess
 import glib
 import fcntl
@@ -14,162 +35,163 @@ __commander_module__ = True
 __root__ = ['!', '!!', '!&']
 
 class Process:
-	def __init__(self, entry, pipe, replace, background, tmpin, stdout, suspend):
-		self.pipe = pipe
-		self.replace = replace
-		self.tmpin = tmpin
-		self.entry = entry
-		self.suspend = suspend
+    def __init__(self, entry, pipe, replace, background, tmpin, stdout, suspend):
+        self.pipe = pipe
+        self.replace = replace
+        self.tmpin = tmpin
+        self.entry = entry
+        self.suspend = suspend
 
-		if replace:
-			self.entry.view().set_editable(False)
+        if replace:
+            self.entry.view().set_editable(False)
 
-		if not background:
-			fcntl.fcntl(stdout, fcntl.F_SETFL, os.O_NONBLOCK)
-			conditions = glib.IO_IN | glib.IO_PRI | glib.IO_ERR | glib.IO_HUP
+        if not background:
+            fcntl.fcntl(stdout, fcntl.F_SETFL, os.O_NONBLOCK)
+            conditions = glib.IO_IN | glib.IO_PRI | glib.IO_ERR | glib.IO_HUP
 
-			self.watch = glib.io_add_watch(stdout, conditions, self.collect_output)
-			self._buffer = ''
-		else:
-			stdout.close()
+            self.watch = glib.io_add_watch(stdout, conditions, self.collect_output)
+            self._buffer = ''
+        else:
+            stdout.close()
 
-	def update(self):
-		parts = self._buffer.split("\n")
+    def update(self):
+        parts = self._buffer.split("\n")
 
-		for p in parts[:-1]:
-			self.entry.info_show(p)
+        for p in parts[:-1]:
+            self.entry.info_show(p)
 
-		self._buffer = parts[-1]
+        self._buffer = parts[-1]
 
-	def collect_output(self, fd, condition):
-		if condition & (glib.IO_IN | glib.IO_PRI):
-			try:
-				ret = fd.read()
+    def collect_output(self, fd, condition):
+        if condition & (glib.IO_IN | glib.IO_PRI):
+            try:
+                ret = fd.read()
 
-				# This seems to happen on OS X...
-				if ret == '':
-					condition = condition | glib.IO_HUP
-				else:
-					self._buffer += ret
+                # This seems to happen on OS X...
+                if ret == '':
+                    condition = condition | glib.IO_HUP
+                else:
+                    self._buffer += ret
 
-					if not self.replace:
-						self.update()
-			except:
-				self.entry.info_show(self._buffer.strip("\n"))
-				self.stop()
-				return False
+                    if not self.replace:
+                        self.update()
+            except:
+                self.entry.info_show(self._buffer.strip("\n"))
+                self.stop()
+                return False
 
-		if condition & (glib.IO_ERR | glib.IO_HUP):
-			if self.replace:
-				buf = self.entry.view().get_buffer()
-				buf.begin_user_action()
+        if condition & (glib.IO_ERR | glib.IO_HUP):
+            if self.replace:
+                buf = self.entry.view().get_buffer()
+                buf.begin_user_action()
 
-				bounds = buf.get_selection_bounds()
+                bounds = buf.get_selection_bounds()
 
-				if bounds:
-					buf.delete(bounds[0], bounds[1])
+                if bounds:
+                    buf.delete(bounds[0], bounds[1])
 
-				buf.insert_at_cursor(self._buffer)
-				buf.end_user_action()
-			else:
-				self.entry.info_show(self._buffer.strip("\n"))
+                buf.insert_at_cursor(self._buffer)
+                buf.end_user_action()
+            else:
+                self.entry.info_show(self._buffer.strip("\n"))
 
-			self.stop()
-			return False
+            self.stop()
+            return False
 
-		return True
+        return True
 
-	def stop(self):
-		if not self.suspend:
-			return
+    def stop(self):
+        if not self.suspend:
+            return
 
-		if hasattr(self.pipe, 'kill'):
-			self.pipe.kill()
+        if hasattr(self.pipe, 'kill'):
+            self.pipe.kill()
 
-		glib.source_remove(self.watch)
+        glib.source_remove(self.watch)
 
-		if self.replace:
-			self.entry.view().set_editable(True)
+        if self.replace:
+            self.entry.view().set_editable(True)
 
-		if self.tmpin:
-			self.tmpin.close()
+        if self.tmpin:
+            self.tmpin.close()
 
-		sus = self.suspend
-		self.suspend = None
-		sus.resume()
+        sus = self.suspend
+        self.suspend = None
+        sus.resume()
 
 def _run_command(entry, replace, background, argstr):
-	tmpin = None
+    tmpin = None
 
-	cwd = None
-	doc = entry.view().get_buffer()
+    cwd = None
+    doc = entry.view().get_buffer()
 
-	if not doc.is_untitled() and doc.is_local():
-		gfile = doc.get_location()
-		cwd = os.path.dirname(gfile.get_path())
+    if not doc.is_untitled() and doc.is_local():
+        gfile = doc.get_location()
+        cwd = os.path.dirname(gfile.get_path())
 
-	if '<!' in argstr:
-		bounds = entry.view().get_buffer().get_selection_bounds()
+    if '<!' in argstr:
+        bounds = entry.view().get_buffer().get_selection_bounds()
 
-		if not bounds:
-			bounds = entry.view().get_buffer().get_bounds()
+        if not bounds:
+            bounds = entry.view().get_buffer().get_bounds()
 
-		inp = bounds[0].get_text(bounds[1])
+        inp = bounds[0].get_text(bounds[1])
 
-		# Write to temporary file
-		tmpin = tempfile.NamedTemporaryFile(delete=False)
-		tmpin.write(inp)
-		tmpin.flush()
+        # Write to temporary file
+        tmpin = tempfile.NamedTemporaryFile(delete=False)
+        tmpin.write(inp)
+        tmpin.flush()
 
-		# Replace with temporary file
-		argstr = argstr.replace('<!', '< "' + tmpin.name + '"')
+        # Replace with temporary file
+        argstr = argstr.replace('<!', '< "' + tmpin.name + '"')
 
-	try:
-		p = subprocess.Popen(argstr, shell=True, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-		stdout = p.stdout
+    try:
+        p = subprocess.Popen(argstr, shell=True, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+        stdout = p.stdout
 
-	except Exception, e:
-		raise commander.commands.exceptions.Execute('Failed to execute: ' + e)
+    except Exception, e:
+        raise commander.commands.exceptions.Execute('Failed to execute: ' + e)
 
-	suspend = None
+    suspend = None
 
-	if not background:
-		suspend = commander.commands.result.Suspend()
+    if not background:
+        suspend = commander.commands.result.Suspend()
 
-	proc = Process(entry, p, replace, background, tmpin, stdout, suspend)
+    proc = Process(entry, p, replace, background, tmpin, stdout, suspend)
 
-	if not background:
-		yield suspend
+    if not background:
+        yield suspend
 
-		# Cancelled or simply done
-		proc.stop()
+        # Cancelled or simply done
+        proc.stop()
 
-		yield commander.commands.result.DONE
-	else:
-		yield commander.commands.result.HIDE
+        yield commander.commands.result.DONE
+    else:
+        yield commander.commands.result.HIDE
 
 def __default__(entry, argstr):
-	"""Run shell command: ! &lt;command&gt;
+    """Run shell command: ! &lt;command&gt;
 
 You can use <b>&lt;!</b> as a special input meaning the current selection or current
 document."""
-	return _run_command(entry, False, False, argstr)
+    return _run_command(entry, False, False, argstr)
 
 def background(entry, argstr):
-	"""Run shell command in the background: !&amp; &lt;command&gt;
+    """Run shell command in the background: !&amp; &lt;command&gt;
 
 You can use <b>&lt;!</b> as a special input meaning the current selection or current
 document."""
-	return _run_command(entry, False, True, argstr)
+    return _run_command(entry, False, True, argstr)
 
 def replace(entry, argstr):
-	"""Run shell command and place output in document: !! &lt;command&gt;
+    """Run shell command and place output in document: !! &lt;command&gt;
 
 You can use <b>&lt;!</b> as a special input meaning the current selection or current
 document."""
-	return _run_command(entry, True, False, argstr)
+    return _run_command(entry, True, False, argstr)
 
 locals()['!'] = __default__
 locals()['!!'] = replace
 locals()['!&'] = background
 
+# vi:ex:ts=4:et



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]