summaryrefslogtreecommitdiffstats
path: root/.config
diff options
context:
space:
mode:
authorSean Breckenridge <seanbrecke@gmail.com>2019-12-16 05:22:14 -0800
committerLuke Smith <luke@lukesmith.xyz>2019-12-16 08:22:14 -0500
commit29bee71d652cd62190b4934817ee227a6f9340d2 (patch)
treecf36cfe7805f8ce55c2f8925efa6380b283b9f99 /.config
parentfc3aae4235b0f5acb29aa51b9342cd2c4554ad17 (diff)
downloadeibhear-29bee71d652cd62190b4934817ee227a6f9340d2.tar.gz
eibhear-29bee71d652cd62190b4934817ee227a6f9340d2.tar.zst
eibhear-29bee71d652cd62190b4934817ee227a6f9340d2.zip
make fzf_bring do what it should do (#434)
also removed a few unnecessary imports
Diffstat (limited to '.config')
-rwxr-xr-x.config/ranger/commands.py20
1 files changed, 6 insertions, 14 deletions
diff --git a/.config/ranger/commands.py b/.config/ranger/commands.py
index 8c5e748..71fd2a2 100755
--- a/.config/ranger/commands.py
+++ b/.config/ranger/commands.py
@@ -6,6 +6,7 @@
# You always need to import ranger.api.commands here to get the Command class:
from ranger.api.commands import *
+from ranger.core.loader import CommandLoader
# A simple command for demonstration purposes follows.
#------------------------------------------------------------------------------
@@ -88,6 +89,8 @@ class fzf_select(Command):
self.fm.cd(fzf_file)
else:
self.fm.select_file(fzf_file)
+
+
# fzf_locate
class fzf_locate(Command):
"""
@@ -114,6 +117,7 @@ class fzf_locate(Command):
else:
self.fm.select_file(fzf_file)
+
class fzf_bring(Command):
"""
:fzf_bring
@@ -124,6 +128,7 @@ class fzf_bring(Command):
"""
def execute(self):
import subprocess
+ import shutil
if self.quantifier:
# match only directories
command="find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \
@@ -136,14 +141,8 @@ class fzf_bring(Command):
stdout, stderr = fzf.communicate()
if fzf.returncode == 0:
fzf_file = os.path.abspath(stdout.decode('utf-8').rstrip('\n'))
- if os.path.isdir(fzf_file):
- self.fm.cd(fzf_file)
- else:
- self.fm.select_file(fzf_file)
-
+ shutil.move(fzf_file, self.fm.thisdir.path)
-import os
-from ranger.core.loader import CommandLoader
class compress(Command):
def execute(self):
@@ -176,11 +175,6 @@ class compress(Command):
return ['compress ' + os.path.basename(self.fm.thisdir.path) + ext for ext in extension]
-
-
-import os
-from ranger.core.loader import CommandLoader
-
class extracthere(Command):
def execute(self):
""" Extract copied files to current directory """
@@ -212,5 +206,3 @@ class extracthere(Command):
obj.signal_bind('after', refresh)
self.fm.loader.add(obj)
-
-