From 5b0a8e733dc2b75da83a5fa56bd968f6ce7cc1ac Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Tue, 5 Dec 2017 04:28:29 +0000 Subject: [PATCH] move to nio.git --- etc/vim/source/html.no | 6 - etc/vim/vim-shortcurts | 741 ----------------------------------------- 2 files changed, 747 deletions(-) delete mode 100644 etc/vim/source/html.no delete mode 100755 etc/vim/vim-shortcurts diff --git a/etc/vim/source/html.no b/etc/vim/source/html.no deleted file mode 100644 index 314cd89e..00000000 --- a/etc/vim/source/html.no +++ /dev/null @@ -1,6 +0,0 @@ -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" NB 04.09.06 HTML plugin -" :let g:html_authorname = 'Nicolas Boisselier' -" :let g:html_tag_case = 'l' -" :let g:html_template = $VIMHOME . '/templates/template.html' -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/etc/vim/vim-shortcurts b/etc/vim/vim-shortcurts deleted file mode 100755 index d8593bd7..00000000 --- a/etc/vim/vim-shortcurts +++ /dev/null @@ -1,741 +0,0 @@ -#!/usr/bin/env bash -################################################################################# -# -# NB 21.10.11 -# -# Script to use in ~/.vimrc -# -# Vim: escape: s/\([\`\$\\]\)/\\\1/g -# Vim: functions: r!perl -ne 'print "$1\n" if /^function (.*)_\w+\s*$/' % -# -# -# SEE ALSO: -# -# Functions: http://vimdoc.sourceforge.net/htmldoc/eval.html#functions -# Functions: http://vim.wikia.com/wiki/Write_your_own_Vim_function -# MappingKeys: http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-_Tutorial_%28Part_1%29 -# Nav: http://www.thegeekstuff.com/2009/03/8-essential-vim-editor-navigation-fundamentals/ -# Toc: http://vimdoc.sourceforge.net/htmldoc/usr_toc.html -# -################################################################################# -#exec echo "DEBUG:$@" -#exec echo -n '#' - -################################################################################## -# -# Globals -# -################################################################################# -ME="NB" -COPYRIGHT="(C) $YEAR Nicolas Boisselier" - -TAG="_THERE_" -TYPES="all|php|perl|bash|sh|vim|ini|sql|xml|html" - -YEAR=$(date +\%Y) -NOW=$(date +\%d.\%m.\%y) - -ME_NOW="$ME $NOW" -#COPYRIGHT_LAIUS="This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself." -#Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed -#This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself. -COPYRIGHT_LAIUS="Copyright $COPYRIGHT - -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 3 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. - -See ." -#echo $FILE; - -NAME=`echo $0 | sed 's,^.*/,,'` - -################################################################################## -# -# -# Functions -# -# -################################################################################# - -################################################################################# -# -# Functions - Internal / ALL_* -# -################################################################################# -function all_list { # all_l -perl -ne ' - next unless ($_,$o) = (/^function\s+(\w+)\s+\{(?:\s*#\s*(\S+))?/); - /^(all_|_|foo)/ and next; - @_ = /^((?:('$TYPES')_)?(.*?))\s*$/; - push(@f,[$1, ($2||""), ($2 ? $3 : ""), ($o ? $o : "")]); - END { - @f = sort { - ($a->[1] cmp $b->[1]) - || ($a->[0] cmp $b->[0]) - } @f; - print map {join("\t",@$_)."\n"} @f; - } -' $0; -} - -function all_comment_new { - printf '%s' "`${1}_comment_char` $TAG - $ME_NOW" -} - -function all_comment_line { - #printf '%s ' "`${1}_comment_char`" - #set|grep _comment_char - printf '%s ' "`${1}_comment_char` $ME_NOW" -} - -function all_comment_line_toggle { - #declare e="`${1}_comment_char` $ME_NOW" - declare e="`all_comment_line $1`" - perl -pe 's/^/zaza/' - #perl -pe '$e=qq|'"$e"'|; s/^\Q$e\E// or s/^/$e/' - #printf '%s ' "`${1}_comment_char`" - #printf '%s ' "`${1}_comment_char` $ME_NOW" -} - -function all_inputlist { - list=`all_list` - - i=0 - for l in $list; do - i=$(($i+1)); - echo " [$i] - $l" - done - -} - -function all_choose { - declare r list fct - - #list=`help noexit | perl -ne 'next if /^Usage/m ... /\s*\n$/m; s/^(\s+)\-/" [".($i++ + 1)."] -"/egm; s/xxx_/auto_/; print'` - list=`help noexit | perl -ne 'next if /^Usage/m ... /\s*\n$/m; s/^(\s+)\-/" ".($i++ + 1)."."/egm; s/xxx_/auto_/; print'` - - printf "%s\n\n" "$list" -return - read -e -p "Wich number ? : " -t 20 r - - test "$r" -gt "0" &>/dev/null || exit 1 - - fct=`echo "$list"|perl -ne '/^\s*\['$r'\] -\s*(.*)\s*$/ and print "$1\n" and last'` - test -z "$fct" && exit 1 - - echo $fct -exit -} - - -function help { -all_list|perl -e ' @all = map{chomp($_); [split(/\t/,$_)] } <>; -use Data::Dumper; -#warn Dumper \\@all; -print "Usage: '$NAME' [-help] [ACTION] [PARAMS]\n"; - -print "\nCommun Functions:\n",map("\t- ".$_->[0]."\n",grep{!$_->[1]} @all); - -my @lang = sort grep{$_ and !$lang{$_}++} map{$_->[1]} @all; -my @fct = sort grep{$_ and !$fct{$_}++} map{$_->[2]} @all; -my $col = 1 - + (( sort{$a<$b} map {length($_)} @lang ))[0] - + (( sort{$a<$b} map {length($_)} @fct ))[0] -; -#print "$col\n"; - -my $fmt = "| %-${col}s "; -#$fmt = "| %s"; - -print "\nLangage/Type file Functions\n" - ,"\n" - ,"\tTypes: ".join(", ",@lang)."\n" - ,"\tFunctions: ".join(", ",map{"auto_$_ FILE"}@fct)."\n" - ,"\n" - #,map{"\t- xxx_".$_."\n"} @fct -; - -for my $f (@fct) { - for my $l (@lang) { - printf("$fmt",$l."_".$f); - } - print " |\n"; -} - -#print "\nActions: ".join(", ",map{"xxx_".$_->[2]} grep{$_->[2] and !$t{$_->[3]}++} @all)."\n"; -' 2>&1 -[ "$1" == "noexit" ] && return -exit -} - -function all_err { - echo "$0: ERR: $1" 1>&2 - exit 1 -} - - -################################################################################# -# -# Functions - Generics -# -################################################################################# -function me_now { echo "$ME_NOW"; } - -function file_type { - - [ -z "$1" ] && all_err "Usage: file_type FILE" - - # - # By name - # - case $1 in - - *.bash|*.sh|*procmail*|*mutt*|*.conf|*my.cnf) echo sh; return ;; - - *.pm|*.pl) echo perl; return ;; - - *.ini) echo ini; return ;; - - *.php|*.inc|*.css|*.js|*named.conf*) echo php; return ;; - - *.sql) echo sql; return ;; - - *vimrc*) echo vim; return ;; - - *.cfg*) echo ini; return ;; - - esac - - # - # By Ext - # - [ -e "$1" ] || return 1 - [ -e "$1" ] || all_err "file_type can't find $1" - type=`file --dereference -b $1` - - case $type in - - sql) echo sql ;; - - xml|*XML*document*) echo xml ;; - - sgml|*SGML*document*) echo sgml ;; - - html|htm|*HTML*document*) echo html ;; - - *"perl"*|pl|pm) echo perl ;; - - *"php"*|*[pP][hH][pP]*script*) echo php ;; - - *"bash"*|"Bourne-Again shell script text executable"|sh|*"shell script ttype executable"*) echo bash ;; - - txt|*ASCII*ttype) echo txt ;; - - *) - if false && test -x "$1"; then - echo "sh" - else - echo "$type" - fi - ;; - - esac; - -} - -function all_file_short { - FILE_SHORT="$FILE" - [ -z "$IZI_ROOT_DIR" ] || FILE_SHORT=`echo "$FILE_SHORT"|sed "s@^$IZI_ROOT_DIR@~izideal@"` - TYPE=`file_type $FILE` -} - -function include_template { - declare file=$1 - test -e "$file" || return 1 - - if test -e "$FILE"; then # && ! test -x "$FILE"; then - - ch=`chmod -v +x "$FILE" 2>&1` - [ -z "$ch" ] || echo "# $ch" - - #echo "# Todo: chmod -v +x $FILE" - fi - -#exec echo ">>DEBUG $@" - sed \ - -e "s/\\t/\\t/g" \ - -e "s^^$FILE_SHORT^g" \ - -e "s^.auto_file^$FILE^g" \ - -e "s^.me_now.^$ME_NOW^g" \ - -e "s^<\(WHO\|ME\)>^$ME^g" \ - -e "s^<\(NOW\|DATE\)>^$NOW^g" \ - -e "s^^$COPYRIGHT^g" \ - "$file" | perl -pe "\$s=qq|$COPYRIGHT_LAIUS|; s^^\$s^g" - return 0 -} - -# Hello - -function izi_2globales { -#if [ $# -gt 0 ]; then -#fi - false && perl -pe \ - 'for (@ARGV) {' \ - '}' \ - 'BEGIN {@RGV = map {-e $_ ? $_ : ""} @ARGV;};' \ - 's/\$(GLOB|Page|ADMIN_USER|SEARCH_PAGE_NAME|DB_CON|MEMORY_DEBUG|TRANSLATIONS)/\$GLOBALS[$1]/g' \ - $@ - true && echo -e "$@" | sed -e \ - 's/\$\(GLOB\|Page\|ADMIN_USER\|SEARCH_PAGE_NAME\|DB_CON\|MEMORY_DEBUG\|TRANSLATIONS\)/\$GLOBALS[\1]/g' - -} - -################################################################################# -# -# Functions - ALL_ -# -################################################################################# -################################################################################## -# -# Functions - TYPE_ -# -################################################################################# - -################################################################################## -# -# Functions - XML_ -# -################################################################################# - -function xml_comment_char { - html_comment_char -} - -function xml_comment_new { - html_comment_new -} - -function xml_comment_line { - html_comment_line -} - -function xml_create { - html_create -} - -################################################################################# -# -# Functions - HTML_ -# -################################################################################# - -function html_comment_char { - printf '%s' "" -} - -function html_comment_new { - printf '%s ' "" -} - -function html_comment_line { - html_comment_new -} - -function html_create { - include_template /home/bin/default.html || cat << EOF -cat << EOF - - - - - - '; - '; - - - -EOF -} - -################################################################################## -# -# Functions - PERL_ -# -################################################################################# - -function perl_comment_new { - all_comment_new perl -} - -function perl_comment_line { - all_comment_line perl -} - -function perl_create { - include_template /home/bin/default.pl || cat << EOF -cat << EOF -#!/usr/bin/perl -w -################################################################################# -# -# $ME_NOW -# -################################################################################# -use strict; -EOF -} - -function perl_comment_char { -printf '%s' "#" -} - -function perl_function_new { -cat << EOF -sub foo { -#------------------------------------------------------------------------------ -# $ME_NOW -#------------------------------------------------------------------------------ -} -EOF -} - -################################################################################# -# -# Functions - SQL_ -# -################################################################################# - -function sql_comment_new { - all_comment_new sql -} - -function sql_comment_line { - all_comment_line sql -} - -function sql_create { -cat << EOF -/* -$ME_NOW -*/ -EOF -} - -function sql_comment_char { -printf '%s' "--" -} - -function sql_function_new { -cat << EOF - -/* -$ME_NOW -**/ -DELIMITER // -DROP FUNCTION IF EXISTS url2idaffi; -CREATE FUNCTION url2idaffi(purl text) -RETURNS text DETERMINISTIC -BEGIN -RETURN (SELECT id FROM affi WHERE purl REGEXP download_regex LIMIT 1); -END// -DELIMITER ; -} -EOF -} - -################################################################################# -# -# Functions - INI_ -# -################################################################################# - -function ini_comment_new { - all_comment_new ini -} - -function ini_comment_line { - all_comment_line ini -} - -function ini_function_new { -cat << EOF -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;$ME_NOW -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -[foo] -EOF -} - -function ini_comment_char { -printf '%s' ";" -} - -function ini_create { -cat << EOF -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; $ME_NOW -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -EOF -} - -################################################################################# -# -# Functions - PHP_ -# -# See: http://manual.phpdoc.org/HTMLSmartyConverter/PHP/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#basics.docblock -# -################################################################################# - -function php_comment_new { - all_comment_new php -} - -function php_comment_line { - all_comment_line php -} - -function php_function_new { -cat << EOF -/** -* @copyright $ME $NOW -* Does what it says -* -* @param datatype1|datatype2 \$paramname description -* @return datatype1|datatype2 description -*/ -function foo() { -} -EOF -} - -function php_comment_char { -printf '%s' "//" -} - -function php_create { -cat << EOF -#!/usr/bin/env php - -EOF -} - -################################################################################# -# -# Functions - VIM_ -# -################################################################################# - -function vim_create { - cat << EOF -################################################################################# -# -# $ME_NOW -# $FILE -# -################################################################################# -EOF -} - -function vim_comment_new { - all_comment_new vim -} - -function vim_comment_line { - all_comment_line vim -} - -function vim_comment_char { - printf '%s' '"' -} - -function vim_function_new { -#`vim_comment_char` $ME_NOW -cat << EOF -function foo(...) -endfunction -EOF -} - -################################################################################# -# -# Functions - BASH_ -# -################################################################################# - -function bash_comment_new { - all_comment_new bash -} - -function bash_comment_line { - all_comment_line bash -} - -function bash_comment_char { - printf '%s' '#' -} - -function bash_create { # bash_c - include_template /home/bin/default.sh || cat << EOF -#!/usr/bin/env bash -################################################################################# -# -# $ME_NOW -# $FILE -# -################################################################################# -NAME=\`echo $0 | sed "s,^.*/,,"\` -EOF -} - -function bash_function_new { -cat << EOF -function foo { -#------------------------------------------------------------------------------ -# $ME_NOW -#------------------------------------------------------------------------------ -} -EOF - -} - -################################################################################# -# -# Main - -# -################################################################################# - -# $GLOB['zaza']; - -#exec echo "$@" - - -################################################################################# -# -# Args -# -################################################################################# -CMD=$1 -shift -ARGS=$@ -FILE="$0" - -[ -z "$CMD" ] && help - -all_file_short -#[ -e "$1" ] && TYPE=`file_type $1` -declare eval=' -case "$CMD" in - help|h|-h|-help) help ;; - all_*) ${CMD} ${ARGS} ;; - # Types file - auto_*) # Usage auto_* FILE [option1, option2, ...] - if false && [ -z "$1" ]; then - $CMD $ARGS - continue - fi - - TYPE=`file_type $1` - FILE="$1" && all_file_short - shift - - case "$TYPE" in - sh) TYPE=bash;; - txt) TYPE=bash;; - '$TYPES') ;; - *) - if test -x "$FILE" &>/dev/null; then - TYPE=bash - else - all_err "Unknow file type: $TYPE ($TYPES)" - fi - ;; - esac - CMD=`echo "$CMD"|sed s/^auto/$TYPE/` - ARGS=$@ - - case "$CMD" in - *_comment_line_toggle) all_comment_line_toggle $TYPE $ARGS ;; - *) $CMD $ARGS ;; - esac - ;; -' - -# Functions -for f in `all_list |awk '{print $1}'`; do - eval="$eval - $f) $f \$ARGS ;;" -done - -eval="$eval"' - -D|debug) echo "$eval" ;; - *) all_err "Unknow command: $CMD" ;; -esac -' -eval "$eval" -exit - -# TODEL - NB 09.08.12 -false && $CMD $ARGS|perl -e 'chomp($_=join("",<>)); s/^\s*(.*?)\s*$/$1/; print' -#exec echo "$eval" -case "$CMD" in - - -D|debug) exec echo "$eval"; all_list |awk '{print $1}';; - help|h|-h|-help) help ;; - - # Commun - - all_*) ${CMD} ${ARGS} ;; - - me_now) me_now $ARGS ;; - - file_type) file_type $ARGS ;; - - izi_2globales) ${CMD} ${ARGS} ;; - - include_template) exec echo ${CMD} ${ARGS} ;; - - # Types file - auto_*) # Usage auto_* FILE [option1, option2, ...] - if true || [ -e "$1" ]; then - TYPE=`file_type $1` - FILE="$1" && all_file_short - fi - shift - - eval " - case \"$TYPE\" in - sh) TYPE=bash;; - txt) TYPE=bash;; - $TYPES) ;; - *) - if test -x \"$FILE\" &>/dev/null; then - TYPE=bash - else - all_err \"Unknow file type: $TYPE ($TYPES)\" - fi - ;; - esac - " - CMD=`echo "$CMD"|sed s/^auto/$TYPE/` - ARGS=$@ - - $CMD $ARGS|perl -e 'chomp($_=join("",<>)); s/^\s*(.*?)\s*$/$1/; print' - ;; - - - *_c) _comment_new $ARGS ;; - *_comment_new) $CMD $ARGS ;; - *_comment_line) $CMD $ARGS ;; - *_comment_char) $CMD $ARGS ;; - *_create) $CMD $ARGS ;; - *_function_new) $CMD $ARGS ;; - - *) all_err "Unknow command: $CMD" ;; - -esac -- 2.47.3