summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-11-14 03:44:10 +0100
committerhut <hut@lepus.uberspace.de>2015-11-14 03:44:10 +0100
commitd11e47ee5065306d3e837ddfb44382acdebe5160 (patch)
tree8e88f0edbae5377df128e79ec930087b4a059027
parent88c1fd2f5c6aec91eb4e13dee1c4b1b703b3d886 (diff)
parenta090d85eae9f6016b655943c97a2bbf8416c12ce (diff)
downloadranger-d11e47ee5065306d3e837ddfb44382acdebe5160.tar.gz
Merge branch 'p_macro' of https://github.com/NoSuck/ranger
-rw-r--r--doc/ranger.pod5
-rw-r--r--ranger/core/actions.py10
2 files changed, 11 insertions, 4 deletions
diff --git a/doc/ranger.pod b/doc/ranger.pod
index b68595a9..b287f1ea 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -201,11 +201,12 @@ Macros can be used in commands to abbreviate things.
 
  %f   the highlighted file
  %d   the path of the current directory
- %s   the selected files in the current directory.
+ %s   the selected files in the current directory
  %t   all tagged files in the current directory
  %c   the full paths of the currently copied/cut files
+ %p   the full paths of selected files
 
-The macros %f, %d and %s also have upper case variants, %F, %D and %S,
+The macros %f, %d, %p, and %s also have upper case variants, %F, %D, %P, and %S,
 which refer to the next tab.  To refer to specific tabs, add a number in
 between.  (%7s = selection of the seventh tab.)
 
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 26dcf4f7..7007581d 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -253,8 +253,10 @@ class Actions(FileManagerAware, SettingsAware):
             macros['f'] = MACRO_FAIL
 
         if self.fm.thistab.get_selection:
+            macros['p'] = [os.path.join(self.fm.thisdir.path, fl.relative_path) for fl in self.fm.thistab.get_selection()]
             macros['s'] = [fl.relative_path for fl in self.fm.thistab.get_selection()]
         else:
+            macros['p'] = MACRO_FAIL
             macros['s'] = MACRO_FAIL
 
         if self.fm.copy_buffer:
@@ -273,7 +275,7 @@ class Actions(FileManagerAware, SettingsAware):
         else:
             macros['d'] = '.'
 
-        # define d/f/s macros for each tab
+        # define d/f/p/s macros for each tab
         for i in range(1,10):
             try:
                 tab = self.fm.tabs[i]
@@ -285,15 +287,17 @@ class Actions(FileManagerAware, SettingsAware):
             i = str(i)
             macros[i + 'd'] = tabdir.path
             if tabdir.get_selection():
+                macros[i + 'p'] = [os.path.join(tabdir.path, fl.relative_path) for fl in tabdir.get_selection()]
                 macros[i + 's'] = [fl.path for fl in tabdir.get_selection()]
             else:
+                macros[i + 'p'] = MACRO_FAIL
                 macros[i + 's'] = MACRO_FAIL
             if tabdir.pointed_obj:
                 macros[i + 'f'] = tabdir.pointed_obj.path
             else:
                 macros[i + 'f'] = MACRO_FAIL
 
-        # define D/F/S for the next tab
+        # define D/F/P/S for the next tab
         found_current_tab = False
         next_tab = None
         first_tab = None
@@ -316,8 +320,10 @@ class Actions(FileManagerAware, SettingsAware):
             else:
                 macros['F'] = MACRO_FAIL
             if next_tab_dir.get_selection():
+                macros['P'] = [os.path.join(next_tab.path, fl.path) for fl in next_tab.get_selection()]
                 macros['S'] = [fl.path for fl in next_tab.get_selection()]
             else:
+                macros['P'] = MACRO_FAIL
                 macros['S'] = MACRO_FAIL
         else:
             macros['D'] = MACRO_FAIL