Advertisement
Spirit_of_Stallman

ranger rc.conf

May 7th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.04 KB | None | 0 0
  1. # ===================================================================
  2. # This file contains the default startup commands for ranger.
  3. # To change them, it is recommended to create the file
  4. # ~/.config/ranger/rc.conf and add your custom commands there.
  5. #
  6. # If you copy this whole file there, you may want to set the environment
  7. # variable RANGER_LOAD_DEFAULT_RC to FALSE to avoid loading it twice.
  8. #
  9. # The purpose of this file is mainly to define keybindings and settings.
  10. # For running more complex python code, please create a plugin in "plugins/" or
  11. # a command in "commands.py".
  12. #
  13. # Each line is a command that will be run before the user interface
  14. # is initialized. As a result, you can not use commands which rely
  15. # on the UI such as :delete or :mark.
  16. # ===================================================================
  17.  
  18. # ===================================================================
  19. # == Options
  20. # ===================================================================
  21.  
  22. # How many columns are there, and what are their relative widths?
  23. set column_ratios 1,3,4
  24.  
  25. # Which files should be hidden? (regular expression)
  26. set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$
  27.  
  28. # Show hidden files? You can toggle this by typing 'zh'
  29. set show_hidden false
  30.  
  31. # Ask for a confirmation when running the "delete" command?
  32. # Valid values are "always" (default), "never", "multiple"
  33. # With "multiple", ranger will ask only if you delete multiple files at once.
  34. set confirm_on_delete multiple
  35.  
  36. # Which script is used to generate file previews?
  37. # ranger ships with scope.sh, a script that calls external programs (see
  38. # README for dependencies) to preview images, archives, etc.
  39. set preview_script ~/.config/ranger/scope.sh
  40.  
  41. # Use the external preview script or display simple plain text previews?
  42. set use_preview_script true
  43.  
  44. # Preview images in full color with the external command "w3mimgpreview"?
  45. # This requires the console web browser "w3m" and a supported terminal.
  46. # It has been successfully tested with "xterm" and "urxvt" without tmux.
  47. set preview_images false
  48.  
  49. # Use a unicode "..." character to mark cut-off filenames?
  50. set unicode_ellipsis false
  51.  
  52. # Show dotfiles in the bookmark preview box?
  53. set show_hidden_bookmarks true
  54.  
  55. # Which colorscheme to use? These colorschemes are available by default:
  56. # default, jungle, snow
  57. set colorscheme default
  58.  
  59. # Preview files on the rightmost column?
  60. # And collapse (shrink) the last column if there is nothing to preview?
  61. set preview_files true
  62. set preview_directories true
  63. set collapse_preview true
  64.  
  65. # Save the console history on exit?
  66. set save_console_history true
  67.  
  68. # Draw the status bar on top of the browser window (default: bottom)
  69. set status_bar_on_top false
  70.  
  71. # Draw a progress bar in the status bar which displays the average state of all
  72. # currently running tasks which support progress bars?
  73. set draw_progress_bar_in_status_bar true
  74.  
  75. # Draw borders around columns?
  76. set draw_borders true
  77.  
  78. # Display the directory name in tabs?
  79. set dirname_in_tabs false
  80.  
  81. # Enable the mouse support?
  82. set mouse_enabled false
  83.  
  84. # Display the file size in the main column or status bar?
  85. set display_size_in_main_column true
  86. set display_size_in_status_bar true
  87.  
  88. # Display files tags in all columns or only in main column?
  89. set display_tags_in_all_columns true
  90.  
  91. # Set a title for the window?
  92. set update_title true
  93.  
  94. # Set the title to "ranger" in the tmux program?
  95. set update_tmux_title true
  96.  
  97. # Shorten the title if it gets long? The number defines how many
  98. # directories are displayed at once, 0 turns off this feature.
  99. set shorten_title 3
  100.  
  101. # Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
  102. set tilde_in_titlebar false
  103.  
  104. # How many directory-changes or console-commands should be kept in history?
  105. set max_history_size 50
  106. set max_console_history_size 100
  107.  
  108. # Try to keep so much space between the top/bottom border when scrolling:
  109. set scroll_offset 8
  110.  
  111. # Flush the input after each key hit? (Noticable when ranger lags)
  112. set flushinput true
  113.  
  114. # Padding on the right when there's no preview?
  115. # This allows you to click into the space to run the file.
  116. set padding_right false
  117.  
  118. # Save bookmarks (used with mX and `X) instantly?
  119. # This helps to synchronize bookmarks between multiple ranger
  120. # instances but leads to *slight* performance loss.
  121. # When false, bookmarks are saved when ranger is exited.
  122. set autosave_bookmarks true
  123.  
  124. # You can display the "real" cumulative size of directories by using the
  125. # command :get_cumulative_size or typing "dc". The size is expensive to
  126. # calculate and will not be updated automatically. You can choose
  127. # to update it automatically though by turning on this option:
  128. set autoupdate_cumulative_size false
  129.  
  130. # Turning this on makes sense for screen readers:
  131. set show_cursor false
  132.  
  133. # One of: size, basename, mtime, type
  134. set sort type
  135.  
  136. # Additional sorting options
  137. set sort_reverse false
  138. set sort_case_insensitive true
  139. set sort_directories_first true
  140.  
  141. # Enable this if key combinations with the Alt Key don't work for you.
  142. # (Especially on xterm)
  143. set xterm_alt_key false
  144.  
  145. # ===================================================================
  146. # == Local Options
  147. # ===================================================================
  148. # You can set local options that only affect a single directory.
  149.  
  150. # Examples:
  151. # setlocal path=~/downloads sort mtime
  152.  
  153. # ===================================================================
  154. # == Command Aliases in the Console
  155. # ===================================================================
  156.  
  157. alias e edit
  158. alias q quit
  159. alias q! quitall
  160. alias qall quitall
  161. alias setl setlocal
  162.  
  163. # ===================================================================
  164. # == Define keys for the browser
  165. # ===================================================================
  166.  
  167. # Basic
  168. map Q quit!
  169. map q quit
  170. copymap q ZZ ZQ
  171.  
  172. map R reload_cwd
  173. map <C-r> reset
  174. map <C-l> redraw_window
  175. map <C-c> abort
  176. map <esc> change_mode normal
  177.  
  178. map i display_file
  179. map ? help
  180. map W display_log
  181. map w taskview_open
  182. map S shell $SHELL
  183.  
  184. map : console
  185. map ; console
  186. map ! console shell
  187. map @ console -p6 shell %%s
  188. map # console shell -p
  189. map s console shell
  190. map r chain draw_possible_programs; console open_with
  191. map f console find
  192. map cd console cd
  193.  
  194. # Tagging / Marking
  195. map t tag_toggle
  196. map ut tag_remove
  197. map "<any> tag_toggle tag=%any
  198. map <Space> mark_files toggle=True
  199. map v mark_files all=True toggle=True
  200. map uv mark_files all=True val=False
  201. map V toggle_visual_mode
  202. map uV toggle_visual_mode reverse=True
  203.  
  204. # For the nostalgics: Midnight Commander bindings
  205. map <F1> help
  206. map <F3> display_file
  207. map <F4> edit
  208. map <F5> copy
  209. map <F6> cut
  210. map <F7> console mkdir
  211. map <F8> console delete
  212. map <F10> exit
  213.  
  214. # In case you work on a keyboard with dvorak layout
  215. map <UP> move up=1
  216. map <DOWN> move down=1
  217. map <LEFT> move left=1
  218. map <RIGHT> move right=1
  219. map <HOME> move to=0
  220. map <END> move to=-1
  221. map <PAGEDOWN> move down=1 pages=True
  222. map <PAGEUP> move up=1 pages=True
  223. map <CR> move right=1
  224. map <DELETE> console delete
  225. map <INSERT> console touch
  226.  
  227. # VIM-like
  228. copymap <UP> k
  229. copymap <DOWN> j
  230. copymap <LEFT> h
  231. copymap <RIGHT> l
  232. copymap <HOME> gg
  233. copymap <END> G
  234. copymap <PAGEDOWN> <C-F>
  235. copymap <PAGEUP> <C-B>
  236.  
  237. map J move down=0.5 pages=True
  238. map K move up=0.5 pages=True
  239. copymap J <C-D>
  240. copymap K <C-U>
  241.  
  242. # Jumping around
  243. map H history_go -1
  244. map L history_go 1
  245. map ] move_parent 1
  246. map [ move_parent -1
  247. map } traverse
  248.  
  249. map gh cd ~
  250. map ge cd /etc
  251. map gu cd /usr
  252. map gd cd /dev
  253. map gl cd -r .
  254. map gL cd -r %f
  255. map go cd /opt
  256. map gv cd /var
  257. map gm cd /media
  258. map gM cd /mnt
  259. map gs cd /srv
  260. map gr cd /
  261. map gR eval fm.cd(ranger.RANGERDIR)
  262. map g/ cd /
  263.  
  264. # External Programs
  265. map E edit
  266. map du shell -p du --max-depth=1 -h --apparent-size
  267. map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh
  268. map yp shell -d echo -n %d/%f | xsel -i
  269. map yd shell -d echo -n %d | xsel -i
  270. map yn shell -d echo -n %f | xsel -i
  271.  
  272. # Filesystem Operations
  273. map = chmod
  274.  
  275. map cw console rename
  276. map A eval fm.open_console('rename ' + fm.thisfile.basename)
  277. map I eval fm.open_console('rename ' + fm.thisfile.basename, position=7)
  278.  
  279. map pp paste
  280. map po paste overwrite=True
  281. map pl paste_symlink relative=False
  282. map pL paste_symlink relative=True
  283. map phl paste_hardlink
  284. map pht paste_hardlinked_subtree
  285.  
  286. map dd cut
  287. map ud uncut
  288. map da cut mode=add
  289. map dr cut mode=remove
  290.  
  291. map yy copy
  292. map uy uncut
  293. map ya copy mode=add
  294. map yr copy mode=remove
  295.  
  296. # Temporary workarounds
  297. map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier)
  298. map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier)
  299. map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier)
  300. map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier)
  301. map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier)
  302. map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier)
  303. map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier)
  304. map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier)
  305.  
  306. # Searching
  307. map / console search
  308. map n search_next
  309. map N search_next forward=False
  310. map ct search_next order=tag
  311. map cs search_next order=size
  312. map ci search_next order=mimetype
  313. map cc search_next order=ctime
  314. map cm search_next order=mtime
  315. map ca search_next order=atime
  316.  
  317. # Tabs
  318. map <C-n> tab_new ~
  319. map <C-w> tab_close
  320. map <TAB> tab_move 1
  321. map <S-TAB> tab_move -1
  322. map <A-Right> tab_move 1
  323. map <A-Left> tab_move -1
  324. map gt tab_move 1
  325. map gT tab_move -1
  326. map gn tab_new ~
  327. map gc tab_close
  328. map uq tab_restore
  329. map <a-1> tab_open 1
  330. map <a-2> tab_open 2
  331. map <a-3> tab_open 3
  332. map <a-4> tab_open 4
  333. map <a-5> tab_open 5
  334. map <a-6> tab_open 6
  335. map <a-7> tab_open 7
  336. map <a-8> tab_open 8
  337. map <a-9> tab_open 9
  338.  
  339. # Sorting
  340. map or toggle_option sort_reverse
  341. map os chain set sort=size; set sort_reverse=False
  342. map ob chain set sort=basename; set sort_reverse=False
  343. map on chain set sort=natural; set sort_reverse=False
  344. map om chain set sort=mtime; set sort_reverse=False
  345. map oc chain set sort=ctime; set sort_reverse=False
  346. map oa chain set sort=atime; set sort_reverse=False
  347. map ot chain set sort=type; set sort_reverse=False
  348.  
  349. map oS chain set sort=size; set sort_reverse=True
  350. map oB chain set sort=basename; set sort_reverse=True
  351. map oN chain set sort=natural; set sort_reverse=True
  352. map oM chain set sort=mtime; set sort_reverse=True
  353. map oC chain set sort=ctime; set sort_reverse=True
  354. map oA chain set sort=atime; set sort_reverse=True
  355. map oT chain set sort=type; set sort_reverse=True
  356.  
  357. map dc get_cumulative_size
  358.  
  359. # Settings
  360. map zc toggle_option collapse_preview
  361. map zd toggle_option sort_directories_first
  362. map zh toggle_option show_hidden
  363. map <C-h> toggle_option show_hidden
  364. map zi toggle_option flushinput
  365. map zm toggle_option mouse_enabled
  366. map zp toggle_option preview_files
  367. map zP toggle_option preview_directories
  368. map zs toggle_option sort_case_insensitive
  369. map zu toggle_option autoupdate_cumulative_size
  370. map zv toggle_option use_preview_script
  371. map zf console filter
  372.  
  373. # Bookmarks
  374. map `<any> enter_bookmark %any
  375. map '<any> enter_bookmark %any
  376. map m<any> set_bookmark %any
  377. map um<any> unset_bookmark %any
  378.  
  379. map m<bg> draw_bookmarks
  380. copymap m<bg> um<bg> `<bg> '<bg>
  381.  
  382. # Generate all the chmod bindings with some python help:
  383. eval for arg in "rwxXst": cmd("map +u{0} shell -d chmod u+{0} %s".format(arg))
  384. eval for arg in "rwxXst": cmd("map +g{0} shell -d chmod g+{0} %s".format(arg))
  385. eval for arg in "rwxXst": cmd("map +o{0} shell -d chmod o+{0} %s".format(arg))
  386. eval for arg in "rwxXst": cmd("map +a{0} shell -d chmod a+{0} %s".format(arg))
  387. eval for arg in "rwxXst": cmd("map +{0} shell -d chmod u+{0} %s".format(arg))
  388.  
  389. eval for arg in "rwxXst": cmd("map -u{0} shell -d chmod u-{0} %s".format(arg))
  390. eval for arg in "rwxXst": cmd("map -g{0} shell -d chmod g-{0} %s".format(arg))
  391. eval for arg in "rwxXst": cmd("map -o{0} shell -d chmod o-{0} %s".format(arg))
  392. eval for arg in "rwxXst": cmd("map -a{0} shell -d chmod a-{0} %s".format(arg))
  393. eval for arg in "rwxXst": cmd("map -{0} shell -d chmod u-{0} %s".format(arg))
  394.  
  395. # ===================================================================
  396. # == Define keys for the console
  397. # ===================================================================
  398. # Note: Unmapped keys are passed directly to the console.
  399.  
  400. # Basic
  401. cmap <tab> eval fm.ui.console.tab()
  402. cmap <s-tab> eval fm.ui.console.tab(-1)
  403. cmap <ESC> eval fm.ui.console.close()
  404. cmap <CR> eval fm.ui.console.execute()
  405. cmap <C-l> redraw_window
  406.  
  407. copycmap <ESC> <C-c>
  408. copycmap <CR> <C-j>
  409.  
  410. # Move around
  411. cmap <up> eval fm.ui.console.history_move(-1)
  412. cmap <down> eval fm.ui.console.history_move(1)
  413. cmap <left> eval fm.ui.console.move(left=1)
  414. cmap <right> eval fm.ui.console.move(right=1)
  415. cmap <home> eval fm.ui.console.move(right=0, absolute=True)
  416. cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
  417.  
  418. # Line Editing
  419. cmap <backspace> eval fm.ui.console.delete(-1)
  420. cmap <delete> eval fm.ui.console.delete(0)
  421. cmap <C-w> eval fm.ui.console.delete_word()
  422. cmap <C-k> eval fm.ui.console.delete_rest(1)
  423. cmap <C-u> eval fm.ui.console.delete_rest(-1)
  424. cmap <C-y> eval fm.ui.console.paste()
  425.  
  426. # And of course the emacs way
  427. copycmap <up> <C-p>
  428. copycmap <down> <C-n>
  429. copycmap <left> <C-b>
  430. copycmap <right> <C-f>
  431. copycmap <home> <C-a>
  432. copycmap <end> <C-e>
  433. copycmap <delete> <C-d>
  434. copycmap <backspace> <C-h>
  435.  
  436. # Note: There are multiple ways to express backspaces. <backspace> (code 263)
  437. # and <backspace2> (code 127). To be sure, use both.
  438. copycmap <backspace> <backspace2>
  439.  
  440. # This special expression allows typing in numerals:
  441. cmap <allow_quantifiers> false
  442.  
  443. # ===================================================================
  444. # == Pager Keybindings
  445. # ===================================================================
  446.  
  447. # Movement
  448. pmap <down> pager_move down=1
  449. pmap <up> pager_move up=1
  450. pmap <left> pager_move left=4
  451. pmap <right> pager_move right=4
  452. pmap <home> pager_move to=0
  453. pmap <end> pager_move to=-1
  454. pmap <pagedown> pager_move down=1.0 pages=True
  455. pmap <pageup> pager_move up=1.0 pages=True
  456. pmap <C-d> pager_move down=0.5 pages=True
  457. pmap <C-u> pager_move up=0.5 pages=True
  458.  
  459. copypmap <UP> k <C-p>
  460. copypmap <DOWN> j <C-n> <CR>
  461. copypmap <LEFT> h
  462. copypmap <RIGHT> l
  463. copypmap <HOME> g
  464. copypmap <END> G
  465. copypmap <C-d> d
  466. copypmap <C-u> u
  467. copypmap <PAGEDOWN> n f <C-F> <Space>
  468. copypmap <PAGEUP> p b <C-B>
  469.  
  470. # Basic
  471. pmap <ESC> pager_close
  472. copypmap <ESC> q Q i <F3>
  473. pmap E edit_file
  474.  
  475. # ===================================================================
  476. # == Taskview Keybindings
  477. # ===================================================================
  478.  
  479. # Movement
  480. tmap <up> taskview_move up=1
  481. tmap <down> taskview_move down=1
  482. tmap <home> taskview_move to=0
  483. tmap <end> taskview_move to=-1
  484. tmap <pagedown> taskview_move down=1.0 pages=True
  485. tmap <pageup> taskview_move up=1.0 pages=True
  486. tmap <C-d> taskview_move down=0.5 pages=True
  487. tmap <C-u> taskview_move up=0.5 pages=True
  488.  
  489. copytmap <UP> k <C-p>
  490. copytmap <DOWN> j <C-n> <CR>
  491. copytmap <HOME> g
  492. copytmap <END> G
  493. copytmap <C-u> u
  494. copytmap <PAGEDOWN> n f <C-F> <Space>
  495. copytmap <PAGEUP> p b <C-B>
  496.  
  497. # Changing priority and deleting tasks
  498. tmap J eval -q fm.ui.taskview.task_move(-1)
  499. tmap K eval -q fm.ui.taskview.task_move(0)
  500. tmap dd eval -q fm.ui.taskview.task_remove()
  501. tmap <pagedown> eval -q fm.ui.taskview.task_move(-1)
  502. tmap <pageup> eval -q fm.ui.taskview.task_move(0)
  503. tmap <delete> eval -q fm.ui.taskview.task_remove()
  504.  
  505. # Basic
  506. tmap <ESC> taskview_close
  507. copytmap <ESC> q Q w <C-c>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement