about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--ranger/actions.py15
-rw-r--r--ranger/defaults/keys.py4
3 files changed, 19 insertions, 2 deletions
diff --git a/TODO b/TODO
index 95bf2984..52812959 100644
--- a/TODO
+++ b/TODO
@@ -23,7 +23,7 @@ General
    (X) #21  10/01/01  write help!
    ( ) #22  10/01/03  add getopt options to change flags/mode
    (X) #29  10/01/06  add chmod command
-   ( ) #30  10/01/06  add a way to create symlinks
+   (X) #30  10/01/06  add a way to create symlinks
    ( ) #32  10/01/08  place the (hidden) cursor to a meaningful position
    ( ) #34  10/01/09  display free disk space
    ( ) #35  10/01/09  display disk usage of files in current directory
diff --git a/ranger/actions.py b/ranger/actions.py
index 48db860c..33952c19 100644
--- a/ranger/actions.py
+++ b/ranger/actions.py
@@ -399,6 +399,21 @@ class Actions(EnvironmentAware, SettingsAware):
 	def cut(self):
 		self.copy()
 		self.env.cut = True
+	
+	def paste_symlink(self):
+		from os import symlink, getcwd
+		from os.path import join
+
+		copied_files = self.env.copy
+
+		if not copied_files:
+			return
+
+		for f in copied_files:
+			try:
+				symlink(f.path, join(getcwd(), f.basename))
+			except Exception as x:
+				self.notify(x)
 
 	def paste(self):
 		"""Paste the selected items into the current directory"""
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py
index 14548076..c08f8ba2 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -77,7 +77,9 @@ def initialize_commands(command_list):
 	bind('yy', fm.copy())
 	bind('dd', fm.cut())
 	bind('pp', fm.paste())
-	hint('p', 'press //p// once again to confirm pasting')
+	bind('pl', fm.paste_symlink())
+	hint('p', 'press //p// once again to confirm pasting' \
+			', or //l// to create symlinks')
 
 	bind('s', fm.execute_command('bash'))