aboutsummaryrefslogtreecommitdiff
path: root/.config/lf/lfrc
blob: 37d49ccacbde8d721574120e5c3937095cb8e941 (plain)
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
# Basic Settings
set previewer ~/.config/lf/pv #preview
set preview true
# set drawbox true
# set icons true
set ignorecase true
set scrolloff 1
set shell zsh

# unmap keys
map y
map d
map m

# keymappings
# rename
map C rename # at the end
map c push C<a-b><a-b><a-f>
map <c-c> push C<c-u> # new rename
# map B bulkrename

# cut/copy/paste
map yy copy
map dd cut
map D delete

# new files/directories
map md mkdir
map mf mkfile

# misc
map H set hidden!
map <c-r> reload



# custom commands
cmd open ${{
  case $(file --mime-type "$f" -bL) in
    text/*|application/json) $EDITOR "$f";;
    *) xdg-open "$f" ;;
  esac
}}

cmd mkdir ${{
  printf "Directory Name: "
  read ans
  mkdir $ans
}}

cmd mkfile ${{
  printf "File Name: "
  read ans
  $EDITOR $ans
}}

cmd sudomkfile ${{
  printf "File Name: "
  read ans
  sudo $EDITOR $ans
}}

cmd chmod ${{
  printf "Mode Bits: "
  read ans

  for file in "$fx"
  do
    chmod $ans $file
  done

  lf -remote 'send reload'
}}

# archive bindings
cmd unarchive ${{
  case "$f" in
      *.zip) unzip "$f" ;;
      *.tar.gz) tar -xzvf "$f" ;;
      *.tar.bz2) tar -xjvf "$f" ;;
      *.tar) tar -xvf "$f" ;;
      *) echo "Unsupported format" ;;
  esac
}}

cmd zip %zip -r "$f" "$f"
cmd tar %tar cvf "$f.tar" "$f"
cmd targz %tar cvzf "$f.tar.gz" "$f"
cmd tarbz2 %tar cjvf "$f.tar.bz2" "$f"

# archive mappings
map az zip
map at tar
map ag targz
map ab targz
map au unarchive