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.

537 lines
16 KiB

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