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.
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.
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".
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 # ===================================================================
18 # ===================================================================
20 # ===================================================================
22 # How many columns are there, and what are their relative widths?
23 set column_ratios 1,3,4
25 # Which files should be hidden? (regular expression)
26 set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$
28 # Show hidden files? You can toggle this by typing 'zh'
31 # Ask for a confirmation when running the "delete" command?
32 # Valid values are "always" (default), "never", "multiple"
33 # With "multiple", ranger will ask only if you delete multiple files at once.
34 set confirm_on_delete multiple
36 # Which script is used to generate file previews?
37 # ranger ships with scope.sh, a script that calls external programs (see
38 # README for dependencies) to preview images, archives, etc.
39 set preview_script ~/.config/ranger/scope.sh
41 # Use the external preview script or display simple plain text previews?
42 set use_preview_script 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
48 # Be aware of version control systems and display information.
51 # State of the three backends git, hg, bzr. The possible states are
52 # disabled, local (only show local info), enabled (show local and remote
54 set vcs_backend_git enabled
55 set vcs_backend_hg disabled
56 set vcs_backend_bzr disabled
58 # Preview images in full color with the external command "w3mimgpreview"?
59 # This requires the console web browser "w3m" and a supported terminal.
60 # It has been successfully tested with "xterm" and "urxvt" without tmux.
61 set preview_images true
63 # Use a unicode "..." character to mark cut-off filenames?
64 set unicode_ellipsis false
66 # Show dotfiles in the bookmark preview box?
67 set show_hidden_bookmarks true
69 # Which colorscheme to use? These colorschemes are available by default:
70 # default, jungle, snow
71 set colorscheme default
73 # Preview files on the rightmost column?
74 # And collapse (shrink) the last column if there is nothing to preview?
75 set preview_files true
76 set preview_directories true
77 set collapse_preview true
79 # Save the console history on exit?
80 set save_console_history true
82 # Draw the status bar on top of the browser window (default: bottom)
83 set status_bar_on_top false
85 # Draw a progress bar in the status bar which displays the average state of all
86 # currently running tasks which support progress bars?
87 set draw_progress_bar_in_status_bar true
89 # Draw borders around columns?
92 # Display the directory name in tabs?
93 set dirname_in_tabs false
95 # Enable the mouse support?
96 set mouse_enabled true
98 # Display the file size in the main column or status bar?
99 set display_size_in_main_column true
100 set display_size_in_status_bar true
102 # Display files tags in all columns or only in main column?
103 set display_tags_in_all_columns true
105 # Set a title for the window?
106 set update_title false
108 # Set the title to "ranger" in the tmux program?
109 set update_tmux_title false
111 # Shorten the title if it gets long? The number defines how many
112 # directories are displayed at once, 0 turns off this feature.
115 # Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
116 set tilde_in_titlebar false
118 # How many directory-changes or console-commands should be kept in history?
119 set max_history_size 20
120 set max_console_history_size 50
122 # Try to keep so much space between the top/bottom border when scrolling:
125 # Flush the input after each key hit? (Noticable when ranger lags)
128 # Padding on the right when there's no preview?
129 # This allows you to click into the space to run the file.
130 set padding_right true
132 # Save bookmarks (used with mX and `X) instantly?
133 # This helps to synchronize bookmarks between multiple ranger
134 # instances but leads to *slight* performance loss.
135 # When false, bookmarks are saved when ranger is exited.
136 set autosave_bookmarks true
138 # You can display the "real" cumulative size of directories by using the
139 # command :get_cumulative_size or typing "dc". The size is expensive to
140 # calculate and will not be updated automatically. You can choose
141 # to update it automatically though by turning on this option:
142 set autoupdate_cumulative_size false
144 # Turning this on makes sense for screen readers:
145 set show_cursor false
147 # One of: size, basename, mtime, type
150 # Additional sorting options
151 set sort_reverse false
152 set sort_case_insensitive true
153 set sort_directories_first true
155 # Enable this if key combinations with the Alt Key don't work for you.
156 # (Especially on xterm)
157 set xterm_alt_key false
159 # ===================================================================
161 # ===================================================================
162 # You can set local options that only affect a single directory.
165 # setlocal path=~/downloads sort mtime
167 # ===================================================================
168 # == Command Aliases in the Console
169 # ===================================================================
177 alias filter scout -prt
178 alias find scout -aet
180 alias unmark scout -Mr
181 alias search scout -rs
182 alias search_inc scout -rts
183 alias travel scout -aefiklst
185 # ===================================================================
186 # == Define keys for the browser
187 # ===================================================================
196 map <C-l> redraw_window
198 map <esc> change_mode normal
209 map @ console -p6 shell %%s
210 map # console shell -p
212 map r chain draw_possible_programs; console open_with
219 map "<any> tag_toggle tag=%any
220 map <Space> mark_files toggle=True
221 map v mark_files all=True toggle=True
222 map uv mark_files all=True val=False
223 map V toggle_visual_mode
224 map uV toggle_visual_mode reverse=True
226 # For the nostalgics: Midnight Commander bindings
228 map <F3> display_file
232 map <F7> console mkdir
233 map <F8> console delete
236 # In case you work on a keyboard with dvorak layout
238 map <DOWN> move down=1
239 map <LEFT> move left=1
240 map <RIGHT> move right=1
243 map <PAGEDOWN> move down=1 pages=True
244 map <PAGEUP> move up=1 pages=True
245 map <CR> move right=1
246 map <DELETE> console delete
247 map <INSERT> console touch
256 copymap <PAGEDOWN> <C-F>
257 copymap <PAGEUP> <C-B>
259 map J move down=0.5 pages=True
260 map K move up=0.5 pages=True
283 map gR eval fm.cd(ranger.RANGERDIR)
285 map g? cd /usr/share/doc/ranger
289 map du shell -p du --max-depth=1 -h --apparent-size
290 map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh
291 map yp shell -d echo -n %d/%f | xsel -i
292 map yd shell -d echo -n %d | xsel -i
293 map yn shell -d echo -n %f | xsel -i
295 # Filesystem Operations
298 map cw console rename
299 map A eval fm.open_console('rename ' + fm.thisfile.basename)
300 map I eval fm.open_console('rename ' + fm.thisfile.basename, position=7)
303 map po paste overwrite=True
304 map pl paste_symlink relative=False
305 map pL paste_symlink relative=True
306 map phl paste_hardlink
307 map pht paste_hardlinked_subtree
312 map dr cut mode=remove
317 map yr copy mode=remove
319 # Temporary workarounds
320 map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier)
321 map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier)
322 map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier)
323 map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier)
324 map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier)
325 map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier)
326 map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier)
327 map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier)
332 map N search_next forward=False
333 map ct search_next order=tag
334 map cs search_next order=size
335 map ci search_next order=mimetype
336 map cc search_next order=ctime
337 map cm search_next order=mtime
338 map ca search_next order=atime
344 map <S-TAB> tab_move -1
345 map <A-Right> tab_move 1
346 map <A-Left> tab_move -1
363 map or toggle_option sort_reverse
364 map os chain set sort=size; set sort_reverse=False
365 map ob chain set sort=basename; set sort_reverse=False
366 map on chain set sort=natural; set sort_reverse=False
367 map om chain set sort=mtime; set sort_reverse=False
368 map oc chain set sort=ctime; set sort_reverse=False
369 map oa chain set sort=atime; set sort_reverse=False
370 map ot chain set sort=type; set sort_reverse=False
372 map oS chain set sort=size; set sort_reverse=True
373 map oB chain set sort=basename; set sort_reverse=True
374 map oN chain set sort=natural; set sort_reverse=True
375 map oM chain set sort=mtime; set sort_reverse=True
376 map oC chain set sort=ctime; set sort_reverse=True
377 map oA chain set sort=atime; set sort_reverse=True
378 map oT chain set sort=type; set sort_reverse=True
380 map dc get_cumulative_size
383 map zc toggle_option collapse_preview
384 map zd toggle_option sort_directories_first
385 map zh toggle_option show_hidden
386 map <C-h> toggle_option show_hidden
387 map zi toggle_option flushinput
388 map zm toggle_option mouse_enabled
389 map zp toggle_option preview_files
390 map zP toggle_option preview_directories
391 map zs toggle_option sort_case_insensitive
392 map zu toggle_option autoupdate_cumulative_size
393 map zv toggle_option use_preview_script
394 map zf console filter
397 map `<any> enter_bookmark %any
398 map '<any> enter_bookmark %any
399 map m<any> set_bookmark %any
400 map um<any> unset_bookmark %any
402 map m<bg> draw_bookmarks
403 copymap m<bg> um<bg> `<bg> '<bg>
405 # Generate all the chmod bindings with some python help:
406 eval for arg in "rwxXst": cmd("map +u{0} shell -d chmod u+{0} %s".format(arg))
407 eval for arg in "rwxXst": cmd("map +g{0} shell -d chmod g+{0} %s".format(arg))
408 eval for arg in "rwxXst": cmd("map +o{0} shell -d chmod o+{0} %s".format(arg))
409 eval for arg in "rwxXst": cmd("map +a{0} shell -d chmod a+{0} %s".format(arg))
410 eval for arg in "rwxXst": cmd("map +{0} shell -d chmod u+{0} %s".format(arg))
412 eval for arg in "rwxXst": cmd("map -u{0} shell -d chmod u-{0} %s".format(arg))
413 eval for arg in "rwxXst": cmd("map -g{0} shell -d chmod g-{0} %s".format(arg))
414 eval for arg in "rwxXst": cmd("map -o{0} shell -d chmod o-{0} %s".format(arg))
415 eval for arg in "rwxXst": cmd("map -a{0} shell -d chmod a-{0} %s".format(arg))
416 eval for arg in "rwxXst": cmd("map -{0} shell -d chmod u-{0} %s".format(arg))
418 # ===================================================================
419 # == Define keys for the console
420 # ===================================================================
421 # Note: Unmapped keys are passed directly to the console.
424 cmap <tab> eval fm.ui.console.tab()
425 cmap <s-tab> eval fm.ui.console.tab(-1)
426 cmap <ESC> eval fm.ui.console.close()
427 cmap <CR> eval fm.ui.console.execute()
428 cmap <C-l> redraw_window
434 cmap <up> eval fm.ui.console.history_move(-1)
435 cmap <down> eval fm.ui.console.history_move(1)
436 cmap <left> eval fm.ui.console.move(left=1)
437 cmap <right> eval fm.ui.console.move(right=1)
438 cmap <home> eval fm.ui.console.move(right=0, absolute=True)
439 cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
442 cmap <backspace> eval fm.ui.console.delete(-1)
443 cmap <delete> eval fm.ui.console.delete(0)
444 cmap <C-w> eval fm.ui.console.delete_word()
445 cmap <C-k> eval fm.ui.console.delete_rest(1)
446 cmap <C-u> eval fm.ui.console.delete_rest(-1)
447 cmap <C-y> eval fm.ui.console.paste()
449 # And of course the emacs way
451 copycmap <down> <C-n>
452 copycmap <left> <C-b>
453 copycmap <right> <C-f>
454 copycmap <home> <C-a>
456 copycmap <delete> <C-d>
457 copycmap <backspace> <C-h>
459 # Note: There are multiple ways to express backspaces. <backspace> (code 263)
460 # and <backspace2> (code 127). To be sure, use both.
461 copycmap <backspace> <backspace2>
463 # This special expression allows typing in numerals:
464 cmap <allow_quantifiers> false
466 # ===================================================================
467 # == Pager Keybindings
468 # ===================================================================
471 pmap <down> pager_move down=1
472 pmap <up> pager_move up=1
473 pmap <left> pager_move left=4
474 pmap <right> pager_move right=4
475 pmap <home> pager_move to=0
476 pmap <end> pager_move to=-1
477 pmap <pagedown> pager_move down=1.0 pages=True
478 pmap <pageup> pager_move up=1.0 pages=True
479 pmap <C-d> pager_move down=0.5 pages=True
480 pmap <C-u> pager_move up=0.5 pages=True
482 copypmap <UP> k <C-p>
483 copypmap <DOWN> j <C-n> <CR>
490 copypmap <PAGEDOWN> n f <C-F> <Space>
491 copypmap <PAGEUP> p b <C-B>
494 pmap <ESC> pager_close
495 copypmap <ESC> q Q i <F3>
498 # ===================================================================
499 # == Taskview Keybindings
500 # ===================================================================
503 tmap <up> taskview_move up=1
504 tmap <down> taskview_move down=1
505 tmap <home> taskview_move to=0
506 tmap <end> taskview_move to=-1
507 tmap <pagedown> taskview_move down=1.0 pages=True
508 tmap <pageup> taskview_move up=1.0 pages=True
509 tmap <C-d> taskview_move down=0.5 pages=True
510 tmap <C-u> taskview_move up=0.5 pages=True
512 copytmap <UP> k <C-p>
513 copytmap <DOWN> j <C-n> <CR>
517 copytmap <PAGEDOWN> n f <C-F> <Space>
518 copytmap <PAGEUP> p b <C-B>
520 # Changing priority and deleting tasks
521 tmap J eval -q fm.ui.taskview.task_move(-1)
522 tmap K eval -q fm.ui.taskview.task_move(0)
523 tmap dd eval -q fm.ui.taskview.task_remove()
524 tmap <pagedown> eval -q fm.ui.taskview.task_move(-1)
525 tmap <pageup> eval -q fm.ui.taskview.task_move(0)
526 tmap <delete> eval -q fm.ui.taskview.task_remove()
529 tmap <ESC> taskview_close
530 copytmap <ESC> q Q w <C-c>