mcedit.menu.in 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  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 3 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, see <http://www.gnu.org/licenses/>.
  230. */
  231. EOF
  232. + f \.c$ | f \.cc$
  233. 3 if ()
  234. cat <<EOF > %b
  235. %iif () {
  236. %i}
  237. EOF
  238. + f \.c$ | f \.cc$
  239. 4 if () else
  240. cat <<EOF > %b
  241. %iif () {
  242. %i} else {
  243. %i}
  244. EOF
  245. + f \.c$ | f \.cc$
  246. 5 if () else if ()
  247. cat <<EOF > %b
  248. %iif ( ) {
  249. %i} else if ( ) {
  250. %i}
  251. EOF
  252. + f \.c$ | f \.cc$
  253. 6 switch ()
  254. NUMBER=%{ Enter number elements of switch:}
  255. echo "%iswitch () {" >%b
  256. while [ "$NUMBER" -gt 0 ]
  257. do
  258. echo "%icase '':" >>%b
  259. echo "%i break;" >>%b
  260. let NUMBER=$NUMBER-1
  261. done
  262. echo "%i default:" >>%b
  263. echo "%i}" >>%b
  264. + f \.c$ | f \.cc$
  265. 7 for ()
  266. cat <<EOF > %b
  267. %ifor (i = ; i < ; i++) {
  268. %i}
  269. EOF
  270. + f \.c$ | f \.cc$
  271. 8 while ()
  272. cat <<EOF > %b
  273. %iwhile () {
  274. %i}
  275. EOF
  276. + f \.c$ | f \.cc$
  277. 9 do {} while ()
  278. cat <<EOF > %b
  279. %ido {
  280. %i} while ()
  281. EOF
  282. + f \.c$ | f \.cc$
  283. a array
  284. cat <<EOF > %b
  285. %ichar const x[] = {
  286. %i, ,
  287. %i};
  288. EOF
  289. + f \.c$ | f \.cc$
  290. b enum
  291. cat <<EOF > %b
  292. %ienum x {
  293. %i, ,
  294. %i};
  295. EOF
  296. + f \.c$ | f \.cc$
  297. c struct
  298. cat <<EOF > %b
  299. %istruct ? {
  300. %i;
  301. %i};
  302. EOF
  303. + f \.c$ | f \.cc$
  304. d union
  305. cat <<EOF > %b
  306. %iunion ? {
  307. %i;
  308. %i};
  309. EOF
  310. + f \.c$ | f \.cc$
  311. e typedef struct
  312. cat <<EOF > %b
  313. %itypedef struct {
  314. %i;
  315. %i} ?;
  316. EOF
  317. + f \.c$ | f \.cc$
  318. f function
  319. NAME=%{ Enter name of function:}
  320. cat <<EOF >> %b
  321. $NAME()
  322. {
  323. } /* end of $NAME() */
  324. EOF
  325. + f \.c$ | f \.h$ | f \.cc$
  326. g #include
  327. INC=%{ Enter include name: }
  328. if [ -r "$INC" ];then
  329. echo \#include \"$INC\" >%b
  330. else
  331. echo \#include \<$INC\> >%b
  332. fi
  333. + f \.c$ | f \.h$ | f \.cc$
  334. d #define
  335. echo "#define " >%b
  336. + f \.c$ | f \.h$ | f \.cc$
  337. d #ifdef
  338. cat <<EOF > %b
  339. #ifdef
  340. #else
  341. #endif
  342. EOF
  343. + f \.c$ | f \.h$ | f \.cc$
  344. ...............................................................................
  345. + f \.c$ | f \.h$ | f \.cc$
  346. h View all *.h into current directory
  347. cat *.h |less
  348. + f \.c$ | f \.cc$
  349. d Run gdb for current file
  350. [ -x "./%n" ] && gdb ./%n
  351. = f \.c$ | f \.cc$
  352. + f \.c$ | f \.cc$
  353. c Compile, link and run the current .c file
  354. export CFLAGS="-g -Wall -O2"
  355. make || make %n || cc $CFLAGS -o %n %f
  356. [ -r "%n" ] && (echo "*** press any key for run... ***"; read)
  357. [ -x "%n" ] && ./%n
  358. (echo -ne "\n--- Press any key for return to edit. ---"; read)
  359. + f \.c$ | f \.h$
  360. t Indent `C' formatter
  361. indent -kr -pcs %b 1>/dev/null 2> %e
  362. #--------------------- End [c/c++] language template --------------------------
  363. #------------------------- Begin unknown template -----------------------------
  364. + y unknown & t r
  365. s #! /bin/sh
  366. echo "#! /bin/sh" >%b
  367. + y unknown & t r
  368. p #! /usr/bin/perl
  369. echo "#! /usr/bin/perl" >%b
  370. + y unknown & t r
  371. a Author description header
  372. unset LANG
  373. unset LANGUAGE
  374. LC_ALL=
  375. MY_UID="`id | sed 's/^.*uid=\([^(]*\).*$/\1/'`"
  376. AUTHOR="`awk -F: '$3 == '$MY_UID' {print $5}' /etc/passwd`"
  377. cat >>%b <<EOF
  378. ----------------------------------------------------------------------
  379. Description:
  380. Author: $AUTHOR <$REPLYTO>
  381. Created at: `date`
  382. Computer: `uname -n`
  383. System: `uname -sr` on `uname -m`
  384. Copyright (c) `date +%%Y` $AUTHOR All rights reserved.
  385. ----------------------------------------------------------------------
  386. EOF
  387. #--------------------------- End unknown template -----------------------------
  388. -------------------------------------------------------------------------------
  389. #----------------------- Begin common section ---------------------------------
  390. S Sort selection
  391. TMPFILE=`mktemp ${MC_TMPDIR:-/tmp}/up.XXXXXX` || exit 1
  392. cat %b > $TMPFILE
  393. cat $TMPFILE| sort >%b
  394. rm -f $TMPFILE
  395. I Insert `Changelog' string
  396. DATE="`date +%%Y-%%m-%%d`"
  397. MY_UID="`id | sed 's/^.*uid=\([^(]*\).*$/\1/'`"
  398. AUTHOR="`awk -F: '$3 == '$MY_UID' {print $5}' /etc/passwd`"
  399. EMAIL="<$REPLYTO>"
  400. echo "$DATE $AUTHOR $EMAIL" >%b
  401. s Invoke `shell'
  402. sh
  403. m view `man'
  404. MAN=%{Enter name of man:}
  405. %view{ascii,nroff} MANROFFOPT='@MAN_FLAGS@' MAN_KEEP_FORMATTING=1 man -P cat $MAN
  406. i Insert output of command to cursor
  407. CMD=%{ Enter command: }
  408. eval $CMD > %b
  409. o Open bash to next free console
  410. open -s -- /bin/bash
  411. u Upper case selection
  412. TMPFILE=`mktemp ${MC_TMPDIR:-/tmp}/up.XXXXXX` || exit 1
  413. cat %b > $TMPFILE
  414. sed 's/\(.*\)/\U\1/' $TMPFILE >%b
  415. rm -f $TMPFILE
  416. l Lower case selection
  417. TMPFILE=`mktemp ${MC_TMPDIR:-/tmp}/up.XXXXXX` || exit 1
  418. cat %b > $TMPFILE
  419. sed 's/\(.*\)/\L\1/' $TMPFILE >%b
  420. rm -f $TMPFILE
  421. #-------------------------- End of common section -----------------------------