commit 1fa4fd97953e38070d33a49235a3a38108fb89d0
parent 0dd44e32064ff0d9bbb9624a1b0b4302db34c9d9
Author: Jaromil <jaromil@dyne.org>
Date: Sun, 9 Sep 2012 13:40:40 +0200
added ctrl-j in vim editor to justify paragraphs
Diffstat:
1 file changed, 40 insertions(+), 17 deletions(-)
diff --git a/src/zlibs/helpers b/src/zlibs/helpers
@@ -25,13 +25,13 @@
# or a folder to start with
autostart() {
-# no argument passed. open known folder
+# no argument passed. open first folder with new mail
{ test -z ${1} } && {
{ test ! -r $MUTTDIR/rc } \
&& { error "Jaro Mail is not yet configured."; return 1 }
- ${=mutt} -F $MUTTDIR/rc ${=muttflags}
+ ${=mutt} -F $MUTTDIR/rc ${=muttflags} -Z
return $?
}
@@ -60,7 +60,7 @@ autostart() {
}
# or the name of a folder in Jaro Mail
- { test -r "$MAILDIRS/$1" } && {
+ { maildircheck "$MAILDIRS/$1" } && {
notice "Opening folder ${1}"
${=mutt} -F $MUTTDIR/rc ${=muttflags} -f "$MAILDIRS/${1}"
return 0
@@ -75,29 +75,52 @@ autostart() {
# this part guesses what is the best editor already present on the system
# of course we have a preference for AutOrg, the editor from our suite
# however the default is nano if nothing else is choosen.
-editor() {
- { test ${EDITOR} } && {
- case ${EDITOR} in
+jarovim() {
+ vim -c 'set fo=tcrq' -c 'set tw=72' \
+ -c 'map <C-j> {gq}' -c 'imap <C-j> <esc>{gq}i' \
+ ${=@}
+ return $?
+}
+
+edit_file() {
+ { test ${EDITOR} } && { _editor="${EDITOR}" }
+ { test ${JARO_EDITOR} } && { _editor="$JARO_EDITOR" }
+
+ case $_editor in
# refine settings for email
- vi|vim) vim -c 'set fo=tcrq' -c 'set tw=76' ${=PARAM} ;;
- emacs) emacsclient -a emacs ${=PARAM} ;;
- *) ${=EDITOR} ${=PARAM} ;;
- esac
- return $? }
+ vi|vim) jarovim ${=PARAM}; return $? ;;
+ emacs) emacsclient -a emacs ${=PARAM}; return $? ;;
+ *) ${=_editor} ${=PARAM}; return $? ;;
+ esac
+
# if we are here we need to guess
case $OS in
MAC) open -t ${=PARAM} ;;
GNU)
- { ps ax|grep '[e]macs' } && { emacsclient -a ${=PARAM} }
- { ps ax|grep '[v]im' } && { vim -c 'set fo=tcrq' -c 'set tw=76' ${=PARAM} }
- { which nano > /dev/null } && {
- nano -m -S -Q ">" -I -E -D -T 4 -U -W -c -i -k -r 72 ${=PARAM} }
- error "No editor found, please configure the EDITOR environment variable."
+ ps ax|grep '[e]macs' > /dev/null
+ if [ $? = 0 ]; then
+ emacsclient -a ${=PARAM}
+ elif [ `which vim` ]; then
+ jarovim ${=PARAM}
+ elif [ `which nano` ]; then
+ nano -m -S -Q ">" -I -E -D -T 4 -U -W -c -i -k -r 72 ${=PARAM}
+ else
+ error "No editor found, please configure the JARO_EDITOR environment variable."
+ fi
;;
esac
return $?
}
+#####################
+## Open a mail folder
+open_folder() {
+ notice "Opening folder ${1}"
+ { maildircheck ${MAILDIRS}/${1} } && {
+ ${=mutt} -F $MUTTDIR/rc ${=muttflags} -f "$MAILDIRS/${1}"
+ return $? }
+ return 1
+}
##############
## Open a File
@@ -186,7 +209,7 @@ cert() {
# gmail)
cc=Equifax_Secure_Certificate_Authority
if ! [ -r $WORKDIR/certs/${cc}.pem ]; then
-
+
curl -o $WORKDIR/certs/${cc}.pem \
"https://www.geotrust.com/resources/root_certificates/certificates/${cc}.cer"
openssl x509 -in \