Advertisement
Guest User

Untitled

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