SUP3R-US3R

Config Ranger

May 22nd, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.64 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,6
  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", "never", "multiple" (default)
  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.md 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 or image previews?
  42. set use_preview_script true
  43.  
  44. # Automatically count files in the directory, even before entering them?
  45. set automatically_count_files true
  46.  
  47. # Open all images in this directory when running certain image viewers
  48. # like feh or sxiv? You can still open selected files by marking them.
  49. set open_all_images true
  50.  
  51. # Be aware of version control systems and display information.
  52. set vcs_aware false
  53.  
  54. # State of the three backends git, hg, bzr. The possible states are
  55. # disabled, local (only show local info), enabled (show local and remote
  56. # information).
  57. set vcs_backend_git enabled
  58. set vcs_backend_hg disabled
  59. set vcs_backend_bzr disabled
  60.  
  61. # Use one of the supported image preview protocols
  62. set preview_images true
  63.  
  64. # Set the preview image method. Supported methods:
  65. #
  66. # * w3m (default):
  67. # Preview images in full color with the external command "w3mimgpreview"?
  68. # This requires the console web browser "w3m" and a supported terminal.
  69. # It has been successfully tested with "xterm" and "urxvt" without tmux.
  70. #
  71. # * iterm2:
  72. # Preview images in full color using iTerm2 image previews
  73. # (http://iterm2.com/images.html). This requires using iTerm2 compiled
  74. # with image preview support.
  75. set preview_images_method w3m
  76.  
  77. # Use a unicode "..." character to mark cut-off filenames?
  78. set unicode_ellipsis false
  79.  
  80. # Show dotfiles in the bookmark preview box?
  81. set show_hidden_bookmarks true
  82.  
  83. # Which colorscheme to use? These colorschemes are available by default:
  84. # default, jungle, snow, solarized
  85. set colorscheme default
  86.  
  87. # Preview files on the rightmost column?
  88. # And collapse (shrink) the last column if there is nothing to preview?
  89. set preview_files true
  90. set preview_directories true
  91. set collapse_preview true
  92.  
  93. # Save the console history on exit?
  94. set save_console_history true
  95.  
  96. # Draw the status bar on top of the browser window (default: bottom)
  97. set status_bar_on_top false
  98.  
  99. # Draw a progress bar in the status bar which displays the average state of all
  100. # currently running tasks which support progress bars?
  101. set draw_progress_bar_in_status_bar true
  102.  
  103. # Draw borders around columns?
  104. set draw_borders true
  105.  
  106. # Display the directory name in tabs?
  107. set dirname_in_tabs false
  108.  
  109. # Enable the mouse support?
  110. set mouse_enabled true
  111.  
  112. # Display the file size in the main column or status bar?
  113. set display_size_in_main_column true
  114. set display_size_in_status_bar true
  115.  
  116. # Display files tags in all columns or only in main column?
  117. set display_tags_in_all_columns true
  118.  
  119. # Set a title for the window?
  120. set update_title false
  121.  
  122. # Set the title to "ranger" in the tmux program?
  123. set update_tmux_title false
  124.  
  125. # Shorten the title if it gets long? The number defines how many
  126. # directories are displayed at once, 0 turns off this feature.
  127. set shorten_title 3
  128.  
  129. # Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
  130. set tilde_in_titlebar false
  131.  
  132. # How many directory-changes or console-commands should be kept in history?
  133. set max_history_size 20
  134. set max_console_history_size 50
  135.  
  136. # Try to keep so much space between the top/bottom border when scrolling:
  137. set scroll_offset 8
  138.  
  139. # Flush the input after each key hit? (Noticable when ranger lags)
  140. set flushinput true
  141.  
  142. # Padding on the right when there's no preview?
  143. # This allows you to click into the space to run the file.
  144. set padding_right true
  145.  
  146. # Save bookmarks (used with mX and `X) instantly?
  147. # This helps to synchronize bookmarks between multiple ranger
  148. # instances but leads to *slight* performance loss.
  149. # When false, bookmarks are saved when ranger is exited.
  150. set autosave_bookmarks true
  151.  
  152. # You can display the "real" cumulative size of directories by using the
  153. # command :get_cumulative_size or typing "dc". The size is expensive to
  154. # calculate and will not be updated automatically. You can choose
  155. # to update it automatically though by turning on this option:
  156. set autoupdate_cumulative_size false
  157.  
  158. # Turning this on makes sense for screen readers:
  159. set show_cursor false
  160.  
  161. # One of: size, natural, basename, atime, ctime, mtime, type, random
  162. set sort natural
  163.  
  164. # Additional sorting options
  165. set sort_reverse false
  166. set sort_case_insensitive true
  167. set sort_directories_first true
  168. set sort_unicode false
  169.  
  170. # Enable this if key combinations with the Alt Key don't work for you.
  171. # (Especially on xterm)
  172. set xterm_alt_key false
  173.  
  174. # Whether to include bookmarks in cd command
  175. set cd_bookmarks true
  176.  
  177. # Avoid previewing files larger than this size, in bytes. Use a value of 0 to
  178. # disable this feature.
  179. set preview_max_size 0
  180.  
  181. # Add the highlighted file to the path in the titlebar
  182. set show_selection_in_titlebar true
  183.  
  184. # The delay that ranger idly waits for user input, in milliseconds, with a
  185. # resolution of 100ms. Lower delay reduces lag between directory updates but
  186. # increases CPU load.
  187. set idle_delay 2000
  188.  
  189. # When the metadata manager module looks for metadata, should it only look for
  190. # a ".metadata.json" file in the current directory, or do a deep search and
  191. # check all directories above the current one as well?
  192. set metadata_deep_search false
  193.  
  194. # ===================================================================
  195. # == Local Options
  196. # ===================================================================
  197. # You can set local options that only affect a single directory.
  198.  
  199. # Examples:
  200. # setlocal path=~/downloads sort mtime
  201.  
  202. # ===================================================================
  203. # == Command Aliases in the Console
  204. # ===================================================================
  205.  
  206. alias e edit
  207. alias q quit
  208. alias q! quitall
  209. alias qa quitall
  210. alias qall quitall
  211. alias setl setlocal
  212.  
  213. alias filter scout -prt
  214. alias find scout -aeit
  215. alias mark scout -mr
  216. alias unmark scout -Mr
  217. alias search scout -rs
  218. alias search_inc scout -rts
  219. alias travel scout -aefiklst
  220.  
  221. # ===================================================================
  222. # == Define keys for the browser
  223. # ===================================================================
  224.  
  225. # Basic
  226. map Q quit!
  227. map q quit
  228. copymap q ZZ ZQ
  229.  
  230. map R reload_cwd
  231. map <C-r> reset
  232. map <C-l> redraw_window
  233. map <C-c> abort
  234. map <esc> change_mode normal
  235.  
  236. map i display_file
  237. map ? help
  238. map W display_log
  239. map w taskview_open
  240. map S shell $SHELL
  241.  
  242. map : console
  243. map ; console
  244. map ! console shell%space
  245. map @ console -p6 shell %%s
  246. map # console shell -p%space
  247. map s console shell%space
  248. map r chain draw_possible_programs; console open_with%space
  249. map f console find%space
  250. map cd console cd%space
  251.  
  252. # Change the line mode
  253. map Mf linemode filename
  254. map Mi linemode fileinfo
  255. map Mp linemode permissions
  256. map Mt linemode metatitle
  257.  
  258. # Tagging / Marking
  259. map t tag_toggle
  260. map ut tag_remove
  261. map "<any> tag_toggle tag=%any
  262. map <Space> mark_files toggle=True
  263. map v mark_files all=True toggle=True
  264. map uv mark_files all=True val=False
  265. map V toggle_visual_mode
  266. map uV toggle_visual_mode reverse=True
  267.  
  268. # For the nostalgics: Midnight Commander bindings
  269. map <F1> help
  270. map <F3> display_file
  271. map <F2> edit
  272. map <F4> copy
  273. map <F5> paste
  274. #map <F6> cut
  275. map <F7> console mkdir%space
  276. map <F8> console delete
  277. map <F10> exit
  278.  
  279. # In case you work on a keyboard with dvorak layout
  280. map <UP> move up=1
  281. map <DOWN> move down=1
  282. map <LEFT> move left=1
  283. map <RIGHT> move right=1
  284. map <HOME> move to=0
  285. map <END> move to=-1
  286. map <PAGEDOWN> move down=1 pages=True
  287. map <PAGEUP> move up=1 pages=True
  288. map <CR> move right=1
  289. #map <DELETE> console delete
  290. map <INSERT> console touch%space
  291.  
  292. # VIM-like
  293. copymap <UP> k
  294. copymap <DOWN> j
  295. copymap <LEFT> h
  296. copymap <RIGHT> l
  297. copymap <HOME> gg
  298. copymap <END> G
  299. copymap <PAGEDOWN> <C-F>
  300. copymap <PAGEUP> <C-B>
  301.  
  302. map J move down=0.5 pages=True
  303. map K move up=0.5 pages=True
  304. copymap J <C-D>
  305. copymap K <C-U>
  306.  
  307. # Jumping around
  308. map H history_go -1
  309. map L history_go 1
  310. map ] move_parent 1
  311. map [ move_parent -1
  312. map } traverse
  313.  
  314. map gh cd ~
  315. map ge cd /etc
  316. map gu cd /usr
  317. map gd cd /dev
  318. map gl cd -r .
  319. map gL cd -r %f
  320. map go cd /opt
  321. map gv cd /var
  322. map gm cd /media
  323. map gM cd /mnt
  324. map gs cd /srv
  325. map gr cd /
  326. map gR eval fm.cd(ranger.RANGERDIR)
  327. map g/ cd /
  328. map g? cd /usr/share/doc/ranger
  329.  
  330. # External Programs
  331. map E edit
  332. map du shell -p du --max-depth=1 -h --apparent-size
  333. map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh
  334. map yp shell -f echo -n %d/%f | xsel -i; xsel -o | xsel -i -b
  335. map yd shell -f echo -n %d | xsel -i; xsel -o | xsel -i -b
  336. map yn shell -f echo -n %f | xsel -i; xsel -o | xsel -i -b
  337.  
  338. # Filesystem Operations
  339. map = chmod
  340.  
  341. map cw console rename%space
  342. map a rename_append
  343. map A eval fm.open_console('rename ' + fm.thisfile.basename)
  344. map I eval fm.open_console('rename ' + fm.thisfile.basename, position=7)
  345.  
  346. map pp paste
  347. map po paste overwrite=True
  348. map pl paste_symlink relative=False
  349. map pL paste_symlink relative=True
  350. map phl paste_hardlink
  351. map pht paste_hardlinked_subtree
  352.  
  353. map dD console delete
  354.  
  355. map dd cut
  356. map ud uncut
  357. map da cut mode=add
  358. map dr cut mode=remove
  359.  
  360. map yy copy
  361. map uy uncut
  362. map ya copy mode=add
  363. map yr copy mode=remove
  364.  
  365. # Temporary workarounds
  366. map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier)
  367. map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier)
  368. map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier)
  369. map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier)
  370. map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier)
  371. map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier)
  372. map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier)
  373. map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier)
  374.  
  375. # Searching
  376. map / console search%space
  377. map n search_next
  378. map N search_next forward=False
  379. map ct search_next order=tag
  380. map cs search_next order=size
  381. map ci search_next order=mimetype
  382. map cc search_next order=ctime
  383. map cm search_next order=mtime
  384. map ca search_next order=atime
  385.  
  386. # Tabs
  387. map <C-n> tab_new ~
  388. map <C-w> tab_close
  389. map <TAB> tab_move 1
  390. map <S-TAB> tab_move -1
  391. map <A-Right> tab_move 1
  392. map <A-Left> tab_move -1
  393. map gt tab_move 1
  394. map gT tab_move -1
  395. map gn tab_new ~
  396. map gc tab_close
  397. map uq tab_restore
  398. map <a-1> tab_open 1
  399. map <a-2> tab_open 2
  400. map <a-3> tab_open 3
  401. map <a-4> tab_open 4
  402. map <a-5> tab_open 5
  403. map <a-6> tab_open 6
  404. map <a-7> tab_open 7
  405. map <a-8> tab_open 8
  406. map <a-9> tab_open 9
  407.  
  408. # Sorting
  409. map or toggle_option sort_reverse
  410. map oz set sort=random
  411. map os chain set sort=size; set sort_reverse=False
  412. map ob chain set sort=basename; set sort_reverse=False
  413. map on chain set sort=natural; set sort_reverse=False
  414. map om chain set sort=mtime; set sort_reverse=False
  415. map oc chain set sort=ctime; set sort_reverse=False
  416. map oa chain set sort=atime; set sort_reverse=False
  417. map ot chain set sort=type; set sort_reverse=False
  418. map oe chain set sort=extension; set sort_reverse=False
  419.  
  420. map oS chain set sort=size; set sort_reverse=True
  421. map oB chain set sort=basename; set sort_reverse=True
  422. map oN chain set sort=natural; set sort_reverse=True
  423. map oM chain set sort=mtime; set sort_reverse=True
  424. map oC chain set sort=ctime; set sort_reverse=True
  425. map oA chain set sort=atime; set sort_reverse=True
  426. map oT chain set sort=type; set sort_reverse=True
  427. map oE chain set sort=extension; set sort_reverse=True
  428.  
  429. map dc get_cumulative_size
  430.  
  431. # Settings
  432. map zc toggle_option collapse_preview
  433. map zd toggle_option sort_directories_first
  434. map zh toggle_option show_hidden
  435. map <C-h> toggle_option show_hidden
  436. map zi toggle_option flushinput
  437. map zm toggle_option mouse_enabled
  438. map zp toggle_option preview_files
  439. map zP toggle_option preview_directories
  440. map zs toggle_option sort_case_insensitive
  441. map zu toggle_option autoupdate_cumulative_size
  442. map zv toggle_option use_preview_script
  443. map zf console filter%space
  444.  
  445. # Bookmarks
  446. map `<any> enter_bookmark %any
  447. map '<any> enter_bookmark %any
  448. map m<any> set_bookmark %any
  449. map um<any> unset_bookmark %any
  450.  
  451. map m<bg> draw_bookmarks
  452. copymap m<bg> um<bg> `<bg> '<bg>
  453.  
  454. # Generate all the chmod bindings with some python help:
  455. eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg))
  456. eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg))
  457. eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg))
  458. eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg))
  459. eval for arg in "rwxXst": cmd("map +{0} shell -f chmod u+{0} %s".format(arg))
  460.  
  461. eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg))
  462. eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg))
  463. eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg))
  464. eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg))
  465. eval for arg in "rwxXst": cmd("map -{0} shell -f chmod u-{0} %s".format(arg))
  466.  
  467. # ===================================================================
  468. # == Define keys for the console
  469. # ===================================================================
  470. # Note: Unmapped keys are passed directly to the console.
  471.  
  472. # Basic
  473. cmap <tab> eval fm.ui.console.tab()
  474. cmap <s-tab> eval fm.ui.console.tab(-1)
  475. cmap <ESC> eval fm.ui.console.close()
  476. cmap <CR> eval fm.ui.console.execute()
  477. cmap <C-l> redraw_window
  478.  
  479. copycmap <ESC> <C-c>
  480. copycmap <CR> <C-j>
  481.  
  482. # Move around
  483. cmap <up> eval fm.ui.console.history_move(-1)
  484. cmap <down> eval fm.ui.console.history_move(1)
  485. cmap <left> eval fm.ui.console.move(left=1)
  486. cmap <right> eval fm.ui.console.move(right=1)
  487. cmap <home> eval fm.ui.console.move(right=0, absolute=True)
  488. cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
  489.  
  490. # Line Editing
  491. cmap <backspace> eval fm.ui.console.delete(-1)
  492. cmap <delete> eval fm.ui.console.delete(0)
  493. cmap <C-w> eval fm.ui.console.delete_word()
  494. cmap <C-k> eval fm.ui.console.delete_rest(1)
  495. cmap <C-u> eval fm.ui.console.delete_rest(-1)
  496. cmap <C-y> eval fm.ui.console.paste()
  497.  
  498. # And of course the emacs way
  499. copycmap <up> <C-p>
  500. copycmap <down> <C-n>
  501. copycmap <left> <C-b>
  502. copycmap <right> <C-f>
  503. copycmap <home> <C-a>
  504. copycmap <end> <C-e>
  505. copycmap <delete> <C-d>
  506. copycmap <backspace> <C-h>
  507.  
  508. # Note: There are multiple ways to express backspaces. <backspace> (code 263)
  509. # and <backspace2> (code 127). To be sure, use both.
  510. copycmap <backspace> <backspace2>
  511.  
  512. # This special expression allows typing in numerals:
  513. cmap <allow_quantifiers> false
  514.  
  515. # ===================================================================
  516. # == Pager Keybindings
  517. # ===================================================================
  518.  
  519. # Movement
  520. pmap <down> pager_move down=1
  521. pmap <up> pager_move up=1
  522. pmap <left> pager_move left=4
  523. pmap <right> pager_move right=4
  524. pmap <home> pager_move to=0
  525. pmap <end> pager_move to=-1
  526. pmap <pagedown> pager_move down=1.0 pages=True
  527. pmap <pageup> pager_move up=1.0 pages=True
  528. pmap <C-d> pager_move down=0.5 pages=True
  529. pmap <C-u> pager_move up=0.5 pages=True
  530.  
  531. copypmap <UP> k <C-p>
  532. copypmap <DOWN> j <C-n> <CR>
  533. copypmap <LEFT> h
  534. copypmap <RIGHT> l
  535. copypmap <HOME> g
  536. copypmap <END> G
  537. copypmap <C-d> d
  538. copypmap <C-u> u
  539. copypmap <PAGEDOWN> n f <C-F> <Space>
  540. copypmap <PAGEUP> p b <C-B>
  541.  
  542. # Basic
  543. pmap <C-l> redraw_window
  544. pmap <ESC> pager_close
  545. copypmap <ESC> q Q i <F3>
  546. pmap E edit_file
  547.  
  548. # ===================================================================
  549. # == Taskview Keybindings
  550. # ===================================================================
  551.  
  552. # Movement
  553. tmap <up> taskview_move up=1
  554. tmap <down> taskview_move down=1
  555. tmap <home> taskview_move to=0
  556. tmap <end> taskview_move to=-1
  557. tmap <pagedown> taskview_move down=1.0 pages=True
  558. tmap <pageup> taskview_move up=1.0 pages=True
  559. tmap <C-d> taskview_move down=0.5 pages=True
  560. tmap <C-u> taskview_move up=0.5 pages=True
  561.  
  562. copytmap <UP> k <C-p>
  563. copytmap <DOWN> j <C-n> <CR>
  564. copytmap <HOME> g
  565. copytmap <END> G
  566. copytmap <C-u> u
  567. copytmap <PAGEDOWN> n f <C-F> <Space>
  568. copytmap <PAGEUP> p b <C-B>
  569.  
  570. # Changing priority and deleting tasks
  571. tmap J eval -q fm.ui.taskview.task_move(-1)
  572. tmap K eval -q fm.ui.taskview.task_move(0)
  573. tmap dd eval -q fm.ui.taskview.task_remove()
  574. tmap <pagedown> eval -q fm.ui.taskview.task_move(-1)
  575. tmap <pageup> eval -q fm.ui.taskview.task_move(0)
  576. tmap <delete> eval -q fm.ui.taskview.task_remove()
  577.  
  578. # Basic
  579. tmap <C-l> redraw_window
  580. tmap <ESC> taskview_close
  581. copytmap <ESC> q Q w <C-c>
Advertisement
Add Comment
Please, Sign In to add comment