commit dbb3445f0ba30eecf6b1dad0fc5462b6afb2a2f8 Author: Sasha MOREL Date: Fri Mar 16 12:02:58 2018 +0100 Validation initiale diff --git a/README.md b/README.md new file mode 100644 index 0000000..2912218 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Configuration de zsh + +Ceci est ma configuration de zsh + +# Comment installer ? + +Pour installer, il faut mettre le contenu du dépôt dans le dossier `~/.zsh` et lancer le script [install.sh](install.sh) + +Avant, il faut s'assurer que les programmes zsh et screen sont bien présents sur le système. \ No newline at end of file diff --git a/functions/_auto-apt b/functions/_auto-apt new file mode 100644 index 0000000..baed35c --- /dev/null +++ b/functions/_auto-apt @@ -0,0 +1,65 @@ +#compdef auto-apt + +# Bruno Bonfils, + +local expl prev ret + +prev="$words[CURRENT-1]" + +# if there is a command in arguments ? +if [[ -n $words[(r)(run|update|update-local|merge|del|check|list|search|debuilt|status)] ]] ; then + + # yes, add completion for command arguments and command options + if [[ -n $words[(r)(update|update-local|merge)] && "$words[CURRENT]" = -* ]] ; then + _wanted option expl 'option' compadd - "-a" && return 0; + fi + + if [[ -n $words[(r)(check|list|search)] && "$words[CURRENT]" = -* ]] ; then + _wanted option expl 'option' compadd - "-v" "-f" && return 0; + fi + + case $prev in + "run") + _wanted command expl 'command' _files -g '*(/,*)' && return 0 ;; + "del") + _wanted package expl 'package' _deb_packages avail && return 0 ;; + "search") + _arguments ':pattern:' && return 0 ;; + esac + +else + + # no, add completion for commands or options (and options arguments) + compset -P "*," + + case $prev in + "-a") + local distribs + distribs=("main" "contrib" "non-free" "non-US" "none") + + _wanted distribution expl 'distribution' compadd -q -S, $distribs ;; + "-p") + local hooks + hooks=("exec" "open" "access" "stat" "none") + _wanted hook expl 'hook' compadd -q -S, $hooks ;; + "-D") + _wanted file expl 'dbfile' _files ;; + "-F") + _wanted file expl 'filedb' _files ;; + *) + + local commands options + + commands=("run" "update" "update-local" "merge" "del" "check" "list" "search" "debuild" "status") + options=("-h" "-s" "-y" "-q" "-i" "-X" "-x" "-a" "-p" "-D" "-F" "-L") + + if [[ "$words[CURRENT]" = -* ]] ; then + _wanted option expl 'option' compadd - $options + else + _wanted command expl 'command' compadd $commands + fi + ;; + esac + + return 0 +fi \ No newline at end of file diff --git a/functions/_java b/functions/_java new file mode 100644 index 0000000..1204bc8 --- /dev/null +++ b/functions/_java @@ -0,0 +1,586 @@ +#compdef javac java javadoc appletviewer jar jdb javah javap extcheck rmic rmiregistry rmid serialver native2ascii keytool jarsigner policytool + +local expl tmp jdb_args jar_cmd match basedir ret=1 +local curcontext="$curcontext" state line jf +typeset -A opt_args tmpassoc + +jdb_args=() + +case "$service" in +javac) + _arguments -C \ + '-g-[generate debugging information]:debug:->debug' \ + '-nowarn[generate no warnings]' \ + '-verbose[output messages about what the compiler is doing]' \ + '-deprecation[output source locations where deprecated APIs are used]' \ + '-classpath[specify where to find user class files]:class path:->classpath' \ + '-sourcepath[specify where to find input source files]:source path:->sourcepath' \ + '-bootclasspath[override location of bootstrap class files]:bootstrap class path:->bootstrapclasspath' \ + '-extdirs[override location of installed extensions]:extensions directories:->extdirs' \ + '-d[specify where to place generated class files]:directory:_files -/' \ + '-encoding[specify character encoding used by source files]:encoding:->encoding' \ + '-source[provide source compatibility with specified release]:release:(1.{2..5})' \ + '-target[specify VM version]:release:(1.{1..5})' \ + '-help[print a synopsis of standard options]' \ + '*:java source file:_files -g \*.java\(-.\)' && return 0 + ;; + +jdb) + jdb_args=( + '-host[specify host to connect to]:host:_hosts' + '-password[specify password]:password:' + ) + ;& + +java) + _arguments -C \ + "$jdb_args[@]" \ + '(-cp -classpath)'{-cp,-classpath}'[specify path for user class files]:class path:->classpath' \ + '-D-[specify a property]:property:->property' \ + '(-verbose:class)-verbose[print class information]' \ + '(-verbose)-verbose\:class[print class information]' \ + '-verbose\:gc[print gc information]' \ + '-verbose\:jni[print JNI information]' \ + '-version[print version]' \ + '-help[print help message]' \ + '(- 1)-jar[specify a program capsulated as jar]:jar:_files -g \*.jar\(-.\)' \ + '(-):class:_java_class -m main ${(kv)opt_args[(i)(-classpath|-cp)]}' \ + '*::args: _normal' \ + && return 0 + ;; + +javadoc) + _arguments -C \ + '-overview[specify overview file]:_files' \ + '-public[display public classes and members only]' \ + '-protected[display public/protected classes and members only (default)]' \ + '-package[display packages, public/protected classes and members only]' \ + '-private[display all classes and members]' \ + '-help[print help message]' \ + '-doclet[specify a doclet]:doclet:_java_class -t doclet ${(kv)opt_args[(i)-classpath]}' \ + '-docletpath[specify a path to search doclet]:doclet path:->docletpath' \ + '-1.1[Javadoc 1.1 compatible output]' \ + '-sourcepath[specify path for source files]:source path:->sourcepath' \ + '-classpath[specify path for user class files]:class path:->classpath' \ + '-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \ + '-extdirs[specify directories for extensions]:extensions directories:->extdirs' \ + '-verbose[print verbose messages]' \ + '-locale[specify locale]:language_country_variant:' \ + '-encoding[specify character encoding for source files]:encoding:->encoding' \ + '-J-[specify java option]:java option:' \ + '-d[specify destination directory]:destination directory:_files -/' \ + '-use[display pages for use]' \ + '-version[include @version text]' \ + '-author[include @author text]' \ + '-splitindex[split index file for each alphabet]' \ + '-windowtitle[specify HTML title element]:title element:' \ + '-doctitle[specify title]:document title:' \ + '-header[specify header text]:header text:' \ + '-footer[specify footer text]:footer text:' \ + '-bottom[specify bottom text]:bottom text:' \ + '-link[generate a link to external reference classes]:document URL:' \ + '-linkoffline[generate a link for external reference class names]:document URL::package list URL:' \ + '-group[generate tables for each groupes]:group heading::package patterns:' \ + '-nodeprecated[do not document deprecated API]' \ + '-nodeprecatedlist[do not generate deprecated API list]' \ + '-notree[do not generate class and interface hierarchy]' \ + '-noindex[do not generate index]' \ + '-nohelp[do not generate help link]' \ + '-nonavbar[do not generate navigation bar]' \ + '-helpfile[specify alternative help link]:helpfile path/filename:' \ + '-stylesheet[specify alternative HTML style sheet]:stylesheet path/filename:' \ + '-docencoding[specify character encoding for output HTML files]:encoding:->encoding' \ + '*:package name, source file or @list:->docsrc' && ret=0 + ;; + +appletviewer) + _arguments -C \ + '-debug[run applet on jdb]' \ + '-encoding[specify character encoding for source files]:encoding:->encoding' \ + '-J-[specify java option]:java option:' \ + '*:URL:_urls' && return 0 + ;; + +jar) + if (( CURRENT == 2 )); then + compset -P - + _values -s '' 'jar command' \ + '( t x u)c[create new archive]' \ + '(c x u)t[list the table of archive]' \ + '(c t u)x[extract files from archive]' \ + '(c t x )u[update archive]' \ + 'f[specify archive file]' \ + 'v[verbose mode]' \ + 'm[specify manifest file]' \ + '0[store only without using ZIP compression]' \ + 'M[do not create manifest file]' && return + else + jar_cmd="${words[2]#-}" + tmpassoc=( + m ':manifest file:_files' + f ':archive file:_files -g "*.([ejw]ar|zip)(-.)"' + ) + _arguments -C \ + "${jar_cmd/[^-]*/:dummy:}" \ + ${${(s::)jar_cmd}/(#b)(?)/$tmpassoc[$match[1]]} \ + '*:file:->jararg' && return 0 + fi + ;; + +javah|javah_g) + _arguments -C \ + '-o[specify output file]:output file:_files' \ + '-d[specify destination directory]:directory:_files -/' \ + '-stubs[generate stubs]' \ + '-verbose[print verbose messages]' \ + '-help[print help message]' \ + '-version[print version]' \ + '-jni[JNI-style native method function prototypes]' \ + '-classpath[specify path for user class files]:class path:->classpath' \ + '-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \ + '-old[generate old JDK1.0-style header files]' \ + '-force[force output]' \ + '*:class:_java_class -m main ${(kv)opt_args[(i)-classpath]}' && return 0 + ;; + +javap) + _arguments -C \ + '-help[print help message]' \ + '-l[line and local variable tables]' \ + '-b[backward compatible to JDK1.1]' \ + '-public[only public classes and members]' \ + '-protected[only protected and public classes and members]' \ + '-package[only package, protected and public classes and members (default)]' \ + '-private[all classes and members]' \ + '-J-[specify java option]:java option:' \ + '-s[internal type signatures]' \ + '-c[disassemble code]' \ + '-verbose[stack size, number of locals and args for methods]' \ + '-classpath[specify path for user class files]:class path:->classpath' \ + '-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \ + '-extdirs[specify directories for extensions]:extensions directories:->extdirs' \ + '*:class:_java_class ${(kv)opt_args[(i)-classpath]}' && return 0 + ;; + +extcheck) + _arguments \ + '-verbose[print verbose messages]' \ + ':target jar file:_files -g \*.jar\(-.\)' && return 0 + ;; + +rmic) + _arguments -C \ + '-classpath[specify path for user class files]:class path:->classpath' \ + '-d[specify destination directory]:directory:_files -/' \ + '-depend[treat dependencies]' \ + '-g[enable debugging]' \ + '-J-[specify java option]:java option:' \ + '-keepgenerated[retain generated source files]' \ + '-nowarn[disable warnings]' \ + '-show[GUI mode]' \ + '-vcompat[compatible with JDK 1.1 and 1.2 (default)]' \ + '-verbose[print verbose messages]' \ + '-v1.1[JDK 1.1 stub protocol]' \ + '-v1.2[JDK 1.2 stub protocol]' \ + '*:package qualified class name:_java_class ${(kv)opt_args[(i)-classpath]}' && return 0 + ;; + +rmiregistry) + if (( CURRENT == 2 )); then + _wanted ports expl 'port to listen on' _ports && return + else + _message 'no more arguments' + fi + ;; + +rmid) + _arguments \ + '-C-[specify command line argument for child process]:command line argument for child process:' \ + '-log[specify log directory]:directory to place logs:_files -/' \ + '-port[specify port]:port:_ports' \ + '-stop[stop rmid]:' && return 0 + ;; + +serialver) + _arguments \ + '-classpath[specify where to find user class files]:class path:->classpath' \ + '(*)-show[display user interface]' \ + '(-show)*:class:_java_class ${(kv)opt_args[(i)-classpath]}' && return 0 + ;; + +native2ascii) + _arguments -C \ + '-reverse[convert Latin-1 (with \udddd) to native encoding]' \ + '-encoding[specify character encoding]:encoding:->encoding' \ + ':input file:_files' \ + ':output file:_files' && return 0 + ;; + +keytool) + _arguments \ + '-J-[specify java option]:java option:' \ + - genkey \ + '-genkey[command to generate a key pair]' \ + '-alias[alias]:alias:' \ + '-keyalg[key algorithm]:key algorithm:' \ + '-keysize[key size]:key size:' \ + '-sigalg[signature algorithm]:signature algorithm:' \ + '-dname[X.500 distinguish name]:X.500 distinguish name:' \ + '-keypass[password for private key]:password for private key:' \ + '-validity[valid days]:number of days:' \ + '-storetype[keystore type]:store type:' \ + '-keystore[keystore location]:keystore location:_files' \ + '-storepass[password for keystore]:password:' \ + '-v[verbose mode]' \ + - import \ + '-import[command to import certificate or certificate chain]' \ + '-alias[alias]:alias:' \ + '-file[specify certificate file]:certificate file:_files' \ + '-keypass[password for private key]:password for private key:' \ + '-noprompt[disable interaction with the user]' \ + '-trustcacerts[use cacerts]' \ + '-storetype[keystore type]:store type:' \ + '-keystore[keystore location]:keystore location:_files' \ + '-storepass[password for keystore]:password:' \ + '-v[verbose mode]' \ + - selfcert \ + '-selfcert[command to generate X.509 v1 self-signed certificate]' \ + '-alias[alias]:alias:' \ + '-sigalg[signature algorithm]:signature algorithm:' \ + '-dname[X.500 distinguish name]:X.500 distinguish name:' \ + '-validity[valid days]:number of days:' \ + '-keypass[password for private key]:password for private key:' \ + '-storetype[keystore type]:store type:' \ + '-keystore[keystore location]:keystore location:_files' \ + '-storepass[password for keystore]:password:' \ + '-v[verbose mode]' \ + - identitydb \ + '-identitydb[command to read identity database]' \ + '-file[specify identity database file]:identity database file:_files' \ + '-storetype[keystore type]:store type:' \ + '-keystore[keystore location]:keystore location:_files' \ + '-storepass[password for keystore]:password:' \ + '-v[verbose mode]' \ + - certreq \ + '-certreq[command to generate certificate signing request]' \ + '-alias[alias]:alias:' \ + '-sigalg[signature algorithm]:signature algorithm:' \ + '-file[specify certificate signing request file]:certificate signing request file:_files' \ + '-keypass[password for private key]:password for private key:' \ + '-storetype[keystore type]:store type:' \ + '-keystore[keystore location]:keystore location:_files' \ + '-storepass[password for keystore]:password:' \ + '-v[verbose mode]' \ + - export \ + '-export[command to store certificate]' \ + '-alias[alias]:alias:' \ + '-file[specify certificate file]:certificate file:_files' \ + '-rfc[make certificate format printable as RFC 1421]' \ + '-storetype[keystore type]:store type:' \ + '-keystore[keystore location]:keystore location:_files' \ + '-storepass[password for keystore]:password:' \ + '-v[verbose mode]' \ + - list \ + '-list[command to print keystore entry]' \ + '-alias[alias]:alias:' \ + '-storetype[keystore type]:store type:' \ + '-keystore[keystore location]:keystore location:_files' \ + '-storepass[password for keystore]:password:' \ + '(-rfc)-v[make certificate format human-readable]' \ + '(-v)-rfc[make certificate format printable as RFC 1421]' \ + - printcert \ + '-printcert[command to print certificate in a human-readable format]' \ + '-file[specify certificate file]:certificate file:_files' \ + '-v[verbose mode]' \ + - keyclone \ + '-keyclone[command to create new keystore entry]' \ + '-alias[alias]:alias:' \ + '-dest[destination alias]:destination alias:' \ + '-keypass[password for private key]:password for private key:' \ + '-new[password for private key of new entry]:password for private key of new entry:' \ + '-storetype[keystore type]:store type:' \ + '-keystore[keystore location]:keystore location:_files' \ + '-storepass[password for keystore]:password:' \ + '-v[verbose mode]' \ + - storepasswd \ + '-storepasswd[command to change password for keystore]' \ + '-new[new password]:new password:' \ + '-storetype[keystore type]:store type:' \ + '-keystore[keystore location]:keystore location:_files' \ + '-storepass[password for keystore]:password:' \ + '-v[verbose mode]' \ + - keypasswd \ + '-keypasswd[command to change password for private key]' \ + '-alias[alias]:alias:' \ + '-keypass[old password for private key]:old password for private key:' \ + '-new[nwe password for private key]:new password for private key:' \ + '-storetype[keystore type]:store type:' \ + '-keystore[keystore location]:keystore location:_files' \ + '-storepass[password for keystore]:password:' \ + '-v[verbose mode]' \ + - delete \ + '-delete[command to delete entry]' \ + '-alias[alias]:alias:' \ + '-storetype[keystore type]:store type:' \ + '-keystore[keystore location]:keystore location:_files' \ + '-storepass[password for keystore]:password:' \ + '-v[verbose mode]' \ + - help \ + '(-J)-help[command to print help message]' && return 0 + ;; + +jarsigner) + _arguments \ + '-keystore[specify URL for keystore location]:URL for keystore location:_files' \ + '-storetype[specify keystore type]:store type:' \ + '-storepass[specify password for keystore]:password:' \ + '-keypass[specify password for private key]:password:' \ + '-sigfile[specify base file name of .SF and .DSA files to be generated]:sigfile:_files' \ + '-signedjar[specify signed JAR file]:_files -g "*.(jar|zip)(-.)"' \ + '(2)-verify[verify mode]' \ + '-certs[output certificate information in verify mode]' \ + '-verbose[print verbose messages]' \ + '-internalsf[old behaviour]' \ + '-sectionsonly[omit header of hash of the whole manifest file]' \ + '-J-[specify java option]:java option:' \ + ':jar file:_files -g "*.(jar|zip)(-.)"' \ + ':alias:' && return 0 + ;; + +policytool) + _arguments \ + '-file:policy file:_files' && return 0 + ;; + +*) + _message 'unknown command' + ;; +esac + +[[ -n "$state" ]] && +case "$state" in +debug) + if [[ -prefix :*, ]]; then + compset -P : + _values -s , "debug info" lines vars source && return + else + _description debuginfo expl "debug info" + compadd -P: "$expl[@]" none && ret=0 + compadd -P: -qS, "$expl[@]" lines vars source && ret=0 + fi + ;; + +classpath|sourcepath|bootstrapclasspath|docletpath) + compset -P '*:' + compset -S ':*' + _alternative \ + "classpath:$state:_path_files -qS: -g '*.(jar|zip)(-.)'" \ + "classpath:$state:_path_files -r': ' -/" && return + ;; + +extdirs) + compset -P '*:' + _path_files -/ && return + ;; + +encoding) + tmp=( + 'US-ASCII:American Standard Code for Information Interchange' + 'Cp1252:Windows Latin-1' + 'ISO-8859-1:ISO 8859-1, Latin alphabet No. 1 ' + 'ISO-8859-15:Latin alphabet No. 9 ' + 'UTF-8:Eight-bit UCS Transformation Format' + 'UTF-16:Sixteen-bit UCS Transformation Format, byte order identified by an' + 'UTF-16BE:Sixteen-bit UCS Transformation Format, big-endian byte order ' + 'UTF-16LE:Sixteen-bit UCS Transformation Format, little-endian byte order ' + 'ASCII:American Standard Code for Information Interchange' + 'ISO8859_1:ISO 8859-1, Latin alphabet No. 1' + 'UnicodeBig:Sixteen-bit Unicode Transformation Format, big-endian' + 'UnicodeBigUnmarked:Sixteen-bit Unicode Transformation Format, big-endian' + 'UnicodeLittle:Sixteen-bit Unicode Transformation Format, little-endian' + 'UnicodeLittleUnmarked:Sixteen-bit Unicode Transformation Format, little-endian' + 'UTF8:Eight-bit Unicode Transformation Format' + 'UTF-16:Sixteen-bit Unicode Transformation Format, byte order' + 'Big5:Big5, Traditional Chinese' + 'Big5_HKSCS:Big5 with Hong Kong extensions, Traditional Chinese' + 'Big5_Solaris:Big5 with seven additional Hanzi ideograph character mappings ' + 'Cp037:USA, Canada (Bilingual, French), Netherlands, Portugal, Brazil, Australia' + 'Cp273:IBM Austria, Germany' + 'Cp277:IBM Denmark, Norway' + 'Cp278:IBM Finland, Sweden' + 'Cp280:IBM Italy' + 'Cp284:IBM Catalan/Spain, Spanish Latin America' + 'Cp285:IBM United Kingdom, Ireland' + 'Cp297:IBM France' + 'Cp420:IBM Arabic' + 'Cp424:IBM Hebrew' + 'Cp437:MS-DOS United States, Australia, New Zealand, South Africa' + 'Cp500:EBCDIC 500V1' + 'Cp737:PC Greek' + 'Cp775:PC Baltic' + 'Cp838:IBM Thailand extended SBCS' + 'Cp850:MS-DOS Latin-1' + 'Cp852:MS-DOS Latin-2' + 'Cp855:IBM Cyrillic' + 'Cp856:IBM Hebrew' + 'Cp857:IBM Turkish' + 'Cp858:Variant of Cp850 with Euro character' + 'Cp860:MS-DOS Portuguese' + 'Cp861:MS-DOS Icelandic' + 'Cp862:PC Hebrew' + 'Cp863:MS-DOS Canadian French' + 'Cp864:PC Arabic' + 'Cp865:MS-DOS Nordic' + 'Cp866:MS-DOS Russian' + 'Cp868:MS-DOS Pakistan' + 'Cp869:IBM Modern Greek' + 'Cp870:IBM Multilingual Latin-2' + 'Cp871:IBM Iceland' + 'Cp874:IBM Thai' + 'Cp875:IBM Greek' + 'Cp918:IBM Pakistan (Urdu)' + 'Cp921:IBM Latvia, Lithuania (AIX, DOS)' + 'Cp922:IBM Estonia (AIX, DOS)' + 'Cp930:Japanese Katakana-Kanji mixed with 4370 UDC, superset of 5026' + 'Cp933:Korean Mixed with 1880 UDC, superset of 5029' + 'Cp935:Simplified Chinese Host mixed with 1880 UDC, superset of 5031' + 'Cp937:Traditional Chinese Host miexed with 6204 UDC, superset 5033' + 'Cp939:Japanese Latin Kanji mixed with 4370 UDC, superset of 5035' + 'Cp942:IBM OS/2 Japanese, superset of Cp932' + 'Cp942C:Variant of Cp942' + 'Cp943:IBM OS/2 Japanese, superset of Cp932 and Shift-JIS' + 'Cp943C:Variant of Cp943' + 'Cp948:OS/2 Chinese (Taiwan) superset of 938' + 'Cp949:PC Korean' + 'Cp949C:Variant of Cp949' + 'Cp950:PC Chinese (Hong Kong, Taiwan)' + 'Cp964:AIX Chinese (Taiwan)' + 'Cp970:AIX Korean' + 'Cp1006:IBM AIX Pakistan (Urdu)' + 'Cp1025:IBM Multilingual Cyrillic (Bulgaria, Bosnia)' + 'Cp1025:IBM Multilingual Cyrillic - Bulgaria, Bosnia, Herzegovinia, Macedonia (FYR)' + 'Cp1026:IBM Latin-5, Turkey' + 'Cp1046:IBM Arabic - Windows' + 'Cp1097:IBM Iran (Farsi)/Persian' + 'Cp1098:IBM Iran (Farsi)/Persian (PC)' + 'Cp1112:IBM Latvia, Lithuania' + 'Cp1122:IBM Estonia' + 'Cp1123:IBM Ukraine' + 'Cp1124:IBM AIX Ukraine' + 'Cp1140:Variant of Cp037 with Euro character' + 'Cp1141:Variant of Cp273 with Euro character' + 'Cp1142:Variant of Cp277 with Euro character' + 'Cp1143:Variant of Cp278 with Euro character' + 'Cp1144:Variant of Cp280 with Euro character' + 'Cp1145:Variant of Cp284 with Euro character' + 'Cp1146:Variant of Cp285 with Euro character' + 'Cp1147:Variant of Cp297 with Euro character' + 'Cp1148:Variant of Cp500 with Euro character' + 'Cp1149:Variant of Cp871 with Euro character' + 'Cp1250:Windows Eastern European' + 'Cp1251:Windows Cyrillic' + 'Cp1253:Windows Greek' + 'Cp1254:Windows Turkish' + 'Cp1255:Windows Hebrew' + 'Cp1256:Windows Arabic' + 'Cp1257:Windows Baltic' + 'Cp1258:Windows Vietnamese' + "Cp1381:IBM OS/2, DOS People's Republic of China (PRC)" + "Cp1383:IBM AIX People's Republic of China (PRC)" + 'Cp33722:IBM-eucJP - Japanese (superset of 5050)' + 'EUC_CN:GB2312, EUC encoding, Simplified Chinese' + 'EUC_JP:JIS X 0201, 0208, 0212, EUC encoding, Japanese' + 'EUC_KR:KS C 5601, EUC encoding, Korean' + 'EUC_TW:CNS11643 (Plane 1-3), EUC encoding, Traditional Chinese' + 'GB18030:Simplified Chinese, PRC standard' + 'GBK:GBK, Simplified Chinese' + 'ISCII91:ISCII91 encoding of Indic scripts' + 'ISO2022CN:ISO 2022 CN, Chinese (conversion to Unicode only)' + 'ISO2022CN_CNS:CNS 11643 in ISO 2022 CN form, Traditional Chinese' + 'ISO2022CN_GB:GB 2312 in ISO 2022 CN form, Simplified Chinese' + 'ISO2022JP:JIS X 0201, 0208 in ISO 2022 form, Japanese' + 'ISO2022KR:ISO 2022 KR, Korean' + 'ISO8859_2:ISO 8859-2, Latin alphabet No. 2' + 'ISO8859_3:ISO 8859-3, Latin alphabet No. 3' + 'ISO8859_4:ISO 8859-4, Latin alphabet No. 4' + 'ISO8859_5:ISO 8859-5, Latin/Cyrillic alphabet' + 'ISO8859_6:ISO 8859-6, Latin/Arabic alphabet' + 'ISO8859_7:ISO 8859-7, Latin/Greek alphabet' + 'ISO8859_8:ISO 8859-8, Latin/Hebrew alphabet' + 'ISO8859_9:ISO 8859-9, Latin alphabet No. 5' + 'ISO8859_13:ISO 8859-13, Latin alphabet No. 7' + 'ISO8859_15:ISO 8859-15, Latin alphabet No. 9' + 'JIS0201:JIS X 0201, Japanese' + 'JIS0208:JIS X 0208, Japanese' + 'JIS0212:JIS X 0212, Japanese' + 'JISAutoDetect:Detects and converts from Shift-JIS, EUC-JP, ISO 2022 JP' + 'Johab:Johab, Korean' + 'KOI8_R:KOI8-R, Russian' + 'MS874:Windows Thai' + 'MS932:Windows Japanese' + 'MS936:Windows Simplified Chinese' + 'MS949:Windows Korean' + 'MS950:Windows Traditional Chinese' + 'MacArabic:Macintosh Arabic' + 'MacCentralEurope:Macintosh Latin-2' + 'MacCroatian:Macintosh Croatian' + 'MacCyrillic:Macintosh Cyrillic' + 'MacDingbat:Macintosh Dingbat' + 'MacGreek:Macintosh Greek' + 'MacHebrew:Macintosh Hebrew' + 'MacIceland:Macintosh Iceland' + 'MacRoman:Macintosh Roman' + 'MacRomania:Macintosh Romania' + 'MacSymbol:Macintosh Symbol' + 'MacThai:Macintosh Thai' + 'MacTurkish:Macintosh Turkish' + 'MacUkraine:Macintosh Ukraine' + 'SJIS:Shift-JIS, Japanese' + 'TIS620:TIS620, Thai' + ) + _describe 'character encoding' tmp -- + ;; + +property) + if compset -P '*='; then + _default && return + else + _message -e property-names 'property name' + fi + ;; + +docsrc) + if compset -P @; then + _wanted files expl 'package/source list file' _files && return + else + _wanted files expl 'package or source' _files -g '*.java(-.)' && return + fi + ;; + +jararg) + if [[ -prefix - ]]; then + tmp=('-C:chdir') + _describe -o 'option' tmp -- && return + elif [[ "$words[CURRENT - 2]" == -C ]]; then + _wanted file expl 'input file' _files -W "($words[CURRENT - 1])" && return + elif [[ "$words[CURRENT - 1]" == -C ]]; then + _wanted directories expl 'chdir to' _files -/ && return + elif [[ $words[2] = *x* ]]; then + jf="$words[3]" + if [[ $jf != $_jar_cache_name && -f $jf ]]; then + _jar_cache_list=("${(@f)$($words[1] tf $jf)}") + _jar_cache_name=$jf + fi + + _wanted files expl 'file from archive' _multi_parts / _jar_cache_list && return + else + _wanted files expl 'input file' _files && return + fi + ;; + +*) + _message "unknown state: $state" + ;; +esac + +return ret \ No newline at end of file diff --git a/functions/_mutt b/functions/_mutt new file mode 100644 index 0000000..f46d027 --- /dev/null +++ b/functions/_mutt @@ -0,0 +1,57 @@ +#compdef muttng mutt + +local curcontext="$curcontext" state line expl suf +typeset -A opt_args + +_arguments -C -s \ + '::recipient:->userhostalias' \ + '*-a[attach file using MIME]:file attachment:_files' \ + '*-b[specify a BCC recipient]:BCC recipient:->userhost' \ + '*-c[specify a CC recipient]:CC recipient:->userhost' \ + '-e+[specify a post-init configuration command]:post-init configuration:' \ + '-f+[specify mailbox to load]:mailbox: _mailboxes' \ + '-F+[specify an init file]:init file:_files' \ + '-h[display help]' \ + '-H+[specify a draft file for message]:draft file:_files' \ + '-i+[specify file to include in message]:include file:_files' \ + '-m+[specify default mailbox type]:mailbox type:(mbox MMDF MH Maildir)' \ + '-n[bypass system configuration]' \ + '-p[resume postponed message]' \ + '-R[open in read-only mode]' \ + '-s+[specify a subject]:subject:' \ + '-v[display mutt version]' \ + '-x[emulate mailx compose]' \ + '-y[start listing mailboxes]' \ + '-z[start only if new messages]' \ + '-Z[open first mailbox with new mail]' && return 0 + +if [[ "$state" = userhostalias ]]; then + if compset -P '*@'; then + _description hosts expl 'remote host name' + _hosts "$expl[@]" -q -S, && return 0 + else + compset -S '@*' || suf='@' + + _description users expl 'login name' + _users "$expl[@]" -q -S "$suf" + + # added by asyd (20020304) + if [ -r ~/.muttrc ]; then + + # use cache + if ( [[ ${+_list_alias} -eq 0 ]] || _cache_invalid mutt_alias ) && + ! _retrieve_cache mutt_alias; then + + _list_alias=(${(o)${${(M)${(f)"$(< ~/.muttrc)"}##alias*}/alias /}%% *}) + + _store_cache mutt_alias _list_alias + fi + + _wanted alias expl 'alias name' compadd -q -S, $_list_alias + fi + return 0 + + fi +fi + +return 1 \ No newline at end of file diff --git a/functions/_openssl b/functions/_openssl new file mode 100644 index 0000000..605d753 --- /dev/null +++ b/functions/_openssl @@ -0,0 +1,242 @@ +#compdef openssl + +# OpenSSL zsh completion +# Bruno Bonfils +# 2005-11-13 + +local prev="$words[CURRENT-1]" # previous word +local cmd="$words[2]" # Current openssl sub command (i.e. x509, req, etc..) + +local -a openssl_commands +local -a options +local -A explanations + +# Associative arrays to add description based on the option +explanations=( + '-in' 'Input file' + '-out' 'Output file' + '-CA' 'CA file' + '-rand' 'Seed data file' + '-key' 'Key file' + '-CAfile' 'CA file' + '-cacert' 'CA certificate file' + '-CApath' 'CA directory' +) + +# List of openssl's sub commands +openssl_commands=("asn1parse" "s_client" "x509" "req" "ca" + "dsa" "crl" "ocsp" "pkcs12" "verify" + "crl" "pkcs7" "genrsa" "gendsa") + +local -a textoptions # suboptions of X509's certopt command +textoptions=("compatible" "no_header" "no_version" "no_serial" + "no_signame" "no_validity" "no_subject" "no_issuer" + "no_pubkey" "no_sigdump" "no_aux" "no_extensions" + "ext_default" "ext_error" "ext_parse" "ext_dump" "ca_default") + +# Is first word an OpenSSL subcommand ? +if [[ -n ${(M)openssl_commands:#$cmd} ]] ; then + + # These options are used by lot of sub openssl_commands + # The continue prevent complete others options + case "$prev" in + "-CA"|"-rand"|"-cacert"|"-cert"|"-in"|"-out"|"-key"|"-CAfile") + _wanted filename expl $explanations[$prev] _files + continue + ;; + "-passin"|"-passout") + _wanted passphrase expl "pass phrase format" + continue + ;; + "-inform"|"-outform"|"-certform") + _wanted format expl "Format" compadd "pem" "der" + continue + ;; + "-CApath") + _wanted directory expl $explanations[$prev] _directories + continue + ;; + esac + + # Complete for specific options + case "$cmd" in + # s_client + "s_client") + case "$prev" in + "-connect") + _wanted host expl "host:port" _hosts + ;; + "-starttls") + _wanted protocol expl "protocol" compadd "pop3" "smtp" + ;; + *) + options=("-connect" "-cert" "-certform" "-key" "-keyform" "-pass" + "-verify" "-CApath" "-CAfile" "-reconnect" "-pause" "-showcerts" + "-prexit" "-state" "-debug" "-msg" "-nbio_test" "-crlf" + "-ign_eof" "-quiet" "-bugs" "-cipher" "-starttls" "-engine" "-rand") + + _wanted options expl "s_client options" compadd - $options + ;; + esac + ;; + # X509 subcommand + "x509") + case "$prev" in + "-certopt") + _wanted certopt expl "Certificate options" compadd -q -S, $textoptions + ;; + # Complete for x509 options + *) + options=("-inform" "-outform" "-in" "-out" "-engine" "-text" "-certopt" "-noout" "-modulus" "-serial" "-subject_hash" "-fingerprint") + # Only complete for digest only if none found + if [[ ! -n $words[(r)(-md2|-md5|-sha1|-mdc2)] ]] ; then + options=($options "-md2" "-md5" "-sha1" "-mdc2") + fi + _wanted options expl "x509 options" compadd - $options + ;; + esac + ;; + # verify subcommand + "verify") + options=("-CAfile" "-CApath" "-purpose" "-untrusted" "-issuer_checks" "-verbose") + _wanted options expl "verify options" compadd - $options + _wanted certificates expl "X509 certificates" _files + ;; + # req subcommand + "req") + options=("-inform" "-outform" "-in" "-passin" "-out" "-passout" + "-text" "-pubkey" "-noout" "-verify" "-new" "-rand" "-newkey" + "-key" "-keyform" "-keyout" "-nodes" "-config" "-multivalue-rdn" + "-x509" "-days" "-set_serial" "-extensions" "-reqexts" + "-utf8" "-nameopt" "-asn1-kludge" "-newhdr" "-batch" "-verbose" "-engine") + + # Complete for digest only if none found + if [[ ! -n $words[(r)(-md2|-md5|-sha1|-mdc2)] ]] ; then + options=($options "-md2" "-md5" "-sha1" "-mdc2") + fi + _wanted options expl "req options" compadd - $options + ;; + # OCSP + "ocsp") + case "$prev" in + "-issuer"|"-index"|"-reqout"|"-respout"|"-VAfile") + _wanted filename expl "${prev//-/} file" _files + ;; + "-port") + # TODO FIXME, support hosts:port + _wanted port expl "port" _ports + ;; + "-url") + _wanted url expl "URL" _urls + ;; + *) + options=("-out" "-issuer" "-cert" "-serial" "-signer" "-signkey" "-sign_other" "-req_text" + "-url" "-CAfile" "-port" "-index" "-CApath" "-VAfile" "-nonce" "-no_nonce" + "-req_text" "-resp_text" "-text" "-reqout" "-respout" "-host") + + _wanted options expl 'ocsp options' compadd - $options + ;; + esac + ;; + # pkcs12 + "pkcs12") + options=('-in' '-out' '-pass' '-passout' '-noout' '-clcerts' '-cacerts' '-nocerts' + '-nokeys' '-info' '-des' '-des3' '-idea' '-nodes' '-nomacver' '-twopass' '-export' + '-out' '-inkey' '-name' '-certfile' '-caname' '-passin' '-chain' '-descert') + + _wanted options expl 'pkcs12 options' compadd - $options + ;; + # crl + "crl") + options=('-inform' '-outform' '-text' '-in' '-out' '-noout' '-hash' '-issuer' + '-lastupdate' '-nextupdate' '-CAfile' '-CApath') + + _wanted options expl 'CRL options' compadd - $options + ;; + "pkcs7") + options=('-inform' '-outform' '-in' '-text' '-out' '-print_certs' '-noout' '-engine') + + _wanted options expl 'PKCS#7 options' compadd - $options + ;; + "asn1parse") + case "$prev" in + "-offset"|"-strparse") + _wanted format expl "Offset" compadd - "number" + ;; + "-length") + ;; + *) + options=('-inform' '-in' '-out' '-noout' '-offset' '-length' '-i' '-oid' '-strpase') + _wanted options expl 'ASN1Parse options' compadd - $options + ;; + esac + ;; + "ca") + case "$prev" in + "-config"|"-ss_cert"|"-spkack"|"-extfile") + _wanted filename expl "${prev/-/} file" _files + ;; + "-outdir") + _wanted directory expl 'Directory output' _directories + ;; + "-startdate"|"-enddate"|"-crl_compromise"|"-crl_CA_compromise") + _message 'Date (YYMMDDHHMMSSZ)' + ;; + "-days"|"-crldays") + _message 'Number of days' + ;; + "-crlhours") + _message 'Number of hours' + ;; + "-crl_reason") + reasons=("unspecified" + "keyCompromise" + "CACompromise" + "affiliationChanged" + "superseded" + "cessationOfOperation" + "certificateHold" + "removeFromCRL") + _wanted reason expl 'Revocation reason' compadd - $reasons + ;; + "-md") + mds=("md5" "sha1" "mdc2") + _wanted msgdst expl 'Message digest' compadd - $mds + ;; + "-name"|"-policy"|"-extensions"|"-crlexts") + _message 'Section' + ;; + *) + options=('-config' '-name' '-in' '-ss_cert' '-spkack' '-infiles' '-out' + '-outdir' '-cert' '-keyfile' '-key' '-passin' '-verbose' + '-notext' '-startdate' '-enddate' '-days' '-md' '-policy' + '-msie_hack' '-preverseDN' '-noemailDN' '-batch' '-extensions' + '-extfile' '-engine' '-gencrl' '-crldays' '-crlhours' '-revoke' + '-crl_reason' '-crl_hold' '-crl_compromise' '-crl_CA_compromise' + '-subj' '-crlexts') + _wanted options expl 'CA options' compadd - $options + ;; + esac + ;; + "genrsa") + digests=('-des' '-des3' '-idea') + options=('-out' '-passout') + + # FIXME TODO + if [[ ! -n $words[(r)($digests)] ]] ; then + options=($options $digests) + fi + + _wanted options expl 'genrsa Options' compadd - $options + ;; + *) + _message "invalid command" + ;; + esac +else # Nop, complete for subcommands + if [[ ${#words} < 3 ]] ; then + _wanted subcommand expl "Subcommand" compadd $openssl_commands + else + _message "invalid command" + fi +fi \ No newline at end of file diff --git a/functions/_svc b/functions/_svc new file mode 100644 index 0000000..6336b01 --- /dev/null +++ b/functions/_svc @@ -0,0 +1,30 @@ +#compdef svcadm svcs + +_svc () { + case "$service" in + svcs) _svcs "$@";; + svcadm) _svcadm "$@";; + *) _message "Invalid service $service";; + esac +} + +_svcadm () { + local expl prev="$words[CURRENT-1]" + + if [[ -n $words[(r)(enable|disable|clear|restart|refresh|mark)] ]] ; then + _message 'ok' + else + _arguments \ + '-v:verbose' && return + fi +} + +_svcs () { + local -a zones + zones=(a b c) + _arguments \ + '-z[zone]:zone:($zones)' \ + '*:command:(boot halt install list ready uninstall verify reboot)' && return +} + +return 1 \ No newline at end of file diff --git a/functions/_zones b/functions/_zones new file mode 100644 index 0000000..21ee636 --- /dev/null +++ b/functions/_zones @@ -0,0 +1,51 @@ +#compdef zoneadm zonecfg zlogin + +_zones () { + case "$service" in + zoneadm) _zoneadm "$@";; + zonecfg) _zonecfg "$@";; + zlogin) _zlogin "$@";; + *) _message "Unknow service $service";; + esac +} + +_zlogin () { + local -a zones + zones=($(zonelist)) + _arguments \ + '-l[username]:username:_users' \ + '-C[console login]' \ + '-S[safe login]' \ + '-E[disable escape sequence character]' \ + '*:zone:($zones)' && return +} + +_zoneadm () { + local -a zones + zones=($(zonelist)) + _arguments \ + '-z[zone]:zone:($zones)' \ + '*:command:(boot halt install list ready uninstall verify reboot)' && return +} + +_zonecfg () { + local -a zones + zones=($(zonelist)) + _arguments \ + '-z[zone]:zone:($zones)' \ + '-f[command file]:file:_files' && return +} + +zonelist () { + local -a zones + + # Fetch zone lists from /etc/zones/index + zones=(${${(a)"${(f)$(< /etc/zones/index)}"##\#*}//:*}) #" prevent vim become crazy + + # Remove global zone from list " + zones[(r)global]='' + + echo -n $zones +} + +return 1 \ No newline at end of file diff --git a/histories/README.md b/histories/README.md new file mode 100644 index 0000000..b3cc9ed --- /dev/null +++ b/histories/README.md @@ -0,0 +1,3 @@ +# Historiques + +Ce dossier contiendra les historiques des commandes exécutées. Un fichier est créé par hôte. \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..2371696 --- /dev/null +++ b/install.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +echo "Creating vars" +cd `echo $0 | sed -e 's/install.sh//'` +PWD=`pwd` +echo "Install dir is $PWD" +SEDHOME=`echo "$HOME" | sed -e 's/\\//\\\\\\//g'` +ZSHPATH=`echo "$PWD" | sed -e "s/$SEDHOME/~/"` +SCREENPATH=`echo "$PWD" | sed -e "s/$SEDHOME\///"` + + +echo "Creating ~/.zshenv : $ZSHPATH" +if [ -f ~/.zshenv ]; then + rm ~/.zshenv +fi +echo " ZDOTDIR=$ZSHPATH" >> ~/.zshenv +echo " skip_global_compinit=1" >> ~/.zshenv + +echo "Linking ~/.screenrc" +[ -L ~/.screenrc ] && rm ~/.screenrc +ln -s "$SCREENPATH/screenrc" ~/.screenrc + +echo "Setting zsh as shell" +chsh --shell /bin/zsh \ No newline at end of file diff --git a/misc/dircolors.rc b/misc/dircolors.rc new file mode 100644 index 0000000..9e2e169 --- /dev/null +++ b/misc/dircolors.rc @@ -0,0 +1,78 @@ +COLOR tty + +# Extra command line options for ls go here. +# Basically these ones are: +# -F = show '/' for dirs, '*' for executables, etc. +# -T 0 = don't trust tab spacing when formatting ls output. +OPTIONS -F -T 0 + +# Below, there should be one TERM entry for each termtype that is colorizable +TERM linux +TERM screen +TERM console +TERM xterm +TERM rxvt +TERM vt100 +TERM Eterm + +# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output) +EIGHTBIT 1 + +# Below are the color init strings for the basic file types. A color init +# string consists of one or more of the following numeric codes: +# Attribute codes: +# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed +# Text color codes: +# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white +# Background color codes: +# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white +NORMAL 00 # global default, although everything should be something. +FILE 00 # normal file +DIR 00;34 # directory +LINK 00;35 # symbolic link +FIFO 40;33 # pipe +SOCK 01;35 # socket +BLK 40;33;01 # block device driver +CHR 40;33;01 # character device driver + +# This is for files with execute permission: +EXEC 01;32 + +# List any file extensions like '.gz' or '.tar' that you would like ls +# to colorize below. Put the extension, a space, and the color init string. +# (and any comments you want to add after a '#') + +# Archives +.btm 00;32 +.tar 00;31 +.tgz 00;31 +.arj 00;31 +.gz 00;31 +.bz2 00;31 +.zip 00;31 + +# Packages +.deb 04;35 +.rpm 04;35 + +# Images +.jpg 00;35 +.gif 00;35 +.bmp 00;35 +.xbm 00;35 +.xpm 00;35 +.tif 00;35 +.png 00;35 + +# movies +.avi 04;36 + +# Sounds +.mp3 00;33 +.xm 00;33 +.ogg 00;33 + +# Doc +.pdf 00;36 +.PDF 00;36 +.ps 00;36 diff --git a/misc/update b/misc/update new file mode 100644 index 0000000..e69de29 diff --git a/misc/zshist.1 b/misc/zshist.1 new file mode 100644 index 0000000..a320b82 --- /dev/null +++ b/misc/zshist.1 @@ -0,0 +1,27 @@ +.TH ZSHIST 1 +.SH ZSHIST +zshist \- read .zsh_history file +.SH SYNOPSIS +.B zshist +.I [filename] +.SH DESCRIPTION +.BR zshist +will parse +.I filename +(expecting it to be .zsh_history file with EXTENDED_HISTORY +option set on) +and convert timestamps to +readable format. As a bonus, it will colourise the output. + +If +.I filename +is a directory, +.BR zshist +will append .zsh_history to it and try to parse that file. + +If no filename is given, it will read ~/.zsh_history + +.SH SEE ALSO +.BR zsh "(1) +.SH AUTHOR +Written by Radovan Garabik diff --git a/misc/zshistrc b/misc/zshistrc new file mode 100644 index 0000000..88142bd --- /dev/null +++ b/misc/zshistrc @@ -0,0 +1,48 @@ +# delimiters can be any string, you can use colour["colourname"] and + operator +# to get interesting colour effects +# Colours are one of: +# none, default, bold, underline, blink, reverse, concealed, +# black, green, yellow, blue, magenta, cyan, white, +# on_black, on_green, on_yellow, on_blue, on_magenta, on_cyan, +# on_white, beep +# on_red means that the background (instead of foreground) is painted +# with red etc... + +delim1 = colours["green"] # before time string +delim2 = colours["red"]+":" # after time string +delim3 = ": "+colours["default"] # before command +delim4 = colours["default"] # at the end of line - you'd better leave colours["default"] at the end! +delim5 = colours["bold"]+colours["blue"] # before unrecognized line format + + +# timeformat can contain following directives: +# +# Directive Meaning +# %a Locale's abbreviated weekday name. +# %A Locale's full weekday name. +# %b Locale's abbreviated month name. +# %B Locale's full month name. +# %c Locale's appropriate date and time representation. +# %d Day of the month as a decimal number [01,31]. +# %H Hour (24-hour clock) as a decimal number [00,23]. +# %I Hour (12-hour clock) as a decimal number [01,12]. +# %j Day of the year as a decimal number [001,366]. +# %m Month as a decimal number [01,12]. +# %M Minute as a decimal number [00,59]. +# %p Locale's equivalent of either AM or PM. +# %S Second as a decimal number [00,61]. +# %U Week number of the year (Sunday as the first day of the week) +# as a decimal number [00,53]. All days in a new year preceding +# the first Sunday are considered to be in week 0. +# %w Weekday as a decimal number [0(Sunday),6]. +# %W Week number of the year (Monday as the first day of the week) +# as a decimal number [00,53]. All days in a new year preceding +# the first Sunday are considered to be in week 0. +# %x Locale's appropriate date representation. +# %X Locale's appropriate time representation. +# %y Year without century as a decimal number [00,99]. +# %Y Year with century as a decimal number. +# %Z Time zone name (or by no characters if no time zone exists). +# %% % + +timeformat = "%d %b %H:%M:%S" diff --git a/rc.host/default.zsh b/rc.host/default.zsh new file mode 100644 index 0000000..00dd177 --- /dev/null +++ b/rc.host/default.zsh @@ -0,0 +1 @@ +# Prompts color diff --git a/rc.os/Arch.zsh b/rc.os/Arch.zsh new file mode 100644 index 0000000..80bf0cf --- /dev/null +++ b/rc.os/Arch.zsh @@ -0,0 +1,16 @@ +open_new_tab () { + if [[ -x `which guake` ]]; then + guake --new-tab=DUMB --rename-tab=$2 --execute-command=" command $* && logout; read; logout" + elif [[ -x `which yakuake` ]]; then + if [ "`qdbus org.kde.yakuake /yakuake/MainWindow_1 org.freedesktop.DBus.Properties.Get com.trolltech.Qt.QWidget visible`" = "false" ];then + qdbus org.kde.yakuake /yakuake/window toggleWindowState + fi + qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.addSession>/dev/null + qdbus org.kde.yakuake /yakuake/tabs org.kde.yakuake.setTabTitle "`qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.activeSessionId`" "$2">/dev/null + qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.runCommand " command $* && exit; read; exit">/dev/null + else + command $* + fi +} + +[ -x /etc/profile.d/cnf.sh ] && . /etc/profile.d/cnf.sh diff --git a/rc.os/Debian.zsh b/rc.os/Debian.zsh new file mode 100644 index 0000000..b61c5a1 --- /dev/null +++ b/rc.os/Debian.zsh @@ -0,0 +1,56 @@ +# vim: set syntax=zsh: + +# Completion for apache 2 Debian tools + +apache2_comp () { + typeset mods_available mods_enabled sites_available sites_enabled + + mods_available=(/etc/apache2/mods-available/*) + sites_available=(/etc/apache2/sites-available/*) + + mods_enabled=(/etc/apache2/mods-enabled/*) + sites_enabled=(/etc/apache2/sites-enabled/*) + + # unicity, do a basename, and remove extension + mods_available=${(u)mods_available:t:r} + mods_enabled=${(u)mods_enabled:t:r} + + sites_available=${(u)sites_available:t} + sites_enabled=${(u)sites_enabled:t} + + compdef "_wanted site expl 'Apache 2 site' compadd $sites_available" a2ensite + compdef "_wanted site expl 'Apache 2 site' compadd $sites_enabled" a2dissite + + compdef "_wanted mod expl 'Apache 2 module' compadd $mods_available" a2enmod + compdef "_wanted mod expl 'Apache 2 module' compadd $mods_enabled" a2dismod +} + +[ -d /etc/apache2/sites-enabled ] && +[ -d /etc/apache2/mods-enabled ] && + apache2_comp + +# Add name of (Debian) SCHROOT if exists +if [ -r /etc/debian_chroot ] ; then + chrootname=${$(< /etc/debian_chroot)//-*} + host="%{$fg[$user_color]%}%n:${chrootname}%{$reset_color%}~%{$fg[$host_color]%}%m" +else + host="%{$fg[$user_color]%}%n%{$reset_color%}~%{$fg[$host_color]%}%m" +fi + +open_new_tab () { + if [[ -x `which guake` ]]; then + guake --new-tab=DUMB --rename-tab=$2 --execute-command=" command $* && logout; read; logout" + elif [[ -x `which yakuake` ]]; then + if [ "`qdbus org.kde.yakuake /yakuake/MainWindow_1 org.freedesktop.DBus.Properties.Get com.trolltech.Qt.QWidget visible`" = "false" ];then + qdbus org.kde.yakuake /yakuake/window toggleWindowState + fi + qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.addSession>/dev/null + qdbus org.kde.yakuake /yakuake/tabs org.kde.yakuake.setTabTitle "`qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.activeSessionId`" "$2">/dev/null + qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.runCommand " command $* && exit; read; exit">/dev/null + else + command $* + fi +} + +alias vnc='xtigervncviewer -FullScreenAllMonitors=0 -FullScreen' +alias rdp='xfreerdp --cert-ignore --size 1900x1000 -u gilles -v' diff --git a/rc.os/Linux.zsh b/rc.os/Linux.zsh new file mode 100644 index 0000000..93074e6 --- /dev/null +++ b/rc.os/Linux.zsh @@ -0,0 +1,30 @@ +alias ls='ls --color' +alias grep='grep --color' + +source $ZDOTDIR/rc.os/prompt.zsh + + +# permit parameter expansion, command substitution and arithmetic expansion +# in prompt +setopt prompt_subst + +precmd () { + local buffer load + load=(${$(< /proc/loadavg)}) + LOADAVG="$load[1]" + buffer=(${$(free)}) + MEM="$((100 * $buffer[16] / $buffer[8]))%%" + + set_title zsh +} + +# zstyle OS specific +eval `dircolors $ZDOTDIR/misc/dircolors.rc` + +# Use LS_COLORS for color completion +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} + +# Distrib specific +[ -r /etc/debian_version ] && source $ZDOTDIR/rc.os/Debian.zsh +[ -r /etc/lsb-release ] && source $ZDOTDIR/rc.os/Ubuntu.zsh +[ -e /etc/arch-release ] && source $ZDOTDIR/rc.os/Arch.zsh diff --git a/rc.os/Ubuntu.zsh b/rc.os/Ubuntu.zsh new file mode 100644 index 0000000..24a8094 --- /dev/null +++ b/rc.os/Ubuntu.zsh @@ -0,0 +1,14 @@ +open_new_tab () { + if [[ -x `which guake` ]]; then + guake --new-tab=DUMB --rename-tab=$2 --execute-command=" command $* && logout; read; logout" + elif [[ -x `which yakuake` ]]; then + if [ "`qdbus org.kde.yakuake /yakuake/MainWindow_1 org.freedesktop.DBus.Properties.Get com.trolltech.Qt.QWidget visible`" = "false" ];then + qdbus org.kde.yakuake /yakuake/window toggleWindowState + fi + qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.addSession>/dev/null + qdbus org.kde.yakuake /yakuake/tabs org.kde.yakuake.setTabTitle "`qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.activeSessionId`" "$2">/dev/null + qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.runCommand " command $* && exit; read; exit">/dev/null + else + command $* + fi +} diff --git a/rc.os/prompt.zsh b/rc.os/prompt.zsh new file mode 100644 index 0000000..5406398 --- /dev/null +++ b/rc.os/prompt.zsh @@ -0,0 +1,22 @@ +# Prompt +autoload -U colors +colors + +date_color="red" +user_color="green" +host_color="yellow" +path_color="blue" +status_color="magenta" +sep_color="white" +sh_color="white" +ret_color="cyan" + + +stats="(%F{$status_color}\$LOADAVG%F{$sep_color} - %F{$status_color}\$MEM%F{$sep_color})" +userhost="(%B%F{$user_color}%n%F{$sep_color}@%F{$host_color}%m%F{$sep_color} +%F{$ret_color} %?%b%F{$sep_color})" +date="(%F{$date_color}%D{%d/%m/%y} %F{$sep_color}- %F{$date_color}%*%F{$sep_color})" +pspath="(%F{$path_color}%~%F{$sep_color})" +cli="%F{$sh_color}%#%f%b " + +PS1="%F{$sep_color}┌ $userhost $date $stats $pspath +└$cli" diff --git a/rc.user/gilles.zsh b/rc.user/gilles.zsh new file mode 100644 index 0000000..d32b751 --- /dev/null +++ b/rc.user/gilles.zsh @@ -0,0 +1,8 @@ +if [ "x$SSH_CLIENT" = "x" ]; then + USE_XTABS=True +fi + +if [ -x $(which -p vim) ]; then + export EDITOR=vim + export VISUAL=vim +fi \ No newline at end of file diff --git a/rc/00modules.rc b/rc/00modules.rc new file mode 100644 index 0000000..8b36ae5 --- /dev/null +++ b/rc/00modules.rc @@ -0,0 +1,2 @@ +zmodload zsh/stat +zmodload zsh/datetime diff --git a/rc/alias.rc b/rc/alias.rc new file mode 100644 index 0000000..7cbf2b9 --- /dev/null +++ b/rc/alias.rc @@ -0,0 +1,44 @@ +# -*- shell-script -*-x +# vim: set syntax=zsh: +# $Id: alias.rc 44 2005-08-09 14:50:41Z asyd $ + +# I prefer interactive mode +alias ls="ls --color -h" +alias ll="ls -lh" +alias la="ls -A" +alias df="df -h" +alias du="du -hs" +alias more="less" +alias serial="screen 1 /dev/ttyS0" +alias ser=serial +alias scan="sudo iwlist wlan0 scan" +alias route="route -n" +# zsh corret clea to flea +[[ -x `which flea` ]] && alias clea="clear" + +[[ -x $(which vim) ]] && alias vi="vim" + +# start mutt with list mailboxes +[[ -x `which mutt` ]] && alias mutt="mutt -y" + +# IPv6 Stuff +alias netstat6="netstat -A inet6" + +# acpi (show all available informations) +[[ -x `which acpi` ]] && alias acpi="acpi -V" + +# Etags +[[ -x `which etags` ]] && alias etags="etags --members" + +alias -s log="tail -f" + +alias -s pem="openssl x509 -text -noout -in" +alias -s req="openssl req -text -in" +alias rand="openssl rand -base64" + +# cron / fcronb +if [[ -x $(which -p fcron) ]]; then + alias crontab="fcrontab" +fi + +return 0 diff --git a/rc/auto_screen.rc b/rc/auto_screen.rc new file mode 100644 index 0000000..6280bd8 --- /dev/null +++ b/rc/auto_screen.rc @@ -0,0 +1,11 @@ +if [ "x$SSH_CLIENT" != "x" ]; then + if [ "$TERM" != "screen" ]; then + SOCK="$HOME/.zsh/ssh_auth_sock" + if [ ! -z "$SSH_AUTH_SOCK" -a "$SSH_AUTH_SOCK" != "$SOCK" ]; then + rm -f "$SOCK" + ln -sf "$SSH_AUTH_SOCK" "$SOCK" + export SSH_AUTH_SOCK="$SOCK" + fi + screen -xR && logout + fi +fi diff --git a/rc/functions.rc b/rc/functions.rc new file mode 100644 index 0000000..27ea8a5 --- /dev/null +++ b/rc/functions.rc @@ -0,0 +1,133 @@ +# -*- shell-script -*- +# +# Trace libraries load by first argument (ELF only) +# (note: exactly same result with ldd) +tracelib () { + LD_TRACE_LOADED_OBJECTS=1 $1 +} + +srm() { + if [ ! -z $1 ]; then + echo "Deleting `find "$1" -type l | wc -l` symbolic links" + find "$1" -type l -exec rm {} + + rm -r "$1" + fi +} + + +rvpn() { + if echo $1 | grep "/" > /dev/null; then + sudo route add -net $1 gw 192.168.10.1 + else + sudo route add -host $1 gw 192.168.10.1 + fi +} + +cp_p() { + strace -q -ewrite cp -- "${1}" "${2}" 2>&1 \ + | awk '{ + count += $NF + if (count % 10 == 0) { + percent = count / total_size * 100 + printf "%3d%% [", percent + for (i=0;i<=percent;i++) + printf "=" + printf ">" + for (i=percent;i<100;i++) + printf " " + printf "]\r" + } + } + END { print "" }' total_size=$(stat -c '%s' "${1}") count=0 +} + + +# debian upgrade +# if the first argument is void, proceed local upgrade +# else, send command via ssh +# assume user have sufficient permission for upgrade +# without interaction +# +# Note: +# i use sudo with the follow lines +# +# Cmnd_Alias DEBIAN = /usr/bin/apt-get, /usr/bin/dpkg +# asyd ALL = PASSWD: ALL, NOPASSWD: DEBIAN +upgrade () { + sudo apt-get update + sudo apt-get -u dist-upgrade -- force-yes -y +} + +lsperm () { + echo $1 | perl -e 'chomp($s=<>);$p=(stat($s))[2] & 07777;printf "$s -> %04o\n",$p' +} + +findnosecure () { + find / -perm +2000 -o -perm +4000 -print 2>/dev/null +} + +function cd () { +if [[ -z $2 ]]; then + if [[ -f $1 ]]; then + builtin cd $1:h + else + builtin cd $1 + fi +else + if [[ -z $3 ]]; then + builtin cd $1 $2 + else + echo cd: too many arguments + fi +fi +} + +# display the NTTP message (wait a Message-Id) +mid () { +( echo "mode reader"; echo "article <$*>" | sed 's/%40/@/ ; s/%24/\$/g ; s/<<*/>*/>/g') | +tee /proc/self/fd/2 | nc $NNTPSERVER 119 | tail +3 } + +set_title () { + [ $TERM = "screen" ] && print -nR $'\033k'$1$'\033'\\ +} + +# update screen caption, use the last argument as hostname +ssh () { + [[ "$*" == *"BatchMode=yes"* ]] && USE_XTABS="False" + if [[ $USE_XTABS = "True" ]]; then + open_new_tab ssh $@ + else + target=$_ + target=${target//*@/} + set_title $target + command ssh $@ + fi +} + +# same for telnet +telnet () { + if [[ $USE_XTABS = "True" ]]; then + open_new_tab telnet "$*" + else + target=$1 + set_title $target + command telnet $* + fi +} + + + +# utf8 +utf8 () { + if [[ $COLORTERM == "gnome-terminal" ]]; then + echo -e '\e%G' + fi + export LC_CTYPE=fr_FR.UTF8 + unalias vi + if [[ ! -x $(which -p vim) ]] ; then + echo "utf8() Warning, vim not found !" + else + alias vi='vim "+set enc=utf8"' + fi +} + diff --git a/rc/history.rc b/rc/history.rc new file mode 100644 index 0000000..fe50c1a --- /dev/null +++ b/rc/history.rc @@ -0,0 +1,14 @@ +# +# History options +# + +setopt EXTENDED_HISTORY # add a timestamp and the duration of each command +setopt SHARE_HISTORY # _all_ zsh sessions share the same history files +setopt HIST_IGNORE_ALL_DUPS # ignores duplications +setopt HIST_IGNORE_SPACE + +HISTFILE=$ZDOTDIR/histories/$(hostname) +HISTSIZE=1000000 +SAVEHIST=1000000 + +export HISTFILE HISTSIZE SAVEHIST diff --git a/rc/misc.rc b/rc/misc.rc new file mode 100644 index 0000000..280d119 --- /dev/null +++ b/rc/misc.rc @@ -0,0 +1,16 @@ +# -*- shell-script -*- + +periodic () { + rehash +} + +export PERIOD=300 + +# Zftp + +# load zftp module +#autoload -U zfinit +#zfinit + +# email address for anonymous ftp +#export EMAIL_ADDR=enjoy.zsh@foo.bar diff --git a/rc/options.rc b/rc/options.rc new file mode 100644 index 0000000..d841f35 --- /dev/null +++ b/rc/options.rc @@ -0,0 +1,27 @@ +# -*- shell-script -*- +# +# Zsh Options +# + +export LISTPROMPT # in order to scroll if completion list is too big + +setopt auto_cd # a commande like % /usr/local is equivalent to cd /usr/local +setopt nohup # don't send HUP signal when closing term session +setopt extended_glob # in order to use #, ~ and ^ for filename generation +setopt always_to_end # move to cursor to the end after completion +setopt notify # report the status of backgrounds jobs immediately +setopt correct # try to correct the spelling if possible +setopt rmstarwait # wait 10 seconds before querying for a rm which contains a * +setopt auto_pushd # Always push directory in stack +setopt pushdminus # Invert the behavior of cd - cd + +setopt histverify # Verify history expansion + + +export DIRSTACKSIZE=20 # Number of directory to keep in the stack + +# Don't erase file with >, use >| (overwrite) or >> (append) instead +set -C + +# Watch new users +watch=(all) +LOGCHECK=5 diff --git a/rc/run-help.rc b/rc/run-help.rc new file mode 100644 index 0000000..031bb96 --- /dev/null +++ b/rc/run-help.rc @@ -0,0 +1,7 @@ +function run-help-sudo { + if [ $# -eq 0 ]; then + man sudo + else + man $1 + fi +} diff --git a/rc/svnscan.rc b/rc/svnscan.rc new file mode 100644 index 0000000..b3f2fcd --- /dev/null +++ b/rc/svnscan.rc @@ -0,0 +1,12 @@ +if which svn > /dev/null; then + if [ -z $NOSVN ]; then + echo "Current rev :`LANG=C svn info "$ZDOTDIR" | grep Revision | cut -d' ' -f 2`" + if [ -z $NOSVNSCAN ]; then + MODFILE=`svn status "$ZDOTDIR" | grep -v " L"` + if [ `echo -n "$MODFILE" | wc -c` -gt 2 ]; then + echo "Modified Files :" + echo "$MODFILE" + fi + fi + fi +fi diff --git a/rc/titles.rc b/rc/titles.rc new file mode 100644 index 0000000..f4ebed9 --- /dev/null +++ b/rc/titles.rc @@ -0,0 +1,13 @@ +if [ $TERM = "screen" ]; then + setopt extended_glob + preexec () { + local CMD=${1[(wr)^(*=*|sudo|-*)]} +# if [[ $CMD -eq "man" ]]; then +# CMD+=" ${2[(wr)^(*=*|sudo|-*)]}" +# fi + echo -n "\ek$CMD\e\\" + } +fi + + + diff --git a/rc/variables.rc b/rc/variables.rc new file mode 100644 index 0000000..e127307 --- /dev/null +++ b/rc/variables.rc @@ -0,0 +1,25 @@ +[ -d /usr/local/info ] && export INFO_PATH="$INFO_PATH;/usr/local/info" + +# less +if which less > /dev/null; then + export PAGER=less + export LESS="-ir" + export LESS_TERMCAP_mb=$'\E[01;31m' + export LESS_TERMCAP_md=$'\E[01;31m' + export LESS_TERMCAP_me=$'\E[0m' + export LESS_TERMCAP_se=$'\E[0m' + export LESS_TERMCAP_so=$'\E[01;44;33m' + export LESS_TERMCAP_ue=$'\E[0m' + export LESS_TERMCAP_us=$'\E[01;32m' + + if which lesspipe > /dev/null; then + export LESSOPEN="| /usr/bin/lesspipe %s" + export LESSCLOSE="/usr/bin/lesspipe %s %s" + fi +fi + +PATH=$PATH:$ZDOTDIR/bin:~/.bin:/usr/local/bin:/usr/sbin:/sbin + +export PATH + +export WORDCHARS="${WORDCHARS:s#/#}" diff --git a/rc/verify_nano_rw.rc b/rc/verify_nano_rw.rc new file mode 100644 index 0000000..d8f3912 --- /dev/null +++ b/rc/verify_nano_rw.rc @@ -0,0 +1,47 @@ +nano () { + if [ -f "$1" ]; then + if [ -w "$1" ]; then + command nano $* + else + echo "Unwritable file, openning through sudoedit" + VISUAL=nano command sudoedit $* + fi + else + if [ -d "`dirname \"$1\"`" ]; then + if [ -w "`dirname \"$1\"`" ]; then + command nano $* + else + echo "Unwritable file, openning through sudoedit" + VISUAL=nano command sudoedit $* + fi + else + echo "Unexpected result..." + read + command nano $* + fi + fi +} + +vim () { + if [ -f "$1" ]; then + if [ -w "$1" ]; then + command vim $* + else + echo "Unwritable file, openning through sudoedit" + VISUAL=vim command sudoedit $* + fi + else + if [ -d "`dirname \"$1\"`" ]; then + if [ -w "`dirname \"$1\"`" ]; then + command vim $* + else + echo "Unwritable file, openning through sudoedit" + VISUAL=vim command sudoedit $* + fi + else + echo "Unexpected result..." + read + command vim $* + fi + fi +} diff --git a/rc/zle.rc b/rc/zle.rc new file mode 100644 index 0000000..2e826c8 --- /dev/null +++ b/rc/zle.rc @@ -0,0 +1,15 @@ +# vim: set syntax=zsh: + +# Use emacs bindkey +bindkey -e + +bindkey '^U' backward-kill-line + +#zle -N insert-root-prefix +autoload -U insert-root-prefix +zle -N insert-root-prefix +bindkey "^[f" insert-root-prefix + +# Use control- arrows to move through words +bindkey '^[[1;5D' vi-backward-word +bindkey '^[[1;5C' vi-forward-word diff --git a/rc/zstyle.rc b/rc/zstyle.rc new file mode 100644 index 0000000..6cb58e5 --- /dev/null +++ b/rc/zstyle.rc @@ -0,0 +1,33 @@ +# vim: set syntax=zsh: +# -*- shell-script -*- + +# Global completion behavior +zstyle ':completion:*' completer _complete _prefix _approximate +zstyle ':completion:*:complete:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' +zstyle ':completion:*' max-errors 1 +zstyle ':completion:*' use-ip true + +# Use 'ps -au$USER' for fetch user process list +zstyle ':completion:*:processes' command 'ps -au$USER' + +# Verbose mode +zstyle ':completion:*:descriptions' format '%B%d%b' + +# Use cache +zstyle ':completion:*' use-cache on +zstyle ':completion:*' cache-path $ZDOTDIR/cache + +zstyle ':completion:*' ignore-parents parent pwd + +zstyle ':completion:*:*:zless:*' file-patterns '*(-/):directories *.gz:all-files' +zstyle ':completion:*:*:gqview:*' file-patterns '*(-/):directories :(#i)*.(png|jpeg|jpg):all-files' +zstyle ':completion:*:*:lintian:*' file-patterns '*(-/):directories *.deb' +zstyle ':completion:*:*:evince:*' file-patterns '*(-/):directories (#i)*.(pdf|ps)' + +zstyle ':completion:*:*:less:*' ignored-patterns '*.gz' +zstyle ':completion:*:*:zcompile:*' ignored-patterns '(*~|*.zwc)' + +# few simple completion definitions +compdef _hosts mtr +compdef _hosts rdesktop +compdef _gnu_generic sort diff --git a/screenrc b/screenrc new file mode 100644 index 0000000..8593b95 --- /dev/null +++ b/screenrc @@ -0,0 +1,160 @@ +# Add stuff to xterm (and cousins) title bars. This is a moderate abuse of the +# hardstatus feature--it just puts the hardstatus stuff into an xterm title +# bar. +termcapinfo xterm*|Eterm|mlterm 'hs:ts=\E]0;:fs=\007:ds=\E]0;screen\007' +defhstatus "screen  (t) | $USER@H" +hardstatus off + +# 256 color xterm +attrcolor b ".I" +termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' +#defbce "on" + +# Give me some info at the bottom of the screen. Since hardstatus is in use by +# the above xterm title hack, the only source of information left is the +# caption that normally only gets displayed if you have split windows. +# e.g.: +# 11:50|Mon|Jan 06|aragorn f 3$ mutt 4$ centericq 5$* less 6-&!$ man 7$ xe +# (Current window is in reverse bold.) +# See bottom of file for more complete description. +caption always "%?%F%{-b bc}%:%{-b bb}%?%H|%?%F%{+u wb}%? %L=%-w%45>%{+b ym}%n*%t%{-}%+w%-0<" + +# Make screen messages stand out a little more - black on bright green. +sorendition "+b kG" + +# Variants on Sven's custom messages. +activity "%c activity -> %n%f %t" +bell "%c bell -> %n%f %t^G" +vbell_msg " *beep* " + +# I know about screen. I don't need to see it every time I start the program. +# (Which is, admittedly, rarely.) +startup_message off +# Log new screen windows in utmp. +deflogin on +# Never, ever turn this off. +autodetach on +# I like to hear the beep. +vbell off +# And show the command for the windows when they're resurrected. +verbose on +# I like a large scrollback +defscrollback 10000 +# Run everything in UTF-8. +defutf8 on +# If a window goes unresponsive, don't block the whole session waiting for it. +defnonblock on + +# Use the function keys to switch among windows. +bindkey -k k1 select 1 +bindkey -k k2 select 2 +bindkey -k k3 select 3 +bindkey -k k4 select 4 +bindkey -k k5 select 5 +bindkey -k k6 select 6 +bindkey -k k7 select 7 +bindkey -k k8 select 8 +bindkey -k k9 select 9 +bindkey -k k; select 10 +bindkey -k F1 select 11 +bindkey -k F2 select 12 +# windows 13-24 are Shift-Fn. May not work in all terminals. +bindkey -k F3 select 13 +bindkey -k F4 select 14 +bindkey -k F5 select 15 +bindkey -k F6 select 16 +bindkey -k F7 select 17 +bindkey -k F8 select 18 +bindkey -k F9 select 19 +bindkey -k FA select 20 +# screen only seems to understand up to FA. +#bindkey -k FB select 21 +#bindkey -k FC select 22 +#bindkey -k FD select 23 +#bindkey -k FE select 24 + +# select works on window names, too. This gives me the first window with a +# free shell. +bind s select zsh + +# Make shift-PgUp and shift-PgDn work like they do in xterm. (Note that this +# requires xterm to be configured to pass those keys through, and not try to +# act on them itself.) +bindkey "^[[5;3~" eval "copy" "stuff ^u" +bindkey -m "^[[5;3~" stuff ^b +bindkey -m "^[[6;3~" stuff ^f + +# Window numbering starts at 1, not 0. +bind c screen 1 +bind C screen 1 +bind 0 select 10 + +# Login toggle is too close to screen redraw. How about explicitly setting +# login state, anyway? +bind 'L' +bind 'i' login on +bind 'o' login off + + +altscreen on + +# It's sometimes useful to have a quote key. +bind ^Q mapdefault +bind q mapdefault + +# And since that leaxes xon unbound, let's remove xoff, too. +bind ^S + +# Using tab to move around regions gets annoying. These help. +bind ^j focus down +bind ^k focus up +bind ^t focus top +bind ^b focus bottom + +# This lets me use specific commands from screen escape sequences. +multiuser on +aclchg :window: +x select + + +# caption description: +# caption always "%?%F%{-b bc}%:%{-b bb}%?%C|%D|%M %d|%H%?%F%{+u wb}%? %L=%-Lw%45>%{+b by}%n%f* %t%{-}%+Lw%-0<" +# +# Anything I don't describe is treated literally. +# +# %? - Start of a conditional statement. +# %F - Use this part of the statement if the window has focus (i.e. it +# is the only window or the currently active one). +# %{-b bc} - Turn off bold, blue foreground, cyan background. +# %: - else +# %{-b bb} - Turn off bold, blue foreground, blue background (this obscures +# the text on non-focused windows and just gives a blue line). +# %? - End conditional statement. +# %C - time (hh:mm, leading space) in 12 hour format +# %D - Three-letter day-of-week appreviation +# %M - Three-letter month appreviation +# %d - Day of the month +# %H - hostname +# %? - Start of conditional statement. +# %F - Use this part of the statement if the window has focus. +# %{+u wb} - underlined, white foreground, blue background +# %? - End conditional (if not focused, text remaind blue on blue). +# %L= - truncation/padding point. With the 'L' qualifier, basically +# just acts as a reference point. Further truncation/padding is +# done relative to here, not the beginning of the string +# %-Lw - window list up to but not including the current window (-), +# show window flags (L) +# %45> - truncation/padding marker; place this point about 45% of the +# way into the display area (45) +# %{+b by} - add bold (still underlined from before), blue foreground, +# yellow background +# %n - number of the current window +# %f - flags for current window +# %t - title of current window +# %{-} - undo last color change (so now we're back to underlined white +# on blue) (technically, this is a pop; a second invocation +# would drop things back to unadorned blue on cyan) +# %+Lw - window list from the next window on (-), show window flags (L) +# %-0< - truncation/padding point. Place this point zero spaces (0) +# from the right margin (-). + +screen 1 \ No newline at end of file