ranger: extracthere command and unmap q
parent
b0a5565eec
commit
964d1c3985
|
@ -57,3 +57,38 @@ class bulkrename(Command):
|
||||||
self.fm.execute_file([File(cmdfile.name)], app=local_ed)
|
self.fm.execute_file([File(cmdfile.name)], app=local_ed)
|
||||||
self.fm.run(['/bin/sh', cmdfile.name], flags='w')
|
self.fm.run(['/bin/sh', cmdfile.name], flags='w')
|
||||||
cmdfile.close()
|
cmdfile.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
from ranger.core.loader import CommandLoader
|
||||||
|
class extracthere(Command):
|
||||||
|
def execute(self):
|
||||||
|
""" Extract copied files to current directory """
|
||||||
|
copied_files = tuple(self.fm.env.copy)
|
||||||
|
|
||||||
|
if not copied_files:
|
||||||
|
return
|
||||||
|
|
||||||
|
def refresh(_):
|
||||||
|
cwd = self.fm.env.get_directory(original_path)
|
||||||
|
cwd.load_content()
|
||||||
|
|
||||||
|
one_file = copied_files[0]
|
||||||
|
cwd = self.fm.env.cwd
|
||||||
|
original_path = cwd.path
|
||||||
|
au_flags = ['-X', cwd.path]
|
||||||
|
au_flags += self.line.split()[1:]
|
||||||
|
au_flags += ['-e']
|
||||||
|
|
||||||
|
self.fm.env.copy.clear()
|
||||||
|
self.fm.env.cut = False
|
||||||
|
if len(copied_files) == 1:
|
||||||
|
descr = "extracting: " + os.path.basename(one_file.path)
|
||||||
|
else:
|
||||||
|
descr = "extracting files from: " + os.path.basename(one_file.dirname)
|
||||||
|
obj = CommandLoader(args=['aunpack'] + au_flags \
|
||||||
|
+ [f.path for f in copied_files], descr=descr)
|
||||||
|
|
||||||
|
obj.signal_bind('after', refresh)
|
||||||
|
self.fm.loader.add(obj)
|
||||||
|
|
|
@ -94,7 +94,7 @@ alias setl setlocal
|
||||||
# ===================================================================
|
# ===================================================================
|
||||||
|
|
||||||
# Basic
|
# Basic
|
||||||
map ! console shell -w
|
map ! console shell -w
|
||||||
|
|
||||||
# For the nostalgics: Midnight Commander bindings
|
# For the nostalgics: Midnight Commander bindings
|
||||||
map <F4> bulkrename
|
map <F4> bulkrename
|
||||||
|
@ -105,6 +105,10 @@ map <F6> console touch
|
||||||
# == Personal shorcuts
|
# == Personal shorcuts
|
||||||
# ===================================================================
|
# ===================================================================
|
||||||
|
|
||||||
|
## Prevent accidental exit when using programs that also uses this key to quit.
|
||||||
|
unmap q
|
||||||
|
map Q quit
|
||||||
|
|
||||||
## Move to trash (without Trash-CLI)
|
## Move to trash (without Trash-CLI)
|
||||||
# map DD shell mv -t ~/.local/share/Trash/files %s
|
# map DD shell mv -t ~/.local/share/Trash/files %s
|
||||||
|
|
||||||
|
@ -114,6 +118,7 @@ map DD shell trash-put -- %s
|
||||||
## Extraction using atools.
|
## Extraction using atools.
|
||||||
map ex shell aunpack -e %s
|
map ex shell aunpack -e %s
|
||||||
map eeg shell aunpack -e %s -X "$HOME/games/"
|
map eeg shell aunpack -e %s -X "$HOME/games/"
|
||||||
|
map pe extracthere
|
||||||
|
|
||||||
## Git
|
## Git
|
||||||
map ega shell -w git add %f %s
|
map ega shell -w git add %f %s
|
||||||
|
|
Loading…
Reference in New Issue