Advertisement
ayygiocasta

rc.conf (ranger)

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