Fixed searching the start of word
[midnight-commander.git] / misc / cedit.menu
blobc2dfe29ddae63ae2d3f5a5584c562f4a9b0c9619
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.
24
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:
53         
54         #----------------------------------------------------------------------
55         #
56         # main()
57         
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
87                 
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:
145         
146         #----------------------------------------------------------------------
147         #
148         # main()
149         
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
202                 
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
215         
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 2 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, write to the Free Software
255         * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
256         */
257         EOF
259 + f \.c$ | f \.cc$
260 3       if ()
261         cat <<EOF > %b
262         %iif () {
263         %i}
264         EOF
265                 
266 + f \.c$ | f \.cc$
267 4       if () else
268         cat <<EOF > %b
269         %iif () {
270         %i} else {
271         %i}
272         EOF
274 + f \.c$ | f \.cc$
275 5       if () else if ()
276         cat <<EOF > %b
277         %iif ( ) {
278         %i} else if ( ) {
279         %i}
280         EOF
282 + f \.c$ | f \.cc$
283 6       switch ()
284         NUMBER=%{ Enter number elements of switch:}
285         echo "%iswitch () {" >%b
286         while [ "$NUMBER" -gt 0 ]
287         do
288             echo "%icase '':" >>%b
289             echo "%i      break;" >>%b
290             let NUMBER=$NUMBER-1    
291         done
292         echo "%i      default:" >>%b
293         echo "%i}" >>%b
294         
295 + f \.c$ | f \.cc$
296 7       for ()
297         cat <<EOF > %b
298         %ifor (i =  ; i <  ; i++) {
299         %i}
300         EOF
301         
302 + f \.c$ | f \.cc$
303 8       while ()               
304         cat <<EOF > %b
305         %iwhile () {
306         %i}
307         EOF
309 + f \.c$ | f \.cc$
310 9       do {} while ()               
311         cat <<EOF > %b
312         %ido {
313         %i} while ()
314         EOF
315         
316 + f \.c$ | f \.cc$
317 a       array
318         cat <<EOF > %b
319         %ichar const x[] = {
320         %i, ,
321         %i};
322         EOF
323         
324 + f \.c$ | f \.cc$
325 b       enum
326         cat <<EOF > %b
327         %ienum x {
328         %i, ,
329         %i};
330         EOF
331         
332 + f \.c$ | f \.cc$
333 c       struct
334         cat <<EOF > %b
335         %istruct ? {
336         %i;
337         %i};
338         EOF
339         
340 + f \.c$ | f \.cc$
341 d       union
342         cat <<EOF > %b
343         %iunion ? {
344         %i;
345         %i};
346         EOF
347         
348 + f \.c$ | f \.cc$
349 e       typedef struct
350         cat <<EOF > %b
351         %itypedef struct {
352         %i;
353         %i} ?;
354         EOF
356 + f \.c$ | f \.cc$
357 f       function
358         NAME=%{ Enter name of function:}
359         cat <<EOF >> %b
360         $NAME()
361         {
362         } /* end of $NAME() */
363         EOF
365 + f \.c$ | f \.h$ | f \.cc$
366 g       #include
367         INC=%{ Enter include name: }
368         if [ -r "$INC" ];then
369             echo \#include \"$INC\" >%b
370         else
371             echo \#include \<$INC\> >%b
372         fi
374 + f \.c$ | f \.h$ | f \.cc$
375 d       #define
376         echo "#define " >%b
378 + f \.c$ | f \.h$ | f \.cc$
379 d       #ifdef
380         cat <<EOF > %b
381         #ifdef
382         #else
383         #endif
384         EOF
386 + f \.c$ | f \.h$ | f \.cc$
387 ...............................................................................
389 + f \.c$ | f \.h$ | f \.cc$
390 h       View all *.h into current directory
391         cat *.h |less
393 + f \.c$ | f \.cc$
394 d       Run gdb for current file
395         [ -x "./%n" ] && gdb ./%n
397 = f \.c$ | f \.cc$
398 + f \.c$ | f \.cc$
399 c       Compile, link and run the current .c file
400         export CFLAGS="-g -Wall -O2"
401         make || make %n || cc $CFLAGS -o %n %f
402         [ -r "%n" ] && (echo "*** press any key for run... ***"; read)
403         [ -x "%n" ] && ./%n
404         (echo -ne "\n--- Press any key for return to edit. ---"; read)
406 + f \.c$ | f \.h$
407 t       Indent `C' formatter
408         indent -kr -pcs %b 1>/dev/null 2> %e
410 #--------------------- End [c/c++] language template --------------------------
412 #------------------------- Begin unknown template -----------------------------
413 + y unknown & t r
414 s       #! /bin/sh
415         echo "#! /bin/sh" >%b
417 + y unknown & t r
418 p       #! /usr/bin/perl
419         echo "#! /usr/bin/perl" >%b
421 + y unknown & t r
422 a       Author description header
423         unset LANG
424         unset LANGUAGE
425         LC_ALL=
426         MY_UID="`id | sed 's/^.*uid=\([^(]*\).*$/\1/'`"
427         AUTHOR="`awk -F: '$3 == '$MY_UID' {print $5}' /etc/passwd`"
428         cat >>%b <<EOF
429         ----------------------------------------------------------------------
430         Description:
431         Author: $AUTHOR <$REPLYTO>
432         Created at: `date`
433         Computer: `uname -n` 
434         System: `uname -sr` on `uname -m`
435         
436         Copyright (c) `date +%%Y` $AUTHOR  All rights reserved.
437         ----------------------------------------------------------------------
438                 
439         EOF
440 #--------------------------- End unknown template -----------------------------
442 -------------------------------------------------------------------------------
444 #----------------------- Begin common section ---------------------------------
445 I       Insert `Changelog' string
446         DATE="`date +%%Y-%%m-%%d`"
447         MY_UID="`id | sed 's/^.*uid=\([^(]*\).*$/\1/'`"
448         AUTHOR="`awk -F: '$3 == '$MY_UID' {print $5}' /etc/passwd`"
449         EMAIL="<$REPLYTO>"
450         echo "$DATE  $AUTHOR  $EMAIL" >%b
452 s       Invoke `shell'
453         sh
455 m       view `man'
456         MAN=%{Enter name of man:}
457         TMPFILE=`mktemp ${MC_TMPDIR:-/tmp}/mcview.$MAN.XXXXXX` || exit 1
458         man -Pcat $MAN >$TMPFILE
459         mcview $TMPFILE
460         rm -f $TMPFILE
461                 
462 i       Insert a out of command to cursor.
463         CMD=%{ Enter command: }
464         eval $CMD > %b
466 o       Open bash to next free console
467         open -s -- /bin/bash
468 #-------------------------- End of common section -----------------------------