diff --git a/configure.ac b/configure.ac index 02c004213..ec77113d5 100644 --- a/configure.ac +++ b/configure.ac @@ -529,6 +529,7 @@ contrib/dist/prototype misc/Makefile misc/skins/Makefile +misc/macros.d/Makefile misc/mc.ext src/Makefile diff --git a/misc/Makefile.am b/misc/Makefile.am index c813eb903..4ed4e7a57 100644 --- a/misc/Makefile.am +++ b/misc/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to create Makefile.in. -SUBDIRS = skins syntax +SUBDIRS = macros.d skins syntax LIBFILES_OUT = mc.ext @@ -23,7 +23,6 @@ LIBFILES_CONST = \ mc.menu \ mc.menu.sr - CLEANFILES = $(SCRIPTS_OUT) cfgdir = $(sysconfdir)/@PACKAGE@ diff --git a/misc/macros.d/Makefile.am b/misc/macros.d/Makefile.am new file mode 100644 index 000000000..18594b7dd --- /dev/null +++ b/misc/macros.d/Makefile.am @@ -0,0 +1,11 @@ +macrodir = $(pkgdatadir)/examples/macros.d + +macro_DATA = \ + macro.0.sh \ + macro.1.sh \ + macro.3.sh \ + macro.4.sh \ + macro.5.sh + +EXTRA_DIST = \ + $(macro_DATA) diff --git a/misc/macros.d/macro.0.sh b/misc/macros.d/macro.0.sh new file mode 100644 index 000000000..983b90715 --- /dev/null +++ b/misc/macros.d/macro.0.sh @@ -0,0 +1,6 @@ +#interactive +m make + TMPFILE=`mktemp ${MC_TMPDIR:-/tmp}/up.XXXXXX` || exit 1 + make 2> $TMPFILE + mcedit $TMPFILE + rm $TMPFILE diff --git a/misc/macros.d/macro.1.sh b/misc/macros.d/macro.1.sh new file mode 100644 index 000000000..0a881ba15 --- /dev/null +++ b/misc/macros.d/macro.1.sh @@ -0,0 +1,5 @@ +u Upper case selection + TMPFILE=`mktemp ${MC_TMPDIR:-/tmp}/up.XXXXXX` || exit 1 + cat %b > $TMPFILE + cat $TMPFILE| sed 's/\(.*\)/\U\1/' >%b + rm -f $TMPFILE diff --git a/misc/macros.d/macro.2.sh b/misc/macros.d/macro.2.sh new file mode 100644 index 000000000..7e3b8026d --- /dev/null +++ b/misc/macros.d/macro.2.sh @@ -0,0 +1,5 @@ +l Lower case selection + TMPFILE=`mktemp ${MC_TMPDIR:-/tmp}/up.XXXXXX` || exit 1 + cat %b > $TMPFILE + cat $TMPFILE| sed 's/\(.*\)/\L\1/' >%b + rm -f $TMPFILE diff --git a/misc/macros.d/macro.3.sh b/misc/macros.d/macro.3.sh new file mode 100644 index 000000000..db77f3da6 --- /dev/null +++ b/misc/macros.d/macro.3.sh @@ -0,0 +1,5 @@ +S Sort selection + TMPFILE=`mktemp ${MC_TMPDIR:-/tmp}/up.XXXXXX` || exit 1 + cat %b > $TMPFILE + cat $TMPFILE| sort >%b + rm -f $TMPFILE diff --git a/misc/macros.d/macro.4.sh b/misc/macros.d/macro.4.sh new file mode 100644 index 000000000..ee53a8cce --- /dev/null +++ b/misc/macros.d/macro.4.sh @@ -0,0 +1,2 @@ +t Indent `C' formatter + indent -gnu -fc1 -i4 -bli0 -nut -bap -l100 %b 1>/dev/null 2> %e diff --git a/misc/macros.d/macro.5.sh b/misc/macros.d/macro.5.sh new file mode 100644 index 000000000..a64dfc95a --- /dev/null +++ b/misc/macros.d/macro.5.sh @@ -0,0 +1,41 @@ +s snippets + a=`cat %b` + if [ "$a" = "fori" ]; then + echo "for (i = 0; i _; i++)" > %b + fi + if [ "$a" = "ife" ]; then + cat < %b + if ( ) + { + } + else + { + } + EOF + fi + if [ "$a" = "GPL" ]; then + cat >>%b < %b + typedef struct { + ; + } ?; + EOF + fi diff --git a/misc/mc.macros b/misc/mc.macros new file mode 100644 index 000000000..bcf9d2834 --- /dev/null +++ b/misc/mc.macros @@ -0,0 +1,9 @@ +#see ./macros.d/* +[editor] +#autocomplete "ife", "GPL", "fori" +ctrl-space=EditWordLeftHighlight:-1;EditPipeBlock:5;EditUnmark:-1; +#run make +ctrl-f9=EditPipeBlock:0; +#indent current selection +meta-ctrl-F=EditPipeBlock:4; +