about summary refs log tree commit diff stats
path: root/ranger/actions.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-14 05:35:46 +0100
committerhut <hut@lavabit.com>2010-01-14 05:35:46 +0100
commit01c8834f9ff1e6990b5720d7efd3f350110df735 (patch)
treee6519b845d5d8efc2e64a5f1691c737b9f1030be /ranger/actions.py
parent832b516c52e74b7180c0e5fc5d5c2d995d1aacf6 (diff)
downloadranger-01c8834f9ff1e6990b5720d7efd3f350110df735.tar.gz
commands: added :edit command
Diffstat (limited to 'ranger/actions.py')
-rw-r--r--ranger/actions.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/ranger/actions.py b/ranger/actions.py
index a881f7c2..6aab4581 100644
--- a/ranger/actions.py
+++ b/ranger/actions.py
@@ -20,6 +20,7 @@ from ranger.shared import EnvironmentAware, SettingsAware
 from ranger import fsobject
 from ranger.gui.widgets import console_mode as cmode
 from ranger.applications import run
+from ranger.fsobject import File
 
 class Actions(EnvironmentAware, SettingsAware):
 	search_method = 'ctime'
@@ -242,11 +243,15 @@ class Actions(EnvironmentAware, SettingsAware):
 	def execute_command(self, cmd, **kw):
 		return run(fm=self, action=cmd, **kw)
 	
-	def edit_file(self):
+	def edit_file(self, file=None):
 		"""Calls execute_file with the current file and app='editor'"""
-		if self.env.cf is None:
+		if file is None:
+			file = self.env.cf
+		elif isinstance(file, str):
+			file = File(os.path.expanduser(file))
+		if file is None:
 			return
-		self.execute_file(self.env.cf, app = 'editor')
+		self.execute_file(file, app = 'editor')
 
 	def open_console(self, mode=':', string=''):
 		"""Open the console if the current UI supports that"""