rc.conf 24 KB

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