-
Notifications
You must be signed in to change notification settings - Fork 0
/
rc.conf
912 lines (771 loc) · 30.3 KB
/
rc.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
# https://ranger.github.io/ranger.1.html
# https://dquinton.github.io/debian-install/config/ranger.html
# https://noctuid.github.io/blog/2014/04/30/using-ranger-for-downloads/
# ===================================================================
# This file contains the default startup commands for ranger.
# To change them, it is recommended to create either /etc/ranger/rc.conf
# (system-wide) or ~/.config/ranger/rc.conf (per user) and add your custom
# commands there.
#
# If you copy this whole file there, you may want to set the environment
# variable RANGER_LOAD_DEFAULT_RC to FALSE to avoid loading it twice.
#
# The purpose of this file is mainly to define keybindings and settings.
# For running more complex python code, please create a plugin in "plugins/" or
# a command in "commands.py".
#
# Each line is a command that will be run before the user interface
# is initialized. As a result, you can not use commands which rely
# on the UI such as :delete or :mark.
# ===================================================================
# ===================================================================
# == Options
# ===================================================================
# Which viewmode should be used? Possible values are:
# miller: Use miller columns which show multiple levels of the hierarchy
# multipane: Midnight-commander like multipane view showing all tabs next
# to each other
set viewmode miller
# set viewmode multipane
# How many columns are there, and what are their relative widths?
set column_ratios 1,2
set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp|aux|synctex\.gz)$|^lost\+found$|^__(py)?cache__$
#|^#
set show_hidden false
# "always", "never", "multiple" (default)
set confirm_on_delete multiple
# Use non-default path for file preview script?
# ranger ships with scope.sh, a script that calls external programs (see
# README.md for dependencies) to preview images, archives, etc.
set use_preview_script true
set preview_script ~/.config/ranger/scope.sh
# Automatically count files in the directory, even before entering them?
set automatically_count_files false
# Open all images in this directory when running certain image viewers
# like feh or sxiv? You can still open selected files by marking them.
set open_all_images true
# Be aware of version control systems and display information.
# causes noticeable slowdown on exit
# . = ignored, ? = untracked, tick = up to date, home = git repo
# set vcs_aware true
# State of the four backends git, hg, bzr, svn. The possible states are
# disabled, local (only show local info), enabled (show local and remote
# information).
set vcs_backend_git enabled
set vcs_backend_hg disabled
set vcs_backend_bzr disabled
set vcs_backend_svn disabled
# * w3m (default):
# Requires "w3m" (w3mimgpreview). Poor on kitty (images only appear on 2nd
# draw).
#
# * kitty:
# Requires python PIL or pillow library. If ranger does not share the local
# filesystem with kitty the transfer method is changed to encode the whole
# image; while slower, this allows remote previews, for example during an ssh
# session. Tmux is unsupported. More robust than w3m, but can cause weirdness
# (disappearing borders).
#
# * iterm2, terminology, urxvt, urxvt-full
#
# for kitty, use kitty (duh)
# for wezterm, use iterm2 with fixed dims -- https://github.com/ranger/ranger/issues/2758#issuecomment-1782551663
set preview_images true
set preview_images_method iterm2
set iterm2_font_width 24
set iterm2_font_height 40
# Delay in seconds before displaying an image with the w3m method.
# Increase it in case of experiencing display corruption, i.e. text -> image
set w3m_delay 0.1
# # Default iTerm2 font size (requires preview_images_method iterm2)
# set iterm2_font_width 8
# set iterm2_font_height 11
# Use a unicode "..." character to mark cut-off filenames?
set unicode_ellipsis false
# BIDI support - try to properly display file names in RTL languages (Hebrew, Arabic).
# Requires the python-bidi pip package
set bidi_support false
# Show dotfiles in the bookmark preview box?
set show_hidden_bookmarks true
# defaults: default, jungle, snow, solarized
# if unset, ranger will inherit from kitty.conf (or .Xresources), which is
# probably a good idea, as long as filetypes are decently distinguished
# set colorscheme mohabaks
# Preview files on the rightmost column?
# And collapse (shrink) the last column if there is nothing to preview?
set preview_files true
set preview_directories false
set collapse_preview true
# Save the console history on exit?
set save_console_history true
# Draw the status bar on top of the browser window (default: false)
# note: the path bar is fixed to the top
set status_bar_on_top true
# Draw a progress bar in the status bar which displays the average state of all
# currently running tasks which support progress bars?
set draw_progress_bar_in_status_bar true
# Draw borders around columns? (separators, outline, both, or none)
# Separators are vertical lines between columns.
# Outline draws a box around all the columns.
# Both combines the two.
set draw_borders separators
# Display the directory name in tabs?
# usually a good idea, unless dirnames are long
set dirname_in_tabs true
# Enable the mouse support?
set mouse_enabled true
# Display the file size in the main column or status bar?
set display_size_in_main_column true
set display_size_in_status_bar false
# Display the free disk space in the status bar?
# generally not needed, better displayed in the WM status bar
set display_free_space_in_status_bar false
# Display files tags in all columns or only in main column?
set display_tags_in_all_columns true
# Set a title for the window?
# overrides kitty title (which is usually the command issued to launch ranger)
# ranger:[path]
set update_title true
# Set the title to "ranger" in the tmux program?
set update_tmux_title true
# Shorten the title if it gets long? The number defines how many
# directories are displayed at once, 0 turns off this feature.
set shorten_title 3
# Show hostname in titlebar?
# only useful if you use ranger locally and through ssh, on the same machine
set hostname_in_titlebar false
# Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
set tilde_in_titlebar true
# How many directory-changes or console-commands should be kept in history?
set max_history_size 20
set max_console_history_size 50
# Try to keep so much space between the top/bottom border when scrolling:
# large values ensure cursor is centred
set scroll_offset 9999
# Flush the input after each key hit? (Noticeable when ranger lags)
set flushinput true
# Padding on the right when there's no preview?
# This allows you to click into the space to run the file.
set padding_right false
# Save bookmarks (used with mX and `X) instantly?
# This helps to synchronize bookmarks between multiple ranger
# instances but leads to *slight* performance loss.
# When false, bookmarks are saved when ranger is exited.
set autosave_bookmarks true
# Save the "`" bookmark to disk. This can be used to switch to the last
# directory by typing "``".
set save_backtick_bookmark true
# You can display the "real" cumulative size of directories by using the
# command :get_cumulative_size or typing "dc". The size is expensive to
# calculate and will not be updated automatically. You can choose
# to update it automatically though by turning on this option:
set autoupdate_cumulative_size false
# Turning this on makes sense for screen readers:
set show_cursor false
# One of: size, natural, basename, atime, ctime, mtime, type, random
set sort natural
# Additional sorting options
set sort_reverse false
set sort_case_insensitive true
set sort_directories_first true
set sort_unicode false
# Enable this if key combinations with the Alt Key don't work for you.
# (Especially on xterm)
set xterm_alt_key false
# Whether to include bookmarks in cd command
set cd_bookmarks true
# Changes case sensitivity for the cd command tab completion
set cd_tab_case sensitive
# Use fuzzy tab completion with the "cd" command. For example,
# ":cd /u/lo/b<tab>" expands to ":cd /usr/local/bin".
set cd_tab_fuzzy false
# Avoid previewing files larger than this size, in bytes. Use a value of 0 to
# always preview.
set preview_max_size 100_000_000
# The key hint lists up to this size have their sublists expanded.
# Otherwise the submaps are replaced with "...".
set hint_collapse_threshold 10
# Add the highlighted file to the path in the titlebar
set show_selection_in_titlebar true
# The delay that ranger idly waits for user input, in milliseconds, with a
# resolution of 100ms. Lower delay reduces lag between directory updates but
# increases CPU load.
set idle_delay 2000
# When the metadata manager module looks for metadata, should it only look for
# a ".metadata.json" file in the current directory, or do a deep search and
# check all directories above the current one as well?
set metadata_deep_search false
# Clear all existing filters when leaving a directory
set clear_filters_on_dir_change true
# Disable displaying line numbers in main column.
# Possible values: false, absolute, relative.
set line_numbers relative
# When line_numbers=relative show the absolute line number in the
# current line. (else shows 0)
set relative_current_zero false
# Start line numbers from 1 instead of 0
set one_indexed true
# Save tabs on exit -- where?
# does not restore sort order
set save_tabs_on_exit false
# Enable scroll wrapping - moving down while on the last item will wrap around to
# the top and vice versa.
set wrap_scroll true
# Set the global_inode_type_filter to nothing. Possible options: d, f and l for
# directories, files and symlinks respectively.
set global_inode_type_filter
# This setting allows to freeze the list of files to save I/O bandwidth. It
# should be 'false' during start-up, but you can toggle it by pressing F.
set freeze_files false
# ===================================================================
# == Local Options
# ===================================================================
# You can set local options that only affect a single directory. Options are
# applied recursively.
# Examples:
# setlocal path='~/downloads' sort size
# setlocal path=~ sort ctime
# ===================================================================
# == Command Aliases in the Console
# ===================================================================
alias e edit
alias q quit
alias q! quit!
alias qa quitall
alias qa! quitall!
alias qall quitall
alias qall! quitall!
alias setl setlocal
alias filter scout -prts
alias find scout -aets
alias mark scout -mr
alias search scout -rs
alias search_inc scout -rts
alias travel scout -aefklst
alias unmark scout -Mr
# map xx scout -a tex$
# -a Automatically open a file on unambiguous match
# -e Open the selected file when pressing enter
# -f Filter files that match the current search pattern
# -g Interpret pattern as a glob pattern
# -i Ignore the letter case of the files -- use s instead
# -k Keep the console open when changing a directory with the command
# -l Letter skipping; e.g. allow "rdme" to match the file "readme"
# -m Mark the matching files after pressing enter
# -M Unmark the matching files after pressing enter
# -p Permanent filter: hide non-matching files after pressing enter
# -r Interpret pattern as a regular expression pattern
# -s Smart case; like -i unless pattern contains upper case letters
# -t Apply filter and search pattern as you type
# -v Inverts the match
alias show_commands shell less %rangerdir/config/commands.py
# https://github.com/ranger/ranger/wiki/Custom-Commands
# learn python bro
# flat = flatten dir
# ===================================================================
# == Define keys for the browser
# ===================================================================
# Basic
# map <C-e> shell $SHELL
# map <C-r> reset
# map C shell find . -type d -empty -exec rmdir {} \;
# map E console shell vim%space
# map E shell neomutt -a %s
# map E shell spawn &
# map F set freeze_files!
# map V set viewmode!
# map e console shell%space
# map e edit
# map e shell { kitty -e vim %p; [[ $? -eq 127 ]] && xterm -e vim %p; } &
# map ve open_with neomutt -a not escaped lol
copymap q ZZ ZQ
map ! console shell%space
map # console shell -p%space
map .. cd ..
map : console
map ; console
map <C-c> abort
map <C-i> display_file
map <C-l> redraw_window
map <esc> change_mode normal
map ? help
map @ console -p6 shell %%s
map C shell cleanhome
map E shell $SHELL
map Q quitall!
map R reload_cwd
map W display_log
map cd console cd%space
map e shell { if command -v kitty >/dev/null; then kitty -e vim %p >/dev/null 2>&1; else xterm -e vim %p; fi; } &
map f console find%space
map q quit!
map r chain draw_possible_programs; console open_with%space
map w taskview_open
unmap i
# map ff console -p25 shell -p find . -name "*?*" -type f -print
# find files and print paths to pager, doesn't work lol
# ffmpeg rejects if output extension doesn't match
# figure out escapes
map P open_with mpv
map vga console shell ffmpeg -i %%s -vn -acodec copy %%s.mp3 || ffmpeg -i %%s -vn -acodec copy %%s.m4a
map vs open_with subdl
map vi open_with subdl --interactive
map vt[ console -p15 shell ffpb -ss -i %%s -c copy tmp.mkv && mv tmp.mkv %%s && notify-send "%%s trimmed!"
map vt] console -p15 shell ffpb -to -i %%s -c copy tmp.mkv && mv tmp.mkv %%s && notify-send "%%s trimmed!"
map vt{ console -p37 shell for file in %%s ; do ffmpeg -ss -i "$file" -c copy "$file"_1.mkv ; done
map vt} console -p37 shell for file in %%s ; do ffmpeg -to -i "$file" -c copy "$file"_1.mkv ; done
map vz shell mpv --profile=yt %s > /dev/null 2>&1 &
map vv shell -w ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 %s; sleep 0.5
# make this console
# try open_with
# https://github.com/BrodieRobertson/scripts/tree/master/dragon
# https://github.com/ranger/ranger/wiki/Drag-and-Drop
# crashes ranger
# map X shell dragon-drop -a -x %p &
map X shell dragon-drop -a -x %p
map bd shell bibdump -i %p &
# map xP2 shell wilin -p 2 %s
# map xP3 shell wilin -p 3 %s
# map xP4 shell wilin -p 4 %s
# map xP5 shell wilin -p 5 %s
# map xP6 shell wilin -p 6 %s
# map xP7 shell wilin -p 7 %s
# map xc1 shell wilin -c 1 %s
# map xc2 shell wilin -c 2 %s
# map xc3 shell wilin -c 3 %s
# map xc4 shell wilin -c 4 %s
# map xc5 shell wilin -c 5 %s
# map xc6 shell wilin -c 6 %s
# map xc7 shell wilin -c 7 %s
# map xp shell wilin %s
map y2 console -p49 shell for file in %%s ;do cp "$file" "$file"_1 ;done
# map y2 console -p49 shell -s for file in %%s ; do cp "$file" "${file%.*}_copy.${file##*.}" ; done
# duplicate selected files adding _1
# map fvf2 console shell -ft ffmpeg -i %f -vn -ar 44100 -c:a 2 -q:a 0 -f mp3 %f.mp3 # (mp3)
# console: used when typing input is necessary, or the mapped command can be
# altered, such as a pattern or new file name
# without using 'console' a key-mapped command will execute immediately, without
# needing confirmation (in some cases it could be dangerous!)
# shell must be used in order to run bash commands, and console shell where
# typing is needed (can use ranger macros and the shell flags)
# using %s in the mapping may not be a good idea in some cases, i.e. when the
# console is opened before executing, because it will expand to all the selected
# file names, and that would 1. render the console full and impossible to type
# in, and 2. send utter garbage to a shell command - so we need to use %%s in
# the key mapping, which remains "%s" on the console, and then shell commands
# can act on every file.
# Just make sure that if you change a mapping and remove "console" to make it
# key-executable (only with "shell") then you need to remove the "%%" (i.e.
# make it "%s" or "%f") or the command will fail.
# capacity of newly mounted drives not reflected in existing instances
# shell/open_with flags
# f runs process in background - useful for an encoding/mogrify job as ranger will still be usable while the process completes
# c runs on current file, not selected
# r runs with super user privileges
# t will show the process in a new terminal window (opens xterm)
# shell flags
# p Redirect output to the pager
# w Wait for an Enter-press when the process is done
# keeps prev shell output, messy
# s Silent mode. Output will be discarded. generally not what i want
# map <C-p> chain console; eval fm.ui.console.history_move(-1)
# Change the line mode
# map Mf linemode filename
# map Mi linemode fileinfo
# map Mm linemode mtime
# map Mp linemode permissions
# map Ms linemode sizemtime
# map Mt linemode metatitle
# Tagging / Marking
map V toggle_visual_mode
map uV toggle_visual_mode reverse=True
# starts (un)marking, a la vim
map UV mark_files all=True val=True
map uv mark_files all=True val=False
# immediately (un)mark all
# map <A-a> chain move to=0; toggle_visual_mode; move to=-1
map "<any> tag_toggle tag=%any
map <Space> mark_files toggle=True
# map tt tag_toggle
# map ut tag_remove
# For the nostalgics: Midnight Commander bindings
# map <C-n> console mkdir%space
# map <F10> exit
# map <F3> display_file
# map <F4> edit
# map <F5> copy
# map <F6> cut
# map <F7> console mkdir%space
# map <F8> console delete
map <F1> help
map <F2> rename_append
# VIM-like
copymap <UP> k
copymap <DOWN> j
copymap <LEFT> h
copymap <RIGHT> l
copymap <HOME> gg
copymap <END> G
map j move down=1
map k move up=1
map J move down=0.5 pages=True cycle=False
map K move up=0.5 pages=True cycle=False
copymap J <PAGEDOWN>
copymap K <PAGEUP>
# map gG eval fm.cd(os.getenv('HDD') + '/guitar
# map gd eval fm.cd(os.getenv('HDD') + '/downloads')
map gG eval fm.cd(os.getenv('HDD') + '/guitar')
map gb eval fm.cd(os.getenv('HDD') + '/books')
map gc cd ~/.config
map ge eval fm.cd(os.getenv('HDD') + '/emu')
map gh cd ~
map gk eval fm.cd(os.getenv('SLSK') + '/complete')
map gm eval fm.cd(os.getenv('HDD'))
map gs eval fm.cd(os.getenv('HDD') + '/scores')
map gt eval fm.cd(os.getenv('HDD') + '/movies')
map gx cd ~/scripts
# map td chain tab_new; eval fm.cd(os.getenv('HDD') + '/downloads')
# map tw chain tab_new; cd ~/work
map tG chain tab_new; eval fm.cd(os.getenv('HDD') + '/guitar')
map tb chain tab_new; eval fm.cd(os.getenv('HDD') + '/books')
map tc chain tab_new; cd ~/.config
map th chain tab_new; cd ~
map tk chain tab_new; eval fm.cd(os.getenv('SLSK') + '/complete')
map tm chain tab_new; eval fm.cd(os.getenv('HDD'))
map ts chain tab_new; eval fm.cd(os.getenv('HDD') + '/scores')
map tt chain tab_new; eval fm.cd(os.getenv('HDD') + '/movies')
map tx chain tab_new; cd ~/scripts
# map Mt shell rsync -chavPr --inplace --remove-source-files --progress %s "$HDD/movies/"
map Mb shell rsync -r --remove-source-files --progress %s "$HDD/books"
map Md shell mv -iuv %s "$HDD/downloads"
map Me shell rsync -r --remove-source-files --progress %s "$HDD/emu"
map Mh shell rsync -r --remove-source-files --progress %s "$HOME"
map Mt shell mv -iuv %s "$HDD/movies"
# open dir in new tab
map <A-CR> chain tab_new; tab_move -1; traverse; tab_shift 1
# move to next tab
map <A-x> shell -f mv %s %D
map Mn shell -f mv %s %D
map MM console shell mv %s
# only visible files/dirs are suggested
map M. shell mv %s ..
map g? cd /usr/share/doc/ranger
map gB history_go -1
map gF history_go 1
map gL cd -r %f # follow symlink
map gR eval fm.cd(ranger.RANGERDIR)
map gT cd /tmp
map gl cd -r .
map gr cd /
unmap g/
unmap gM
unmap gT
unmap ge
unmap gi
unmap gn
unmap go
unmap gv
# # Bookmarks -- deprecated
# map `<any> enter_bookmark %any
# map '<any> enter_bookmark %any
# map m<any> set_bookmark %any
# map m<bg> draw_bookmarks
# map um<any> unset_bookmark %any
# map ~<bg> draw_bookmarks
copymap m<bg> um<bg> `<bg> '<bg>
map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh
map dc get_cumulative_size
map di shell nsxiv -t .
map dn shell ncdu
map du shell -p du --max-depth=1 -h --apparent-size
map yp yank path
map yd yank dir
map yn yank name
map yN yank name_without_extension
# Filesystem Operations
map = chmod
# map mkx shell -s chmod +x %s
map cw console rename%space
# clears name, allows bulk
# keep extension?
map a rename_append
# rename before extension
map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"))
# rename after extension
map I eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7)
# rename from front
map B chain move to=0; toggle_visual_mode; move to=-1; bulkrename; mark_files all=True val=False
# rename all files matching filter
map D console -p12 shell mv %%s /%%s
# tab completion in middle?
# https://github.com/ranger/ranger/issues/706
# map Ra1 console -p27 shell -fs rename 's/\.(.*)/A.$1/' %%s
# Append to file names inside the ext -change A, mode: file-name.ext > file-nameA.ext
map pp paste
map <C-p> paste
map po paste overwrite=True
map pP paste append=True
map pO paste overwrite=True append=True
map pl paste_symlink relative=False
map pL paste_symlink relative=True
map phl paste_hardlink
map pht paste_hardlinked_subtree
map D console delete
map <C-d> console delete
map TE console shell trash-empty
map dd cut
# map MM cut
map <C-x> cut
map ud uncut
map da cut mode=add
map dr cut mode=remove
map dt cut mode=toggle
map yy copy
map uy uncut
map ya copy mode=add
map yr copy mode=remove
map yt copy mode=toggle
# (un)mark/toggle for copying
# Temporary workarounds
map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier)
map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier)
map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier)
map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier)
map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier)
map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier)
# copy all from selected to top/bottom
map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier)
map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier)
# Searching
map n search_next
map N search_next forward=False
map ct search_next order=tag
map cs search_next order=size
map ci search_next order=mimetype
map cc search_next order=ctime
map cm search_next order=mtime
map ca search_next order=atime
# Tabs
map L tab_move 1
map H tab_move -1
map <A-j> move_parent 1
map <A-k> move_parent -1
map <A-l> tab_shift 1
map <A-h> tab_shift -1
map <A-u> tab_restore
# A-u doesn't work
# map <A-S-l> tab_shift 1 #A-S doesn't work
# map <A-S-h> tab_shift 1
# map ] move_parent 1
# map [ move_parent -1
map } traverse
map { traverse_backwards
map ) jump_non
# C-S-t is treated as C-t
# %f the highlighted file
# %d the path of the current directory
# %s the selected files in the current directory
# %t all tagged files in the current directory
# %c the full paths of the currently copied/cut files
# %p the full paths of selected files
# C-PUp/PDown = nothing
# C-Up/Down = zoom in/out
# C-Right/Left = some funky stuff
# S-Up = a
# S-Down/Right/Left = nothing
map <C-t> tab_new
# map <C-n> tab_new
map <C-w> tab_close
map uq tab_restore
map <a-1> tab_open 1
map <a-2> tab_open 2
map <a-3> tab_open 3
map <a-4> tab_open 4
map <a-5> tab_open 5
map <a-6> tab_open 6
map <a-7> tab_open 7
map <a-8> tab_open 8
map <a-9> tab_open 9
# map <a-r> tab_shift 1
# map <a-l> tab_shift -1
map <A-r> chain eval fm.source(fm.confpath('rc.conf')); eval fm.rifle.reload_config()
# https://unix.stackexchange.com/a/150545
# often doesn't reload reload rifle
# Sorting, movement
# search %s useful for srt
map <C-h> set show_hidden!
map S chain filter_stack clear; set sort=natural; set sort_reverse=False; move to=0
map s chain filter_stack clear; set sort=size; set sort_reverse=False; move to=0
map <C-r> chain filter_stack add type f; set sort=random; move to=0
map / console search_inc%space
map F console filter%space
map cf filter_stack clear
map <C-f> fzf_select
# map fz fzf_select
map tr tab_restore
map za toggle_flat
map oa chain set sort=atime; set sort_reverse=False
map oA chain set sort=atime; set sort_reverse=True
map ob chain set sort=basename; set sort_reverse=False
map oB chain set sort=basename; set sort_reverse=True
map oc chain set sort=ctime; set sort_reverse=False
map oC chain set sort=ctime; set sort_reverse=True
map oe chain set sort=extension; set sort_reverse=False
map oE chain set sort=extension; set sort_reverse=True
map om chain set sort=mtime; set sort_reverse=False
map oM chain set sort=mtime; set sort_reverse=True
map on chain set sort=natural; set sort_reverse=False
map oN chain set sort=natural; set sort_reverse=True
map or set sort_reverse!
map os chain set sort=size; set sort_reverse=False
map oS chain set sort=size; set sort_reverse=True
map ot chain set sort=type; set sort_reverse=False
map oT chain set sort=type; set sort_reverse=True
map oz chain set sort=random; move to=0
# Settings
map zI set flushinput!
map zP set preview_directories!
map zc set collapse_preview!
map zd set sort_directories_first!
map zf console filter%space
map zh set show_hidden!
map zi set preview_images!
map zm set mouse_enabled!
map zp set preview_files!
map zs set sort_case_insensitive!
map zu set autoupdate_cumulative_size!
map zv set use_preview_script!
copymap <C-h> <backspace>
copymap <backspace> <backspace2>
copymap zf zz
# Filter stack
# map .. filter_stack show
# map <C-f> filter_stack add type f
map .! filter_stack add not
map .& filter_stack add and
map .* filter_stack decompose
map .c filter_stack clear
map .d filter_stack add type d
map .f filter_stack add type f
map .l filter_stack add type l
map .m console filter_stack add mime%space
map .n console filter_stack add name%space
map .p filter_stack pop
map .r console filter_stack rotate
map .| filter_stack add or
map <C-a> filter_stack clear
# Generate all the chmod bindings with some python help:
eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +{0} shell -f chmod u+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -{0} shell -f chmod u-{0} %s".format(arg))
# ===================================================================
# == Define keys for the console (i.e. readline)
# ===================================================================
# Note: Unmapped keys are passed directly to the console.
# Basic
cmap <tab> eval fm.ui.console.tab()
cmap <s-tab> eval fm.ui.console.tab(-1)
cmap <ESC> eval fm.ui.console.close()
cmap <CR> eval fm.ui.console.execute()
cmap <C-l> redraw_window
copycmap <ESC> <C-c>
copycmap <CR> <C-j>
# Move around
cmap <up> eval fm.ui.console.history_move(-1)
cmap <down> eval fm.ui.console.history_move(1)
cmap <left> eval fm.ui.console.move(left=1)
cmap <right> eval fm.ui.console.move(right=1)
cmap <home> eval fm.ui.console.move(right=0, absolute=True)
cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
cmap <a-b> eval fm.ui.console.move_word(left=1)
cmap <a-f> eval fm.ui.console.move_word(right=1)
copycmap <a-b> <a-left>
copycmap <a-f> <a-right>
# Line Editing
cmap <backspace> eval fm.ui.console.delete(-1)
cmap <delete> eval fm.ui.console.delete(0)
cmap <C-w> eval fm.ui.console.delete_word()
cmap <A-d> eval fm.ui.console.delete_word(backward=False)
cmap <C-k> eval fm.ui.console.delete_rest(1)
cmap <C-u> eval fm.ui.console.delete_rest(-1)
cmap <C-y> eval fm.ui.console.paste()
# # And of course the emacs way
# # copycmap <right> <C-f>
# copycmap <ESC> <C-g>
# copycmap <backspace> <C-h>
# copycmap <delete> <C-d>
# copycmap <down> <C-n>
# copycmap <end> <C-e>
# copycmap <home> <C-a>
# copycmap <left> <C-b>
# copycmap <up> <C-p>
# Note: There are multiple ways to express backspaces. <backspace> (code 263)
# and <backspace2> (code 127). To be sure, use both.
copycmap <backspace> <backspace2>
# This special expression allows typing in numerals:
cmap <allow_quantifiers> false
# ===================================================================
# == Pager Keybindings
# ===================================================================
# Movement
pmap <C-d> pager_move down=0.5 pages=True
pmap <C-l> redraw_window
pmap <C-u> pager_move up=0.5 pages=True
pmap <ESC> pager_close
pmap <down> pager_move down=1
pmap <end> pager_move to=-1
pmap <home> pager_move to=0
pmap <left> pager_move left=4
pmap <pagedown> pager_move down=1.0 pages=True
pmap <pageup> pager_move up=1.0 pages=True
pmap <right> pager_move right=4
pmap <up> pager_move up=1
pmap E edit_file
copypmap <C-d> d
copypmap <C-u> u
copypmap <DOWN> j <C-n> <CR>
copypmap <END> G
copypmap <ESC> q Q i <F3>
copypmap <HOME> g
copypmap <LEFT> h
copypmap <PAGEDOWN> n f <C-F> <Space>
copypmap <PAGEUP> p b <C-B>
copypmap <RIGHT> l
copypmap <UP> k <C-p>
# ===================================================================
# == Taskview Keybindings
# ===================================================================
# Movement
tmap <up> taskview_move up=1
tmap <down> taskview_move down=1
tmap <home> taskview_move to=0
tmap <end> taskview_move to=-1
tmap <pagedown> taskview_move down=1.0 pages=True
tmap <pageup> taskview_move up=1.0 pages=True
tmap <C-d> taskview_move down=0.5 pages=True
tmap <C-u> taskview_move up=0.5 pages=True
copytmap <UP> k <C-p>
copytmap <DOWN> j <C-n> <CR>
copytmap <HOME> g
copytmap <END> G
copytmap <C-u> u
copytmap <PAGEDOWN> n f <C-F> <Space>
copytmap <PAGEUP> p b <C-B>
# Changing priority and deleting tasks
tmap J eval -q fm.ui.taskview.task_move(-1)
tmap K eval -q fm.ui.taskview.task_move(0)
tmap dd eval -q fm.ui.taskview.task_remove()
tmap <pagedown> eval -q fm.ui.taskview.task_move(-1)
tmap <pageup> eval -q fm.ui.taskview.task_move(0)
tmap <delete> eval -q fm.ui.taskview.task_remove()
# Basic
tmap <C-l> redraw_window
tmap <ESC> taskview_close
copytmap <ESC> q Q w <C-c>