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