summaryrefslogtreecommitdiffstats
path: root/lass/2configs/mc.nix
blob: f5de04616307bea15ba8f57196552955a38d6380 (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
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
{ config, pkgs, ... }:

let
  mcExt = pkgs.writeText "mc.ext" ''
    # gitfs changeset
    regex/^\[git\]
      Open=%cd %p/changesetfs://
      View=%cd %p/patchsetfs://

    ### Archives ###

    # .tgz, .tpz, .tar.gz, .tar.z, .tar.Z, .ipk, .gem
    regex/\.t([gp]?z|ar\.g?[zZ])$|\.ipk$|\.gem$
      Open=%cd %p/utar://

    shell/.tar.bz
      # Open=%cd %p/utar://

    regex/\.t(ar\.bz2|bz2?|b2)$
      Open=%cd %p/utar://

    # .tar.lzma, .tlz
    regex/\.t(ar\.lzma|lz)$
      Open=%cd %p/utar://

    # .tar.xz, .txz
    regex/\.t(ar\.xz|xz)$
      Open=%cd %p/utar://

    # .tar.F - used in QNX
    shell/.tar.F
      # Open=%cd %p/utar://

    # .qpr/.qpk - QNX Neutrino package installer files
    regex/\.qp[rk]$
      Open=%cd %p/utar://

    # tar
    shell/i/.tar
      Open=%cd %p/utar://

    # lha
    type/^LHa\ .*archive
      Open=%cd %p/ulha://

    # arj
    regex/i/\.a(rj|[0-9][0-9])$
      Open=%cd %p/uarj://

    # cab
    shell/i/.cab
      Open=%cd %p/ucab://

    # ha
    shell/i/.ha
      Open=%cd %p/uha://

    # rar
    regex/i/\.r(ar|[0-9][0-9])$
      Open=%cd %p/urar://

    # ALZip
    shell/i/.alz
      Open=%cd %p/ualz://

    # cpio
    shell/.cpio.Z
      Open=%cd %p/ucpio://

    shell/.cpio.xz
      Open=%cd %p/ucpio://

    shell/.cpio.gz
      Open=%cd %p/ucpio://

    shell/i/.cpio
      Open=%cd %p/ucpio://

    # 7zip archives (they are not man pages)
    shell/i/.7z
      Open=%cd %p/u7z://

    # patch
    regex/\.(diff|patch)(\.bz2)$
      Open=%cd %p/patchfs://

    regex/\.(diff|patch)(\.(gz|Z))$
      Open=%cd %p/patchfs://

    # ls-lR
    regex/(^|\.)ls-?lR(\.gz|Z|bz2)$
      Open=%cd %p/lslR://

    # trpm
    shell/.trpm
      Open=%cd %p/trpm://

    # RPM packages (SuSE uses *.spm for source packages)
    regex/\.(src\.rpm|spm)$
      Open=%cd %p/rpm://

    shell/.rpm
      Open=%cd %p/rpm://

    # deb
    regex/\.u?deb$
      Open=%cd %p/deb://

    # dpkg
    shell/.debd
      Open=%cd %p/debd://

    # apt
    shell/.deba
      Open=%cd %p/deba://

    # ISO9660
    shell/i/.iso
      Open=%cd %p/iso9660://


    regex/\.(diff|patch)$
      Open=%cd %p/patchfs://

    # ar library
    regex/\.s?a$
      Open=%cd %p/uar://

    # gplib
    shell/i/.lib
      Open=%cd %p/ulib://


    # Mailboxes
    type/^ASCII\ mail\ text
      Open=%cd %p/mailfs://


    ### Sources ###

    # C/C++
    regex/i/\.(c|cc|cpp)$
      Include=editor

    # C/C++ header
    regex/i/\.(h|hh|hpp)$
      Include=editor

    # Fortran
    shell/i/.f
      Include=editor

    # Assembler
    regex/i/\.(s|asm)$
      Include=editor

    include/editor
      Open=%var{EDITOR:vim} %f

    ### Images ###

    shell/i/.gif
      Include=image

    regex/i/\.jpe?g$
      Include=image

    shell/i/.bmp
      Include=image

    shell/i/.png
      Include=image

    shell/i/.jng
      Include=image

    shell/i/.mng
      Include=image

    shell/i/.tiff
      Include=image

    shell/.ico
      Include=image

    include/image
      Open=sxiv %f
      View=sxiv %f

    ### Sound files ###

    regex/i/\.(wav|snd|voc|au|smp|aiff|snd|m4a|ape|aac|wv)$
      Include=audio

    regex/i/\.(mod|s3m|xm|it|mtm|669|stm|ult|far)$
      Include=audio

    shell/i/.waw22
      Include=audio

    shell/i/.mp3
      Include=audio

    regex/i/\.og[gax]$
      Include=audio

    regex/i/\.(spx|flac)$
      Include=audio

    regex/i/\.(midi?|rmid?)$
      Include=audio

    shell/i/.wma
      Include=audio

    include/audio
      Open=mpv %f
      View=mpv %f

    ### Video ###

    shell/i/.avi
      Include=video

    regex/i/\.as[fx]$
      Include=video

    shell/i/.divx
      Include=video

    shell/i/.rmvb
      Include=video

    shell/i/.mkv
      Include=video

    regex/i/\.(mov|qt)$
      Include=video

    regex/i/\.(mp4|m4v|mpe?g)$
      Include=video

    # MPEG-2 TS container + H.264 codec
    shell/i/.mts
      Include=video

    shell/i/.ts
      Include=video

    shell/i/.vob
      Include=video

    shell/i/.wmv
      Include=video

    regex/i/\.fl[icv]$
      Include=video

    shell/i/.ogv
      Include=video

    # WebM
    shell/i/.webm
        Include=video

    type/WebM
        Include=video

    include/video
      Open=mpv %f
      View=mpv %f


    ### Documents ###

    # PDF
    shell/i/.pdf
      Open=zathura %f
      View=zathura %f

    ### Miscellaneous ###

    # Makefile
    regex/[Mm]akefile$
      Open=make -f %f %{Enter parameters}


    ### Plain compressed files ###

    # ace
    shell/i/.ace
      Open=%cd %p/uace://
      Extract=unace x %f

    # arc
    shell/i/.arc
      Open=%cd %p/uarc://
      Extract=arc x %f '*'
      Extract (with flags)=I=%{Enter any Arc flags:}; if test -n "$I"; then arc x $I %f; fi

    # zip
    shell/i/.zip
      Open=%cd %p/uzip://

    # zip
    type/i/^zip\ archive
      Open=%cd %p/uzip://

    # jar(zip)
    type/i/^Java\ Jar\ file\ data\ \(zip\)
      Open=%cd %p/uzip://

    # zoo
    shell/i/.zoo
      Open=%cd %p/uzoo://

    ### Default ###

    # Default target for anything not described above
    default/*
      Open=vim %f
      View=vim %f

  '';

in {
  environment.systemPackages = [
    (pkgs.symlinkJoin {
      name = "mc";
      paths = [
        (pkgs.writeDashBin "mc" ''
          export MC_DATADIR=${pkgs.write "mc-ext" {
              "/mc.ext".link = mcExt;
              "/sfs.ini".text = "";
          }};
          export TERM=xterm-256color
          exec ${pkgs.mc}/bin/mc -S xoria256 "$@"
        '')
        pkgs.mc
      ];
    })
  ];
}