added examples

added rules for misc/macros.d/*. in the process of installation, example scripts will be copied into share/mc/examples/macros.d

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
This commit is contained in:
Ilia Maslakov 2011-02-04 13:15:43 +03:00
parent b642e2e1e1
commit 04d54931d0
10 changed files with 86 additions and 2 deletions

View File

@ -529,6 +529,7 @@ contrib/dist/prototype
misc/Makefile
misc/skins/Makefile
misc/macros.d/Makefile
misc/mc.ext
src/Makefile

View File

@ -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@

11
misc/macros.d/Makefile.am Normal file
View File

@ -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)

6
misc/macros.d/macro.0.sh Normal file
View File

@ -0,0 +1,6 @@
#interactive
m make
TMPFILE=`mktemp ${MC_TMPDIR:-/tmp}/up.XXXXXX` || exit 1
make 2> $TMPFILE
mcedit $TMPFILE
rm $TMPFILE

5
misc/macros.d/macro.1.sh Normal file
View File

@ -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

5
misc/macros.d/macro.2.sh Normal file
View File

@ -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

5
misc/macros.d/macro.3.sh Normal file
View File

@ -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

2
misc/macros.d/macro.4.sh Normal file
View File

@ -0,0 +1,2 @@
t Indent `C' formatter
indent -gnu -fc1 -i4 -bli0 -nut -bap -l100 %b 1>/dev/null 2> %e

41
misc/macros.d/macro.5.sh Normal file
View File

@ -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 <<EOF > %b
if ( )
{
}
else
{
}
EOF
fi
if [ "$a" = "GPL" ]; then
cat >>%b <<EOF
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
EOF
fi
if [ "$a" = "type" ]; then
cat <<EOF > %b
typedef struct {
;
} ?;
EOF
fi

9
misc/mc.macros Normal file
View File

@ -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;