ranger: mkcd command

master
Pierre Neidhardt 2013-10-07 18:04:26 +02:00
parent 0cd58f0aea
commit 7357124d93
2 changed files with 24 additions and 3 deletions

View File

@ -92,3 +92,23 @@ class extracthere(Command):
obj.signal_bind('after', refresh)
self.fm.loader.add(obj)
class mkcd(Command):
def execute(self):
""" Create folder and cd to it """
def execute(self):
from os.path import join, expanduser, lexists
from os import mkdir
dirname = join(self.fm.thisdir.path, expanduser(self.rest(1)))
if not lexists(dirname):
mkdir(dirname)
else:
self.fm.notify("file/directory exists!", bad=True)
self.fm.cd(dirname)
def tab(self):
return self._tab_directory_content()

View File

@ -100,6 +100,7 @@ map ! console shell -w
map <F4> bulkrename
map <F5> console shell -w file "%f"
map <F6> console touch
map <F7> console mkcd
# ===================================================================
# == Personal shorcuts
@ -116,9 +117,9 @@ map Q quit
map DD shell trash-put -- %s
## Extraction using atools.
map ex shell aunpack -e %s
map eeg shell aunpack -e %s -X "$HOME/games/"
map pe extracthere
map exs shell aunpack -e %s
map exg shell aunpack -e %s -X "$HOME/games/"
map exh extracthere
## Git
map ega shell -w git add %f %s