summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-03-22 21:21:35 +0100
committerhut <hut@lavabit.com>2011-03-22 21:21:35 +0100
commitdffc317f2df42b73304bd2119bdcfa15c88fe4eb (patch)
tree84b379182673655274caa9067a631deaab7e8806 /ranger
parent96883700b683f0f99e2e6512ee5b0484e9cb1a9d (diff)
downloadranger-dffc317f2df42b73304bd2119bdcfa15c88fe4eb.tar.gz
defaults.keys: allow pasting hardlinks.
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/actions.py9
-rw-r--r--ranger/defaults/keys.py1
2 files changed, 9 insertions, 1 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 8a57330b..7b721229 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -18,7 +18,7 @@ import re
 import shutil
 import string
 from os.path import join, isdir, realpath
-from os import symlink, getcwd
+from os import link, symlink, getcwd
 from inspect import cleandoc
 
 import ranger
@@ -744,6 +744,13 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 			except Exception as x:
 				self.notify(x)
 
+	def paste_hardlink(self):
+		for f in self.env.copy:
+			try:
+				link(f.path, join(getcwd(), f.basename))
+			except Exception as x:
+				self.notify(x)
+
 	def paste(self, overwrite=False):
 		"""Paste the selected items into the current directory"""
 		copied_files = tuple(self.env.copy)
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py
index 782af310..cd878dee 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -180,6 +180,7 @@ map('pp', fm.paste())
 map('po', fm.paste(overwrite=True))
 map('pl', fm.paste_symlink(relative=False))
 map('pL', fm.paste_symlink(relative=True))
+map('phl', fm.paste_hardlink())
 map('p<bg>', fm.hint('press *p* to confirm pasting' \
 		', *o*verwrite, create sym*l*inks, relative sym*L*inks'))