Dotfiles for my tiling window manager + terminal workflow.
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.

676 lines
21 KiB

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