summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-10-03 15:59:12 +0200
committerhut <hut@lavabit.com>2011-10-03 15:59:12 +0200
commitd40d1cf901a914430190068e6d8f56e0eb29107d (patch)
treeb7adacc7a8b25938576dd040329126392a39fd29
parent0d7171c2f8fe155d8a715f4704495085736a684a (diff)
downloadranger-d40d1cf901a914430190068e6d8f56e0eb29107d.tar.gz
defaults/rc.conf: use copyXmap to simplify rc.conf
-rw-r--r--ranger/defaults/rc.conf175
1 files 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 <C-r> reset
@@ -44,7 +43,7 @@ map <C-c> 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 <C-d> move down=0.5 pages=True
-map <C-u> move up=0.5   pages=True
-map <C-f> move down=1   pages=True
-map <C-b> move up=1     pages=True
-
 # For the nostalgics: Midnight Commander bindings
 map <F1> help
 map <F3> display_file
@@ -103,6 +88,21 @@ map <CR>       move right=1
 map <DEL>      console delete
 map <INS>      console touch
 
+# VIM-like
+copymap <UP>       k
+copymap <DOWN>     j
+copymap <LEFT>     h
+copymap <RIGHT>    l
+copymap <HOME>     gg
+copymap <END>      G
+copymap <PAGEDOWN> <C-F>
+copymap <PAGEUP>   <C-B>
+
+map J  move down=0.5  pages=True
+map K  move up=0.5    pages=True
+copymap J <C-D>
+copymap K <C-U>
+
 # 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 `<bg>   draw_bookmarks
-map '<bg>   draw_bookmarks
-map m<bg>   draw_bookmarks
-map um<bg>  draw_bookmarks
 map `<any>  enter_bookmark %any
 map '<any>  enter_bookmark %any
 map m<any>  set_bookmark %any
 map um<any> unset_bookmark %any
 
+map m<bg>   draw_bookmarks
+copymap m<bg>  um<bg> `<bg> '<bg>
+
 # 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 <tab>   eval fm.ui.console.tab()
 cmap <s-tab> eval fm.ui.console.tab(-1)
-cmap <C-c>   eval fm.ui.console.close()
-cmap <C-d>   eval fm.ui.console.close()
 cmap <ESC>   eval fm.ui.console.close()
 cmap <CR>    eval fm.ui.console.execute()
-cmap <C-j>   eval fm.ui.console.execute()
 cmap <C-l>   redraw_window
 
-# This special expression allows typing in numerals:
-cmap <allow_quantifiers> false
+copycmap <ESC> <C-c>
+copycmap <CR>  <C-j>
 
 # Move around
+cmap <up>    eval fm.ui.console.history_move(-1)
+cmap <down>  eval fm.ui.console.history_move(1)
 cmap <left>  eval fm.ui.console.move(left=1)
 cmap <right> eval fm.ui.console.move(right=1)
 cmap <home>  eval fm.ui.console.move(right=0, absolute=True)
 cmap <end>   eval fm.ui.console.move(right=-1, absolute=True)
-cmap <up>    eval fm.ui.console.history_move(-1)
-cmap <down>  eval fm.ui.console.history_move(1)
-
-# And of course the emacs way
-cmap <C-b>   eval fm.ui.console.move(left=1)
-cmap <C-f>   eval fm.ui.console.move(right=1)
-cmap <C-a>   eval fm.ui.console.move(right=0, absolute=True)
-cmap <C-e>   eval fm.ui.console.move(right=-1, absolute=True)
-cmap <C-p>   eval fm.ui.console.history_move(-1)
-cmap <C-n>   eval fm.ui.console.history_move(1)
 
 # Line Editing
-# Note: There are multiple ways to express backspaces.  <backspace> (code 263)
-# and <backspace2> (code 127).  To be sure, use both.
 cmap <backspace>  eval fm.ui.console.delete(-1)
-cmap <backspace2> eval fm.ui.console.delete(-1)
 cmap <delete>     eval fm.ui.console.delete(0)
-cmap <C-h>        eval fm.ui.console.delete(-1)
-cmap <C-d>        eval fm.ui.console.delete(0)
 cmap <C-w>        eval fm.ui.console.delete_word()
 cmap <C-k>        eval fm.ui.console.delete_rest(1)
 cmap <C-u>        eval fm.ui.console.delete_rest(-1)
 cmap <C-y>        eval fm.ui.console.paste()
 
