From 3ec6f466744a45135c4e592e003f99f775da5e3e Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 7 Apr 2010 23:05:23 +0200 Subject: more keys, fixed hint --- ranger/core/actions.py | 1 + ranger/defaults/keys.py | 59 ++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 54 insertions(+), 6 deletions(-) diff --git a/ranger/core/actions.py b/ranger/core/actions.py index fb2973dd..99df7875 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -95,6 +95,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware): self.log.appendleft(text) if hasattr(self.ui, 'notify'): self.ui.notify(text, duration=duration, bad=bad) + hint = notify def redraw_window(self): """Redraw the window""" diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py index 031bc402..62cd46c9 100644 --- a/ranger/defaults/keys.py +++ b/ranger/defaults/keys.py @@ -44,6 +44,7 @@ map('', alias='') # Backspace is bugged sometimes def move(arg): arg.wdg.move(narg=arg.n, **arg.direction) + # =================================================================== # == Define aliases # =================================================================== @@ -65,6 +66,7 @@ map('', alias='') map('', alias='') map('', alias='') + # =================================================================== # == Define keys in "general" context: # =================================================================== @@ -100,7 +102,7 @@ map('.term', fm.execute_command('x-terminal-emulator', flags='d')) map('du', fm.execute_command('du --max-depth=1 -h | less')) # -------------------------------------------------- toggle options -map('z', fm.hint("bind_//h//idden //p//review_files" \ +map('z', fm.hint("show_//h//idden //p//review_files" \ "//d//irectories_first //c//ollapse_preview flush//i//nput")) map('zh', fm.toggle_boolean_option('show_hidden')) map('zp', fm.toggle_boolean_option('preview_files')) @@ -191,7 +193,7 @@ map('?', KEY_F1, fm.display_help()) map('w', lambda arg: arg.fm.ui.open_taskview()) # ------------------------------------------------ system functions -map('ZZ', fm.exit()) +map('ZZ', 'ZQ', fm.exit()) map('', fm.reset()) map('R', fm.reload_cwd()) @map('') @@ -209,6 +211,53 @@ map('>', fm.open_console(cmode.COMMAND_QUICK)) map('!', fm.open_console(cmode.OPEN)) map('r', fm.open_console(cmode.OPEN_QUICK)) + +# =================================================================== +# == Define keys for the pager +# =================================================================== +map = pager_keys = KeyMap() +map.merge(global_keys) +map.merge(vim_aliases) + +# -------------------------------------------------------- movement +map('', wdg.move(left=4)) +map('', wdg.move(right=4)) +map('', 'd', wdg.move(down=0.5, pages=True)) +map('', 'u', wdg.move(up=0.5, pages=True)) +map('', 'f', '', wdg.move(down=1, pages=True)) +map('', 'b', '', wdg.move(up=1, pages=True)) +map('', wdg.move(down=0.8, pages=True)) + +# ---------------------------------------------------------- others +map('E', fm.edit_file()) +map('?', fm.display_help()) + +# --------------------------------------------------- bind the keys +# There are two different kinds of pagers, each have a different +# method for exiting: + +map = keymanager.get_context('pager') +map.merge(pager_keys) +map('q', 'i', '', lambda arg: arg.fm.ui.close_pager()) + +map = keymanager.get_context('embedded_pager') +map.merge(pager_keys) +map('q', 'i', '', lambda arg: arg.fm.ui.close_embedded_pager()) + + +# =================================================================== +# == Define keys for the taskview +# =================================================================== +map = keymanager.get_context('taskview') +map('K', wdg.task_move(0)) +map('J', wdg.task_move(-1)) +map('dd', wdg.task_remove()) + +map('?', fm.display_help()) +map('w', 'q', ESC, ctrl('d'), ctrl('c'), + lambda arg: arg.fm.ui.close_taskview()) + + # =================================================================== # == Define keys for the console # =================================================================== @@ -236,11 +285,9 @@ map('', wdg.delete_rest(1)) map('', wdg.delete_rest(-1)) map('', wdg.paste()) +map('') def type_key(arg): - log('x') arg.wdg.type_key(arg.match) -map('', type_key) -log(map._tree) # =================================================================== @@ -255,6 +302,6 @@ map('', dir=Direction(down=0, absolute=True)) map('', dir=Direction(down=-1, absolute=True)) map('', dir=Direction(down=1, pages=True)) map('', dir=Direction(down=-1, pages=True)) -map('%', dir=Direction(down=1, percentage=True, absolute=True)) +map('%', dir=Direction(down=1, percentage=True, absolute=True)) map('', dir=Direction(down=1, pages=True)) map('', dir=Direction(down=1)) -- cgit 1.4.1-2-gfad0