From d40d1cf901a914430190068e6d8f56e0eb29107d Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 3 Oct 2011 15:59:12 +0200 Subject: defaults/rc.conf: use copyXmap to simplify rc.conf --- ranger/defaults/rc.conf | 175 +++++++++++++++++++++++------------------------- 1 file changed, 84 insertions(+), 91 deletions(-) diff --git a/ranger/defaults/rc.conf b/ranger/defaults/rc.conf index ecd64501..d8ce123d 100644 --- a/ranger/defaults/rc.conf +++ b/ranger/defaults/rc.conf @@ -31,10 +31,9 @@ alias qall quitall # =================================================================== # Basic -map Q quit! -map q quit -map ZZ quit -map ZQ quit +map Q quit! +map q quit +copymap q ZZ ZQ map R reload_cwd map reset @@ -44,7 +43,7 @@ map abort map i display_file map ? help map W display_log -map w eval fm.ui.open_taskview() +map w taskview_open map S shell $SHELL map : console @@ -66,20 +65,6 @@ map v mark_files all=True toggle=True map V mark_files all=True val=False map uv mark_files all=True val=False -# VIM-like -map gg move to=0 -map G move to=-1 -map j move down=1 -map k move up=1 -map h move left=1 -map l move right=1 -map J move down=0.5 pages=True -map K move up=0.5 pages=True -map move down=0.5 pages=True -map move up=0.5 pages=True -map move down=1 pages=True -map move up=1 pages=True - # For the nostalgics: Midnight Commander bindings map help map display_file @@ -103,6 +88,21 @@ map move right=1 map console delete map console touch +# VIM-like +copymap k +copymap j +copymap h +copymap l +copymap gg +copymap G +copymap +copymap + +map J move down=0.5 pages=True +map K move up=0.5 pages=True +copymap J +copymap K + # Jumping around map H history_go -1 map L history_go 1 @@ -230,15 +230,14 @@ map zv toggle_option use_preview_script map zf console filter # Bookmarks -map ` draw_bookmarks -map ' draw_bookmarks -map m draw_bookmarks -map um draw_bookmarks map ` enter_bookmark %any map ' enter_bookmark %any map m set_bookmark %any map um unset_bookmark %any +map m draw_bookmarks +copymap m um ` ' + # Beware. I haven't figured out how to make these keybindings pretty yet: # map +ow shell -d chmod o+w (one mapping for each combination) @@ -247,8 +246,6 @@ eval import itertools; [cmd("map +%s%s shell -d chmod %s+%s %%s" % (mode+mode)) # map -ow shell -d chmod o+w (one mapping for each combination) eval import itertools; [cmd("map -%s%s shell -d chmod %s-%s %%s" % (mode+mode)) for mode in itertools.product("ugoa", "rwxXst")] - - # =================================================================== # == Define keys for the console # =================================================================== @@ -257,85 +254,76 @@ eval import itertools; [cmd("map -%s%s shell -d chmod %s-%s %%s" % (mode+mode)) # Basic cmap eval fm.ui.console.tab() cmap eval fm.ui.console.tab(-1) -cmap eval fm.ui.console.close() -cmap eval fm.ui.console.close() cmap eval fm.ui.console.close() cmap eval fm.ui.console.execute() -cmap eval fm.ui.console.execute() cmap redraw_window -# This special expression allows typing in numerals: -cmap false +copycmap +copycmap # Move around +cmap eval fm.ui.console.history_move(-1) +cmap eval fm.ui.console.history_move(1) cmap eval fm.ui.console.move(left=1) cmap eval fm.ui.console.move(right=1) cmap eval fm.ui.console.move(right=0, absolute=True) cmap eval fm.ui.console.move(right=-1, absolute=True) -cmap eval fm.ui.console.history_move(-1) -cmap eval fm.ui.console.history_move(1) - -# And of course the emacs way -cmap eval fm.ui.console.move(left=1) -cmap eval fm.ui.console.move(right=1) -cmap eval fm.ui.console.move(right=0, absolute=True) -cmap eval fm.ui.console.move(right=-1, absolute=True) -cmap eval fm.ui.console.history_move(-1) -cmap eval fm.ui.console.history_move(1) # Line Editing -# Note: There are multiple ways to express backspaces. (code 263) -# and (code 127). To be sure, use both. cmap eval fm.ui.console.delete(-1) -cmap eval fm.ui.console.delete(-1) cmap eval fm.ui.console.delete(0) -cmap eval fm.ui.console.delete(-1) -cmap eval fm.ui.console.delete(0) cmap eval fm.ui.console.delete_word() cmap eval fm.ui.console.delete_rest(1) cmap eval fm.ui.console.delete_rest(-1) cmap eval fm.ui.console.paste() +# And of course the emacs way +copycmap +copycmap +copycmap +copycmap +copycmap +copycmap +copycmap +copycmap + +# Note: There are multiple ways to express backspaces. (code 263) +# and (code 127). To be sure, use both. +copycmap + +# This special expression allows typing in numerals: +cmap false # =================================================================== # == Pager Keybindings # =================================================================== # Movement -pmap j eval -q fm.ui.browser.pager.move(down=1) -pmap k eval -q fm.ui.browser.pager.move(up=1) -pmap gg eval -q fm.ui.browser.pager.move(down=0, absolute=True) -pmap G eval -q fm.ui.browser.pager.move(down=-1, absolute=True) -pmap eval -q fm.ui.browser.pager.move(down=1) -pmap eval -q fm.ui.browser.pager.move(down=1) -pmap eval -q fm.ui.browser.pager.move(up=1) -pmap eval -q fm.ui.browser.pager.move(down=0, absolute=True) -pmap eval -q fm.ui.browser.pager.move(down=-1, absolute=True) -pmap eval -q fm.ui.browser.pager.move(down=1) -pmap eval -q fm.ui.browser.pager.move(up=1) - -pmap d eval -q fm.ui.browser.pager.move(down=0.5, pages=True) -pmap eval -q fm.ui.browser.pager.move(down=0.5, pages=True) -pmap u eval -q fm.ui.browser.pager.move(up= 0.5, pages=True) -pmap eval -q fm.ui.browser.pager.move(up= 0.5, pages=True) -pmap n eval -q fm.ui.browser.pager.move(down=1.0, pages=True) -pmap f eval -q fm.ui.browser.pager.move(down=1.0, pages=True) -pmap eval -q fm.ui.browser.pager.move(down=1.0, pages=True) -pmap p eval -q fm.ui.browser.pager.move(up= 1.0, pages=True) -pmap b eval -q fm.ui.browser.pager.move(up= 1.0, pages=True) -pmap eval -q fm.ui.browser.pager.move(up= 1.0, pages=True) -pmap eval -q fm.ui.browser.pager.move(down=0.8, pages=True) - -pmap h eval -q fm.ui.browser.pager.move(left=4) -pmap l eval -q fm.ui.browser.pager.move(right=4) -pmap eval -q fm.ui.browser.pager.move(left=4) -pmap eval -q fm.ui.browser.pager.move(right=4) +pmap pager_move down=1 +pmap pager_move up=1 +pmap pager_move left=4 +pmap pager_move right=4 +pmap pager_move to=0 +pmap pager_move to=-1 +pmap pager_move down=1.0 pages=True +pmap pager_move up=1.0 pages=True +pmap pager_move down=0.5 pages=True +pmap pager_move up=0.5 pages=True + +copypmap k +copypmap j +copypmap h +copypmap l +copypmap g +copypmap G +copypmap d +copypmap u +copypmap n f +copypmap p b # Basic -pmap q eval -q fm.ui.close_pager(); fm.ui.close_embedded_pager() -pmap i eval -q fm.ui.close_pager(); fm.ui.close_embedded_pager() -pmap eval -q fm.ui.close_pager(); fm.ui.close_embedded_pager() -pmap eval -q fm.ui.close_pager(); fm.ui.close_embedded_pager() +pmap pager_close +copypmap q Q i pmap E edit_file # =================================================================== @@ -343,14 +331,22 @@ pmap E edit_file # =================================================================== # Movement -tmap j eval -q fm.ui.taskview.move(down=1) -tmap k eval -q fm.ui.taskview.move(up=1) -tmap gg eval -q fm.ui.taskview.move(down=0, absolute=True) -tmap G eval -q fm.ui.taskview.move(down=-1, absolute=True) -tmap eval -q fm.ui.taskview.move(down=1) -tmap eval -q fm.ui.taskview.move(up=1) -tmap eval -q fm.ui.taskview.move(down=0, absolute=True) -tmap eval -q fm.ui.taskview.move(down=-1, absolute=True) +tmap taskview_move up=1 +tmap taskview_move down=1 +tmap taskview_move to=0 +tmap taskview_move to=-1 +tmap taskview_move down=1.0 pages=True +tmap taskview_move up=1.0 pages=True +tmap taskview_move down=0.5 pages=True +tmap taskview_move up=0.5 pages=True + +copytmap k +copytmap j +copytmap g +copytmap G +copytmap u +copytmap n f +copytmap p b # Changing priority and deleting tasks tmap J eval -q fm.ui.taskview.task_move(-1) @@ -360,9 +356,6 @@ tmap eval -q fm.ui.taskview.task_move(-1) tmap eval -q fm.ui.taskview.task_move(0) tmap eval -q fm.ui.taskview.task_remove() -# A bunch of aliases for closing -tmap w eval -q fm.ui.close_taskview() -tmap q eval -q fm.ui.close_taskview() -tmap Q eval -q fm.ui.close_taskview() -tmap eval -q fm.ui.close_taskview() -tmap eval -q fm.ui.close_taskview() +# Basic +tmap taskview_close +copytmap q Q w -- cgit 1.4.1-2-gfad0