You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

632 lines
20KB

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