summaryrefslogtreecommitdiff
path: root/mc
diff options
context:
space:
mode:
authorAdministrator <root@bastian.jones.dk>2012-10-03 17:43:12 +0200
committerAdministrator <root@bastian.jones.dk>2012-10-03 17:43:12 +0200
commit1ece66a904dd73a69a5b73f18df5fd05978e2555 (patch)
treeb09c91b74a51c57177f54b1d2473aaeb9896fc2d /mc
parent427ecc91182ee0da02b4d7a9265a79d25de53aac (diff)
Update mc config.
Diffstat (limited to 'mc')
-rw-r--r--mc/mc.ini14
-rw-r--r--mc/mc.menu256
-rw-r--r--mc/mc.menu.diff13
3 files changed, 258 insertions, 25 deletions
diff --git a/mc/mc.ini b/mc/mc.ini
new file mode 100644
index 0000000..a5f8415
--- /dev/null
+++ b/mc/mc.ini
@@ -0,0 +1,14 @@
+[Midnight-Commander]
+auto_save_setup=0
+use_internal_view=1
+use_internal_edit=1
+num_history_items_recorded=200
+editor_option_save_mode=0
+editor_show_right_margin=1
+skin=modarcon16-defbg-thin
+
+[Panels]
+navigate_with_arrows=true
+
+[Layout]
+message_visible=0
diff --git a/mc/mc.menu b/mc/mc.menu
index 2e7be79..bd2d8a7 100644
--- a/mc/mc.menu
+++ b/mc/mc.menu
@@ -1,4 +1,31 @@
shell_patterns=0
++ ! t t
+@ Do something on the current file
+ CMD=%{Enter command}
+ $CMD %f
+
++ t t
+@ Do something on the tagged files
+ set %t; CMD=%{Enter command}
+ while [ -n "$1" ]; do
+ $CMD "$1"
+ shift
+ done
+
+
+0 Edit a bug report and send it to root
+ I=`mktemp "${MC_TMPDIR:-/tmp}/mail.XXXXXX"` || exit 1
+ ${EDITOR-vi} "$I"
+ test -r $I && mail root < $I
+ rm -f "$I"
+
+=+ f \.1$ | f \.3$ | f \.4$ | f \.5$ | f \.6$ | f \.7$ | f \.8$ | f \.man$ & t r
+1 Display the file with roff -man
+ nroff -man %f | less
+
+2 Call the info hypertext browser
+ info
+
= t d
3 Compress the current subdirectory (tar.gz)
Pwd=`basename %d /`
@@ -18,23 +45,198 @@ shell_patterns=0
tar cf - "$Pwd" | bzip2 -f > "$tar.tar.bz2" && \
echo "../$tar.tar.bz2 created."
-=+ f \.tar\.gz$ | f \.tar\.z$ | f \.tgz$ | f \.tpz$ | f \.tar\.Z$| f \.tar\.bz2$ & t r
-x Extract the contents of a compressed tar file
- unset EXT
- case %f in
- *.tar.bz2) EXT=tar_bz2;;
- esac
- if [ "$EXT" = "tar_bz2" ]; then
- bunzip2 -c %f | tar xvf -
+5 Compress the current subdirectory (tar.7z)
+ Pwd=`basename %d /`
+ echo -n "Name of the compressed file (without extension) [$Pwd]: "
+ read tar
+ if [ "$tar"x = x ]; then tar="$Pwd"; fi
+ cd .. && \
+ tar cf - "$Pwd" | 7za a -si "$tar.tar.7z" && \
+ echo "../$tar.tar.7z created."
+
+6 Compress the current subdirectory (tar.xz)
+ Pwd=`basename %d /`
+ echo -n "Name of the compressed file (without extension) [$Pwd]: "
+ read tar
+ if [ "$tar"x = x ]; then tar="$Pwd"; fi
+ cd .. && \
+ tar cf - "$Pwd" | xz -f > "$tar.tar.xz" && \
+ echo "../$tar.tar.xz created."
+
+= f \.c$ & t r
++ f \.c$ & t r & ! t t
+с Compile and link current .c file
+ make `basename %f .c` 2>/dev/null || cc -O -o `basename %f .c` %f
+
++ t r & ! t t
+a Append file to opposite
+ cat %f >> %D/%f
+
++ t t
+A Append files to opposite files
+ set %t
+ while [ -n "$1" ]; do
+ cat "$1" >> "%D/$1"
+ shift
+ done
+
++ t r & ! t t
+d Delete file if a copy exists in the other directory.
+ if [ "%d" = "%D" ]; then
+ echo "The two directories must be different."
+ exit 1
+ fi
+ if [ -f %D/%f ]; then # if two of them, then
+ if cmp -s %D/%f %f; then
+ rm %f && echo "%f: DELETED."
+ else
+ echo "%f and %D/%f differ: NOT deleted."
+ echo -n "Press RETURN "
+ read key
+ fi
else
- gzip -dc %f | tar xvf -
+ echo "%f: No copy in %D/%f: NOT deleted."
+ fi
+
++ t t
+D Delete tagged files if a copy exists in the other directory.
+ if [ "%d" = "%D" ]; then
+ echo "The two directores must be different."
+ exit 1
fi
+ for i in %t
+ do
+ if [ -f "%D/$i" ]; then
+ SUM1="`sum $i`"
+ SUM2="`sum %D/$i`"
+ if [ "$SUM1" = "$SUM2" ]; then
+ rm "$i" && echo "${i}: DELETED."
+ else
+ echo "$i and %D/$i differ: NOT deleted."
+ fi
+ else
+ echo "%i has no copy in %D: NOT deleted."
+ fi
+ done
+
+m View manual page
+ MAN=%{Enter manual name}
+ %view man -P cat $MAN
+
+= f \.gz$ & t r
++ ! t t
+n Inspect gzip'ed newsbatch file
+ dd if=%f bs=1 skip=12|zcat|${PAGER-more}
+ # assuming the cunbatch header is 12 bytes long.
+
+= t r &
++ ! t t
+h Strip headers from current newsarticle
+ CHECK=`awk '{print $1 ; exit}' %f` 2>/dev/null
+ case "$CHECK" in
+ Newsgroups:|Path:)
+ I=`mktemp "${MC_TMPDIR:-/tmp}/news.XXXXXX"` || exit 1
+ cp %f "$I" && sed '/^'"$CHECK"' /,/^$/d' "$I" > %f
+ [ "$?" = "0" ] && rm "$I"
+ echo "%f: header removed."
+ ;;
+ *)
+ echo "%f is not a news article."
+ ;;
+ esac
+
++ t t
+H Strip headers from the marked newsarticles
+ set %t
+ while [ -n "$1" ]; do
+ CHECK=`awk '{print $1 ; exit}' $1` 2>/dev/null
+ WFILE=`mktemp "${MC_TMPDIR:-/tmp}/news.XXXXXX"` || exit 1
+ case "$CHECK" in
+ Newsgroups:|Path:)
+ cp "$1" "$WFILE" && sed '/^'"$CHECK"' /,/^$/d' "$WFILE" > "$1"
+ if [ "$?" = "0" ]; then
+ rm "$WFILE"; echo "$1 header removed. OK."
+ else
+ echo "Oops! Please check $1 against $WFILE."
+ fi
+ ;;
+ *)
+ echo "$1 skipped: Not a news article."
+ ;;
+ esac
+ shift
+ done
+
+= t r
++ ! t t
+r Copy file to remote host
+ echo -n "To which host?: "
+ read Host
+ echo -n "To which directory on $Host?: "
+ read Dir
+ rcp -p %f "${Host}:$Dir"
+
++ t t
+R Copy files to remote host (no error checking)
+ echo -n "Copy files to which host?: "
+ read Host
+ echo -n "To which directory on $Host? :"
+ read Dir
+ rcp -pr %u "${Host}:$Dir"
+
+= f \.tex$ & t r
++ f \.tex$ & t r & ! t t
+t Run latex on file and show it with xdvi
+ latex %f && xdvi `basename %f .tex`.dvi
+
+=+ f ^part | f ^Part | f uue & t r
++ t t
+U Uudecode marked news articles (needs work)
+ set %t
+ (
+ while [ -n "$1" ]; do # strip headers
+ FIRST=`awk '{print $1 ; exit}' "$1"`
+ cat "$1" | sed '/^'"$FIRST"' /,/^$/d'; shift
+ done
+ ) |sed '/^$/d' |sed -n '/^begin 6/,/^end$/p' | uudecode
+ if [ "$?" != "0" ]; then
+ echo "Cannot decode %t."
+ fi
+ echo "Please test the output file before deleting anything."
+
+=+ f \.tar\.gz$ | f \.tar\.z$ | f \.tgz$ | f \.tpz$ | f \.tar\.lz$ | f \.tar\.lzma$ | f \.tar\.7z$ | f \.tar\.xz$ | f \.tar\.Z$ | f \.tar\.bz2$ & t r
+x Extract the contents of a compressed tar file
+ unset PRG
+ case %f in
+ *.tar.bz2)
+ PRG="bunzip2 -c"
+ ;;
+ *.tar.gz|*.tar.z|*.tgz|*.tpz|*.tar.Z)
+ PRG="gzip -dc"
+ ;;
+ *.tar.lzma)
+ PRG="lzma -dc"
+ ;;
+ *.tar.lz)
+ PRG="lzip -dc"
+ ;;
+ *.tar.xz)
+ PRG="xz -dc"
+ ;;
+ *.tar.7z)
+ PRG="7za e -so"
+ ;;
+ *)
+ exit 1
+ ;;
+ esac
+ $PRG %f | tar xvf -
= t r
+ ! t t
y Gzip or gunzip current file
unset DECOMP
- case %f in
+ case %f in
*.gz) DECOMP=-d;;
*.[zZ]) DECOMP=-d;;
esac
@@ -45,17 +247,17 @@ Y Gzip or gunzip tagged files
for i in %t
do
unset DECOMP
- case $i in
+ case "$i" in
*.gz) DECOMP=-d;;
*.[zZ]) DECOMP=-d;;
esac
- gzip $DECOMP -v $i
+ gzip $DECOMP -v "$i"
done
+ ! t t
b Bzip2 or bunzip2 current file
unset DECOMP
- case %f in
+ case %f in
*.bz2) DECOMP=-d;;
esac
bzip2 $DECOMP -v %f
@@ -65,10 +267,10 @@ B Bzip2 or bunzip2 tagged files
for i in %t
do
unset DECOMP
- case $i in
+ case "$i" in
*.bz2) DECOMP=-d;;
esac
- bzip2 $DECOMP -v $i
+ bzip2 $DECOMP -v "$i"
done
+ f \.tar.gz$ | f \.tgz$ | f \.tpz$ | f \.tar.Z$ | f \.tar.z$ | f \.tar.bz2$ | f \.tar.F$ & t r & ! t t
@@ -84,7 +286,7 @@ z Extract compressed tar file to subdirectory
*.tar.bz2) D="`basename %f .tar.bz2`"; set bunzip2 -c ;;
*.tar.F) D="`basename %f .tar.F`"; set freeze -dc;
esac
- mkdir $D; cd $D && ($1 $2 ../%f | tar xvf -)
+ mkdir "$D"; cd "$D" && ("$1" "$2" ../%f | tar xvf -)
+ t t
Z Extract compressed tar files to subdirectories
@@ -92,7 +294,7 @@ Z Extract compressed tar files to subdirectories
do
set gzip -dc
unset D
- case $i in
+ case "$i" in
*.tar.gz) D="`basename $i .tar.gz`";;
*.tgz) D="`basename $i .tgz`";;
*.tpz) D="`basename $i .tpz`";;
@@ -101,7 +303,7 @@ Z Extract compressed tar files to subdirectories
*.tar.F) D="`basename $i .tar.F`"; set freeze -dc;;
*.tar.bz2) D="`basename $i .tar.bz2`"; set bunzip2 -c;;
esac
- mkdir $D; (cd $D && $1 $2 ../$i | tar xvf -)
+ mkdir "$D"; (cd "$D" && "$1" "$2" "../$i" | tar xvf -)
done
+ f \.gz$ | f \.tgz$ | f \.tpz$ | f \.Z$ | f \.z$ | f \.bz2$ & t r & ! t t
@@ -122,9 +324,9 @@ c Convert gz<->bz2, tar.gz<->tar.bz2 & tgz->tar.bz2
bz2) D="`basename %f .bz2`";;
esac
if [ "$EXT" = "bz2" ]; then
- bunzip2 -v %f ; gzip -f9 -v $D
+ bunzip2 -v %f ; gzip -f9 -v "$D"
else
- gunzip -v %f ; bzip2 -v $D
+ gunzip -v %f ; bzip2 -v "$D"
fi
+ t t
@@ -134,7 +336,7 @@ C Convert gz<->bz2, tar.gz<->tar.bz2 & tgz->tar.bz2
do
unset D
unset EXT
- case $1 in
+ case "$1" in
*.tgz) EXT=tgz;;
*.tpz) EXT=tpz;;
*.Z) EXT=Z;;
@@ -149,15 +351,19 @@ C Convert gz<->bz2, tar.gz<->tar.bz2 & tgz->tar.bz2
bz2) D="`basename $1 .bz2`";;
esac
if [ "$EXT" = "bz2" ]; then
- bunzip2 -v $1
- gzip -f9 -v $D
+ bunzip2 -v "$1"
+ gzip -f9 -v "$D"
else
- gunzip -v $1
- bzip2 -v $D
+ gunzip -v "$1"
+ bzip2 -v "$D"
fi
shift
done
++ x /usr/bin/open | x /usr/local/bin/open & x /bin/sh
+o Open next a free console
+ open -s -- sh
+
+ F \.tar\.gz$ | F \.tar\.bz2$ & ! T T
t git-import-orig current file in opposite dir
git-import-orig --pristine-tar --sign-tags %D/%F
diff --git a/mc/mc.menu.diff b/mc/mc.menu.diff
new file mode 100644
index 0000000..047bf13
--- /dev/null
+++ b/mc/mc.menu.diff
@@ -0,0 +1,13 @@
+--- mc.menu.orig 2012-08-05 14:41:44.000000000 +0200
++++ mc.menu 2012-10-03 17:27:34.000000000 +0200
+@@ -363,3 +363,10 @@
+ + x /usr/bin/open | x /usr/local/bin/open & x /bin/sh
+ o Open next a free console
+ open -s -- sh
++
+++ F \.tar\.gz$ | F \.tar\.bz2$ & ! T T
++t git-import-orig current file in opposite dir
++ git-import-orig --pristine-tar --sign-tags %D/%F
++
++c Create unofficial changelog entry
++ dch -D jonas -l ~0jones --force-distribution "Unofficial build based on Debian Sid packaging."