summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorThe Flying Rapist <admin@nosuck.org>2016-03-20 02:34:52 -0400
committerThe Flying Rapist <admin@nosuck.org>2016-03-20 02:34:52 -0400
commit0cf4b058cd9e663dab1b12c15a95addb66113743 (patch)
tree2cbef4e45b5c17616cb1c2fc925582d2f41902af
parent7ee4b45bd2619fb07c9b139940003224bedb1de3 (diff)
downloadranger-0cf4b058cd9e663dab1b12c15a95addb66113743.tar.gz
Added toggle mode for cut/copy actions.
-rw-r--r--ranger/config/rc.conf2
-rw-r--r--ranger/core/actions.py4
2 files changed, 5 insertions, 1 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()