+# And of course the emacs way
+copycmap <up>        <C-p>
+copycmap <down>      <C-n>
+copycmap <left>      <C-b>
+copycmap <right>     <C-f>
+copycmap <home>      <C-a>
+copycmap <end>       <C-e>
+copycmap <delete>    <C-d>
+copycmap <backspace> <C-h>
+
+# Note: There are multiple ways to express backspaces.  <backspace> (code 263)
+# and <backspace2> (code 127).  To be sure, use both.
+copycmap <backspace> <backspace2>
+
+# This special expression allows typing in numerals:
+cmap <allow_quantifiers> 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 <cr>    eval -q fm.ui.browser.pager.move(down=1)
-pmap <down>  eval -q fm.ui.browser.pager.move(down=1)
-pmap <up>    eval -q fm.ui.browser.pager.move(up=1)
-pmap <home>  eval -q fm.ui.browser.pager.move(down=0, absolute=True)
-pmap <end>   eval -q fm.ui.browser.pager.move(down=-1, absolute=True)
-pmap <C-n>   eval -q fm.ui.browser.pager.move(down=1)
-pmap <C-p>   eval -q fm.ui.browser.pager.move(up=1)
-
-pmap d          eval -q fm.ui.browser.pager.move(down=0.5, pages=True)
-pmap <C-d>      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 <C-u>      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 <pagedown> 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 <pageup>   eval -q fm.ui.browser.pager.move(up=  1.0, pages=True)
-pmap <space>    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 <left>  eval -q fm.ui.browser.pager.move(left=4)
-pmap <right> eval -q fm.ui.browser.pager.move(right=4)
+pmap  <down>      pager_move  down=1
+pmap  <up>        pager_move  up=1
+pmap  <left>      pager_move  left=4
+pmap  <right>     pager_move  right=4
+pmap  <home>      pager_move  to=0
+pmap  <end>       pager_move  to=-1
+pmap  <pagedown>  pager_move  down=1.0  pages=True
+pmap  <pageup>    pager_move  up=1.0    pages=True
+pmap  <C-d>       pager_move  down=0.5  pages=True
+pmap  <C-u>       pager_move  up=0.5    pages=True
+
+copypmap <UP>       k  <C-p>
+copypmap <DOWN>     j  <C-n> <CR>
+copypmap <LEFT>     h
+copypmap <RIGHT>    l
+copypmap <HOME>     g
+copypmap <END>      G
+copypmap <C-d>      d
+copypmap <C-u>      u
+copypmap <PAGEDOWN> n  f  <C-F>  <Space>
+copypmap <PAGEUP>   p  b  <C-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 <ESC>  eval -q fm.ui.close_pager(); fm.ui.close_embedded_pager()
-pmap <F3>   eval -q fm.ui.close_pager(); fm.ui.close_embedded_pager()
+pmap     <ESC> pager_close
+copypmap <ESC> q Q i <F3>
 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 <down> eval -q fm.ui.taskview.move(down=1)
-tmap <up>   eval -q fm.ui.taskview.move(up=1)
-tmap <home> eval -q fm.ui.taskview.move(down=0, absolute=True)
-tmap <end>  eval -q fm.ui.taskview.move(down=-1, absolute=True)
+tmap <up>        taskview_move up=1
+tmap <down>      taskview_move down=1
+tmap <home>      taskview_move to=0
+tmap <end>       taskview_move to=-1
+tmap <pagedown>  taskview_move down=1.0  pages=True
+tmap <pageup>    taskview_move up=1.0    pages=True
+tmap <C-d>       taskview_move down=0.5  pages=True
+tmap <C-u>       taskview_move up=0.5    pages=True
+
+copytmap <UP>       k  <C-p>
+copytmap <DOWN>     j  <C-n> <CR>
+copytmap <HOME>     g
+copytmap <END>      G
+copytmap <C-u>      u
+copytmap <PAGEDOWN> n  f  <C-F>  <Space>
+copytmap <PAGEUP>   p  b  <C-B>
 
 # Changing priority and deleting tasks
 tmap J          eval -q fm.ui.taskview.task_move(-1)
@@ -360,9 +356,6 @@ tmap <pagedown> eval -q fm.ui.taskview.task_move(-1)
 tmap <pageup>   eval -q fm.ui.taskview.task_move(0)
 tmap <delete>   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 <esc> eval -q fm.ui.close_taskview()
-tmap <c-c> eval -q fm.ui.close_taskview()
+# Basic
+tmap <ESC> taskview_close
+copytmap <ESC> q Q w <C-c>