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