summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/config/rc.conf2
-rw-r--r--ranger/core/actions.py4
-rw-r--r--ranger/core/fm.py8
3 files changed, 12 insertions, 2 deletions
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index 43a9b99a..44692d79 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -360,11 +360,13 @@ map dd cut
 map ud uncut
 map da cut mode=add
 map dr cut mode=remove
+map dt cut mode=toggle
 
 map yy copy
 map uy uncut
 map ya copy mode=add
 map yr copy mode=remove
+map yt copy mode=toggle
 
 # Temporary workarounds
 map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier)
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index e692eb39..89924dc0 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -1219,7 +1219,7 @@ class Actions(FileManagerAware, SettingsAware):
         Copy the selected items.
         Modes are: 'set', 'add', 'remove'.
         """
-        assert mode in ('set', 'add', 'remove')
+        assert mode in ('set', 'add', 'remove', 'toggle')
         cwd = self.thisdir
         if not narg and not dirarg:
             selected = (f for f in self.thistab.get_selection() if f in cwd.files)
@@ -1241,6 +1241,8 @@ class Actions(FileManagerAware, SettingsAware):
             self.copy_buffer.update(set(selected))
         elif mode == 'remove':
             self.copy_buffer.difference_update(set(selected))
+        elif mode == 'toggle':
+            self.copy_buffer.symmetric_difference_update(set(selected))
         self.do_cut = False
         self.ui.browser.main_column.request_redraw()
 
diff --git a/ranger/core/fm.py b/ranger/core/fm.py
index 046eb788..f6792b95 100644
--- a/ranger/core/fm.py
+++ b/ranger/core/fm.py
@@ -136,7 +136,7 @@ class FM(Actions, SignalDispatcher):
 
             if self.settings.open_all_images and \
                     len(self.thisdir.marked_items) == 0 and \
-                    re.match(r'^(feh|sxiv|imv) ', command):
+                    re.match(r'^(feh|sxiv|imv|pqiv) ', command):
 
                 images = [f.relative_path for f in self.thisdir.files if f.image]
                 escaped_filenames = " ".join(shell_quote(f) \
@@ -161,6 +161,12 @@ class FM(Actions, SignalDispatcher):
                         new_command = command.replace("imv ",
                                 "imv -n %d " % number, 1)
 
+                    if command[0:5] == 'pqiv ':
+                        number = images.index(self.thisfile.relative_path)
+                        new_command = command.replace("pqiv ",
+                                "pqiv --action \"goto_file_byindex(%d)\" " % \
+                                number, 1)
+
                     if new_command:
                         command = "set -- %s; %s" % (escaped_filenames,
                                 new_command)