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