1 # ===================================================================
2 # This file contains the default startup commands for ranger.
3 # To change them, it is recommended to create either /etc/ranger/rc.conf
4 # (system-wide) or ~/.config/ranger/rc.conf (per user) and add your custom
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.
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".
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 # ===================================================================
19 # ===================================================================
21 # ===================================================================
23 # Which viewmode should be used? Possible values are:
24 # miller: Use miller columns which show multiple levels of the hierarchy
25 # multipane: Midnight-commander like multipane view showing all tabs next
28 #set viewmode multipane
30 # How many columns are there, and what are their relative widths?
31 set column_ratios 1,3,4
33 # Which files should be hidden? (regular expression)
34 set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$
36 # Show hidden files? You can toggle this by typing 'zh'
39 # Ask for a confirmation when running the "delete" command?
40 # Valid values are "always", "never", "multiple" (default)
41 # With "multiple", ranger will ask only if you delete multiple files at once.
42 set confirm_on_delete always
44 # Use non-default path for file preview script?
45 # ranger ships with scope.sh, a script that calls external programs (see
46 # README.md for dependencies) to preview images, archives, etc.
47 #set preview_script ~/.config/ranger/scope.sh
49 # Use the external preview script or display simple plain text or image previews?
50 set use_preview_script true
52 # Automatically count files in the directory, even before entering them?
53 set automatically_count_files true
55 # Open all images in this directory when running certain image viewers
56 # like feh or sxiv? You can still open selected files by marking them.
57 set open_all_images true
59 # Be aware of version control systems and display information.
62 # State of the four backends git, hg, bzr, svn. The possible states are
63 # disabled, local (only show local info), enabled (show local and remote
65 set vcs_backend_git enabled
66 set vcs_backend_hg disabled
67 set vcs_backend_bzr disabled
68 set vcs_backend_svn disabled
70 # Use one of the supported image preview protocols
71 set preview_images false
73 # Set the preview image method. Supported methods:
76 # Preview images in full color with the external command "w3mimgpreview"?
77 # This requires the console web browser "w3m" and a supported terminal.
78 # It has been successfully tested with "xterm" and "urxvt" without tmux.
81 # Preview images in full color using iTerm2 image previews
82 # (http://iterm2.com/images.html). This requires using iTerm2 compiled
83 # with image preview support.
85 # This feature relies on the dimensions of the terminal's font. By default, a
86 # width of 8 and height of 11 are used. To use other values, set the options
87 # iterm2_font_width and iterm2_font_height to the desired values.
90 # Previews images in full color in the terminology terminal emulator.
91 # Supports a wide variety of formats, even vector graphics like svg.
94 # Preview images in full color using urxvt image backgrounds. This
95 # requires using urxvt compiled with pixbuf support.
98 # The same as urxvt but utilizing not only the preview pane but the
99 # whole terminal window.
102 # Preview images in full color using kitty image protocol.
103 # Requires python PIL or pillow library.
104 # If ranger does not share the local filesystem with kitty
105 # the transfer method is changed to encode the whole image;
106 # while slower, this allows remote previews,
107 # for example during an ssh session.
108 # Tmux is unsupported.
109 set preview_images_method w3m
111 # Delay in seconds before displaying an image with the w3m method.
112 # Increase it in case of experiencing display corruption.
115 # Default iTerm2 font size (see: preview_images_method: iterm2)
116 set iterm2_font_width 8
117 set iterm2_font_height 11
119 # Use a unicode "..." character to mark cut-off filenames?
120 set unicode_ellipsis false
122 # BIDI support - try to properly display file names in RTL languages (Hebrew, Arabic).
123 # Requires the python-bidi pip package
124 set bidi_support false
126 # Show dotfiles in the bookmark preview box?
127 set show_hidden_bookmarks true
129 # Which colorscheme to use? These colorschemes are available by default:
130 # default, jungle, snow, solarized
131 set colorscheme default
133 # Preview files on the rightmost column?
134 # And collapse (shrink) the last column if there is nothing to preview?
135 set preview_files true
136 set preview_directories true
137 set collapse_preview true
139 # Save the console history on exit?
140 set save_console_history true
142 # Draw the status bar on top of the browser window (default: bottom)
143 set status_bar_on_top false
145 # Draw a progress bar in the status bar which displays the average state of all
146 # currently running tasks which support progress bars?
147 set draw_progress_bar_in_status_bar true
149 # Draw borders around columns? (separators, outline, both, or none)
150 # Separators are vertical lines between columns.
151 # Outline draws a box around all the columns.
152 # Both combines the two.
153 set draw_borders none
155 # Display the directory name in tabs?
156 set dirname_in_tabs false
158 # Enable the mouse support?
159 set mouse_enabled true
161 # Display the file size in the main column or status bar?
162 set display_size_in_main_column true
163 set display_size_in_status_bar true
165 # Display the free disk space in the status bar?
166 set display_free_space_in_status_bar true
168 # Display files tags in all columns or only in main column?
169 set display_tags_in_all_columns true
171 # Set a title for the window?
172 set update_title false
174 # Set the title to "ranger" in the tmux program?
175 set update_tmux_title true
177 # Shorten the title if it gets long? The number defines how many
178 # directories are displayed at once, 0 turns off this feature.
181 # Show hostname in titlebar?
182 set hostname_in_titlebar true
184 # Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
185 set tilde_in_titlebar true
187 # How many directory-changes or console-commands should be kept in history?
188 set max_history_size 20
189 set max_console_history_size 50
191 # Try to keep so much space between the top/bottom border when scrolling:
194 # Flush the input after each key hit? (Noticeable when ranger lags)
197 # Padding on the right when there's no preview?
198 # This allows you to click into the space to run the file.
199 set padding_right true
201 # Save bookmarks (used with mX and `X) instantly?
202 # This helps to synchronize bookmarks between multiple ranger
203 # instances but leads to *slight* performance loss.
204 # When false, bookmarks are saved when ranger is exited.
205 set autosave_bookmarks true
207 # Save the "`" bookmark to disk. This can be used to switch to the last
208 # directory by typing "``".
209 set save_backtick_bookmark true
211 # You can display the "real" cumulative size of directories by using the
212 # command :get_cumulative_size or typing "dc". The size is expensive to
213 # calculate and will not be updated automatically. You can choose
214 # to update it automatically though by turning on this option:
215 set autoupdate_cumulative_size false
217 # Turning this on makes sense for screen readers:
218 set show_cursor false
220 # One of: size, natural, basename, atime, ctime, mtime, type, random
223 # Additional sorting options
224 set sort_reverse false
225 set sort_case_insensitive true
226 set sort_directories_first true
227 set sort_unicode false
229 # Enable this if key combinations with the Alt Key don't work for you.
230 # (Especially on xterm)
231 set xterm_alt_key false
233 # Whether to include bookmarks in cd command
234 set cd_bookmarks true
236 # Changes case sensitivity for the cd command tab completion
237 set cd_tab_case sensitive
239 # Use fuzzy tab completion with the "cd" command. For example,
240 # ":cd /u/lo/b<tab>" expands to ":cd /usr/local/bin".
241 set cd_tab_fuzzy false
243 # Avoid previewing files larger than this size, in bytes. Use a value of 0 to
244 # disable this feature.
245 set preview_max_size 0
247 # The key hint lists up to this size have their sublists expanded.
248 # Otherwise the submaps are replaced with "...".
249 set hint_collapse_threshold 10
251 # Add the highlighted file to the path in the titlebar
252 set show_selection_in_titlebar true
254 # The delay that ranger idly waits for user input, in milliseconds, with a
255 # resolution of 100ms. Lower delay reduces lag between directory updates but
256 # increases CPU load.
259 # When the metadata manager module looks for metadata, should it only look for
260 # a ".metadata.json" file in the current directory, or do a deep search and
261 # check all directories above the current one as well?
262 set metadata_deep_search false
264 # Clear all existing filters when leaving a directory
265 set clear_filters_on_dir_change false
267 # Disable displaying line numbers in main column.
268 # Possible values: false, absolute, relative.
269 set line_numbers false
271 # When line_numbers=relative show the absolute line number in the
273 set relative_current_zero false
275 # Start line numbers from 1 instead of 0
276 set one_indexed false
279 set save_tabs_on_exit false
281 # Enable scroll wrapping - moving down while on the last item will wrap around to
282 # the top and vice versa.
283 set wrap_scroll false
285 # Set the global_inode_type_filter to nothing. Possible options: d, f and l for
286 # directories, files and symlinks respectively.
287 set global_inode_type_filter
289 # This setting allows to freeze the list of files to save I/O bandwidth. It
290 # should be 'false' during start-up, but you can toggle it by pressing F.
291 set freeze_files false
293 # ===================================================================
295 # ===================================================================
296 # You can set local options that only affect a single directory.
299 # setlocal path=~/downloads sort mtime
301 # ===================================================================
302 # == Command Aliases in the Console
303 # ===================================================================
314 alias filter scout -prts
315 alias find scout -aets
317 alias unmark scout -Mr
318 alias search scout -rs
319 alias search_inc scout -rts
320 alias travel scout -aefklst
322 # ===================================================================
323 # == Define keys for the browser
324 # ===================================================================
332 map F set freeze_files!
334 map <C-l> redraw_window
336 map <esc> change_mode normal
347 map ! console shell%space
348 map @ console -p6 shell %%s
349 map # console shell -p%space
350 map s console shell%space
351 map r chain draw_possible_programs; console open_with%%space
352 map f console find%space
353 map cd console cd%space
355 map <C-p> chain console; eval fm.ui.console.history_move(-1)
357 # Change the line mode
358 map Mf linemode filename
359 map Mi linemode fileinfo
360 map Mm linemode mtime
361 map Mp linemode permissions
362 map Ms linemode sizemtime
363 map Mt linemode metatitle
368 map "<any> tag_toggle tag=%any
369 map <Space> mark_files toggle=True
370 map v mark_files all=True toggle=True
371 map uv mark_files all=True val=False
372 map V toggle_visual_mode
373 map uV toggle_visual_mode reverse=True
375 # For the nostalgics: Midnight Commander bindings
377 map <F2> rename_append
378 map <F3> display_file
382 map <F7> console mkdir%space
383 map <F8> console delete
386 # In case you work on a keyboard with dvorak layout
388 map <DOWN> move down=1
389 map <LEFT> move left=1
390 map <RIGHT> move right=1
393 map <PAGEDOWN> move down=1 pages=True
394 map <PAGEUP> move up=1 pages=True
395 map <CR> move right=1
396 #map <DELETE> console delete
397 map <INSERT> console touch%space
406 copymap <PAGEDOWN> <C-F>
407 copymap <PAGEUP> <C-B>
409 map J move down=0.5 pages=True
410 map K move up=0.5 pages=True
420 map { traverse_backwards
432 map gi eval fm.cd('/run/media/' + os.getenv('USER'))
437 map gR eval fm.cd(ranger.RANGERDIR)
439 map g? cd /usr/share/doc/ranger
443 map du shell -p du --max-depth=1 -h --apparent-size
444 map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh
448 map y. yank name_without_extension
450 # Filesystem Operations
453 map cw console rename%space
455 map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"))
456 map I eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7)
459 map po paste overwrite=True
460 map pP paste append=True
461 map pO paste overwrite=True append=True
462 map pl paste_symlink relative=False
463 map pL paste_symlink relative=True
464 map phl paste_hardlink
465 map pht paste_hardlinked_subtree
467 map dD console delete
472 map dr cut mode=remove
473 map dt cut mode=toggle
478 map yr copy mode=remove
479 map yt copy mode=toggle
481 # Temporary workarounds
482 map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier)
483 map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier)
484 map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier)
485 map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier)
486 map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier)
487 map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier)
488 map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier)
489 map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier)
492 map / console search%space
494 map N search_next forward=False
495 map ct search_next order=tag
496 map cs search_next order=size
497 map ci search_next order=mimetype
498 map cc search_next order=ctime
499 map cm search_next order=mtime
500 map ca search_next order=atime
506 map <S-TAB> tab_move -1
507 map <A-Right> tab_move 1
508 map <A-Left> tab_move -1
523 map <a-r> tab_shift 1
524 map <a-l> tab_shift -1
527 map or set sort_reverse!
528 map oz set sort=random
529 map os chain set sort=size; set sort_reverse=False
530 map ob chain set sort=basename; set sort_reverse=False
531 map on chain set sort=natural; set sort_reverse=False
532 map om chain set sort=mtime; set sort_reverse=False
533 map oc chain set sort=ctime; set sort_reverse=False
534 map oa chain set sort=atime; set sort_reverse=False
535 map ot chain set sort=type; set sort_reverse=False
536 map oe chain set sort=extension; set sort_reverse=False
538 map oS chain set sort=size; set sort_reverse=True
539 map oB chain set sort=basename; set sort_reverse=True
540 map oN chain set sort=natural; set sort_reverse=True
541 map oM chain set sort=mtime; set sort_reverse=True
542 map oC chain set sort=ctime; set sort_reverse=True
543 map oA chain set sort=atime; set sort_reverse=True
544 map oT chain set sort=type; set sort_reverse=True
545 map oE chain set sort=extension; set sort_reverse=True
547 map dc get_cumulative_size
550 map zc set collapse_preview!
551 map zd set sort_directories_first!
552 map zh set show_hidden!
553 map <C-h> set show_hidden!
554 copymap <C-h> <backspace>
555 copymap <backspace> <backspace2>
556 map zI set flushinput!
557 map zi set preview_images!
558 map zm set mouse_enabled!
559 map zp set preview_files!
560 map zP set preview_directories!
561 map zs set sort_case_insensitive!
562 map zu set autoupdate_cumulative_size!
563 map zv set use_preview_script!
564 map zf console filter%space
568 map .n console filter_stack add name%space
569 map .m console filter_stack add mime%space
570 map .d filter_stack add type d
571 map .f filter_stack add type f
572 map .l filter_stack add type l
573 map .| filter_stack add or
574 map .& filter_stack add and
575 map .! filter_stack add not
576 map .r console filter_stack rotate
577 map .c filter_stack clear
578 map .* filter_stack decompose
579 map .p filter_stack pop
580 map .. filter_stack show
583 map `<any> enter_bookmark %any
584 map '<any> enter_bookmark %any
585 map m<any> set_bookmark %any
586 map um<any> unset_bookmark %any
588 map m<bg> draw_bookmarks
589 copymap m<bg> um<bg> `<bg> '<bg>
591 # Generate all the chmod bindings with some python help:
592 eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg))
593 eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg))
594 eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg))
595 eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg))
596 eval for arg in "rwxXst": cmd("map +{0} shell -f chmod u+{0} %s".format(arg))
598 eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg))
599 eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg))
600 eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg))
601 eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg))
602 eval for arg in "rwxXst": cmd("map -{0} shell -f chmod u-{0} %s".format(arg))
604 # ===================================================================
605 # == Define keys for the console
606 # ===================================================================
607 # Note: Unmapped keys are passed directly to the console.
610 cmap <tab> eval fm.ui.console.tab()
611 cmap <s-tab> eval fm.ui.console.tab(-1)
612 cmap <ESC> eval fm.ui.console.close()
613 cmap <CR> eval fm.ui.console.execute()
614 cmap <C-l> redraw_window
620 cmap <up> eval fm.ui.console.history_move(-1)
621 cmap <down> eval fm.ui.console.history_move(1)
622 cmap <left> eval fm.ui.console.move(left=1)
623 cmap <right> eval fm.ui.console.move(right=1)
624 cmap <home> eval fm.ui.console.move(right=0, absolute=True)
625 cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
626 cmap <a-b> eval fm.ui.console.move_word(left=1)
627 cmap <a-f> eval fm.ui.console.move_word(right=1)
629 copycmap <a-b> <a-left>
630 copycmap <a-f> <a-right>
633 cmap <backspace> eval fm.ui.console.delete(-1)
634 cmap <delete> eval fm.ui.console.delete(0)
635 cmap <C-w> eval fm.ui.console.delete_word()
636 cmap <A-d> eval fm.ui.console.delete_word(backward=False)
637 cmap <C-k> eval fm.ui.console.delete_rest(1)
638 cmap <C-u> eval fm.ui.console.delete_rest(-1)
639 cmap <C-y> eval fm.ui.console.paste()
641 # And of course the emacs way
644 copycmap <down> <C-n>
645 copycmap <left> <C-b>
646 copycmap <right> <C-f>
647 copycmap <home> <C-a>
649 copycmap <delete> <C-d>
650 copycmap <backspace> <C-h>
652 # Note: There are multiple ways to express backspaces. <backspace> (code 263)
653 # and <backspace2> (code 127). To be sure, use both.
654 copycmap <backspace> <backspace2>
656 # This special expression allows typing in numerals:
657 cmap <allow_quantifiers> false
659 # ===================================================================
660 # == Pager Keybindings
661 # ===================================================================
664 pmap <down> pager_move down=1
665 pmap <up> pager_move up=1
666 pmap <left> pager_move left=4
667 pmap <right> pager_move right=4
668 pmap <home> pager_move to=0
669 pmap <end> pager_move to=-1
670 pmap <pagedown> pager_move down=1.0 pages=True
671 pmap <pageup> pager_move up=1.0 pages=True
672 pmap <C-d> pager_move down=0.5 pages=True
673 pmap <C-u> pager_move up=0.5 pages=True
675 copypmap <UP> k <C-p>
676 copypmap <DOWN> j <C-n> <CR>
683 copypmap <PAGEDOWN> n f <C-F> <Space>
684 copypmap <PAGEUP> p b <C-B>
687 pmap <C-l> redraw_window
688 pmap <ESC> pager_close
689 copypmap <ESC> q Q i <F3>
692 # ===================================================================
693 # == Taskview Keybindings
694 # ===================================================================
697 tmap <up> taskview_move up=1
698 tmap <down> taskview_move down=1
699 tmap <home> taskview_move to=0
700 tmap <end> taskview_move to=-1
701 tmap <pagedown> taskview_move down=1.0 pages=True
702 tmap <pageup> taskview_move up=1.0 pages=True
703 tmap <C-d> taskview_move down=0.5 pages=True
704 tmap <C-u> taskview_move up=0.5 pages=True
706 copytmap <UP> k <C-p>
707 copytmap <DOWN> j <C-n> <CR>
711 copytmap <PAGEDOWN> n f <C-F> <Space>
712 copytmap <PAGEUP> p b <C-B>
714 # Changing priority and deleting tasks
715 tmap J eval -q fm.ui.taskview.task_move(-1)
716 tmap K eval -q fm.ui.taskview.task_move(0)
717 tmap dd eval -q fm.ui.taskview.task_remove()
718 tmap <pagedown> eval -q fm.ui.taskview.task_move(-1)
719 tmap <pageup> eval -q fm.ui.taskview.task_move(0)
720 tmap <delete> eval -q fm.ui.taskview.task_remove()
723 tmap <C-l> redraw_window
724 tmap <ESC> taskview_close
725 copytmap <ESC> q Q w <C-c>