diff options
-rw-r--r-- | ranger/core/actions.py | 9 | ||||
-rw-r--r-- | ranger/defaults/keys.py | 1 |
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')) |