mcedit.menu 12 KB

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