*** empty log message ***
[midnight-commander.git] / lib / cedit.menu
blob568003ad9f9bdde810ed844a0be2c411011dc380
1 shell_patterns=0    # expression type
3 # The macros are:
5 # %c The cursor column position number. For edit menu only.
6 # %i The indent of blank space, equal the cursor column 
7 #    position. For edit menu only.
8 # %y The syntax type of current file. For edit menu only.
9 # %b The block file name.
10 # %e The error file name.
11 # %f The current file name.
12 # %n Only the current file name without extension.
13 # %x The extension of current file name.
14 # %d The current directory name.
15 # %F The current file in the unselected panel.
16 # %D The directory name of the unselected panel.
17 # %t The currently tagged files.
18 # %T The tagged files in the unselected panel.
19 # %u and %U Similar to the %t and %T macros, but in
20 #    addition the files are untagged. You can use this macro
21 #    only once per menu file entry or extension file entry,
22 #    because next time there will be no tagged files.
23 # %s and %S The selected files: The tagged files if
24 #    there are any. Otherwise the current file.
25
26 # %% The % character
28 # %{some text} Prompt for the substitution. An input box
29 #    is shown and the text inside the braces is used as a
30 #    prompt. The macro is substituted by the text typed by the
31 #    user. The user can press ESC or F10 to cancel. This macro
32 #    doesn't work on the command line yet.
34 #----------------------- Begin [perl] language template -----------------------
35 + y Perl\ Program | f \.pl$
36 1       Author description header
37         unset LANG
38         AUTHOR="$(cat /etc/passwd |grep ^$(id -un) |awk -F: '{print($5)}')"
39         cat >>%b <<EOF
40         #----------------------------------------------------------------------
41         # Description:
42         # Author: $AUTHOR <$(echo -ne $REPLYTO)>
43         # Created at: $(date)
44         # Computer: $(uname -n) 
45         # System: $(uname -sr) on $(uname -m)
46         #    
47         # Copyright (c) $(date +%%Y) $AUTHOR  All rights reserved.
48         #
49         #----------------------------------------------------------------------
50         # Configure section:
51         
52         #----------------------------------------------------------------------
53         #
54         # main()
55         
56         EOF
58 + y Perl\ Program | f \.pl$
59 2       while ()
60         cat <<EOF > %b
61         %iwhile() {
62         %i}
63         EOF
65 + y Perl\ Program | f \.pl$
66 3       for ()
67         cat <<EOF > %b
68         %ifor ($i =  ; $i <  ; $i++) {
69         %i}
70         EOF
72 + y Perl\ Program | f \.pl$
73 4       foreach ()
74         cat <<EOF > %b
75         %iforeach ($ ) {
76         %i}
77         EOF
79 + y Perl\ Program | f \.pl$
80 5       if ()
81         cat <<EOF > %b
82         %iif () {
83         %i}
84         EOF
85                 
86 + y Perl\ Program | f \.pl$
87 6       if () else
88         cat <<EOF > %b
89         %iif () {
90         %i} else {
91         %i}
92         EOF
94 + y Perl\ Program | f \.pl$
95 7       if () elsif ()
96         cat <<EOF > %b
97         %iif () {
98         %i} elsif () {
99         %i}
100         EOF
102 + y Perl\ Program | f \.pl$
103 8       substr ()
104         echo "%i$ = substr(\$str, \$off, \$cnt);" >%b
106 + y Perl\ Program | f \.pl$
107 9       opendir ()
108         cat <<EOF > %b
109         %iopendir(DIR, \$dir) || die("\$0: can't open \$dir\n");
110         EOF
112 + y Perl\ Program | f \.pl$
113 a       sub ()
114         NAME=%{ Enter name of subroutine: }
115         cat <<EOF > %b
116         sub
117         $NAME ()
118         {
119         } # end of $NAME()        
120         EOF
121 #----------------------- End [perl] language template -------------------------
123 #---------------------- Begin [shell] language template -----------------------
124 + y Shell\ Script | f \.sh$
125 1       Author description header
126         unset LANG
127         AUTHOR="$(cat /etc/passwd |grep ^$(id -un) |awk -F: '{print($5)}')"
128         cat >>%b <<EOF
129         #----------------------------------------------------------------------
130         # Description:
131         # Author: $AUTHOR <$(echo -ne $REPLYTO)>
132         # Created at: $(date)
133         # Computer: $(uname -n) 
134         # System: $(uname -sr) on $(uname -m)
135         #    
136         # Copyright (c) $(date +%%Y) $AUTHOR  All rights reserved.
137         #
138         #----------------------------------------------------------------------
139         # Configure section:
140         
141         #----------------------------------------------------------------------
142         #
143         # main()
144         
145         EOF
147 + y Shell\ Script | f \.sh$
148 3       for
149         cat <<EOF > %b
150         %ifor i in \$
151         %ido
152         %idone
153         EOF
155 + y Shell\ Script | f \.sh$
156 4       while
157         cat <<EOF > %b
158         %iwhile
159         %ido
160         %idone
161         EOF
163 + y Shell\ Script | f \.sh$
164 5       if [] then else
165         cat <<EOF >> %b
166         %iif [ ];then
167         %ielse
168         %ifi
169         EOF
171 + y Shell\ Script | f \.sh$
172 6       case
173         NUMBER=%{ Enter number elements of case:}
174         cat <<EOF > %b
175         %icase "\$" in
176         EOF
177         while [ "$NUMBER" -gt 0 ]
178         do
179         cat <<EOF >> %b
180         %i)
181         %i    ;;
182         EOF
183         let NUMBER=$NUMBER-1    
184         done
185         cat <<EOF >> %b
186         %i*)
187         %iesac
188         EOF
190 + y Shell\ Script | f \.sh$
191 7       function
192         NAME=%{ Enter name of function:}
193         cat <<EOF >> %b
194         $NAME() {
195         } # end of $NAME()
196         EOF
197                 
198 + y Shell\ Script | f \.sh$
199 8       select of bash
200         cat <<EOF >> %b
201         %iselect i in \$l
202         %ido
203         %i    if [ -n "\$i" ];then
204         %i       break
205         %i    else
206         %i       continue
207         %i    fi        
208         %idone
209         EOF
210         
211 #----------------------- End [shell] language template ------------------------
213 #------------------------- Begin [c] language template ------------------------
214 + f \.h$ | f \.c$ | f \.cc$
215 1       Author description header
216         unset LANG
217         AUTHOR="$(cat /etc/passwd |grep ^$(id -un) |awk -F: '{print($5)}')"
218         cat >> %b <<EOF
219         /********************************************************************
220         * Description:
221         * Author: $AUTHOR <$(echo -ne $REPLYTO)>
222         * Created at: $(date)
223         * Computer: $(uname -n) 
224         * System: $(uname -sr) on $(uname -m)
225         *    
226         * Copyright (c) $(date +%%Y) $AUTHOR  All rights reserved.
227         *
228         ********************************************************************/
229         EOF
231 + f \.h$ | f \.c$ | f \.cc$
232 2       GPL description header
233         cat >>%b <<EOF
234         /*
235         * This program is free software; you can redistribute it and/or modify
236         * it under the terms of the GNU General Public License as published by
237         * the Free Software Foundation; either version 2 of the License, or
238         * (at your option) any later version.
239         *
240         * This program is distributed in the hope that it will be useful,
241         * but WITHOUT ANY WARRANTY; without even the implied warranty of
242         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
243         * GNU General Public License for more details.
244         *
245         * You should have received a copy of the GNU General Public License
246         * along with this program; if not, write to the Free Software
247         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
248         */
249         EOF
251 + f \.c$ | f \.cc$
252 3       if ()
253         cat <<EOF > %b
254         %iif () {
255         %i}
256         EOF
257                 
258 + f \.c$ | f \.cc$
259 4       if () else
260         cat <<EOF > %b
261         %iif () {
262         %i} else {
263         %i}
264         EOF
266 + f \.c$ | f \.cc$
267 5       if () else if ()
268         cat <<EOF > %b
269         %iif ( ) {
270         %i} else if ( ) {
271         %i}
272         EOF
274 + f \.c$ | f \.cc$
275 6       switch ()
276         NUMBER=%{ Enter number elements of switch:}
277         echo "%iswitch () {" >%b
278         while [ "$NUMBER" -gt 0 ]
279         do
280             echo "%icase '':" >>%b
281             echo "%i      break;" >>%b
282             let NUMBER=$NUMBER-1    
283         done
284         echo "%i      default:" >>%b
285         echo "%i}" >>%b
286         
287 + f \.c$ | f \.cc$
288 7       for ()
289         cat <<EOF > %b
290         %ifor (i =  ; i <  ; i++) {
291         %i}
292         EOF
293         
294 + f \.c$ | f \.cc$
295 8       while ()               
296         cat <<EOF > %b
297         %iwhile () {
298         %i}
299         EOF
301 + f \.c$ | f \.cc$
302 9       do {} while ()               
303         cat <<EOF > %b
304         %ido {
305         %i} while ()
306         EOF
307         
308 + f \.c$ | f \.cc$
309 a       array
310         cat <<EOF > %b
311         %ichar const x[] = {
312         %i, ,
313         %i};
314         EOF
315         
316 + f \.c$ | f \.cc$
317 b       enum
318         cat <<EOF > %b
319         %ienum x {
320         %i, ,
321         %i};
322         EOF
323         
324 + f \.c$ | f \.cc$
325 c       struct
326         cat <<EOF > %b
327         %istruct ? {
328         %i;
329         %i};
330         EOF
331         
332 + f \.c$ | f \.cc$
333 d       union
334         cat <<EOF > %b
335         %iunion ? {
336         %i;
337         %i};
338         EOF
339         
340 + f \.c$ | f \.cc$
341 e       typedef struct
342         cat <<EOF > %b
343         %itypedef struct {
344         %i;
345         %i} ?;
346         EOF
348 + f \.c$ | f \.cc$
349 f       function
350         NAME=%{ Enter name of function:}
351         cat <<EOF >> %b
352         $NAME()
353         {
354         } /* end of $NAME() */
355         EOF
357 + f \.c$ | f \.h$ | f \.cc$
358 g       #include
359         INC=%{ Enter include name: }
360         if [ -r "$INC" ];then
361             echo \#include \"$INC\" >%b
362         else
363             echo \#include \<$INC\> >%b
364         fi
366 + f \.c$ | f \.h$ | f \.cc$
367 d       #define
368         echo "#define " >%b
370 + f \.c$ | f \.h$ | f \.cc$
371 d       #ifdef
372         cat <<EOF > %b
373         #ifdef
374         #else
375         #endif
376         EOF
378 + f \.c$ | f \.h$ | f \.cc$
379 ...............................................................................
381 + f \.c$ | f \.h$ | f \.cc$
382 h       View all *.h into current directory
383         cat *.h |less
385 + f \.c$ | f \.cc$
386 d       Run gdb for current file
387         [ -x "./%n" ] && gdb ./%n
389 = f \.c$ | f \.cc$
390 + f \.c$ | f \.cc$
391 c       Compile, link and run the current .c file
392         export CFLAGS="-g -Wall -O2"
393         make || make %n || cc $CFLAGS -o %n %f
394         [ -r "%n" ] && (echo "*** press any key for run... ***"; read)
395         [ -x "%n" ] && ./%n
396         (echo -ne "\n--- Press any key for return to edit. ---"; read)
398 + f \.c$ | f \.h$
399 t       Indent `C' formatter
400         indent -kr -pcs %b 1>/dev/null 2> %e
402 #--------------------- End [c/c++] language template --------------------------
404 #------------------------- Begin unknown template -----------------------------
405 + y unknown & t r
406 s       #!/bin/sh
407         echo "#!/bin/sh" >%b
409 + y unknown & t r
410 p       #!/usr/bin/perl
411         echo "#!/usr/bin/perl" >%b
413 + y unknown & t r
414 a       Author description header
415         unset LANG
416         AUTHOR="$(cat /etc/passwd |grep ^$(id -un) |awk -F: '{print($5)}')"
417         cat >>%b <<EOF
418         ----------------------------------------------------------------------
419         Description:
420         Author: $AUTHOR <$(echo -ne $REPLYTO)>
421         Created at: $(date)
422         Computer: $(uname -n) 
423         System: $(uname -sr) on $(uname -m)
424         
425         Copyright (c) $(date +%%Y) $AUTHOR  All rights reserved.
426         ----------------------------------------------------------------------
427                 
428         EOF
429 #--------------------------- End unknown template -----------------------------
431 -------------------------------------------------------------------------------
433 #----------------------- Begin common section ---------------------------------
434 I       Insert `Changelog' string
435         DATE=$(date +%%Y-%%m-%%d)
436         AUTHOR="$(cat /etc/passwd |grep ^$(id -un) |awk -F: '{print($5)}')"
437         EMAIL="<$(echo -ne $REPLYTO)>"
438         echo "$DATE  $AUTHOR  $EMAIL" >%b
440 s       Invoke `shell'
441         sh
443 m       view `man'
444         MAN=%{Enter name of man:}
445         TMPFILE=/tmp/mcview.$MAN.$$
446         man -Pcat $MAN >$TMPFILE
447         mcview $TMPFILE
448         rm -f $TMPFILE
449                 
450 i       Insert a out of command to cursor.
451         CMD=%{ Enter command: }
452         eval $CMD > %b
454 o       Open bash to next free console
455         open -s -- /bin/bash
456 #-------------------------- End of common section -----------------------------