Advertisement
Guest User

rc.conf

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