From: Simon Ruderich Date: Sat, 2 Jun 2018 12:46:19 +0000 (+0200) Subject: Merge branch 'multimedia' again X-Git-Url: https://ruderich.org/simon/gitweb/?p=config%2Fdotfiles.git;a=commitdiff_plain;h=416ce61606a742ea16b9e121b2e279416375860a;hp=e97bbde3f921b463259068089c1bbfd0e64eebc7 Merge branch 'multimedia' again Forgot a few commits in the original merge. --- diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..144dbb4 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,21 @@ +[submodule "vim/vim/bundle/ctrlp"] + path = vim/vim/bundle/ctrlp + url = https://github.com/kien/ctrlp.vim.git +[submodule "vim/vim/bundle/fswitch"] + path = vim/vim/bundle/fswitch + url = https://github.com/derekwyatt/vim-fswitch.git +[submodule "vim/vim/bundle/gundo"] + path = vim/vim/bundle/gundo + url = https://github.com/sjl/gundo.vim.git +[submodule "vim/vim/bundle/nerdcommenter"] + path = vim/vim/bundle/nerdcommenter + url = https://github.com/scrooloose/nerdcommenter.git +[submodule "vim/vim/bundle/surround"] + path = vim/vim/bundle/surround + url = https://github.com/tpope/vim-surround.git +[submodule "vim/vim/bundle/repeat"] + path = vim/vim/bundle/repeat + url = https://github.com/tpope/vim-repeat.git +[submodule "vim/vim/bundle/xptemplate"] + path = vim/vim/bundle/xptemplate + url = https://github.com/drmingdrmer/xptemplate diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/README b/README new file mode 100644 index 0000000..d94ea97 --- /dev/null +++ b/README @@ -0,0 +1,11 @@ +README +====== + +Git repository to store my configuration, designed to by cloned to +`~/.config/dotfiles`. `~/.config` is not used to allow a separate directory +hierarchy than just the program names which is custom for `~/.config`. + +NOTE: This repository must contain only public data as it will be stored on +many hosts! + +// vim: ft=asciidoc diff --git a/archive.sh b/archive.sh new file mode 100755 index 0000000..4de7061 --- /dev/null +++ b/archive.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +# Create an archive of my configuration file which can be uploaded on a +# server. +# +# Usage: ./archive.sh + +# Copyright (C) 2010-2018 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +git_clone() { + git clone "$1" "$2" >/dev/null + ( cd "$2" && git remote rm origin && git gc ) +} + + +# Don't overwrite an existing file/directory. +if test -e tmp; then + echo 'tmp/ already exists!' + exit 1 +fi + +git_clone . tmp/dotfiles + +archive=dotfiles.tar.gz +echo "creating $archive" +tar cf tmp/$archive -C tmp -z dotfiles +echo "moving $archive to ." +mv tmp/$archive . + +rm -rf tmp diff --git a/lib.m4 b/lib.m4 new file mode 100644 index 0000000..2f008e4 --- /dev/null +++ b/lib.m4 @@ -0,0 +1,25 @@ +dnl Contains additional macros for m4. +dnl +dnl The following macros are defined: IF and FI. Example: +dnl IF(OS, debian) +dnl ... +dnl FI +dnl +dnl Copyright (C) 2009-2013 Simon Ruderich +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program. If not, see . +dnl +dnl +define(`IF', `ifelse(`$1', `$2',dnl')dnl +define(`FI', `)dnl')dnl diff --git a/lib.sh b/lib.sh new file mode 100644 index 0000000..aa46799 --- /dev/null +++ b/lib.sh @@ -0,0 +1,219 @@ +# Setup functions and settings used in subdirectories. +# +# Their setup.sh script sources this file. + +# Copyright (C) 2009-2018 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +# csh gives the error "Unknown colorls variable `su'." when used with newer +# options supported by Zsh or GNU ls. +unset LS_COLORS + + +# Check if the given program is installed. `type` is portable, `which` is not. +installed() { + type "$1" >/dev/null 2>&1 +} +# Get the path of the given program. Thanks to Gilles on [1] (read on +# 2013-03-10) for the PATH-walking idea. `which` is not portable and `type` +# has no well-formed output format. +# +# [1]: http://unix.stackexchange.com/questions/4988/how-do-i-test-to-see-if-an-application-exists-in-path/4991 +installed_path() { + test -z "$1" && return 1 + + # Keep IFS change local. + ( + IFS=: + # Walk PATH. + for directory in $PATH; do + if test -x "$directory/$1"; then + printf '%s\n' "$directory/$1" + return 0 + fi + done + + return 1 + ) +} + +# Usage: cmd_i ... +# +# Run with all arguments (including the last file) and write the result +# to the temporary file .tmp and then rename that file to . This +# can't be done in-place (e.g. cmd file) because it truncates the file. +cmd_i() { + # Get last argument. + last= + for x; do + last="$x" + done + + "$@" >"$last".tmp + mv "$last".tmp "$last" +} + +# Usage: sed_i ... +# +# sed -i is not portable due to different implementations. See cmd_i. +sed_i() { + cmd_i sed "$@" +} +grep_i() { + cmd_i grep "$@" +} + +# Usage: perl_line_filter ... +# +# Run the perl command cmd on each line before printing it. +perl_line_filter() { + cmd="$1" + shift + + # Can't use -pe because it uses <> which treats the arguments as files. + perl -e "use strict; use warnings; while () { $cmd; print; }" "$@" +} + +# Usage: simple_cpp .. -- ... +# +# Replaces each FIRST (on word boundaries) with like a +# simple cpp replacement. +simple_cpp() { + cmd='my $i = 0;' + + for x; do + shift + + if test x"$x" = x--; then + break + fi + + cmd="$cmd s/\b$x\b/\$ARGV[\$i]/g; \$i++;" + done + + perl_line_filter "$cmd" -- "$@" +} + +# Print the current OS. The following OS are supported at the moment: +# +# - Debian (debian) +# - Gentoo (gentoo) +# - Mac OS X (darwin) +# - Solaris/OpenSolaris (sun) +# - FreeBSD (freebsd) +# +# If an unsupported OS is used an error is printed. +os() { + if test -f /etc/debian_version; then + echo debian + elif test -f /etc/gentoo-release; then + echo gentoo + elif test x`uname` = xDarwin; then + echo darwin + elif test x`uname` = xSunOS; then + echo sun + elif test x`uname` = xFreeBSD; then + echo freebsd + else + echo 'unsupported OS!' >&2 + return 1 + fi +} + +# Creates a symbolic link for file $1 in dirname of $2 with name of basename +# $2. +# +# `./link.sh example ~/.examplerc` creates a symbolic link to example +# (wherever it is located) in ~/ named .examplerc. +link() { + local pwd base source target >/dev/null 2>&1 || true + + # Get all necessary paths. + pwd=`pwd` + base=`printf '%s' "$2" | sed "s|\~|$HOME|"` # expand ~, some sh don't do it + base=`dirname "$base"` + source=`printf '%s' "$pwd/$1" | sed "s|$base/||"` + target=`basename "$2"` + + # Go to the directory where the link is going to be created. + cd "$base" || return 1 + + # Abort if the target file exists and is no symbolic link. Prevents + # overwriting real files. + if test -e "$target" && test ! -h "$target"; then + printf "link(): target '%s' exists already and is no symbolic link!\n" \ + "$target" >&2 + exit 1 + fi + + # Make sure the source exists. + if test ! -e "$source"; then + printf "link(): source '%s' doesn't exist!\n" "$source" >&2 + exit 1 + fi + + # Create the new symbolic link; remove the old one if necessary. + printf "link(): linking '%s' to '%s'\n" "$source" "$target" + rm -f "$target" + ln -s "$source" "$target" + + # Go back to the directory where we were before. + cd "$pwd" +} + +# Generate a file from a source file using a given command. A warning not to +# edit it is automatically added to the created file. +# +# Usage: generate +# +# If an empty extension is provided, the file is modified in-place (through a +# temporary file). +generate() { + local file >/dev/null 2>&1 || true + local file_tmp >/dev/null 2>&1 || true + local extension >/dev/null 2>&1 || true + + # Get command and target file. + file="$1" + extension="$2" + shift + shift + + if test -z "$extension"; then + file_tmp="$file.tmp" + else + # We only need this message if we generate a new file. + printf "%s: generating from '%s' (%s)\n" \ + "$file" "$file$extension" "$1" + + echo '###################################' >"$file" + echo '# WARNING! DO NOT EDIT THIS FILE! #' >>"$file" + echo '###################################' >>"$file" + echo >>"$file" + printf "# It was generated from '%s' on %s.\n" \ + "$file$extension" "`date`" >>"$file" + echo >>"$file" + + file_tmp="$file" + fi + + # Generate $file from $file$extension using the given command. + "$@" <"$file$extension" >>"$file_tmp" + + if test -z "$extension"; then + mv "$file_tmp" "$file" + fi +} diff --git a/mail/.gitignore b/mail/.gitignore new file mode 100644 index 0000000..2a54f18 --- /dev/null +++ b/mail/.gitignore @@ -0,0 +1,15 @@ +# Ignore GnuPG files not stored in Git. +/gnupg/pubring.gpg +/gnupg/pubring.gpg~ +/gnupg/random_seed +/gnupg/secring.gpg +/gnupg/trustdb.gpg + +# Ignore files generated by setup.sh. +/mutt/display + +# Ignore local files. +/mutt/adfooters/ +/mutt/mlfooters/ +# Ignore generated files. +/mutt/history diff --git a/mail/Makefile b/mail/Makefile new file mode 100644 index 0000000..23d5991 --- /dev/null +++ b/mail/Makefile @@ -0,0 +1,4 @@ +all: + @./setup.sh + +.PHONY: all diff --git a/mail/abook/abookrc b/mail/abook/abookrc new file mode 100644 index 0000000..d7b40ce --- /dev/null +++ b/mail/abook/abookrc @@ -0,0 +1,38 @@ +# Configuration file for abook, a curses based address book. +# +# Works only with abook >= 0.6.0pre2! + +# Copyright (C) 2009-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Preserve all fields in ~/.abook/addressbook even if not defined by field. +# This makes sure no data is lost when working with a different field +# configuration. +set preserve_fields = all + +# My custom fields. +field birthday = Birthday, date +field im = Instant-Messenger, list +field urls = URLs, list # additional URLs + +# Display only important (to me) fields. +view CONTACT = name, email, im, url, urls +view ADDRESS = address, zip, city, country +view PHONE = phone, workphone, fax, mobile +view OTHER = birthday, nick, notes + +# Use elinks as browser. +set www_command=elinks diff --git a/mail/gnupg/gpg.conf b/mail/gnupg/gpg.conf new file mode 100644 index 0000000..2cbec14 --- /dev/null +++ b/mail/gnupg/gpg.conf @@ -0,0 +1,82 @@ +# Configuration file for GnuPG. +# +# Thanks to [1] for some hints to generate stronger keys (read on 2013-04-04). +# +# [1]: https://we.riseup.net/riseuplabs+paow/openpgp-best-practices + +# Copyright (C) 2009-2013 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# DISPLAY + +# Don't display the copyright notice. +no-greeting + +# Use long keyids because the short ones have collisions. +keyid-format 0xlong + + +# KEY GENERATION + +# Use stronger preferences. These are not enforced, but tried in the given +# order and the first supported by all recipients is used. +# +# Ciphers for encryption. +personal-cipher-preferences AES256 AES192 AES CAST5 +# Don't use insecure hashes like SHA1 or MD5 and prefer stronger hashes. +personal-digest-preferences SHA512 SHA384 SHA256 SHA224 +# Prefer better compression methods. +personal-compress-preferences BZIP2 ZLIB ZIP Uncompressed + +# Default preferences when generating a new key. Use the three settings above +# combined to create stronger keys. +default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 BZIP2 ZLIB ZIP Uncompressed + +# Don't use SHA1 when signing keys, this includes self-certificates. This +# setting is separate from the settings above and needs to be explicitly set +# or SHA1 will be used! Thanks to [1]. +cert-digest-algo SHA512 + + +# KEY PROTECTION + +# Mangle passphrases for private keys and symmetric encryption by applying a +# hash function (s2k-digest-algo) with a salt s2k-count times (default). +s2k-mode 3 +# Increase count. Takes ~0.5 seconds on my machine. +s2k-count 3538944 +# Use SHA-512 as hash function. Takes a little longer than SHA-1, which is the +# default. +s2k-digest-algo SHA512 + + +# KEYSERVERS + +# Use the given keyserver. +keyserver hkp://pool.sks-keyservers.net + +# Don't use the preferred keyserver of the key, but our keyserver pool +# instead. This way we won't use any broken keyservers like pgp.mit.edu +# specified by the key. +keyserver-options no-honor-keyserver-url + + +# MY KEYS + +# Use my newest key as default key. +default-key 0x92FEFDB7E44C32F9 + +# vim: ft=gpg diff --git a/mail/lbdbrc b/mail/lbdbrc new file mode 100644 index 0000000..c30f296 --- /dev/null +++ b/mail/lbdbrc @@ -0,0 +1,20 @@ +# Configuration file for little brothers database lbdb. + +# Copyright (C) 2009-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Use abook and gpg as sources. +METHODS="m_abook m_gpg" diff --git a/mail/mailcap b/mail/mailcap new file mode 100644 index 0000000..50d184b --- /dev/null +++ b/mail/mailcap @@ -0,0 +1,20 @@ +# Mailcap file used by mutt to decode html messages. + +# Copyright (C) 2007-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Allows mutt to decode text/html attachments and display them inline. +text/html; lynx -dump -assume_charset=%{charset} -display_charset=utf-8 %s; copiousoutput; nametemplate=%s.html diff --git a/mail/mutt/adfooters/.gitignore b/mail/mutt/adfooters/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/mail/mutt/crypto b/mail/mutt/crypto new file mode 100644 index 0000000..c5b08bc --- /dev/null +++ b/mail/mutt/crypto @@ -0,0 +1,58 @@ +# muttrc file for gpg support + +# Copyright (C) 2007-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# settings for gpg to decrypt/encrypt/verify: +set pgp_decode_command="gpg %?p?--passphrase-fd 0? --no-verbose --batch --output - %f" +set pgp_verify_command="gpg --no-verbose --batch --output - --verify %s %f" +set pgp_decrypt_command="gpg --passphrase-fd 0 --no-verbose --batch --output - %f" +set pgp_sign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f" +set pgp_clearsign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f" +set pgp_encrypt_only_command="/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to %a -- -r %r -- %f" +set pgp_encrypt_sign_command="/usr/lib/mutt/pgpewrap gpg --passphrase-fd 0 --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to %a -- -r %r -- %f" +set pgp_import_command="gpg --no-verbose --import --verbose %f" +set pgp_export_command="gpg --no-verbose --export --armor %r" +set pgp_verify_key_command="gpg --no-verbose --batch --fingerprint --check-sigs %r" +set pgp_list_pubring_command="gpg --no-verbose --batch --with-colons --list-keys %r" +set pgp_list_secring_command="gpg --no-verbose --batch --with-colons --list-secret-keys %r" +# match necessary for a good signature: +set pgp_good_sign="^gpg: Good signature from" + +# use inline signatures for compatibility with other clients and mailing +# lists: +set pgp_create_traditional=yes + +# automatically sign every mail: +set pgp_autosign=yes +# automatically encrypt replies on encrypted mails: +set pgp_replyencrypt=yes + +# automatically verify inline signatures: +set pgp_auto_decode=yes + +# store the gpg password for half an hour: +set pgp_timeout=1800 + +# use my key for signing/encrypting: +set pgp_sign_as=0x92FEFDB7E44C32F9 + +# enable encryption for all known GnuPG keys. crypto-autoencrypt.pl creates +# all the necessary hooks: +send-hook . 'set crypt_autoencrypt=no' +source ~/.mutt/crypto-autoencrypt.pl| + +# vim: ft=muttrc diff --git a/mail/mutt/crypto-autoencrypt.pl b/mail/mutt/crypto-autoencrypt.pl new file mode 100755 index 0000000..08cf146 --- /dev/null +++ b/mail/mutt/crypto-autoencrypt.pl @@ -0,0 +1,38 @@ +#!/usr/bin/perl + +# Helper script for mutt to create a list of send-hooks which enable +# crypt_autoencrypt for known GnuPG keys. + +# Copyright (C) 2009-2013 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +use strict; +use warnings; + +open my $gpg, '-|', 'gpg --list-keys --with-colons --fixed-list-mode' or die $!; +while (<$gpg>) { + next if not /^uid:/; + + # We don't skip invalid, deleted, revoked, expired and not-trusted UIDs to + # prevent sending an unencrypted mail when e.g. a key is revoked or + # expired; GnuPG will warn if we use any of them. If you really want to + # skip those UIDs (not recommended), uncomment the next line. + #next if /^uid:[idren]:/; + + next if not /<(.+?@.+?)>:/; + print "send-hook '~t $1' 'set crypt_autoencrypt=yes'\n"; +} +close $gpg or die $!; diff --git a/mail/mutt/display.in b/mail/mutt/display.in new file mode 100644 index 0000000..22688b7 --- /dev/null +++ b/mail/mutt/display.in @@ -0,0 +1,172 @@ +# muttrc file for the mail display + +# Copyright (C) 2007-2013 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Don't display help bar at the top of the screen. +set help=no + +# don't display sidebar, enabled by setup.sh if the sidebar patch is used: +#set sidebar_visible=no + +# automatically display html mails as plain text: +auto_view text/html +# but ensure plain mail is used if it exists: +alternative_order text/plain + +# assume iso-8859-1 for unspecified charsets in emails as it's the most used, +# not a perfect solution, but it works most of the time well: +set assumed_charset=iso-8859-1 + + +# sort threads with new messages in old threads like new threads: +set sort_aux=last-date-received + +# mark missing messages in threads with a '?' in the thread display: +set hide_missing=no +set hide_top_missing=no + + +# use a wider index format (35 instead of 15 characters): +# also display the number of attachments: +set index_format="%4C %Z %{%b %d} %-35.35L (%?l?%4l&%4c?)%?X?(%X)& ? %s" + +# display a small email index while reading email contents: +set pager_index_lines=5 + +# when scrolling mails repeat the three last lines on the next screen: +set pager_context=3 + + +# only update the read/write counter every 2000 mails, this increases speed: +set read_inc=2000 +set write_inc=2000 + + +# wrap email content to 78 characters, this increases readability (for me): +set wrap=78 +# don't display any '+' markers when a line is wrapped: +set markers=no +# display ~s at the end of each message so it's clear where the message ends: +set tilde + +# order the headers in mail display by this order: +hdr_order Date: From: To: Cc: Bcc: Subject: + + +# ignore settings +# +# I ignore only certain headers so I can see custom headers; the first ignore +# rule in each section ignores standard, the second non standard headers +# +# thanks to [1] for a very helpful list of mail headers +# [1]: http://people.dsv.su.se/~jpalme/ietf/mail-headers/mail-headers.html + +# reset all ignores so I can see all headers I don't ignore in the following +# rules: +unignore * + +# ignore mbox from header: +ignore "from " + +# ignore trace information headers: +ignore received return-path + +# ignore format and control information headers: +ignore content-disposition mime-version + +# ignore sender and recipient indication headers: +ignore sender +ignore apparently-to x-face x-sender envelope-to + +# ignore response control headers: +ignore reply-to +ignore errors-to followup-to mail-followup-to + +# ignore message identification headers: +ignore in-reply-to references +ignore delivered-to + +# ignore headers containing dates and times: +ignore delivery-date + +# ignore quality information headers: +ignore precedence + +# ignore size information headers: +#ignore +ignore content-length lines + +# ignore encoding information headers: +ignore content-transfer-encoding content-type encoding + +# ignore mailing list control headers: +ignore list-archive list-help list-id list-post list-subscribe \ + list-unsubscribe + +# ignore miscellaneous headers (non standard): +ignore status x-status # mail status, used by mail clients + + +# color settings +# +# thanks to http://www.therandymon.com/woodnotes/mutt/node46.html for the +# settings to allow transparency (default) +# +# thanks to Debian Lenny mutt default files for the color settings + +# normal text: +color normal white default +# mail headers: +color hdrdefault cyan default +# attachments: +color attachment brightyellow default +# marker for the currently selected mail in the index: +color indicator default cyan +# signature (if correctly delimited with "-- "): +color signature cyan default +# status bar (at top and bottom): +color status brightgreen blue +# tildes at the bottom if there is no more content: +color tilde blue default +# thread tree markers: +color tree red default + +# mark quotes: +color quoted magenta default +color quoted1 cyan default +# mark the writer of the quote the same color as the quote: +color body magenta default ".+ <.+> writes:" +color body magenta default "On .+ wrote:" +color body cyan default "> .+ <.+> writes:" +color body cyan default "> On .+ wrote:" + +# mark subject: +color header brightgreen default ^Subject: + +# mark important messages red: +color index white red "~F" + +# mark valid gpg signatures: +color body green default "gpg: Good signature from .+" +# mark invalid gpg signatures: +color body red default "gpg: BAD signature from .+" +# mark encrypted mails: +color body green default "gpg: encrypted with .+" +# mark missing gpg public keys: +color body yellow default "gpg: Can't check signature: public key not found" + +# vim: ft=muttrc diff --git a/mail/mutt/handling b/mail/mutt/handling new file mode 100644 index 0000000..f82f113 --- /dev/null +++ b/mail/mutt/handling @@ -0,0 +1,29 @@ +# muttrc file for mail handling; stores macros and commands + +# Copyright (C) 2007-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# allow the use of in attachment menu to open them: +bind attach view-attach +# allow the use of 'i' to quit the attachment menu: +bind attach i exit + +# when opening the inbox or mailinglists display at first only flagged emails: +# f toggles between flagged/all mails +folder-hook "^(inbox$|lists/)" source ~/.mutt/handling-flagged +#folder-hook . source ~/.mutt/handling-unflagged # FIXME: this doesn't work + +# vim: ft=muttrc diff --git a/mail/mutt/handling-flagged b/mail/mutt/handling-flagged new file mode 100644 index 0000000..d1f4ecd --- /dev/null +++ b/mail/mutt/handling-flagged @@ -0,0 +1,27 @@ +# muttrc file to toggle between flagged an unflagged mails +# when sourced display only flagged emails, next call to f toggles + +# Copyright (C) 2007-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# display only flagged mails: +# un/set beep prevents warnings if there are no flagged messages +push "unset beep~Fset beep" + +# macro to display all mails: +macro index f "source ~/.mutt/handling-unflagged" + +# vim: ft=muttrc diff --git a/mail/mutt/handling-unflagged b/mail/mutt/handling-unflagged new file mode 100644 index 0000000..0a76453 --- /dev/null +++ b/mail/mutt/handling-unflagged @@ -0,0 +1,27 @@ +# muttrc file to toggle between flagged an unflagged mails +# when sourced display all emails, next call to f toggles + +# Copyright (C) 2007-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# display all mails, also go to the next new/unread message: +# un/set beep prevents warnings with next-new-then-unread if there are no unread messages +push ".unset beepset beep" + +# macro to display only flagged mails: +macro index f "source ~/.mutt/handling-flagged" + +# vim: ft=muttrc diff --git a/mail/mutt/load b/mail/mutt/load new file mode 100644 index 0000000..84f0b6d --- /dev/null +++ b/mail/mutt/load @@ -0,0 +1,37 @@ +# muttrc file which loads all rc files + +# Copyright (C) 2007-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# load mail/mailbox settings: +source ~/.mutt/mails + +# load sending settings: +source ~/.mutt/send + +# load macros and commands settings: +source ~/.mutt/handling + +# load display settings: +source ~/.mutt/display + +# load gpg support: +source ~/.mutt/crypto + +# load t-prot support: +source ~/.mutt/t-prot + +# vim: ft=muttrc diff --git a/mail/mutt/mails b/mail/mutt/mails new file mode 100644 index 0000000..22a111c --- /dev/null +++ b/mail/mutt/mails @@ -0,0 +1,54 @@ +# muttrc file for mailbox and email settings + +# Copyright (C) 2007-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# use my inbox as mbox: +set mbox=+inbox-gray + +# store send emails in this mailbox: +set record=+send/outbox +# store postponed mails in this file: +set postponed=+postponed + + +# use the little brother database to get information about emails (no quotes +# around %s!): +set query_command="lbdbq %s" + + +# automatically append emails to other mailboxes: +set confirmappend=no +# automatically delete emails when changing/closing a mailbox: +set delete=yes +# don't ask to move read mails from spool file to mbox: +set move=no + +# automatically quote the message when replying: +set include=yes +# allow editing of headers when sending a mail: +set edit_headers=yes +# make sure autoedit is disabled as it causes problems with several hooks +# (send-hook, reply-hook, crypt-hook, etc.) +set autoedit=no + +# don't mark old new mails as "O", mark them as "N": +set mark_old=no + +# ask before quitting: +set quit=ask-yes + +# vim: ft=muttrc diff --git a/mail/mutt/mlfooters/.gitignore b/mail/mutt/mlfooters/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/mail/mutt/muttrc b/mail/mutt/muttrc new file mode 100644 index 0000000..fffcbc3 --- /dev/null +++ b/mail/mutt/muttrc @@ -0,0 +1,22 @@ +# muttrc configuration file + +# Copyright (C) 2007-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# use account ruderich.com for mutt: +source ~/.mutt/ruderich + +# vim: ft=muttrc diff --git a/mail/mutt/ruderich b/mail/mutt/ruderich new file mode 100644 index 0000000..38c07f9 --- /dev/null +++ b/mail/mutt/ruderich @@ -0,0 +1,62 @@ +# muttrc file for account ruderich.org/ruderich.com + +# Copyright (C) 2007-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# set my identity: +set from=simon@ruderich.org +set realname="Simon Ruderich" +# use this as hostname so the local hostname is not used: +set hostname=ruderich.org + +# set my additional mail addresses: +alternates simon@ruderich.org simon@ruderich.com + + +# use my signature, language dependent: +send-hook . 'set signature=~/.mutt/ruderich-signature' +send-hook '~t\.de$' 'set signature=~/.mutt/ruderich-signature-de' + + +# use ~/mail as my folder: +set folder=~/mail + +# my inboxes so they are checked for new mail: +mailboxes `echo $HOME/mail/inbox*` +# my mailing lists so they are checked for new mail: +mailboxes `echo $HOME/mail/lists/*` + + +# automatically sort after threads in mailing lists: +folder-hook . set sort=date +folder-hook lists set sort=threads +folder-hook programming set sort=threads + +# allow threads in privoxy-requsts: +folder-hook . set sort_re=yes +folder-hook lists/archive/privoxy-requests set sort_re=no + +# allow reading gzip compressed mailboxes: +open-hook \\.gz$ "gzip -cd %f > %t" + + +# load muttrc files: +source ~/.mutt/load + +# Display mutt's version on startup. +push + +# vim: ft=muttrc diff --git a/mail/mutt/ruderich-signature b/mail/mutt/ruderich-signature new file mode 100644 index 0000000..bc63428 --- /dev/null +++ b/mail/mutt/ruderich-signature @@ -0,0 +1,3 @@ ++ privacy is necessary ++ using gnupg http://gnupg.org ++ public key id: 0x92FEFDB7E44C32F9 diff --git a/mail/mutt/ruderich-signature-de b/mail/mutt/ruderich-signature-de new file mode 100644 index 0000000..167b746 --- /dev/null +++ b/mail/mutt/ruderich-signature-de @@ -0,0 +1,3 @@ ++ Privatsphäre ist notwendig ++ Ich verwende GnuPG http://gnupg.org ++ Öffentlicher Schlüssel: 0x92FEFDB7E44C32F9 diff --git a/mail/mutt/send b/mail/mutt/send new file mode 100644 index 0000000..a1cdeed --- /dev/null +++ b/mail/mutt/send @@ -0,0 +1,25 @@ +# muttrc file for sending mails + +# Copyright (C) 2007-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# use vim as editor for sending mails: +set editor=vim + +# use msmtp as MDA: +set sendmail=msmtp + +# vim: ft=muttrc diff --git a/mail/mutt/t-prot b/mail/mutt/t-prot new file mode 100644 index 0000000..d3f4f46 --- /dev/null +++ b/mail/mutt/t-prot @@ -0,0 +1,25 @@ +# $Id: muttrc.t-prot,v 1.9 2002/12/29 03:52:57 jochen Exp $ + +# CHANGES by Simon Ruderich: +# - use my helper script 'mutt-display-filter' +# - work on transparent terminals (default color setting) + + +# This all works only if you have mutt-1.3.12 or newer +# or if you use something like the pagerfilter patch +# (http://www.escape.de/users/tolot/mutt/). +set display_filter='mutt-display-filter' + +# toggle TOFU protection with ESC-0 and ESC-1 +macro generic \e0 ":unset display_filter\n" "Turn TOFU protection off" +macro generic \e1 ":set display_filter='mutt-display-filter'\n" "Turn TOFU protection on" + +# same in pager mode - ugly but what the hell... +macro pager \e0 ":unset display_filter; exec exit\n:exec display-message\n" "Turn TOFU protection off" +macro pager \e1 ":set display_filter='mutt-display-filter'; exec exit\n:exec display-message\n" "Turn TOFU protection on" + +# highlight TOFU protection: +color body brightmagenta default "^\\[---.*" +color body green default "^#v[-+]" + +# vim: ft=muttrc diff --git a/mail/setup.sh b/mail/setup.sh new file mode 100755 index 0000000..2d6e9b2 --- /dev/null +++ b/mail/setup.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +# Setup script for mail configuration files. + +# Copyright (C) 2009-2013 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +. ../lib.sh + + +generate mutt/display .in cat +if mutt -v | grep sidebar >/dev/null 2>&1; then + echo 'mutt/display: enabling mutt sidebar settings' + sed_i 's/^#set sidebar_/set sidebar_/' mutt/display +fi + +# Link setup. +if installed abook; then + link abook ~/.abook +fi +link gnupg ~/.gnupg +if installed lbdb; then + link lbdbrc ~/.lbdbrc +fi +link mailcap ~/.mailcap +link mutt ~/.mutt diff --git a/misc/.gitignore b/misc/.gitignore new file mode 100644 index 0000000..2f5d841 --- /dev/null +++ b/misc/.gitignore @@ -0,0 +1,7 @@ +/ghc/ghci_history +/ghc/x86_64-linux-*/ +/lftp/rl_history +/maxima/maxout.gnuplot_pipes +/psql/history +/psql/psqlrc +/sqlite/sqliterc diff --git a/misc/Makefile b/misc/Makefile new file mode 100644 index 0000000..23d5991 --- /dev/null +++ b/misc/Makefile @@ -0,0 +1,4 @@ +all: + @./setup.sh + +.PHONY: all diff --git a/misc/gdb/README b/misc/gdb/README new file mode 100644 index 0000000..dd2cdbe --- /dev/null +++ b/misc/gdb/README @@ -0,0 +1,34 @@ +README +====== + +Useful gdb commands. + + +`info files` +------------ + +List all (ELF) sections of the running program including address ranges. + +Example output: + + (gdb) info files + Symbols from "/bin/ls". + Unix child process: + Using the running image of child Thread 0x7ffff7fe87a0 (LWP 25058). + While running this, GDB does not access memory from... + Local exec file: + `/bin/ls', file type elf64-x86-64. + Entry point: 0x404880 + 0x0000000000400238 - 0x0000000000400254 is .interp + 0x0000000000400254 - 0x0000000000400274 is .note.ABI-tag + 0x0000000000400274 - 0x0000000000400298 is .note.gnu.build-id + [...] + 0x000000000061afe8 - 0x000000000061b348 is .got.plt + 0x000000000061b360 - 0x000000000061b57c is .data + 0x000000000061b580 - 0x000000000061c300 is .bss + 0x00007ffff7ddd1c8 - 0x00007ffff7ddd1ec is .note.gnu.build-id in /lib64/ld-linux-x86-64.so.2 + 0x00007ffff7ddd1f0 - 0x00007ffff7ddd2a8 is .hash in /lib64/ld-linux-x86-64.so.2 + 0x00007ffff7ddd2a8 - 0x00007ffff7ddd380 is .gnu.hash in /lib64/ld-linux-x86-64.so.2 + 0x00007ffff7ddd380 - 0x00007ffff7ddd608 is .dynsym in /lib64/ld-linux-x86-64.so.2 + 0x00007ffff7ddd608 - 0x00007ffff7ddd784 is .dynstr in /lib64/ld-linux-x86-64.so.2 + [...] diff --git a/misc/gdb/gdbinit b/misc/gdb/gdbinit new file mode 100644 index 0000000..59b79c0 --- /dev/null +++ b/misc/gdb/gdbinit @@ -0,0 +1,37 @@ +# GDB (GNU debugger) configuration file. + +# Copyright (C) 2011-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Save command history. +set history save on +# And save more entries. +set history size 10000 + + +# Set prompt. Bold green "gdb" in parentheses. Trailing whitespace is +# necessary. +set extended-prompt (\[\e[01;32m\]gdb\e[00m\]) + + +# Default output base is 16 (hex). +set output-radix 16 + +# Always disassemble next command/instruction. Very useful when debugging code +# without debug information. +set disassemble-next-line on + +# vim: ft=gdb diff --git a/misc/ghc/ghci b/misc/ghc/ghci new file mode 100644 index 0000000..0584d16 --- /dev/null +++ b/misc/ghc/ghci @@ -0,0 +1,20 @@ +-- ghci configuration file. + +-- Copyright (C) 2014 Simon Ruderich +-- +-- This file 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 file is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this file. If not, see . + + +-- Don't display loaded modules in prompt. +:set prompt "ghci> " diff --git a/misc/lftp/rc b/misc/lftp/rc new file mode 100644 index 0000000..ac70f49 --- /dev/null +++ b/misc/lftp/rc @@ -0,0 +1,70 @@ +# lftp configuration file. + +# Copyright (C) 2007-2013 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# SETTINGS + +# Display all files (including hidden ones) with `ls`. +set ftp:list-options -a + +# Enable colors in interactive mode. Used by e.g. directory listings (which +# use $LS_COLORS). +set color:use-color auto + +# Use a colorized prompt. Hostname in bold green, current directory in bold +# blue. +set cmd:prompt "lftp \[\e[01;32m\]\h\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\] % " + + +# Store passwords in the bookmarks file. +set bmk:save-passwords yes + +# Don't store current directory of each server in ~/.lftp/cwd_history. +set cmd:save-cwd-history no +# Don't store transfer logs in ~/.lftp/transfer_log. +set xfer:log no + + +# No retries after a failed connection, prevents (long) delays e.g. for +# automated jobs. +set net:max-retries 1 + +# If SSL is used make sure the data connection is encrypted as well. This +# should be the default behavior!. +set ftp:ssl-protect-data yes +set ftp:ssl-protect-fxp yes +# Same for control connections (default). +set ftp:ssl-protect-list yes +# Make sure SSL is not dropped after a successful login (default). +set ftp:ssl-use-ccc no +# And verify the certificate and hostname, otherwise encryption doesn't matter +# (default). +set ssl:check-hostname yes +set ssl:verify-certificate yes + + +# ALIASES + +# Create "sync" command which syncs local directories with remote ones and +# transfers all missing/outdated files. Local files which don't exist anymore +# are removed on the server. +alias sync mirror --verbose --reverse --delete --dereference + +# Create commands to go up directories. +alias .. cd .. +alias ... cd ../.. +alias .... cd ../../.. diff --git a/misc/maxima/maxima-init.lisp b/misc/maxima/maxima-init.lisp new file mode 100644 index 0000000..fefdadd --- /dev/null +++ b/misc/maxima/maxima-init.lisp @@ -0,0 +1,24 @@ +; Maxima (computer algebra system) configuration file, lisp part. +; +; Also have a look at maxima/maxima-init.mac. + +; Copyright (C) 2011-2012 Simon Ruderich +; +; This file 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 file is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this file. If not, see . + + +; Set directory for temporary files to ~/.maxima (used for plotting for +; example). Thanks to rootzlevel in #faui2k9 on IRCnet (2011-05-28 21:52 CET). +(setf *maxima-tempdir* + (namestring (merge-pathnames ".maxima/" (user-homedir-pathname)))) diff --git a/misc/maxima/maxima-init.mac b/misc/maxima/maxima-init.mac new file mode 100644 index 0000000..1dedac1 --- /dev/null +++ b/misc/maxima/maxima-init.mac @@ -0,0 +1,46 @@ +/* + * Maxima (computer algebra system) configuration file, Maxima part. + * + * Also have a look at maxima/maxima-init.lisp. + * + * Notes: + * + * Solve Ax = b, thanks to Florian. + * + * A : matrix([1,2,0],[0,2,3],[0,0,4])$ + * b : matrix([1],[3],[5])$ + * linsolve_by_lu(A,b); + */ + +/* + * Copyright (C) 2011-2012 Simon Ruderich + * + * This file 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 file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this file. If not, see . + */ + + +/* CUSTOM FUNCTIONS */ + +/* Didn't find any euclid norm in Maxima, so here it is. */ +norm(x) := sqrt(transpose(x) . x); + +/* Maxima's mat_norm() can't calculate the 2-norm. Thanks to Wolfgang Lindner + * (http://www.ma.utexas.edu/pipermail/maxima/2007/006300.html) for an + * improved version. */ +mat_norm2(x) := sqrt(lmax(eigenvalues(transpose(conjugate(x)) . x)[1])); + +/* Shortcut to perform lu factorization. */ +lu(x) := block(x : lu_factor(x), get_lu_factors(x)); + +/* vim: ft=maxima */ diff --git a/misc/mysql/my.cnf b/misc/mysql/my.cnf new file mode 100644 index 0000000..2c2f29b --- /dev/null +++ b/misc/mysql/my.cnf @@ -0,0 +1,21 @@ +# MySQL client configuration file. + +# Copyright (C) 2009-2013 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +[mysql] +# Always use the pager. +pager diff --git a/misc/perl/perlcriticrc b/misc/perl/perlcriticrc new file mode 100644 index 0000000..6fb1f06 --- /dev/null +++ b/misc/perl/perlcriticrc @@ -0,0 +1,62 @@ +# perlcritic configuration file + +# Copyright (C) 2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Be strict about errors in ~/.perlcriticrc. +profile-strictness = fatal + +# Display all errors/warnings by default. +severity = brutal + +# Use colored output. +color = 1 + + +# IMHO 'x' is more readable than q{x}, so ignore this warning. +[-ValuesAndExpressions::ProhibitNoisyQuotes] +# Same for '', ignore it too. +[-ValuesAndExpressions::ProhibitEmptyQuotes] + +# I know how /s, /x and /m work (and expect that from others), ignore these +# warnings. +[-RegularExpressions::RequireDotMatchAnything] +[-RegularExpressions::RequireExtendedFormatting] +[-RegularExpressions::RequireLineBoundaryMatching] + +# I prefer exact line numbers in errors, allow die instead of croak. I don't +# develop perl modules so it shouldn't be a problem. +[-ErrorHandling::RequireCarping] + +# IMHO "print $FH ..." is readable enough, "print {$FH} ..." is not necessary. +[-InputOutput::RequireBracedFileHandleWithPrint] + +# Don't require checks for print's return value. I check the return value of +# other functions like open() or close(), but checking every print is just a +# waste of time. +[InputOutput::RequireCheckedSyscalls] +functions = :builtins +exclude_functions = print + +# IMHO punctuation variables are more readable than their English counterparts +# (and faster in some cases). So allow the ones I use often. +[Variables::ProhibitPunctuationVars] +allow = $0 $! $? $. $@ $/ $" $+ $- + +# Allow the usage of ".." when '..' occurs inside the string, e.g. in strings +# like ".. '..' ..". +[ValuesAndExpressions::ProhibitInterpolationOfLiterals] +allow_if_string_contains_single_quote = 1 diff --git a/misc/psql/psqlrc.in b/misc/psql/psqlrc.in new file mode 100644 index 0000000..23cc2d9 --- /dev/null +++ b/misc/psql/psqlrc.in @@ -0,0 +1,52 @@ +-- Postgresql client configuration file. + +-- Copyright (C) 2016 Simon Ruderich +-- +-- This file 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 file is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this file. If not, see . + + +-- Shut up \pset during this config script. +\set QUIET on + +-- Automatically switch to vertical mode when the columns don't fit on screen. +\pset expanded auto + +-- Use unicode characters for borders. +\pset linestyle unicode + +-- Per default NULL values are not displayed, use a replacement string to +-- prevent mistaken them for an empty string. +\pset null 「NULL」 + +-- Don't abort transactions in interactive mode when an error occurs. As the +-- error is displayed no information is lost and this saves one from having to +-- restart the transaction on a typo in a statement. +\set ON_ERROR_ROLLBACK interactive + +-- "ignorespace ignoredups" +\set HISTCONTROL ignoreboth +-- Set path to history file and increase it. +\set HISTFILE HISTFILE_PATH +\set HISTSIZE 100000 + +-- Add transaction status (%x) to prompt; show database name in bold green. +\set PROMPT1 '%x%[%033[01;32m%]%/%[%033[00m%]%R%# ' +-- Remove database from second prompt to make it easily distinguishable from +-- PROMPT1. +\set PROMPT2 '%x%R%# ' + +-- But display the normal psql welcome message. +\set QUIET off + +-- vim: ft=sql diff --git a/misc/setup.sh b/misc/setup.sh new file mode 100755 index 0000000..c04bc52 --- /dev/null +++ b/misc/setup.sh @@ -0,0 +1,68 @@ +#!/bin/sh + +# Setup script for miscellaneous configuration files. + +# Copyright (C) 2009-2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +. ../lib.sh + + +# gdb, GNU debugger. +if installed gdb; then + link gdb/gdbinit ~/.gdbinit +fi + +# ghc(i), Glasgow Haskell Compilation. +if installed ghci; then + link ghc ~/.ghc + link ghc/ghci ~/.ghci +fi + +# Powerful FTP client. +if installed lftp; then + link lftp ~/.lftp +fi + +# Maxima, a symbolic algebra program. +if installed maxima; then + link maxima ~/.maxima +fi + +if installed psql; then + generate psql/psqlrc .in simple_cpp \ + HISTFILE_PATH -- "`pwd`/psql/history" + sed_i 's/^#/--/' psql/psqlrc + link psql/psqlrc ~/.psqlrc +fi + +# MySQL client. +if installed mysql; then + link mysql/my.cnf ~/.my.cnf +fi + +if installed sqlite3; then + # sqlite3 doesn't support any comments in sqliterc. + grep -v -E '^#' sqlite/sqliterc.in >sqlite/sqliterc + link sqlite/sqliterc ~/.sqliterc +fi + +# perlcritic to check Perl programs for common problems. +if installed perlcritic; then + link perl/perlcriticrc ~/.perlcriticrc +fi diff --git a/misc/sqlite/sqliterc.in b/misc/sqlite/sqliterc.in new file mode 100644 index 0000000..f8bfa58 --- /dev/null +++ b/misc/sqlite/sqliterc.in @@ -0,0 +1,28 @@ +# sqlite3 configuration file. +# +# sqlite3 doesn't support comments in ~/.sqliterc. They must be stripped +# before using this file. + +# Copyright (C) 2014 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Enable column output mode with headers. Used for SELECT statements and makes +# them more readable. +.mode column +.headers on + +# Display NULL value as "NULL". +.nullvalue NULL diff --git a/.gitignore b/multimedia/.gitignore similarity index 100% rename from .gitignore rename to multimedia/.gitignore diff --git a/multimedia/Makefile b/multimedia/Makefile new file mode 100644 index 0000000..23d5991 --- /dev/null +++ b/multimedia/Makefile @@ -0,0 +1,4 @@ +all: + @./setup.sh + +.PHONY: all diff --git a/handbrake/preferences b/multimedia/handbrake/preferences similarity index 100% rename from handbrake/preferences rename to multimedia/handbrake/preferences diff --git a/handbrake/presets b/multimedia/handbrake/presets similarity index 100% rename from handbrake/presets rename to multimedia/handbrake/presets diff --git a/mplayer/config b/multimedia/mplayer/config similarity index 100% rename from mplayer/config rename to multimedia/mplayer/config diff --git a/mplayer/input.conf b/multimedia/mplayer/input.conf similarity index 100% rename from mplayer/input.conf rename to multimedia/mplayer/input.conf diff --git a/mplayer2/config b/multimedia/mplayer2/config similarity index 100% rename from mplayer2/config rename to multimedia/mplayer2/config diff --git a/mplayer2/input.conf b/multimedia/mplayer2/input.conf similarity index 100% rename from mplayer2/input.conf rename to multimedia/mplayer2/input.conf diff --git a/mpv/input.conf b/multimedia/mpv/input.conf similarity index 100% rename from mpv/input.conf rename to multimedia/mpv/input.conf diff --git a/mpv/mpv.conf b/multimedia/mpv/mpv.conf similarity index 100% rename from mpv/mpv.conf rename to multimedia/mpv/mpv.conf diff --git a/multimedia/setup.sh b/multimedia/setup.sh new file mode 100755 index 0000000..dd6e929 --- /dev/null +++ b/multimedia/setup.sh @@ -0,0 +1,63 @@ +#!/bin/sh + +# Setup script for multimedia configuration files. + +# Copyright (C) 2011-2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +. ../lib.sh + + +# MPlayer and MPlayer2 use the same configuration directory. +if installed mplayer; then + cleanup() { + if test -h ~/.mplayer; then + # Setup already done. + return + fi + # Try to remove a default config file from ~/.mplayer. Necessary + # because it's also created by mplayer --help. + if test -f ~/.mplayer/config; then + sha=`shasum ~/.mplayer/config | awk '{print $1}'` + if test x"$sha" = x60f98ca2f1f3f81ce3ea2aa3e0e85e8c57e7db40; then + rm ~/.mplayer/config + else + echo '~/.mplayer/config: found modifications, aborting' >&2 + exit 1 + fi + fi + rmdir ~/.mplayer 2>/dev/null || true + } + + if mplayer --help | grep MPlayer2 >/dev/null; then + cleanup + link mplayer2 ~/.mplayer + else + cleanup + link mplayer ~/.mplayer + fi +fi +# Another MPlayer fork, but developed separately with a different config +# directory. +if installed mpv; then + link mpv ~/.config/mpv +fi + +if installed handbrake; then + link handbrake ~/.config/ghb +fi diff --git a/os/.gitignore b/os/.gitignore new file mode 100644 index 0000000..d19959a --- /dev/null +++ b/os/.gitignore @@ -0,0 +1,4 @@ +# Ignore files created by setup.sh. +/debian/aptitude/config +# Ignore temporary files. +/debian/aptitude/cache diff --git a/os/Makefile b/os/Makefile new file mode 100644 index 0000000..23d5991 --- /dev/null +++ b/os/Makefile @@ -0,0 +1,4 @@ +all: + @./setup.sh + +.PHONY: all diff --git a/os/darwin/environment.plist b/os/darwin/environment.plist new file mode 100644 index 0000000..6c87ec5 --- /dev/null +++ b/os/darwin/environment.plist @@ -0,0 +1 @@ +{ PATH = "/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin"; } diff --git a/os/debian/aptitude/config.in b/os/debian/aptitude/config.in new file mode 100644 index 0000000..2030dfb --- /dev/null +++ b/os/debian/aptitude/config.in @@ -0,0 +1,50 @@ +// Aptitude configuration file. + +// Copyright (C) 2009-2013 Simon Ruderich +// +// This file 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 file is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this file. If not, see . + + +aptitude { + UI { + // Only display menubar when it's active. + Menubar-Autohide "true"; + // Don't display often used commands as help, I know them. + HelpBar "false"; + + // Use normal grouping with origin (~O) package as new top level. + // Thanks to hark in #debian on Freenode (2009-04-02 19:14) and + // http://noone.org/blog/English/Computer/Debian/Group%20by%20origin%20in%20aptitude.futile + // the site he pointed me to. + //Default-Grouping "task,status,pattern(~O, !~O => other),section(subdirs,passthrough),section(topdir)"; + // Same as Default-Grouping but only display packages which are + // changed (so no upgradeable are shown). + //Default-Preview-Grouping "pattern(~O),action,section(topdir),filter(~ainstall | ~aupgrade | ~adowngrade | ~aremove | ~apurge | ~ahold)"; + + // Pause before installing any packages. + Pause-After-Download "Yes"; + } + + // Don't display a warning when performing changes (add new packages, + // etc.) in read only mode. + Suppress-Read-Only-Warning "true"; +} + +Apt { + // Don't install recommended packages by default. The most annoying + // aptitude default! + Install-Recommends "false"; +} + +// vim: ft=cfg diff --git a/os/debian/bin/backup.sh b/os/debian/bin/backup.sh new file mode 100755 index 0000000..4b9bffa --- /dev/null +++ b/os/debian/bin/backup.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +# Backup all important system-relevant data of a Debian system. +# +# The list of installed packages can be extracted from /var/lib/dpkg/status. + +# Copyright (C) 2013 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +# tar can't exclude it automatically because we pipe it through gpg. +target="`pwd`/`hostname`.tar.gpg" + +tar cf - \ + --exclude /root/apt \ + --exclude /var/cache \ + --exclude /var/www \ + --exclude "$target" \ + --exclude "$target.tmp" \ + /etc /root /var \ + | gpg --encrypt --sign --recipient 0x95AC608FB0863F79 \ + >"$target.tmp" +mv "$target.tmp" "$target" diff --git a/os/debian/bin/init-reprepro.sh b/os/debian/bin/init-reprepro.sh new file mode 100755 index 0000000..4014dc4 --- /dev/null +++ b/os/debian/bin/init-reprepro.sh @@ -0,0 +1,90 @@ +# Setup a reprepro repository in /root/apt and add it to +# /etc/apt/sources.list. + +# Copyright (C) 2013 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +sources=/etc/apt/sources.list +repo=/root/apt + +# Don't look for exact "file://$repo" match to allow modifications on the +# system. +if grep -E '^deb file:///' "$sources" >/dev/null 2>&1; then + echo "file:/// already present in '$sources'!" >&2 + exit 1 +fi + +# Create signing key for the repository if necessary. +email="apt@`hostname`" +if ! gpg --list-keys "$email" >/dev/null 2>&1; then + # See doc/DETAILS in the gpg source tree for documentation. + gpg --gen-key --batch </dev/null \ + || grep -E '^deb' "$sources" | head -n1 | awk '{ print $3 }'` + +# Create reprepro repository. +if test ! -d "$repo"; then + echo "creating reprepro repository in '$repo'" >&2 + mkdir -p "$repo/conf" + mkdir -p "$repo/morgue" + + arch="`dpkg --print-architecture` `dpkg --print-foreign-architectures`" + cat >"$repo/conf/distributions" <"$repo/conf/options" <&2 + ( cd "$repo" && reprepro export ) || true + + # Does nothing if the same key is imported multiple times. + echo 'Adding key with apt-key.' >&2 + gpg --export "$keyid" | apt-key add - +fi + +echo "deb file://$repo $codename main" >>"$sources" + +echo 'Finished successfully'. >&2 diff --git a/os/debian/reportbugrc b/os/debian/reportbugrc new file mode 100644 index 0000000..e5d3ef1 --- /dev/null +++ b/os/debian/reportbugrc @@ -0,0 +1,51 @@ +# reportbug preferences file. + +# Copyright (C) 2009-2014 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# character encoding: UTF-8 +# Version of reportbug this preferences file was written by +reportbug_version "6.5.0" + +# Use advanced operating mode which asks more questions than the default +# (novice). +mode advanced + +# Use text interface, simple and powerful. +ui text + +# Use `debsums` to verify the integrity of the package before reporting a bug. +verify + +# Name and email settings. +realname "Simon Ruderich" +email "simon@ruderich.org" + +# Use Debian's SMTP server. +smtphost reportbug.debian.org +# Encrypt connection to SMTP server. +smtptls + +# Sign bug reports using GnuPG. Ignored when a MUA (like mutt) is used. +sign gpg + +# Display complete mail before sending it. Not used with mutt. +paranoid + +# Use mutt as MUA to send the mails. +mutt +# And use mutt to read mboxes. +mbox_reader_cmd "mutt -f %s" diff --git a/os/nocreeps.pub b/os/nocreeps.pub new file mode 100644 index 0000000..1a31e9b --- /dev/null +++ b/os/nocreeps.pub @@ -0,0 +1,52 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.14 (GNU/Linux) + +mQINBE8LTUsBEACl2SCqlpAreByr6SwcrDlfCLLUdg/Rb/NoBf+q+5L1CHRQNhg0 +8anYiGE2EWnkTkPINJbtbrlhTBR1g3xmMqcOGNffUWgBAlN9OLg/aZRamOYXMf10 +swKrjcdsc4dh0i+1uUK//IIkP5JZg8Ay5825pWBBG3WMSDB5/Ax88DmasMz+y3ba +BhBfpI8k9/RO3RG4oEEb/iGAOeJmLVdch2WB5uAICTnkLcDbDHj7pybw56dNWwc5 +Z0glMKMoav9bkK6Ut/SH4I+G3N7voNWIgQoOYGk4H/qv3DeZtafxH0f+DXq2yGQC +WijUpZznIi9PicK+9sioMYmbjtwZ2OmivUyENknWUu/swDQsX3soj2VmGsB30Eso +TTisj+M3xejLQAY+5ZchZpNeFxhhwZIfG7G1aHyDsIcU14INetUtGdt8263zIPIs +fQwprAs5YrI2lX2fmQmnmD5rlq2EggjWqHjBX6FjIG/8AYkpTspuW+L6Ctvt7DdN +S5JtpdfLiQlljBEvo4bU1UP9zZLR5THDMQzIBy49PkPp5oeO/xsmKleSqNYvyGDh +cFk4PwEufe3DtJsk9yvcMlEBIpCKZUeW75TZt8cFEJsGDBveZ0IJjK56e6+MGmLG +vS3e/jrKZnHW+jFrhYi2W35KScuBBtnOmiMcSZF0ReCe4OfgN3mL/E8caQARAQAB +tBdub2NyZWVwcyBlbmNyeXB0aW9uIGtleYkCPgQTAQIAKAUCTwtNSwIbAwUJBaOa +gAYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQlaxgj7CGP3k9MA//bQRDdkFk +mWr7IQH2JzTcxYkXNI3v8dK3EQ9DydehP7nHNhP4Aa+Ntcz4Xkl16Bw43UweAVbo +5JhLjwiSteimW+gUP8W8nsFLjDUfylvKwyPqlTJGFEhXZEF4SAh8Bnd7bqn+81v2 +ZbYpFQNNTrs6h/auOWsMStXGXorn3Wzq2pc06x+d44dFkvduD22uJMK4yonmfE5D +lbkYT4phQDhZmTDTDABR2psKr6TAESb8J/GNRn1Lyytmt1vODMQK8gcnWMr13kPK +CA1MDr3hoDHxprBUfqy8dNSsGFCM/KTHoL7hgmrHWvnNj3l5pfP3aBRm0SZjujMs +NWHfhRHlLMreOPFPMokukznyD3VypEBmie55TWpJ+qIzkOpRPRz1wB6qvXTvtjB1 +mcIM7We6IwdFrUmm39soWXnUKhFXEi4R3+K09dGqIFclKD00RO7/n6/yKbRY/N86 +DzXSkHQL4cP0t35faHLvhSeMdpQk+nubGCMX/6H4V4P8u+GeEH6fvA3HgH7crjyv +waiGjtxIIXaT8Gicbgetr1t3KGv7CD/eYWxYCJ3tSSbXRc9vWYq4DG/XxKMr7bV6 +YICYnOePeS51djJ+6snMkEq+6MN3FFJJhLJXsOwFhbCT2zhs8/HTc2M3Ssk7FyYa +yxIXvLJGsjtGjAYkxthonpN7PVsefjntVNC5Ag0ETwtNSwEQALJhES5JDyMFY2lH +gn1PaB3swmqgQeIDMllL293xCocJMJXYahESUWJueSizl7ZdKPVK/nmNGzm3H3Hv +XyFE1tux9dDoKHYNYh+XTWyHboWnyM2OpS7ypWPt3oE6qiVJCwfs68wL1HPxViJ6 +DB+C0WxsZNEjusIXPRfExNO9vqAbVg0K5NauWI64LCD39l4xXhJ+zNhFlkYoysMW +oq0e9ngVDeLS5VCZ4SDJPoQk/eqluMl0qBUp2Dixlf+TbjtWkVJT+nA22CGj7eXN +Vk3NDKhpgtfc0/vX0fP1XApkeadLF6lFIogiKLuSperXMckXWfRn4BUUlmuB8W0z +xHF1JziWR1QqXmUK8I2dFLVwBZUfcQrIiAs6CRW88++Kc+GoKU1idcIbDNhz14uU +5ZEzdvZYJJwttA1sofW2orzPyXmCSI/8bFD8GXANUw59fmt+KR3RGRWaVPK3Qm37 +VrQ8/koCWQHagyEdLYraFUi5wYaHm40JPck0Edb+A0HgbxlqtbLIZYYF2lwmNnjQ +bcXam60P1qColbKWr6ZUOfuVOFeeCrOzAJOiJeO8xREf4u7F50WFPWZbu/iPQFdM +B5NwzxFVWz1e8JKSQApP9lUcygq0uNBCPBCr77upXlcAgFED/CD4pk443qVtdvLZ +vpbZU/QSou0ZHr1u+15G+63Vkk2BABEBAAGJAiUEGAECAA8FAk8LTUsCGwwFCQWj +moAACgkQlaxgj7CGP3mkDg/+Me0zXwcsau8oP/rxzRl7UrgcCtqhzvd9rK7tMNQ1 +Fr8k+mOe6nY7+wfNs9bLb6eki9rtAiz1Hs+nkAA6RqxutF2CSd1ZpNC2rB++gBEI +mpQ8gGmSGoxTavr2Gd06oGPkTJ82e8ozqHvf8ZJQcyHzBIgyOS5dNe7JVvjv9/XS +80tfwlUwADjDrXXweAkN6uq9E5pqD1W5VOGewvWOC+vRwjQBBOE260O9+lOeMn8Y +1OlUI91abfWoyp7/ubcnW4HrNXuUMnMVGGJ+SbpbIG32/4+zWt8836eI9N5sceH7 +rwZds1FQ3eBmy+6S2ArF5YXddOGZ/SRq2wnOg/hQOOmQt2ILTKSyByfAic1SoDWI +/LW3BnVDouIZaYjlz1DxqPMeiz810rOca6kUL+8GptdvD8QSl3DWtYrkXuJa0IyZ +N/C08F6trwhL+qJtJ4lSSFATTKy/3Qt4la+B1qrNRlFvmo1rK25gNsrkjeMnjdo5 +F1+tz/7gpE0mj/h7T85oPnP5Pbm4939WW5YQ2bRoL5AMtJTvBqQPrSXdazUlZd0s +f7GyOvvyrHX51ij0S+vzMY1VtlW2ch0YprR3tgPmpnj+eidpQbZpcoXfbOK5Ub9J +b6JNPKIXmZUIVWaQXU19cLVbBM8QLCrWJ1oAymgnsFb4N9ELFnj8RJTlEtPnxTeR +LlQ= +=6ozN +-----END PGP PUBLIC KEY BLOCK----- diff --git a/os/setup.sh b/os/setup.sh new file mode 100755 index 0000000..dc3a341 --- /dev/null +++ b/os/setup.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +# Setup script for OS related configuration files. + +# Copyright (C) 2009-2013 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +. ../lib.sh + + +if test x"`os`" = xdarwin; then + # Sets a custom PATH for GUI applications. + mkdir -p ~/.MacOSX + link darwin/environment.plist ~/.MacOSX/environment.plist +fi +if test x"`os`" = xdebian; then + # Necessary as aptitude rewrites the config file on every start. + generate debian/aptitude/config .in cat + # aptitude/config uses // as comment instead of #. + sed_i 's|^#|//|' debian/aptitude/config + + link debian/aptitude ~/.aptitude + if installed reportbug; then + link debian/reportbugrc ~/.reportbugrc + fi +fi diff --git a/setup.sh b/setup.sh index dd6e929..d2a3815 100755 --- a/setup.sh +++ b/setup.sh @@ -1,8 +1,9 @@ #!/bin/sh -# Setup script for multimedia configuration files. +# Runs setup.sh in all configuration directories. Must be run in the main +# configuration directory. -# Copyright (C) 2011-2014 Simon Ruderich +# Copyright (C) 2009-2018 Simon Ruderich # # 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 @@ -20,44 +21,15 @@ set -eu -. ../lib.sh +for path in */setup.sh; do + # Skip non executable setup.sh files as an easy way to deactivate one. + test ! -x "$path" && continue + project=`printf '%s' "$path" | sed 's|/setup.sh$||'` -# MPlayer and MPlayer2 use the same configuration directory. -if installed mplayer; then - cleanup() { - if test -h ~/.mplayer; then - # Setup already done. - return - fi - # Try to remove a default config file from ~/.mplayer. Necessary - # because it's also created by mplayer --help. - if test -f ~/.mplayer/config; then - sha=`shasum ~/.mplayer/config | awk '{print $1}'` - if test x"$sha" = x60f98ca2f1f3f81ce3ea2aa3e0e85e8c57e7db40; then - rm ~/.mplayer/config - else - echo '~/.mplayer/config: found modifications, aborting' >&2 - exit 1 - fi - fi - rmdir ~/.mplayer 2>/dev/null || true + printf 'running setup.sh in "%s"\n' "$project" + ( cd "$project" && ./setup.sh >/dev/null ) || { + printf '%s/setup.sh failed\n' "$project" >&2 + exit 1 } - - if mplayer --help | grep MPlayer2 >/dev/null; then - cleanup - link mplayer2 ~/.mplayer - else - cleanup - link mplayer ~/.mplayer - fi -fi -# Another MPlayer fork, but developed separately with a different config -# directory. -if installed mpv; then - link mpv ~/.config/mpv -fi - -if installed handbrake; then - link handbrake ~/.config/ghb -fi +done diff --git a/shell/.gitignore b/shell/.gitignore new file mode 100644 index 0000000..c08e6d5 --- /dev/null +++ b/shell/.gitignore @@ -0,0 +1,17 @@ +# Ignore generated files. +/digrc +/htoprc +/screenrc +/shell/aliases +/shell/dircolors +/tmux.conf +/tmux-window1.conf +/tmux-window2.conf +# Ignore temporary files. +/lesshistory +/zsh/cache +/zsh/history* +# Ignore unimportant files. +/crontab.d/crontab.dotfiles-vim +/crontab.d/crontab.jobs +/zsh/libcoloredstderr.so diff --git a/shell/Makefile b/shell/Makefile new file mode 100644 index 0000000..23d5991 --- /dev/null +++ b/shell/Makefile @@ -0,0 +1,4 @@ +all: + @./setup.sh + +.PHONY: all diff --git a/shell/bash/logout b/shell/bash/logout new file mode 100644 index 0000000..12f1e5d --- /dev/null +++ b/shell/bash/logout @@ -0,0 +1,21 @@ +# Bash logout file. + +# Copyright (C) 2011-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +source_config ~/.shell/logout + +# vim: ft=sh diff --git a/shell/bash/profile b/shell/bash/profile new file mode 100644 index 0000000..db373e9 --- /dev/null +++ b/shell/bash/profile @@ -0,0 +1,23 @@ +# Bash login configuration file. + +# Copyright (C) 2011-2014 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +if [[ -f ~/.bashrc ]]; then + . ~/.bashrc +fi + +# vim: ft=sh diff --git a/shell/bash/rc b/shell/bash/rc new file mode 100644 index 0000000..d876fe9 --- /dev/null +++ b/shell/bash/rc @@ -0,0 +1,46 @@ +# Main bash configuration file. +# +# Is sourced by all interactive bash shells and other shells like scp or rcp. + +# Copyright (C) 2011-2013 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +. ~/.shell/functions + +source_config ~/.shell/env + + +# Check if this is an interactive shell. Abort if not to prevent problems with +# scp and rcp. Taken from default Debian bashrc. Thanks. +if [[ $- != *i* ]]; then + return +fi + + +# Set the prompt; hostname and current working directory are displayed. +# Hostname is displayed in bold green, current directory in yellow. +PS1='\[\033[01;32m\]\h\[\033[00m\]:\[\033[33m\]\w\[\033[00m\] \$ ' + +# Use Vi(m) style readline mappings in bash. +set -o vi + + +source_config ~/.shell/aliases +source_config ~/.shell/rc + +source_config ~/.bash/rc.local + +# vim: ft=sh diff --git a/shell/bin/README b/shell/bin/README new file mode 100644 index 0000000..ad0164a --- /dev/null +++ b/shell/bin/README @@ -0,0 +1,7 @@ +README +====== + +Contains shell related programs useful on all computers. Wrapper scripts are +prefixed with "s". All programs are licensed under GPL v3+. + +Available through a symbolic link in shell: ~/.shell/bin/ diff --git a/shell/bin/battery.pl b/shell/bin/battery.pl new file mode 100755 index 0000000..c7e812e --- /dev/null +++ b/shell/bin/battery.pl @@ -0,0 +1,94 @@ +#!/usr/bin/perl + +# Copyright (C) 2011-2013 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +use strict; +use warnings; + + +if (scalar @ARGV != 1 and (scalar @ARGV != 2 or not $ARGV[0] =~ /-[st]/)) { + print STDERR "Usage: $0 [-s | -t] \n"; + print STDERR "\n"; + print STDERR "Normally this is /sys/class/power_supply/BAT*.\n"; + exit 1; +} +if (scalar @ARGV == 1) { + @ARGV = ('', $ARGV[0]); +} + +my $path = "$ARGV[1]/uevent"; + +# No battery available. +if (not -e $path) { + print STDERR "'$path' not found.\n"; + exit 1; +} + +my $screen_mode = ($ARGV[0] eq '-s'); +my $tmux_mode = ($ARGV[0] eq '-t'); + +my %battery; + +open my $file, '<', $path or die $!; +while (<$file>) { + /^POWER_SUPPLY_([A-Z_]+)=(.+)$/; + $battery{$1} = $2; +} +close $file or die $!; + +# New names ... +if (defined $battery{ENERGY_NOW}) { + $battery{CHARGE_NOW} = $battery{ENERGY_NOW}; + $battery{CHARGE_FULL} = $battery{ENERGY_FULL}; +} + +my $charge = int($battery{CHARGE_NOW} / $battery{CHARGE_FULL} * 100); +my $charging = ''; +if ($battery{STATUS} eq 'Charging' or $battery{STATUS} eq 'Full') { + $charging = '^'; +} + +# GNU screen mode with colors: 0-20 red, 20-40 yellow, 40-100 green. +if ($screen_mode) { + my $color; + if ($charge < 20) { + $color = 'b r'; + } elsif ($charge < 40) { + $color = 'b y'; + } else { + $color = 'b g'; + } + + print "\005{+$color}$charge%\005{-}$charging\n"; + +# Same in tmux mode. +} elsif ($tmux_mode) { + my $color; + if ($charge < 20) { + $color = 'red'; + } elsif ($charge < 40) { + $color = 'yellow'; + } else { + $color = 'green'; + } + + print "#[fg=$color,bold]$charge%#[default]$charging\n"; + +# Plain text output. +} else { + print "$charge%$charging\n"; +} diff --git a/shell/bin/calc b/shell/bin/calc new file mode 100755 index 0000000..ea3cbd3 --- /dev/null +++ b/shell/bin/calc @@ -0,0 +1,49 @@ +#!/bin/sh + +# Copyright (C) 2011-2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +exec python -i -c ' + +# Math functions. +from math import * + +def ld(x): + return log(x)/log(2) +def lg(x): + return log10(x) + +def binom(n,k): + return reduce(lambda a,b: a*(n-b)/(b+1),xrange(k),1) + +# Convert number to scientific notation (e.g. 5e6). +def s(x): + print "%e" % x + + +# Time/Date functions. +import time + +# Convert time in seconds since epoch to readable string. +def stime(seconds): + print time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(seconds)) + + +print "Welcome to the ultimate calculator."' + +# vim: ft=python diff --git a/shell/bin/chronic b/shell/bin/chronic new file mode 100755 index 0000000..a9fa47b --- /dev/null +++ b/shell/bin/chronic @@ -0,0 +1,84 @@ +#!/usr/bin/perl + +=head1 NAME + +chronic - runs a command quietly unless it fails + +=head1 SYNOPSIS + +chronic COMMAND... + +=head1 DESCRIPTION + +chronic runs a command, and arranges for its standard out and standard +error to only be displayed if the command fails (exits nonzero or crashes). +If the command succeeds, any extraneous output will be hidden. + +A common use for chronic is for running a cron job. Rather than +trying to keep the command quiet, and having to deal with mails containing +accidental output when it succeeds, and not verbose enough output when it +fails, you can just run it verbosely always, and use chronic to hide +the successful output. + + 0 1 * * * chronic backup # instead of backup >/dev/null 2>&1 + +=head1 AUTHOR + +Copyright 2010 by Joey Hess + +Original concept and "chronic" name by Chuck Houpt. + +Licensed under the GNU GPL version 2 or higher. + +=cut + +use warnings; +use strict; +use IPC::Run qw( start pump finish timeout ); + +if (! @ARGV) { + die "usage: chronic [-l LOGFILE] COMMAND...\n"; +} + +my $logfile; +if (@ARGV >= 3 and $ARGV[0] eq '-l') { + $logfile = $ARGV[1]; + shift @ARGV; + shift @ARGV; +} + +my ($out, $err); +my $h = IPC::Run::start \@ARGV, \*STDIN, \$out, \$err; +$h->finish; +my $ret=$h->full_result; + +if (defined $logfile) { + open my $fh, '>', $logfile + or showout_and_die("failed to open logfile '$logfile'"); + print $fh $err; # stderr is more interesting, show it first + print $fh $out; + close $fh + or showout_and_die("failed to close logfile '$logfile'"); +} + +if ($ret >> 8) { # child failed + showout(); + exit ($ret >> 8); +} +elsif ($ret != 0) { # child killed by signal + showout(); + exit 1; +} +else { + exit 0; +} + +sub showout { + print STDOUT $out; + print STDERR $err; +} +sub showout_and_die { + my $errno = $!; + showout(); + die "chronic: $_[0]: $errno\n"; +} diff --git a/shell/bin/chronic-log b/shell/bin/chronic-log new file mode 100755 index 0000000..e8dc7ea --- /dev/null +++ b/shell/bin/chronic-log @@ -0,0 +1,38 @@ +#!/bin/sh + +# Simple wrapper around (my) chronic which writes the log files to +# ~/.tmp/logs/. + +# Copyright (C) 2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +if test $# -lt 2; then + echo "Usage: $0 .." >&2 + exit 1 +fi + + +name="$1" +shift + +today=`date '+%Y-%m-%d'` +now=`date '+%H:%M:%S'` + +logdir="$HOME/.tmp/logs/$today" +mkdir -p "$logdir" +exec chronic -l "$logdir/$name-$now" "$@" diff --git a/shell/bin/mv-p b/shell/bin/mv-p new file mode 100755 index 0000000..7259d33 --- /dev/null +++ b/shell/bin/mv-p @@ -0,0 +1,30 @@ +#!/bin/sh + +# Wrapper command for `mv` which creates the target directory before moving +# the file there. + +# Copyright (C) 2011-2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +# Get last argument. +for last; do + : +done + +mkdir -p "`dirname "$last"`" \ + && mv "$@" diff --git a/shell/bin/notify.py b/shell/bin/notify.py new file mode 100755 index 0000000..3caa7d2 --- /dev/null +++ b/shell/bin/notify.py @@ -0,0 +1,79 @@ +#!/usr/bin/python + +# notify.py is a simple notification program displaying a message on the +# screen. + +# Copyright (C) 2011-2013 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +import sys +import locale + +import pygtk +pygtk.require('2.0') # there might be a GTK 1 version installed, ignore it +import gtk +import pango +import gobject + + +# Pressing the mouse inside the window quits notify. +def mouse_press_callback(widget, event): + gtk.main_quit() + + +if __name__ == '__main__': + if len(sys.argv) != 2: + sys.stderr.write("Usage: %s \n" % (sys.argv[0])) + sys.exit(1) + + # Display configuration. + BOLD = True + FG_COLOR = 'blue' + BG_COLOR = 'yellow' + + # We need a popup so the window manager doesn't touch our window. + window = gtk.Window(gtk.WINDOW_POPUP) + # No window border or close/resize buttons. + window.set_decorated(False) + # In case set_decorated(False) doesn't work with the used window manager + # quit when the window is manually closed. + window.connect('delete-event', gtk.main_quit) + # Enable mouse click events, by default windows don't receive them. + window.add_events(gtk.gdk.BUTTON_PRESS_MASK) + window.connect('button-press-event', mouse_press_callback) + + # Background color. + window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(BG_COLOR)) + + string = sys.argv[1].decode(locale.getdefaultlocale()[1]) + + # Colored message string. + label_message = gtk.Label(string) + label_message.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(FG_COLOR)) + window.add(label_message) + + if BOLD: + attributes = pango.AttrList() + attributes.insert(pango.AttrWeight(pango.WEIGHT_HEAVY, end_index=-1)) + label_message.set_attributes(attributes) + + # Display at the top at full screen width. + screen = window.get_screen() + window.resize(screen.get_width(), 30) + window.move(0, 15) + + window.show_all() + gtk.main() diff --git a/shell/bin/print-constant.pl b/shell/bin/print-constant.pl new file mode 100755 index 0000000..f0205db --- /dev/null +++ b/shell/bin/print-constant.pl @@ -0,0 +1,258 @@ +#!/usr/bin/perl + +# Print values of C constants. + +# Copyright (C) 2012 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +use strict; +use warnings; + +use Getopt::Long (); +use File::Temp (); + +our $VERSION = '0.01'; + + +my $option_help = 0; +my $option_version = 0; +my @option_include = (); +my $option_pathconf = undef; +my $option_quiet = 0; +my $option_sysconf = 0; +my $option_type = 'd'; +if (not Getopt::Long::GetOptions( + 'help|h|?' => \$option_help, + 'version|v' => \$option_version, + # + 'include|i=s' => \@option_include, + 'pathconf|p=s' => \$option_pathconf, + 'quiet|q' => \$option_quiet, + 'sysconf|s' => \$option_sysconf, + 'type|t=s' => \$option_type, + )) { + require Pod::Usage; + Pod::Usage::pod2usage(2); +} +if ($option_help) { + require Pod::Usage; + Pod::Usage::pod2usage(1); +} +if ($option_version) { + print <. +EOF + exit 0; +} + +# We need the constant name as argument. +if (scalar @ARGV != 1) { + require Pod::Usage; + Pod::Usage::pod2usage(2); +} + + +my $constant = $ARGV[0]; +# Check for non-constant name inputs - also prevents running arbitrary code on +# the machine. +if (not $constant =~ /^[a-zA-Z0-9_]+$/) { + print STDERR "Invalid constant name: '$constant'!\n"; + exit 1; +} + +# Some sanity checks. +if (not $option_type =~ /^[a-zA-Z]+$/) { + print STDERR "Invalid type: '$option_type'!\n"; + exit 1; +} +if ($option_sysconf and defined $option_pathconf) { + print STDERR "--sysconf and --pathconf can't be used together!\n"; + exit 1; +} +foreach my $include (@option_include) { + if (not $include =~ m{^[a-zA-Z0-9./_-]+$}) { + print STDERR "Invalid include: '$include'!\n"; + exit 1; + } +} + +my $constant_display = $constant; +# Pass the constant to sysconf()/pathconf() instead of using it directly. +if ($option_sysconf) { + $constant = "sysconf($constant)"; + $constant_display = $constant; +} elsif (defined $option_pathconf) { + $constant_display = "pathconf(\"$option_pathconf\", $constant)"; + # Use the current directory to prevent escape problems for the path, see + # below. + $constant = "pathconf(\".\", $constant)"; +} + + +# Use "limits.h" and "unistd.h" as default include - but only if the user +# specified no other includes, in case it conflicts with "limits.h". +if (scalar @option_include == 0) { + push @option_include, 'limits.h'; + push @option_include, 'unistd.h'; +} + + +# Temporary directory where the following C program which prints the constant +# is built. +my $tempdir = File::Temp::tempdir(CLEANUP => 1) or die $!; +chdir $tempdir or die $!; + +# Write the C file which prints the constant value. +my $c_template = <<'EOF'; +#include +#include +%s + +int main(int argc, char **argv) { + printf("%s\n", %s); + + return EXIT_SUCCESS; +} +EOF +open my $fh, '>', 'constant.c' or die $!; +printf $fh $c_template, + join("\n", map { "#include <$_>" } @option_include), + '%' . $option_type, + $constant; +close $fh or die $!; + +# Compile the constant C file. +my @args = ('cc', '-o', 'constant', 'constant.c'); +if (system(@args) != 0) { + print STDERR "Compilation failure (message above).\n"; + + chdir; # see below + exit 1; +} + +# pathconf() needs a path, we use the current directory - therefore we have to +# chdir to the given path. This prevents escape problems with the path. +if (defined $option_pathconf) { + chdir $option_pathconf; +} + +my $value = `$tempdir/constant`; + +if ($option_quiet) { + print $value; +} else { + print "$constant_display: $value"; +} + +# Change the working directory or File::Temp can't remove our temporary +# directory. +chdir; + + +__END__ + +=head1 NAME + +print-constant - print values of C constants + +=head1 SYNOPSIS + +B [I] I + +=head1 DESCRIPTION + +print-constant prints the values of C constants. Useful to find out certain +system constants without having to write a small C program to print them. + +=head1 OPTIONS + +=over 8 + +=item B<-i> I, B<--include> I + +Use I as include file. Adds C<#include EincludeE> to the +beginning of the C file used to print the constant. By default C and +C are used as headers. If this option is specified I default +includes are used. Can be specified multiple times. + +=item B<-p> I, B<--pathconf> I + +Pass the constant to pathconf(3) and print the result. I is the first +argument for pathconf(3). Conflicts with B<--sysconf>. + +=item B<-q>, B<--quiet> + +Display only the constant's value. + +=item B<-s>, B<--sysconf> + +Pass the constant to sysconf(3) and print the result. Conflicts with +B<--pathconf>. + +=item B<-t> I, B<--type> I + +Use I as type of the constant, used in printf(3). By default C is +used. + +=item B<-h>, B<-?>, B<--help> + +Print available options. + +=item B<-v>, B<--version> + +Print version number and license. + +=back + +=head1 AUTHOR + +Simon Ruderich, Esimon@ruderich.orgE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2012 by Simon Ruderich + +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. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +=head1 SEE ALSO + +L, L + +=cut diff --git a/shell/bin/remove-continuation.pl b/shell/bin/remove-continuation.pl new file mode 100755 index 0000000..3deb7d7 --- /dev/null +++ b/shell/bin/remove-continuation.pl @@ -0,0 +1,42 @@ +#!/usr/bin/perl + +# Remove continuation lines from stdin/file. Leading whitespace on the next +# line is removed. + +# Copyright (C) 2012 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +use strict; +use warnings; + + +my $continuation = 0; +while () { + # Remove leading whitespace if the last line was a line continuation. + if ($continuation) { + s/^\s+//; + } + + if (/^(.+?)\\$/) { + print $1; + $continuation = 1; + } else { + print $_; + $continuation = 0; + } +} +# Handle line continuation on the last line. +print "\n" if $continuation; diff --git a/shell/bin/rsleep b/shell/bin/rsleep new file mode 100755 index 0000000..9b953c5 --- /dev/null +++ b/shell/bin/rsleep @@ -0,0 +1,31 @@ +#!/usr/bin/perl + +# Sleep randomly between 0 and $ARGV[0] seconds. + +# Copyright (C) 2013-2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +use strict; +use warnings; + + +if (scalar @ARGV != 1) { + print STDERR "Usage: $0 \n"; + exit 1; +} + +srand; +sleep int rand $ARGV[0]; diff --git a/shell/bin/sc b/shell/bin/sc new file mode 100755 index 0000000..506e90a --- /dev/null +++ b/shell/bin/sc @@ -0,0 +1,53 @@ +#!/bin/bash + +# Small wrapper for systemctl which provides some shortcuts. + +# Copyright (C) 2015 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set -eu + + +args=( ) +found= +for arg; do + # This heuristic replaces the first occurrence of a shortcut with its + # expansion. This is not perfect (e.g. `systemctl status s` would result + # in `systemctl status status`) but works even when options are used and + # doesn't require us to duplicate systemctl's parsing of command line + # arguments. + if [[ -z $found ]]; then + found=1 + case "$arg" in + c) arg=cat ;; + d) arg=disable ;; + e) arg=enable ;; + k) arg=kill ;; + m) arg=mask ;; + r) arg=restart ;; + rl) arg=reload ;; + s) arg=status ;; + sa) arg=start ;; + so) arg=stop ;; + u) arg=unmask ;; + # No match, try it again for the next parameter. + *) found= ;; + esac + fi + args+=( "$arg" ) +done + +set +u # empty $args causes an error, I think this is a bug in bash +exec systemctl "${args[@]}" diff --git a/shell/bin/slocate b/shell/bin/slocate new file mode 100755 index 0000000..43e1eb2 --- /dev/null +++ b/shell/bin/slocate @@ -0,0 +1,23 @@ +#!/bin/sh + +# Search only in the local `locate` database. Created with `supdatedb`. + +# Copyright (C) 2012-2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +exec locate -d "$HOME/.tmp/locatedb" "$@" diff --git a/shell/bin/srandom-order b/shell/bin/srandom-order new file mode 100755 index 0000000..45297be --- /dev/null +++ b/shell/bin/srandom-order @@ -0,0 +1,31 @@ +#!/bin/sh + +# Run all files in the current directory (recursively) in a random order with +# the given program. + +# Copyright (C) 2012-2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +if test "$#" -eq 0; then + echo "Usage: $0 .." >&2 + exit 2 +fi + +find . -type f -print0 \ + | sort --random-sort --zero-terminated \ + | xargs -0 "$@" diff --git a/shell/bin/srsync b/shell/bin/srsync new file mode 100755 index 0000000..8402bb3 --- /dev/null +++ b/shell/bin/srsync @@ -0,0 +1,38 @@ +#!/bin/sh + +# rsync shortcut with options "everybody" needs. + +# Be careful when restoring /boot with --sparse, GRUB doesn't support sparse +# files (e.g. the kernel). Therefore don't use --sparse in this case. + +# Copyright (C) 2011-2015 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu +set -x + +exec rsync \ + --verbose \ + --itemize-changes \ + --human-readable \ + --archive \ + --acls \ + --xattrs \ + --hard-links \ + --sparse \ + --numeric-ids \ + --one-file-system \ + "$@" diff --git a/shell/bin/srsync-incremental b/shell/bin/srsync-incremental new file mode 100755 index 0000000..187e6b6 --- /dev/null +++ b/shell/bin/srsync-incremental @@ -0,0 +1,66 @@ +#!/bin/sh + +# Perform incremental backups using rsync and hardlinks. +# +# Thanks to http://www.sanitarium.net/golug/rsync_backups_2010.html for the +# idea. + +# Copyright (C) 2011-2017 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +if test "$#" -lt 2; then + echo "Usage: $0 " >&2 + echo + echo "Note: The target directory is the _first_ argument!" >&2 + exit 2 +fi + + +cd "$1" +shift + +# Get path to last backup directory. +dest=./ +for x in backup-*; do + test -d "$x" || continue + dest="../$x" # relative to destination directory +done + +target="backup-$(date '+%Y-%m-%d-%H-%M-%S')" +target_tmp="partial-$target" + +mkdir "$target_tmp" +rsync \ + --verbose --itemize-changes --human-readable \ + --archive --acls --xattrs --hard-links --sparse --numeric-ids \ + --one-file-system \ + --link-dest="$dest" \ + "$@" "$target_tmp" \ +|| { + # Try to remove the target directory without changing the exit code. In + # case the connection failed without transferring any files, we want to + # remove the empty directory. + code=$? + rmdir "$target_tmp" 2>/dev/null || true + exit $code +} +# --dry-run (-n) creates an empty directory. Remove it to prevent using it for +# further incremental backups (which would do a full backup). +rmdir "$target_tmp" 2>/dev/null && exit 0 || true + +mv "$target_tmp" "$target" diff --git a/shell/bin/supdatedb b/shell/bin/supdatedb new file mode 100755 index 0000000..4f5fac0 --- /dev/null +++ b/shell/bin/supdatedb @@ -0,0 +1,27 @@ +#!/bin/sh + +# Generate `locate` database for my home directory only. Exclude backups and +# other temporary files. + +# Copyright (C) 2012-2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +exec updatedb \ + --localpaths="$HOME" \ + --prunepaths="$HOME/.tmp $HOME/tmp" \ + --output="$HOME/.tmp/locatedb" diff --git a/shell/bin/svalgrind b/shell/bin/svalgrind new file mode 100755 index 0000000..bcb68da --- /dev/null +++ b/shell/bin/svalgrind @@ -0,0 +1,22 @@ +#!/bin/sh + +# Copyright (C) 2011-2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +exec valgrind --leak-check=full --show-reachable=yes --error-exitcode=1 \ + --track-fds=yes --quiet "$@" diff --git a/shell/bin/temperature.pl b/shell/bin/temperature.pl new file mode 100755 index 0000000..42eaffe --- /dev/null +++ b/shell/bin/temperature.pl @@ -0,0 +1,96 @@ +#!/usr/bin/perl + +# Copyright (C) 2011-2012 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +use strict; +use warnings; + + +if (scalar @ARGV != 1 and (scalar @ARGV != 2 or not $ARGV[0] =~ /-[st]/)) { + print STDERR "Usage: $0 [-s | -t] \n"; + print STDERR "\n"; + print STDERR "Normally this is /sys/devices/platform/*.\n"; + exit 1; +} +if (scalar @ARGV == 1) { + @ARGV = ('', $ARGV[0]); +} + +my $temperature_path = "$ARGV[1]/temp1_input"; +my $critical_path = "$ARGV[1]/temp1_crit"; + +# No temperature information available. +if (not -e $temperature_path or not -e $critical_path) { + print STDERR "'$temperature_path' or '$critical_path' not found.\n"; + exit 1; +} + +my $screen_mode = ($ARGV[0] eq '-s'); +my $tmux_mode = ($ARGV[0] eq '-t'); + +my $temperature; +my $critical; + +my $file; +open $file, '<', $temperature_path or die $!; +$temperature = <$file>; +close $file or die $!; +open $file, '<', $critical_path or die $!; +$critical = <$file>; +close $file or die $!; + +my $value = int($temperature / 1000); +my $risk = ($critical - $temperature)/$critical; + +$value .= "\xb0"; # degree symbol in UTF-8 + +# GNU screen mode with colors. +if ($screen_mode) { + my $color; + if ($risk < 0) { + $color = 'br r'; # bold reverse + } elsif ($risk < 0.1) { + $color = 'b r'; + } elsif ($risk < 0.2) { + $color = 'b y'; + } else { + $color = 'b g'; + } + + print "\005{+$color}$value\005{-}\n"; + +# Same in tmux mode. +} elsif ($tmux_mode) { + my $color; + my $style = 'bold'; + if ($risk < 0) { + $color = 'red'; + $style = 'reverse'; # blink doesn't work for me + } elsif ($risk < 0.1) { + $color = 'red'; + } elsif ($risk < 0.2) { + $color = 'yellow'; + } else { + $color = 'green'; + } + + print "#[fg=$color,$style]$value#[default]\n"; + +# Plain text output. +} else { + print "$value\n"; +} diff --git a/shell/colordiffrc b/shell/colordiffrc new file mode 100644 index 0000000..d8f91db --- /dev/null +++ b/shell/colordiffrc @@ -0,0 +1,24 @@ +# Colordiff configuration file. + +# Copyright (C) 2011-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Custom colors for the diff output which is more similar to TextMate's output +# (new: green, old: red). +newtext=green +oldtext=red +diffstuff=magenta +cvsstuff=yellow diff --git a/shell/crontab.d/Makefile b/shell/crontab.d/Makefile new file mode 100644 index 0000000..23d5991 --- /dev/null +++ b/shell/crontab.d/Makefile @@ -0,0 +1,4 @@ +all: + @./setup.sh + +.PHONY: all diff --git a/shell/crontab.d/README b/shell/crontab.d/README new file mode 100644 index 0000000..56121ce --- /dev/null +++ b/shell/crontab.d/README @@ -0,0 +1,8 @@ +README +====== + +`setup.sh` combines all 'crontab.*' files in this directory into a single +crontab file and loads it with `crontab`. + +This replaces the current crontab! If no 'crontab.*' files were found, the +current crontab is removed. diff --git a/shell/crontab.d/jobs b/shell/crontab.d/jobs new file mode 100644 index 0000000..8426b7a --- /dev/null +++ b/shell/crontab.d/jobs @@ -0,0 +1,44 @@ +# Run jobs on regular bases. Similar to /etc/cron.*/. +# +# Symlink to crontab.jobs to enable it. + +# Copyright (C) 2013-2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +# Include user's binaries in PATH. Expanding $HOME doesn't work with cron, +# `setup.sh` handles that! +PATH=$HOME/bin:$HOME/.shell/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games +# `rsleep` (random sleep) is used to reduce concurrent commands if this +# crontab file is used by multiple users. + + +# Taken from Debian's /etc/crontab from cron package 3.0pl1-124 and modified. +# Thanks. +17 * * * * rsleep 60; run-parts --report .crontab.d/jobs.hourly +25 6 * * * rsleep 1800; run-parts --report .crontab.d/jobs.daily +47 6 * * 7 rsleep 3600; run-parts --report .crontab.d/jobs.weekly +52 6 1 * * rsleep 3600; run-parts --report .crontab.d/jobs.monthly + +# Run on system startup. +@reboot run-parts --report .crontab.d/jobs.reboot + +# Run every minute. +* * * * * run-parts --report .crontab.d/jobs.minutely +# Run every x hours. +31 */6 * * * rsleep 600; run-parts --report .crontab.d/jobs.hourly6 +39 */8 * * * rsleep 600; run-parts --report .crontab.d/jobs.hourly8 + +# vim: ft=crontab diff --git a/shell/crontab.d/jobs.daily/.gitignore b/shell/crontab.d/jobs.daily/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/shell/crontab.d/jobs.daily/prune-logs b/shell/crontab.d/jobs.daily/prune-logs new file mode 100755 index 0000000..74aa1f2 --- /dev/null +++ b/shell/crontab.d/jobs.daily/prune-logs @@ -0,0 +1,32 @@ +#!/bin/sh + +# Remove log files created by schronic which are older than two weeks. + +# Copyright (C) 2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + + +logdir="$HOME/.tmp/logs" +if test ! -d "$logdir"; then + exit 0 +fi + +# Remove empty directories. +rmdir "$logdir"/* 2>/dev/null || true + +exec find "$logdir/" -type f -mtime +14 -delete diff --git a/shell/crontab.d/jobs.hourly/.gitignore b/shell/crontab.d/jobs.hourly/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/shell/crontab.d/jobs.hourly6/.gitignore b/shell/crontab.d/jobs.hourly6/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/shell/crontab.d/jobs.hourly8/.gitignore b/shell/crontab.d/jobs.hourly8/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/shell/crontab.d/jobs.minutely/.gitignore b/shell/crontab.d/jobs.minutely/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/shell/crontab.d/jobs.monthly/.gitignore b/shell/crontab.d/jobs.monthly/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/shell/crontab.d/jobs.reboot/.gitignore b/shell/crontab.d/jobs.reboot/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/shell/crontab.d/jobs.weekly/.gitignore b/shell/crontab.d/jobs.weekly/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/shell/crontab.d/setup.sh b/shell/crontab.d/setup.sh new file mode 100755 index 0000000..46ebb56 --- /dev/null +++ b/shell/crontab.d/setup.sh @@ -0,0 +1,96 @@ +#!/bin/sh + +# Combine all crontab.* files in ~/.crontab.d/ into a single crontab file and +# load it with `crontab`. +# +# An existing crontab entry not generated with this script is not overwritten. + +# Copyright (C) 2012-2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + + +HEADER_WARNING='# WARNING! DO NOT EDIT THIS FILE! #' + +# Don't overwrite existing crontab entries. Not race condition free but that +# can't be helped. +if crontab -l >/dev/null 2>&1; then + if crontab -l | head -n3 | grep -F -x "$HEADER_WARNING" >/dev/null; then + : + else + echo 'Existing crontab entry found, please remove it manually.' + exit 2 + fi +fi + + +DIRECTORY="$HOME/.crontab.d" +if test ! -d "$DIRECTORY" || test ! -O "$DIRECTORY"; then + exit 1 +fi + +# `set -e` aborts when `mktemp` fails. +CRONTAB=`mktemp --tmpdir="$DIRECTORY" update-crontab.XXXXXXXXXXXX` + +echo '###################################' >"$CRONTAB" +echo "$HEADER_WARNING" >>"$CRONTAB" +echo '###################################' >>"$CRONTAB" +echo >>"$CRONTAB" +printf "# It was generated from '%s/*' on %s." \ + "$DIRECTORY" "`LANG=C date '+%a, %d %b %Y %H:%M:%S %z'`" >>"$CRONTAB" + +# Enforce C sort order. +LC_ALL=C + +NO_MATCHES= +for file in "$DIRECTORY"/crontab.*; do + # No crontab.* files exist, abort. + if test ! -e "$file"; then + NO_MATCHES=y + break + fi + + printf "Found '%s'.\n" "$file" + + printf '\n\n## %s:\n' "$file" >>"$CRONTAB" + + # Strip licenses, multiple empty lines and fix $HOME variables in PATH + # (cron doesn't expand variables). + START_REGEX='^# This [a-zA-Z]* is free software: you can redistribute it' + END_REGEX='^# along with this [a-zA-Z]*. If not, see <[^>]*>\.' + <"$file" sed -e "/$START_REGEX/,/$END_REGEX/ d" \ + -e "/^#[ ]*$/ d" \ + -e "/^# Copyright (C) [0-9][0-9]* / d" \ + | cat --squeeze-blank \ + | sed "/^PATH/ s:\$HOME:$HOME:g" \ + >>"$CRONTAB" +done + +# Update crontab with the crontab.* files. +if test -z "$NO_MATCHES"; then + echo + echo 'Updating crontab.' + crontab "$CRONTAB" + +# No files found, remove the existing crontab entry. Ignore errors in case no +# crontab entry existed in the first place. +else + echo 'No files found, removing old crontab (if it exists).' + crontab -r || true +fi + +rm "$CRONTAB" diff --git a/shell/csh/rc b/shell/csh/rc new file mode 100644 index 0000000..0fdc66a --- /dev/null +++ b/shell/csh/rc @@ -0,0 +1,26 @@ +# Csh configuration file. + +# Copyright (C) 2011-2013 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Start Zsh in interactive login mode if available, otherwise do nothing. -l +# is used so Zsh sources .zlogin and .zlogout. +if ($?prompt) then + # csh doesn't use `type` .. yeah POSIX. + which zsh >/dev/null && exec zsh -l +endif + +# vim: ft=csh diff --git a/shell/digrc.in b/shell/digrc.in new file mode 100644 index 0000000..c686042 --- /dev/null +++ b/shell/digrc.in @@ -0,0 +1,23 @@ +# Dig configuration file. +# +# dig doesn't support comments in ~/.digrc. They must be stripped before using +# this file. + +# Copyright (C) 2014 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Use the search list or domain directive as defined in /etc/resolv.conf. ++search diff --git a/shell/haskeline b/shell/haskeline new file mode 100644 index 0000000..ecf2428 --- /dev/null +++ b/shell/haskeline @@ -0,0 +1,39 @@ +-- Configuration file for haskeline (an incomplete readline "clone"). + +-- Copyright (C) 2014 Simon Ruderich +-- +-- This file 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 file is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this file. If not, see . + + +-- Activate Vi editing mode. +editMode: Vi + +-- Never ring any bell. +bellStyle: NoBell + +-- Increase history size. +maxHistorySize: Just 50000 +-- Don't add consecutive duplicate lines to the history. +historyDuplicates: IgnoreConsecutive + + +-- KEY BINDINGS + +-- / with the additional effect that only lines starting with the +-- current input are matched. Very useful to recall old commands quickly - +-- just type the first few characters. +bind: ctrl-p meta-k +bind: ctrl-n meta-j + +-- vim: ft=haskell diff --git a/shell/htoprc.in b/shell/htoprc.in new file mode 100644 index 0000000..194328d --- /dev/null +++ b/shell/htoprc.in @@ -0,0 +1,76 @@ +# htop configuration file. + +# Useful mappings: +# +# Use \ to limit to only matching processes (like l in mutt). _Very_ useful. + +# Copyright (C) 2011-2014 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Ordered in the same way htop orders them for easy diffing. + +# Display the following fields (trailing whitespace for easy diffing ...): +# +# - PID (0) +# - USER (48) +# - NICE (18) +# - M_SIZE (38): virtual memory +# - M_RESIDENT (39): resident memory +# - M_SHARE (40): shared memory +# - STATE (2) +# - PERCENT_CPU (46) +# - PERCENT_MEM (47) +# - TIME (49) +# - STARTTIME (20) +# - Command (1) +fields=0 48 18 38 39 40 2 46 47 49 20 1 + +# Don't display kernel threads. +hide_kernel_threads=1 +# But display userland threads. +hide_userland_threads=0 +# Display thread names. The command line is displayed in the tree view as +# parent of the threads. +show_thread_names=1 + +# Highlight program base name. +highlight_base_name=1 +# Highlight megabytes in memory usage. +highlight_megabytes=1 +# Highlight threads. +highlight_threads=1 + +# Display detailed CPU information, including IO-Wait. +detailed_cpu_time=1 + +# Display the following meters. +# +# left: - first part of CPU usage, bar (LeftCPUs) +# - memory usage, bar (Memory) +# - swap usage, bar (Swap) +# - hostname, text (Hostname) +# +# right: - second part of CPU usage, bar (RightCPUs) +# - task statistics, text (Tasks) +# - load average, text (LoadAverage) +# - uptime, text (Uptime) +# +left_meters=LeftCPUs Memory Swap Hostname +left_meter_modes=1 1 1 2 +right_meters=RightCPUs Tasks LoadAverage Uptime +right_meter_modes=1 2 2 2 + +# vim: ft=cfg diff --git a/shell/inputrc b/shell/inputrc new file mode 100644 index 0000000..aa74013 --- /dev/null +++ b/shell/inputrc @@ -0,0 +1,54 @@ +# Configuration file for readline. + +# Copyright (C) 2011-2015 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Only one is necessary to get a list of all possible options. +set show-all-if-ambiguous on +set show-all-if-unmodified on + +# Always complete all items no matter how many there are. +set completion-query-items -1 +# And make sure we use a pager for completions (this is also the default). +set page-completions on + +# Add character to files denoting the type when completing file names. +set visible-stats on + +# Activate Vi editing mode. +set editing-mode vi + + +# KEY BINDINGS + +# Insert mode. + +# Use jk to exit insert mode (jj is too slow to type). +"jk": vi-movement-mode + +# / with the additional effect that only lines starting with the +# current input are matched. Very useful to recall old commands quickly - just +# type the first few characters. +"\C-p": history-search-backward +"\C-n": history-search-forward + +# Allow in Vi normal mode to clear the screen. +"\C-L": clear-screen + +# Command mode. +set keymap vi + +# No bindings yet. diff --git a/shell/lessfilter b/shell/lessfilter new file mode 100755 index 0000000..1403df4 --- /dev/null +++ b/shell/lessfilter @@ -0,0 +1,44 @@ +#!/bin/sh + +# Copyright (C) 2011-2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +case "$1" in + # Color diff files. + *.diff | *.patch) + colordiff <"$1" + ;; + + *.nfo) + iconv -f latin1 -t utf-8 <"$1" + ;; + + *) + # Display directory contents. + if test -d "$1"; then + printf '=> Contents of %s:\n' "$1" + ls -- "$1" + exit 0 + fi + + # We don't handle this format. + exit 1 +esac + +# No further processing by lesspipe necessary. +exit 0 diff --git a/shell/lesskey b/shell/lesskey new file mode 100644 index 0000000..247679b --- /dev/null +++ b/shell/lesskey @@ -0,0 +1,56 @@ +# Lesskey configuration file for less. + +# Copyright (C) 2011-2013 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +#command + +# Map "-" to go up one screen like in mutt. +- back-screen +# Map h and l to work like in Vim (go left/right). To display the help use H. +h left-scroll +l right-scroll + + +#line-edit + +# Vim-like up/down to replace the arrow keys. +^P up +^N down + + +#env + +# Set options for less. +# +# no-init: Disable initialization termcap as it causes the screen to get +# cleared on some systems. +# quit-if-one-screen: If the output fits on the current screen quit less. +# RAW-CONTROL-CHARS: Display ANSI "color" escape sequences to allow colored +# output. Other escape sequences are drawn in caret +# notation. +# ignore-case: Ignore case if the search string doesn't contain any uppercase +# letters. If there are uppercase letters respect case. +# +# Don't use search-skip-screen as it makes it easy to miss matches on the +# current page. +LESS = --no-init --quit-if-one-screen --RAW-CONTROL-CHARS --ignore-case + +# Store less' history file in this directory. HISTORY_PATH is replaced by +# setup.sh because lesskey doesn't expand ~/. +LESSHISTFILE = HISTORY_PATH +# Increase the history size, default is 100. +LESSHISTSIZE = 1000 diff --git a/shell/reminders.in b/shell/reminders.in new file mode 100644 index 0000000..a146029 --- /dev/null +++ b/shell/reminders.in @@ -0,0 +1,54 @@ +# remind reminder file. + +# Copyright (C) 2012-2013 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# FUNCTIONS + +# Todo item. Prevents cluttering the calendar by displaying the entry only +# today. Thanks to http://wiki.43folders.com/index.php/Remind_FAQ (read on +# 2011-06-24). Additionally %"%" is used in todo items which omits them from +# the calendar view completely. Combined this way supports `rem -c` (no todo +# items) and `rem '*3'` (todo items only once). +FSET todo() trigger(realtoday()) + + + +# TODO LIST + +# Header. +#REM [todo()] MSG %"%" TODO: % + +#REM [todo()] MSG %"%" - Example todo entry. % + +# Empty line. +#REM [todo()] MSG %"%" % + + + +# REMINDERS + +#REM 04 April 2012 +10 MSG Example reminder entry. % + + + +# DAEMON REMINDERS + +IF $Daemon > 0 + #REM AT 00:00 MSG Example reminder. +ENDIF + +# vim: ft=remind diff --git a/shell/screenrc.in b/shell/screenrc.in new file mode 100644 index 0000000..a403083 --- /dev/null +++ b/shell/screenrc.in @@ -0,0 +1,158 @@ +# GNU screen configuration file. +# +# Features which are only available in (very) recent screen releases or in +# current Git are marked with "(GIT)" so they can be removed by the setup +# script on machines with older versions. +# +# (BATTERY) is only used on laptops, (ROOT) only if running as root. + +# Copyright (C) 2011-2013 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Automatically lock the screen after 10 minutes of inactivity if running as +# root. +#idle 600 lockscreen # handled by setup script + +# Don't display startup message. +startup_message off + +# Use visual bell instead of audible bell. +vbell on + +# Increase the scrollback buffer. +defscrollback 50000 + +# Ignore case when searching. +ignorecase on + +# I prefer zsh as my shell. GNU screen displays a warning if the shell isn't +# available. +shell zsh + +# Don't "login" windows (= add them to the utmp database) by default. Not +# useful for me and the "$" flag clutters the window flags (displayed with +# %Lw). +deflogin off + + +# TERMINAL + +# Enable 256 color mode. +term screen-256color +# Allow bold colors in XTerm (not necessary for Rxvt), not sure why this is +# necessary. Otherwise normal and bold colors are switched. Thanks to +# http://www.frexx.de/xterm-256-notes/. +attrcolor b ".I" + + +# CAPTION AND HARDSTATUS + +# Use white on light blue background for highlighting and text messages (and +# for window borders in split mode). +sorendition = Bw + +# Display current battery charge if running on a laptop. Redisplay every 3 +# minutes. +backtick 1 180 180 $HOME/.shell/bin/battery.pl -s BATTERY # (BATTERY) +# Display current temperature if running on a laptop. Redisplay every minute. +backtick 2 60 60 $HOME/.shell/bin/temperature.pl -s TEMPERATURE # (TEMPERATURE) + +# Make sure the temporary variable we use is empty. Thanks to +# http://gist.github.com/133000 for the idea to use setenv and to TauPan in +# #screen on Freenode (2010-03-10 16:11 CET) for reminding me of it and +# searching it again. +unsetenv s + +# Always display the caption. +setenv s "$s%{= Bw}" # - white on light blue background, also reset all + # attributes (necessary so everything is displayed + # correctly) +setenv s "$s%?%P" # - is copy mode enabled? (GIT) +setenv s "$s%{= wB}" # - if so change colors to light blue on white (GIT) +setenv s "$s%?" # - end if (GIT) +setenv s "$s%3n" # - window number +setenv s "$s " # - space +setenv s "$s%t" # - window name +caption always "$s" +unsetenv s +# Always display the status line with open windows and the hostname. +setenv s "$s%Lw" # - number and names of windows, L displays window flags +setenv s "$s%=" # - right align the following text +setenv s "$s%l" # - load average +setenv s "$s " # - space +setenv s "$s%H" # - hostname +setenv s "$s " # - space (TEMPERATURE) +setenv s "$s%2`" # - temperature (TEMPERATURE) +setenv s "$s " # - space (BATTERY) +setenv s "$s%1`" # - battery status (BATTERY) +hardstatus alwayslastline "$s" +unsetenv s + + +# BINDINGS + +# Remove some bindings I don't use to prevent using them accidentally. You +# probably don't want to copy this. +bind K # kill +bind k # kill +bind ^K # kill +bind \\ # quit +bind ^\ # quit +bind ^Z # suspend +bind z # suspend +bind ^S # xoff +bind s # xoff +bind ^Q # xon +bind q # xon +bind ^G # visual bell +bind D # power detach + +# Bindings for fast switching to windows 10 to 19. Thanks to skizzhg in +# #screen on Freenode (2010-10-31 21:49 CET) for the suggestion. +bind ; command -c window +bind -c window 0 select 10 +bind -c window 1 select 11 +bind -c window 2 select 12 +bind -c window 3 select 13 +bind -c window 4 select 14 +bind -c window 5 select 15 +bind -c window 6 select 16 +bind -c window 7 select 17 +bind -c window 8 select 18 +bind -c window 9 select 19 +# And bindings for windows 20 to 29 with e.g. ;;1. Thanks to Kays in #irssi on +# Freenode (2012-10-18 16:25 CEST) for the suggestion to use ;;. +bind -c window ; command -c window2 +bind -c window2 0 select 20 +bind -c window2 1 select 21 +bind -c window2 2 select 22 +bind -c window2 3 select 23 +bind -c window2 4 select 24 +bind -c window2 5 select 25 +bind -c window2 6 select 26 +bind -c window2 7 select 27 +bind -c window2 8 select 28 +bind -c window2 9 select 29 + +# Run urlview on current screen content. Very useful to follow links. Make +# sure hardcopy_append is off before using this command. +bind ^B eval "hardcopy $HOME/.tmp/screen-urlview" "screen urlview $HOME/.tmp/screen-urlview" + + +# DIGRAPHS + +digraph (, 「 +digraph ), 」 diff --git a/shell/setup.sh b/shell/setup.sh new file mode 100755 index 0000000..eec1ded --- /dev/null +++ b/shell/setup.sh @@ -0,0 +1,291 @@ +#!/bin/sh + +# Setup script for shell configuration files. + +# Copyright (C) 2011-2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +. ../lib.sh + + +# Helper functions. +terminal_info() { + infocmp "$@" 2>&1 +} +terminal_available() { + terminal_info "$@" > /dev/null +} +# Usage: +apply_optional_replacement() { + if test -n "$4"; then + printf '%s: using %s %s\n' "$1" "$2" "$4" + generate "$1" '' simple_cpp \ + "$3" -- "$4" + else + printf '%s: removing %s display\n' "$1" "$2" + grep_i -v "$3" "$1" + fi +} +# Check if `infocmp` is available. +if ! infocmp >/dev/null 2>&1; then + echo 'Warning: `infocmp` not available! 256color checks will fail.' + echo +fi + + +# DIRECTORY SETUP + +# Create private temporary directory used by many tools (including GNU screen +# and tmux). +mkdir -p ~/.tmp +chmod 0700 ~/.tmp + +# Create rlwrap history directory. +mkdir -p shell/rlwrap +# Create zsh cache directory. +mkdir -p zsh/cache + + +# FILE SETUP + +# Generate ~/.less with lesskey. Prevent cluttering ~/ by storing the history +# file in this directory; this requires replacing the constant HISTORY_PATH in +# lesskey. +echo 'lesskey: generating .lesskey' +simple_cpp shell/dircolors + dircolors -b shell/dircolors.in >>shell/dircolors +fi + +# Find the required options to get colored ls output. GNU ls is preferred. See +# shell/aliases.in for details. Doing this here instead of in shell/aliases +# speeds up shell starts. +# +# GNU ls with colors available. +if ls --color >/dev/null 2>&1; then + ls_args='command ls --color' +# Normal (BSD) ls with colors available. +elif ls -G >/dev/null 2>&1; then + # Don't display hidden files by default when running as root (-I), I use + # `la` for that. + ls_args='CLICOLOR_FORCE=1 command ls -G -I' +# OpenBSD has no colored ls, use colorls instead. +elif colorls -G >/dev/null 2>&1; then + ls_args='CLICOLOR_FORCE=1 colorls -G' +# Simple ls with no colors. +else + ls_args='command ls' +fi + +# Also check if `column -t` is available. +if echo test | column -t >/dev/null 2>&1; then + column=' | column -t' +else + column= +fi + +generate shell/aliases .in simple_cpp \ + LS_ARGS COLUMN -- \ + "$ls_args" "$column" + +# If `tig` is not available use my simple replacement. +if ! installed tig; then + echo "alias tig='git tig'" >>shell/aliases +fi + +# Check if grep supports --color=auto. +if echo test | grep --color=auto test >/dev/null 2>&1; then + : +else + echo 'shell/aliases: removing grep --color=auto' + sed_i '/^alias grep=/ s/^/#/' shell/aliases +fi + +generate screenrc .in cat +# As screen-256color is not widely supported use it only on machines where the +# matching terminfo entry is available. This also requires a terminal emulator +# which supports 256 colors. Also used for tmux. +use_256colors= +if terminal_available screen-256color; then + # GNU/Linux's virtual terminal doesn't support 256 colors. If setup.sh is + # run one one, assume this user is mostly used from the terminal. + if test x"$TERM" = xlinux || test x"$TERM" = xscreen.linux; then + echo 'screenrc: running on virtual terminal, disabling 256 colors' + # Called through SSH connection, assume the local system supports 256 + # colors. + elif test -n "${SSH_CONNECTION:+set}"; then + use_256colors=1 + # We have rxvt-unicode installed, check if it supports 256 colors. + elif installed urxvt; then + # Thanks to deryni in #rxvt-unicode on Freenode (2012-10-14 22:54 + # CEST) for the strings/grep idea. The grep check is for "correct" 256 + # rxvt-unicode binaries (e.g. Debian's rxvt-unicode-256color), the + # terminal_info check for manual installations which modify + # rxvt-unicode's terminfo entry. + urxvt_path=`installed_path urxvt` + urxvt_grep=`strings "$urxvt_path" | grep '^TERM=rxvt-'` + if test x"$urxvt_grep" = 'xTERM=rxvt-unicode-256color' \ + || terminal_info rxvt-unicode \ + | grep -F 'colors#256' >/dev/null; then + use_256colors=1 + fi + # Check if XTerm supports 256 colors (not a perfect check, but most XTerm + # support 256 colors). + elif terminal_available xterm-256color; then + use_256colors=1 + fi +fi +if test -z "$use_256colors"; then + echo 'screenrc: removing 256 colors' + sed_i 's/Enable 256 color/Disable 256 color/; + s/screen-256color/screen/' screenrc +fi +# Some options are only necessary when running as root. They are marked as +# "(ROOT)". +if test "`id -u`" -ne 0; then + echo 'screenrc: removing root options' + grep_i -v '(ROOT)' screenrc +fi +# I use some features of GNU screen which are only in Git or very recent GNU +# screen versions. Drop them on machines which have older versions. They are +# marked as "(GIT)". +if test ! -d "$HOME/development/shell/screen"; then + echo 'screenrc: removing Git features' + grep_i -v '(GIT)' screenrc +fi +# Rxvt doesn't need the attrcolor "fix". As I prefer rxvt assume I use it when +# it's installed. +if installed rxvt; then + echo 'screenrc: removing attrcolor "fix"' + sed_i 's/attrcolor b ".I"/#attrcolor b ".I"/' screenrc +fi +# Display current battery charge on computers with a battery. Necessary lines +# are marked as "(BATTERY)". Also used for Tmux. +battery= +for x in /sys/class/power_supply/BAT*; do + test -d "$x" || continue + battery="$x" +done +apply_optional_replacement screenrc \ + battery BATTERY "$battery" +# Display current temperature. Necessary lines are marked as "(TEMPERATURE)". +# Also used for Tmux. +temperature=/sys/devices/platform/coretemp.0 +if ! test -d "$temperature"; then + temperature= +fi +apply_optional_replacement screenrc \ + temperature TEMPERATURE "$temperature" + + +if installed tmux; then + generate tmux.conf .in cat + + apply_optional_replacement tmux.conf \ + battery BATTERY "$battery" + apply_optional_replacement tmux.conf \ + temperature TEMPERATURE "$temperature" + + # Old Tmux versions can't handle that. + generate tmux.conf '' ./bin/remove-continuation.pl + + # Add mappings to switch to windows 10-29 quickly. See tmux-window.pl for + # details. + perl ./tmux-window.pl 1 "`pwd`/tmux-window2.conf" >tmux-window1.conf + perl ./tmux-window.pl 2 >tmux-window2.conf + # Set absolute path to tmux-window1.conf in tmux.conf. + generate tmux.conf '' simple_cpp \ + TMUX_WINDOW_PATH -- "`pwd`/tmux-window1.conf" + + # 256 colors not available. + if test -z "$use_256colors"; then + echo 'tmux.conf: removing 256 colors' + sed_i 's/Enable 256 color/Disable 256 color/; + s/screen-256color/screen/' tmux.conf + fi + # Tmux doesn't display a warning if the shell wasn't found! + if test ! -x '/bin/zsh'; then + echo 'tmux.conf: removing /bin/zsh as shell' + sed_i 's/zsh/sh/' tmux.conf + fi +fi + +# Htop overwrites the comments in its configuration file. +generate htoprc .in cat + +if installed dig; then + # dig doesn't support any comments in digrc. + grep -v -E '^#' digrc.in >digrc +fi + + +# LINK SETUP + +# Link setup for shells. +link shell ~/.shell +link bash ~/.bash +link bash/rc ~/.bashrc +link bash/profile ~/.bash_profile +link bash/logout ~/.bash_logout +if installed csh; then + link csh/rc ~/.cshrc +fi +link zsh ~/.zsh +link zsh/env ~/.zshenv +link zsh/rc ~/.zshrc +link zsh/logout ~/.zlogout + +if installed tmux; then + link terminfo ~/.terminfo +fi + +# Link setup for additional files. +if installed crontab; then + link crontab.d ~/.crontab.d +fi +link lessfilter ~/.lessfilter +if installed colordiff; then + link colordiffrc ~/.colordiffrc +fi +link inputrc ~/.inputrc +if installed ghci; then + link haskeline ~/.haskeline +fi +link screenrc ~/.screenrc +if installed tmux; then + link tmux.conf ~/.tmux.conf +fi +if installed htop; then + link htoprc ~/.htoprc + # New location for htoprc. Use both for compatibility. + mkdir -p ~/.config/htop + link htoprc ~/.config/htop/htoprc +fi +if test -d ~/.ssh && test -O ~/.ssh; then + mkdir -p ~/.ssh/master + link ssh_config ~/.ssh/config +fi +if installed dig; then + link digrc ~/.digrc +fi diff --git a/shell/shell/aliases.in b/shell/shell/aliases.in new file mode 100644 index 0000000..69270cc --- /dev/null +++ b/shell/shell/aliases.in @@ -0,0 +1,134 @@ +# Aliases and similar functions which can be used by all shells (supporting +# them). + +# Copyright (C) 2011-2015 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Shortcuts for often used programs. +alias c=clear +alias d=cd +alias e=elinks +alias g=git +alias h=htop +alias l=ls +alias m=make +alias p=less # p for pager +alias s=ssh +alias t=tig +alias v=vim +alias x=exit +# Shortcuts for a little less used programs. +alias ga='git annex' +alias gr=grep +alias gri='grep -i' +alias grr='grep -r' +alias grri='grep -ri' +alias mc='make clean' +alias mj='make -j$(nproc)' +alias mu=mutt +alias rs=reset # like git's reset alias +alias sa='ssh-add -t 1h' +alias te=tree +# systemd ... (sc is provided as shell script for better completion) +alias jc=journalctl +alias lc=loginctl +alias mc=machinectl + + +unalias mv cp 2>/dev/null +# Ask for confirmation before overwriting files. Especially useful when moving +# to a different directory. No alias for `rm` because I specify the files to +# remove directly, so I know what will happen. +alias mv='mv -i' +# Additionally preserve all file attributes when copying, this includes +# copying symbolic links as is without dereferencing them. +alias cp='cp -i -a' + + +# Make sure there is no alias named ls as it causes problems with the +# following ls function on (at least) bash 4.0.35. +unalias ls 2>/dev/null +# Improved ls which displays the files in columns (-C), visualizes +# directories, links and other special files (-F) and pages everything through +# less. +# +# If available use GNU ls with colorized output. If it isn't available try +# normal ls which needs CLICOLOR_FORCE so it displays colors when used with a +# pager. If none work no colors are used. +# +# See `setup.sh` for details. LS_* are replaced with the appropriate values +# when this file is generated. +ls() { + LS_ARGS -C -F "$@" 2>&1 | less +} + +unalias ll lt la lal lat 2>/dev/null +# List the files in list format with access rights, etc. +alias ll='ls -l' +# List the files sorted by last modification date. +alias lt='ls -l -t' +# List all files. +alias la='ls -a' +# List all files in list format with access rights, etc. +alias lal='ls -al' +# List all files sorted by last modification date. +alias lat='ls -al -t' + + +# Make going up directories simple. +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' +alias .....='cd ../../../..' + +# Automatically use unified diffs. +alias diff='diff -u' + +# COLUMN is set to `| column -t` if it's available, empty otherwise. + +# Display all files (-s), use human readable sizes (-h) and display the +# complete size (-c). +alias du='du -shc' +# Use human readable sizes and format it nicely, thanks to climagic +# (http://twitter.com/climagic/status/49623386762129408). +df() { + command df -hP "$@" COLUMN +} + +# Highlight matched strings. Doesn't work with a pager! +alias grep='grep --color=auto' + +# Pipe output through less. +tree() { + command tree -C "$@" | less +} + +# Better viewer for info pages .. just pipe everything into less. +info() { + command info "$@" 2>/dev/null | less +} + +# Using su (or sudo) as root to a less privileged user might allow the other +# user to run arbitrary commands as root. See also Debian bugs #628843 and +# #657784. +if test "`id -u`" -eq 0; then + su() { + echo 'never su as root' >&2 + return 1 + } +fi + +# vim: ft=sh diff --git a/shell/shell/bin b/shell/shell/bin new file mode 120000 index 0000000..19f285a --- /dev/null +++ b/shell/shell/bin @@ -0,0 +1 @@ +../bin \ No newline at end of file diff --git a/shell/shell/dircolors.in b/shell/shell/dircolors.in new file mode 100644 index 0000000..82bafc6 --- /dev/null +++ b/shell/shell/dircolors.in @@ -0,0 +1,93 @@ +# Color settings for GNU ls. Read by `dircolors` to write the $LS_COLORS +# environment variable. + +# Copyright (C) 2013 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# See `dircolors --print-database` for possible colors. + +RESET 00 +# Normal files: no color. +NORMAL 00 + +# Regular files: normal. +FILE 00 +# Executable files: bold red. +EXEC 31;01 + +# Symbolic links: cyan (other possible value: "target", color based on target +# type). +LINK 36 +# Orphaned symbolic links (nonexistent or not-statable): cyan with red +# background. +ORPHAN 36;41 +# Regular files with multiple hard links: underlined. +MULTIHARDLINK 04 + +# setuid and setgid files: bold red with yellow background (red because they +# are executables). +SETUID 31;43;01 +SETGID 31;43;01 + +# Directories: bold blue. +DIR 34;01 +# Directories writable by other users and not sticky: bold blue with red +# background. +OTHER_WRITABLE 34;41;01 +# Directories with sticky bit and writable by others: bold blue with green +# background. +STICKY_OTHER_WRITABLE 34;42;01 +# Directories with sticky bit and not writable by others: bold blue with +# yellow background. +STICKY 34;43;01 + +# Named pipes: green. +FIFO 32 +# Sockets: green. +SOCK 32 +# Block devices: normal. +BLK 00 +# Character devices: normal. +CHR 00 + + +# Color important files which might be overlooked in full directories. +# +# `ls` can't color matching files, only matching extensions and suffixes; +# therefore use the suffix (which is a superset of matching extensions). As +# most filenames have no weird suffixes like "filenameNEWS", this should work +# fine most of the time. +# +# *foo matches files ending with foo, .foo only files with a foo extension +# (e.g. example.foo). + +# Read-me files (e.g. README, program.readme, etc.): bold magenta. +*README 35;01 +*README.adoc 35;01 +*README.txt 35;01 +*README.md 35;01 +*README.mkd 35;01 +*readme 35;01 +# Misc files: bold magenta. +*NEWS 35;01 +*FAQ 35;01 +*faq 35;01 +*TODO 35;01 +*todo 35;01 +# Makefiles: bold magenta. +*Makefile 35;01 + +# vim: ft=dircolors diff --git a/shell/shell/env b/shell/shell/env new file mode 100644 index 0000000..f3e4293 --- /dev/null +++ b/shell/shell/env @@ -0,0 +1,142 @@ +# Configuration file for environment related options for all shells. + +# Copyright (C) 2011-2015 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Use UTF-8 encoding in the terminal. Don't use LC_ALL as it's used for +# debugging purposes. Thanks to twb in #screen on Freenode (2009-10-02 10:25 +# CET). +LANG=en_US.UTF-8 +export LANG +# Use C locale when sorting. +LC_COLLATE=C +export LC_COLLATE + +# Just in case a nice administrator tries to force LC_ALL on us ... +unset LC_ALL +# Also reset the rest just in case. +unset LC_ADDRESS +unset LC_CTYPE +unset LC_IDENTIFICATION +unset LC_MEASUREMENT +unset LC_MESSAGES +unset LC_MONETARY +unset LC_NAME +unset LC_NUMERIC +unset LC_PAPER +unset LC_TELEPHONE +unset LC_TIME +# Make sure $LANGUAGE is not set. It's a GNU extension which can overwrite +# variables like $LANG or $LC_ALL. +unset LANGUAGE + +# Add ~/bin, ~/.bin and ~/.shell/bin to PATH if available. +if test -d "$HOME/.shell/bin"; then + PATH="$HOME/.shell/bin:$PATH" +fi +if test -d "$HOME/.bin"; then + PATH="$HOME/.bin:$PATH" +fi +if test -d "$HOME/bin"; then + PATH="$HOME/bin:$PATH" +fi + +# Use Vim as editor. +EDITOR=vim +export EDITOR + +# Set less as pager, its configuration is done through the ~/.less file. +PAGER=less +export PAGER + +escape=`printf '\033'` +# Color man pages viewed with less, thanks to [1]. +# +# [1]: http://nion.modprobe.de/blog/archives/572-less-colors-for-man-pages.html +# +# Color bold strings in bold blue. +LESS_TERMCAP_md="${escape}[01;34m" +LESS_TERMCAP_me="${escape}[0m" +export LESS_TERMCAP_md LESS_TERMCAP_me +# Color underlined strings in bold yellow and underlined. +LESS_TERMCAP_us="${escape}[01;4;33m" +LESS_TERMCAP_ue="${escape}[0m" +export LESS_TERMCAP_us LESS_TERMCAP_ue +# Color standout mode in bold black with yellow background. +LESS_TERMCAP_so="${escape}[01;30;43m" +LESS_TERMCAP_se="${escape}[0m" +export LESS_TERMCAP_so LESS_TERMCAP_se + +# Prefer a private and most likely fast directory (tmpfs) for temporary files +# to reduce security problems on multi-user systems. +if test -n "$XDG_RUNTIME_DIR" && test -d "$XDG_RUNTIME_DIR"; then + TMP="$XDG_RUNTIME_DIR" +# Use ~/.tmp and ~/.tmp as fallback. +elif test -d "$HOME/.tmp"; then + TMP="$HOME/.tmp" +elif test -d "$HOME/tmp"; then + TMP="$HOME/tmp" +else + TMP= +fi +if test -n "$TMP"; then + TEMP="$TMP" + TMPDIR="$TMP" + export TMP TEMP TMPDIR +fi + +# Change rlwrap's home directory to prevent cluttering ~/. +RLWRAP_HOME="$HOME/.shell/rlwrap" +export RLWRAP_HOME + +# Set colors for GNU ls (and Zsh completions). +if test -f "$HOME/.shell/dircolors"; then + . "$HOME/.shell/dircolors" +fi +# Set the same colors for non GNU ls, except for special cases which aren't +# supported. +LSCOLORS='ExgxxxxxBxxxxxBdBdExEb' +# ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ +# | | | | | | | | | | | +# | | | | | | | | | | *- directory writable to others, without sticky bit +# | | | | | | | | | *--- directory writable to others, with sticky bit +# | | | | | | | | *----- executable with setgid bit set +# | | | | | | | *------- executable with setuid bit set +# | | | | | | *--------- character special +# | | | | | *----------- block special +# | | | | *------------- executable +# | | | *--------------- pipe +# | | *----------------- socket +# | *------------------- symbolic link +# *--------------------- directory +export LSCOLORS + +# Setup lesspipe to view multiple file-types (like .gz, .zip, etc.) with less. +# Useful in combination with the "p" alias. Inspired by Debian's default bash +# files. Thanks. +if test -x /usr/bin/lesspipe; then + # Don't use eval $(lesspipe) which breaks on a few systems (e.g. Gentoo) + # due to a different lesspipe implementation. + LESSOPEN='| /usr/bin/lesspipe %s' + LESSCLOSE='/usr/bin/lesspipe %s %s' + export LESSOPEN LESSCLOSE +fi + +# Additional command line options for `mtr`. +MTR_OPTIONS='--show-ips' +export MTR_OPTIONS + +# vim: ft=sh diff --git a/shell/shell/functions b/shell/shell/functions new file mode 100644 index 0000000..838968b --- /dev/null +++ b/shell/shell/functions @@ -0,0 +1,30 @@ +# Shell functions useful to all shells. + +# Copyright (C) 2011-2014 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Source $1 if it exists. And $1.local if it exists as well. +source_config() { + if test -f "$1"; then + . "$1" + fi + + if test -f "$1.local"; then + . "$1.local" + fi +} + +# vim: ft=sh diff --git a/shell/shell/logout b/shell/shell/logout new file mode 100644 index 0000000..a5e1bbc --- /dev/null +++ b/shell/shell/logout @@ -0,0 +1,31 @@ +# Shell logout file usable by all shells. + +# Copyright (C) 2011-2013 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# When leaving the console clear the screen to increase privacy. Taken from +# Debian default bash files and modified. Thanks. + +if test -x /usr/bin/clear_console; then + /usr/bin/clear_console -q +else + clear +fi + +# Make sure sudo rights are removed. +sudo -k >/dev/null 2>&1 + +# vim: ft=sh diff --git a/shell/shell/rc b/shell/shell/rc new file mode 100644 index 0000000..d0261bb --- /dev/null +++ b/shell/shell/rc @@ -0,0 +1,117 @@ +# Shell configuration file. + +# Copyright (C) 2013-2014 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Normal umask for root (readable by all users). +if test "`id -u`" -eq 0; then + umask 022 +# Restricted umask for normal users (readable only by me). +else + umask 077 +fi + +# Disable flow control (^s and ^q). I use GNU Screen/Tmux which also supports +# this in a similar way (entering copy mode) and enabling flow control by +# accident is annoying. +if test -t 0; then + stty -ixon -ixoff +fi + +# Auto-logout after timeout on TTYs. It's easy to forget to logout after +# switching back to X11 from a TTY. +timeout_setup_screen_lock() { + echo "Locking GNU screen after $timeout seconds (TTY detected)." + screen -X idle $timeout lockscreen + echo +} +timeout_setup_tmux_lock() { + if type vlock >/dev/null; then + echo "Locking Tmux after $timeout seconds (TTY detected)." + tmux set-option lock-after-time $timeout + echo + + else + echo "vlock not found, locking won't work in Tmux!" >&2 + echo "Falling back to shell timeout." >&2 + echo + + timeout_setup_shell_logout + fi +} +timeout_setup_shell_logout() { + echo "Auto-logout after $timeout seconds (TTY detected)." + TMOUT=$timeout + echo +} +# Timeout in seconds. +local timeout >/dev/null 2>&1 +timeout=600 +case "$TERM" in + # `tty` doesn't work inside a pseudo-terminal as provided by GNU + # Screen/Tmux. + # + # The following settings for GNU Screen/Tmux will only auto-lock new + # sessions, not when attaching to existing sessions! + screen*) + if test -n "$STY"; then + case "$STY" in + *.tty[0-9]*.*) + timeout_setup_screen_lock + ;; + esac + elif test -n "$TMUX"; then + case "`tmux display -p '#{client_tty}'`" in + /dev/tty[0-9]*) + timeout_setup_tmux_lock + ;; + /dev/*) + # Not on TTY, nothing to do. + ;; + *) + echo 'Tmux < 1.8 found, TTY check might be incorrect!' >&2 + + local client >/dev/null 2>&1 + client=`printf '%s' "$TMUX" | sed 's/^.*,\([0-9]*\)$/\1/'` + + case "`tmux list-clients \ + | grep -E "^/dev/.*?: $client "`" in + /dev/tty[0-9]*) + timeout_setup_tmux_lock + ;; + esac + ;; + esac + else + echo 'TERM=screen but neither $STY nor $TMUX found!' >&2 + timeout_setup_shell_logout + fi + ;; + + *) + case `tty` in + /dev/tty[0-9]*) + timeout_setup_shell_logout + ;; + esac + ;; +esac +unset timeout +unset timeout_setup_screen_lock +unset timeout_setup_tmux_lock +unset timeout_setup_screen_lock + +# vim: ft=sh diff --git a/shell/ssh_config b/shell/ssh_config new file mode 100644 index 0000000..09995ab --- /dev/null +++ b/shell/ssh_config @@ -0,0 +1,137 @@ +# SSH configuration file. +# +# Some options are set even if they are default to prevent /etc/ssh/ssh_config +# from overwriting them. + +# Copyright (C) 2011-2016 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + +# Undocumented (and not very well tested) feature. This drops the connection +# after 5 seconds of inactivity. Thanks to shad0VV in #openssh on Freenode +# (2012-11-04 18:40 CET) for telling me about this undocumented feature. +# +# ServerAliveCountMax 0 +# ServerAliveInterval 5 + + +# Options are parsed top-to-bottom, the first matching option is used. Later +# assignments to the same option are ignored, thanks to anonJD in #openssh on +# Freenode (2011-05-18 21:40 CEST) for letting me know. Therefore put all +# affected host specific rules here, before the global rules. +# +# For example to change the MACs option for a specific host, use: +# +# Host host +# # Old SSH daemon which needs SHA1 (SHA-512 in case it gets updated). +# MACs hmac-sha2-512,hmac-sha1 + + +# Rules for all hosts. +Host * + +# Force protocol version 2 which is more secure (default). + Protocol 2 + +# Use stronger algorithms. If some hosts require weaker versions then use Host +# groups to enable them only for those specific machines. + +# Don't use SHA1 and disable elliptic curves whose security regarding the +# parameters is still in debate. + KexAlgorithms diffie-hellman-group-exchange-sha256 +# Use stronger cipher versions. Disable CBC ciphers to prevent (unlikely) +# plaintext recovery attack [1], disable RC4 because it's broken [2]; this +# leaves only AES. No GCM ciphers yet because they are still very new. +# +# [1]: http://www.openssh.com/txt/cbc.adv +# [2]: http://www.schneier.com/blog/archives/2013/03/new_rc4_attack.html + Ciphers aes256-ctr +# Don't use weak MACs like MD5 or SHA1. However strong MACs are not as +# important as strong ciphers because an attacker must be able to break a MAC +# in real time to modify the data in transmit. Prefer "-etm" algorithms which +# use encrypt-then-mac which is more secure than the default encrypt-and-mac +# in SSH [1] (available since 6.2). +# +# [1]: http://cseweb.ucsd.edu/~mihir/papers/oem.html + MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-512 +# Disable DSA host keys because they are weak (only 1024 bit) and elliptic +# curves. I don't need certificates, therefore disable those algorithms as +# well (*-cert-*). + HostKeyAlgorithms ssh-rsa + +# Disable X11 and agent forwarding for security reasons (defaults). + ForwardX11 no + ForwardAgent no +# Don't trust remote X11 clients. If enabled allows bad admins complete access +# to local X11! + ForwardX11Trusted no + +# Disable authentication methods I don't use. + ChallengeResponseAuthentication no + GSSAPIAuthentication no + HostbasedAuthentication no + KbdInteractiveAuthentication no +# Only enable those I need. + PasswordAuthentication yes + PubkeyAuthentication yes + +# Use only authentication identity files configured in ~/.ssh/config even if +# ssh-agent offers more identities. + IdentitiesOnly yes + +# Bind local forwardings to loopback only. This way no remote hosts can access +# them (default). + GatewayPorts no +# Abort if not all requested port forwardings can be set up. + ExitOnForwardFailure yes + +# Allow using -M (ControlMaster) to create a master SSH session which +# "tunnels" other connections to the same host, thus reducing the number of +# authentications (which are relatively slow) and TCP connections. The master +# sockets are stored in ~/.ssh (by default ControlPath is not set). Using %r +# (remote user name) might leak information to other users on the current +# system (e.g. via netstat or lsof). + ControlPath ~/.ssh/master/%l-%h-%p-%r +# Automatically create a new master session if there's none yet or use an +# existing one. This way the user doesn't have to use -M to enable a master +# manually. Don't set this option to "yes" or all SSH commands try to become +# the master session which is obviously not possible. + ControlMaster auto +# When the connection for a master is closed (e.g. logout of remote shell), +# move the master connection in the background. If there's no other active +# connection using the master, close it after x seconds. This prevents the +# client of the master connection from blocking because it waits for all +# connections using it to terminate which is very annoying. The timeout +# prevents stale master connections. + ControlPersist 10 + +# Don't permit running local commands (default). + PermitLocalCommand no + +# Don't send any environment variables (default). + SendEnv + +# Don't hash any hosts in ~/.ssh/known_hosts. It doesn't help if the ssh hosts +# are stored in the shell's history file or in this file as shortcut so it's +# rather useless (default). + HashKnownHosts no + +# Check host IP in known_hosts when connecting to detect DNS spoofing +# (default). + CheckHostIP yes +# Ask before adding any host keys to ~/.ssh/known_hosts (default). + StrictHostKeyChecking ask +# Check host keys from DNS' SSHFP resource records but ask apply +# StrictHostKeyChecking before trusting them. + VerifyHostKeyDNS ask diff --git a/shell/sshd_config b/shell/sshd_config new file mode 100644 index 0000000..0b7d95a --- /dev/null +++ b/shell/sshd_config @@ -0,0 +1,84 @@ +# SSH daemon configuration file. +# +# Some options are set even if they are default to document that they are +# important and to prevent upstream changes from affecting them. + +# Copyright (C) 2013-2016 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Listen on port 22 (default). +Port 22 + +# Only use protocol 2. Protocol 1 is insecure. (default) +Protocol 2 + +# Stronger algorithms. See ssh_config for details. +KexAlgorithms diffie-hellman-group-exchange-sha256 +Ciphers aes256-ctr +MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-512 + +# Use privilege separation for increased security. "sandbox" applies +# additional restrictions on the unprivileged process. +UsePrivilegeSeparation sandbox + +# Don't use PAM because it may circumvent other authentication methods used +# below (default). +UsePAM no +# Disable authentication methods I don't use. +ChallengeResponseAuthentication no +GSSAPIAuthentication no +HostbasedAuthentication no +KbdInteractiveAuthentication no +KerberosAuthentication no +PasswordAuthentication no +# Only enable those I need. +PubkeyAuthentication yes + +# Don't allow empty passwords (default). +PermitEmptyPasswords no +# Allow root-login only with public keys. +PermitRootLogin without-password + +# Be strict when checking user file permissions (default). +StrictModes yes + +# Allow more sessions per network connection (e.g. from ControlMaster/-M). +# When not enough sessions are available this message is sent by ssh: +# "mux_client_request_session: session request failed: Session open refused by +# peer". +MaxSessions 30 + +# Don't accept any environment variables from the client (default). +AcceptEnv +# Don't use ~/.ssh/environment and environment= options in +# ~/.ssh/authorized_keys because LD_PRELOAD could be used to circumvent +# authentications (default). +PermitUserEnvironment no + +# Send a message after the given seconds of inactivity through the encrypted +# channel. Used to detect stale connections more quickly. Not necessary on all +# servers. +#ClientAliveInterval 60 +# Disconnect the client if more than max count alive messages were lost +# (default). With the setting above this detects a broken connection after 3 +# minutes. +ClientAliveCountMax 3 + +# Enable sftp (and sshfs) usage. internal-sftp also works in chroots. +Subsystem sftp internal-sftp + +# Only allow logins for certain users. +AllowUsers root diff --git a/shell/terminfo/README b/shell/terminfo/README new file mode 100644 index 0000000..3c91b00 --- /dev/null +++ b/shell/terminfo/README @@ -0,0 +1,5 @@ +README +====== + +screen-it-256color is a modified screen-256color terminfo which handles italic +text for Tmux correctly. diff --git a/shell/terminfo/s/screen-it-256color b/shell/terminfo/s/screen-it-256color new file mode 100644 index 0000000..8651f3c Binary files /dev/null and b/shell/terminfo/s/screen-it-256color differ diff --git a/shell/tmux-window.pl b/shell/tmux-window.pl new file mode 100644 index 0000000..5e2601c --- /dev/null +++ b/shell/tmux-window.pl @@ -0,0 +1,93 @@ +#!/usr/bin/perl + +# Helper script to support quick window jumping with a prefix key for 0-9 in +# Tmux. + +# At the moment Tmux doesn't support mappings with multiple keys, e.g. prefix +# ;0, prefix ;1 etc. (where ; is the common secondary prefix key). But this +# works in GNU screen and is very useful to switch to windows quickly, e.g. +# prefix ;3 to switch to window 13 or prefix ;;5 to switch to window 25. +# +# To simulate this missing feature ; and 0-9 must be rebound when prefix ; is +# used, and unbound when ; or 0-9 was pressed and the window selected. This +# script generates these tedious mappings. +# +# For each number (0-9) the following mapping is generated (example with 0): +# +# bind-key -n 0 unbind-key -n 0 \; \ +# ... +# unbind-key -n 9 \; \ +# unbind-key -n \\; \ # this unmaps ; +# select-window -t :10 \; +# +# Due to Tmux's handling of errors, they abort the rest of the mapping, the +# select-window command is executed as last part of the mapping. +# +# If a secondary chaining (e.g. prefix ;;3) is requested, a second file like +# the generated one must be loaded with ; to jump to windows 20-29. Therefore +# the following line is added in this case. +# +# bind-key -n \; source-file "/path/to/second/file" +# +# To use these mappings first create the files using this script. To switch to +# windows 10-19 with ;0-;9 and to 20-29 with ;;0-;;9 run these commands (can +# be chained indefinitely): +# +# $ perl ./tmux-window.pl 1 "`pwd`/tmux-window2.conf" > tmux-window1.conf +# $ perl ./tmux-window.pl 2 > tmux-window2.conf +# +# Then add the following to your tmux.conf: +# +# bind-key \; source-file "/path/to/tmux-window1.conf" +# +# tmux-window1.conf automatically contains the path to tmux-window2.conf, +# therefore chaining for ;;3 will work to jump to window 23. + +# Copyright (C) 2012-2013 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +use strict; +use warnings; + + +if (scalar @ARGV != 1 && scalar @ARGV != 2) { + print STDERR "Usage: $0 []\n"; + exit 1; +} + +my $level = $ARGV[0]; +my $path = $ARGV[1]; + +if (defined $path and $path !~ m{^/}) { + print STDERR " must be an absolute path!\n"; + exit 2; +} + + +for (my $i = 0; $i < 10; $i++) { + print "bind-key -n $i "; + for (my $j = 0; $j < 10; $j++) { + print "unbind-key -n $j \\; "; + } + print "unbind-key -n \\\\; \\; "; + # Do the select-window last. If the window doesn't exist the failing + # select-window command prevents unbinding the other keys. + print "select-window -t :$level$i\n"; +} + +if (defined $path) { + print "bind-key -n \\; source-file \"$path\"\n"; +} diff --git a/shell/tmux.conf.in b/shell/tmux.conf.in new file mode 100644 index 0000000..6d582d9 --- /dev/null +++ b/shell/tmux.conf.in @@ -0,0 +1,133 @@ +# Tmux configuration file. +# +# Notes: +# +# - To swap/renumber windows (like GNU screen's :number command) use +# :swap-window -t . +# - GNU screen's screen -x can be replicated with tmux new-session -t. + +# Copyright (C) 2011-2013 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# GENERAL + +# Use vlock to lock the screen. Tmux doesn't have an internal lock program +# like GNU screen! +set-option -g lock-command "vlock" +# Lock sessions individually. Otherwise lock-after-time will wait on all other +# sessions to idle before it locks this session. +set-option -g lock-server off + +# Use Zsh as shell. Tmux does not display a warning if the shell isn't +# available! +set-option -g default-shell "/bin/zsh" + +# Use a larger window history, in lines. +set-option -g history-limit 50000 + +# Display Tmux messages for a longer time, in milliseconds. +set-option -g display-time 3000 + +# Open new windows with the current working directory used when Tmux was +# started, and not the working directory of the current pane. +set-option -g default-path "." + + +# TERMINAL + +# Enable 256 color mode. +set-option -g default-terminal "screen-256color" + +# Disable alternative screen feature. This way e.g. Vim's window content stays +# visible after quitting Vim. This is quite useful to copy data (needs tmux +# 1.5 to work (almost) completely). +set-window-option -g alternate-screen off + +# Set title for outer terminal. +set-option -g set-titles on + +# Don't rename windows to the currently running program, my zshrc does this +# for me (with some additional features). +set-window-option -g automatic-rename off + + +# STATUS LINE + +# White text. +set-option -g status-fg white +# Bright blue background color (colour12). +set-option -g status-bg colour12 + +# Nothing left of window list. +set-option -g status-left "" +# Current load average and hostname (#H) on the right. +set-option -g status-right "#(uptime | sed 's/^.*load averages*: //; s/,//g') \ + #H \ + #(~/.shell/bin/temperature.pl -t TEMPERATURE)\ + #[] #(~/.shell/bin/battery.pl -t BATTERY)\ + " + +# Format for windows in the window list in the status line. #I window index, +# #W window number, #F window flags. +set-window-option -g window-status-format "#I #W#F" +set-window-option -g window-status-current-format "#I #W#F" + +# Update status line commands (#(..)) only every minute. +set-option -g status-interval 60 + + +# BINDINGS + +# Use Vi(m) key bindings. +set-option -g status-keys vi +set-window-option -g mode-keys vi + +# Use Ctrl-A as escape binding, like in GNU screen. +set-option -g prefix C-a +# Ctrl-A a sends Ctrl-A to the process, like in GNU screen. +bind-key a send-prefix +unbind-key C-b + +# GNU screen like bindings (with C-x). +bind-key C-c new-window +bind-key C-a last-window +bind-key C-n next-window +bind-key C-p previous-window +bind-key C-[ copy-mode +bind-key C-] paste-buffer + +# Arrow-key replacements for tmux's prompt. +bind-key -t vi-edit C-n history-down +bind-key -t vi-edit C-p history-up + +# Display date/time, similar to GNU screen's ^a ^t. Tmux's default ^a t just +# displays the current time, but I often want to know the current date. +bind-key C-t display-message + +# Run urlview on the current screen content. Very useful to follow links. +# Thanks to Arch wiki (https://wiki.archlinux.org/index.php/Tmux) for the +# basic idea how to enable this in tmux. +bind-key C-b capture-pane \; \ + save-buffer ~/.tmp/tmux-urlview \; \ + delete-buffer \; \ + new-window "urlview <~/.tmp/tmux-urlview" + +# Binding for fast switching to windows 10 to 29 (and more if necessary). +# Thanks to Kays in #irssi on Freenode (2012-10-18 16:25 CEST) for reminding +# me of this issue in Tmux. See tmux-windows.pl for details how it works. +bind-key \; source-file "TMUX_WINDOW_PATH" + +# vim: ft=tmux diff --git a/shell/zsh/env b/shell/zsh/env new file mode 100644 index 0000000..30483a0 --- /dev/null +++ b/shell/zsh/env @@ -0,0 +1,35 @@ +# Zsh configuration file for environment related options. + +# Copyright (C) 2011-2014 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +. ~/.shell/functions + +source_config ~/.shell/env + + +# Make sure elements in PATH are unique. +typeset -U path PATH + +# Use $TMPDIR/zsh as directory for temporary Zsh files to prevent symlink +# attacks - only helps if $TMPDIR points to a safe directory (which should be +# true with the settings in shell/env). +TMPPREFIX="$TMPDIR/zsh" + + +source_config ~/.zsh/env.local + +# vim: ft=zsh diff --git a/shell/zsh/functions/_systemctl b/shell/zsh/functions/_systemctl new file mode 100644 index 0000000..c440dd7 --- /dev/null +++ b/shell/zsh/functions/_systemctl @@ -0,0 +1,418 @@ +#compdef systemctl + +(( $+functions[_systemctl_command] )) || _systemctl_command() +{ + local -a _systemctl_cmds + _systemctl_cmds=( + "list-sockets:List sockets" + "list-timers:List timers" + "list-units:List units" + "start:Start (activate) one or more units" + "stop:Stop (deactivate) one or more units" + "reload:Reload one or more units" + "restart:Start or restart one or more units" + "condrestart:Restart one or more units if active" + "try-restart:Restart one or more units if active" + "reload-or-restart:Reload one or more units if possible, otherwise start or restart" + "force-reload:Reload one or more units if possible, otherwise restart if active" + "hibernate:Hibernate the system" + "hybrid-sleep:Hibernate and suspend the system" + "reload-or-try-restart:Reload one or more units if possible, otherwise restart if active" + "isolate:Start one unit and stop all others" + "kill:Send signal to processes of a unit" + "is-active:Check whether units are active" + "is-failed:Check whether units are failed" + "status:Show runtime status of one or more units" + "show:Show properties of one or more units/jobs or the manager" + "cat:Show the source unit files and drop-ins" + "reset-failed:Reset failed state for all, one, or more units" + "list-unit-files:List installed unit files" + "enable:Enable one or more unit files" + "disable:Disable one or more unit files" + "reenable:Reenable one or more unit files" + "preset:Enable/disable one or more unit files based on preset configuration" + "set-default:Set the default target" + "get-default:Query the default target" + "edit:Edit one or more unit files" + "is-system-running:Query overall status of the system" + "help:Show documentation for specified units" + "list-dependencies:Show unit dependency tree" + "mask:Mask one or more units" + "unmask:Unmask one or more units" + "link:Link one or more units files into the search path" + "is-enabled:Check whether unit files are enabled" + "list-jobs:List jobs" + "cancel:Cancel all, one, or more jobs" + "snapshot:Create a snapshot" + "delete:Remove one or more snapshots" + "show-environment:Dump environment" + "set-environment:Set one or more environment variables" + "unset-environment:Unset one or more environment variables" + "daemon-reload:Reload systemd manager configuration" + "daemon-reexec:Reexecute systemd manager" + "default:Enter system default mode" + "rescue:Enter system rescue mode" + "emergency:Enter system emergency mode" + "halt:Shut down and halt the system" + "suspend:Suspend the system" + "poweroff:Shut down and power-off the system" + "reboot:Shut down and reboot the system" + "kexec:Shut down and reboot the system with kexec" + "exit:Ask for user instance termination" + "switch-root:Change root directory" + ) + + if (( CURRENT == 1 )); then + _describe -t commands 'systemctl command' _systemctl_cmds || compadd "$@" + else + local curcontext="$curcontext" expl + + cmd="${${_systemctl_cmds[(r)$words[1]:*]%%:*}}" + # Deal with any aliases + case $cmd in + condrestart) cmd="try-restart";; + force-reload) cmd="reload-or-try-restart";; + esac + + # CHANGED: my aliases + case $words[1] in + c) cmd=cat ;; + d) cmd=disable ;; + e) cmd=enable ;; + k) cmd=kill ;; + m) cmd=mask ;; + r) cmd=restart ;; + rl) cmd=reload ;; + s) cmd=status ;; + sa) cmd=start ;; + so) cmd=stop ;; + u) cmd=unmask ;; + esac + + if (( $#cmd )); then + curcontext="${curcontext%:*:*}:systemctl-${cmd}:" + + local update_policy + zstyle -s ":completion:${curcontext}:" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy _systemctl_caching_policy + fi + + _call_function ret _systemctl_$cmd || _message 'no more arguments' + else + _message "unknown systemctl command: $words[1]" + fi + return ret + fi +} + +__systemctl() +{ + systemctl $_sys_service_mgr --full --no-legend --no-pager "$@" +} + + +# Fills the unit list +_systemctl_all_units() +{ + if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid SYS_ALL_UNITS ) && + ! _retrieve_cache SYS_ALL_UNITS; + then + _sys_all_units=( ${${(f)"$(__systemctl list-units --all)"}%% *} ) + _store_cache SYS_ALL_UNITS _sys_all_units + fi +} + +# Fills the unit list including all file units +_systemctl_really_all_units() +{ + local -a all_unit_files; + local -a really_all_units; + if ( [[ ${+_sys_really_all_units} -eq 0 ]] || _cache_invalid SYS_REALLY_ALL_UNITS ) && + ! _retrieve_cache SYS_REALLY_ALL_UNITS; + then + all_unit_files=( ${${(f)"$(__systemctl list-unit-files)"}%% *} ) + _systemctl_all_units + really_all_units=($_sys_all_units $all_unit_files) + _sys_really_all_units=(${(u)really_all_units}) + _store_cache SYS_REALLY_ALL_UNITS _sys_really_all_units + fi +} + +_filter_units_by_property() { + local property=$1 value=$2 ; shift ; shift + local -a units ; units=($*) + local props + for props in ${(ps:\n\n:)"$(_call_program units "$service show --no-pager --property="Id,$property" -- ${units} 2>/dev/null")"}; do + props=(${(f)props}) + if [[ "${props[2]}" = "$property=$value" ]]; then + echo -E - " ${props[1]#Id=}" + fi + done +} + +_systemctl_get_template_names() { echo -E - ${^${(M)${(f)"$(__systemctl list-unit-files)"}##*@.[^[:space:]]##}%%@.*}\@ } + + +_systemctl_active_units() {_sys_active_units=( ${${(f)"$(__systemctl list-units)"}%% *} )} + +_systemctl_startable_units(){ + _sys_startable_units=( $( _filter_units_by_property ActiveState inactive $( + _filter_units_by_property CanStart yes $( + __systemctl $mode list-unit-files --state enabled,disabled,static | \ + { while read -r a b; do [[ $a =~ @\. ]] || echo -E - " $a"; done; } + __systemctl $mode list-units --state inactive,failed | \ + { while read -r a b; do echo -E - " $a"; done; } )) ) ) +} + +_systemctl_restartable_units(){ + _sys_restartable_units=( $(_filter_units_by_property CanStart yes $( + __systemctl $mode list-unit-files --state enabled,disabled,static | \ + { while read -r a b; do [[ $a =~ @\. ]] || echo -E - " $a"; done; } + __systemctl $mode list-units | \ + { while read -r a b; do echo -E - " $a"; done; } )) ) +} + +_systemctl_failed_units() {_sys_failed_units=( ${${(f)"$(__systemctl list-units --failed)"}%% *} ) } +_systemctl_unit_state() { typeset -gA _sys_unit_state; _sys_unit_state=( $(__systemctl list-unit-files) ) } + +local fun +# Completion functions for ALL_UNITS +for fun in is-active is-failed is-enabled status show cat mask preset help list-dependencies edit ; do + (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() + { + _systemctl_really_all_units + _wanted systemd-units expl unit \ + compadd "$@" -a - _sys_really_all_units + } +done + +# Completion functions for ENABLED_UNITS +(( $+functions[_systemctl_disable] )) || _systemctl_disable() +{ + local _sys_unit_state; _systemctl_unit_state + _wanted systemd-units expl 'enabled unit' \ + compadd "$@" - ${(k)_sys_unit_state[(R)enabled]} +} + +(( $+functions[_systemctl_reenable] )) || _systemctl_reenable() +{ + local _sys_unit_state; _systemctl_unit_state + _wanted systemd-units expl 'enabled/disabled unit' \ + compadd "$@" - ${(k)_sys_unit_state[(R)(enabled|disabled)]} $(_systemctl_get_template_names) +} + +# Completion functions for DISABLED_UNITS +(( $+functions[_systemctl_enable] )) || _systemctl_enable() +{ + local _sys_unit_state; _systemctl_unit_state + _wanted systemd-units expl 'disabled unit' \ + compadd "$@" - ${(k)_sys_unit_state[(R)disabled]} $(_systemctl_get_template_names) +} + +# Completion functions for FAILED_UNITS +(( $+functions[_systemctl_reset-failed] )) || _systemctl_reset-failed() +{ + local _sys_failed_units; _systemctl_failed_units + _wanted systemd-units expl 'failed unit' \ + compadd "$@" -a - _sys_failed_units || _message "no failed unit found" +} + +# Completion functions for STARTABLE_UNITS +(( $+functions[_systemctl_start] )) || _systemctl_start() +{ + local _sys_startable_units; _systemctl_startable_units + _wanted systemd-units expl 'startable unit' \ + compadd "$@" - ${_sys_startable_units[*]} $(_systemctl_get_template_names) +} + +# Completion functions for STOPPABLE_UNITS +for fun in stop kill try-restart condrestart ; do + (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() + { + local _sys_active_units; _systemctl_active_units + _wanted systemd-units expl 'stoppable unit' \ + compadd "$@" - $( _filter_units_by_property CanStop yes \ + ${_sys_active_units[*]} ) + } +done + +# Completion functions for ISOLATABLE_UNITS +(( $+functions[_systemctl_isolate] )) || _systemctl_isolate() +{ + _systemctl_all_units + _wanted systemd-units expl 'isolatable unit' \ + compadd "$@" - $( _filter_units_by_property AllowIsolate yes \ + ${_sys_all_units[*]} ) +} + +# Completion functions for RELOADABLE_UNITS +for fun in reload reload-or-try-restart force-reload ; do + (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() + { + local _sys_active_units; _systemctl_active_units + _wanted systemd-units expl 'reloadable unit' \ + compadd "$@" - $( _filter_units_by_property CanReload yes \ + ${_sys_active_units[*]} ) + } +done + +# Completion functions for RESTARTABLE_UNITS +for fun in restart reload-or-restart ; do + (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() + { + local _sys_restartable_units; _systemctl_restartable_units + _wanted systemd-units expl 'restartable unit' \ + compadd "$@" - ${_sys_restartable_units[*]} $(_systemctl_get_template_names) + } +done + +# Completion functions for MASKED_UNITS +(( $+functions[_systemctl_unmask] )) || _systemctl_unmask() +{ + local _sys_unit_state; _systemctl_unit_state + _wanted systemd-units expl 'masked unit' \ + compadd "$@" - ${(k)_sys_unit_state[(R)masked]} || _message "no masked units found" +} + +# Completion functions for JOBS +(( $+functions[_systemctl_cancel] )) || _systemctl_cancel() +{ + _wanted systemd-jobs expl job \ + compadd "$@" - ${${(f)"$(__systemctl list-jobs)"}%% *} || + _message "no jobs found" +} + +# Completion functions for SNAPSHOTS +(( $+functions[_systemctl_delete] )) || _systemctl_delete() +{ + _wanted systemd-snapshots expl snapshot \ + compadd "$@" - ${${(f)"$(__systemctl list-units --type snapshot --all)"}%% *} || + _message "no snapshots found" +} + +# Completion functions for TARGETS +(( $+functions[_systemctl_set-default] )) || _systemctl_set-default() +{ + _wanted systemd-targets expl target \ + compadd "$@" - ${${(f)"$(__systemctl list-unit-files --type target --all)"}%% *} || + _message "no targets found" +} + +# Completion functions for ENVS +for fun in set-environment unset-environment ; do + (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() + { + local fun=$0 ; fun=${fun##_systemctl_} + local suf + if [[ "${fun}" = "set-environment" ]]; then + suf='-S=' + fi + _wanted systemd-environment expl 'environment variable' \ + compadd "$@" ${suf} - ${${(f)"$(systemctl show-environment)"}%%=*} + } +done + +(( $+functions[_systemctl_link] )) || _systemctl_link() { + _sd_unit_files +} + +(( $+functions[_systemctl_switch-root] )) || _systemctl_switch-root() { + _files +} + +# no systemctl completion for: +# [STANDALONE]='daemon-reexec daemon-reload default +# emergency exit halt kexec list-jobs list-units +# list-unit-files poweroff reboot rescue show-environment' +# [NAME]='snapshot' + +_systemctl_caching_policy() +{ + local _sysunits + local -a oldcache + + # rebuild if cache is more than a day old + oldcache=( "$1"(mh+1) ) + (( $#oldcache )) && return 0 + + _sysunits=(${${(f)"$(__systemctl --all)"}%% *}) + + if (( $#_sysunits )); then + for unit in $_sysunits; do + [[ "$unit" -nt "$1" ]] && return 0 + done + fi + + return 1 +} + +_unit_states() { + local -a _states + _states=(loaded failed active inactive not-found listening running waiting plugged mounted exited dead masked) + _values -s , "${_states[@]}" +} + +_unit_types() { + local -a _types + _types=(automount busname device mount path service snapshot socket swap target timer) + _values -s , "${_types[@]}" +} + +_unit_properties() { + if ( [[ ${+_sys_all_properties} -eq 0 ]] || _cache_invalid SYS_ALL_PROPERTIES ) && + ! _retrieve_cache SYS_ALL_PROPERTIES; + then + _sys_all_properties=( ${${(M)${(f)"$(__systemctl show --all; + /lib/systemd/systemd --dump-configuration-items)"}##[[:alnum:]]##=*}%%=*} + ) + _store_cache SYS_ALL_PROPRTIES _sys_all_properties + fi + _values -s , "${_sys_all_properties[@]}" +} + +_job_modes() { + local -a _modes + _modes=(fail replace replace-irreversibly isolate ignore-dependencies ignore-requirements flush) + _values -s , "${_modes[@]}" +} + +local -a _modes; _modes=("--user" "--system") +local _sys_service_mgr=${${words:*_modes}[(R)(${(j.|.)_modes})]:---system} +_arguments -s \ + {-h,--help}'[Show help]' \ + '--version[Show package version]' \ + {-t+,--type=}'[List only units of a particular type]:unit type:_unit_types' \ + '--state=[Display units in the specified state]:unit state:_unit_states' \ + '--job-mode=[Specify how to deal with other jobs]:mode:_job_modes' \ + {-p+,--property=}'[Show only properties by specific name]:unit property:_unit_properties' \ + {-a,--all}'[Show all units/properties, including dead/empty ones]' \ + '--reverse[Show reverse dependencies]' \ + '--after[Show units ordered after]' \ + '--before[Show units ordered before]' \ + '--failed[Show only failed units]' \ + {-l,--full}"[Don't ellipsize unit names on output]" \ + '--show-types[When showing sockets, show socket type]' \ + {-i,--ignore-inhibitors}'[When executing a job, ignore jobs dependencies]' \ + {-q,--quiet}'[Suppress output]' \ + '--no-block[Do not wait until operation finished]' \ + '--no-legend[Do not print a legend, i.e. the column headers and the footer with hints]' \ + '--no-pager[Do not pipe output into a pager]' \ + '--system[Connect to system manager]' \ + '--user[Connect to user service manager]' \ + "--no-wall[Don't send wall message before halt/power-off/reboot]" \ + '--global[Enable/disable unit files globally]' \ + "--no-reload[When enabling/disabling unit files, don't reload daemon configuration]" \ + '--no-ask-password[Do not ask for system passwords]' \ + '--kill-who=[Who to send signal to]:killwho:(main control all)' \ + {-s+,--signal=}'[Which signal to send]:signal:_signals' \ + {-f,--force}'[When enabling unit files, override existing symlinks. When shutting down, execute action immediately]' \ + '--root=[Enable unit files in the specified root directory]:directory:_directories' \ + '--runtime[Enable unit files only temporarily until next reboot]' \ + {-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \ + {-P,--privileged}'[Acquire privileges before execution]' \ + {-n+,--lines=}'[Journal entries to show]:number of entries' \ + {-o+,--output=}'[Change journal output mode]:modes:_sd_outputmodes' \ + '--firmware-setup[Tell the firmware to show the setup menu on next boot]' \ + '--plain[When used with list-dependencies, print output as a list]' \ + '*::systemctl command:_systemctl_command' diff --git a/shell/zsh/functions/extract b/shell/zsh/functions/extract new file mode 100644 index 0000000..5a73454 --- /dev/null +++ b/shell/zsh/functions/extract @@ -0,0 +1,41 @@ +# Author: Copyright © 2005 Eric P. Mangold - teratorn (-at-) gmail (-dot) com +# License: MIT. http://www.opensource.org/licenses/mit-license.html +# http://zshwiki.org/home/examples/functions + +local old_dirs current_dirs lower +lower=${(L)1} +old_dirs=( *(N/) ) +if [[ $lower == *.tar.gz || $lower == *.tgz ]]; then + tar zxfv $1 +elif [[ $lower == *.gz ]]; then + gunzip $1 +elif [[ $lower == *.tar.bz2 || $lower == *.tbz ]]; then + bunzip2 -c $1 | tar xfv - +elif [[ $lower == *.bz2 ]]; then + bunzip2 $1 +elif [[ $lower == *.zip ]]; then + unzip $1 +elif [[ $lower == *.rar ]]; then + unrar e $1 +elif [[ $lower == *.tar ]]; then + tar xfv $1 +elif [[ $lower == *.lha ]]; then + lha e $1 +else + print "Unknown archive type: $1" + return 1 +fi +# Change in to the newly created directory, and +# list the directory contents, if there is one. +current_dirs=( *(N/) ) +for i in {1..${#current_dirs}}; do + if [[ $current_dirs[$i] != $old_dirs[$i] ]]; then + cd $current_dirs[$i] + ls + break + fi +done + +#compdef '_files -g "*.gz *.tgz *.bz2 *.tbz *.zip *.rar *.tar *.lha"' extract_archive + +# vim: ft=zsh diff --git a/shell/zsh/logout b/shell/zsh/logout new file mode 100644 index 0000000..a540ec8 --- /dev/null +++ b/shell/zsh/logout @@ -0,0 +1,21 @@ +# Zsh logout file. + +# Copyright (C) 2011-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +source_config ~/.shell/logout + +# vim: ft=zsh diff --git a/shell/zsh/rc b/shell/zsh/rc new file mode 100644 index 0000000..7222619 --- /dev/null +++ b/shell/zsh/rc @@ -0,0 +1,1119 @@ +# Zsh configuration file. + +# Copyright (C) 2011-2014 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Warn when creating global variables from inside a function. Needs to be set +# before declaring a function. +setopt warn_create_global + + +# HELPER FUNCTIONS + +# Return the name of the program which is called in the foreground with `fg`. +# $1 is the name of the program (optional). If it's not 'fg' or 'fg *' it's +# returned unchanged. +zshrc_resolve_fg_to_resumed_job_name() { + # $REPLY is used by convention for scalars ($reply for arrays) to return + # values from functions. unset it here to prevent problems when REPLY is + # bound to an integer or similar. Thanks to Mikachu in #zsh on Freenode + # (2012-09-27 17:14 CEST) for this hint. + unset REPLY + + # Replace fg with the resumed job name. + if [[ $1 == fg ]]; then + REPLY=${jobtexts[%+]} + elif [[ $1 == fg\ * ]]; then + REPLY=${jobtexts[${1#fg }]} + # Normal program, return as is. + else + REPLY=$1 + fi +} + + +# MISCELLANEOUS SETTINGS + +# Prevent warnings. +typeset -g TMOUT +# Load general shell setup commands. NOTE: Expand this when publishing the +# config. +source_config ~/.shell/rc + +# Disable beeps. +setopt nobeep + +# Prevent overwriting existing files with '> filename', use '>| filename' +# (or >!) instead. +setopt noclobber + +# Entering the name of a directory (if it's not a command) will automatically +# cd to that directory. +setopt autocd + +# When entering a nonexistent command name automatically try to find a similar +# one. +setopt correct + +# Enable zsh's extended glob abilities. +setopt extendedglob + +# Don't exit if is pressed. Prevents exiting the shell by accident (e.g. +# pressing twice). +setopt ignoreeof + +# Also display PID when suspending a process. +setopt longlistjobs + + +# KEY BINDINGS + +# Not all bindings are done here, only those not specific to a given section. + +# Use Vi(m) style key bindings. +bindkey -v + +# Use jk to exit insert mode (jj is too slow to type). +bindkey 'jk' vi-cmd-mode + +# I don't need the arrow keys, I use ^N and ^P for this (see below). +bindkey -r '^[OA' '^[OB' '^[OC' '^[OD' '^[[A' '^[[B' '^[[C' '^[[D' +# Also not in Vi mode. +bindkey -a -r '^[OA' '^[OB' '^[OC' '^[OD' '^[[A' '^[[B' '^[[C' '^[[D' + + +# FUNCTION SETTINGS + +# Make sure every entry in $fpath is unique. +typeset -U fpath +# ~/.zsh/functions/completion is a symbolic link to the Completion directory +# of a Zsh Git checkout. Use it to get the newest completions if available. +if [[ -d ~/.zsh/functions/completion ]]; then + fpath=(~/.zsh/functions/completion/*/*(/) $fpath) +fi +# Set correct fpath to allow loading my functions (including completion +# functions). +fpath=(~/.zsh/functions $fpath) +# Autoload my functions (except completion functions and hidden files). Thanks +# to caphuso from the Zsh example files for this idea. +if [[ -d ~/.zsh/functions ]]; then + autoload -Uz ${fpath[1]}/^_*(^/:t) +fi + +# Simulate hooks using _functions arrays for Zsh versions older than 4.3.4. At +# the moment only precmd(), preexec() and chpwd() are simulated. +if [[ $ZSH_VERSION != (4.3.<4->*|4.<4->*|<5->*) ]]; then + # Run all functions defined in the ${precmd,preexec,chpwd}_functions + # arrays. + function precmd() { + for function in $precmd_functions; do + $function "$@" + done + } + function preexec() { + for function in $preexec_functions; do + $function "$@" + done + } + function chpwd() { + for function in $chpwd_functions; do + $function "$@" + done + } +fi + +# Load zmv (zsh move) which is a powerful file renamer. +autoload -Uz zmv + + +# HISTORY SETTINGS + +# Use history and store it in ~/.zsh/history. +HISTSIZE=1000000 +SAVEHIST=1000000 +HISTFILE=~/.zsh/history +# Append to the history file instead of overwriting it and do it immediately +# when a command is executed. +setopt appendhistory +setopt incappendhistory +# If the same command is run multiple times store it only once in the history. +setopt histignoredups +# Don't add lines starting with a space to the history. +setopt histignorespace + +# Vim like completions of previous executed commands (also enter Vi-mode). If +# called at the beginning it just recalls old commands (like cursor up), if +# called after typing something, only lines starting with the typed text are +# returned. Very useful to get old commands quickly - in addition to the +# history commands (!..). Thanks to Mikachu in #zsh on Freenode (2010-01-17 +# 12:47 CET) for the information how to a use function with bindkey. +zle -N zshrc-vi-history-beginning-search-backward +zshrc-vi-history-beginning-search-backward() { + local not_at_beginning_of_line + if [[ $CURSOR -ne 0 ]]; then + not_at_beginning_of_line=yes + fi + + zle history-beginning-search-backward + + # Start Vi-mode and stay at the same position (Vi-mode moves one left, + # this counters it). + zle vi-cmd-mode + if [[ -n $not_at_beginning_of_line ]]; then + zle vi-forward-char + fi +} +bindkey '^P' zshrc-vi-history-beginning-search-backward +bindkey -a '^P' history-beginning-search-backward # binding for Vi-mode +# Here only Vi-mode is necessary as ^P enters Vi-mode and ^N only makes sense +# after calling ^P. +bindkey -a '^N' history-beginning-search-forward + +# Enable incremental search which is especially useful when the string is an +# argument and not the command. +bindkey '^R' history-incremental-pattern-search-backward +# Also enable my usual use of Ctrl-P/Ctrl-N to get the previous/next matching +# history entry. +if [[ $ZSH_VERSION == (4.<4->*|<5->*) ]]; then + bindkey -M isearch '^P' history-incremental-pattern-search-backward + bindkey -M isearch '^N' history-incremental-pattern-search-forward +fi + +# Automatically push cd-ed directories on the directory stack. +setopt autopushd +# Don't push duplicates on the directory stack. +setopt pushdignoredups +# Exchange the meaning of + and - when specifying a directory on the stack. +# This way cd - lists the last used directory first, which is more +# natural because cd - goes to the last directory. +setopt pushdminus + + +# PROMPT SETTINGS + +# Use colorized output, necessary for prompts and completions. +autoload -Uz colors; colors + +# Necessary for $EPOCHSECONDS, the UNIX time. +zmodload zsh/datetime + +# Some shortcuts for colors. The %{...%} tells zsh that the data in between +# doesn't need any space, necessary for correct prompt drawing. Use %F{color} +# in more recent zsh versions (here compatibility is important). +local red="%{${fg[red]}%}" +local blue="%{${fg[blue]}%}" +local green="%{${fg[green]}%}" +local yellow="%{${fg[yellow]}%}" +local default="%{${fg[default]}%}" + +# vcs_info was added in 4.3.9 but it works in earlier versions too. So load it +# if the necessary files are available in ~/.zsh/functions/vcs_info (often a +# symbolic link to current checkout of Zsh's sources). +if [[ $ZSH_VERSION == (4.3.<9->*|4.<4->*|<5->*) || + -d ~/.zsh/functions/vcs_info ]]; then + # Update fpath to allow loading the vcs_info functions. + if [[ -d ~/.zsh/functions/vcs_info ]]; then + fpath=(~/.zsh/functions/vcs_info/ + ~/.zsh/functions/vcs_info/Backends + $fpath) + fi + + # Load vcs_info to display information about version control repositories. + autoload -Uz vcs_info + # Only look for certain VCS. + zstyle ':vcs_info:*' enable git + # Check the repository for changes so they can be used in %u/%c (see + # below). This comes with a speed penalty for bigger repositories. + zstyle ':vcs_info:*' check-for-changes yes + + # Set style of vcs_info display. The current branch (green) and VCS (blue) + # is displayed. If there is an special action going on (merge, rebase) + # it's also displayed (red). Also display if there are unstaged or staged + # (%u/%c) changes. + if [[ $ZSH_VERSION == (4.3.<11->*|4.<4->*|<5->*) || + -d ~/.zsh/functions/vcs_info ]]; then + zstyle ':vcs_info:*' formats \ + "(${green}%b%u%c${default}:${blue}%s${default}%m)" \ + "${green}%u%c${default}" + zstyle ':vcs_info:*' actionformats \ + "(${green}%b%u%c${default}/${red}%a${default}:${blue}%s${default}%m)" \ + "${green}%u%c${default}" + else + # In older versions %u and %c are not defined yet and are not + # correctly expanded. + zstyle ':vcs_info:*' formats \ + "(${green}%b${default}:${blue}%s${default})" + zstyle ':vcs_info:*' actionformats \ + "(${green}%b${default}/${red}%a${default}:${blue}%s${default})" + fi + # Set style for formats/actionformats when unstaged (%u) and staged (%c) + # changes are detected in the repository; check-for-changes must be set to + # true for this to work. Thanks to Bart Trojanowski + # (http://jukie.net/~bart/blog/pimping-out-zsh-prompt) for the idea + # (2010-03-11 00:20 CET). + zstyle ':vcs_info:*' unstagedstr '¹' + zstyle ':vcs_info:*' stagedstr '²' + + # Default to run vcs_info. If possible we prevent running it later for + # speed reasons. If set to a non empty value vcs_info is run. + zshrc_force_run_vcs_info=1 + + # Cache system inspired by Bart Trojanowski + # (http://jukie.net/~bart/blog/pimping-out-zsh-prompt). + zstyle ':vcs_info:*+pre-get-data:*' hooks pre-get-data + +vi-pre-get-data() { + # Only Git and Mercurial support and need caching. Abort if any other + # VCS is used. + [[ $vcs != git && $vcs != hg ]] && return + + # If the shell just started up or we changed directories (or for other + # custom reasons) we must run vcs_info. + if [[ -n $zshrc_force_run_vcs_info ]]; then + zshrc_force_run_vcs_info= + return + fi + + # Don't run vcs_info by default to speed up the shell. + ret=1 + # If a git/hg command was run then run vcs_info as the status might + # need to be updated. + case $(fc -ln $(($HISTCMD-1))) in + git* | g\ *) + ret=0 + ;; + hg*) + ret=0 + ;; + esac + } + + # Display number of WIP stashes (this excludes manually named commits + # which might be used for something else), thanks to + # http://eseth.org/2010/git-in-zsh.html (viewed on 2013-04-27) for the + # idea to display the stash count. + function +vi-git-stashes() { + if [[ -s ${hook_com[base]/.git/refs/stash} ]]; then + local -a stashes + # Thanks to Valodim in #zsh on Freenode (2013-07-01 14:14 CEST) + # for the solution to "grep" the output with (M) and :#(...). + stashes=( ${(M)${(f)"$(git stash list 2>/dev/null)"}:#(*WIP*)} ) + + if [[ ${#stashes} -gt 0 ]]; then + hook_com[misc]+=" ${yellow}${#stashes}s${default}" + fi + fi + } + + # Apply hooks to Git. + zstyle ':vcs_info:git*+set-message:*' hooks git-stashes + + # Must run vcs_info when changing directories. + prompt_chpwd() { + zshrc_force_run_vcs_info=1 + } + chpwd_functions+=(prompt_chpwd) + + # Used by prompt code below to determine if vcs_info should be run. + zshrc_use_vcs_info=1 +else + zshrc_use_vcs_info= +fi + +typeset -a zshrc_longrun_data +zshrc_longrun_data=() +# Display runtime in seconds for long running programs (> 60 seconds) and send +# a bell to notify me. +zshrc_longrun_preexec() { + local program=$3 + + # Handle fg. + local REPLY + zshrc_resolve_fg_to_resumed_job_name $program + program=$REPLY + + # No background process found. + if [[ -z $program ]]; then + return + fi + + # Don't track the time for certain (possible) long running processes which + # need no automatic notification. + local ignore + for ignore in elinks man mutt vim; do + case $program in + $ignore | $ignore\ *) + zshrc_longrun_data=() + return + ;; + esac + done + + zshrc_longrun_data=($program $EPOCHSECONDS) +} +zshrc_longrun_precmd() { + # No previous timestamp available or disabled for this command, ignore. + if [[ -z $zshrc_longrun_data ]]; then + return + fi + + local difference=$(( EPOCHSECONDS - zshrc_longrun_data[2] )) + if [[ $difference -gt 60 ]]; then + echo + echo -n "${fg[yellow]}" + echo -n "~> ${(V)zshrc_longrun_data[1]} took $difference seconds." + echo -n "${fg[default]}" + echo "\a" # send bell + fi + + # Clear status. Prevents displaying old status information when pressing + # enter with an empty command line. + zshrc_longrun_data=() +} +preexec_functions+=(zshrc_longrun_preexec) +precmd_functions+=(zshrc_longrun_precmd) + +# Set the prompt. A two line prompt is used. On the top left the current +# working directory is displayed, on the right vcs_info (if available) and the +# current time in hex. On the bottom left current user name and host is shown, +# the exit code of the last command if it wasn't 0, the number of running jobs +# if not 0. +# +# The prompt is in green and blue to make easily detectable, the error exit +# code in red and bold and the job count in yellow. Designed for dark +# terminals. +# +# Thanks to Adam's prompt for the basic idea of this prompt. +zshrc_prompt_precmd() { + # Regex to remove elements which take no space. Used to calculate the + # width of the top prompt. Thanks to Bart's and Adam's prompt code in + # Functions/Prompts/prompt_*_setup. + local zero='%([BSUbfksu]|([FB]|){*})' + + # Call vcs_info before every prompt. + if [[ -n $zshrc_use_vcs_info ]]; then + vcs_info + else + vcs_info_msg_0_= + vcs_info_msg_1_= + fi + + # Setup. Create variables holding the formatted content. + + # Current directory in yellow, truncated if necessary (WIDTH is replaced + # below). + local directory="${yellow}%WIDTH<..<%~%<<${default}" + # Minimal information about the VCS, only displayed if there are + # unstaged/staged changes. + local vcs_staged=${vcs_info_msg_1_} + + # Information about the VCS in this directory. + local vcs=${vcs_info_msg_0_} + # Current time (seconds since epoch) in Hex in bright blue. + local seconds="${blue}%B0x$(([##16] EPOCHSECONDS))%b${default}" + + # User name (%n) in bright green. + local user="${green}%B%n%b${default}" + # Host name (%m) in bright green; underlined if running on a remote system + # through SSH. + local host="${green}%B%m%b${default}" + if [[ -n $SSH_CONNECTION ]]; then + host="%U${host}%u" + fi + + # Number of background processes in yellow if not zero. + local background="%(1j.${yellow}%j${default}.)" + # Exit code in bright red in parentheses if not zero. + local exitcode="%(?..(${red}%B%?%b${default}%) )" + # Prompt symbol, % for normal users, # in red for root. + local symbol="%(!.${red}#${default}.%%)" + + # Prefix characters in first and second line. + local top_prefix="${blue}%B.-%b${default}" + local bottom_prefix="${blue}%B'%b${default}" + + # Combine them to create the prompt. + + local top_left=${vcs_staged} + local top_right="${vcs}(${seconds})" + + local width_top_prefix=${#${(S%%)top_prefix//$~zero/}} + local width_top_left=${#${(S%%)top_left//$~zero/}} + local width_top_right=${#${(S%%)top_right//$~zero/}} + + # Calculate the maximum width of ${top_left}. -2 are the braces of + # ${top_left}, -1 is one separator from ${top_separator} (we want at least + # one between left and right parts). + local top_left_width_max=$(( + COLUMNS - $width_top_prefix + - $width_top_left - 2 + - 1 + - $width_top_right + )) + # Truncate directory if necessary. + top_left="(${directory/WIDTH/${top_left_width_max}})${top_left}" + width_top_left=${#${(S%%)top_left//$~zero/}} + + # Calculate the width of the top prompt to fill the middle with "-". + local width=$(( + COLUMNS - width_top_prefix - width_top_left - width_top_right + )) + local top_separator="%B${blue}${(l:${width}::-:)}%b${default}" + + PROMPT="${top_prefix}${top_left}${top_separator}${top_right} +${bottom_prefix}${user}@${host} ${background}${symbol} ${exitcode}" +} +precmd_functions+=(zshrc_prompt_precmd) + + +# When GNU screen, tmux, xterm or rxvt is used set the name of the window to +# the currently running program. +# +# When a program is started preexec() sets the window's name to it; when it +# stops precmd() resets the window's name to 'zsh'. 'fg' is supported and sets +# the window's name to the resumed job. +# +# It works with GNU screen, tmux, xterm and rxvt. +# +# If a command is run with sudo or if the shell is running as root then a ! is +# added at the beginning of the command to make this clear. If a command is +# running on a different computer with ssh a @ is added at the beginning. If +# screen/tmux is running on the remote machine instead of @screen @:hostname +# (or @tmux ..; hostname replaced by the machine's hostname) is displayed. +# This only works if the .zshrc on the server also uses this command. +# +# screen* is necessary as `screen` uses screen.linux for example for a linux +# console. +if [[ $TERM == screen* || $TERM == xterm* || $TERM == rxvt* ]]; then + # Is set to a non empty value to reset the window name in the next + # precmd() call. + zshrc_window_reset=yes + + zshrc_window_preexec() { + # Get the program name with its arguments. + local program_name=$1 + + # When sudo is used, use real program name instead, but with an + # exclamation mark at the beginning (handled below). + local program_sudo= + if [[ $program_name == sudo* ]]; then + program_name=${program_name#sudo } + program_sudo=yes + fi + + # Handle fg. + local REPLY + zshrc_resolve_fg_to_resumed_job_name $program_name + program_name=$REPLY + + # Remove all arguments from the program name. + program_name=${program_name%% *} + + # Ignore often used commands which are only running for a very short + # time. This prevents a "blinking" name when it's changed to "cd" for + # example and then some milliseconds later back to "zsh". + [[ $program_name == (cd*|d|ls|l|la|ll|clear|c) ]] && return + + # Change my shortcuts so the real name of the program is displayed. + case $program_name in + e) + program_name=elinks + ;; + g) + program_name=git + ;; + m) + program_name=make + ;; + p) + program_name=less + ;; + v) + program_name=vim + ;; + mu) + program_name=mutt + ;; + esac + + # Add an exclamation mark at the beginning if running with sudo or if + # running zsh as root. + if [[ -n $program_sudo || $UID -eq 0 ]]; then + program_name=!$program_name + fi + + # Add an at mark at the beginning if running through ssh on a + # different computer. + if [[ -n $SSH_CONNECTION ]]; then + program_name="@$program_name" + + # If screen is running in SSH then display "@:hostname" as title + # in the term/outer screen. + if [[ $program_name == @screen || $program_name == @tmux ]]; then + program_name="@:${HOST//.*/}" + # Use "@:!hostname" for root screens. + elif [[ $program_name == @!screen || $program_name == @!tmux ]]; then + program_name="@:!${HOST//.*/}" + fi + fi + + # Set the window name to the currently running program. + zshrc_window_title $program_name + + # Tell precmd() to reset the window name when the program stops. + zshrc_window_reset=yes + } + + zshrc_window_precmd() { + # Abort if no window name reset is necessary. + [[ -z $zshrc_window_reset ]] && return + + # Reset the window name to 'zsh'. + local name=zsh + # If the function was called with an argument then reset the window + # name to '.zsh' (used by clear alias). + if [[ -n $1 ]]; then + name=.zsh + fi + + # Prepend prefixes like in zshrc_window_preexec(). + if [[ $UID -eq 0 ]]; then + name="!$name" + fi + if [[ -n $SSH_CONNECTION ]]; then + name="@$name" + fi + zshrc_window_title $name + + # Just reset the name, so no screen reset necessary for the moment. + zshrc_window_reset= + } + + # Sets the window title. Works with GNU screen, tmux (which uses screen as + # TERM), xterm and rxvt. (V) escapes all non-printable characters, thanks + # to Mikachu in #zsh on Freenode (2010-08-07 17:09 CEST). + if [[ $TERM == screen* ]]; then + zshrc_window_title() { + print -n "\ek${(V)1}\e\\" + } + elif [[ $TERM == xterm* || $TERM == rxvt* ]]; then + zshrc_window_title() { + print -n "\e]2;${(V)1}\e\\" + } + else + # Fallback if another TERM is used. + zshrc_window_title() { } + fi + + # Add the preexec() and precmd() hooks. + preexec_functions+=(zshrc_window_preexec) + precmd_functions+=(zshrc_window_precmd) +else + # Fallback if another TERM is used, necessary to run screen (see below in + # "RUN COMMANDS"). + zshrc_window_preexec() { } +fi + + +# COMPLETION SETTINGS + +# Load the complist module which provides additional features to completion +# lists (coloring, scrolling). +zmodload zsh/complist +# Use new completion system, store dumpfile in ~/.zsh/cache to prevent +# cluttering of ~/. $fpath must be set before calling this. Thanks to Adlai in +# #zsh on Freenode (2009-08-07 21:05 CEST) for reminding me of the $fpath +# problem. +autoload -Uz compinit; compinit -d ~/.zsh/cache/zcompdump + +# Use cache to speed up some slow completions (dpkg, perl modules, etc.). +zstyle ':completion:*' use-cache yes +zstyle ':completion:*' cache-path ~/.zsh/cache + +# List all files in the current directory when pressing tab on an empty input, +# behave like complete-word otherwise. Thanks to John Eikenberry [1] for the +# code, read on 2014-03-15. +# +# [1]: http://unix.stackexchange.com/a/32426 +complete-word-or-complete-list-of-files() { + if [[ $#BUFFER == 0 ]]; then + BUFFER='ls ' + CURSOR=3 + zle list-choices + zle backward-kill-word + else + zle complete-word + fi +} +zle -N complete-word-or-complete-list-of-files +# Let the completion system handle all completions, including expanding of +# shell wildcards (which is handled by other shell mechanisms if the default +# expand-or-complete is used). +bindkey '^I' complete-word-or-complete-list-of-files +# If there are multiple matches after pressing always display them +# immediately without requiring another . a completes to aa and +# lists aaa, aab, aac as possible completions if the directory contains aaa, +# aab, aac, bbb instead of only completing to aa. +setopt nolistambiguous +# Support completions in the middle of a word, without this option zsh jumps +# to the end of the word before the completion process begins. Is required for +# the _prefix completer. +setopt completeinword + +# Force a reload of the completion system if nothing matched; this fixes +# installing a program and then trying to tab-complete its name. Thanks to +# Alex Munroe [1] for the code, read on 2014-03-03. +# +# [1]: https://github.com/eevee/rc/blob/master/.zshrc +_force_rehash() { + if (( CURRENT == 1 )); then + rehash + fi + # We didn't really complete anything. + return 1 +} + +zstyle ':completion:::::' completer \ + _force_rehash _expand _complete _prefix _ignored _approximate + +# Match specification to be tried when completing items. Each group ('...') is +# tried after another if no matches were found, once matches are found no +# other groups are tried. Thanks to Mikachu in #zsh on Freenode (2012-08-28 +# 18:48 CEST) for explanations. +# +# When matching also include the uppercase variant of typed characters +# ('m:{a-z}={A-Z}'); using '' before this group would try the unmodified match +# first, but I prefer to get all matches immediately (e.g. if Makefile and +# makefile exist in the current directory echo m matches both, with '' it +# would only match makefile because it found one match). This allows typing in +# lowercase most of the time and completion fixes the case, which is faster. +# +# Don't perform these fixes in _approximate to prevent it from changing the +# input too much. Thanks to the book "From Bash to Z Shell" page 249. +zstyle ':completion:*:(^approximate):*' matcher-list 'm:{a-z}={A-Z}' + +# Allow one mistake per three characters. Thanks to the book "From Bash to Z +# Shell" page 248. +zstyle -e ':completion:*:approximate:*' max-errors \ + 'reply=( $(( ($#PREFIX + $#SUFFIX) / 3 )) )' + +# Expand shell wildcards to all matching files after . echo * +# results in a b c if the directory contains the files a, b, c. Thanks to the +# book "From Bash to Z Shell" page 246. +zstyle ':completion:*:expand:*' tag-order all-expansions +# Keep prefixes unexpanded if possible: $HOME/ doesn't expand $HOME, +# while $HOME does. +zstyle ':completion:*:expand:*' keep-prefix yes + +# When completing multiple path components display all matching ambiguous +# components. For example /u/s/d/r/README lists all matching READMEs +# instead of just the matching paths up to the r/ component. Can be slow if +# there are many matching files. +zstyle ':completion:*' list-suffixes yes + +# Use ls-like colors for completions. +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} + +# Make completion lists scrollable so "do you wish to see all n possibilities" +# is no longer displayed. Display current position in percent (%p). +zstyle ':completion:*:default' list-prompt '%p' +# Display group name (%d) (like 'external command', 'alias', etc.), in bold. +# Also display a message if _approximate found errors and no matches were +# found. +zstyle ':completion:*' format ' %B%d%b:' +zstyle ':completion:*:corrections' format ' %B%d%b (errors: %e)' +zstyle ':completion:*:warnings' format ' %Bno matches for %d%b' +# Display different types of matches separately. +zstyle ':completion:*' group-name '' + +# Separate man pages by section. +zstyle ':completion:*' separate-sections yes + +# Don't draw trailing / in bold (new in zsh 4.3.11). Thanks to Mikachu in #zsh +# on Freenode for the fix (2010-12-17 13:46 CET). +zle_highlight=(suffix:none) + +# Ignore completion functions. +zstyle ':completion:*:functions' ignored-patterns '_*' + +# When offering typo corrections, do not propose anything which starts with an +# underscore (such as many of Zsh's shell functions). Thanks to paradigm [1] +# for the idea (read on 2013-04-07). +# +# [1]: https://github.com/paradigm/dotfiles/blob/master/.zshrc +CORRECT_IGNORE='_*' + +# Ignore parent directory. +zstyle ':completion:*:(cd|mv|cp):*' ignore-parents parent pwd +# Always complete file names only once in the current line. This makes it easy +# to complete multiple file names because I can just press tab to get all +# possible values. Otherwise I would have to skip the first value again and +# again. Thanks to Mikachu in #zsh on Freenode (2011-08-11 14:42 CEST) for the +# hint to use other. other is necessary so prefix lists both prefix and +# prefixrest if the directory contains prefix and prefixrest. +zstyle ':completion:*:all-files' ignore-line other +# Except for mv and cp, because I often want to use to similar names, so I +# complete to the same and change it. +zstyle ':completion:*:(mv|cp):all-files' ignore-line no + +# Don't complete ./config.* files, this makes running ./configure much +# simpler. Thanks to Nomexous in #zsh on Freenode (2010-03-16 01:54 CET) +zstyle ':completion:*:*:-command-:*' ignored-patterns './config.*' +# Don't complete unwanted files with Vim. Thanks to Nomexous in #zsh on +# Freenode (2010-06-06 04:54 CEST). See below for a way to complete them. +zstyle ':completion:*:*:vim:*:all-files' ignored-patterns \ + '*.aux' '*.log' '*.pdf' '*.bbl' '*.blg' '*.out' '*-blx.bib' '*.run.xml' \ + '*.o' \ + '*.pyc' \ + '*.class' + +# Provide a fallback completer which always completes files. Useful when Zsh's +# completion is too "smart". Thanks to Frank Terbeck +# (http://www.zsh.org/mla/users/2009/msg01038.html). +zle -C complete-files complete-word _generic +zstyle ':completion:complete-files:*' completer _files +bindkey '^F' complete-files + +# Completion for my wrapper scripts. +compdef slocate=locate +compdef srsync=rsync +compdef srsync-incremental=rsync +compdef svalgrind=valgrind +compdef sc=systemctl + + +# CUSTOM ALIASES AND FUNCTIONS + +# If ^C is pressed while typing a command, add it to the history so it can be +# easily retrieved later and then abort like ^C normally does. This is useful +# when I want to abort an command to do something in between and then finish +# typing the command. +# +# Thanks to Vadim Zeitlin for a fix (--) so lines +# starting with - don't cause errors; and to Nadav Har'El +# for a fix (-r) to handle whitespace/quotes +# correctly, both on the Zsh mailing list. +TRAPINT() { + # Don't store this line in history if histignorespace is enabled and the + # line starts with a space. + if [[ -o histignorespace && ${BUFFER[1]} = ' ' ]]; then + return $1 + fi + + # Store the current buffer in the history. + zle && print -s -r -- $BUFFER + + # Return the default exit code so Zsh aborts the current command. + return $1 +} + +# Load aliases and similar functions also used by other shells. +if [[ -f ~/.shell/aliases ]]; then + . ~/.shell/aliases +fi + +# Make sure aliases are expanded when using sudo. +alias sudo='sudo ' + +# Global aliases for often used redirections. +alias -g E='2>&1' +alias -g N='>/dev/null' +alias -g EN='2>/dev/null' +alias -g L='2>&1 | less' +alias -g LS='2>&1 | less -S' # -S prevents wrapping of long lines +alias -g D='2>&1 | colordiff | less' +# Global aliases for often used commands. +alias -g A='| awk' +alias -g A1="| awk '{ print \$1 }'" +alias -g A2="| awk '{ print \$2 }'" +alias -g A3="| awk '{ print \$3 }'" +alias -g G='| grep' +alias -g GB='| grep -vE "^Binary file .+ matches\$"' +alias -g H='| head' +alias -g P='| perl' +alias -g S='| sort' +alias -g SL='| sort | less' +alias -g T='| tail' +alias -g U='| uniq' +alias -g X='`xsel -p || xclip -o`' # X selection + +# Make going up directories simple. +alias -g ...='../..' +alias -g ....='../../..' +alias -g .....='../../../..' + +# If the window naming feature is used (see above) then use ".zsh" (leading +# dot) as title name after running clear so it's clear to me that the window +# is empty. I open so much windows that I don't know in which I have something +# important. This helps me to remember which windows are empty (I run clear +# after I finished my work in a window). +if [[ -n $zshrc_window_reset ]]; then + alias clear='clear; zshrc_window_reset=yes; zshrc_window_precmd reset' +fi + + +# CUSTOM COMMANDS + +# Display all branches (except stash) in gitk but only 200 commits as this is +# much faster. Also put in the background and disown. Thanks to drizzd in #git +# on Freenode (2010-04-03 17:55 CEST). +(( $+commands[gitk] )) && gitk() { + command gitk --max-count=200 --branches --remotes --tags "$@" & + disown %command +} +# Same for tig (except the disown part as it's no GUI program). +(( $+commands[tig] )) && tig() { + command tig --max-count=200 --branches --remotes --tags "$@" +} + +# Choose the "best" PDF viewer available. Also setup completion for `pdf`. +if (( $+commands[katarakt] )); then + pdf() { + command katarakt "$@" 2>/dev/null & + disown %command + } + # No completion for katarakt yet. + compdef pdf=xpdf +elif (( $+commands[xpdf] )); then + pdf() { + command xpdf "$@" 2>/dev/null & + disown %command + } + compdef pdf=xpdf +elif (( $+commands[zathura] )); then + pdf() { + command zathura "$@" 2>/dev/null & + disown %command + } + # No completion for zathura yet. + compdef pdf=xpdf +fi + + +# OS SPECIFIC SETTINGS + +if [[ $OSTYPE == linux* ]]; then + # Settings when creating Debian packages. + export DEBEMAIL=simon@ruderich.org + export DEBFULLNAME='Simon Ruderich' +fi + + +# LOAD ADDITIONAL CONFIGURATION FILES + +# Configuration options for rc.local. + +# Multiplexer to use. By default GNU screen is used. Possible values: screen, +# tmux and empty (no multiplexer). +zshrc_use_multiplexer=screen +# Additional arguments for fortune. +zshrc_fortune_arguments=() + +source_config ~/.zsh/rc.local + + +# RUN COMMANDS + +# Make sure the multiplexer is available. Otherwise the exec terminates our +# session. +if [[ -n $zshrc_use_multiplexer ]]; then + if ! (( $+commands[$zshrc_use_multiplexer] )); then + echo "Multiplexer '$zshrc_use_multiplexer' not found." >&2 + zshrc_use_multiplexer= + fi +fi + +# If not already in screen or tmux, reattach to a running session or create a +# new one. This also starts screen/tmux on a remote server when connecting +# through ssh. +if [[ $TERM != dumb && $TERM != dialup && $TERM != linux + && -z $STY && -z $TMUX ]]; then + # Get running detached sessions. + if [[ $zshrc_use_multiplexer = screen ]]; then + session=$(screen -list | grep 'Detached' | awk '{ print $1; exit }') + elif [[ $zshrc_use_multiplexer = tmux ]]; then + session=$(tmux list-sessions 2>/dev/null \ + | sed '/(attached)$/ d; s/^\([0-9]\{1,\}\).*$/\1/; q') + fi + + # As we exec later we have to set the title here. + if [[ $zshrc_use_multiplexer = screen ]]; then + zshrc_window_preexec screen + elif [[ $zshrc_use_multiplexer = tmux ]]; then + zshrc_window_preexec tmux + fi + + # Create a new session if none is running. + if [[ -z $session ]]; then + if [[ $zshrc_use_multiplexer = screen ]]; then + exec screen + elif [[ $zshrc_use_multiplexer = tmux ]]; then + exec tmux + fi + # Reattach to a running session. + else + if [[ $zshrc_use_multiplexer = screen ]]; then + exec screen -r $session + elif [[ $zshrc_use_multiplexer = tmux ]]; then + exec tmux attach-session -t $session + fi + fi +fi + +# Colorize stderr in bold red. Very useful when looking for errors. +if [[ $LD_PRELOAD != *libcoloredstderr.so* ]]; then + # coloredstderr found, use it. + if [[ -f ~/.zsh/libcoloredstderr.so ]]; then + export LD_PRELOAD="$HOME/.zsh/libcoloredstderr.so:$LD_PRELOAD" + export COLORED_STDERR_FDS=2, + export COLORED_STDERR_PRE=$'\033[91m' # bright red + export COLORED_STDERR_IGNORED_BINARIES=/usr/bin/tset + # Use the fallback solution. + # + # Thanks to http://gentoo-wiki.com/wiki/Zsh for the basic script and + # Mikachu in #zsh on Freenode (2010-03-07 04:03 CET) for some improvements + # (-r, printf). It's not yet perfect and doesn't work with su and git for + # example, but it can handle most interactive output quite well (even with + # no trailing new line) and in cases it doesn't work, the E alias can be + # used as workaround. + # + # Moved in the "run commands" section to prevent one unnecessary zsh + # process when starting GNU screen/tmux (see above). + else + exec 2>>(while read -r -k -u 0 line; do + printf '\e[91m%s\e[0m' $line + print -n $'\0' + done &) + + # Reset doesn't work with this hack. + reset() { + command reset "$@" 2>&1 + } + fi +fi + +# Display possible log messages from ~/.xinitrc (if `xmessage` wasn't +# installed). No race condition as xinitrc has finished before a shell is +# executed and only one shell is started on login. +if [[ -f ~/.xinitrc.errors ]]; then + echo "${fg_bold[red]}xinitrc failed!${fg_bold[default]}" + echo + cat ~/.xinitrc.errors + rm ~/.xinitrc.errors + echo +fi + +# Run the following programs every 4 hours (and when zsh starts). +PERIOD=14400 +periodic() { + # Display fortunes. + (( $+commands[fortune] )) && fortune -ac "${zshrc_fortune_arguments[@]}" + # Display reminders. + (( $+commands[rem] )) && [[ -f ~/.reminders ]] && rem -h +} + + +# RESTART SETTINGS + +zmodload -F zsh/stat b:zstat + +# Remember startup time. Used to perform automatic restarts when ~/.zshrc is +# modified. +zshrc_startup_time=$EPOCHSECONDS + +# Automatically restart Zsh if ~/.zshrc was modified. +zshrc_restart_precmd() { + local stat + if ! zstat -A stat +mtime ~/.zshrc; then + return + fi + + # ~/.zshrc wasn't modified, nothing to do. + if [[ $stat -le $zshrc_startup_time ]]; then + return + fi + + local startup + strftime -s startup '%Y-%m-%d %H:%M:%S' $zshrc_startup_time + + echo -n "${fg[magenta]}" + echo -n "~/.zshrc modified since startup ($startup) ... " + echo -n "${fg[default]}" + + if [[ -n $zshrc_disable_restart ]]; then + echo 'automatic restart disabled.' + return + fi + + # Don't exec if we have background processes because execing will let us + # lose control over them. + if [[ ${#${(k)jobstates}} -ne 0 ]]; then + echo 'active background jobs!' + return + fi + + # Try to start a new interactive shell. If it fails, something is wrong. + # Don't kill our current session by execing it, abort instead. + zsh -i -c 'exit 42' + if [[ $? -ne 42 ]]; then + echo -n ${fg_bold[red]} + echo 'failed to start new zsh!' + echo -n ${fg_bold[default]} + return + fi + + echo 'restarting zsh.' + echo + + exec zsh +} +precmd_functions+=(zshrc_restart_precmd) + + +# RELOAD SETTINGS + +zshenv_reload_time=0 # load before first command +zshenv_boot_time=$(date -d "$(uptime -s)" '+%s') # uptime in epoch seconds + +# Automatically source ~/.zsh/env.update when the file changes (and exists). +# Can be used e.g. to update SSH_AGENT_PID and GPG_AGENT_INFO variables in +# running zsh processes. Sourced immediately before executing shell commands +# (preexec) to ensure the environment is always up to date. +zshenv_reload_preexec() { + local file + file=~/.zsh/env.update + + local stat + if ! zstat -A stat +mtime $file 2>/dev/null; then + return + fi + # File was modified before reboot. Skip it to prevent loading of old + # values. + if [[ $stat -lt $zshenv_boot_time ]]; then + return + fi + # File wasn't modified, nothing to do. + if [[ $stat -le $zshenv_reload_time ]]; then + return + fi + zshenv_reload_time=$EPOCHSECONDS + + unsetopt warn_create_global + . $file + setopt warn_create_global +} +preexec_functions+=(zshenv_reload_preexec) + +# vim: ft=zsh diff --git a/vcs/.gitignore b/vcs/.gitignore new file mode 100644 index 0000000..a296e88 --- /dev/null +++ b/vcs/.gitignore @@ -0,0 +1,2 @@ +cvsrc +gitconfig diff --git a/vcs/Makefile b/vcs/Makefile new file mode 100644 index 0000000..23d5991 --- /dev/null +++ b/vcs/Makefile @@ -0,0 +1,4 @@ +all: + @./setup.sh + +.PHONY: all diff --git a/vcs/bin/tig.pl b/vcs/bin/tig.pl new file mode 100755 index 0000000..881583d --- /dev/null +++ b/vcs/bin/tig.pl @@ -0,0 +1,126 @@ +#!/usr/bin/perl + +# tig-like git log output. Used when tig is not available or broken. + +# Copyright (C) 2013 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +use strict; +use warnings; + +use POSIX (); +use Term::ANSIColor qw(colored); + + +my $color_graph = 'yellow'; +my $color_hash = 'cyan'; +my $color_ref_sep = 'cyan'; +my $color_ref_head = 'cyan bold'; +my $color_ref_branch = 'green bold'; +my $color_ref_reference = 'red bold'; +my $color_author = 'magenta'; + + +# Aliases in Git with "! ..." are always run in the top-level-directory. +# GIT_PREFIX contains the relative path to the current subdirectory. Thanks to +# dr_lepper in #git on Freenode (2013-04-03 23:17 CEST) for telling me about +# GIT_PREFIX. +if (defined $ENV{GIT_PREFIX} and $ENV{GIT_PREFIX} ne '') { + chdir $ENV{GIT_PREFIX} or die $!; +} + +my $format = '%x00' # separator from --graph + . '%h' . '%x00' # abbreviated commit hash + . '%at' . '%x00' # author date + . '%an' . '%x00' # author name + . '%s' . '%x00' # subject + . '%d'; # ref names +my @cmd = ('git', 'log', '--graph', "--format=$format", + # use either given arguments or --all to list all commits + (scalar @ARGV) ? @ARGV : '--all'); +open my $fh, '-|', @cmd or die $!; + +my $pager = $ENV{PAGER}; +# Try to find an usable pager without searching $PATH. +if (not defined $pager) { + foreach my $path (qw(/usr/bin/less /bin/less /usr/bin/more /bin/more)) { + next if not -x $path; + + $pager = $path; + last; + } +} +# Use a pager if STDOUT is a terminal. +if (-t STDOUT and defined $pager) { + open STDOUT, '|-', $pager or die $!; +} + +while (<$fh>) { + # History graph line. + if (m{^([|/\\_ ]+)$}) { + print colored($_, $color_graph); + next; + } + + # Commit line. + /^([ *|.\\-]+)\x00(.+)\x00(.+)\x00(.+)\x00(.*)\x00(.*)$/ or die $_; + my $prefix = $1; + my $hash = colored($2, $color_hash); + my $date = POSIX::strftime('%Y-%m-%d', localtime($3)); + my $author = colored($4, $color_author); + my $message = $5; + my $refs = $6; + + # Strip trailing whitespace. + $prefix =~ s/\s+$//; + # Color "graph". + $prefix =~ s/\|/colored($&, $color_graph)/ge; + + # Strip leading whitespace and braces. + $refs =~ s/^\s+//; + $refs =~ tr/()//d; + + # Color refs. + $refs = join colored(', ', $color_ref_sep), map { + my $color; + if ($_ eq 'HEAD') { + $color = $color_ref_head; + } elsif (m{/}) { + $color = $color_ref_reference; + } else { + $color = $color_ref_branch; + } + colored($_, $color); + } split /, /, $refs; + + if ($refs ne '') { + $refs = ' ' + . colored('(', $color_ref_sep) + . $refs + . colored(')', $color_ref_sep); + } + + printf "%s %s %s %s%s %s\n", + $prefix, $hash, $date, $author, $refs, $message; +} + +close $fh or die $!; + +# Necessary for the redirection to a pager or the pager terminates after our +# script finishes without displaying all data. +if (defined $pager) { + close STDOUT or die $!; +} diff --git a/vcs/cvsrc.in b/vcs/cvsrc.in new file mode 100644 index 0000000..90b11b4 --- /dev/null +++ b/vcs/cvsrc.in @@ -0,0 +1,30 @@ +# CVS configuration file. + +# CVS doesn't support comments and newlines in ~/.cvsrc. They must be stripped +# before using this file. + +# Copyright (C) 2011-2014 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Don't display all checked directories. +cvs -q + +# Use unified diffs. +diff -u +# Create any directories which were removed locally. +update -d + +# vim: ft=cvsrc diff --git a/vcs/gitattributes b/vcs/gitattributes new file mode 100644 index 0000000..8258ef8 --- /dev/null +++ b/vcs/gitattributes @@ -0,0 +1,20 @@ +# Global Git configuration file for attributes. + +# Copyright (C) 2013 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +*.pdf diff=pdf +*.gz diff=gzip diff --git a/vcs/gitconfig.in b/vcs/gitconfig.in new file mode 100644 index 0000000..50d88a9 --- /dev/null +++ b/vcs/gitconfig.in @@ -0,0 +1,249 @@ +# Global Git configuration file. + +# Copyright (C) 2011-2017 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +[user] + name = Simon Ruderich + email = simon@ruderich.org + +[color] + ui = auto + +[color "diff"] + # Meta information. + meta = yellow bold + # Hunk header. + frag = magenta bold + # Function in hunk header. + func = blue bold + # Removed lines. + old = red bold + # Added lines. + new = green bold + # Commit headers. + commit = cyan + +[color "grep"] + # GNU grep-like colors. + filename = magenta + linenumber = green + +[core] + editor = vim + # Global gitattributes file. Thanks to canton7 in #git on Freenode + # (2011-11-09 13:23 CET). + attributesfile = PWD/gitattributes + +[pager] + # Use pager for the following commands. + status = true + tag = true + +[interactive] + # Don't require in interactive commands which require only a + # single key, for example `git add --patch`. Requires Perl module + # Term::Readkey. + singlekey = true + +[alias] + ## Shortcuts for often used commands. + # + ## Local. + c = commit --verbose + ca = commit --verbose --amend + cad = commit --verbose --amend --date= + d = diff + dw = diff --color-words + ds = diff --stat + dc = diff --cached + dcw = diff --cached --color-words + dcs = diff --cached --stat + g = grep + gi = grep --ignore-case + s = status + l = log + ls = log --stat + lp = log --patch + lpw = log --patch --color-words + ld = show --date=short -s --pretty='format:%h (\"%s\", %ad)' # describe + a = add + ap = add --patch + au = add --update + rs = reset + rsh = reset --hard + rsp = reset --patch + rv = revert + cl = clean -ndx + clf = clean -fdx + ## Branches. + co = checkout + b = branch -a -v + br = branch + m = merge + mo = merge origin/master + re = rebase + rei = rebase --interactive + rec = rebase --continue + cp = cherry-pick + ## Submodules. + sm = submodule + ## Remote. + f = fetch + t = tag + p = push + # Parallel git remote update. Also strips unnecessary output. + ru = "! git remote \ + | xargs -d '\\n' -n1 -P0 git remote update 2>&1 \ + | sed '/^$/d; \ + /^Please make sure you have the correct access rights$/d; \ + /^and the repository exists\\.$/d;'" + # Push to all remotes. Thanks to albel727 in #git on Freenode + # (2011-06-04 16:06 CEST) for the idea. Modified to push in parallel + # and to strip unnecessary output. + rp = "! git remote \ + | xargs -d '\\n' -n1 -P0 git push 2>&1 \ + | sed '/^$/d; \ + /^Please make sure you have the correct access rights$/d; \ + /^and the repository exists\\.$/d;'" + ## Patches. + fp = format-patch + ## Maintenance. + # (Redirection of stderr is necessary to prevent missing output with + # my "color stderr" solution in Zsh.) + fs = ! git fsck --strict --full 2>&1 + fg = ! git fs && git gc --aggressive 2>&1 # fsck and compress repo + ## Misc. + sl = stash list + ss = stash save + ssk = stash save --keep-index + ssu = stash save --include-untracked + sa = stash apply --index + sp = stash pop --index + + ## Custom commands. + # + # tig-like log view. Similar to the following but with author/date + # information. --pretty=format is not used because it doesn't allow + # precise enough control over formats and colors. + # + # tig = log --pretty=oneline --graph --all --decorate --abbrev-commit + tig = ! PWD/bin/tig.pl + + # Create backup of uncommitted and untracked changes. + ssb = "! git stash save --include-untracked \ + \"Backup on $(LANG=C date '+%a, %d %b %Y %H:%M:%S %z')\" \ + >/dev/null \ + && git stash apply >/dev/null" + + # Display list and content of untracked files. Untracked directories + # and symbolic links are only listed. + u = "! git ls-files --other --exclude-standard --directory -z \ + | xargs -0 sh -c '\ + for x; do \ + printf \"\\033[1;33m-> %s\\033[0m:\" \"$x\"; \ + if test -d \"$x\"; then \ + echo \" directory\"; \ + elif test -h \"$x\"; then \ + echo \" symbolic link\"; \ + else \ + echo; \ + cat \"$x\"; \ + fi; \ + echo; \ + done' argv0 \ + | less" + +[diff] + # Detect copies and renames. + renames = copy + + # Diff algorithm to use. + algorithm = histogram + + # Highlight moved code in a different color. + colorMoved = zebra + + # Replace "a/" and "b/" prefix in diffs with characters describing the + # context (e.g. "i/"ndex and "w/"ork tree). + mnemonicprefix = true + + # Change the definition of a word as used by diff --color-words to be + # shorter (not only spaces) and thus simplify the generated diffs. + # Words ([a-zA-Z0-9_]+) are matched, or a single non-word character + # ([^a-zA-Z0-9_]), therefore changes to words are shown in complete + # (e.g. from "word" to "newword" as "[-word-]{+newword+}"), but + # changes to non-word characters are shown character wise (e.g. from + # "==" to "!=" as "[-=-]{+!+}="); [-..-] is removal, {+..+} is + # addition. See t/ for some tests and examples. + wordRegex = [a-zA-Z0-9_]+|[^a-zA-Z0-9_] + +# Allow diffing of some binary files. +# +# "sh -c '..' ARGV0" is used when the programs require additional arguments +# which are passed after ARGV0 by git. +[diff "gzip"] + textconv = gzip -d -c +[diff "pdf"] + textconv = sh -c 'exec pdftotext "$@" -' ARGV0 +[diff "sqlite"] + textconv = sh -c 'exec sqlite3 "$@" .dump' ARGV0 + +[log] + # Display branches/tag names in log (same as log's --decorate option). + decorate = short + # If a single file is given to `git log`, automatically use --follow. + follow = true + +[merge] + tool = vimdiff + + # Merge upstream branch if `git merge` is called without arguments. + defaultToUpstream = true + +[rebase] + # Use single-letter command names in git rebase -i which are faster to + # change. + abbreviateCommands = true + +[push] + # When running git push without a refspec push only the current + # branch, see man page git-config(1) for details. Default since Git + # 2.0. + default = simple + +[format] + # When using git format-patch use threads and add all patches as + # replies to the first one. + thread = shallow + +[transfer] + # Automatically fsck objects when receiving them (respected by git + # receive-pack and git fetch (>= 1.7.8, for fetch)). + fsckObjects = true + +[advice] + # Disable annoying advice messages. + waitingForEditor = false + + +# NON-GIT SETTINGS + +[annex] + # My SSH config already uses ControlMaster where appropriate. + sshcaching = false + +# vim: ft=gitconfig diff --git a/vcs/hgrc b/vcs/hgrc new file mode 100644 index 0000000..ee4de57 --- /dev/null +++ b/vcs/hgrc @@ -0,0 +1,62 @@ +# This is the Mercurial configuration file. + +# Copyright (C) 2011-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +[ui] +username = Simon Ruderich + +# Use git diffs with support for renames, binaries, access rights, etc. +[diff] +git = True + +[extensions] +# Convert other vcs to mercurial. +hgext.convert = +# Simplify pull and merge processes. +hgext.fetch = +# Log output similar to hg view but as ASCII. +hgext.graphlog = +# Enable hg view. +hgext.hgk = +# Patch stack support. +hgext.mq = +# Use a pager for all output. +hgext.pager = +# Partial commit utility. +hgext.record = +# Allows cherry-picking and rebasing. +hgext.transplant = + +# Necessary for hg view. +[hgk] +path = /usr/share/mercurial/hgk + +[hooks] +# Precommit hook which runs tests if they exist. +precommit = precommit-runtests +# Prevent "hg pull" if MQ patches are applied. +prechangegroup.mq-no-pull = ! hg qtop > /dev/null 2>&1 +# Prevent "hg push" if MQ patches are applied. +preoutgoing.mq-no-push = ! hg qtop > /dev/null 2>&1 + +# Use colordiff and less as pager so that output from diff is colored and +# everything is easily readable in a terminal. +[pager] +pager = colordiff | less +ignore = record, qrecord, view, clone + +# vim: ft=cfg diff --git a/vcs/setup.sh b/vcs/setup.sh new file mode 100755 index 0000000..bf22f99 --- /dev/null +++ b/vcs/setup.sh @@ -0,0 +1,73 @@ +#!/bin/sh + +# Setup script for VCS configuration files. + +# Copyright (C) 2011-2013 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +. ../lib.sh + + +if installed git; then + generate gitconfig .in simple_cpp PWD -- "`pwd`" + + # Older Git versions don't support push.default = simple. + if ! git status >/dev/null 2>&1; then + echo 'gitconfig: removing push.default = simple' + grep_i -v '^[[:space:]]default = simple$' gitconfig + fi + # Even older Git versions don't support color.function. + if ! git status >/dev/null 2>&1; then + echo 'gitconfig: removing color.function' + sed_i 's/^[[:space:]]*function = .*//' gitconfig + fi + # Even older Git versions don't support git log --patch but only -p. + if ! git log --patch >/dev/null 2>&1; then + echo 'gitconfig: replacing git log --patch with -p' + sed_i 's/log --patch/log -p/' gitconfig + fi + + # If coloredstderr is used to color stderr then remove the workaround for + # missing output to stderr. + if test -n "${LD_PRELOAD:+set}" \ + && printf '%s' "$LD_PRELOAD" | grep libcoloredstderr.so >/dev/null; then + echo 'gitconfig: removing stderr fix' + sed_i '/^\t\(fs\|fg\) =/ s/2>&1//' gitconfig + fi + + link gitconfig ~/.gitconfig +fi + +if installed tig; then + if tig --version | grep -F 'tig version 1.' >/dev/null; then + link tigrc.old ~/.tigrc + else + link tigrc ~/.tigrc + fi +fi + +if installed hg; then + link hgrc ~/.hgrc +fi + +if installed cvs; then + # CVS doesn't support any comments nor empty lines in cvsrc. + grep -E -v '^#' cvsrc.in | grep -E -v '^$' >cvsrc + + link cvsrc ~/.cvsrc +fi diff --git a/vcs/t/expected-empty.txt b/vcs/t/expected-empty.txt new file mode 100644 index 0000000..19c91bf --- /dev/null +++ b/vcs/t/expected-empty.txt @@ -0,0 +1,31 @@ +diff --git a/test.txt b/test.txt +--- a/test.txt ++++ b/test.txt +@@ -1,26 +1,27 @@ +Tests +==== + +Short sentence with words! + +Longer sentence even more words, ain't that nice! + +And other one, just testing. + +option: new value +option-two: new-value-two +option-three: "value-three" + +function testme() { + firstCall(); + while (a != b) { + if (!second_var) { + third_call() && fourth_call() \ + || fifth_call(); + } + } + return 42; +} + +allow = $0 $! $? $. +allow = $! $? +allow = $0 $! $? diff --git a/vcs/t/expected-nonspaces.txt b/vcs/t/expected-nonspaces.txt new file mode 100644 index 0000000..d6b3558 --- /dev/null +++ b/vcs/t/expected-nonspaces.txt @@ -0,0 +1,32 @@ +diff --git a/test.txt b/test.txt +--- a/test.txt ++++ b/test.txt +@@ -1,26 +1,27 @@ +Tests +[-=====-]{+====+} + +[-Simple-]{+Short+} sentence with [-a few words.-]{+words!+} + +Longer sentence[-with-] even more [-words ..-]{+words,+} ain't that [-nice?-]{+nice!+} + +And [-another-]{+other+} one, just testing. + +option: {+new+} value +option-two: [-value-two-]{+new-value-two+} +option-three: [-value-three-]{+"value-three"+} + +function testme() { + [-first_call();-] +[- if-]{+firstCall();+} +{+ while+} (a [-==-]{+!=+} b) { + if [-(!second_call())-]{+(!second_var)+} { + [-third_call();-]{+third_call() && fourth_call() \+} +{+ || fifth_call();+} + } + } + return 42; +} + +allow = {+$0+} $! $? $. +allow = $! $?[-$.-] +allow = {+$0+} $! $?[-$.-] diff --git a/vcs/t/expected-word-nonword.txt b/vcs/t/expected-word-nonword.txt new file mode 100644 index 0000000..76b34ac --- /dev/null +++ b/vcs/t/expected-word-nonword.txt @@ -0,0 +1,31 @@ +diff --git a/test.txt b/test.txt +--- a/test.txt ++++ b/test.txt +@@ -1,26 +1,27 @@ +Tests +====[-=-] + +S[-imple-]{+hort+} sentence with [-a few -]words[-.-]{+!+} + +Longer sentence [-with -]even more words[- ..-]{+,+} ain't that nice[-?-]{+!+} + +And [-an-]other one, just testing. + +option: {+new +}value +option-two: {+new-+}value-two +option-three: {+"+}value-three{+"+} + +function testme() { + first[-_c-]{+C+}all(); + {+wh+}i[-f-]{+le+} (a [-=-]{+!+}= b) { + if (!second_{+var) {+} +{+ third_+}call(){+ && fourth_call(+}) [-{-]{+\+} +{+ +} {+|| fif+}th[-ird-]_call(); + } + } + return 42; +} + +allow = ${+0 $+}! $? $. +allow = $! $?[- $.-] +allow = $[-!-]{+0+} $[-?-]{+!+} $[-.-]{+?+} diff --git a/vcs/t/expected-words-nonword.txt b/vcs/t/expected-words-nonword.txt new file mode 100644 index 0000000..5e0f6b1 --- /dev/null +++ b/vcs/t/expected-words-nonword.txt @@ -0,0 +1,31 @@ +diff --git a/test.txt b/test.txt +--- a/test.txt ++++ b/test.txt +@@ -1,26 +1,27 @@ +Tests +====[-=-] + +[-Simple-]{+Short+} sentence with [-a few -]words[-.-]{+!+} + +Longer sentence [-with -]even more words[- ..-]{+,+} ain't that nice[-?-]{+!+} + +And [-another-]{+other+} one, just testing. + +option: {+new +}value +option-two: {+new-+}value-two +option-three: {+"+}value-three{+"+} + +function testme() { + [-first_call-]{+firstCall+}(); + [-if-]{+while+} (a [-=-]{+!+}= b) { + if (![-second_call()-]{+second_var+}) { + third_call(){+ && fourth_call() \+} +{+ || fifth_call()+}; + } + } + return 42; +} + +allow = ${+0 $+}! $? $. +allow = $! $?[- $.-] +allow = $[-!-]{+0+} $[-?-]{+!+} $[-.-]{+?+} diff --git a/vcs/t/expected-words-nonwords-spaces.txt b/vcs/t/expected-words-nonwords-spaces.txt new file mode 100644 index 0000000..cbc70dc --- /dev/null +++ b/vcs/t/expected-words-nonwords-spaces.txt @@ -0,0 +1,31 @@ +diff --git a/test.txt b/test.txt +--- a/test.txt ++++ b/test.txt +@@ -1,26 +1,27 @@ +Tests +[-=====-]{+====+} + +[-Simple-]{+Short+} sentence with [-a few -]words[-.-]{+!+} + +Longer sentence [-with -]even more words[- .. -]{+, +}ain't that nice[-?-]{+!+} + +And [-another-]{+other+} one, just testing. + +option: {+new +}value +option-two: {+new-+}value-two +option-three[-: -]{+: "+}value-three{+"+} + +function testme() { + [-first_call-]{+firstCall+}(); + [-if-]{+while+} (a[- == -]{+ != +}b) { + if (![-second_call()) {-]{+second_var) {+} + third_call{+() && fourth_call() \+} +{+ || fifth_call+}(); + } + } + return 42; +} + +allow[- = $! $? $.-]{+ = $0 $! $? $.+} +allow[- = $! $? $.-]{+ = $! $?+} +allow[- = $! $? $.-]{+ = $0 $! $?+} diff --git a/vcs/t/expected-words-nonwords.txt b/vcs/t/expected-words-nonwords.txt new file mode 100644 index 0000000..cbc70dc --- /dev/null +++ b/vcs/t/expected-words-nonwords.txt @@ -0,0 +1,31 @@ +diff --git a/test.txt b/test.txt +--- a/test.txt ++++ b/test.txt +@@ -1,26 +1,27 @@ +Tests +[-=====-]{+====+} + +[-Simple-]{+Short+} sentence with [-a few -]words[-.-]{+!+} + +Longer sentence [-with -]even more words[- .. -]{+, +}ain't that nice[-?-]{+!+} + +And [-another-]{+other+} one, just testing. + +option: {+new +}value +option-two: {+new-+}value-two +option-three[-: -]{+: "+}value-three{+"+} + +function testme() { + [-first_call-]{+firstCall+}(); + [-if-]{+while+} (a[- == -]{+ != +}b) { + if (![-second_call()) {-]{+second_var) {+} + third_call{+() && fourth_call() \+} +{+ || fifth_call+}(); + } + } + return 42; +} + +allow[- = $! $? $.-]{+ = $0 $! $? $.+} +allow[- = $! $? $.-]{+ = $! $?+} +allow[- = $! $? $.-]{+ = $0 $! $?+} diff --git a/vcs/t/expected-words-nonwordspaces-spaces.txt b/vcs/t/expected-words-nonwordspaces-spaces.txt new file mode 100644 index 0000000..11769da --- /dev/null +++ b/vcs/t/expected-words-nonwordspaces-spaces.txt @@ -0,0 +1,31 @@ +diff --git a/test.txt b/test.txt +--- a/test.txt ++++ b/test.txt +@@ -1,26 +1,27 @@ +Tests +[-=====-]{+====+} + +[-Simple-]{+Short+} sentence with [-a few -]words[-.-]{+!+} + +Longer sentence [-with -]even more words[- ..-]{+,+} ain't that nice[-?-]{+!+} + +And [-another-]{+other+} one, just testing. + +option: {+new +}value +option-two: {+new-+}value-two +option-three: {+"+}value-three{+"+} + +function testme() { + [-first_call-]{+firstCall+}(); + [-if-]{+while+} (a [-==-]{+!=+} b) { + if (![-second_call())-]{+second_var)+} { + third_call{+() && fourth_call() \+} +{+ || fifth_call+}(); + } + } + return 42; +} + +allow = {+$0 +}$! $? $. +allow = $! $?[- $.-] +allow = {+$0 +}$! $?[- $.-] diff --git a/vcs/t/expected-words-nonwordspaces.txt b/vcs/t/expected-words-nonwordspaces.txt new file mode 100644 index 0000000..ce5d927 --- /dev/null +++ b/vcs/t/expected-words-nonwordspaces.txt @@ -0,0 +1,31 @@ +diff --git a/test.txt b/test.txt +--- a/test.txt ++++ b/test.txt +@@ -1,26 +1,27 @@ +Tests +[-=====-]{+====+} + +[-Simple-]{+Short+} sentence with[-a few-] words[-.-]{+!+} + +Longer sentence[-with-] even more words[-..-]{+,+} ain't that nice[-?-]{+!+} + +And [-another-]{+other+} one, just testing. + +option: {+new+} value +option-two: {+new-+}value-two +option-three: {+"+}value-three{+"+} + +function testme() { + [-first_call-]{+firstCall+}(); + [-if-]{+while+} (a [-==-]{+!=+} b) { + if (![-second_call())-]{+second_var)+} { + third_call{+() && fourth_call() \+} +{+ || fifth_call+}(); + } + } + return 42; +} + +allow = {+$0+} $! $? $. +allow = $! $?[-$.-] +allow = {+$0+} $! $?[-$.-] diff --git a/vcs/t/test.sh b/vcs/t/test.sh new file mode 100755 index 0000000..6f1084b --- /dev/null +++ b/vcs/t/test.sh @@ -0,0 +1,111 @@ +#!/bin/sh + +# Small test file to check different --word-diff-regex settings in Git. + +# Copyright (C) 2012-2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +git_diff() { + git diff --color=never --word-diff=plain --word-diff-regex="$1" \ + | grep -v '^index ' >"result-$2.txt" + diff -u "../expected-$2.txt" "result-$2.txt" +} + + +# Setup test directory/files. +mkdir test +cd test + +git init >/dev/null +cat >test.txt </dev/null + +cat >test.txt <. + + +# Don't display uncommitted changes. +set show-changes = no + +# Ignore case when searching. +set ignore-case = yes + +# Don't write ~/.tig_history. +set history-size = 0 + + +# DISPLAY + +# Same as the default, but use relative dates. +set main-view = date:relative author:full commit-title:yes,graph,refs + + +# BINDINGS + +# Allow moving in the main menu while displaying a diff in the bottom of the +# screen. +bind generic J next +bind generic K previous + +# Mutt like bindings to move to first and last line. +bind generic = move-first-line +bind generic * move-last-line + +# Close current view like in mutt. +bind diff i view-close + +# Unbind unnecessary views. I only use the main view and view diffs of +# commits. +bind generic m none +bind generic d none +bind generic l none +bind generic t none +bind generic f none +bind generic b none +bind generic r none +bind generic s none +bind generic S none +bind generic c none +bind generic y none +bind generic g none +bind generic p none +# Unbind commands which may change the repository. I use tig only as a viewer. +bind main C none + + +# COLORS + +# Try to mimic gitk's colors. + +color date default default +color delimiter default default # ~ if text is too long + +# Main window. +color cursor black cyan # currently selected line +color author default default +color graph-commit magenta default # commit dots in graph +color main-head green default bold # HEAD +color main-ref green default # branches +color main-remote yellow default # remote branches +color main-tag yellow default bold # tags +color main-local-tag yellow default bold # local tags (normal tags) + +# Information at the top of the commit diff. +color commit default default +color "Author: " default default +color "Commit: " default default +color pp-merge default default +color "Date: " default default +color "AuthorDate: " default default +color "CommitDate: " default default +color pp-refs default default +# Special parts of the commit message. +color " Signed-off-by" default default +color " Acked-by" default default + +# Diff coloring. +color diff-header default default bold # diff --git a/.. b/.. +color diff-index default default bold # index abc..def +color diff-chunk cyan default # @@ -.. +.. @@ + +# vim: ft=muttrc diff --git a/vcs/tigrc.old b/vcs/tigrc.old new file mode 100644 index 0000000..8824257 --- /dev/null +++ b/vcs/tigrc.old @@ -0,0 +1,104 @@ +# tig configuration file. + +# Copyright (C) 2011-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Show the revision graph like gitk does. +set show-rev-graph = yes + +# Use relative dates. +set show-date = relative + +# Don't display uncommitted changes. +set show-changes = no + +# Ignore case when searching. +set ignore-case = yes + + +# BINDINGS + +# Allow moving in the main menu while displaying a diff in the bottom of the +# screen. +bind generic J next +bind generic K previous + +# Mutt like bindings to move to first and last line. +bind generic = move-first-line +bind generic * move-last-line + +# Close current view like in mutt. +bind diff i view-close + +# Unbind unnecessary views. I only use the main view and view diffs of +# commits. +bind generic m none +bind generic d none +bind generic l none +bind generic t none +bind generic f none +bind generic B none +bind generic H none +bind generic p none +bind generic S none +bind generic c none +# Unbind commands which may change the repository. I use tig only as a viewer. +bind generic C none +bind generic u none +bind generic ! none +bind generic M none +bind generic 1 none +bind generic @ none +bind generic e none +bind generic G none + + +# COLORS + +# Try to mimic gitk's colors. + +color date default default +color delimiter default default # ~ if text is too long + +# Main window. +color cursor black cyan # currently selected line +color main-author default default # just 'author' in newer versions +color graph-commit magenta default # commit dots in graph +color main-head green default bold # HEAD +color main-ref green default # branches +color main-remote yellow default # remote branches +color main-tag yellow default bold # tags +color main-local-tag yellow default bold # local tags (normal tags) + +# Information at the top of the commit diff. +color commit default default +color pp-author default default +color pp-commit default default +color pp-merge default default +color pp-date default default +color pp-adate default default +color pp-cdate default default +color pp-refs default default +# Special parts of the commit message. +color signoff default default +color acked default default + +# Diff coloring. +color diff-header default default bold # diff --git a/.. b/.. +color diff-index default default bold # index abc..def +color diff-chunk cyan default # @@ -.. +.. @@ + +# vim: ft=muttrc diff --git a/vim/.gitignore b/vim/.gitignore new file mode 100644 index 0000000..f0da910 --- /dev/null +++ b/vim/.gitignore @@ -0,0 +1,5 @@ +# Ignore unnecessary Vim files. +/vim/bundle/*/doc/tags +/vim/cache/ +/vim/doc/tags +/vim/spell/ diff --git a/vim/Makefile b/vim/Makefile new file mode 100644 index 0000000..23d5991 --- /dev/null +++ b/vim/Makefile @@ -0,0 +1,4 @@ +all: + @./setup.sh + +.PHONY: all diff --git a/vim/crontab b/vim/crontab new file mode 100644 index 0000000..16b060e --- /dev/null +++ b/vim/crontab @@ -0,0 +1,21 @@ +# Vim crontab entry. + +# Copyright (C) 2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Delete CtrlP cache files older than one day to force CtrlP to repopulate the +# cache with current directory content. +36 */8 * * * D="$HOME/.vim/cache/ctrlp"; test -d "$D" && find "$D" -name '\%*' -type f -mtime +1 -delete; true diff --git a/vim/gvimrc b/vim/gvimrc new file mode 100644 index 0000000..8d36ddf --- /dev/null +++ b/vim/gvimrc @@ -0,0 +1,50 @@ +" GVim configuration file. + +" Copyright (C) 2011-2012 Simon Ruderich +" +" This file 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 file is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this file. If not, see . + + +" Stop the cursor from blinking. +set guicursor+=a:blinkon0 + +" Don't display the menu. +set guioptions-=m +" Don't display the toolbar. +set guioptions-=T +" Don't display any scrollbars, they just waste space. +set guioptions-=r +set guioptions-=R +set guioptions-=l +set guioptions-=L + +" Increase window size to 110x25 if no tiling window manager is used. +set columns=110 +set lines=25 + +" Don't use the mouse. +set mouse= +" And don't use the mouse wheel. +map +map +map +map +map +map +map +map +map +map +map +map diff --git a/vim/setup.sh b/vim/setup.sh new file mode 100755 index 0000000..6884298 --- /dev/null +++ b/vim/setup.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +# Setup script for Vim configuration files. + +# Copyright (C) 2011-2012 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +. ../lib.sh + + +# Create directories. +mkdir -p vim/cache + +# Create documentation tags for pathogen plugins. `vim -e` always exists with +# 1 for unknown reasons. +vim -e -c ':call pathogen#helptags()' -c ':q' || true + +# Link setup. +link vim ~/.vim +link vimrc ~/.vimrc +if installed gvim; then + link gvimrc ~/.gvimrc +fi + +# Create/Update custom spell checking files. +if test -f vim/spell/Makefile; then + make -C vim/spell +fi + +if test -d ~/.crontab.d; then + link crontab ~/.crontab.d/crontab.dotfiles-vim +fi diff --git a/vim/term2gui.pl b/vim/term2gui.pl new file mode 100755 index 0000000..274ad2c --- /dev/null +++ b/vim/term2gui.pl @@ -0,0 +1,313 @@ +#!/usr/bin/perl + +# Convert a terminal color scheme for 256 color terminals to a GUI color +# scheme by adding the appropriate gui* options. + +# Copyright (C) 2012-2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +use strict; +use warnings; + + +sub xterm2rgb { + my ($color) = @_; + + # Taken from the urxvt-8.2-256color.patch in Debian's urxvt-unicode + # package 9.07-2. + my @colors = ( + 'rgb:00/00/00', + 'rgb:00/00/5f', + 'rgb:00/00/87', + 'rgb:00/00/af', + 'rgb:00/00/d7', + 'rgb:00/00/ff', + 'rgb:00/5f/00', + 'rgb:00/5f/5f', + 'rgb:00/5f/87', + 'rgb:00/5f/af', + 'rgb:00/5f/d7', + 'rgb:00/5f/ff', + 'rgb:00/87/00', + 'rgb:00/87/5f', + 'rgb:00/87/87', + 'rgb:00/87/af', + 'rgb:00/87/d7', + 'rgb:00/87/ff', + 'rgb:00/af/00', + 'rgb:00/af/5f', + 'rgb:00/af/87', + 'rgb:00/af/af', + 'rgb:00/af/d7', + 'rgb:00/af/ff', + 'rgb:00/d7/00', + 'rgb:00/d7/5f', + 'rgb:00/d7/87', + 'rgb:00/d7/af', + 'rgb:00/d7/d7', + 'rgb:00/d7/ff', + 'rgb:00/ff/00', + 'rgb:00/ff/5f', + 'rgb:00/ff/87', + 'rgb:00/ff/af', + 'rgb:00/ff/d7', + 'rgb:00/ff/ff', + 'rgb:5f/00/00', + 'rgb:5f/00/5f', + 'rgb:5f/00/87', + 'rgb:5f/00/af', + 'rgb:5f/00/d7', + 'rgb:5f/00/ff', + 'rgb:5f/5f/00', + 'rgb:5f/5f/5f', + 'rgb:5f/5f/87', + 'rgb:5f/5f/af', + 'rgb:5f/5f/d7', + 'rgb:5f/5f/ff', + 'rgb:5f/87/00', + 'rgb:5f/87/5f', + 'rgb:5f/87/87', + 'rgb:5f/87/af', + 'rgb:5f/87/d7', + 'rgb:5f/87/ff', + 'rgb:5f/af/00', + 'rgb:5f/af/5f', + 'rgb:5f/af/87', + 'rgb:5f/af/af', + 'rgb:5f/af/d7', + 'rgb:5f/af/ff', + 'rgb:5f/d7/00', + 'rgb:5f/d7/5f', + 'rgb:5f/d7/87', + 'rgb:5f/d7/af', + 'rgb:5f/d7/d7', + 'rgb:5f/d7/ff', + 'rgb:5f/ff/00', + 'rgb:5f/ff/5f', + 'rgb:5f/ff/87', + 'rgb:5f/ff/af', + 'rgb:5f/ff/d7', + 'rgb:5f/ff/ff', + 'rgb:87/00/00', + 'rgb:87/00/5f', + 'rgb:87/00/87', + 'rgb:87/00/af', + 'rgb:87/00/d7', + 'rgb:87/00/ff', + 'rgb:87/5f/00', + 'rgb:87/5f/5f', + 'rgb:87/5f/87', + 'rgb:87/5f/af', + 'rgb:87/5f/d7', + 'rgb:87/5f/ff', + 'rgb:87/87/00', + 'rgb:87/87/5f', + 'rgb:87/87/87', + 'rgb:87/87/af', + 'rgb:87/87/d7', + 'rgb:87/87/ff', + 'rgb:87/af/00', + 'rgb:87/af/5f', + 'rgb:87/af/87', + 'rgb:87/af/af', + 'rgb:87/af/d7', + 'rgb:87/af/ff', + 'rgb:87/d7/00', + 'rgb:87/d7/5f', + 'rgb:87/d7/87', + 'rgb:87/d7/af', + 'rgb:87/d7/d7', + 'rgb:87/d7/ff', + 'rgb:87/ff/00', + 'rgb:87/ff/5f', + 'rgb:87/ff/87', + 'rgb:87/ff/af', + 'rgb:87/ff/d7', + 'rgb:87/ff/ff', + 'rgb:af/00/00', + 'rgb:af/00/5f', + 'rgb:af/00/87', + 'rgb:af/00/af', + 'rgb:af/00/d7', + 'rgb:af/00/ff', + 'rgb:af/5f/00', + 'rgb:af/5f/5f', + 'rgb:af/5f/87', + 'rgb:af/5f/af', + 'rgb:af/5f/d7', + 'rgb:af/5f/ff', + 'rgb:af/87/00', + 'rgb:af/87/5f', + 'rgb:af/87/87', + 'rgb:af/87/af', + 'rgb:af/87/d7', + 'rgb:af/87/ff', + 'rgb:af/af/00', + 'rgb:af/af/5f', + 'rgb:af/af/87', + 'rgb:af/af/af', + 'rgb:af/af/d7', + 'rgb:af/af/ff', + 'rgb:af/d7/00', + 'rgb:af/d7/5f', + 'rgb:af/d7/87', + 'rgb:af/d7/af', + 'rgb:af/d7/d7', + 'rgb:af/d7/ff', + 'rgb:af/ff/00', + 'rgb:af/ff/5f', + 'rgb:af/ff/87', + 'rgb:af/ff/af', + 'rgb:af/ff/d7', + 'rgb:af/ff/ff', + 'rgb:d7/00/00', + 'rgb:d7/00/5f', + 'rgb:d7/00/87', + 'rgb:d7/00/af', + 'rgb:d7/00/d7', + 'rgb:d7/00/ff', + 'rgb:d7/5f/00', + 'rgb:d7/5f/5f', + 'rgb:d7/5f/87', + 'rgb:d7/5f/af', + 'rgb:d7/5f/d7', + 'rgb:d7/5f/ff', + 'rgb:d7/87/00', + 'rgb:d7/87/5f', + 'rgb:d7/87/87', + 'rgb:d7/87/af', + 'rgb:d7/87/d7', + 'rgb:d7/87/ff', + 'rgb:d7/af/00', + 'rgb:d7/af/5f', + 'rgb:d7/af/87', + 'rgb:d7/af/af', + 'rgb:d7/af/d7', + 'rgb:d7/af/ff', + 'rgb:d7/d7/00', + 'rgb:d7/d7/5f', + 'rgb:d7/d7/87', + 'rgb:d7/d7/af', + 'rgb:d7/d7/d7', + 'rgb:d7/d7/ff', + 'rgb:d7/ff/00', + 'rgb:d7/ff/5f', + 'rgb:d7/ff/87', + 'rgb:d7/ff/af', + 'rgb:d7/ff/d7', + 'rgb:d7/ff/ff', + 'rgb:ff/00/00', + 'rgb:ff/00/5f', + 'rgb:ff/00/87', + 'rgb:ff/00/af', + 'rgb:ff/00/d7', + 'rgb:ff/00/ff', + 'rgb:ff/5f/00', + 'rgb:ff/5f/5f', + 'rgb:ff/5f/87', + 'rgb:ff/5f/af', + 'rgb:ff/5f/d7', + 'rgb:ff/5f/ff', + 'rgb:ff/87/00', + 'rgb:ff/87/5f', + 'rgb:ff/87/87', + 'rgb:ff/87/af', + 'rgb:ff/87/d7', + 'rgb:ff/87/ff', + 'rgb:ff/af/00', + 'rgb:ff/af/5f', + 'rgb:ff/af/87', + 'rgb:ff/af/af', + 'rgb:ff/af/d7', + 'rgb:ff/af/ff', + 'rgb:ff/d7/00', + 'rgb:ff/d7/5f', + 'rgb:ff/d7/87', + 'rgb:ff/d7/af', + 'rgb:ff/d7/d7', + 'rgb:ff/d7/ff', + 'rgb:ff/ff/00', + 'rgb:ff/ff/5f', + 'rgb:ff/ff/87', + 'rgb:ff/ff/af', + 'rgb:ff/ff/d7', + 'rgb:ff/ff/ff', + 'rgb:08/08/08', + 'rgb:12/12/12', + 'rgb:1c/1c/1c', + 'rgb:26/26/26', + 'rgb:30/30/30', + 'rgb:3a/3a/3a', + 'rgb:44/44/44', + 'rgb:4e/4e/4e', + 'rgb:58/58/58', + 'rgb:62/62/62', + 'rgb:6c/6c/6c', + 'rgb:76/76/76', + 'rgb:80/80/80', + 'rgb:8a/8a/8a', + 'rgb:94/94/94', + 'rgb:9e/9e/9e', + 'rgb:a8/a8/a8', + 'rgb:b2/b2/b2', + 'rgb:bc/bc/bc', + 'rgb:c6/c6/c6', + 'rgb:d0/d0/d0', + 'rgb:da/da/da', + 'rgb:e4/e4/e4', + 'rgb:ee/ee/ee', + ); + + return if $color < 16 or $color > 255; # undef + + my $value = $colors[$color - 16]; + $value =~ s{^rgb:}{}; + $value =~ s{/}{}g; + + return '#' . $value; +} + + +while () { + # Only handle lines with highlight commands. + if (/^\s*\bhi(?:ghlight)?\b/) { + foreach my $setting (m/\bcterm(?:fg|bg)?=\S+/g) { + my ($name, $value) = split /=/, $setting; + + my $gui_name = $name; + $gui_name =~ s/cterm/gui/; + + my $new_value; + if ($name eq 'cterm') { + $new_value = $value; + } elsif ($value eq 'NONE') { + $new_value = 'NONE'; + } else { + $new_value = xterm2rgb($value); + } + + # Update existing value. + if (/\b\Q$gui_name\E=/) { + s/\Q$gui_name\E=\S+/$gui_name=$new_value/; + # Append at the end of the line. + } else { + s/\n/ $gui_name=$new_value\n/; + } + } + } + + print; +} diff --git a/vim/vim/after/ftplugin/mail.vim b/vim/vim/after/ftplugin/mail.vim new file mode 100644 index 0000000..8d46f5a --- /dev/null +++ b/vim/vim/after/ftplugin/mail.vim @@ -0,0 +1,46 @@ +" Vim filetype plugin file +" +" Language: Mail +" Maintainer: Simon Ruderich +" License: GPL v3+ + +" Copyright (C) 2009-2013 Simon Ruderich +" +" This file 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 file is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this file. If not, see . + + +" Use only 65 characters per line as given in rfc1855. +setlocal textwidth=65 + +" Remove trailing whitespace after quotes. +silent! %s/^>.\{-}\zs\s\+$// +" Remove spaces between quotes (> > to >>). +silent! %s/^>\+\zs >/>/g +silent! %s/^>\+\zs >/>/g +silent! %s/^>\+\zs >/>/g + +" Move directly after the headers. +normal! gg +normal! } +" And if the mail contains a reply move the cursor after the quote. +if search('^On .\+ wrote:$', 'n') + normal! } +endif + +" Fold quotes. Thanks to Teemu Likonen +" (http://permalink.gmane.org/gmane.editors.vim.devel/20890, +" <20080809190407.GA7584@mithlond.arda.local>) and danielsh_ in #mutt on +" Freenode (2010-07-10 13:01 CEST) for letting me know. +setlocal foldmethod=expr foldminlines=2 +setlocal foldexpr=strlen(substitute(substitute(getline(v:lnum),'\\s','','g'),'[^>].*','','')) diff --git a/vim/vim/after/ftplugin/php.vim b/vim/vim/after/ftplugin/php.vim new file mode 100644 index 0000000..1c37b1e --- /dev/null +++ b/vim/vim/after/ftplugin/php.vim @@ -0,0 +1,25 @@ +" Vim filetype plugin file +" +" Language: PHP +" Maintainer: Simon Ruderich +" License: GPL v3+ + +" Copyright (C) 2008-2012 Simon Ruderich +" +" This file 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 file is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this file. If not, see . + + +" Automatically fix my wrong usage of kdb tags in phpdoc comments which don't +" exist and should be kbd tags. I make this typo all the time. +abbreviate kdb kbd diff --git a/vim/vim/after/syntax/apache.vim b/vim/vim/after/syntax/apache.vim new file mode 100644 index 0000000..474b5e6 --- /dev/null +++ b/vim/vim/after/syntax/apache.vim @@ -0,0 +1,24 @@ +" Vim syntax file +" +" Language: Apache files +" Maintainer: Simon Ruderich +" License: GPL v3+ + +" Copyright (C) 2008-2012 Simon Ruderich +" +" This file 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 file is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this file. If not, see . + + +" Only check spelling in comments. +syn match apacheComment "^\s*#.*$" contains=apacheFixme,@Spell diff --git a/vim/vim/after/syntax/c.vim b/vim/vim/after/syntax/c.vim new file mode 100644 index 0000000..4af58da --- /dev/null +++ b/vim/vim/after/syntax/c.vim @@ -0,0 +1,27 @@ +" Vim syntax file +" +" Language: C +" Maintainer: Simon Ruderich +" License: GPL v3+ + +" Copyright (C) 2012 Simon Ruderich +" +" This file 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 file is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this file. If not, see . + + +" Highlight statement control keywords differently when my color scheme is +" used. +if exists('g:colors_name') && g:colors_name == 'simon' + syntax keyword statementControl continue break return goto +endif diff --git a/vim/vim/after/syntax/crontab.vim b/vim/vim/after/syntax/crontab.vim new file mode 100644 index 0000000..1d12828 --- /dev/null +++ b/vim/vim/after/syntax/crontab.vim @@ -0,0 +1,24 @@ +" Vim syntax file +" +" Language: Crontab files +" Maintainer: Simon Ruderich +" License: GPL v3+ + +" Copyright (C) 2008-2012 Simon Ruderich +" +" This file 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 file is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this file. If not, see . + + +" Don't check spelling in variables. +syntax match crontabVar "^\s*\k\w*\s*="me=e-1 contains=@NoSpell diff --git a/vim/vim/after/syntax/diff.vim b/vim/vim/after/syntax/diff.vim new file mode 100644 index 0000000..7815f08 --- /dev/null +++ b/vim/vim/after/syntax/diff.vim @@ -0,0 +1,35 @@ +" Vim syntax file +" +" Language: Diff +" Maintainer: Simon Ruderich +" License: GPL v3+ + +" Copyright (C) 2012 Simon Ruderich +" +" This file 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 file is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this file. If not, see . + + +" Color added/removed lines in the diff header the same color as added/removed +" lines. +syntax match diffAdded /^+++ .*$/ +syntax match diffRemoved /^--- .*$/ +" Dedicated group for hunks. +syntax match diffHunk /^@.*$/ contains=diffSubname + +" Special colors for filename and hunk. +highlight diffFile ctermfg=yellow cterm=bold guifg=yellow gui=bold +highlight diffHunk ctermfg=magenta cterm=bold guifg=magenta gui=bold +" Added lines in green, removed lines in red. +highlight diffAdded ctermfg=green cterm=bold guifg=green gui=bold +highlight diffRemoved ctermfg=red cterm=bold guifg=red gui=bold diff --git a/vim/vim/after/syntax/gitcommit.vim b/vim/vim/after/syntax/gitcommit.vim new file mode 100644 index 0000000..f4ec7a3 --- /dev/null +++ b/vim/vim/after/syntax/gitcommit.vim @@ -0,0 +1,25 @@ +" Vim syntax file +" +" Language: Git commit messages +" Maintainer: Simon Ruderich +" License: GPL v3+ + +" Copyright (C) 2012 Simon Ruderich +" +" This file 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 file is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this file. If not, see . + + +" Don't fold diffs in Git commit messages. I want to fold the list of +" committed files, but take a closer look at the diffs. +syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|#\)\@=/ contains=@gitcommitDiff diff --git a/vim/vim/after/syntax/perl.vim b/vim/vim/after/syntax/perl.vim new file mode 100644 index 0000000..7a45bc1 --- /dev/null +++ b/vim/vim/after/syntax/perl.vim @@ -0,0 +1,39 @@ +" Vim syntax file +" +" Language: Perl +" Maintainer: Simon Ruderich +" License: GPL v3+ + +" Copyright (C) 2012-2014 Simon Ruderich +" +" This file 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 file is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this file. If not, see . + + +" Use SpecialComment to highlight shebangs. +highlight link perlSharpBang SpecialComment + +" I never use continue and break, and always confuse them with next and last. +syntax match Error "\<\(continue\|break\)\>" + +" Highlight statement control keywords differently when my color scheme is +" used. +if exists('g:colors_name') && g:colors_name == 'simon' + highlight link perlStatementControl statementControl +endif + +" Highlight for Inline::C in __DATA__/__END__ section +unlet b:current_syntax +syntax include @InlineC syntax/c.vim +syntax region perlInlineC start='^__C__$' skip='.' end='.' contains=@InlineC +syntax cluster perlDATA add=perlInlineC diff --git a/vim/vim/after/syntax/vim.vim b/vim/vim/after/syntax/vim.vim new file mode 100644 index 0000000..1943d3c --- /dev/null +++ b/vim/vim/after/syntax/vim.vim @@ -0,0 +1,25 @@ +" Vim syntax file +" +" Language: Vim .vim files +" Maintainer: Simon Ruderich +" License: GPL v3+ + +" Copyright (C) 2008-2012 Simon Ruderich +" +" This file 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 file is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this file. If not, see . + + +" Fix for the default .vim syntax to also recognize "syntax default" instead +" of "syntax def". +syn region vimHiLink contained oneline matchgroup=vimCommand start="\<\(def\(ault\)\?\s\+\)\=link\>\|\" end="$" contains=vimHiGroup,vimGroup,vimHLGroup,vimNotation diff --git a/vim/vim/autoload/pathogen.vim b/vim/vim/autoload/pathogen.vim new file mode 100644 index 0000000..7b89cca --- /dev/null +++ b/vim/vim/autoload/pathogen.vim @@ -0,0 +1,326 @@ +" pathogen.vim - path option manipulation +" Maintainer: Tim Pope +" Version: 2.2 + +" Install in ~/.vim/autoload (or ~\vimfiles\autoload). +" +" For management of individually installed plugins in ~/.vim/bundle (or +" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your +" .vimrc is the only other setup necessary. +" +" The API is documented inline below. For maximum ease of reading, +" :set foldmethod=marker + +if exists("g:loaded_pathogen") || &cp + finish +endif +let g:loaded_pathogen = 1 + +function! s:warn(msg) + echohl WarningMsg + echomsg a:msg + echohl NONE +endfunction + +" Point of entry for basic default usage. Give a relative path to invoke +" pathogen#incubate() (defaults to "bundle/{}"), or an absolute path to invoke +" pathogen#surround(). For backwards compatibility purposes, a full path that +" does not end in {} or * is given to pathogen#runtime_prepend_subdirectories() +" instead. +function! pathogen#infect(...) abort " {{{1 + for path in a:0 ? reverse(copy(a:000)) : ['bundle/{}'] + if path =~# '^[^\\/]\+$' + call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') + call pathogen#incubate(path . '/{}') + elseif path =~# '^[^\\/]\+[\\/]\%({}\|\*\)$' + call pathogen#incubate(path) + elseif path =~# '[\\/]\%({}\|\*\)$' + call pathogen#surround(path) + else + call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') + call pathogen#surround(path . '/{}') + endif + endfor + call pathogen#cycle_filetype() + return '' +endfunction " }}}1 + +" Split a path into a list. +function! pathogen#split(path) abort " {{{1 + if type(a:path) == type([]) | return a:path | endif + let split = split(a:path,'\\\@"),'!isdirectory(v:val)')) && (!filereadable(dir.sep.'doc'.sep.'tags') || filewritable(dir.sep.'doc'.sep.'tags')) + silent! execute 'helptags' pathogen#fnameescape(dir.'/doc') + endif + endfor + endfor +endfunction " }}}1 + +command! -bar Helptags :call pathogen#helptags() + +" Execute the given command. This is basically a backdoor for --remote-expr. +function! pathogen#execute(...) abort " {{{1 + for command in a:000 + execute command + endfor + return '' +endfunction " }}}1 + +" Like findfile(), but hardcoded to use the runtimepath. +function! pathogen#runtime_findfile(file,count) abort "{{{1 + let rtp = pathogen#join(1,pathogen#split(&rtp)) + let file = findfile(a:file,rtp,a:count) + if file ==# '' + return '' + else + return fnamemodify(file,':p') + endif +endfunction " }}}1 + +" Backport of fnameescape(). +function! pathogen#fnameescape(string) abort " {{{1 + if exists('*fnameescape') + return fnameescape(a:string) + elseif a:string ==# '-' + return '\-' + else + return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','') + endif +endfunction " }}}1 + +if exists(':Vedit') + finish +endif + +let s:vopen_warning = 0 + +function! s:find(count,cmd,file,lcd) " {{{1 + let rtp = pathogen#join(1,pathogen#split(&runtimepath)) + let file = pathogen#runtime_findfile(a:file,a:count) + if file ==# '' + return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'" + endif + if !s:vopen_warning + let s:vopen_warning = 1 + let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE' + else + let warning = '' + endif + if a:lcd + let path = file[0:-strlen(a:file)-2] + execute 'lcd `=path`' + return a:cmd.' '.pathogen#fnameescape(a:file) . warning + else + return a:cmd.' '.pathogen#fnameescape(file) . warning + endif +endfunction " }}}1 + +function! s:Findcomplete(A,L,P) " {{{1 + let sep = pathogen#separator() + let cheats = { + \'a': 'autoload', + \'d': 'doc', + \'f': 'ftplugin', + \'i': 'indent', + \'p': 'plugin', + \'s': 'syntax'} + if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0]) + let request = cheats[a:A[0]].a:A[1:-1] + else + let request = a:A + endif + let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*' + let found = {} + for path in pathogen#split(&runtimepath) + let path = expand(path, ':p') + let matches = split(glob(path.sep.pattern),"\n") + call map(matches,'isdirectory(v:val) ? v:val.sep : v:val') + call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]') + for match in matches + let found[match] = 1 + endfor + endfor + return sort(keys(found)) +endfunction " }}}1 + +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(,'edit',,0) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(,'edit',,0) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(,'edit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(,'split',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(,'vsplit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(,'tabedit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(,'pedit',,1) +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(,'read',,1) + +" vim:set et sw=2: diff --git a/vim/vim/bundle/ctrlp b/vim/vim/bundle/ctrlp new file mode 160000 index 0000000..b5d3fe6 --- /dev/null +++ b/vim/vim/bundle/ctrlp @@ -0,0 +1 @@ +Subproject commit b5d3fe66a58a13d2ff8b6391f4387608496a030f diff --git a/vim/vim/bundle/deb/autoload/deb.vim b/vim/vim/bundle/deb/autoload/deb.vim new file mode 100644 index 0000000..9e6fd1e --- /dev/null +++ b/vim/vim/bundle/deb/autoload/deb.vim @@ -0,0 +1,258 @@ +" Vim autoload file for browsing debian package. +" copyright (C) 2007-2008, arno renevier +" Distributed under the GNU General Public License (version 2 or above) +" Last Change: 2008 april 1 +" +" Inspired by autoload/tar.vim by Charles E Campbell +" +" Latest version of that file can be found at +" http://www.fdn.fr/~arenevier/vim/autoload/deb.vim +" It should also be available at +" http://www.vim.org/scripts/script.php?script_id=1970 + +if &cp || exists("g:loaded_deb") || v:version < 700 + finish +endif +let g:loaded_deb= "v1.4" + +fun! deb#read(debfile, member) + + " checks if ar and tar are installed + if !s:hascmd("ar") || !s:hascmd("tar") + return + endif + + let l:target = a:member + + let l:archmember = s:dataFileName(a:debfile) " default archive member to extract + if l:archmember == "" + echohl WarningMsg | echo "***error*** (deb#read) no valid data file found in debian archive" + return + elseif l:archmember == "data.tar.gz" + let l:unpcmp = "tar zxfO " + elseif l:archmember == "data.tar.bz2" + let l:unpcmp = "tar jxfO " + elseif l:archmember == "data.tar.lzma" + if !s:hascmd("lzma") + return + endif + let l:unpcmp = "lzma -d | tar xfO " + elseif l:archmember == "data.tar" + let l:unpcmp = "tar xfO " + endif + + if a:member =~ '^\* ' " information control file + let l:archmember = "control.tar.gz" + let l:target = substitute(l:target, "^\* ", "", "") + let l:unpcmp = "tar zxfO " + elseif a:member =~ ' -> ' " symbolic link + let l:target = split(a:member,' -> ')[0] + let l:linkname = split(a:member,' -> ')[1] + + if l:linkname =~ "^\/" " direct symlink: path is already absolute + let l:target = ".".l:linkname + + else + " transform relative path to absolute path + + " first, get basename for target + let l:target = substitute(l:target, "\/[^/]*$", "", "") + + " while it begins with ../ + while l:linkname =~ "^\.\.\/" + + " removes one level of ../ in linkname + let l:linkname = substitute(l:linkname, "^\.\.\/", "", "") + + " go one directory up in target + let l:target = substitute(l:target, "\/[^/]*$", "", "") + endwhile + + let l:target = l:target."/".l:linkname + endif + endif + + " we may preprocess some files (such as man pages, or changelogs) + let l:preproccmd = "" + + " + " unzip man pages + " + if l:target =~ "\.\/usr\/share\/man\/.*\.gz$" + + " try to fail gracefully if a command is not available + if !s:hascmd("gzip") + return + elseif !s:hascmd("nroff") + let l:preproccmd = "| gzip -cd" + elseif !s:hascmd("col") + let l:preproccmd = "| gzip -cd | nroff -mandoc" + else + let l:preproccmd = "| gzip -cd | nroff -mandoc | col -b" + endif + + " + " unzip other .gz files + " + elseif l:target =~ '.*\.gz$' + if !s:hascmd("gzip") + return + endif + let l:preproccmd = "| gzip -cd" + endif + + " read content + exe "silent r! ar p " . s:QuoteFile(a:debfile) . " " . s:QuoteFile(l:archmember) . " | " . l:unpcmp . " - " . s:QuoteFile(l:target) . l:preproccmd + " error will be treated in calling function + if v:shell_error != 0 + return + endif + + exe "file deb:".l:target + + 0d + + setlocal nomodifiable nomodified readonly + +endfun + +fun! deb#browse(file) + + " checks if necessary utils are installed + if !s:hascmd("dpkg") || !s:hascmd("ar") || !s:hascmd("tar") + return + endif + + " checks if file is readable + if !filereadable(a:file) + return + endif + if a:file =~ "'" + echohl WarningMsg | echo "***error*** (deb#Browse) filename cannot contain quote character (" . a:file . ")" + return + endif + + let keepmagic = &magic + set magic + + " set filetype to "deb" + set ft=deb + + setlocal modifiable noreadonly + + " set header + exe "$put ='".'\"'." deb.vim version ".g:loaded_deb."'" + exe "$put ='".'\"'." Browsing debian package ".a:file."'" + $put='' + + " package info + "exe "silent read! dpkg -I ".a:file + "$put='' + + " display information control files + let l:infopos = line(".") + exe "silent read! ar p " . s:QuoteFile(a:file) . " control.tar.gz | tar zt" + + $put='' + + " display data files + let l:listpos = line(".") + exe "silent read! dpkg -c ". s:QuoteFile(a:file) + + " format information control list + " removes '* ./' line + exe (l:infopos + 1). 'd' + " add a star before each line + exe "silent " . (l:infopos + 1). ',' . (l:listpos - 2) . 's/^/\* /' + + " format data list + exe "silent " . l:listpos . ',$s/^.*\s\(\.\/\(\S\|\).*\)$/\1/' + + if v:shell_error != 0 + echohl WarningMsg | echo "***warning*** (deb#Browse) error when listing content of " . a:file + let &magic = keepmagic + return + endif + + 0d + + setlocal nomodifiable readonly + noremap :call DebBrowseSelect() + let &magic = keepmagic + +endfun + +fun! s:DebBrowseSelect() + let l:fname= getline(".") + + " sanity check + if (l:fname !~ '^\.\/') && (l:fname !~ '^\* \.\/') + return + endif + if l:fname =~ "'" + echohl WarningMsg | echo "***error*** (DebBrowseSelect) filename cannot contain quote character (" . l:fname . ")" + return + endif + + " do nothing on directories + " TODO: find a way to detect symlinks to directories, to be able not to + " open them + if (l:fname =~ '\/$') + return + endif + + " need to get it now since a new window will open + let l:curfile= expand("%") + + " open new window + new + wincmd _ + + call deb#read(l:curfile, l:fname) + + if v:shell_error != 0 + echohl WarningMsg | echo "***warning*** (DebBrowseSelect) error when reading " . l:fname + return + endif + + filetype detect + + " zipped files, are unziped in deb#read, but filetype may not + " automatically work. + if l:fname =~ "\.\/usr\/share\/man\/.*\.gz$" + set filetype=man + elseif l:fname =~ "\.\/usr\/share\/doc\/.*\/changelog.Debian.gz$" + set filetype=debchangelog + endif + +endfun + +" return data file name for debian package. This can be either data.tar.gz, +" data.tar.bz2 or data.tar.lzma +fun s:dataFileName(deb) + for fn in ["data.tar.gz", "data.tar.bz2", "data.tar.lzma", "data.tar"] + " [0:-2] is to remove trailing null character from command output + if (system("ar t " . "'" . a:deb . "'" . " " . fn))[0:-2] == fn + return fn + endif + endfor + return "" " no debian data format in this archive +endfun + +fun s:QuoteFile(file) + " we need to escape %, #, <, and > + " see :help cmdline-specialk + return "'" . substitute(a:file, '\([%#<>]\)', '\\\1', 'g') . "'" +endfun + +" return 1 if cmd exists +" display error message and return 0 otherwise +fun s:hascmd(cmd) + if executable(a:cmd) + return 1 + else + echohl Error | echo "***error*** " . a:cmd . " not available on your system" + return 0 + else +endfu + diff --git a/vim/vim/bundle/deb/plugin/debPlugin.vim b/vim/vim/bundle/deb/plugin/debPlugin.vim new file mode 100644 index 0000000..4ae2f13 --- /dev/null +++ b/vim/vim/bundle/deb/plugin/debPlugin.vim @@ -0,0 +1,18 @@ +" debPlugin.vim -- a Vim plugin for browsing debian packages +" copyright (C) 2007, arno renevier +" Distributed under the GNU General Public License (version 2 or above) +" Last Change: 2007 December 07 +" +" This file only sets the autocommands. Functions are in autoload/deb.vim. +" +" Latest version of that file can be found at +" http://www.fdn.fr/~arenevier/vim/plugin/debPlugin.vim +" It should also be available at +" http://www.vim.org/scripts/script.php?script_id=1970 +" +if &cp || exists("g:loaded_debPlugin") || !has("unix") || v:version < 700 + finish +endif +let g:loaded_debPlugin = 1 + +autocmd BufReadCmd *.deb call deb#browse(expand("")) diff --git a/vim/vim/bundle/deb/syntax/deb.vim b/vim/vim/bundle/deb/syntax/deb.vim new file mode 100644 index 0000000..4ad6af1 --- /dev/null +++ b/vim/vim/bundle/deb/syntax/deb.vim @@ -0,0 +1,28 @@ +" Vim syntax file for browsing debian package. +" copyright (C) 2007, arno renevier +" Distributed under the GNU General Public License (version 2 or above) +" Last Change: 2007 December 07 +" +" Latest version of that file can be found at +" http://www.fdn.fr/~arenevier/vim/syntax/deb.vim +" It should also be available at +" http://www.vim.org/scripts/script.php?script_id=1970 + +if exists("b:current_syntax") + finish +endif + +syn match debComment '^".*' +syn match debInfoFilename '^\* \.\/.*' +syn match debDataFilename '^\.\/.*[^/]$' +syn match debDirname '^\..*\/$' +syn match debSymlink '^\.\/.* -> .*$' contains=debSymlinkTarget,debSymlinkArrow,debSymlinkName +syn match debSymlinkName '^\S*' contained +syn match debSymlinkTarget '\S*$' contained +syn match debSymlinkArrow '->' contained + +hi def link debComment Comment +hi def link debInfoFilename Type +hi def link debDataFilename PreProc +hi def link debSymlinkName Identifier +hi def link debSymlinkTarget PreProc diff --git a/vim/vim/bundle/fswitch b/vim/vim/bundle/fswitch new file mode 160000 index 0000000..e716da1 --- /dev/null +++ b/vim/vim/bundle/fswitch @@ -0,0 +1 @@ +Subproject commit e716da1ee6f80ee859b36083e6d6c3d7617b72e7 diff --git a/vim/vim/bundle/gundo b/vim/vim/bundle/gundo new file mode 160000 index 0000000..531f996 --- /dev/null +++ b/vim/vim/bundle/gundo @@ -0,0 +1 @@ +Subproject commit 531f996bfec59d0addfe102b16538e54f6a2111b diff --git a/vim/vim/bundle/matchit/doc/matchit.txt b/vim/vim/bundle/matchit/doc/matchit.txt new file mode 100644 index 0000000..8a3a96e --- /dev/null +++ b/vim/vim/bundle/matchit/doc/matchit.txt @@ -0,0 +1,406 @@ +*matchit.txt* Extended "%" matching + +For instructions on installing this file, type + :help matchit-install +inside Vim. + +For Vim version 6.3. Last change: 2007 Aug 29 + + + VIM REFERENCE MANUAL by Benji Fisher + +*matchit* *matchit.vim* + +1. Extended matching with "%" |matchit-intro| +2. Activation |matchit-activate| +3. Configuration |matchit-configure| +4. Supporting a New Language |matchit-newlang| +5. Known Bugs and Limitations |matchit-bugs| + +The functionality mentioned here is a plugin, see |add-plugin|. +This plugin is only available if 'compatible' is not set. +You can avoid loading this plugin by setting the "loaded_matchit" variable +in your |vimrc| file: > + :let loaded_matchit = 1 + +{Vi does not have any of this} + +============================================================================== +1. Extended matching with "%" *matchit-intro* + + *matchit-%* +% Cycle forward through matching groups, such as "if", "else", "endif", + as specified by |b:match_words|. + + *g%* *v_g%* *o_g%* +g% Cycle backwards through matching groups, as specified by + |b:match_words|. For example, go from "if" to "endif" to "else". + + *[%* *v_[%* *o_[%* +[% Go to [count] previous unmatched group, as specified by + |b:match_words|. Similar to |[{|. + + *]%* *v_]%* *o_]%* +]% Go to [count] next unmatched group, as specified by + |b:match_words|. Similar to |]}|. + + *v_a%* +a% In Visual mode, select the matching group, as specified by + |b:match_words|, containing the cursor. Similar to |v_a[|. + A [count] is ignored, and only the first character of the closing + pattern is selected. + +In Vim, as in plain vi, the percent key, |%|, jumps the cursor from a brace, +bracket, or paren to its match. This can be configured with the 'matchpairs' +option. The matchit plugin extends this in several ways: + + You can match whole words, such as "if" and "endif", not just + single characters. You can also specify a |regular-expression|. + You can define groups with more than two words, such as "if", + "else", "endif". Banging on the "%" key will cycle from the "if" to + the first "else", the next "else", ..., the closing "endif", and back + to the opening "if". Nested structures are skipped. Using |g%| goes + in the reverse direction. + By default, words inside comments and strings are ignored, unless + the cursor is inside a comment or string when you type "%". If the + only thing you want to do is modify the behavior of "%" so that it + behaves this way, you do not have to define |b:match_words|, since the + script uses the 'matchpairs' option as well as this variable. + +See |matchit-details| for details on what the script does, and |b:match_words| +for how to specify matching patterns. + +MODES: *matchit-modes* *matchit-v_%* *matchit-o_%* + +Mostly, % and related motions (|g%| and |[%| and |]%|) work just like built-in +|motion| commands in |Operator-pending| and |Visual| modes. However, you +cannot make these motions |linewise| or |characterwise|, since the |:omap|s +that define them start with "v" in order to make the default behavior +inclusive. (See |o_v|.) In other words, "dV%" will not work. The +work-around is to go through Visual mode: "V%d" will work. + +LANGUAGES: *matchit-languages* + +Currently, the following languages are supported: Ada, ASP with VBS, Csh, +DTD, Entity, Essbase, Fortran, HTML, JSP (same as HTML), LaTeX, Lua, Pascal, +SGML, Shell, Tcsh, Vim, XML. Other languages may already have support via +the default |filetype-plugin|s in the standard vim distribution. + +To support a new language, see |matchit-newlang| below. + +DETAILS: *matchit-details* *matchit-parse* + +Here is an outline of what matchit.vim does each time you hit the "%" key. If +there are |backref|s in |b:match_words| then the first step is to produce a +version in which these back references have been eliminated; if there are no +|backref|s then this step is skipped. This step is called parsing. For +example, "\(foo\|bar\):end\1" is parsed to yield +"\(foo\|bar\):end\(foo\|bar\)". This can get tricky, especially if there are +nested groups. If debugging is turned on, the parsed version is saved as +|b:match_pat|. + + *matchit-choose* +Next, the script looks for a word on the current line that matches the pattern +just constructed. It includes the patterns from the 'matchpairs' option. +The goal is to do what you expect, which turns out to be a little complicated. +The script follows these rules: + + Insist on a match that ends on or after the cursor. + Prefer a match that includes the cursor position (that is, one that + starts on or before the cursor). + Prefer a match that starts as close to the cursor as possible. + If more than one pattern in |b:match_words| matches, choose the one + that is listed first. + +Examples: + + Suppose you > + :let b:match_words = '<:>,:' +< and hit "%" with the cursor on or before the "<" in "a is born". + The pattern '<' comes first, so it is preferred over '', which + also matches. If the cursor is on the "t", however, then '' is + preferred, because this matches a bit of text containing the cursor. + If the two groups of patterns were reversed then '<' would never be + preferred. + + Suppose you > + :let b:match_words = 'if:end if' +< (Note the space!) and hit "%" with the cursor at the end of "end if". + Then "if" matches, which is probably not what you want, but if the + cursor starts on the "end " then "end if" is chosen. (You can avoid + this problem by using a more complicated pattern.) + +If there is no match, the cursor does not move. (Before version 1.13 of the +script, it would fall back on the usual behavior of |%|). If debugging is +turned on, the matched bit of text is saved as |b:match_match| and the cursor +column of the start of the match is saved as |b:match_col|. + +Next, the script looks through |b:match_words| (original and parsed versions) +for the group and pattern that match. If debugging is turned on, the group is +saved as |b:match_ini| (the first pattern) and |b:match_tail| (the rest). If +there are |backref|s then, in addition, the matching pattern is saved as +|b:match_word| and a table of translations is saved as |b:match_table|. If +there are |backref|s, these are determined from the matching pattern and +|b:match_match| and substituted into each pattern in the matching group. + +The script decides whether to search forwards or backwards and chooses +arguments for the |searchpair()| function. Then, the cursor is moved to the +start of the match, and |searchpair()| is called. By default, matching +structures inside strings and comments are ignored. This can be changed by +setting |b:match_skip|. + +============================================================================== +2. Activation *matchit-activate* + +You can use this script as a plugin, by copying it to your plugin directory. +See |add-global-plugin| for instructions. You can also add a line to your +|vimrc| file, such as > + :source $VIMRUNTIME/macros/matchit.vim +or > + :runtime macros/matchit.vim +Either way, the script should start working the next time you start up Vim. + +(Earlier versions of the script did nothing unless a |buffer-variable| named +|b:match_words| was defined. Even earlier versions contained autocommands +that set this variable for various file types. Now, |b:match_words| is +defined in many of the default |filetype-plugin|s instead.) + +For a new language, you can add autocommands to the script or to your vimrc +file, but the recommended method is to add a line such as > + let b:match_words = '\:\' +to the |filetype-plugin| for your language. See |b:match_words| below for how +this variable is interpreted. + +TROUBLESHOOTING *matchit-troubleshoot* + +The script should work in most installations of Vim. It may not work if Vim +was compiled with a minimal feature set, for example if the |+syntax| option +was not enabled. If your Vim has support for syntax compiled in, but you do +not have |syntax| highlighting turned on, matchit.vim should work, but it may +fail to skip matching groups in comments and strings. If the |filetype| +mechanism is turned off, the |b:match_words| variable will probably not be +defined automatically. + +============================================================================== +3. Configuration *matchit-configure* + +There are several variables that govern the behavior of matchit.vim. Note +that these are variables local to the buffer, not options, so use |:let| to +define them, not |:set|. Some of these variables have values that matter; for +others, it only matters whether the variable has been defined. All of these +can be defined in the |filetype-plugin| or autocommand that defines +|b:match_words| or "on the fly." + +The main variable is |b:match_words|. It is described in the section below on +supporting a new language. + + *MatchError* *matchit-hl* *matchit-highlight* +MatchError is the highlight group for error messages from the script. By +default, it is linked to WarningMsg. If you do not want to be bothered by +error messages, you can define this to be something invisible. For example, +if you use the GUI version of Vim and your command line is normally white, you +can do > + :hi MatchError guifg=white guibg=white +< + *b:match_ignorecase* +If you > + :let b:match_ignorecase = 1 +then matchit.vim acts as if 'ignorecase' is set: for example, "end" and "END" +are equivalent. If you > + :let b:match_ignorecase = 0 +then matchit.vim treats "end" and "END" differently. (There will be no +b:match_infercase option unless someone requests it.) + + *b:match_debug* +Define b:match_debug if you want debugging information to be saved. See +|matchit-debug|, below. + + *b:match_skip* +If b:match_skip is defined, it is passed as the skip argument to +|searchpair()|. This controls when matching structures are skipped, or +ignored. By default, they are ignored inside comments and strings, as +determined by the |syntax| mechanism. (If syntax highlighting is turned off, +nothing is skipped.) You can set b:match_skip to a string, which evaluates to +a non-zero, numerical value if the match is to be skipped or zero if the match +should not be skipped. In addition, the following special values are +supported by matchit.vim: + s:foo becomes (current syntax item) =~ foo + S:foo becomes (current syntax item) !~ foo + r:foo becomes (line before cursor) =~ foo + R:foo becomes (line before cursor) !~ foo +(The "s" is meant to suggest "syntax", and the "r" is meant to suggest +"regular expression".) + +Examples: + + You can get the default behavior with > + :let b:match_skip = 's:comment\|string' +< + If you want to skip matching structures unless they are at the start + of the line (ignoring whitespace) then you can > + :let b:match_skip = 'R:^\s*' +< Do not do this if strings or comments can span several lines, since + the normal syntax checking will not be done if you set b:match_skip. + + In LaTeX, since "%" is used as the comment character, you can > + :let b:match_skip = 'r:%' +< Unfortunately, this will skip anything after "\%", an escaped "%". To + allow for this, and also "\\%" (an excaped backslash followed by the + comment character) you can > + :let b:match_skip = 'r:\(^\|[^\\]\)\(\\\\\)*%' +< + See the $VIMRUNTIME/ftplugin/vim.vim for an example that uses both + syntax and a regular expression. + +============================================================================== +4. Supporting a New Language *matchit-newlang* + *b:match_words* +In order for matchit.vim to support a new language, you must define a suitable +pattern for |b:match_words|. You may also want to set some of the +|matchit-configure| variables, as described above. If your language has a +complicated syntax, or many keywords, you will need to know something about +Vim's |regular-expression|s. + +The format for |b:match_words| is similar to that of the 'matchpairs' option: +it is a comma (,)-separated list of groups; each group is a colon(:)-separated +list of patterns (regular expressions). Commas and backslashes that are part +of a pattern should be escaped with backslashes ('\:' and '\,'). It is OK to +have only one group; the effect is undefined if a group has only one pattern. +A simple example is > + :let b:match_words = '\:\,' + \ . '\:\:\:\' +(In Vim regular expressions, |\<| and |\>| denote word boundaries. Thus "if" +matches the end of "endif" but "\" does not.) Then banging on the "%" +key will bounce the cursor between "if" and the matching "endif"; and from +"while" to any matching "continue" or "break", then to the matching "endwhile" +and back to the "while". It is almost always easier to use |literal-string|s +(single quotes) as above: '\' rather than "\\" and so on. + +Exception: If the ":" character does not appear in b:match_words, then it is +treated as an expression to be evaluated. For example, > + :let b:match_words = 'GetMatchWords()' +allows you to define a function. This can return a different string depending +on the current syntax, for example. + +Once you have defined the appropriate value of |b:match_words|, you will +probably want to have this set automatically each time you edit the +appropriate file type. The recommended way to do this is by adding the +definition to a |filetype-plugin| file. + +Tips: Be careful that your initial pattern does not match your final pattern. +See the example above for the use of word-boundary expressions. It is usually +better to use ".\{-}" (as many as necessary) instead of ".*" (as many as +possible). See |\{-|. For example, in the string "label", "<.*>" +matches the whole string whereas "<.\{-}>" and "<[^>]*>" match "" and +"". + + *matchit-spaces* *matchit-s:notend* +If "if" is to be paired with "end if" (Note the space!) then word boundaries +are not enough. Instead, define a regular expression s:notend that will match +anything but "end" and use it as follows: > + :let s:notend = '\%(\:\' +< *matchit-s:sol* +This is a simplified version of what is done for Ada. The s:notend is a +|script-variable|. Similarly, you may want to define a start-of-line regular +expression > + :let s:sol = '\%(^\|;\)\s*' +if keywords are only recognized after the start of a line or after a +semicolon (;), with optional white space. + + *matchit-backref* *matchit-\1* +In any group, the expressions |\1|, |\2|, ..., |\9| refer to parts of the +INITIAL pattern enclosed in |\(|escaped parentheses|\)|. These are referred +to as back references, or backrefs. For example, > + :let b:match_words = '\:\(h\)\1\>' +means that "bo" pairs with "ho" and "boo" pairs with "hoo" and so on. Note +that "\1" does not refer to the "\(h\)" in this example. If you have +"\(nested \(parentheses\)\) then "\d" refers to the d-th "\(" and everything +up to and including the matching "\)": in "\(nested\(parentheses\)\)", "\1" +refers to everything and "\2" refers to "\(parentheses\)". If you use a +variable such as |s:notend| or |s:sol| in the previous paragraph then remember +to count any "\(" patterns in this variable. You do not have to count groups +defined by |\%(\)|. + +It should be possible to resolve back references from any pattern in the +group. For example, > + :let b:match_words = '\(foo\)\(bar\):more\1:and\2:end\1\2' +would not work because "\2" cannot be determined from "morefoo" and "\1" +cannot be determined from "andbar". On the other hand, > + :let b:match_words = '\(\(foo\)\(bar\)\):\3\2:end\1' +should work (and have the same effect as "foobar:barfoo:endfoobar"), although +this has not been thoroughly tested. + +You can use |zero-width| patterns such as |\@<=| and |\zs|. (The latter has +not been thouroughly tested in matchit.vim.) For example, if the keyword "if" +must occur at the start of the line, with optional white space, you might use +the pattern "\(^\s*\)\@<=if" so that the cursor will end on the "i" instead of +at the start of the line. For another example, if HTML had only one tag then +one could > + :let b:match_words = '<:>,<\@<=tag>:<\@<=/tag>' +so that "%" can bounce between matching "<" and ">" pairs or (starting on +"tag" or "/tag") between matching tags. Without the |\@<=|, the script would +bounce from "tag" to the "<" in "", and another "%" would not take you +back to where you started. + +DEBUGGING *matchit-debug* *:MatchDebug* + +If you are having trouble figuring out the appropriate definition of +|b:match_words| then you can take advantage of the same information I use when +debugging the script. This is especially true if you are not sure whether +your patterns or my script are at fault! To make this more convenient, I have +made the command :MatchDebug, which defines the variable |b:match_debug| and +creates a Matchit menu. This menu makes it convenient to check the values of +the variables described below. You will probably also want to read +|matchit-details| above. + +Defining the variable |b:match_debug| causes the script to set the following +variables, each time you hit the "%" key. Several of these are only defined +if |b:match_words| includes |backref|s. + + *b:match_pat* +The b:match_pat variable is set to |b:match_words| with |backref|s parsed. + *b:match_match* +The b:match_match variable is set to the bit of text that is recognized as a +match. + *b:match_col* +The b:match_col variable is set to the cursor column of the start of the +matching text. + *b:match_wholeBR* +The b:match_wholeBR variable is set to the comma-separated group of patterns +that matches, with |backref|s unparsed. + *b:match_iniBR* +The b:match_iniBR variable is set to the first pattern in |b:match_wholeBR|. + *b:match_ini* +The b:match_ini variable is set to the first pattern in |b:match_wholeBR|, +with |backref|s resolved from |b:match_match|. + *b:match_tail* +The b:match_tail variable is set to the remaining patterns in +|b:match_wholeBR|, with |backref|s resolved from |b:match_match|. + *b:match_word* +The b:match_word variable is set to the pattern from |b:match_wholeBR| that +matches |b:match_match|. + *b:match_table* +The back reference '\'.d refers to the same thing as '\'.b:match_table[d] in +|b:match_word|. + +============================================================================== +5. Known Bugs and Limitations *matchit-bugs* + +Just because I know about a bug does not mean that it is on my todo list. I +try to respond to reports of bugs that cause real problems. If it does not +cause serious problems, or if there is a work-around, a bug may sit there for +a while. Moral: if a bug (known or not) bothers you, let me know. + +The various |:vmap|s defined in the script (%, |g%|, |[%|, |]%|, |a%|) may +have undesired effects in Select mode |Select-mode-mapping|. At least, if you +want to replace the selection with any character in "ag%[]" there will be a +pause of |'updatetime'| first. + +It would be nice if "\0" were recognized as the entire pattern. That is, it +would be nice if "foo:\end\0" had the same effect as "\(foo\):\end\1". I may +try to implement this in a future version. (This is not so easy to arrange as +you might think!) + +============================================================================== +vim:tw=78:fo=tcq2: diff --git a/vim/vim/bundle/matchit/plugin/matchit.vim b/vim/vim/bundle/matchit/plugin/matchit.vim new file mode 100644 index 0000000..e41cda9 --- /dev/null +++ b/vim/vim/bundle/matchit/plugin/matchit.vim @@ -0,0 +1,812 @@ +" matchit.vim: (global plugin) Extended "%" matching +" Last Change: Fri Jan 25 10:00 AM 2008 EST +" Maintainer: Benji Fisher PhD +" Version: 1.13.2, for Vim 6.3+ +" URL: http://www.vim.org/script.php?script_id=39 + +" Documentation: +" The documentation is in a separate file, matchit.txt . + +" Credits: +" Vim editor by Bram Moolenaar (Thanks, Bram!) +" Original script and design by Raul Segura Acevedo +" Support for comments by Douglas Potts +" Support for back references and other improvements by Benji Fisher +" Support for many languages by Johannes Zellner +" Suggestions for improvement, bug reports, and support for additional +" languages by Jordi-Albert Batalla, Neil Bird, Servatius Brandt, Mark +" Collett, Stephen Wall, Dany St-Amant, Yuheng Xie, and Johannes Zellner. + +" Debugging: +" If you'd like to try the built-in debugging commands... +" :MatchDebug to activate debugging for the current buffer +" This saves the values of several key script variables as buffer-local +" variables. See the MatchDebug() function, below, for details. + +" TODO: I should think about multi-line patterns for b:match_words. +" This would require an option: how many lines to scan (default 1). +" This would be useful for Python, maybe also for *ML. +" TODO: Maybe I should add a menu so that people will actually use some of +" the features that I have implemented. +" TODO: Eliminate the MultiMatch function. Add yet another argument to +" Match_wrapper() instead. +" TODO: Allow :let b:match_words = '\(\(foo\)\(bar\)\):\3\2:end\1' +" TODO: Make backrefs safer by using '\V' (very no-magic). +" TODO: Add a level of indirection, so that custom % scripts can use my +" work but extend it. + +" allow user to prevent loading +" and prevent duplicate loading +if exists("loaded_matchit") || &cp + finish +endif +let loaded_matchit = 1 +let s:last_mps = "" +let s:last_words = ":" + +let s:save_cpo = &cpo +set cpo&vim + +nnoremap % :call Match_wrapper('',1,'n') +nnoremap g% :call Match_wrapper('',0,'n') +vnoremap % :call Match_wrapper('',1,'v') m'gv`` +vnoremap g% :call Match_wrapper('',0,'v') m'gv`` +onoremap % v:call Match_wrapper('',1,'o') +onoremap g% v:call Match_wrapper('',0,'o') + +" Analogues of [{ and ]} using matching patterns: +nnoremap [% :call MultiMatch("bW", "n") +nnoremap ]% :call MultiMatch("W", "n") +vmap [% [%m'gv`` +vmap ]% ]%m'gv`` +" vnoremap [% :call MultiMatch("bW", "v") m'gv`` +" vnoremap ]% :call MultiMatch("W", "v") m'gv`` +onoremap [% v:call MultiMatch("bW", "o") +onoremap ]% v:call MultiMatch("W", "o") + +" text object: +vmap a% [%v]% + +" Auto-complete mappings: (not yet "ready for prime time") +" TODO Read :help write-plugin for the "right" way to let the user +" specify a key binding. +" let g:match_auto = '' +" let g:match_autoCR = '' +" if exists("g:match_auto") +" execute "inoremap " . g:match_auto . ' x"=Autocomplete()Pls' +" endif +" if exists("g:match_autoCR") +" execute "inoremap " . g:match_autoCR . ' =Autocomplete()' +" endif +" if exists("g:match_gthhoh") +" execute "inoremap " . g:match_gthhoh . ' :call Gthhoh()' +" endif " gthhoh = "Get the heck out of here!" + +let s:notslash = '\\\@" + endif + " In s:CleanUp(), we may need to check whether the cursor moved forward. + let startline = line(".") + let startcol = col(".") + " Use default behavior if called with a count. + if v:count + exe "normal! " . v:count . "%" + return s:CleanUp(restore_options, a:mode, startline, startcol) + end + + " First step: if not already done, set the script variables + " s:do_BR flag for whether there are backrefs + " s:pat parsed version of b:match_words + " s:all regexp based on s:pat and the default groups + " + if !exists("b:match_words") || b:match_words == "" + let match_words = "" + " Allow b:match_words = "GetVimMatchWords()" . + elseif b:match_words =~ ":" + let match_words = b:match_words + else + execute "let match_words =" b:match_words + endif +" Thanks to Preben "Peppe" Guldberg and Bram Moolenaar for this suggestion! + if (match_words != s:last_words) || (&mps != s:last_mps) || + \ exists("b:match_debug") + let s:last_words = match_words + let s:last_mps = &mps + " The next several lines were here before + " BF started messing with this script. + " quote the special chars in 'matchpairs', replace [,:] with \| and then + " append the builtin pairs (/*, */, #if, #ifdef, #else, #elif, #endif) + " let default = substitute(escape(&mps, '[$^.*~\\/?]'), '[,:]\+', + " \ '\\|', 'g').'\|\/\*\|\*\/\|#if\>\|#ifdef\>\|#else\>\|#elif\>\|#endif\>' + let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") . + \ '\/\*:\*\/,#if\%(def\)\=:#else\>:#elif\>:#endif\>' + " s:all = pattern with all the keywords + let match_words = match_words . (strlen(match_words) ? "," : "") . default + if match_words !~ s:notslash . '\\\d' + let s:do_BR = 0 + let s:pat = match_words + else + let s:do_BR = 1 + let s:pat = s:ParseWords(match_words) + endif + let s:all = substitute(s:pat, s:notslash . '\zs[,:]\+', '\\|', 'g') + let s:all = '\%(' . s:all . '\)' + " let s:all = '\%(' . substitute(s:all, '\\\ze[,:]', '', 'g') . '\)' + if exists("b:match_debug") + let b:match_pat = s:pat + endif + endif + + " Second step: set the following local variables: + " matchline = line on which the cursor started + " curcol = number of characters before match + " prefix = regexp for start of line to start of match + " suffix = regexp for end of match to end of line + " Require match to end on or after the cursor and prefer it to + " start on or before the cursor. + let matchline = getline(startline) + if a:word != '' + " word given + if a:word !~ s:all + echohl WarningMsg|echo 'Missing rule for word:"'.a:word.'"'|echohl NONE + return s:CleanUp(restore_options, a:mode, startline, startcol) + endif + let matchline = a:word + let curcol = 0 + let prefix = '^\%(' + let suffix = '\)$' + " Now the case when "word" is not given + else " Find the match that ends on or after the cursor and set curcol. + let regexp = s:Wholematch(matchline, s:all, startcol-1) + let curcol = match(matchline, regexp) + " If there is no match, give up. + if curcol == -1 + return s:CleanUp(restore_options, a:mode, startline, startcol) + endif + let endcol = matchend(matchline, regexp) + let suf = strlen(matchline) - endcol + let prefix = (curcol ? '^.*\%' . (curcol + 1) . 'c\%(' : '^\%(') + let suffix = (suf ? '\)\%' . (endcol + 1) . 'c.*$' : '\)$') + endif + if exists("b:match_debug") + let b:match_match = matchstr(matchline, regexp) + let b:match_col = curcol+1 + endif + + " Third step: Find the group and single word that match, and the original + " (backref) versions of these. Then, resolve the backrefs. + " Set the following local variable: + " group = colon-separated list of patterns, one of which matches + " = ini:mid:fin or ini:fin + " + " Reconstruct the version with unresolved backrefs. + let patBR = substitute(match_words.',', + \ s:notslash.'\zs[,:]*,[,:]*', ',', 'g') + let patBR = substitute(patBR, s:notslash.'\zs:\{2,}', ':', 'g') + " Now, set group and groupBR to the matching group: 'if:endif' or + " 'while:endwhile' or whatever. A bit of a kluge: s:Choose() returns + " group . "," . groupBR, and we pick it apart. + let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, patBR) + let i = matchend(group, s:notslash . ",") + let groupBR = strpart(group, i) + let group = strpart(group, 0, i-1) + " Now, matchline =~ prefix . substitute(group,':','\|','g') . suffix + if s:do_BR " Do the hard part: resolve those backrefs! + let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline) + endif + if exists("b:match_debug") + let b:match_wholeBR = groupBR + let i = matchend(groupBR, s:notslash . ":") + let b:match_iniBR = strpart(groupBR, 0, i-1) + endif + + " Fourth step: Set the arguments for searchpair(). + let i = matchend(group, s:notslash . ":") + let j = matchend(group, '.*' . s:notslash . ":") + let ini = strpart(group, 0, i-1) + let mid = substitute(strpart(group, i,j-i-1), s:notslash.'\zs:', '\\|', 'g') + let fin = strpart(group, j) + "Un-escape the remaining , and : characters. + let ini = substitute(ini, s:notslash . '\zs\\\(:\|,\)', '\1', 'g') + let mid = substitute(mid, s:notslash . '\zs\\\(:\|,\)', '\1', 'g') + let fin = substitute(fin, s:notslash . '\zs\\\(:\|,\)', '\1', 'g') + " searchpair() requires that these patterns avoid \(\) groups. + let ini = substitute(ini, s:notslash . '\zs\\(', '\\%(', 'g') + let mid = substitute(mid, s:notslash . '\zs\\(', '\\%(', 'g') + let fin = substitute(fin, s:notslash . '\zs\\(', '\\%(', 'g') + " Set mid. This is optimized for readability, not micro-efficiency! + if a:forward && matchline =~ prefix . fin . suffix + \ || !a:forward && matchline =~ prefix . ini . suffix + let mid = "" + endif + " Set flag. This is optimized for readability, not micro-efficiency! + if a:forward && matchline =~ prefix . fin . suffix + \ || !a:forward && matchline !~ prefix . ini . suffix + let flag = "bW" + else + let flag = "W" + endif + " Set skip. + if exists("b:match_skip") + let skip = b:match_skip + elseif exists("b:match_comment") " backwards compatibility and testing! + let skip = "r:" . b:match_comment + else + let skip = 's:comment\|string' + endif + let skip = s:ParseSkip(skip) + if exists("b:match_debug") + let b:match_ini = ini + let b:match_tail = (strlen(mid) ? mid.'\|' : '') . fin + endif + + " Fifth step: actually start moving the cursor and call searchpair(). + " Later, :execute restore_cursor to get to the original screen. + let restore_cursor = virtcol(".") . "|" + normal! g0 + let restore_cursor = line(".") . "G" . virtcol(".") . "|zs" . restore_cursor + normal! H + let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor + execute restore_cursor + call cursor(0, curcol + 1) + " normal! 0 + " if curcol + " execute "normal!" . curcol . "l" + " endif + if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on")) + let skip = "0" + else + execute "if " . skip . "| let skip = '0' | endif" + endif + let sp_return = searchpair(ini, mid, fin, flag, skip) + let final_position = "call cursor(" . line(".") . "," . col(".") . ")" + " Restore cursor position and original screen. + execute restore_cursor + normal! m' + if sp_return > 0 + execute final_position + endif + return s:CleanUp(restore_options, a:mode, startline, startcol, mid.'\|'.fin) +endfun + +" Restore options and do some special handling for Operator-pending mode. +" The optional argument is the tail of the matching group. +fun! s:CleanUp(options, mode, startline, startcol, ...) + execute "set" a:options + " Open folds, if appropriate. + if a:mode != "o" + if &foldopen =~ "percent" + normal! zv + endif + " In Operator-pending mode, we want to include the whole match + " (for example, d%). + " This is only a problem if we end up moving in the forward direction. + elseif (a:startline < line(".")) || + \ (a:startline == line(".") && a:startcol < col(".")) + if a:0 + " Check whether the match is a single character. If not, move to the + " end of the match. + let matchline = getline(".") + let currcol = col(".") + let regexp = s:Wholematch(matchline, a:1, currcol-1) + let endcol = matchend(matchline, regexp) + if endcol > currcol " This is NOT off by one! + execute "normal!" . (endcol - currcol) . "l" + endif + endif " a:0 + endif " a:mode != "o" && etc. + return 0 +endfun + +" Example (simplified HTML patterns): if +" a:groupBR = '<\(\k\+\)>:' +" a:prefix = '^.\{3}\(' +" a:group = '<\(\k\+\)>:' +" a:suffix = '\).\{2}$' +" a:matchline = "12312" or "12312" +" then extract "tag" from a:matchline and return ":" . +fun! s:InsertRefs(groupBR, prefix, group, suffix, matchline) + if a:matchline !~ a:prefix . + \ substitute(a:group, s:notslash . '\zs:', '\\|', 'g') . a:suffix + return a:group + endif + let i = matchend(a:groupBR, s:notslash . ':') + let ini = strpart(a:groupBR, 0, i-1) + let tailBR = strpart(a:groupBR, i) + let word = s:Choose(a:group, a:matchline, ":", "", a:prefix, a:suffix, + \ a:groupBR) + let i = matchend(word, s:notslash . ":") + let wordBR = strpart(word, i) + let word = strpart(word, 0, i-1) + " Now, a:matchline =~ a:prefix . word . a:suffix + if wordBR != ini + let table = s:Resolve(ini, wordBR, "table") + else + " let table = "----------" + let table = "" + let d = 0 + while d < 10 + if tailBR =~ s:notslash . '\\' . d + " let table[d] = d + let table = table . d + else + let table = table . "-" + endif + let d = d + 1 + endwhile + endif + let d = 9 + while d + if table[d] != "-" + let backref = substitute(a:matchline, a:prefix.word.a:suffix, + \ '\'.table[d], "") + " Are there any other characters that should be escaped? + let backref = escape(backref, '*,:') + execute s:Ref(ini, d, "start", "len") + let ini = strpart(ini, 0, start) . backref . strpart(ini, start+len) + let tailBR = substitute(tailBR, s:notslash . '\zs\\' . d, + \ escape(backref, '\\'), 'g') + endif + let d = d-1 + endwhile + if exists("b:match_debug") + if s:do_BR + let b:match_table = table + let b:match_word = word + else + let b:match_table = "" + let b:match_word = "" + endif + endif + return ini . ":" . tailBR +endfun + +" Input a comma-separated list of groups with backrefs, such as +" a:groups = '\(foo\):end\1,\(bar\):end\1' +" and return a comma-separated list of groups with backrefs replaced: +" return '\(foo\):end\(foo\),\(bar\):end\(bar\)' +fun! s:ParseWords(groups) + let groups = substitute(a:groups.",", s:notslash.'\zs[,:]*,[,:]*', ',', 'g') + let groups = substitute(groups, s:notslash . '\zs:\{2,}', ':', 'g') + let parsed = "" + while groups =~ '[^,:]' + let i = matchend(groups, s:notslash . ':') + let j = matchend(groups, s:notslash . ',') + let ini = strpart(groups, 0, i-1) + let tail = strpart(groups, i, j-i-1) . ":" + let groups = strpart(groups, j) + let parsed = parsed . ini + let i = matchend(tail, s:notslash . ':') + while i != -1 + " In 'if:else:endif', ini='if' and word='else' and then word='endif'. + let word = strpart(tail, 0, i-1) + let tail = strpart(tail, i) + let i = matchend(tail, s:notslash . ':') + let parsed = parsed . ":" . s:Resolve(ini, word, "word") + endwhile " Now, tail has been used up. + let parsed = parsed . "," + endwhile " groups =~ '[^,:]' + let parsed = substitute(parsed, ',$', '', '') + return parsed +endfun + +" TODO I think this can be simplified and/or made more efficient. +" TODO What should I do if a:start is out of range? +" Return a regexp that matches all of a:string, such that +" matchstr(a:string, regexp) represents the match for a:pat that starts +" as close to a:start as possible, before being preferred to after, and +" ends after a:start . +" Usage: +" let regexp = s:Wholematch(getline("."), 'foo\|bar', col(".")-1) +" let i = match(getline("."), regexp) +" let j = matchend(getline("."), regexp) +" let match = matchstr(getline("."), regexp) +fun! s:Wholematch(string, pat, start) + let group = '\%(' . a:pat . '\)' + let prefix = (a:start ? '\(^.*\%<' . (a:start + 2) . 'c\)\zs' : '^') + let len = strlen(a:string) + let suffix = (a:start+1 < len ? '\(\%>'.(a:start+1).'c.*$\)\@=' : '$') + if a:string !~ prefix . group . suffix + let prefix = '' + endif + return prefix . group . suffix +endfun + +" No extra arguments: s:Ref(string, d) will +" find the d'th occurrence of '\(' and return it, along with everything up +" to and including the matching '\)'. +" One argument: s:Ref(string, d, "start") returns the index of the start +" of the d'th '\(' and any other argument returns the length of the group. +" Two arguments: s:Ref(string, d, "foo", "bar") returns a string to be +" executed, having the effect of +" :let foo = s:Ref(string, d, "start") +" :let bar = s:Ref(string, d, "len") +fun! s:Ref(string, d, ...) + let len = strlen(a:string) + if a:d == 0 + let start = 0 + else + let cnt = a:d + let match = a:string + while cnt + let cnt = cnt - 1 + let index = matchend(match, s:notslash . '\\(') + if index == -1 + return "" + endif + let match = strpart(match, index) + endwhile + let start = len - strlen(match) + if a:0 == 1 && a:1 == "start" + return start - 2 + endif + let cnt = 1 + while cnt + let index = matchend(match, s:notslash . '\\(\|\\)') - 1 + if index == -2 + return "" + endif + " Increment if an open, decrement if a ')': + let cnt = cnt + (match[index]=="(" ? 1 : -1) " ')' + " let cnt = stridx('0(', match[index]) + cnt + let match = strpart(match, index+1) + endwhile + let start = start - 2 + let len = len - start - strlen(match) + endif + if a:0 == 1 + return len + elseif a:0 == 2 + return "let " . a:1 . "=" . start . "| let " . a:2 . "=" . len + else + return strpart(a:string, start, len) + endif +endfun + +" Count the number of disjoint copies of pattern in string. +" If the pattern is a literal string and contains no '0' or '1' characters +" then s:Count(string, pattern, '0', '1') should be faster than +" s:Count(string, pattern). +fun! s:Count(string, pattern, ...) + let pat = escape(a:pattern, '\\') + if a:0 > 1 + let foo = substitute(a:string, '[^'.a:pattern.']', "a:1", "g") + let foo = substitute(a:string, pat, a:2, "g") + let foo = substitute(foo, '[^' . a:2 . ']', "", "g") + return strlen(foo) + endif + let result = 0 + let foo = a:string + let index = matchend(foo, pat) + while index != -1 + let result = result + 1 + let foo = strpart(foo, index) + let index = matchend(foo, pat) + endwhile + return result +endfun + +" s:Resolve('\(a\)\(b\)', '\(c\)\2\1\1\2') should return table.word, where +" word = '\(c\)\(b\)\(a\)\3\2' and table = '-32-------'. That is, the first +" '\1' in target is replaced by '\(a\)' in word, table[1] = 3, and this +" indicates that all other instances of '\1' in target are to be replaced +" by '\3'. The hard part is dealing with nesting... +" Note that ":" is an illegal character for source and target, +" unless it is preceded by "\". +fun! s:Resolve(source, target, output) + let word = a:target + let i = matchend(word, s:notslash . '\\\d') - 1 + let table = "----------" + while i != -2 " There are back references to be replaced. + let d = word[i] + let backref = s:Ref(a:source, d) + " The idea is to replace '\d' with backref. Before we do this, + " replace any \(\) groups in backref with :1, :2, ... if they + " correspond to the first, second, ... group already inserted + " into backref. Later, replace :1 with \1 and so on. The group + " number w+b within backref corresponds to the group number + " s within a:source. + " w = number of '\(' in word before the current one + let w = s:Count( + \ substitute(strpart(word, 0, i-1), '\\\\', '', 'g'), '\(', '1') + let b = 1 " number of the current '\(' in backref + let s = d " number of the current '\(' in a:source + while b <= s:Count(substitute(backref, '\\\\', '', 'g'), '\(', '1') + \ && s < 10 + if table[s] == "-" + if w + b < 10 + " let table[s] = w + b + let table = strpart(table, 0, s) . (w+b) . strpart(table, s+1) + endif + let b = b + 1 + let s = s + 1 + else + execute s:Ref(backref, b, "start", "len") + let ref = strpart(backref, start, len) + let backref = strpart(backref, 0, start) . ":". table[s] + \ . strpart(backref, start+len) + let s = s + s:Count(substitute(ref, '\\\\', '', 'g'), '\(', '1') + endif + endwhile + let word = strpart(word, 0, i-1) . backref . strpart(word, i+1) + let i = matchend(word, s:notslash . '\\\d') - 1 + endwhile + let word = substitute(word, s:notslash . '\zs:', '\\', 'g') + if a:output == "table" + return table + elseif a:output == "word" + return word + else + return table . word + endif +endfun + +" Assume a:comma = ",". Then the format for a:patterns and a:1 is +" a:patterns = ",,..." +" a:1 = ",,..." +" If is the first pattern that matches a:string then return +" if no optional arguments are given; return , if a:1 is given. +fun! s:Choose(patterns, string, comma, branch, prefix, suffix, ...) + let tail = (a:patterns =~ a:comma."$" ? a:patterns : a:patterns . a:comma) + let i = matchend(tail, s:notslash . a:comma) + if a:0 + let alttail = (a:1 =~ a:comma."$" ? a:1 : a:1 . a:comma) + let j = matchend(alttail, s:notslash . a:comma) + endif + let current = strpart(tail, 0, i-1) + if a:branch == "" + let currpat = current + else + let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g') + endif + while a:string !~ a:prefix . currpat . a:suffix + let tail = strpart(tail, i) + let i = matchend(tail, s:notslash . a:comma) + if i == -1 + return -1 + endif + let current = strpart(tail, 0, i-1) + if a:branch == "" + let currpat = current + else + let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g') + endif + if a:0 + let alttail = strpart(alttail, j) + let j = matchend(alttail, s:notslash . a:comma) + endif + endwhile + if a:0 + let current = current . a:comma . strpart(alttail, 0, j-1) + endif + return current +endfun + +" Call this function to turn on debugging information. Every time the main +" script is run, buffer variables will be saved. These can be used directly +" or viewed using the menu items below. +if !exists(":MatchDebug") + command! -nargs=0 MatchDebug call s:Match_debug() +endif + +fun! s:Match_debug() + let b:match_debug = 1 " Save debugging information. + " pat = all of b:match_words with backrefs parsed + amenu &Matchit.&pat :echo b:match_pat + " match = bit of text that is recognized as a match + amenu &Matchit.&match :echo b:match_match + " curcol = cursor column of the start of the matching text + amenu &Matchit.&curcol :echo b:match_col + " wholeBR = matching group, original version + amenu &Matchit.wh&oleBR :echo b:match_wholeBR + " iniBR = 'if' piece, original version + amenu &Matchit.ini&BR :echo b:match_iniBR + " ini = 'if' piece, with all backrefs resolved from match + amenu &Matchit.&ini :echo b:match_ini + " tail = 'else\|endif' piece, with all backrefs resolved from match + amenu &Matchit.&tail :echo b:match_tail + " fin = 'endif' piece, with all backrefs resolved from match + amenu &Matchit.&word :echo b:match_word + " '\'.d in ini refers to the same thing as '\'.table[d] in word. + amenu &Matchit.t&able :echo '0:' . b:match_table . ':9' +endfun + +" Jump to the nearest unmatched "(" or "if" or "" if a:spflag == "bW" +" or the nearest unmatched "" or "endif" or ")" if a:spflag == "W". +" Return a "mark" for the original position, so that +" let m = MultiMatch("bW", "n") ... execute m +" will return to the original position. If there is a problem, do not +" move the cursor and return "", unless a count is given, in which case +" go up or down as many levels as possible and again return "". +" TODO This relies on the same patterns as % matching. It might be a good +" idea to give it its own matching patterns. +fun! s:MultiMatch(spflag, mode) + if !exists("b:match_words") || b:match_words == "" + return "" + end + let restore_options = (&ic ? "" : "no") . "ignorecase" + if exists("b:match_ignorecase") + let &ignorecase = b:match_ignorecase + endif + let startline = line(".") + let startcol = col(".") + + " First step: if not already done, set the script variables + " s:do_BR flag for whether there are backrefs + " s:pat parsed version of b:match_words + " s:all regexp based on s:pat and the default groups + " This part is copied and slightly modified from s:Match_wrapper(). + let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") . + \ '\/\*:\*\/,#if\%(def\)\=:#else\>:#elif\>:#endif\>' + " Allow b:match_words = "GetVimMatchWords()" . + if b:match_words =~ ":" + let match_words = b:match_words + else + execute "let match_words =" b:match_words + endif + if (match_words != s:last_words) || (&mps != s:last_mps) || + \ exists("b:match_debug") + let s:last_words = match_words + let s:last_mps = &mps + if match_words !~ s:notslash . '\\\d' + let s:do_BR = 0 + let s:pat = match_words + else + let s:do_BR = 1 + let s:pat = s:ParseWords(match_words) + endif + let s:all = '\%(' . substitute(s:pat . (strlen(s:pat)?",":"") . default, + \ '[,:]\+','\\|','g') . '\)' + if exists("b:match_debug") + let b:match_pat = s:pat + endif + endif + + " Second step: figure out the patterns for searchpair() + " and save the screen, cursor position, and 'ignorecase'. + " - TODO: A lot of this is copied from s:Match_wrapper(). + " - maybe even more functionality should be split off + " - into separate functions! + let cdefault = (s:pat =~ '[^,]$' ? "," : "") . default + let open = substitute(s:pat . cdefault, + \ s:notslash . '\zs:.\{-}' . s:notslash . ',', '\\),\\(', 'g') + let open = '\(' . substitute(open, s:notslash . '\zs:.*$', '\\)', '') + let close = substitute(s:pat . cdefault, + \ s:notslash . '\zs,.\{-}' . s:notslash . ':', '\\),\\(', 'g') + let close = substitute(close, '^.\{-}' . s:notslash . ':', '\\(', '') . '\)' + if exists("b:match_skip") + let skip = b:match_skip + elseif exists("b:match_comment") " backwards compatibility and testing! + let skip = "r:" . b:match_comment + else + let skip = 's:comment\|string' + endif + let skip = s:ParseSkip(skip) + " let restore_cursor = line(".") . "G" . virtcol(".") . "|" + " normal! H + " let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor + let restore_cursor = virtcol(".") . "|" + normal! g0 + let restore_cursor = line(".") . "G" . virtcol(".") . "|zs" . restore_cursor + normal! H + let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor + execute restore_cursor + + " Third step: call searchpair(). + " Replace '\('--but not '\\('--with '\%(' and ',' with '\|'. + let openpat = substitute(open, '\(\\\@" or ... +" and return "endif" or "endwhile" or "" or ... . +" For now, this uses b:match_words and the same script variables +" as s:Match_wrapper() . Later, it may get its own patterns, +" either from a buffer variable or passed as arguments. +" fun! s:Autocomplete() +" echo "autocomplete not yet implemented :-(" +" if !exists("b:match_words") || b:match_words == "" +" return "" +" end +" let startpos = s:MultiMatch("bW") +" +" if startpos == "" +" return "" +" endif +" " - TODO: figure out whether 'if' or '' matched, and construct +" " - the appropriate closing. +" let matchline = getline(".") +" let curcol = col(".") - 1 +" " - TODO: Change the s:all argument if there is a new set of match pats. +" let regexp = s:Wholematch(matchline, s:all, curcol) +" let suf = strlen(matchline) - matchend(matchline, regexp) +" let prefix = (curcol ? '^.\{' . curcol . '}\%(' : '^\%(') +" let suffix = (suf ? '\).\{' . suf . '}$' : '\)$') +" " Reconstruct the version with unresolved backrefs. +" let patBR = substitute(b:match_words.',', '[,:]*,[,:]*', ',', 'g') +" let patBR = substitute(patBR, ':\{2,}', ':', "g") +" " Now, set group and groupBR to the matching group: 'if:endif' or +" " 'while:endwhile' or whatever. +" let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, patBR) +" let i = matchend(group, s:notslash . ",") +" let groupBR = strpart(group, i) +" let group = strpart(group, 0, i-1) +" " Now, matchline =~ prefix . substitute(group,':','\|','g') . suffix +" if s:do_BR +" let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline) +" endif +" " let g:group = group +" +" " - TODO: Construct the closing from group. +" let fake = "end" . expand("") +" execute startpos +" return fake +" endfun + +" Close all open structures. "Get the heck out of here!" +" fun! s:Gthhoh() +" let close = s:Autocomplete() +" while strlen(close) +" put=close +" let close = s:Autocomplete() +" endwhile +" endfun + +" Parse special strings as typical skip arguments for searchpair(): +" s:foo becomes (current syntax item) =~ foo +" S:foo becomes (current syntax item) !~ foo +" r:foo becomes (line before cursor) =~ foo +" R:foo becomes (line before cursor) !~ foo +fun! s:ParseSkip(str) + let skip = a:str + if skip[1] == ":" + if skip[0] == "s" + let skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '" . + \ strpart(skip,2) . "'" + elseif skip[0] == "S" + let skip = "synIDattr(synID(line('.'),col('.'),1),'name') !~? '" . + \ strpart(skip,2) . "'" + elseif skip[0] == "r" + let skip = "strpart(getline('.'),0,col('.'))=~'" . strpart(skip,2). "'" + elseif skip[0] == "R" + let skip = "strpart(getline('.'),0,col('.'))!~'" . strpart(skip,2). "'" + endif + endif + return skip +endfun + +let &cpo = s:save_cpo + +" vim:sts=2:sw=2: diff --git a/vim/vim/bundle/nerdcommenter b/vim/vim/bundle/nerdcommenter new file mode 160000 index 0000000..1f4bfd5 --- /dev/null +++ b/vim/vim/bundle/nerdcommenter @@ -0,0 +1 @@ +Subproject commit 1f4bfd59920c101a30a74a07b824608a6e65f3fe diff --git a/vim/vim/bundle/repeat b/vim/vim/bundle/repeat new file mode 160000 index 0000000..7a6675f --- /dev/null +++ b/vim/vim/bundle/repeat @@ -0,0 +1 @@ +Subproject commit 7a6675f092842c8f81e71d5345bd7cdbf3759415 diff --git a/vim/vim/bundle/surround b/vim/vim/bundle/surround new file mode 160000 index 0000000..2d05440 --- /dev/null +++ b/vim/vim/bundle/surround @@ -0,0 +1 @@ +Subproject commit 2d05440ad23f97a7874ebd9b5de3a0e65d25d85c diff --git a/vim/vim/bundle/xptemplate b/vim/vim/bundle/xptemplate new file mode 160000 index 0000000..beb1725 --- /dev/null +++ b/vim/vim/bundle/xptemplate @@ -0,0 +1 @@ +Subproject commit beb1725e57376caeb890df24c259a2e341ec69bd diff --git a/vim/vim/colors/simon.vim b/vim/vim/colors/simon.vim new file mode 100644 index 0000000..870c43b --- /dev/null +++ b/vim/vim/colors/simon.vim @@ -0,0 +1,187 @@ +" Vim color scheme. +" +" Designed for dark and partially transparent terminals with 256 colors. It +" works with GVim - however by default GVim doesn't support transparent +" backgrounds, thus black is used as background color. +" +" Tested with xterm and (u)rxvt (both with -256color) and GVim. +" +" Not all available highlight groups are used at the moment. +" +" Some new highlight groups are defined which can be used in syntax files, see +" "GENERAL ADDITIONS" below. They have to be configured to work. +" +" Maintainer: Simon Ruderich +" Last Change: 2014-10-24 +" License: GPL v3+ + +" Copyright (C) 2011-2014 Simon Ruderich +" +" This file 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 file is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this file. If not, see . + + +" This color scheme only works with 256 colors and in GVim. +if &t_Co != 256 && !has('gui_running') + echoerr 'Colorscheme "simon" needs 256 colors. Aborting.' + finish +endif + + +" This color scheme is (only) designed for a dark background. +set background=dark +highlight clear + +" :highlight clear resets this variable, so put it after it. +let g:colors_name = 'simon' + + +" GENERAL HIGHLIGHT SETTINGS + +" Normal text (very light gray on default terminal background). ctermbg=NONE +" necessary for transparency. GVim doesn't support a transparent background, +" thus use black. +highlight Normal ctermfg=252 ctermbg=NONE guifg=#d0d0d0 guibg=#000000 + +" Comments (violet on default). +highlight Comment ctermfg=135 guifg=#af5fff +" Constants (light dark red on default). +highlight Constant ctermfg=160 guifg=#d70000 + " Strings, e.g. ".." (dark orange on default). + highlight String ctermfg=208 guifg=#ff8700 + " Characters, e.g. '.' in C (lighter dark orange on default). + highlight Character ctermfg=215 guifg=#ffaf5f + " Numbers (light magenta on default). + highlight Number ctermfg=207 guifg=#ff5fff + " Booleans (light dark red on default). + highlight Boolean ctermfg=160 guifg=#d70000 + highlight Float ctermfg=207 guifg=#ff5fff +" Identifier (cyan on default). cterm=NONE to prevent bold. +highlight Identifier ctermfg=51 cterm=NONE guifg=#00ffff gui=NONE + " Function names, often used for predefined functions (cyan on default). + highlight Function ctermfg=51 cterm=NONE guifg=#00ffff gui=NONE +" Statements, e.g. return, continue, etc. (yellow on default). +highlight Statement ctermfg=227 cterm=bold guifg=#ffff5f gui=bold +" Preprocessor commands, e.g. #include in cpp (light blue on default). +highlight PreProc ctermfg=63 cterm=bold guifg=#5f5fff gui=bold +" Types of variables, e.g. int, long, etc. (light green on default). +highlight Type ctermfg=83 cterm=bold guifg=#5fff5f gui=bold + " static, volatile, etc. (lighter green on default). + highlight StorageClass ctermfg=120 cterm=bold guifg=#87ff87 gui=bold +" Special characters (red on default). +highlight Special ctermfg=160 guifg=#d70000 + " Special characters in a string, e.g. '\n' (red on default). + highlight SpecialChar ctermfg=160 guifg=#d70000 + " Delimiter characters, e.g. braces around function arguments in some + " languages (dark red on default). + highlight Delimiter ctermfg=52 guifg=#5f0000 + " Special items inside a comment (light violent on darker violet). + highlight SpecialComment ctermfg=135 ctermbg=93 guifg=#af5fff guibg=#8700ff +" (Syntax) Errors (white on red). +highlight Error ctermfg=231 ctermbg=196 guifg=#ffffff guibg=#ff0000 +" Todo items and other important stuff (e.g. TODO, XXX, etc.) (black on +" yellow). +highlight Todo ctermfg=16 ctermbg=226 guifg=#000000 guibg=#ffff00 + + +" Additional highlights used by the "GUI", not directly by syntax +" highlighting. + +" Columns set with 'colorcolumn' (default on bright violet). +highlight ColorColumn ctermbg=57 guibg=#5f00ff +" Cursor color (black on light yellow). +highlight Cursor ctermfg=16 ctermbg=227 guifg=#000000 guibg=#ffff5f +" Cursor color when IME or XIM is on, :h CursorIM (not used, keep in sync with +" Cursor). +highlight CursorIM ctermfg=16 ctermbg=227 guifg=#000000 guibg=#ffff5f +" Current cursor column/line (current color on dark gray). cterm=NONE to +" prevent underlining. +highlight CursorColumn ctermbg=234 cterm=NONE guibg=#1c1c1c gui=NONE +highlight CursorLine ctermbg=234 cterm=NONE guibg=#1c1c1c gui=NONE +" Directories in file listings (blue on default). +highlight Directory ctermfg=27 cterm=bold guifg=#005fff gui=bold +" Error messages (white on red). +highlight ErrorMsg ctermfg=231 ctermbg=196 guifg=#ffffff guibg=#ff0000 +" Fold column, left of number column (lighter yellow on default), ctermbg=NONE +" necessary for transparency. +highlight FoldColumn ctermfg=228 ctermbg=NONE guifg=#ffff87 guibg=NONE +" Current search match during incremental search (black on orange). +highlight IncSearch ctermfg=16 ctermbg=214 guifg=#000000 guibg=#ffaf00 +" Line number in line number column (light yellow on default). +highlight LineNr ctermfg=227 guifg=#ffff5f +" Matching brace/bracket when the cursor is currently on the other one +" (default on light green). +highlight MatchParen ctermbg=40 guibg=#00d700 +" 'showmode' message, e.g. "-- INSERT --" (light gray on default). +highlight ModeMsg ctermfg=247 guifg=#9e9e9e +" More prompt (:h more-prompt) (light green on default). +highlight MoreMsg ctermfg=119 guifg=#87ff5f +" Characters which do not really exist in the text (:h NonText) (gray-like +" blue on default). +highlight NonText ctermfg=105 guifg=#8787ff +" Last search pattern for 'hlsearch' (keep in sync with IncSearch). +highlight Search ctermfg=16 ctermbg=214 guifg=#000000 guibg=#ffaf00 +" Special characters, e.g. tabs, control characters (e.g. ^K), etc. (light +" blue on default). +highlight SpecialKey ctermfg=69 guifg=#5f87ff +" Spelling mistake (default on light violet). +highlight SpellBad ctermbg=127 guibg=#af00af +" Wrong capitalization (default on light blue). +highlight SpellCap ctermbg=27 guibg=#005fff +" Status line of the currently active window (bold and reverse). +highlight StatusLine cterm=reverse,bold gui=reverse,bold +" Status line of inactive windows (reverse). +highlight StatusLineNC cterm=reverse gui=reverse +" Tab pages line, parts with no labels on the right (default, cterm=NONE to +" disable reverse). +highlight TabLineFill cterm=NONE gui=NONE +" Titles in output from :set all, :autocmd, etc. (light blue on default). Also +" used by AsciiDoc. +highlight Title ctermfg=63 cterm=bold guifg=#5f5fff gui=bold +" Vertical split column (black on default), black to try to hide it +" (ctermfg=NONE doesn't work), cterm=NONE is necessary to remove reverse. Also +" see my vimrc for a way to hide it completely (the column is still there, but +" empty). +highlight VertSplit ctermfg=16 cterm=NONE guifg=#000000 gui=NONE +" Current visual selection (default on light gray). +highlight Visual ctermbg=246 guibg=#949494 +" Warning messages (white on orange). +highlight WarningMsg ctermfg=231 ctermbg=166 guifg=#ffffff guibg=#d75f00 + +" Cursor color when language mappings are used, :h lCursor (not used, keep in +" sync with Cursor). +highlight lCursor ctermfg=16 ctermbg=227 guifg=#000000 guibg=#ffff5f + + +" GENERAL ADDITIONS + +" Tab characters (if 'list' is enabled) to reduce their visibility in +" comparison with SpecialKey (darker gray on default). +" +" Needs matchadd('specialKeyTab', '\t') in vimrc. +highlight specialKeyTab ctermfg=239 guifg=#4e4e4e + +" Statement control keywords (e.g. continue, break, return, goto, etc.), extra +" syntax item to make them extra visible (keep in sync with Statement, except +" underline). +" +" Needs a modified syntax file or additional rules in after/syntax/. +" +" For example for C: +" +" syntax keyword statementControl continue break return goto +" +" Or for Perl: +" +" highlight link perlStatementControl statementControl +highlight statementControl ctermfg=227 cterm=bold,underline guifg=#ffff5f gui=bold,underline diff --git a/vim/vim/ftdetect/asciidoc_filetype.vim b/vim/vim/ftdetect/asciidoc_filetype.vim new file mode 100644 index 0000000..9a936e0 --- /dev/null +++ b/vim/vim/ftdetect/asciidoc_filetype.vim @@ -0,0 +1,53 @@ +" Vim filetype detection file +" Language: AsciiDoc +" Author: Stuart Rackham +" Last Change: AsciiDoc 8.2.0 +" URL: http://www.methods.co.nz/asciidoc/ +" Licence: GPL (http://www.gnu.org) +" Remarks: Vim 6 or greater + +" COMMENT OUT ONE OF THE TWO FOLLOWING COMMANDS +" The first sets asciidoc syntax highlighting on all .txt files, the second +" only existing files *.txt that appear to be AsciiDoc files. + +"au BufNewFile,BufRead *.txt,README,TODO,CHANGELOG,NOTES setfiletype asciidoc +au BufRead *.txt,README,TODO,CHANGELOG,NOTES call s:FTasciidoc() + +" This function checks for a valid AsciiDoc document title after first +" skipping any leading comments. +function! s:FTasciidoc() + let in_comment_block = 0 + let n = 1 + while n < 50 + let line = getline(n) + let n = n + 1 + if line =~ '^/\{4,}$' + if ! in_comment_block + let in_comment_block = 1 + else + let in_comment_block = 0 + endif + continue + endif + if in_comment_block + continue + endif + if line !~ '\(^//\)\|\(^\s*$\)' + break + endif + endwhile + if line !~ '.\{3,}' + return + endif + let len = len(line) + let line = getline(n) + if line !~ '[-=]\{3,}' + return + endif + if len < len(line) - 3 || len > len(line) + 3 + return + endif + setfiletype asciidoc +endfunction + +" vim: et sw=2 ts=2 sts=2: diff --git a/vim/vim/ftdetect/vimperator.vim b/vim/vim/ftdetect/vimperator.vim new file mode 100644 index 0000000..b7ee1a4 --- /dev/null +++ b/vim/vim/ftdetect/vimperator.vim @@ -0,0 +1,2 @@ +" Vimperator +au BufNewFile,BufRead *vimperatorrc*,*.vimp set filetype=vimperator diff --git a/vim/vim/ftplugin/_common/personal.xpt.vim b/vim/vim/ftplugin/_common/personal.xpt.vim new file mode 100644 index 0000000..9bcfb39 --- /dev/null +++ b/vim/vim/ftplugin/_common/personal.xpt.vim @@ -0,0 +1,47 @@ +" Custom settings for XPTemplate. +XPTemplate priority=personal + +XPTvar $author Simon Ruderich +XPTvar $email simon@ruderich.org + + +" Space settings related to brackets. + +" if () ** { +" else ** { +XPTvar $BRif ' ' +" } ** else { +XPTvar $BRel ' ' +" for () ** { +" while () ** { +" do ** { +XPTvar $BRloop ' ' +" struct name ** { +XPTvar $BRstc ' ' +" int fun() ** { +" class name ** { +XPTvar $BRfun ' ' + + +" General space settings. + +" int fun ** ( +" class name ** ( +XPTvar $SPfun '' + +" int fun( ** arg ** ) +" if ( ** condition ** ) +" for ( ** statement ** ) +" [ ** a, b ** ] +" { ** 'k' : 'v' ** } +XPTvar $SParg '' + +" if ** ( +" while ** ( +" for ** ( +XPTvar $SPcmd ' ' + +" a ** = ** b +" a = a ** + ** 1 +" (a, ** b, ** ) +XPTvar $SPop ' ' diff --git a/vim/vim/ftplugin/c/c.xpt.vim b/vim/vim/ftplugin/c/c.xpt.vim new file mode 100644 index 0000000..aaeb7db --- /dev/null +++ b/vim/vim/ftplugin/c/c.xpt.vim @@ -0,0 +1,69 @@ +" vim: ft=xpt + +" XPTemplate template file. +" +" Language: C +" Maintainer: Simon Ruderich +" License: GPL v3+ + +" Copyright (C) 2012-2014 Simon Ruderich +" +" This file 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 file is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this file. If not, see . + + +" Prevent errors if XPTemplate is not installed. +if !exists('g:XPT#ver') + finish +endif + +XPTemplate priority=personal + + +XPT f +XSET description|post=S(V(), '^description$', 'XXX') +/* + * `description^ + * + * Copyright (C) `strftime("%Y")^ Simon Ruderich + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include + + +int main(int argc, char **argv) { + `cursor^ + + return EXIT_SUCCESS; +} + + +XPT p +printf("`format^"`cursor^); + +XPT pe +fprintf(stderr, "`format^"`cursor^); diff --git a/vim/vim/ftplugin/java/java.xpt.vim b/vim/vim/ftplugin/java/java.xpt.vim new file mode 100644 index 0000000..c6749c8 --- /dev/null +++ b/vim/vim/ftplugin/java/java.xpt.vim @@ -0,0 +1,64 @@ +" vim: ft=xpt + +" XPTemplate template file. +" +" Language: Java +" Maintainer: Simon Ruderich +" License: GPL v3+ + +" Copyright (C) 2012-2014 Simon Ruderich +" +" This file 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 file is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this file. If not, see . + + +" Prevent errors if XPTemplate is not installed. +if !exists('g:XPT#ver') + finish +endif + +XPTemplate priority=personal + + +XPT f +XSET description|post=S(V(), '^description$', 'XXX') +/* + * `description^ + * + * Copyright (C) `strftime("%Y")^ Simon Ruderich + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +public class `E('%:t:r')^ { + `cursor^ +} + + +XPT p +System.out.println(`value^); + +XPT pe +System.err.println(`value^); diff --git a/vim/vim/ftplugin/perl/perl.xpt.vim b/vim/vim/ftplugin/perl/perl.xpt.vim new file mode 100644 index 0000000..c2b4314 --- /dev/null +++ b/vim/vim/ftplugin/perl/perl.xpt.vim @@ -0,0 +1,78 @@ +" vim: ft=xpt + +" XPTemplate template file. +" +" Language: Perl +" Maintainer: Simon Ruderich +" License: GPL v3+ + +" Copyright (C) 2012-2014 Simon Ruderich +" +" This file 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 file is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this file. If not, see . + + +" Prevent errors if XPTemplate is not installed. +if !exists('g:XPT#ver') + finish +endif + +XPTemplate priority=personal + + +XPT f +XSET description|post=S(V(), '^description$', 'XXX') +#!/usr/bin/perl + +# `description^ + +# Copyright (C) `strftime("%Y")^ Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +use strict; +use warnings; + + +`cursor^ + + +XPT p +print `value^; + +XPT pe +print STDERR `value^; + +XPT pd +print Dumper(`value^); + + +XPT u +use `package^; +`cursor^ + +XPT udd +use Data::Dumper; +`cursor^ diff --git a/vim/vim/ftplugin/tex/tex.xpt.vim b/vim/vim/ftplugin/tex/tex.xpt.vim new file mode 100644 index 0000000..a7173c1 --- /dev/null +++ b/vim/vim/ftplugin/tex/tex.xpt.vim @@ -0,0 +1,97 @@ +" vim: ft=xpt + +" XPTemplate template file. +" +" Language: LaTeX +" Maintainer: Simon Ruderich +" License: GPL v3+ + +" Copyright (C) 2012 Simon Ruderich +" +" This file 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 file is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this file. If not, see . + + +" Prevent errors if XPTemplate is not installed. +if !exists('g:XPT#ver') + finish +endif + +XPTemplate priority=personal + + +" PACKAGES + +XPT usepackage " \usepackage{..} +\usepackage{`package^} + + +" SECTIONS + +XPT s synonym=section " \section{..} +\section`*^{`title^} + +XPT ss " \subsection{..} +\subsection`*^{`title^} + +XPT sss " \subsubsection{..} +\subsubsection`*^{`title^} + + +" ENVIRONMENTS + +XPT itemize " \begin{itemize} .. \end{itemize} +\begin{itemize} +\item `cursor^ +\end{itemize} + +XPT enumerate " \begin{enumerate} .. \end{enumerate} +\begin{enumerate} +\item `cursor^ +\end{enumerate} + +XPT description " \begin{description} .. \end{description} +\begin{description} +\item`[`text?`]^ `cursor^ +\end{description} + +XPT i "\item .. +\item`[`text?`]^ `cursor^ + +XPT align " \begin{align} .. \end{align} +\begin{align`*^} +`cursor^ +\end{align`*^} + +XPT listing " \begin{lstlisting} .. \end{lstlisting} +\begin{lstlisting}`[`attributes?`]^ +`cursor^ +\end{lstlisting} + + +" BEAMER + +XPT frame " \begin{frame} .. \end{frame} +\begin{frame}{`title^} +`cursor^ +\end{frame} + +XPT block " \begin{block} .. \end{block} +\begin{block}{`title^} +`cursor^ +\end{block} + +XPT exampleblock " \begin{exampleblock} .. \end{exampleblock} +\begin{exampleblock}{`title^} +`cursor^ +\end{exampleblock} diff --git a/vim/vim/ftplugin/vhdl/vhdl.xpt.vim b/vim/vim/ftplugin/vhdl/vhdl.xpt.vim new file mode 100644 index 0000000..6707b9c --- /dev/null +++ b/vim/vim/ftplugin/vhdl/vhdl.xpt.vim @@ -0,0 +1,67 @@ +" vim: ft=xpt + +" XPTemplate template file. +" +" Language: VHDL +" Maintainer: Simon Ruderich +" License: GPL v3+ + +" Copyright (C) 2014 Simon Ruderich +" +" This file 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 file is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this file. If not, see . + + +XPTemplate priority=lang + +let s:f = g:XPTfuncs() + +XPTinclude + \ _common/common + + +XPT f +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +`cursor^ + + +XPT slv +std_logic_vector(`from^ downto `to^) + + +XPT entity +entity `name^ is + port( + `cursor^ + ); +end entity; + +XPT architecture +architecture `behavioral^ of `entity^ is +begin + `cursor^ +end architecture; + +XPT process +process`list^ +begin + `cursor^ +end process; + +XPT if +if `condition^ then + `cursor^ +end if; diff --git a/vim/vim/plugin/gnupg.vim b/vim/vim/plugin/gnupg.vim new file mode 100644 index 0000000..3b00366 --- /dev/null +++ b/vim/vim/plugin/gnupg.vim @@ -0,0 +1,1464 @@ +" Name: gnupg.vim +" Last Change: 2015 Dec 17 +" Maintainer: James McCoy +" Original Author: Markus Braun +" Summary: Vim plugin for transparent editing of gpg encrypted files. +" License: This program is free software; you can redistribute it and/or +" modify it under the terms of the GNU General Public License +" as published by the Free Software Foundation; either version +" 2 of the License, or (at your option) any later version. +" See http://www.gnu.org/copyleft/gpl-2.0.txt +" +" Section: Documentation {{{1 +" +" Description: {{{2 +" +" This script implements transparent editing of gpg encrypted files. The +" filename must have a ".gpg", ".pgp" or ".asc" suffix. When opening such +" a file the content is decrypted, when opening a new file the script will +" ask for the recipients of the encrypted file. The file content will be +" encrypted to all recipients before it is written. The script turns off +" viminfo, swapfile, and undofile to increase security. +" +" Installation: {{{2 +" +" Copy the gnupg.vim file to the $HOME/.vim/plugin directory. +" Refer to ':help add-plugin', ':help add-global-plugin' and ':help +" runtimepath' for more details about Vim plugins. +" +" From "man 1 gpg-agent": +" +" ... +" You should always add the following lines to your .bashrc or whatever +" initialization file is used for all shell invocations: +" +" GPG_TTY=`tty` +" export GPG_TTY +" +" It is important that this environment variable always reflects the out‐ +" put of the tty command. For W32 systems this option is not required. +" ... +" +" Most distributions provide software to ease handling of gpg and gpg-agent. +" Examples are keychain or seahorse. +" +" If there are specific actions that should take place when editing a +" GnuPG-managed buffer, an autocmd for the User event and GnuPG pattern can +" be defined. For example, the following will set 'textwidth' to 72 for all +" GnuPG-encrypted buffers: +" +" autocmd User GnuPG setl textwidth=72 +" +" This will be triggered before any BufRead or BufNewFile autocmds, and +" therefore will not take precedence over settings specific to any filetype +" that may get set. +" +" Commands: {{{2 +" +" :GPGEditRecipients +" Opens a scratch buffer to change the list of recipients. Recipients that +" are unknown (not in your public key) are highlighted and have +" a prepended "!". Closing the buffer makes the changes permanent. +" +" :GPGViewRecipients +" Prints the list of recipients. +" +" :GPGEditOptions +" Opens a scratch buffer to change the options for encryption (symmetric, +" asymmetric, signing). Closing the buffer makes the changes permanent. +" WARNING: There is no check of the entered options, so you need to know +" what you are doing. +" +" :GPGViewOptions +" Prints the list of options. +" +" Variables: {{{2 +" +" g:GPGExecutable +" If set used as gpg executable. If unset, defaults to +" "gpg --trust-model always" if "gpg" is available, falling back to +" "gpg2 --trust-model always" if not. +" +" g:GPGUseAgent +" If set to 0 a possible available gpg-agent won't be used. Defaults to 1. +" +" g:GPGPreferSymmetric +" If set to 1 symmetric encryption is preferred for new files. Defaults to 0. +" +" g:GPGPreferArmor +" If set to 1 armored data is preferred for new files. Defaults to 0 +" unless a "*.asc" file is being edited. +" +" g:GPGPreferSign +" If set to 1 signed data is preferred for new files. Defaults to 0. +" +" g:GPGDefaultRecipients +" If set, these recipients are used as defaults when no other recipient is +" defined. This variable is a Vim list. Default is unset. +" +" g:GPGPossibleRecipients +" If set, these contents are loaded into the recipients dialog. This +" allows to add commented lines with possible recipients to the list, +" which can be uncommented to select the actual recipients. Default is +" unset. Example: +" +" let g:GPGPossibleRecipients=[ +" \"Example User ", +" \"Other User " +" \] +" +" +" g:GPGUsePipes +" If set to 1, use pipes instead of temporary files when interacting with +" gnupg. When set to 1, this can cause terminal-based gpg agents to not +" display correctly when prompting for passwords. Defaults to 0. +" +" g:GPGHomedir +" If set, specifies the directory that will be used for GPG's homedir. +" This corresponds to gpg's --homedir option. This variable is a Vim +" string. Default is unset. +" +" g:GPGFilePattern +" If set, overrides the default set of file patterns that determine +" whether this plugin will be activated. Defaults to +" '*.\(gpg\|asc\|pgp\)'. +" +" Known Issues: {{{2 +" +" In some cases gvim can't decrypt files + +" This is caused by the fact that a running gvim has no TTY and thus gpg is +" not able to ask for the passphrase by itself. This is a problem for Windows +" and Linux versions of gvim and could not be solved unless a "terminal +" emulation" is implemented for gvim. To circumvent this you have to use any +" combination of gpg-agent and a graphical pinentry program: +" +" - gpg-agent only: +" you need to provide the passphrase for the needed key to gpg-agent +" in a terminal before you open files with gvim which require this key. +" +" - pinentry only: +" you will get a popup window every time you open a file that needs to +" be decrypted. +" +" - gpgagent and pinentry: +" you will get a popup window the first time you open a file that +" needs to be decrypted. +" +" If you're using Vim <7.4.959, after the plugin runs any external command, +" Vim will no longer be able to yank to/paste from the X clipboard or +" primary selections. This is caused by a workaround for a different bug +" where Vim no longer recognizes the key codes for keys such as the arrow +" keys after running GnuPG. See the discussion at +" https://github.com/jamessan/vim-gnupg/issues/36 for more details. +" +" Credits: {{{2 +" +" - Mathieu Clabaut for inspirations through his vimspell.vim script. +" - Richard Bronosky for patch to enable ".pgp" suffix. +" - Erik Remmelzwaal for patch to enable windows support and patient beta +" testing. +" - Lars Becker for patch to make gpg2 working. +" - Thomas Arendsen Hein for patch to convert encoding of gpg output. +" - Karl-Heinz Ruskowski for patch to fix unknown recipients and trust model +" and patient beta testing. +" - Giel van Schijndel for patch to get GPG_TTY dynamically. +" - Sebastian Luettich for patch to fix issue with symmetric encryption an set +" recipients. +" - Tim Swast for patch to generate signed files. +" - James Vega for patches for better '*.asc' handling, better filename +" escaping and better handling of multiple keyrings. +" +" Section: Plugin header {{{1 + +" guard against multiple loads {{{2 +if (exists("g:loaded_gnupg") || &cp || exists("#GnuPG")) + finish +endif +let g:loaded_gnupg = '2.5' +let s:GPGInitRun = 0 + +" check for correct vim version {{{2 +if (v:version < 702) + echohl ErrorMsg | echo 'plugin gnupg.vim requires Vim version >= 7.2' | echohl None + finish +endif + +" Section: Autocmd setup {{{1 + +if (!exists("g:GPGFilePattern")) + let g:GPGFilePattern = '*.\(gpg\|asc\|pgp\)' +endif + +augroup GnuPG + autocmd! + + " do the decryption + exe "autocmd BufReadCmd " . g:GPGFilePattern . " call s:GPGInit(1) |" . + \ " call s:GPGDecrypt(1)" + exe "autocmd FileReadCmd " . g:GPGFilePattern . " call s:GPGInit(0) |" . + \ " call s:GPGDecrypt(0)" + + " convert all text to encrypted text before writing + " We check for GPGCorrespondingTo to avoid triggering on writes in GPG Options/Recipient windows + exe "autocmd BufWriteCmd,FileWriteCmd " . g:GPGFilePattern . " if !exists('b:GPGCorrespondingTo') |" . + \ " call s:GPGInit(0) |" . + \ " call s:GPGEncrypt() |" . + \ " endif" + + " cleanup on leaving vim + exe "autocmd VimLeave " . g:GPGFilePattern . " call s:GPGCleanup()" +augroup END + +" Section: Constants {{{1 + +let s:GPGMagicString = "\t \t" +let s:keyPattern = '\%(0x\)\=[[:xdigit:]]\{8,16}' + +" Section: Highlight setup {{{1 + +highlight default link GPGWarning WarningMsg +highlight default link GPGError ErrorMsg +highlight default link GPGHighlightUnknownRecipient ErrorMsg + +" Section: Functions {{{1 + +" Function: s:shellescape(s[, special]) {{{2 +" +" Calls shellescape(), also taking into account 'shellslash' +" when on Windows and using $COMSPEC as the shell. +" +" Returns: shellescaped string +" +function s:shellescape(s, ...) + let special = a:0 ? a:1 : 0 + if exists('+shellslash') && &shell == $COMSPEC + let ssl = &shellslash + set noshellslash + + let escaped = shellescape(a:s, special) + + let &shellslash = ssl + else + let escaped = shellescape(a:s, special) + endif + + return escaped +endfunction + +" Function: s:GPGInit(bufread) {{{2 +" +" initialize the plugin +" The bufread argument specifies whether this was called due to BufReadCmd +" +function s:GPGInit(bufread) + call s:GPGDebug(3, printf(">>>>>>>> Entering s:GPGInit(%d)", a:bufread)) + + " For FileReadCmd, we're reading the contents into another buffer. If that + " buffer is also destined to be encrypted, then these settings will have + " already been set, otherwise don't set them since it limits the + " functionality of the cleartext buffer. + if a:bufread + " we don't want a swap file, as it writes unencrypted data to disk + setl noswapfile + + " if persistent undo is present, disable it for this buffer + if exists('+undofile') + setl noundofile + endif + + " first make sure nothing is written to ~/.viminfo while editing + " an encrypted file. + set viminfo= + endif + + " the rest only has to be run once + if s:GPGInitRun + return + endif + + " check what gpg command to use + if (!exists("g:GPGExecutable")) + if executable("gpg") + let g:GPGExecutable = "gpg --trust-model always" + else + let g:GPGExecutable = "gpg2 --trust-model always" + endif + endif + + " check if gpg-agent is allowed + if (!exists("g:GPGUseAgent")) + let g:GPGUseAgent = 1 + endif + + " check if symmetric encryption is preferred + if (!exists("g:GPGPreferSymmetric")) + let g:GPGPreferSymmetric = 0 + endif + + " check if armored files are preferred + if (!exists("g:GPGPreferArmor")) + " .asc files should be armored as that's what the extension is used for + if expand('') =~ '\.asc$' + let g:GPGPreferArmor = 1 + else + let g:GPGPreferArmor = 0 + endif + endif + + " check if signed files are preferred + if (!exists("g:GPGPreferSign")) + let g:GPGPreferSign = 0 + endif + + " start with empty default recipients if none is defined so far + if (!exists("g:GPGDefaultRecipients")) + let g:GPGDefaultRecipients = [] + endif + + if (!exists("g:GPGPossibleRecipients")) + let g:GPGPossibleRecipients = [] + endif + + + " prefer not to use pipes since it can garble gpg agent display + if (!exists("g:GPGUsePipes")) + let g:GPGUsePipes = 0 + endif + + " allow alternate gnupg homedir + if (!exists('g:GPGHomedir')) + let g:GPGHomedir = '' + endif + + " print version + call s:GPGDebug(1, "gnupg.vim ". g:loaded_gnupg) + + let s:GPGCommand = g:GPGExecutable + + " don't use tty in gvim except for windows: we get their a tty for free. + " FIXME find a better way to avoid an error. + " with this solution only --use-agent will work + if (has("gui_running") && !has("gui_win32")) + let s:GPGCommand .= " --no-tty" + endif + + " setup shell environment for unix and windows + let s:shellredirsave = &shellredir + let s:shellsave = &shell + let s:shelltempsave = &shelltemp + " noshelltemp isn't currently supported on Windows, but it doesn't cause any + " errors and this future proofs us against requiring changes if Windows + " gains noshelltemp functionality + let s:shelltemp = !g:GPGUsePipes + if (has("unix")) + " unix specific settings + let s:shellredir = ">%s 2>&1" + let s:shell = '/bin/sh' + let s:stderrredirnull = '2>/dev/null' + else + " windows specific settings + let s:shellredir = '>%s' + let s:shell = &shell + let s:stderrredirnull = '2>nul' + endif + + call s:GPGDebug(3, "shellredirsave: " . s:shellredirsave) + call s:GPGDebug(3, "shellsave: " . s:shellsave) + call s:GPGDebug(3, "shelltempsave: " . s:shelltempsave) + + call s:GPGDebug(3, "shell: " . s:shell) + call s:GPGDebug(3, "shellcmdflag: " . &shellcmdflag) + call s:GPGDebug(3, "shellxquote: " . &shellxquote) + call s:GPGDebug(3, "shellredir: " . s:shellredir) + call s:GPGDebug(3, "stderrredirnull: " . s:stderrredirnull) + + call s:GPGDebug(3, "shell implementation: " . resolve(s:shell)) + + " find the supported algorithms + let output = s:GPGSystem({ 'level': 2, 'args': '--version' }) + + let gpgversion = substitute(output, '^gpg (GnuPG) \([0-9]\+\.\d\+\).*', '\1', '') + let s:GPGPubkey = substitute(output, ".*Pubkey: \\(.\\{-}\\)\n.*", "\\1", "") + let s:GPGCipher = substitute(output, ".*Cipher: \\(.\\{-}\\)\n.*", "\\1", "") + let s:GPGHash = substitute(output, ".*Hash: \\(.\\{-}\\)\n.*", "\\1", "") + let s:GPGCompress = substitute(output, ".*Compress.\\{-}: \\(.\\{-}\\)\n.*", "\\1", "") + + " determine if gnupg can use the gpg-agent + if (str2float(gpgversion) >= 2.1 || (exists("$GPG_AGENT_INFO") && g:GPGUseAgent == 1)) + if (!exists("$GPG_TTY") && !has("gui_running")) + " Need to determine the associated tty by running a command in the + " shell. We can't use system() here because that doesn't run in a shell + " connected to a tty, so it's rather useless. + " + " Save/restore &modified so the buffer isn't incorrectly marked as + " modified just by detecting the correct tty value. + " Do the &undolevels dance so the :read and :delete don't get added into + " the undo tree, as the user needn't be aware of these. + let [mod, levels] = [&l:modified, &undolevels] + set undolevels=-1 + silent read !tty + let $GPG_TTY = getline('.') + silent delete + let [&l:modified, &undolevels] = [mod, levels] + " redraw is needed since we're using silent to run !tty, c.f. :help :! + redraw! + if (v:shell_error) + let $GPG_TTY = "" + echohl GPGWarning + echom "$GPG_TTY is not set and the `tty` command failed! gpg-agent might not work." + echohl None + endif + endif + let s:GPGCommand .= " --use-agent" + else + let s:GPGCommand .= " --no-use-agent" + endif + + call s:GPGDebug(2, "public key algorithms: " . s:GPGPubkey) + call s:GPGDebug(2, "cipher algorithms: " . s:GPGCipher) + call s:GPGDebug(2, "hashing algorithms: " . s:GPGHash) + call s:GPGDebug(2, "compression algorithms: " . s:GPGCompress) + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGInit()") + let s:GPGInitRun = 1 +endfunction + +" Function: s:GPGCleanup() {{{2 +" +" cleanup on leaving vim +" +function s:GPGCleanup() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGCleanup()") + + " wipe out screen + new +only + redraw! + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGCleanup()") +endfunction + +" Function: s:GPGDecrypt(bufread) {{{2 +" +" decrypt the buffer and find all recipients of the encrypted file +" The bufread argument specifies whether this was called due to BufReadCmd +" +function s:GPGDecrypt(bufread) + call s:GPGDebug(3, printf(">>>>>>>> Entering s:GPGDecrypt(%d)", a:bufread)) + + " get the filename of the current buffer + let filename = expand(":p") + + " clear GPGRecipients and GPGOptions + if type(g:GPGDefaultRecipients) == type([]) + let b:GPGRecipients = copy(g:GPGDefaultRecipients) + else + let b:GPGRecipients = [] + echohl GPGWarning + echom "g:GPGDefaultRecipients is not a Vim list, please correct this in your vimrc!" + echohl None + endif + let b:GPGOptions = [] + + " file name minus extension + let autocmd_filename = fnameescape(expand(':r')) + + " File doesn't exist yet, so nothing to decrypt + if !filereadable(filename) + " Allow the user to define actions for GnuPG buffers + silent doautocmd User GnuPG + " call the autocommand for the file minus .gpg$ + silent execute ':doautocmd BufNewFile ' . autocmd_filename + call s:GPGDebug(2, 'called BufNewFile autocommand for ' . autocmd_filename) + + " This is a new file, so force the user to edit the recipient list if + " they open a new file and public keys are preferred + if (g:GPGPreferSymmetric == 0) + call s:GPGEditRecipients() + endif + + return + endif + + " Only let this if the file actually exists, otherwise GPG functionality + " will be disabled when editing a buffer that doesn't yet have a backing + " file + let b:GPGEncrypted = 0 + + " find the recipients of the file + let cmd = { 'level': 3 } + let cmd.args = '--verbose --decrypt --list-only --dry-run --no-use-agent --logger-fd 1 ' . s:shellescape(filename) + let output = s:GPGSystem(cmd) + + " Suppress the "N more lines" message when editing a file, not when reading + " the contents of a file into a buffer + let silent = a:bufread ? 'silent ' : '' + + let asymmPattern = 'gpg: public key is ' . s:keyPattern + " check if the file is symmetric/asymmetric encrypted + if (match(output, "gpg: encrypted with [[:digit:]]\\+ passphrase") >= 0) + " file is symmetric encrypted + let b:GPGEncrypted = 1 + call s:GPGDebug(1, "this file is symmetric encrypted") + + let b:GPGOptions += ["symmetric"] + + " find the used cipher algorithm + let cipher = substitute(output, ".*gpg: \\([^ ]\\+\\) encrypted data.*", "\\1", "") + if (match(s:GPGCipher, "\\<" . cipher . "\\>") >= 0) + let b:GPGOptions += ["cipher-algo " . cipher] + call s:GPGDebug(1, "cipher-algo is " . cipher) + else + echohl GPGWarning + echom "The cipher " . cipher . " is not known by the local gpg command. Using default!" + echo + echohl None + endif + elseif (match(output, asymmPattern) >= 0) + " file is asymmetric encrypted + let b:GPGEncrypted = 1 + call s:GPGDebug(1, "this file is asymmetric encrypted") + + let b:GPGOptions += ["encrypt"] + + " find the used public keys + let start = match(output, asymmPattern) + while (start >= 0) + let start = start + strlen("gpg: public key is ") + let recipient = matchstr(output, s:keyPattern, start) + call s:GPGDebug(1, "recipient is " . recipient) + " In order to support anonymous communication, GnuPG allows eliding + " information in the encryption metadata specifying what keys the file + " was encrypted to (c.f., --throw-keyids and --hidden-recipient). In + " that case, the recipient(s) will be listed as having used a key of all + " zeroes. + " Since this will obviously never actually be in a keyring, only try to + " convert to an ID or add to the recipients list if it's not a hidden + " recipient. + if recipient !~? '^0x0\+$' + let name = s:GPGNameToID(recipient) + if !empty(name) + let b:GPGRecipients += [name] + call s:GPGDebug(1, "name of recipient is " . name) + else + let b:GPGRecipients += [recipient] + echohl GPGWarning + echom "The recipient \"" . recipient . "\" is not in your public keyring!" + echohl None + end + end + let start = match(output, asymmPattern, start) + endwhile + else + " file is not encrypted + let b:GPGEncrypted = 0 + call s:GPGDebug(1, "this file is not encrypted") + echohl GPGWarning + echom "File is not encrypted, all GPG functions disabled!" + echohl None + exe printf('%sr %s', silent, fnameescape(filename)) + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()") + return + endif + + if a:bufread + silent execute ':doautocmd BufReadPre ' . autocmd_filename + call s:GPGDebug(2, 'called BufReadPre autocommand for ' . autocmd_filename) + else + silent execute ':doautocmd FileReadPre ' . autocmd_filename + call s:GPGDebug(2, 'called FileReadPre autocommand for ' . autocmd_filename) + endif + + " check if the message is armored + if (match(output, "gpg: armor header") >= 0) + call s:GPGDebug(1, "this file is armored") + let b:GPGOptions += ["armor"] + endif + + " finally decrypt the buffer content + " since even with the --quiet option passphrase typos will be reported, + " we must redirect stderr (using shell temporarily) + call s:GPGDebug(1, "decrypting file") + let cmd = { 'level': 1, 'ex': silent . 'r !' } + let cmd.args = '--quiet --decrypt ' . s:shellescape(filename, 1) + call s:GPGExecute(cmd) + + if (v:shell_error) " message could not be decrypted + echohl GPGError + let blackhole = input("Message could not be decrypted! (Press ENTER)") + echohl None + " Only wipeout the buffer if we were creating one to start with. + " FileReadCmd just reads the content into the existing buffer + if a:bufread + silent bwipeout! + endif + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()") + return + endif + + if a:bufread + " In order to make :undo a no-op immediately after the buffer is read, + " we need to do this dance with 'undolevels'. Actually discarding the undo + " history requires performing a change after setting 'undolevels' to -1 and, + " luckily, we have one we need to do (delete the extra line from the :r + " command) + let levels = &undolevels + set undolevels=-1 + " :lockmarks doesn't actually prevent '[,'] from being overwritten, so we + " need to manually set them ourselves instead + silent 1delete + 1mark [ + $mark ] + let &undolevels = levels + let &readonly = filereadable(filename) && filewritable(filename) == 0 + " call the autocommand for the file minus .gpg$ + silent execute ':doautocmd BufReadPost ' . autocmd_filename + call s:GPGDebug(2, 'called BufReadPost autocommand for ' . autocmd_filename) + else + " call the autocommand for the file minus .gpg$ + silent execute ':doautocmd FileReadPost ' . autocmd_filename + call s:GPGDebug(2, 'called FileReadPost autocommand for ' . autocmd_filename) + endif + + " Allow the user to define actions for GnuPG buffers + silent doautocmd User GnuPG + + " refresh screen + redraw! + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()") +endfunction + +" Function: s:GPGEncrypt() {{{2 +" +" encrypts the buffer to all previous recipients +" +function s:GPGEncrypt() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGEncrypt()") + + " FileWriteCmd is only called when a portion of a buffer is being written to + " disk. Since Vim always sets the '[,'] marks to the part of a buffer that + " is being written, that can be used to determine whether BufWriteCmd or + " FileWriteCmd triggered us. + if [line("'["), line("']")] == [1, line('$')] + let auType = 'BufWrite' + else + let auType = 'FileWrite' + endif + + " file name minus extension + let autocmd_filename = fnameescape(expand(':r')) + + silent exe ':doautocmd '. auType .'Pre '. autocmd_filename + call s:GPGDebug(2, 'called '. auType .'Pre autocommand for ' . autocmd_filename) + + " store encoding and switch to a safe one + if (&fileencoding != &encoding) + let s:GPGEncoding = &encoding + let &encoding = &fileencoding + call s:GPGDebug(2, "encoding was \"" . s:GPGEncoding . "\", switched to \"" . &encoding . "\"") + else + let s:GPGEncoding = "" + call s:GPGDebug(2, "encoding and fileencoding are the same (\"" . &encoding . "\"), not switching") + endif + + " guard for unencrypted files + if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) + echohl GPGError + let blackhole = input("Message could not be encrypted! (Press ENTER)") + echohl None + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncrypt()") + return + endif + + " initialize GPGOptions if not happened before + if (!exists("b:GPGOptions") || empty(b:GPGOptions)) + let b:GPGOptions = [] + if (exists("g:GPGPreferSymmetric") && g:GPGPreferSymmetric == 1) + let b:GPGOptions += ["symmetric"] + let b:GPGRecipients = [] + else + let b:GPGOptions += ["encrypt"] + endif + if (exists("g:GPGPreferArmor") && g:GPGPreferArmor == 1) + let b:GPGOptions += ["armor"] + endif + if (exists("g:GPGPreferSign") && g:GPGPreferSign == 1) + let b:GPGOptions += ["sign"] + endif + call s:GPGDebug(1, "no options set, so using default options: " . string(b:GPGOptions)) + endif + + " built list of options + let options = "" + for option in b:GPGOptions + let options = options . " --" . option . " " + endfor + + if (!exists('b:GPGRecipients')) + let b:GPGRecipients = [] + endif + + " check here again if all recipients are available in the keyring + let recipients = s:GPGCheckRecipients(b:GPGRecipients) + + " check if there are unknown recipients and warn + if !empty(recipients.unknown) + echohl GPGWarning + echom "Please use GPGEditRecipients to correct!!" + echo + echohl None + + " Let user know whats happend and copy known_recipients back to buffer + let dummy = input("Press ENTER to quit") + endif + + " built list of recipients + let options .= ' ' . join(map(recipients.valid, '"-r ".v:val'), ' ') + + " encrypt the buffer + let destfile = tempname() + let cmd = { 'level': 1, 'ex': "'[,']w !" } + let cmd.args = '--quiet --no-encrypt-to ' . options + let cmd.redirect = '>' . s:shellescape(destfile, 1) + silent call s:GPGExecute(cmd) + + " restore encoding + if (s:GPGEncoding != "") + let &encoding = s:GPGEncoding + call s:GPGDebug(2, "restored encoding \"" . &encoding . "\"") + endif + + if (v:shell_error) " message could not be encrypted + " Command failed, so clean up the tempfile + call delete(destfile) + echohl GPGError + let blackhole = input("Message could not be encrypted! (Press ENTER)") + echohl None + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncrypt()") + return + endif + + let filename = resolve(expand('')) + if rename(destfile, filename) + " Rename failed, so clean up the tempfile + call delete(destfile) + echohl GPGError + echom printf("\"%s\" E212: Can't open file for writing", filename) + echohl None + return + endif + + if auType == 'BufWrite' + setl nomodified + let &readonly = filereadable(filename) && filewritable(filename) == 0 + endif + + silent exe ':doautocmd '. auType .'Post '. autocmd_filename + call s:GPGDebug(2, 'called '. auType .'Post autocommand for ' . autocmd_filename) + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncrypt()") +endfunction + +" Function: s:GPGViewRecipients() {{{2 +" +" echo the recipients +" +function s:GPGViewRecipients() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGViewRecipients()") + + " guard for unencrypted files + if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) + echohl GPGWarning + echom "File is not encrypted, all GPG functions disabled!" + echohl None + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGViewRecipients()") + return + endif + + let recipients = s:GPGCheckRecipients(b:GPGRecipients) + + echo 'This file has following recipients (Unknown recipients have a prepended "!"):' + " echo the recipients + for name in recipients.valid + let name = s:GPGIDToName(name) + echo name + endfor + + " echo the unknown recipients + echohl GPGWarning + for name in recipients.unknown + let name = "!" . name + echo name + endfor + echohl None + + " check if there is any known recipient + if empty(recipients.valid) + echohl GPGError + echom 'There are no known recipients!' + echohl None + endif + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGViewRecipients()") +endfunction + +" Function: s:GPGEditRecipients() {{{2 +" +" create a scratch buffer with all recipients to add/remove recipients +" +function s:GPGEditRecipients() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGEditRecipients()") + + " guard for unencrypted files + if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) + echohl GPGWarning + echom "File is not encrypted, all GPG functions disabled!" + echohl None + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEditRecipients()") + return + endif + + " only do this if it isn't already a GPGRecipients_* buffer + if (match(bufname("%"), "^\\(GPGRecipients_\\|GPGOptions_\\)") != 0 && match(bufname("%"), "\.\\(gpg\\|asc\\|pgp\\)$") >= 0) + + " save buffer name + let buffername = bufname("%") + let editbuffername = "GPGRecipients_" . buffername + + " check if this buffer exists + if (!bufexists(editbuffername)) + " create scratch buffer + execute 'silent! split ' . fnameescape(editbuffername) + + " add a autocommand to regenerate the recipients after a write + autocmd BufHidden,BufUnload,BufWriteCmd call s:GPGFinishRecipientsBuffer() + else + if (bufwinnr(editbuffername) >= 0) + " switch to scratch buffer window + execute 'silent! ' . bufwinnr(editbuffername) . "wincmd w" + else + " split scratch buffer window + execute 'silent! sbuffer ' . fnameescape(editbuffername) + + " add a autocommand to regenerate the recipients after a write + autocmd BufHidden,BufUnload,BufWriteCmd call s:GPGFinishRecipientsBuffer() + endif + + " empty the buffer + silent %delete + endif + + " Mark the buffer as a scratch buffer + setlocal buftype=acwrite + setlocal bufhidden=hide + setlocal noswapfile + setlocal nowrap + setlocal nobuflisted + setlocal nonumber + + " so we know for which other buffer this edit buffer is + let b:GPGCorrespondingTo = buffername + + " put some comments to the scratch buffer + silent put ='GPG: ----------------------------------------------------------------------' + silent put ='GPG: Please edit the list of recipients, one recipient per line.' + silent put ='GPG: Unknown recipients have a prepended \"!\".' + silent put ='GPG: Lines beginning with \"GPG:\" are removed automatically.' + silent put ='GPG: Data after recipients between and including \"(\" and \")\" is ignored.' + silent put ='GPG: Closing this buffer commits changes.' + silent put ='GPG: ----------------------------------------------------------------------' + + " get the recipients + let recipients = s:GPGCheckRecipients(getbufvar(b:GPGCorrespondingTo, "GPGRecipients")) + + " if there are no known or unknown recipients, use the default ones + if (empty(recipients.valid) && empty(recipients.unknown)) + if (type(g:GPGDefaultRecipients) == type([])) + let recipients = s:GPGCheckRecipients(g:GPGDefaultRecipients) + else + echohl GPGWarning + echom "g:GPGDefaultRecipients is not a Vim list, please correct this in your vimrc!" + echohl None + endif + endif + + " put the recipients in the scratch buffer + for name in recipients.valid + let name = s:GPGIDToName(name) + silent put =name + endfor + + " put the unknown recipients in the scratch buffer + let syntaxPattern = '' + if !empty(recipients.unknown) + let flaggedNames = map(recipients.unknown, '"!".v:val') + call append('$', flaggedNames) + let syntaxPattern = '\(' . join(flaggedNames, '\|') . '\)' + endif + + for line in g:GPGPossibleRecipients + silent put ='GPG: '.line + endfor + + " define highlight + if (has("syntax") && exists("g:syntax_on")) + highlight clear GPGUnknownRecipient + if !empty(syntaxPattern) + execute 'syntax match GPGUnknownRecipient "' . syntaxPattern . '"' + highlight link GPGUnknownRecipient GPGHighlightUnknownRecipient + endif + + syntax match GPGComment "^GPG:.*$" + execute 'syntax match GPGComment "' . s:GPGMagicString . '.*$"' + highlight clear GPGComment + highlight link GPGComment Comment + endif + + " delete the empty first line + silent 1delete + + " jump to the first recipient + silent $ + + endif + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEditRecipients()") +endfunction + +" Function: s:GPGFinishRecipientsBuffer() {{{2 +" +" create a new recipient list from RecipientsBuffer +" +function s:GPGFinishRecipientsBuffer() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGFinishRecipientsBuffer()") + + " guard for unencrypted files + if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) + echohl GPGWarning + echom "File is not encrypted, all GPG functions disabled!" + echohl None + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGFinishRecipientsBuffer()") + return + endif + + " go to buffer before doing work + if (bufnr("%") != expand("")) + " switch to scratch buffer window + execute 'silent! ' . bufwinnr(expand("")) . "wincmd w" + endif + + " delete the autocommand + autocmd! * + + " get the recipients from the scratch buffer + let recipients = [] + let lines = getline(1,"$") + for recipient in lines + let matches = matchlist(recipient, '^\(.\{-}\)\%(' . s:GPGMagicString . '(ID:\s\+\(' . s:keyPattern . '\)\s\+.*\)\=$') + + let recipient = matches[2] ? matches[2] : matches[1] + + " delete all spaces at beginning and end of the recipient + " also delete a '!' at the beginning of the recipient + let recipient = substitute(recipient, "^[[:space:]!]*\\(.\\{-}\\)[[:space:]]*$", "\\1", "") + + " delete comment lines + let recipient = substitute(recipient, "^GPG:.*$", "", "") + + " only do this if the line is not empty + if !empty(recipient) + let gpgid = s:GPGNameToID(recipient) + if !empty(gpgid) + if (match(recipients, gpgid) < 0) + let recipients += [gpgid] + endif + else + if (match(recipients, recipient) < 0) + let recipients += [recipient] + echohl GPGWarning + echom "The recipient \"" . recipient . "\" is not in your public keyring!" + echohl None + endif + endif + endif + endfor + + " write back the new recipient list to the corresponding buffer and mark it + " as modified. Buffer is now for sure an encrypted buffer. + call setbufvar(b:GPGCorrespondingTo, "GPGRecipients", recipients) + call setbufvar(b:GPGCorrespondingTo, "&mod", 1) + call setbufvar(b:GPGCorrespondingTo, "GPGEncrypted", 1) + + " check if there is any known recipient + if empty(recipients) + echohl GPGError + echom 'There are no known recipients!' + echohl None + endif + + " reset modified flag + setl nomodified + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGFinishRecipientsBuffer()") +endfunction + +" Function: s:GPGViewOptions() {{{2 +" +" echo the recipients +" +function s:GPGViewOptions() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGViewOptions()") + + " guard for unencrypted files + if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) + echohl GPGWarning + echom "File is not encrypted, all GPG functions disabled!" + echohl None + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGViewOptions()") + return + endif + + if (exists("b:GPGOptions")) + echo 'This file has following options:' + " echo the options + for option in b:GPGOptions + echo option + endfor + endif + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGViewOptions()") +endfunction + +" Function: s:GPGEditOptions() {{{2 +" +" create a scratch buffer with all recipients to add/remove recipients +" +function s:GPGEditOptions() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGEditOptions()") + + " guard for unencrypted files + if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) + echohl GPGWarning + echom "File is not encrypted, all GPG functions disabled!" + echohl None + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEditOptions()") + return + endif + + " only do this if it isn't already a GPGOptions_* buffer + if (match(bufname("%"), "^\\(GPGRecipients_\\|GPGOptions_\\)") != 0 && match(bufname("%"), "\.\\(gpg\\|asc\\|pgp\\)$") >= 0) + + " save buffer name + let buffername = bufname("%") + let editbuffername = "GPGOptions_" . buffername + + " check if this buffer exists + if (!bufexists(editbuffername)) + " create scratch buffer + execute 'silent! split ' . fnameescape(editbuffername) + + " add a autocommand to regenerate the options after a write + autocmd BufHidden,BufUnload,BufWriteCmd call s:GPGFinishOptionsBuffer() + else + if (bufwinnr(editbuffername) >= 0) + " switch to scratch buffer window + execute 'silent! ' . bufwinnr(editbuffername) . "wincmd w" + else + " split scratch buffer window + execute 'silent! sbuffer ' . fnameescape(editbuffername) + + " add a autocommand to regenerate the options after a write + autocmd BufHidden,BufUnload,BufWriteCmd call s:GPGFinishOptionsBuffer() + endif + + " empty the buffer + silent %delete + endif + + " Mark the buffer as a scratch buffer + setlocal buftype=nofile + setlocal noswapfile + setlocal nowrap + setlocal nobuflisted + setlocal nonumber + + " so we know for which other buffer this edit buffer is + let b:GPGCorrespondingTo = buffername + + " put some comments to the scratch buffer + silent put ='GPG: ----------------------------------------------------------------------' + silent put ='GPG: THERE IS NO CHECK OF THE ENTERED OPTIONS!' + silent put ='GPG: YOU NEED TO KNOW WHAT YOU ARE DOING!' + silent put ='GPG: IF IN DOUBT, QUICKLY EXIT USING :x OR :bd.' + silent put ='GPG: Please edit the list of options, one option per line.' + silent put ='GPG: Please refer to the gpg documentation for valid options.' + silent put ='GPG: Lines beginning with \"GPG:\" are removed automatically.' + silent put ='GPG: Closing this buffer commits changes.' + silent put ='GPG: ----------------------------------------------------------------------' + + " put the options in the scratch buffer + let options = getbufvar(b:GPGCorrespondingTo, "GPGOptions") + + for option in options + silent put =option + endfor + + " delete the empty first line + silent 1delete + + " jump to the first option + silent $ + + " define highlight + if (has("syntax") && exists("g:syntax_on")) + syntax match GPGComment "^GPG:.*$" + highlight clear GPGComment + highlight link GPGComment Comment + endif + endif + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEditOptions()") +endfunction + +" Function: s:GPGFinishOptionsBuffer() {{{2 +" +" create a new option list from OptionsBuffer +" +function s:GPGFinishOptionsBuffer() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGFinishOptionsBuffer()") + + " guard for unencrypted files + if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) + echohl GPGWarning + echom "File is not encrypted, all GPG functions disabled!" + echohl None + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGFinishOptionsBuffer()") + return + endif + + " go to buffer before doing work + if (bufnr("%") != expand("")) + " switch to scratch buffer window + execute 'silent! ' . bufwinnr(expand("")) . "wincmd w" + endif + + " clear options and unknownOptions + let options = [] + let unknownOptions = [] + + " delete the autocommand + autocmd! * + + " get the options from the scratch buffer + let lines = getline(1, "$") + for option in lines + " delete all spaces at beginning and end of the option + " also delete a '!' at the beginning of the option + let option = substitute(option, "^[[:space:]!]*\\(.\\{-}\\)[[:space:]]*$", "\\1", "") + " delete comment lines + let option = substitute(option, "^GPG:.*$", "", "") + + " only do this if the line is not empty + if (!empty(option) && match(options, option) < 0) + let options += [option] + endif + endfor + + " write back the new option list to the corresponding buffer and mark it + " as modified + call setbufvar(b:GPGCorrespondingTo, "GPGOptions", options) + call setbufvar(b:GPGCorrespondingTo, "&mod", 1) + + " reset modified flag + setl nomodified + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGFinishOptionsBuffer()") +endfunction + +" Function: s:GPGCheckRecipients(tocheck) {{{2 +" +" check if recipients are known +" Returns: dictionary of recipients, {'valid': [], 'unknown': []} +" +function s:GPGCheckRecipients(tocheck) + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGCheckRecipients()") + + let recipients = {'valid': [], 'unknown': []} + + if (type(a:tocheck) == type([])) + for recipient in a:tocheck + let gpgid = s:GPGNameToID(recipient) + if !empty(gpgid) + if (match(recipients.valid, gpgid) < 0) + call add(recipients.valid, gpgid) + endif + else + if (match(recipients.unknown, recipient) < 0) + call add(recipients.unknown, recipient) + echohl GPGWarning + echom "The recipient \"" . recipient . "\" is not in your public keyring!" + echohl None + endif + end + endfor + endif + + call s:GPGDebug(2, "recipients are: " . string(recipients.valid)) + call s:GPGDebug(2, "unknown recipients are: " . string(recipients.unknown)) + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGCheckRecipients()") + return recipients +endfunction + +" Function: s:GPGNameToID(name) {{{2 +" +" find GPG key ID corresponding to a name +" Returns: ID for the given name +" +function s:GPGNameToID(name) + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGNameToID()") + + " ask gpg for the id for a name + let cmd = { 'level': 2 } + let cmd.args = '--quiet --with-colons --fixed-list-mode --list-keys ' . s:shellescape(a:name) + let output = s:GPGSystem(cmd) + + " when called with "--with-colons" gpg encodes its output _ALWAYS_ as UTF-8, + " so convert it, if necessary + if (&encoding != "utf-8") + let output = iconv(output, "utf-8", &encoding) + endif + let lines = split(output, "\n") + + " parse the output of gpg + let pubseen = 0 + let counter = 0 + let gpgids = [] + let seen_keys = {} + let skip_key = 0 + let has_strftime = exists('*strftime') + let choices = "The name \"" . a:name . "\" is ambiguous. Please select the correct key:\n" + for line in lines + + let fields = split(line, ":") + + " search for the next pub + if (fields[0] == "pub") + " check if this key has already been processed + if has_key(seen_keys, fields[4]) + let skip_key = 1 + continue + endif + let skip_key = 0 + let seen_keys[fields[4]] = 1 + + " Ignore keys which are not usable for encryption + if fields[11] !~? 'e' + continue + endif + + let identity = fields[4] + let gpgids += [identity] + if has_strftime + let choices = choices . counter . ": ID: 0x" . identity . " created at " . strftime("%c", fields[5]) . "\n" + else + let choices = choices . counter . ": ID: 0x" . identity . "\n" + endif + let counter = counter+1 + let pubseen = 1 + " search for the next uid + elseif (!skip_key && fields[0] == "uid") + let choices = choices . " " . fields[9] . "\n" + endif + + endfor + + " counter > 1 means we have more than one results + let answer = 0 + if (counter > 1) + let choices = choices . "Enter number: " + let answer = input(choices, "0") + while (answer == "") + let answer = input("Enter number: ", "0") + endwhile + endif + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGNameToID()") + return get(gpgids, answer, "") +endfunction + +" Function: s:GPGIDToName(identity) {{{2 +" +" find name corresponding to a GPG key ID +" Returns: Name for the given ID +" +function s:GPGIDToName(identity) + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGIDToName()") + + " TODO is the encryption subkey really unique? + + " ask gpg for the id for a name + let cmd = { 'level': 2 } + let cmd.args = '--quiet --with-colons --fixed-list-mode --list-keys ' . a:identity + let output = s:GPGSystem(cmd) + + " when called with "--with-colons" gpg encodes its output _ALWAYS_ as UTF-8, + " so convert it, if necessary + if (&encoding != "utf-8") + let output = iconv(output, "utf-8", &encoding) + endif + let lines = split(output, "\n") + + " parse the output of gpg + let pubseen = 0 + let uid = "" + for line in lines + let fields = split(line, ":") + + if !pubseen " search for the next pub + if (fields[0] == "pub") + " Ignore keys which are not usable for encryption + if fields[11] !~? 'e' + continue + endif + + let pubseen = 1 + endif + else " search for the next uid + if (fields[0] == "uid") + let pubseen = 0 + if exists("*strftime") + let uid = fields[9] . s:GPGMagicString . "(ID: 0x" . a:identity . " created at " . strftime("%c", fields[5]) . ")" + else + let uid = fields[9] . s:GPGMagicString . "(ID: 0x" . a:identity . ")" + endif + break + endif + endif + endfor + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGIDToName()") + return uid +endfunction + +" Function: s:GPGPreCmd() {{{2 +" +" Setup the environment for running the gpg command +" +function s:GPGPreCmd() + let &shellredir = s:shellredir + let &shell = s:shell + let &shelltemp = s:shelltemp + " Force C locale so GPG output is consistent + let s:messages = v:lang + language messages C +endfunction + + +" Function: s:GPGPostCmd() {{{2 +" +" Restore the user's environment after running the gpg command +" +function s:GPGPostCmd() + let &shellredir = s:shellredirsave + let &shell = s:shellsave + let &shelltemp = s:shelltempsave + execute 'language messages' s:messages + " Workaround a bug in the interaction between console vim and + " pinentry-curses by forcing Vim to re-detect and setup its terminal + " settings + let &term = &term + silent doautocmd TermChanged +endfunction + +" Function: s:GPGSystem(dict) {{{2 +" +" run g:GPGCommand using system(), logging the commandline and output. This +" uses temp files (regardless of how 'shelltemp' is set) to hold the output of +" the command, so it must not be used for sensitive commands. +" Recognized keys are: +" level - Debug level at which the commandline and output will be logged +" args - Arguments to be given to g:GPGCommand +" +" Returns: command output +" +function s:GPGSystem(dict) + let commandline = s:GPGCommand + if (!empty(g:GPGHomedir)) + let commandline .= ' --homedir ' . s:shellescape(g:GPGHomedir) + endif + let commandline .= ' ' . a:dict.args + let commandline .= ' ' . s:stderrredirnull + call s:GPGDebug(a:dict.level, "command: ". commandline) + + call s:GPGPreCmd() + let output = system(commandline) + call s:GPGPostCmd() + + call s:GPGDebug(a:dict.level, "rc: ". v:shell_error) + call s:GPGDebug(a:dict.level, "output: ". output) + return output +endfunction + +" Function: s:GPGExecute(dict) {{{2 +" +" run g:GPGCommand using :execute, logging the commandline +" Recognized keys are: +" level - Debug level at which the commandline will be logged +" args - Arguments to be given to g:GPGCommand +" ex - Ex command which will be :executed +" redirect - Shell redirect to use, if needed +" +function s:GPGExecute(dict) + let commandline = printf('%s%s', a:dict.ex, s:GPGCommand) + if (!empty(g:GPGHomedir)) + let commandline .= ' --homedir ' . s:shellescape(g:GPGHomedir, 1) + endif + let commandline .= ' ' . a:dict.args + if (has_key(a:dict, 'redirect')) + let commandline .= ' ' . a:dict.redirect + endif + let commandline .= ' ' . s:stderrredirnull + call s:GPGDebug(a:dict.level, "command: " . commandline) + + call s:GPGPreCmd() + execute commandline + call s:GPGPostCmd() + + call s:GPGDebug(a:dict.level, "rc: ". v:shell_error) +endfunction + +" Function: s:GPGDebug(level, text) {{{2 +" +" output debug message, if this message has high enough importance +" only define function if GPGDebugLevel set at all +" +function s:GPGDebug(level, text) + if exists("g:GPGDebugLevel") && g:GPGDebugLevel >= a:level + if exists("g:GPGDebugLog") + execute "redir >> " . g:GPGDebugLog + silent echom "GnuPG: " . a:text + redir END + else + echom "GnuPG: " . a:text + endif + endif +endfunction + +" Section: Commands {{{1 + +command! GPGViewRecipients call s:GPGViewRecipients() +command! GPGEditRecipients call s:GPGEditRecipients() +command! GPGViewOptions call s:GPGViewOptions() +command! GPGEditOptions call s:GPGEditOptions() + +" Section: Menu {{{1 + +if (has("menu")) + amenu Plugin.GnuPG.View\ Recipients :GPGViewRecipients + amenu Plugin.GnuPG.Edit\ Recipients :GPGEditRecipients + amenu Plugin.GnuPG.View\ Options :GPGViewOptions + amenu Plugin.GnuPG.Edit\ Options :GPGEditOptions +endif + +" vim600: set foldmethod=marker foldlevel=0 : diff --git a/vim/vim/plugin/matrix.vim b/vim/vim/plugin/matrix.vim new file mode 100644 index 0000000..9ed838d --- /dev/null +++ b/vim/vim/plugin/matrix.vim @@ -0,0 +1,325 @@ +" matrix.vim - Don Yang (uguu.org) +" +" Matrix screensaver for VIM. +" +"Usage: +" After loading the script, use :Matrix to start. +" Press any key a few times to exit. +" +" You will need to edit s:mindelay and s:maxdelay below to match your +" machine speed and window size. +" +"Known Issues: +" Sometimes you need to press keys a few times to exit instead of just +" once. Press and hold is another way to go... feels like getchar is +" checking for keypress state instead of keystroke availability. +" +" If the window is too small, script will not run. If the window is +" resized and become too small (less than 8 rows or 10 columns) after +" the script started, script will abort and *buffers may be lost*, so +" don't do that. Resizing the window to most other sizes will be fine. +" +" Doesn't work if multiple windows exist before script started. In +" that case the script will abort with error message. +" +" If the current buffer is modified, some error messages will appear +" before the script starts, and an extra window is left behind after +" the script exits. Workaround: save your buffers first. +" +"Other Info: +" Inspired by cmatrix... +" Didn't feel inspired enough to start using pico/nano, of course ^_^; +" +" 05/13/08 - disable cursorline, cursorcolumn and spell +" (thanks to Diederick Niehorster for the suggestion). +" 12/21/06 - multiwindow support by S. Lockwood-Childs. +" 10/03/05 - added silent! to cursor positioning code to stop drawing +" numbers during animation (thanks to David Eggum for the +" suggestion). +" 10/02/05 - disable showmatch +" 03/16/05 - make new buffer modifiable before running +" 01/27/05 - added sleep to consume less CPU +" removed frame counter +" 01/26/05 - initial version + + +" Speed range, must be positive. Lower delay = faster. +let s:mindelay = 1 +let s:maxdelay = 5 + +" Session file for preserving original window layout +let s:session_file = tempname() + + +function! s:Rand() + let b:seed = b:seed * 22695477 + 1 + if b:seed < 0 + return -b:seed + endif + return b:seed +endfunction + +function! s:CreateObject(i) + while 1 + let b:x{a:i} = s:Rand() % b:columns + if b:reserve{b:x{a:i}} > 4 + break + endif + endwhile + let b:y{a:i} = 1 + let b:t{a:i} = s:Rand() % b:s{b:x{a:i}} + let b:head{a:i} = s:Rand() % 4 + let b:len{a:i} = s:Rand() % b:h + 3 + let b:reserve{b:x{a:i}} = 1 - b:len{a:i} +endfunction + +function! s:DrawObject(i) + let x = b:x{a:i} * 2 + 1 + let y = b:y{a:i} + + " Draw head + if y <= b:h + if b:head{a:i} + silent! exec 'norm! :' . y . nr2char(13) . x . '|R' . b:d[s:Rand()%b:dl] . '_' . nr2char(27) + if y > 1 + silent! exec 'norm! kR' . ((s:Rand() % 2) ? '`' : ' ') . nr2char(27) + endif + else + let a = ((s:Rand() % 2) ? '`' : ' ') . nr2char(27) + silent! exec 'norm! :'. y . nr2char(13) . x . '|R' . b:d[s:Rand() % b:dl] . a + endif + else + if b:head{a:i} && y == b:h + 1 + silent! exec 'norm! :' . b:h . nr2char(13) . (x + 1) . '|R' . ((s:Rand() % 2) ? '`' : ' ') . nr2char(27) + endif + endif + + " Draw tail + let y = y - b:len{a:i} + if 1 <= y && y <= b:h + silent! exec 'norm! :'. y . nr2char(13) . x . '|R ' . nr2char(27) + endif + let b:reserve{b:x{a:i}} = y +endfunction + +function! s:Animate() + let i = 0 + + while i < b:objcount + " Animate object + if b:t{i} <= 0 + if b:y{i} - b:len{i} <= b:h + " Draw + call s:DrawObject(i) + let b:t{i} = b:s{b:x{i}} + let b:y{i} = b:y{i} + 1 + else + " Regenerate + call s:CreateObject(i) + endif + endif + + let b:t{i} = b:t{i} - 1 + let i = i + 1 + endwhile + redraw + if getchar(1) + let b:run = 0 + endif + sleep 20m +endfunction + +function! s:Reset() + " Clear screen + let b:w = winwidth(0) + let b:h = winheight(0) + exec 'norm! gg"_dG' . b:h . 'O' . nr2char(27) . 'gg' + redraw + if b:w < 10 || b:h < 8 + let b:run = 0 + return + endif + + " Set number of columns. This is rounded down due to line wrapping + " at the last column if the screen width is even. So you end up + " seeing the cursor blinking a lot at the right side of the screen. + " Alternatively, ':set rl' before running the script to have it + " blink on the left side. + let b:columns = (b:w - 1) / 2 + + " Initialize columns. + let i = 0 + while i < b:columns + " Set delay time. Each column gets the same delay time. + let b:s{i} = s:Rand() % (s:maxdelay - s:mindelay) + s:mindelay + + " Unreserve column + let b:reserve{i} = b:h + let i = i + 1 + endwhile + + " Initialize objects + let b:objcount = b:columns - 2 + let i = 0 + while i < b:objcount + call s:CreateObject(i) + let i = i + 1 + endwhile +endfunction + +function! s:Init() + " Create new buffer and hide the existing buffers. Hiding the + " existing buffers without switching to a new buffer preserves + " undo history. + exec 'mksession! ' . s:session_file + let s:num_orig_win = winnr("$") + + " move to top window, so created window will become window 1, + " then attempt to create new window + 1 wincmd w + silent! new + + " check that there really is an additional window + if winnr("$") != s:num_orig_win + 1 + return 1 + endif + let s:newbuf = bufnr('%') + + " close all but window 1, which is the new window + only + + setl bh=delete bt=nofile ma nolist nonu noro noswf tw=0 nowrap + + " Set GUI options + if has('gui') + let s:o_gcr = &gcr + let s:o_go = &go + set gcr=a:ver1-blinkon0 go= + endif + if has('cmdline_info') + let s:o_ru = &ru + let s:o_sc = &sc + set noru nosc + endif + if has('title') + let s:o_ts = &titlestring + exec 'set titlestring=\ ' + endif + if v:version >= 700 + let s:o_spell = &spell + let s:o_cul = &cul + let s:o_cuc = &cuc + set nospell nocul nocuc + endif + let s:o_ch = &ch + let s:o_ls = &ls + let s:o_lz = &lz + let s:o_siso = &siso + let s:o_sm = &sm + let s:o_smd = &smd + let s:o_so = &so + let s:o_ve = &ve + set ch=1 ls=0 lz nosm nosmd siso=0 so=0 ve=all + + " Initialize PRNG + let b:seed = localtime() + let b:run = 1 + + " Clear screen and initialize objects + call s:Reset() + + " Set colors. Output looks better if your color scheme has black + " background. I would rather not have the script change the + " current color scheme since there is no good way to restore them + " afterwards. + hi MatrixHidden ctermfg=Black ctermbg=Black guifg=#000000 guibg=#000000 + hi MatrixNormal ctermfg=DarkGreen ctermbg=Black guifg=#008000 guibg=#000000 + hi MatrixBold ctermfg=LightGreen ctermbg=Black guifg=#00ff00 guibg=#000000 + hi MatrixHead ctermfg=White ctermbg=Black guifg=#ffffff guibg=#000000 + sy match MatrixNormal /^.*/ contains=MatrixHidden + sy match MatrixHidden contained /.`/ contains=MatrixBold + sy match MatrixHidden contained /._/ contains=MatrixHead + sy match MatrixBold contained /.\(`\)\@=/ + sy match MatrixHead contained /.\(_\)\@=/ + + " Create random char dictionary + let b:d = '' + let i = 33 + while i < 127 + if i != 95 && i != 96 + let b:d = b:d . nr2char(i) + endif + let i = i + 1 + endwhile + let b:dl = strlen(b:d) + return 0 +endfunction + +function! s:Cleanup() + " Restore options + if has('gui') + let &gcr = s:o_gcr + let &go = s:o_go + unlet s:o_gcr s:o_go + endif + if has('cmdline_info') + let &ru = s:o_ru + let &sc = s:o_sc + unlet s:o_ru s:o_sc + endif + if has('title') + let &titlestring = s:o_ts + unlet s:o_ts + endif + if v:version >= 700 + let &spell = s:o_spell + let &cul = s:o_cul + let &cuc = s:o_cuc + unlet s:o_cul s:o_cuc + endif + let &ch = s:o_ch + let &ls = s:o_ls + let &lz = s:o_lz + let &siso = s:o_siso + let &sm = s:o_sm + let &smd = s:o_smd + let &so = s:o_so + let &ve = s:o_ve + unlet s:o_ch s:o_ls s:o_lz s:o_siso s:o_sm s:o_smd s:o_so s:o_ve + + " Restore old buffers + exec 'source ' . s:session_file + exec 'bwipe ' . s:newbuf + unlet s:newbuf + + " Clear keystroke + let c = getchar(0) +endfunction + +function! Matrix() + if s:Init() + echohl ErrorMsg + echon 'Can not create window' + echohl None + return + endif + + while b:run + if b:w != winwidth(0) || b:h != winheight(0) + call s:Reset() + else + call s:Animate() + endif + endwhile + + call s:Cleanup() +endfunction + + +if !has('virtualedit') || !has('windows') || !has('syntax') + echohl ErrorMsg + echon 'Not enough features, need at least +virtualedit, +windows and +syntax' + echohl None +else + command! Matrix call Matrix() +endif diff --git a/vim/vim/plugin/securemodelines.vim b/vim/vim/plugin/securemodelines.vim new file mode 100644 index 0000000..2893b48 --- /dev/null +++ b/vim/vim/plugin/securemodelines.vim @@ -0,0 +1,153 @@ +" vim: set sw=4 sts=4 et ft=vim : +" Script: securemodelines.vim +" Version: 10d6c6b52fcdd12f3ba457126f66fee4ccceec04 +" Author: Ciaran McCreesh +" Homepage: http://github.com/ciaranm/securemodelines +" Requires: Vim 7 +" License: Redistribute under the same terms as Vim itself +" Purpose: A secure alternative to modelines + +if &compatible || v:version < 700 || exists('g:loaded_securemodelines') + finish +endif +let g:loaded_securemodelines = 1 + +if (! exists("g:secure_modelines_allowed_items")) + let g:secure_modelines_allowed_items = [ + \ "textwidth", "tw", + \ "softtabstop", "sts", + \ "tabstop", "ts", + \ "shiftwidth", "sw", + \ "expandtab", "et", "noexpandtab", "noet", + \ "filetype", "ft", + \ "foldmethod", "fdm", + \ "readonly", "ro", "noreadonly", "noro", + \ "rightleft", "rl", "norightleft", "norl", + \ "cindent", "cin", "nocindent", "nocin", + \ "smartindent", "si", "nosmartindent", "nosi", + \ "autoindent", "ai", "noautoindent", "noai", + \ "spell", + \ "spelllang" + \ ] +endif + +if (! exists("g:secure_modelines_verbose")) + let g:secure_modelines_verbose = 0 +endif + +if (! exists("g:secure_modelines_modelines")) + let g:secure_modelines_modelines=5 +endif + +if (! exists("g:secure_modelines_leave_modeline")) + if &modeline + set nomodeline + if g:secure_modelines_verbose + echohl WarningMsg + echo "Forcibly disabling internal modelines for securemodelines.vim" + echohl None + endif + endif +endif + +fun! IsInList(list, i) abort + for l:item in a:list + if a:i == l:item + return 1 + endif + endfor + return 0 +endfun + +fun! DoOne(item) abort + let l:matches = matchlist(a:item, '^\([a-z]\+\)\%([-+^]\?=[a-zA-Z0-9_\-.]\+\)\?$') + if len(l:matches) > 0 + if IsInList(g:secure_modelines_allowed_items, l:matches[1]) + exec "setlocal " . a:item + elseif g:secure_modelines_verbose + echohl WarningMsg + echo "Ignoring '" . a:item . "' in modeline" + echohl None + endif + endif +endfun + +fun! DoNoSetModeline(line) abort + for l:item in split(a:line, '[ \t:]') + call DoOne(l:item) + endfor +endfun + +fun! DoSetModeline(line) abort + for l:item in split(a:line) + call DoOne(l:item) + endfor +endfun + +fun! CheckVersion(op, ver) abort + if a:op == "=" + return v:version != a:ver + elseif a:op == "<" + return v:version < a:ver + elseif a:op == ">" + return v:version >= a:ver + else + return 0 + endif +endfun + +fun! DoModeline(line) abort + let l:matches = matchlist(a:line, '\%(\S\@=]\?\)\([0-9]\+\)\?\)\|\sex\):\s*\%(set\s\+\)\?\([^:]\+\):\S\@!') + if len(l:matches) > 0 + let l:operator = ">" + if len(l:matches[1]) > 0 + let l:operator = l:matches[1] + endif + if len(l:matches[2]) > 0 + if CheckVersion(l:operator, l:matches[2]) ? 0 : 1 + return + endif + endif + return DoSetModeline(l:matches[3]) + endif + + let l:matches = matchlist(a:line, '\%(\S\@=]\?\)\([0-9]\+\)\?\)\|\sex\):\(.\+\)') + if len(l:matches) > 0 + let l:operator = ">" + if len(l:matches[1]) > 0 + let l:operator = l:matches[1] + endif + if len(l:matches[2]) > 0 + if CheckVersion(l:operator, l:matches[2]) ? 0 : 1 + return + endif + endif + return DoNoSetModeline(l:matches[3]) + endif +endfun + +fun! DoModelines() abort + if line("$") > g:secure_modelines_modelines + let l:lines={ } + call map(filter(getline(1, g:secure_modelines_modelines) + + \ getline(line("$") - g:secure_modelines_modelines, "$"), + \ 'v:val =~ ":"'), 'extend(l:lines, { v:val : 0 } )') + for l:line in keys(l:lines) + call DoModeline(l:line) + endfor + else + for l:line in getline(1, "$") + call DoModeline(l:line) + endfor + endif +endfun + +fun! SecureModelines_DoModelines() abort + call DoModelines() +endfun + +aug SecureModeLines + au! + au BufRead,StdinReadPost * :call DoModelines() +aug END + diff --git a/vim/vim/syntax/asciidoc.vim b/vim/vim/syntax/asciidoc.vim new file mode 100644 index 0000000..d63a095 --- /dev/null +++ b/vim/vim/syntax/asciidoc.vim @@ -0,0 +1,173 @@ +" Vim syntax file +" Language: AsciiDoc +" Author: Stuart Rackham (inspired by Felix +" Obenhuber's original asciidoc.vim script). +" URL: http://www.methods.co.nz/asciidoc/ +" Licence: GPL (http://www.gnu.org) +" Remarks: Vim 6 or greater +" Limitations: See 'Appendix E: Vim Syntax Highlighter' in the AsciiDoc 'User +" Guide'. + +if exists("b:current_syntax") + finish +endif + +syn clear +syn sync fromstart +syn sync linebreaks=1 + +" Run :help syn-priority to review syntax matching priority. +syn keyword asciidocToDo TODO FIXME CHECK TEST XXX ZZZ DEPRECATED +syn match asciidocBackslash /\\/ +syn region asciidocIdMarker start=/^\$Id:\s/ end=/\s\$$/ +syn match asciidocCallout /\\\@/ +syn match asciidocListBlockDelimiter /^--$/ +syn match asciidocLineBreak /[ \t]+$/ +syn match asciidocRuler /^'\{3,}$/ +syn match asciidocPagebreak /^<\{3,}$/ +syn match asciidocEntityRef /\\\@\?[0-9A-Za-z_]\@!/ +syn match asciidocAttributeRef /\\\@.]\{,3}\)\?\([a-z]\)\?\)\?|/ containedin=asciidocTableBlock contained +syn region asciidocTableBlock matchgroup=asciidocTableDelimiter start=/^|=\{3,}$/ end=/^|=\{3,}$/ keepend contains=ALL +syn match asciidocTablePrefix /\(\S\@.]\{,3}\)\?\([a-z]\)\?\)\?!/ containedin=asciidocTableBlock contained +syn region asciidocTableBlock2 matchgroup=asciidocTableDelimiter2 start=/^!=\{3,}$/ end=/^!=\{3,}$/ keepend contains=ALL + +syn match asciidocListContinuation /^+$/ +syn region asciidocLiteralBlock start=/^\.\{4,}$/ end=/^\.\{4,}$/ contains=asciidocCallout,asciidocToDo keepend +syn region asciidocListingBlock start=/^-\{4,}$/ end=/^-\{4,}$/ contains=asciidocCallout,asciidocToDo keepend +syn region asciidocCommentBlock start="^/\{4,}$" end="^/\{4,}$" contains=asciidocToDo +syn region asciidocPassthroughBlock start="^+\{4,}$" end="^+\{4,}$" + +" Allowing leading \w characters in the filter delimiter is to accomodate +" the pre version 8.2.7 syntax and may be removed in future releases. +syn region asciidocFilterBlock start=/^\w*\~\{4,}$/ end=/^\w*\~\{4,}$/ + +syn region asciidocMacroAttributes matchgroup=asciidocRefMacro start=/\\\@>\)\|^$/ contains=asciidocQuoted.* keepend +syn region asciidocMacroAttributes matchgroup=asciidocAnchorMacro start=/\\\@ +" URL: http://www.unet.univie.ac.at/~a9600989/vim/getmailrc.vim +" Last Change: 2005 02 22 + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" string, ints and comments +syn match gmComment /#.*$/ +syn match gmInt /\<\d\+\>/ +syn region gmDbQuoteStr start=+"+ skip=+\\"+ end=+"+ +syn region gmQuoteStr start=+'+ skip=+\\'+ end=+'+ + +" booleans are case insensitive +syn case ignore + syn keyword gmTrue 1 true yes on + syn keyword gmFalse 0 false no off +syn case match + +syn match gmParam /^\s*\w\+\s*=/ contains=gmKeywd +syn match gmSection /^\s*\[\(retriever\|destination\|options\)\]\s*$/ +syn match gmFilterSec /^\s*\[filter-\w\+\]\s*$/ + +syn keyword gmType type contained + +" retriever section +" + +" retriever type +syn match gmRetType /^\s*type\s*=\s*[a-zA-Z3]\+\s*$/ contains=gmRetTypes,gmType +syn keyword gmRetTypes BrokenUIDLPOP3Retriver contained +syn keyword gmRetTypes SimplePOP3Retriever SimpleIMAPRetriever contained +syn keyword gmRetTypes SimplePOP3SSLRetriever SimpleIMAPSSLRetriever contained +syn keyword gmRetTypes MultidropPOP3Retriever MultidropPOP3SSLRetriever contained +syn keyword gmRetTypes MultidropSPDSRetriever MultidropIMAPRetriever contained +syn keyword gmRetTypes MultidropIMAPSSLRetriever contained + +" common retriever options +syn keyword gmKeywd password port server username contained +" POP3 +syn keyword gmKeywd use_apop contained +" IMAP +syn keyword gmKeywd mailboxes move_on_delete contained +" SSL +syn keyword gmKeywd certfile keyfile contained +" multidrop +syn keyword gmKeywd envelope_recipient contained +" timeout +syn keyword gmKeywd timeout contained + +" destination section +" + +" destination type +syn match gmDestType /^\s*type\s*=\s*\(Maildir\|Mboxrd\|MDA_external\|MultiDestination\|MultiGuesser\|MultiSorter\|MDA_qmaillocal\)\s*$/ contains=gmDestTypes,gmType +syn keyword gmDestTypes Maildir Mboxrd MDA_external MultiDestination contained +syn keyword gmDestTypes MultiGuesser MultiSorter MDA_qmaillocal contained + +" Maildir, Mboxrd and MDA_external common options +syn keyword gmKeywd path contained +" MDA_external +syn keyword gmKeywd allow_root_commands arguments group contained +syn keyword gmKeywd unixfrom user contained +" MultiSorter +syn keyword gmKeywd default locals contained +" MDA_qmaillocal plus allow_root_command, group and user from +" MDA_external +syn keyword gmKeywd conf-break defaultdelivery homedir contained +syn keyword gmKeywd localdomain localpart_translate qmaillocal contained +syn keyword gmKeywd strip_delivered_to contained + +" option section +" +syn keyword gmKeywd delete delete_after delivered_to contained +syn keyword gmKeywd max_messages_per_session max_message_size contained +syn keyword gmKeywd message_log message_log_syslog read_all received contained +syn keyword gmKeywd verbose contained + +" filter section +" + +" filter type +syn match gmFilterType /^\s*type\s*=\s*\(Filter_classifier\|Filter_external\|Filter_TMDA\)\s*$/ contains=gmFilterTypes,gmType +syn keyword gmFilterTypes Filter_classifier Filter_external Filter_TMDA contained + +" filter options +syn keyword gmKeywd allow_root_commands arguments exitcodes_drop contained +syn keyword gmKeywd exitcodes_keep group path unixfrom user contained + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_getmail_syn_inits") + if version < 508 + let did_getmail_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + HiLink gmComment Comment + HiLink gmInt Identifier + HiLink gmDbQuoteStr String + HiLink gmQuoteStr String + + HiLink gmTrue Identifier + HiLink gmFalse Constant + + HiLink gmParam Normal + HiLink gmSection Statement + HiLink gmFilterSec Statement + + HiLink gmKeywd Type + HiLink gmType Type + + HiLink gmRetTypes PreProc + HiLink gmDestTypes PreProc + HiLink gmFilterTypes PreProc + delcommand HiLink +endif + +let b:current_syntax = "getmail" + +" vim: ts=8 diff --git a/vim/vim/syntax/msmtp.vim b/vim/vim/syntax/msmtp.vim new file mode 100644 index 0000000..1b0f8df --- /dev/null +++ b/vim/vim/syntax/msmtp.vim @@ -0,0 +1,52 @@ +" Vim syntax file +" Language: msmtp rc files +" Maintainer: Simon Ruderich +" Last Change: 2008-08-23 +" Filenames: msmtprc +" Version: 0.1 + + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + + +" Comments. +syn match msmtpComment /#.*$/ contains=@Spell + +" General commands. +syntax match msmtpOption /\<\(defaults\|account\|host\|port\|timeout\|protocol\|domain\)\>/ +" Authentication commands. +syntax match msmtpOption /\<\(auth\|user\|password\|passwordeval\|ntlmdomain\)\>/ +" TLS commands. +syntax match msmtpOption /\<\(tls\|tls_trust_file\|tls_crl_file\|tls_fingerprint\|tls_key_file\|tls_cert_file\|tls_certcheck\|tls_starttls\|tls_force_sslv3\|tls_min_dh_prime_bits\|tls_priorities\)\>/ +" Sendmail mode specific commands. +syntax match msmtpOption /\<\(auto_from\|from\|maildomain\|dsn_notify\|dsn_return\|keepbcc\|logfile\|syslog\)\>/ + + +" Options which accept only an on/off value. +syn match msmtpWrongOption /\<\(tls\|tls_certcheck\|tls_starttls\|tls_force_sslv3\|auto_from\|keepbcc\) \(on$\|off$\)\@!.*$/ +" Option port accepts numeric values. +syn match msmtpWrongOption /\ +" Homepage: http://github.com/petdance/vim-perl/tree/master +" Bugs/requests: http://github.com/petdance/vim-perl/issues +" Last Change: 2010-08-10 +" Contributors: Andy Lester +" Hinrik Örn Sigurðsson +" Lukas Mai +" Nick Hibma +" Sonia Heimann +" and many others. +" +" Please download most recent version first before mailing +" any comments. +" +" The following parameters are available for tuning the +" perl syntax highlighting, with defaults given: +" +" unlet perl_include_pod +" unlet perl_no_scope_in_variables +" unlet perl_no_extended_vars +" unlet perl_string_as_statement +" unlet perl_no_sync_on_sub +" unlet perl_no_sync_on_global_var +" let perl_sync_dist = 100 +" unlet perl_fold +" unlet perl_fold_blocks +" let perl_nofold_packages = 1 +" let perl_nofold_subs = 1 + +if exists("b:current_syntax") + finish +endif + + +" POD starts with ^= and ends with ^=cut + +if exists("perl_include_pod") + " Include a while extra syntax file + syn include @Pod syntax/pod.vim + unlet b:current_syntax + if exists("perl_fold") + syn region perlPOD start="^=[a-z]" end="^=cut" contains=@Pod,@Spell,perlTodo keepend fold + syn region perlPOD start="^=cut" end="^=cut" contains=perlTodo keepend fold + else + syn region perlPOD start="^=[a-z]" end="^=cut" contains=@Pod,@Spell,perlTodo keepend + syn region perlPOD start="^=cut" end="^=cut" contains=perlTodo keepend + endif +else + " Use only the bare minimum of rules + if exists("perl_fold") + syn region perlPOD start="^=[a-z]" end="^=cut" fold + else + syn region perlPOD start="^=[a-z]" end="^=cut" + endif +endif + + +syn cluster perlTop contains=TOP +syn region perlGenericBlock matchgroup=perlGenericBlock start="{" end="}" contained transparent + + +" All keywords +" +syn match perlConditional "\<\%(if\|elsif\|unless\|given\|when\|default\)\>" +syn match perlConditional "\" nextgroup=perlElseIfError skipwhite skipnl skipempty +syn match perlRepeat "\<\%(while\|for\%(each\)\=\|do\|until\|continue\)\>" +syn match perlOperator "\<\%(defined\|undef\|eq\|ne\|[gl][et]\|cmp\|not\|and\|or\|xor\|not\|bless\|ref\|do\)\>" +syn match perlControl "\<\%(BEGIN\|CHECK\|INIT\|END\|UNITCHECK\)\>" + +syn match perlStatementStorage "\<\%(my\|our\|local\|state\)\>" +syn match perlStatementControl "\<\%(return\|last\|next\|redo\|goto\|break\)\>" +syn match perlStatementScalar "\<\%(chom\=p\|chr\|crypt\|r\=index\|lc\%(first\)\=\|length\|ord\|pack\|sprintf\|substr\|uc\%(first\)\=\)\>" +syn match perlStatementRegexp "\<\%(pos\|quotemeta\|split\|study\)\>" +syn match perlStatementNumeric "\<\%(abs\|atan2\|cos\|exp\|hex\|int\|log\|oct\|rand\|sin\|sqrt\|srand\)\>" +syn match perlStatementList "\<\%(splice\|unshift\|shift\|push\|pop\|join\|reverse\|grep\|map\|sort\|unpack\)\>" +syn match perlStatementHash "\<\%(delete\|each\|exists\|keys\|values\)\>" +syn match perlStatementIOfunc "\<\%(syscall\|dbmopen\|dbmclose\)\>" +syn match perlStatementFiledesc "\<\%(binmode\|close\%(dir\)\=\|eof\|fileno\|getc\|lstat\|printf\=\|read\%(dir\|line\|pipe\)\|rewinddir\|say\|select\|stat\|tell\%(dir\)\=\|write\)\>" nextgroup=perlFiledescStatementNocomma skipwhite +syn match perlStatementFiledesc "\<\%(fcntl\|flock\|ioctl\|open\%(dir\)\=\|read\|seek\%(dir\)\=\|sys\%(open\|read\|seek\|write\)\|truncate\)\>" nextgroup=perlFiledescStatementComma skipwhite +syn match perlStatementVector "\" +syn match perlStatementFiles "\<\%(ch\%(dir\|mod\|own\|root\)\|glob\|link\|mkdir\|readlink\|rename\|rmdir\|symlink\|umask\|unlink\|utime\)\>" +syn match perlStatementFiles "-[rwxoRWXOezsfdlpSbctugkTBMAC]\>" +syn match perlStatementFlow "\<\%(caller\|die\|dump\|eval\|exit\|wantarray\)\>" +syn match perlStatementInclude "\" +syn match perlStatementInclude "\<\%(use\|no\)\s\+\%(\%(attributes\|attrs\|autouse\|parent\|base\|big\%(int\|num\|rat\)\|blib\|bytes\|charnames\|constant\|diagnostics\|encoding\%(::warnings\)\=\|feature\|fields\|filetest\|if\|integer\|less\|lib\|locale\|mro\|open\|ops\|overload\|re\|sigtrap\|sort\|strict\|subs\|threads\%(::shared\)\=\|utf8\|vars\|version\|vmsish\|warnings\%(::register\)\=\)\>\)\=" +syn match perlStatementProc "\<\%(alarm\|exec\|fork\|get\%(pgrp\|ppid\|priority\)\|kill\|pipe\|set\%(pgrp\|priority\)\|sleep\|system\|times\|wait\%(pid\)\=\)\>" +syn match perlStatementSocket "\<\%(acept\|bind\|connect\|get\%(peername\|sock\%(name\|opt\)\)\|listen\|recv\|send\|setsockopt\|shutdown\|socket\%(pair\)\=\)\>" +syn match perlStatementIPC "\<\%(msg\%(ctl\|get\|rcv\|snd\)\|sem\%(ctl\|get\|op\)\|shm\%(ctl\|get\|read\|write\)\)\>" +syn match perlStatementNetwork "\<\%(\%(end\|[gs]et\)\%(host\|net\|proto\|serv\)ent\|get\%(\%(host\|net\)by\%(addr\|name\)\|protoby\%(name\|number\)\|servby\%(name\|port\)\)\)\>" +syn match perlStatementPword "\<\%(get\%(pw\%(uid\|nam\)\|gr\%(gid\|nam\)\|login\)\)\|\%(end\|[gs]et\)\%(pw\|gr\)ent\>" +syn match perlStatementTime "\<\%(gmtime\|localtime\|time\)\>" + +syn match perlStatementMisc "\<\%(warn\|formline\|reset\|scalar\|prototype\|lock\|tied\=\|untie\)\>" + +syn keyword perlTodo TODO TBD FIXME XXX NOTE contained + +syn region perlStatementIndirObjWrap matchgroup=perlStatementIndirObj start="\<\%(map\|grep\|sort\|print\|system\|exec\)\>\s*{" end="}" contains=@perlTop,perlGenericBlock + +syn match perlLabel "^\s*\h\w*\s*::\@!\%(\ is *not* considered as part of the +" variable - there again, too complicated and too slow. + +" Special variables first ($^A, ...) and ($|, $', ...) +syn match perlVarPlain "$^[ACDEFHILMNOPRSTVWX]\=" +syn match perlVarPlain "$[\\\"\[\]'&`+*.,;=%~!?@#$<>(-]" +syn match perlVarPlain "%+" +syn match perlVarPlain "$\%(0\|[1-9]\d*\)" +" Same as above, but avoids confusion in $::foo (equivalent to $main::foo) +syn match perlVarPlain "$::\@!" +" These variables are not recognized within matches. +syn match perlVarNotInMatches "$[|)]" +" This variable is not recognized within matches delimited by m//. +syn match perlVarSlash "$/" + +" And plain identifiers +syn match perlPackageRef "[$@#%*&]\%(\%(::\|'\)\=\I\i*\%(\%(::\|'\)\I\i*\)*\)\=\%(::\|'\)\I"ms=s+1,me=e-1 contained + +" To not highlight packages in variables as a scope reference - i.e. in +" $pack::var, pack:: is a scope, just set "perl_no_scope_in_variables" +" If you don't want complex things like @{${"foo"}} to be processed, +" just set the variable "perl_no_extended_vars"... + +if !exists("perl_no_scope_in_variables") + syn match perlVarPlain "\%([@$]\|\$#\)\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod + syn match perlVarPlain2 "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef + syn match perlFunctionName "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod +else + syn match perlVarPlain "\%([@$]\|\$#\)\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod + syn match perlVarPlain2 "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" + syn match perlFunctionName "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod +endif + +if !exists("perl_no_extended_vars") + syn cluster perlExpr contains=perlStatementIndirObjWrap,perlStatementScalar,perlStatementRegexp,perlStatementNumeric,perlStatementList,perlStatementHash,perlStatementFiles,perlStatementTime,perlStatementMisc,perlVarPlain,perlVarPlain2,perlVarNotInMatches,perlVarSlash,perlVarBlock,perlVarBlock2,perlShellCommand,perlFloat,perlNumber,perlStringUnexpanded,perlString,perlQQ,perlArrow,perlGenericBlock + syn region perlArrow matchgroup=perlArrow start="->\s*(" end=")" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained + syn region perlArrow matchgroup=perlArrow start="->\s*\[" end="\]" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained + syn region perlArrow matchgroup=perlArrow start="->\s*{" end="}" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained + syn match perlArrow "->\s*{\s*\I\i*\s*}" contains=perlVarSimpleMemberName nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained + syn region perlArrow matchgroup=perlArrow start="->\s*\$*\I\i*\s*(" end=")" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained + syn region perlVarBlock matchgroup=perlVarPlain start="\%($#\|[$@]\)\$*{" skip="\\}" end="}" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod + syn region perlVarBlock2 matchgroup=perlVarPlain start="[%&*]\$*{" skip="\\}" end="}" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod + syn match perlVarPlain2 "[%&*]\$*{\I\i*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod + syn match perlVarPlain "\%(\$#\|[@$]\)\$*{\I\i*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod + syn region perlVarMember matchgroup=perlVarPlain start="\%(->\)\={" skip="\\}" end="}" contained contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod + syn match perlVarSimpleMember "\%(->\)\={\s*\I\i*\s*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contains=perlVarSimpleMemberName contained + syn match perlVarSimpleMemberName "\I\i*" contained + syn region perlVarMember matchgroup=perlVarPlain start="\%(->\)\=\[" skip="\\]" end="]" contained contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod + syn match perlPackageConst "__PACKAGE__" nextgroup=perlMethod + syn match perlMethod "->\$*\I\i*" contained nextgroup=perlVarSimpleMember,perlVarMember,perlMethod +endif + +" File Descriptors +syn match perlFiledescRead "<\h\w*>" + +syn match perlFiledescStatementComma "(\=\s*\u\w*\s*,"me=e-1 transparent contained contains=perlFiledescStatement +syn match perlFiledescStatementNocomma "(\=\s*\u\w*\s*[^, \t]"me=e-1 transparent contained contains=perlFiledescStatement + +syn match perlFiledescStatement "\u\w*" contained + +" Special characters in strings and matches +syn match perlSpecialString "\\\%(\o\{1,3}\|x\%({\x\+}\|\x\{1,2}\)\|c.\|[^cx]\)" contained extend +syn match perlSpecialStringU2 "\\." extend contained transparent contains=NONE +syn match perlSpecialStringU "\\\\" contained +syn match perlSpecialMatch "\\[1-9]" contained extend +syn match perlSpecialMatch "\\g\%(\d\+\|{\%(-\=\d\+\|\h\w*\)}\)" contained +syn match perlSpecialMatch "\\k\%(<\h\w*>\|'\h\w*'\)" contained +syn match perlSpecialMatch "{\d\+\%(,\%(\d\+\)\=\)\=}" contained +syn match perlSpecialMatch "\[[]-]\=[^\[\]]*[]-]\=\]" contained +syn match perlSpecialMatch "[+*()?.]" contained +syn match perlSpecialMatch "(?[#:=!]" contained +syn match perlSpecialMatch "(?[impsx]*\%(-[imsx]\+\)\=)" contained +syn match perlSpecialMatch "(?\%([-+]\=\d\+\|R\))" contained +syn match perlSpecialMatch "(?\%(&\|P[>=]\)\h\w*)" contained +syn match perlSpecialMatch "(\*\%(\%(PRUNE\|SKIP\|THEN\)\%(:[^)]*\)\=\|\%(MARK\|\):[^)]*\|COMMIT\|F\%(AIL\)\=\|ACCEPT\))" contained + +" Possible errors +" +" Highlight lines with only whitespace (only in blank delimited here documents) as errors +syn match perlNotEmptyLine "^\s\+$" contained +" Highlight "} else if (...) {", it should be "} else { if (...) { " or "} elsif (...) {" +syn match perlElseIfError "\s\+if" contained +syn keyword perlElseIfError elseif + +" Variable interpolation +" +" These items are interpolated inside "" strings and similar constructs. +syn cluster perlInterpDQ contains=perlSpecialString,perlVarPlain,perlVarNotInMatches,perlVarSlash,perlVarBlock +" These items are interpolated inside '' strings and similar constructs. +syn cluster perlInterpSQ contains=perlSpecialStringU,perlSpecialStringU2 +" These items are interpolated inside m// matches and s/// substitutions. +syn cluster perlInterpSlash contains=perlSpecialString,perlSpecialMatch,perlVarPlain,perlVarBlock +" These items are interpolated inside m## matches and s### substitutions. +syn cluster perlInterpMatch contains=@perlInterpSlash,perlVarSlash + +" Shell commands +syn region perlShellCommand matchgroup=perlMatchStartEnd start="`" end="`" contains=@perlInterpDQ keepend + +" Constants +" +" Numbers +syn match perlNumber "\<\%(0\%(x\x[[:xdigit:]_]*\|b[01][01_]*\|\o[0-7_]*\|\)\|[1-9][[:digit:]_]*\)\>" +syn match perlFloat "\<\d[[:digit:]_]*[eE][\-+]\=\d\+" +syn match perlFloat "\<\d[[:digit:]_]*\.[[:digit:]_]*\%([eE][\-+]\=\d\+\)\=" +syn match perlFloat "\.[[:digit:]_]\+\%([eE][\-+]\=\d\+\)\=" + +syn match perlString "\<\%(v\d\+\%(\.\d\+\)*\|\d\+\%(\.\d\+\)\{2,}\)\>" contains=perlVStringV +syn match perlVStringV "\+ extend contained transparent contains=perlAnglesSQ,@perlInterpSQ keepend + +syn region perlParensDQ start=+(+ end=+)+ extend contained transparent contains=perlParensDQ,@perlInterpDQ keepend +syn region perlBracketsDQ start=+\[+ end=+\]+ extend contained transparent contains=perlBracketsDQ,@perlInterpDQ keepend +syn region perlBracesDQ start=+{+ end=+}+ extend contained transparent contains=perlBracesDQ,@perlInterpDQ keepend +syn region perlAnglesDQ start=+<+ end=+>+ extend contained transparent contains=perlAnglesDQ,@perlInterpDQ keepend + + +" Simple version of searches and matches +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@\s*\z([^[:space:]'([{<#]\)+ end=+\z1[cgimopsx]*+ contains=@perlInterpMatch keepend +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@\)\@\)\@\)\@ and m[] which allows for comments and extra whitespace in the pattern +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@\)\@[cgimopsx]*+ contains=@perlInterpMatch,perlAnglesDQ keepend +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@\)\@\s*\z([^[:space:]'([{<#]\)+ end=+\z1+me=e-1 contains=@perlInterpMatch nextgroup=perlSubstitutionGQQ keepend +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@\)\@\)\@\)\@\)\@+ contains=@perlInterpMatch,perlAnglesDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@\)\@[ecgimopsx]*+ contained contains=@perlInterpDQ,perlAnglesDQ keepend +syn region perlSubstitutionSQ matchgroup=perlMatchStartEnd start=+'+ end=+'[ecgimopsx]*+ contained contains=@perlInterpSQ keepend + +" Translations +" perlMatch is the first part, perlTranslation* is the second, translator part. +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@\s*\z([^[:space:]([{<#]\)+ end=+\z1+me=e-1 contains=@perlInterpSQ nextgroup=perlTranslationGQ +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@\)\@\)\@\)\@+ contains=@perlInterpSQ,perlAnglesSQ nextgroup=perlTranslationGQ skipwhite skipempty skipnl +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@[cds]*+ contains=perlAnglesSQ contained + + +" Strings and q, qq, qw and qr expressions + +syn region perlStringUnexpanded matchgroup=perlStringStartEnd start="'" end="'" contains=@perlInterpSQ keepend +syn region perlString matchgroup=perlStringStartEnd start=+"+ end=+"+ contains=@perlInterpDQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@\s*\z([^[:space:]#([{<]\)+ end=+\z1+ contains=@perlInterpSQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@\)\@\)\@\)\@\)\@+ contains=@perlInterpSQ,perlAnglesSQ keepend + +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@\s*\z([^[:space:]#([{<]\)+ end=+\z1+ contains=@perlInterpDQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@\)\@\)\@\)\@\)\@+ contains=@perlInterpDQ,perlAnglesDQ keepend + +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@\)\@\)\@\)\@\)\@\)\@+ contains=@perlInterpSQ,perlAnglesSQ keepend + +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@\s*\z([^[:space:]#([{<'/]\)+ end=+\z1[imosx]*+ contains=@perlInterpMatch keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@\)\@\)\@\)\@ and qr[] which allows for comments and extra whitespace in the pattern +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@\)\@[imosx]*+ contains=@perlInterpMatch,perlAnglesDQ,perlComment keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@\zs\_[^)]\+" contained +syn match perlSubPrototype +(\_[^)]*)\_s*\|+ nextgroup=perlSubAttributes contained contains=perlSubPrototypeError +syn match perlSubName +\%(\h\|::\|'\w\)\%(\w\|::\|'\w\)*\_s*\|+ contained nextgroup=perlSubPrototype + +syn match perlFunction +\\_s*+ nextgroup=perlSubName + +if !exists("perl_no_scope_in_variables") + syn match perlFunctionPRef "\h\w*::" contained + syn match perlFunctionName "\h\w*[^:]" contained +else + syn match perlFunctionName "\h[[:alnum:]_:]*" contained +endif + +" The => operator forces a bareword to the left of it to be interpreted as +" a string +syn match perlString "\I\@\)\@=" + +" All other # are comments, except ^#! +syn match perlComment "#.*" contains=perlTodo,@Spell +syn match perlSharpBang "^#!.*" + +" Formats +syn region perlFormat matchgroup=perlStatementIOFunc start="^\s*\~]\+\%(\.\.\.\)\=" contained +syn match perlFormatField "[@^]#[#.]*" contained +syn match perlFormatField "@\*" contained +syn match perlFormatField "@[^A-Za-z_|<>~#*]"me=e-1 contained +syn match perlFormatField "@$" contained + +" __END__ and __DATA__ clauses +if exists("perl_fold") + syntax region perlDATA start="^__\%(DATA\|END\)__$" skip="." end="." contains=perlPOD,@perlDATA fold +else + syntax region perlDATA start="^__\%(DATA\|END\)__$" skip="." end="." contains=perlPOD,@perlDATA +endif + +" +" Folding + +if exists("perl_fold") + " Note: this bit must come before the actual highlighting of the "package" + " keyword, otherwise this will screw up Pod lines that match /^package/ + if !exists("perl_nofold_packages") + syn region perlPackageFold start="^package \S\+;\s*\%(#.*\)\=$" end="^1;\=\s*\%(#.*\)\=$" end="\n\+package"me=s-1 transparent fold keepend + endif + if !exists("perl_nofold_subs") + syn region perlSubFold start="^\z(\s*\)\.*[^};]$" end="^\z1}\s*\%(#.*\)\=$" transparent fold keepend + syn region perlSubFold start="^\z(\s*\)\<\%(BEGIN\|END\|CHECK\|INIT\|UNITCHECK\)\>.*[^};]$" end="^\z1}\s*$" transparent fold keepend + endif + + if exists("perl_fold_blocks") + syn region perlBlockFold start="^\z(\s*\)\%(if\|elsif\|unless\|for\|while\|until\|given\)\s*(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" start="^\z(\s*\)foreach\s*\%(\%(my\|our\)\=\s*\S\+\s*\)\=(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend + syn region perlBlockFold start="^\z(\s*\)\%(do\|else\)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*while" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend + endif + + setlocal foldmethod=syntax + syn sync fromstart +else + " fromstart above seems to set minlines even if perl_fold is not set. + syn sync minlines=0 +endif + +command -nargs=+ HiLink hi def link + +" The default highlighting. +HiLink perlSharpBang PreProc +HiLink perlControl PreProc +HiLink perlInclude Include +HiLink perlSpecial Special +HiLink perlString String +HiLink perlCharacter Character +HiLink perlNumber Number +HiLink perlFloat Float +HiLink perlType Type +HiLink perlIdentifier Identifier +HiLink perlLabel Label +HiLink perlStatement Statement +HiLink perlConditional Conditional +HiLink perlRepeat Repeat +HiLink perlOperator Operator +HiLink perlFunction Keyword +HiLink perlSubName Function +HiLink perlSubPrototype Type +HiLink perlSubAttributes PreProc +HiLink perlSubAttributesCont perlSubAttributes +HiLink perlComment Comment +HiLink perlTodo Todo +if exists("perl_string_as_statement") + HiLink perlStringStartEnd perlStatement +else + HiLink perlStringStartEnd perlString +endif +HiLink perlVStringV perlStringStartEnd +HiLink perlList perlStatement +HiLink perlMisc perlStatement +HiLink perlVarPlain perlIdentifier +HiLink perlVarPlain2 perlIdentifier +HiLink perlArrow perlIdentifier +HiLink perlFiledescRead perlIdentifier +HiLink perlFiledescStatement perlIdentifier +HiLink perlVarSimpleMember perlIdentifier +HiLink perlVarSimpleMemberName perlString +HiLink perlVarNotInMatches perlIdentifier +HiLink perlVarSlash perlIdentifier +HiLink perlQQ perlString +HiLink perlHereDoc perlString +HiLink perlStringUnexpanded perlString +HiLink perlSubstitutionSQ perlString +HiLink perlSubstitutionGQQ perlString +HiLink perlTranslationGQ perlString +HiLink perlMatch perlString +HiLink perlMatchStartEnd perlStatement +HiLink perlFormatName perlIdentifier +HiLink perlFormatField perlString +HiLink perlPackageDecl perlType +HiLink perlStorageClass perlType +HiLink perlPackageRef perlType +HiLink perlStatementPackage perlStatement +HiLink perlStatementStorage perlStatement +HiLink perlStatementControl perlStatement +HiLink perlStatementScalar perlStatement +HiLink perlStatementRegexp perlStatement +HiLink perlStatementNumeric perlStatement +HiLink perlStatementList perlStatement +HiLink perlStatementHash perlStatement +HiLink perlStatementIOfunc perlStatement +HiLink perlStatementFiledesc perlStatement +HiLink perlStatementVector perlStatement +HiLink perlStatementFiles perlStatement +HiLink perlStatementFlow perlStatement +HiLink perlStatementInclude perlStatement +HiLink perlStatementProc perlStatement +HiLink perlStatementSocket perlStatement +HiLink perlStatementIPC perlStatement +HiLink perlStatementNetwork perlStatement +HiLink perlStatementPword perlStatement +HiLink perlStatementTime perlStatement +HiLink perlStatementMisc perlStatement +HiLink perlStatementIndirObj perlStatement +HiLink perlFunctionName perlIdentifier +HiLink perlMethod perlIdentifier +HiLink perlFunctionPRef perlType +HiLink perlPOD perlComment +HiLink perlShellCommand perlString +HiLink perlSpecialAscii perlSpecial +HiLink perlSpecialDollar perlSpecial +HiLink perlSpecialString perlSpecial +HiLink perlSpecialStringU perlSpecial +HiLink perlSpecialMatch perlSpecial +HiLink perlDATA perlComment + +" Possible errors +HiLink perlNotEmptyLine Error +HiLink perlElseIfError Error +HiLink perlSubPrototypeError Error +HiLink perlSubError Error + +delcommand HiLink + +" Syncing to speed up processing +" +if !exists("perl_no_sync_on_sub") + syn sync match perlSync grouphere NONE "^\s*\" + syn sync match perlSync grouphere NONE "^}" +endif + +if !exists("perl_no_sync_on_global_var") + syn sync match perlSync grouphere NONE "^$\I[[:alnum:]_:]+\s*=\s*{" + syn sync match perlSync grouphere NONE "^[@%]\I[[:alnum:]_:]+\s*=\s*(" +endif + +if exists("perl_sync_dist") + execute "syn sync maxlines=" . perl_sync_dist +else + syn sync maxlines=100 +endif + +syn sync match perlSyncPOD grouphere perlPOD "^=pod" +syn sync match perlSyncPOD grouphere perlPOD "^=head" +syn sync match perlSyncPOD grouphere perlPOD "^=item" +syn sync match perlSyncPOD grouphere NONE "^=cut" + +let b:current_syntax = "perl" + +" XXX Change to sts=4:sw=4 +" vim:ts=8:sts=2:sw=2:expandtab:ft=vim diff --git a/vim/vim/syntax/python.vim b/vim/vim/syntax/python.vim new file mode 100644 index 0000000..0e0bb12 --- /dev/null +++ b/vim/vim/syntax/python.vim @@ -0,0 +1,374 @@ +" Vim syntax file +" Language: Python +" Maintainer: Dmitry Vasiliev +" URL: http://www.hlabs.spb.ru/vim/python.vim +" Last Change: 2010-04-09 +" Filenames: *.py +" Version: 2.6.6 +" +" Based on python.vim (from Vim 6.1 distribution) +" by Neil Schemenauer +" +" Thanks: +" +" Jeroen Ruigrok van der Werven +" for the idea to highlight erroneous operators +" Pedro Algarvio +" for the patch to enable spell checking only for the right spots +" (strings and comments) +" John Eikenberry +" for the patch fixing small typo +" Caleb Adamantine +" for the patch fixing highlighting for decorators +" Andrea Riciputi +" for the patch with new configuration options + +" +" Options: +" +" For set option do: let OPTION_NAME = 1 +" For clear option do: let OPTION_NAME = 0 +" +" Option names: +" +" For highlight builtin functions and objects: +" python_highlight_builtins +" +" For highlight builtin objects: +" python_highlight_builtin_objs +" +" For highlight builtin funtions: +" python_highlight_builtin_funcs +" +" For highlight standard exceptions: +" python_highlight_exceptions +" +" For highlight string formatting: +" python_highlight_string_formatting +" +" For highlight str.format syntax: +" python_highlight_string_format +" +" For highlight string.Template syntax: +" python_highlight_string_templates +" +" For highlight indentation errors: +" python_highlight_indent_errors +" +" For highlight trailing spaces: +" python_highlight_space_errors +" +" For highlight doc-tests: +" python_highlight_doctests +" +" If you want all Python highlightings above: +" python_highlight_all +" (This option not override previously set options) +" +" For fast machines: +" python_slow_sync +" +" For "print" builtin as function: +" python_print_as_function + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +if exists("python_highlight_all") && python_highlight_all != 0 + " Not override previously set options + if !exists("python_highlight_builtins") + if !exists("python_highlight_builtin_objs") + let python_highlight_builtin_objs = 1 + endif + if !exists("python_highlight_builtin_funcs") + let python_highlight_builtin_funcs = 1 + endif + endif + if !exists("python_highlight_exceptions") + let python_highlight_exceptions = 1 + endif + if !exists("python_highlight_string_formatting") + let python_highlight_string_formatting = 1 + endif + if !exists("python_highlight_string_format") + let python_highlight_string_format = 1 + endif + if !exists("python_highlight_string_templates") + let python_highlight_string_templates = 1 + endif + if !exists("python_highlight_indent_errors") + let python_highlight_indent_errors = 1 + endif + if !exists("python_highlight_space_errors") + let python_highlight_space_errors = 1 + endif + if !exists("python_highlight_doctests") + let python_highlight_doctests = 1 + endif +endif + +" Keywords +syn keyword pythonStatement break continue del +syn keyword pythonStatement exec return +syn keyword pythonStatement pass raise +syn keyword pythonStatement global assert +syn keyword pythonStatement lambda yield +syn keyword pythonStatement with +syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite +syn match pythonFunction "[a-zA-Z_][a-zA-Z0-9_]*" display contained +syn keyword pythonRepeat for while +syn keyword pythonConditional if elif else +syn keyword pythonPreCondit import from as +syn keyword pythonException try except finally +syn keyword pythonOperator and in is not or + +if !exists("python_print_as_function") || python_print_as_function == 0 + syn keyword pythonStatement print +endif + +" Decorators (new in Python 2.4) +syn match pythonDecorator "@" display nextgroup=pythonDottedName skipwhite +syn match pythonDottedName "[a-zA-Z_][a-zA-Z0-9_]*\(\.[a-zA-Z_][a-zA-Z0-9_]*\)*" display contained +syn match pythonDot "\." display containedin=pythonDottedName + +" Comments +syn match pythonComment "#.*$" display contains=pythonTodo,@Spell +syn match pythonRun "\%^#!.*$" +syn match pythonCoding "\%^.*\(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$" +syn keyword pythonTodo TODO FIXME XXX contained + +" Errors +syn match pythonError "\<\d\+\D\+\>" display +syn match pythonError "[$?]" display +syn match pythonError "[&|]\{2,}" display +syn match pythonError "[=]\{3,}" display + +" TODO: Mixing spaces and tabs also may be used for pretty formatting multiline +" statements. For now I don't know how to work around this. +if exists("python_highlight_indent_errors") && python_highlight_indent_errors != 0 + syn match pythonIndentError "^\s*\( \t\|\t \)\s*\S"me=e-1 display +endif + +" Trailing space errors +if exists("python_highlight_space_errors") && python_highlight_space_errors != 0 + syn match pythonSpaceError "\s\+$" display +endif + +" Strings +syn region pythonString start=+[bB]\='+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonEscape,pythonEscapeError,@Spell +syn region pythonString start=+[bB]\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonEscape,pythonEscapeError,@Spell +syn region pythonString start=+[bB]\="""+ end=+"""+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest2,pythonSpaceError,@Spell +syn region pythonString start=+[bB]\='''+ end=+'''+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest,pythonSpaceError,@Spell + +syn match pythonEscape +\\[abfnrtv'"\\]+ display contained +syn match pythonEscape "\\\o\o\=\o\=" display contained +syn match pythonEscapeError "\\\o\{,2}[89]" display contained +syn match pythonEscape "\\x\x\{2}" display contained +syn match pythonEscapeError "\\x\x\=\X" display contained +syn match pythonEscape "\\$" + +" Unicode strings +syn region pythonUniString start=+[uU]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,@Spell +syn region pythonUniString start=+[uU]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,@Spell +syn region pythonUniString start=+[uU]"""+ end=+"""+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell +syn region pythonUniString start=+[uU]'''+ end=+'''+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell + +syn match pythonUniEscape "\\u\x\{4}" display contained +syn match pythonUniEscapeError "\\u\x\{,3}\X" display contained +syn match pythonUniEscape "\\U\x\{8}" display contained +syn match pythonUniEscapeError "\\U\x\{,7}\X" display contained +syn match pythonUniEscape "\\N{[A-Z ]\+}" display contained +syn match pythonUniEscapeError "\\N{[^A-Z ]\+}" display contained + +" Raw strings +syn region pythonRawString start=+[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell +syn region pythonRawString start=+[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell +syn region pythonRawString start=+[rR]"""+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell +syn region pythonRawString start=+[rR]'''+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell + +syn match pythonRawEscape +\\['"]+ display transparent contained + +" Unicode raw strings +syn region pythonUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell +syn region pythonUniRawString start=+[uU][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell +syn region pythonUniRawString start=+[uU][rR]"""+ end=+"""+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest2,pythonSpaceError,@Spell +syn region pythonUniRawString start=+[uU][rR]'''+ end=+'''+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest,pythonSpaceError,@Spell + +syn match pythonUniRawEscape "\([^\\]\(\\\\\)*\)\@<=\\u\x\{4}" display contained +syn match pythonUniRawEscapeError "\([^\\]\(\\\\\)*\)\@<=\\u\x\{,3}\X" display contained + +if exists("python_highlight_string_formatting") && python_highlight_string_formatting != 0 + " String formatting + syn match pythonStrFormatting "%\(([^)]\+)\)\=[-#0 +]*\d*\(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString + syn match pythonStrFormatting "%[-#0 +]*\(\*\|\d\+\)\=\(\.\(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString +endif + +if exists("python_highlight_string_format") && python_highlight_string_format != 0 + " str.format syntax + syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString + syn match pythonStrFormat "{\([a-zA-Z_][a-zA-Z0-9_]*\|\d\+\)\(\.[a-zA-Z_][a-zA-Z0-9_]*\|\[\(\d\+\|[^!:\}]\+\)\]\)*\(![rs]\)\=\(:\({\([a-zA-Z_][a-zA-Z0-9_]*\|\d\+\)}\|\([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*\(\.\d\+\)\=[bcdeEfFgGnoxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString +endif + +if exists("python_highlight_string_templates") && python_highlight_string_templates != 0 + " String templates + syn match pythonStrTemplate "\$\$" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString + syn match pythonStrTemplate "\${[a-zA-Z_][a-zA-Z0-9_]*}" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString + syn match pythonStrTemplate "\$[a-zA-Z_][a-zA-Z0-9_]*" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString +endif + +if exists("python_highlight_doctests") && python_highlight_doctests != 0 + " DocTests + syn region pythonDocTest start="^\s*>>>" end=+'''+he=s-1 end="^\s*$" contained + syn region pythonDocTest2 start="^\s*>>>" end=+"""+he=s-1 end="^\s*$" contained +endif + +" Numbers (ints, longs, floats, complex) +syn match pythonHexError "\<0[xX]\x*[g-zG-Z]\x*[lL]\=\>" display + +syn match pythonHexNumber "\<0[xX]\x\+[lL]\=\>" display +syn match pythonOctNumber "\<0[oO]\o\+[lL]\=\>" display +syn match pythonBinNumber "\<0[bB][01]\+[lL]\=\>" display + +syn match pythonNumber "\<\d\+[lLjJ]\=\>" display + +syn match pythonFloat "\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>" display +syn match pythonFloat "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display +syn match pythonFloat "\<\d\+\.\d*\([eE][+-]\=\d\+\)\=[jJ]\=" display + +syn match pythonOctError "\<0[oO]\=\o*[8-9]\d*[lL]\=\>" display +syn match pythonBinError "\<0[bB][01]*[2-9]\d*[lL]\=\>" display + +if exists("python_highlight_builtin_objs") && python_highlight_builtin_objs != 0 + " Builtin objects and types + syn keyword pythonBuiltinObj True False Ellipsis None NotImplemented + syn keyword pythonBuiltinObj __debug__ __doc__ __file__ __name__ __package__ +endif + +if exists("python_highlight_builtin_funcs") && python_highlight_builtin_funcs != 0 + " Builtin functions + syn keyword pythonBuiltinFunc __import__ abs all any apply + syn keyword pythonBuiltinFunc basestring bin bool buffer bytearray bytes callable + syn keyword pythonBuiltinFunc chr classmethod cmp coerce compile complex + syn keyword pythonBuiltinFunc delattr dict dir divmod enumerate eval + syn keyword pythonBuiltinFunc execfile file filter float format frozenset getattr + syn keyword pythonBuiltinFunc globals hasattr hash help hex id + syn keyword pythonBuiltinFunc input int intern isinstance + syn keyword pythonBuiltinFunc issubclass iter len list locals long map max + syn keyword pythonBuiltinFunc min next object oct open ord + syn keyword pythonBuiltinFunc pow property range + syn keyword pythonBuiltinFunc raw_input reduce reload repr + syn keyword pythonBuiltinFunc reversed round set setattr + syn keyword pythonBuiltinFunc slice sorted staticmethod str sum super tuple + syn keyword pythonBuiltinFunc type unichr unicode vars xrange zip + + if exists("python_print_as_function") && python_print_as_function != 0 + syn keyword pythonBuiltinFunc print + endif +endif + +if exists("python_highlight_exceptions") && python_highlight_exceptions != 0 + " Builtin exceptions and warnings + syn keyword pythonExClass BaseException + syn keyword pythonExClass Exception StandardError ArithmeticError + syn keyword pythonExClass LookupError EnvironmentError + + syn keyword pythonExClass AssertionError AttributeError BufferError EOFError + syn keyword pythonExClass FloatingPointError GeneratorExit IOError + syn keyword pythonExClass ImportError IndexError KeyError + syn keyword pythonExClass KeyboardInterrupt MemoryError NameError + syn keyword pythonExClass NotImplementedError OSError OverflowError + syn keyword pythonExClass ReferenceError RuntimeError StopIteration + syn keyword pythonExClass SyntaxError IndentationError TabError + syn keyword pythonExClass SystemError SystemExit TypeError + syn keyword pythonExClass UnboundLocalError UnicodeError + syn keyword pythonExClass UnicodeEncodeError UnicodeDecodeError + syn keyword pythonExClass UnicodeTranslateError ValueError VMSError + syn keyword pythonExClass WindowsError ZeroDivisionError + + syn keyword pythonExClass Warning UserWarning BytesWarning DeprecationWarning + syn keyword pythonExClass PendingDepricationWarning SyntaxWarning + syn keyword pythonExClass RuntimeWarning FutureWarning + syn keyword pythonExClass ImportWarning UnicodeWarning +endif + +if exists("python_slow_sync") && python_slow_sync != 0 + syn sync minlines=2000 +else + " This is fast but code inside triple quoted strings screws it up. It + " is impossible to fix because the only way to know if you are inside a + " triple quoted string is to start from the beginning of the file. + syn sync match pythonSync grouphere NONE "):$" + syn sync maxlines=200 +endif + +if version >= 508 || !exists("did_python_syn_inits") + if version <= 508 + let did_python_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + HiLink pythonStatement Statement + HiLink pythonPreCondit Statement + HiLink pythonFunction Function + HiLink pythonConditional Conditional + HiLink pythonRepeat Repeat + HiLink pythonException Exception + HiLink pythonOperator Operator + + HiLink pythonDecorator Define + HiLink pythonDottedName Function + HiLink pythonDot Normal + + HiLink pythonComment Comment + HiLink pythonCoding Special + HiLink pythonRun Special + HiLink pythonTodo Todo + + HiLink pythonError Error + HiLink pythonIndentError Error + HiLink pythonSpaceError Error + + HiLink pythonString String + HiLink pythonUniString String + HiLink pythonRawString String + HiLink pythonUniRawString String + + HiLink pythonEscape Special + HiLink pythonEscapeError Error + HiLink pythonUniEscape Special + HiLink pythonUniEscapeError Error + HiLink pythonUniRawEscape Special + HiLink pythonUniRawEscapeError Error + + HiLink pythonStrFormatting Special + HiLink pythonStrFormat Special + HiLink pythonStrTemplate Special + + HiLink pythonDocTest Special + HiLink pythonDocTest2 Special + + HiLink pythonNumber Number + HiLink pythonHexNumber Number + HiLink pythonOctNumber Number + HiLink pythonBinNumber Number + HiLink pythonFloat Float + HiLink pythonOctError Error + HiLink pythonHexError Error + HiLink pythonBinError Error + + HiLink pythonBuiltinObj Structure + HiLink pythonBuiltinFunc Function + + HiLink pythonExClass Structure + + delcommand HiLink +endif + +let b:current_syntax = "python" diff --git a/vim/vim/syntax/tmux.vim b/vim/vim/syntax/tmux.vim new file mode 100644 index 0000000..58bceca --- /dev/null +++ b/vim/vim/syntax/tmux.vim @@ -0,0 +1,103 @@ +" Vim syntax file +" Language: tmux(1) configuration file +" Maintainer: Tiago Cunha +" Last Change: $Date: 2010/07/02 02:46:39 $ +" License: This file is placed in the public domain. + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +setlocal iskeyword+=- +syntax case match + +syn keyword tmuxAction any current none +syn keyword tmuxBoolean off on + +syn keyword tmuxCmds detach[-client] ls list-sessions neww new-window +syn keyword tmuxCmds bind[-key] unbind[-key] prev[ious-window] last[-window] +syn keyword tmuxCmds lsk list-keys set[-option] renamew rename-window selectw +syn keyword tmuxCmds select-window lsw list-windows attach[-session] +syn keyword tmuxCmds send-prefix refresh[-client] killw kill-window lsc +syn keyword tmuxCmds list-clients linkw link-window unlinkw unlink-window +syn keyword tmuxCmds next[-window] send[-keys] swapw swap-window +syn keyword tmuxCmds rename[-session] kill-session switchc switch-client +syn keyword tmuxCmds has[-session] copy-mode pasteb paste-buffer +syn keyword tmuxCmds new[-session] start[-server] kill-server setw +syn keyword tmuxCmds set-window-option show[-options] showw show-window-options +syn keyword tmuxCmds command-prompt setb set-buffer showb show-buffer lsb +syn keyword tmuxCmds list-buffers deleteb delete-buffer lscm list-commands +syn keyword tmuxCmds movew move-window respawnw respawn-window +syn keyword tmuxCmds source[-file] info server-info clock-mode lock[-server] +syn keyword tmuxCmds saveb save-buffer downp down-pane killp +syn keyword tmuxCmds kill-pane resizep resize-pane selectp select-pane swapp +syn keyword tmuxCmds swap-pane splitw split-window upp up-pane choose-session +syn keyword tmuxCmds choose-window loadb load-buffer copyb copy-buffer suspendc +syn keyword tmuxCmds suspend-client findw find-window breakp break-pane nextl +syn keyword tmuxCmds next-layout rotatew rotate-window confirm[-before] +syn keyword tmuxCmds clearhist clear-history selectl select-layout if[-shell] +syn keyword tmuxCmds display[-message] setenv set-environment showenv +syn keyword tmuxCmds show-environment choose-client displayp display-panes +syn keyword tmuxCmds run[-shell] lockc lock-client locks lock-session lsp +syn keyword tmuxCmds list-panes pipep pipe-pane showmsgs show-messages capturep +syn keyword tmuxCmds capture-pane joinp join-pane choose-buffer + +syn keyword tmuxOptsSet prefix status status-fg status-bg bell-action +syn keyword tmuxOptsSet default-command history-limit status-left status-right +syn keyword tmuxOptsSet status-interval set-titles display-time buffer-limit +syn keyword tmuxOptsSet status-left-length status-right-length message-fg +syn keyword tmuxOptsSet message-bg lock-after-time default-path repeat-time +syn keyword tmuxOptsSet message-attr status-attr status-keys set-remain-on-exit +syn keyword tmuxOptsSet status-utf8 default-terminal visual-activity +syn keyword tmuxOptsSet visual-bell visual-content status-justify +syn keyword tmuxOptsSet terminal-overrides status-left-attr status-left-bg +syn keyword tmuxOptsSet status-left-fg status-right-attr status-right-bg +syn keyword tmuxOptsSet status-right-fg update-environment base-index +syn keyword tmuxOptsSet display-panes-colour display-panes-time default-shell +syn keyword tmuxOptsSet set-titles-string lock-command lock-server +syn keyword tmuxOptsSet mouse-select-pane message-limit quiet escape-time +syn keyword tmuxOptsSet pane-active-border-bg pane-active-border-fg +syn keyword tmuxOptsSet pane-border-bg pane-border-fg +syn keyword tmuxOptsSet display-panes-active-colour alternate-screen +syn keyword tmuxOptsSet detach-on-destroy + +syn keyword tmuxOptsSetw monitor-activity aggressive-resize force-width +syn keyword tmuxOptsSetw force-height remain-on-exit uft8 mode-fg mode-bg +syn keyword tmuxOptsSetw mode-keys clock-mode-colour clock-mode-style +syn keyword tmuxOptsSetw xterm-keys mode-attr window-status-attr +syn keyword tmuxOptsSetw window-status-bg window-status-fg automatic-rename +syn keyword tmuxOptsSetw main-pane-width main-pane-height monitor-content +syn keyword tmuxOptsSetw window-status-current-attr window-status-current-bg +syn keyword tmuxOptsSetw window-status-current-fg mode-mouse synchronize-panes +syn keyword tmuxOptsSetw window-status-format window-status-current-format +syn keyword tmuxOptsSetw word-separators + +syn keyword tmuxTodo FIXME NOTE TODO XXX contained + +syn match tmuxKey /\(C-\|M-\|\^\)\p/ display +syn match tmuxNumber /\d\+/ display +syn match tmuxOptions /\s-\a\+/ display +syn match tmuxVariable /\w\+=/ display +syn match tmuxVariableExpansion /\${\=\w\+}\=/ display + +syn region tmuxComment start=/#/ end=/$/ contains=tmuxTodo display oneline +syn region tmuxString start=/"/ end=/"/ display oneline +syn region tmuxString start=/'/ end=/'/ display oneline + +hi def link tmuxAction Boolean +hi def link tmuxBoolean Boolean +hi def link tmuxCmds Keyword +hi def link tmuxComment Comment +hi def link tmuxKey Special +hi def link tmuxNumber Number +hi def link tmuxOptions Identifier +hi def link tmuxOptsSet Function +hi def link tmuxOptsSetw Function +hi def link tmuxString String +hi def link tmuxTodo Todo +hi def link tmuxVariable Constant +hi def link tmuxVariableExpansion Constant + +let b:current_syntax = "tmux" diff --git a/vim/vim/syntax/vimperator.vim b/vim/vim/syntax/vimperator.vim new file mode 100644 index 0000000..ad73c87 --- /dev/null +++ b/vim/vim/syntax/vimperator.vim @@ -0,0 +1,75 @@ +" Vim syntax file +" Language: VIMperator configuration file +" Maintainer: Doug Kearns +" Latest Revision: 2008 August 19 + +if exists("b:current_syntax") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +syn include @javascriptTop syntax/javascript.vim +unlet b:current_syntax + +syn keyword vimperatorTodo FIXME NOTE TODO XXX contained +syn match vimperatorComment +".*$+ contains=vimperatorTodo,@Spell + +syn region vimperatorString start="\z(["']\)" end="\z1" skip="\\\\\|\\\z1" oneline + +syn match vimperatorLineComment +^\s*".*$+ contains=vimperatorTodo,@Spell + +syn keyword vimperatorCommand ab[breviate] ab[clear] addo[ns] au[tocmd] b[uffer] ba[ck] bd[elete] beep bma[rk] bmarks buffers + \ bun[load] bw[ipeout] ca[bbrev] cabc[lear] cd cuna[bbrev] cm[ap] cmapc[lear] cno[remap] comc[lear] com[mand] cu[nmap] + \ delbm[arks] delc[ommand] delmac[ros] delm[arks] delqm[arks] dia[log] dl downl[oads] e[dit] ec[ho] echoe[rr] em[enu] + \ exe[cute] exu[sage] files fo[rward] fw h[elp] ha[rdcopy] hist[ory] hs ia[bbrev] iabc[lear] im[ap] imapc[lear] ino[remap] + \ iuna[bbrev] iu[nmap] javas[cript] ju[mps] js let ls macros ma[rk] map mapc[lear] marks mkv[imperatorrc] no[remap] + \ noh[lsearch] norm[al] o[pen] pa[geinfo] pagest[yle] pc[lose] pl[ay] pref[erences] prefs pwd q[uit] qa[ll] qma[rk] qmarks + \ quita[ll] re[draw] re[load] reloada[ll] res[tart] run sav[eas] sb[ar] sb[open] sbcl[ose] se[t] setg[lobal] setl[ocal] + \ sideb[ar] so[urce] st[op] tN[ext] t[open] tab tabd[uplicate] tabN[ext] tabc[lose] tabe[dit] tabfir[st] tabl[ast] tabm[ove] + \ tabn[ext] tabnew tabo[nly] tabopen tabp[revious] tabr[ewind] tabs time tn[ext] tp[revious] u[ndo] una[bbreviate] undoa[ll] + \ unl[et] unm[ap] ve[rsion] vie[wsource] viu[sage] w[rite] wc[lose] win[open] winc[lose] wine[dit] wo[pen] wqa[ll] wq xa[ll] + \ zo[om] + \ contained + +syn match vimperatorCommand "!" contained + +" FIXME +syn match vimperatorCommandWrapper "\%(^\s*:\=\)\@<=\%(!\|\h\w*\>\)" contains=vimperatorCommand + +syn region vimperatorSet matchgroup=vimperatorCommand start="\%(^\s*:\=\)\@<=\" end="$" keepend oneline contains=vimperatorOption +syn keyword vimperatorOption activate act activelinkfgcolor alfc activelinkbgcolor albc complete cpt defsearch ds editor + \ extendedhinttags eht focuscontent fc nofocuscontent nofc fullscreen fs nofullscreen nofs guioptions go hintmatching hm + \ hintstyle hs hinttags ht hinttimeout hto history hi hlsearch hls nohlsearch nohls hlsearchstyle hlss incsearch is + \ noincsearch nois ignorecase ic noignorecase noic insertmode im noinsertmode noim laststatus ls linkbgcolor lbc linkfgcolor + \ lfc linksearch lks nolinksearch nolks more newtab nextpattern nomore pageinfo pa popups pps preload nopreload previewheight + \ pvh previouspattern online noonline scroll scr shell sh shellcmdflag shcf showmode smd noshowmode nosmd showstatuslinks ssli + \ showtabline stal smartcase scs nosmartcase noscs suggestengines titlestring usermode um nousermode noum urlseparator verbose + \ vbs visualbell vb novisualbell novb visualbellstyle wildmode wim wildoptions wop wordseparators wsp + \ contained + +syn region vimperatorJavascript start="\%(^\s*\%(javascript\|js\)\s\+\)\@<=" end="$" contains=@javascriptTop keepend oneline +syn region vimperatorJavascript matchgroup=vimperatorJavascriptDelimiter + \ start="\%(^\s*\%(javascript\|js\)\s\+\)\@<=<<\z(\h\w*\)"hs=s+2 end="^\z1$" contains=@javascriptTop fold + +syn region vimperatorMap matchgroup=vimperatorCommand start="\%(^\s*:\=\)\@<=\" end="$" keepend oneline contains=vimperatorKeySym + +syn match vimperatorKeySym "<[0-9A-Za-z-]\+>" + +" Note: match vim.vim highlighting groups +hi def link vimperatorCommand Statement +hi def link vimperatorComment Comment +hi def link vimperatorJavascriptDelimiter Delimiter +hi def link vimperatorKeySym Special +hi def link vimperatorLineComment Comment +hi def link vimperatorOption PreProc +hi def link vimperatorString String +hi def link vimperatorTodo Todo + +let b:current_syntax = "vimperator" + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: tw=130 et ts=4 sw=4: diff --git a/vim/vimrc b/vim/vimrc new file mode 100644 index 0000000..e8f19ff --- /dev/null +++ b/vim/vimrc @@ -0,0 +1,1112 @@ +" Vim main configuration file. + +" Copyright (C) 2008-2016 Simon Ruderich +" +" This file 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 file is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this file. If not, see . + + +" EDITOR SETTINGS + +" Save 'runtimepath' in case it was changed by the system's configuration +" files. Also save 'diff' as set all& resets it; but somehow later (after +" sourcing the vimrc - for example in a VimEnter autocmd) it gets +" automagically restored to the correct value. Not sure what exactly Vim is +" doing there. +if has('eval') + let s:save_runtimepath = &runtimepath + let s:save_diff = &diff +endif +" Reset all options (except 'term', 'lines' and 'columns'). This makes sure a +" system wide configuration file doesn't change default values. +set all& +" And restore it after all other options were reset. +if has('eval') + let &runtimepath = s:save_runtimepath + let &diff = s:save_diff + unlet s:save_runtimepath + unlet s:save_diff +endif + +" Make sure Vim (and not Vi) settings are used. +set nocompatible + +" Disallow :autocmd, shell and write commands in .vimrc and .exrc files in the +" current directory. Only used if 'exrc' is enabled (off by default), +" precaution just in case somebody enables 'exrc'. +set secure + +" Try to use pipes instead of temporary files. Prevents some auto commands +" from running for temporary files but also prevents the file's content to be +" written to disk. +set noshelltemp + +" Use UTF-8 for all internal data (buffers, registers, etc.). This doesn't +" affect reading files in different encodings, see 'fileencodings' for that. +set encoding=utf-8 + +" Load my scripts from ~/.vim (my scripts) and ~/.vim/runtime (checkout of Vim +" runtime files) if available. +set runtimepath-=~/.vim +set runtimepath^=~/.vim,~/.vim/runtime + +" Don't store swap files in the same directory as the edited file, but only if +" we have a "safe" writable directory available. +if filewritable('~/.tmp') == 2 || filewritable('~/tmp') == 2 + set directory-=. +endif +" But store them in ~/.tmp or ~/tmp (already set by default) if available. +set directory^=~/.tmp +" Never use /tmp which gets cleaned on reboot. +set directory-=/tmp + +" Disable modelines as they may cause security problems. Instead use +" securemodelines (Vim script #1876). +set nomodeline + +" Complete to longest common string (list:longest) and then complete all full +" matches after another (full). Thanks to pbrisbin +" (http://pbrisbin.com:8080/dotfiles/vimrc). +set wildmode=list:longest,full +" Ignore case when completing files/directories. +if exists('+wildignorecase') + set wildignorecase +endif + +" Ignore files with the following extensions because I almost never want to +" edit them in Vim (specifying them manually still works of course). +set wildignore= +" C +set wildignore+=*.o,*.d,*.so +" Java +set wildignore+=*.class +" LaTeX +set wildignore+=*.aux,*.log,*.out,*.toc,*.pdf +" Python +set wildignore+=*.pyc + +" Show completion menu even if only one entry matches. +if exists('+completeopt') + set completeopt+=menuone +endif + +" Increase history of executed commands (:) and search patterns (/). +set history=1000 + +" Increase number of possible undos. +set undolevels=1000 + +" Remember marks (including the last cursor position) for more files. ^= is +" necessary because 'viminfo' is parsed from the beginning and the first match +" is used. +if has('viminfo') + set viminfo^='1000 +endif + +" Use strong encryption if possible, also used for swap/undo files. +if exists('+cryptmethod') + set cryptmethod=blowfish +endif + +" Clear all vimrc-related autocmds. Has to be done here as the vimrc augroup +" is used multiple times. Necessary to support reloading the vimrc. +if has('autocmd') + augroup vimrc + autocmd! + augroup END +endif + + +" HELPER FUNCTIONS + +if has('eval') +" Check if the given syntax group is available. Thanks to bairui in #vim on +" Freenode (2012-02-19 01:15 CET) for the try/catch silent highlight idea. + function! s:HasSyntaxGroup(group) + try + execute 'silent highlight ' . a:group + " \a = [A-Za-z] + catch /^Vim\%((\a\+)\)\=:E411/ " 'highlight group not found' + return 0 + endtry + return 1 + endfunction + +" Check if the given Vim version and patch is available. + function! s:HasVersionAndPatch(version, patch) + return v:version > a:version + \ || (v:version == a:version && has('patch' . a:patch)) + endfunction +endif + + +" TERMINAL SETTINGS + +" Also enable fast terminal mode in GNU screen and tmux, but not for SSH +" connections. +if &term =~# '^screen' && !exists('$SSH_CONNECTION') + set ttyfast +endif + + +" EDIT SETTINGS + +" Enable automatic file detection, plugin and indention support. +if has('autocmd') + filetype off " necessary for pathogen to force a reload of ftplugins + filetype plugin indent on +endif + +" Use UTF-8 file encoding for all files. Automatically recognize latin1 in +" existing files. +set fileencodings=utf-8,latin1 + +" Always use unix line-endings for new files. DOS line endings in existing +" files are recognized. +set fileformats=unix,dos + +" Wrap text after 78 characters. +set textwidth=78 + +" Set tabs to 4 spaces, use softtabs. +set shiftwidth=4 +set softtabstop=4 +set expandtab +" When < and > is used indent/deindent to the next 'shiftwidth' boundary. +set shiftround +" Use the default value for real tabs. +set tabstop=8 + +" Enable auto indention. +set autoindent + +" When joining lines only add one space after a sentence. +set nojoinspaces + +" Allow backspacing over autoindent and line breaks. +set backspace=indent,eol + +" Start a comment when hitting enter after a commented line (r) and when using +" o or O around a commented line (o). +set formatoptions+=ro +" Don't break a line if was already longer then 'textwidth' when insert mode +" started. +set formatoptions+=l +" Remove comment leader when joining lines where it makes sense. +if s:HasVersionAndPatch(703, 541) + set formatoptions+=j +endif + +" Allow virtual editing (cursor can be positioned anywhere, even when there is +" no character) in visual block mode. +set virtualedit=block + +" Already display matches while typing the search command. This makes spotting +" typos easy and searching faster. +set incsearch + +" Activate syntax folding. +if has('folding') + set foldmethod=syntax + " Only use fold column if we have enough space (for example not in a + " (virtual) terminal which has only 80 columns). + if &columns > 80 + set foldcolumn=2 + endif + set foldlevel=99 " no closed folds at default, 'foldenable' would disable + " folding which is not what I want + " Don't open folds for block movements like '(', '{', '[[', '[{', etc. + set foldopen-=block +endif + +" Only check case if the searched word contains a capital character. +set ignorecase +set smartcase + +" Activate spell checking, use English as default. +if exists('+spell') && has('syntax') + " But not when diffing because spell checking is distracting in this case. + if !&diff + set spell + endif + set spelllang=en_us +endif + +" Allow buffers with changes to be hidden. Very important for efficient +" editing with multiple buffers. Prevents the "E37: No write since last change +" (add ! to override)" warning when switching modified buffers. +set hidden + +" When splitting vertically put the new window right of the current one. +if has('vertsplit') + set splitright +endif + + +" DISPLAY SETTINGS + +" Use a dark background. Doesn't change the background color, only sets text +" colors for a dark terminal. +set background=dark + +" Use my color scheme if 256 colors are available. +if &t_Co == 256 || has('gui_running') + colorscheme simon +endif + +" Display line numbers. +set number +" But use as little space as possible for the numbers column. Thanks to James +" Vega (http://git.jamessan.com/?p=etc/vim.git;a=summary). +if exists('+numberwidth') + set numberwidth=1 +endif +" Display the ruler with current line/file position. If 'statusline' is used, +" then this only affects . +set ruler +" Display partial commands in the status line. +set showcmd + +" Don't redraw screen when executing macros; increases speed. Thanks to James +" Vega (http://git.jamessan.com/?p=etc/vim.git;a=summary). +set lazyredraw + +" Visualize the line the cursor is currently in. +if exists('+cursorline') + set cursorline +endif + +" Highlight all matches on the screen when searching. Use (see below) to +" remove the highlighting until the next search. +set hlsearch + +" Display some special characters. +set list +set listchars= +" Display tabs as ">--------". +set listchars+=tab:>- +" Display trailing whitespace as "-". +set listchars+=trail:- +" Display markers for long lines when wrapping is disabled. +set listchars+=extends:>,precedes:< +" Display non-breakable space as "!". +if v:version >= 700 + set listchars+=nbsp:! +endif + +" Don't draw the vertical split separator by using space as character. Thanks +" to scp1 in #vim on Freenode (2012-06-16 16:12 CEST) for the idea to use a +" non-breakable space. But a simple space works as well, as long as the +" current color scheme is not reset. +if has('windows') && has('folding') + set fillchars+=vert:\ " comment to prevent trailing whitespace +endif + +if has('statusline') + " Always display the status line even if there is only one window. + set laststatus=2 + + " If there's more than one buffer return "/" (e.g. "/05") where + " is the highest buffer number, otherwise return nothing. Used in + " 'statusline' to get an overview of available buffer numbers. + function! s:StatuslineBufferCount() + let l:bufnr = bufnr('$') + if l:bufnr > 1 + let l:result = '/' + if exists('*printf') + let l:result .= printf('%02d', l:bufnr) + else + " Older Vims don't have printf() (and no .= either). Emulate + " "%02d". + if l:bufnr < 10 + let l:result = l:result . '0' + endif + let l:result = l:result . l:bufnr + endif + return l:result + else + return '' + endif + endfunction + + " Like %f but use relative filename if it's shorter than the absolute path + " (e.g. '../../file' vs. '~/long/path/to/file'). fnamemodify()'s ':.' is + " not enough because it doesn't create '../'s. + function! s:StatuslineRelativeFilename() + " Display only filename for help files. + if &buftype == 'help' + return expand('%:t') + endif + " Special case for scratch files. + if &buftype == 'nofile' + return '[Scratch]' + endif + + let l:path = expand('%') + " No file. + if l:path == '' + return '[No Name]' + endif + " Path is already relative, nothing to do. + if stridx(l:path, '/') != 0 + return l:path + endif + + " Absolute path to this file. + let l:path = expand('%:p') + " Shortened path to this file, thanks to bairui in #vim on Freenode + " (2012-06-23 00:54) for the tip to use fnamemodify(). This is what + " Vim normally uses as %f (minus some exceptions). + let l:original_path = fnamemodify(l:path, ':~') + " Absolute path to the current working directory. + let l:cwd = getcwd() + + " Working directory completely contained in path, replace it with a + " relative path. Happens for example when opening a file with netrw. + " %f displays this as absolute path, but we want a relative path of + " course. + if stridx(l:path, l:cwd) == 0 + return strpart(l:path, strlen(l:cwd) + 1) + endif + + let l:path_list = split(l:path, '/') + let l:cwd_list = split(l:cwd, '/') + + " Remove the common path. + while l:path_list[0] == l:cwd_list[0] + call remove(l:path_list, 0) + call remove(l:cwd_list, 0) + endwhile + + " Add as many '..' as necessary for the relative path and join the + " path. Thanks to Raimondi in #vim on Freenode (2012-06-23 01:13) for + " the hint to use repeat() instead of a loop. + let l:path = repeat('../', len(l:cwd_list)) . join(l:path_list, '/') + + " Use the shorter path, either relative or absolute. + if strlen(l:path) < strlen(l:original_path) + return l:path + else + return l:original_path + endif + endfunction + + " Display unexpected 'fileformat', 'fileencoding' and 'bomb' settings. + function! s:StatuslineFileFormat() + if &fileformat != 'unix' + return '[' . &fileformat . ']' + else + return '' + endif + endfunction + function! s:StatuslineFileEncoding() + if &fileencoding != '' && &fileencoding != 'utf-8' + \ && &filetype != 'help' + return '[' . &fileencoding . ']' + else + return '' + endif + endfunction + function! s:StatuslineFileBOMB() + if exists('+bomb') && &bomb + return '[BOM]' + else + return '' + endif + endfunction + + " Return current syntax group in brackets or nothing if there's none. + function! s:StatuslineSyntaxGroup() + let l:group = synIDattr(synID(line('.'), col('.'), 1), 'name') + if l:group != '' + return '[' . l:group . '] ' + else + return '' + endif + endfunction + + " Short function names to make 'statusline' more readable. + function! SBC() + return s:StatuslineBufferCount() + endfunction + function! SRF() + return s:StatuslineRelativeFilename() + endfunction + function! SFF() + return s:StatuslineFileFormat() + endfunction + function! SFE() + return s:StatuslineFileEncoding() + endfunction + function! SFB() + return s:StatuslineFileBOMB() + endfunction + function! SSG() + return s:StatuslineSyntaxGroup() + endfunction + + set statusline= + " on the left + set statusline+=%02n " buffer number + set statusline+=%{SBC()} " highest buffer number + set statusline+=: + if has('modify_fname') && v:version >= 700 " some functions need 7.0 + set statusline+=%{SRF()} " path to current file + else + set statusline+=%f " path to current file in buffer + endif + set statusline+=\ " space after path + set statusline+=%h " [help] if buffer is help file + set statusline+=%w " [Preview] if buffer is preview buffer + set statusline+=%m " [+] if buffer was modified, + " [-] if 'modifiable' is off + set statusline+=%r " [RO] if buffer is read only + if v:version >= 700 " %#..# needs 7.0 + set statusline+=%#Error# " display warnings + set statusline+=%{SFF()} " - unexpected file format + set statusline+=%{SFE()} " - unexpected file encoding + set statusline+=%{SFB()} " - unexpected file byte order mask + set statusline+=%## " continue with normal colors + endif + + " on the right + set statusline+=%= " right align + set statusline+=0x%-8B\ " current character under cursor as hex + set statusline+=%-12.(%l,%c%V%)\ " line number (%l), + " column number (%c), + " virtual column number if different + " than %c (%V) + set statusline+=%P " position in file in percent +endif + + +" MAPPINGS (except for plugins, see PLUGIN SETTINGS below) + +" noremap is used to make sure the right side is executed as is and can't be +" modified by a plugin or other settings. Except for which isn't +" affected by mappings. + +" Easy way to exit insert mode (jj is too slow). +inoremap jk +" Also for command mode, thanks to http://github.com/mitechie/pyvim +" (2010-10-15). +cnoremap jk +" And fix my typos ... +inoremap JK +inoremap Jk +inoremap jK +cnoremap JK +cnoremap Jk +cnoremap jK + +" Disable arrow keys for all modes except command modes. Thanks to James Vega +" (http://git.jamessan.com/?p=etc/vim.git;a=summary). +map +map +map +map +imap +imap +imap +imap +" Also disable arrow keys in command mode, use / as replacement (see +" below). +cmap +cmap +cmap +cmap + +" Use / as replacement for / in command mode. Thanks to +" abstrakt and grayw in #vim on Freenode (2010-04-12 21:20 CEST). +cnoremap +cnoremap + +" Use :tjump to lookup tags (instead of :tag) which lists all available tags +" if there's more than one match. This is really helpful in larger projects +" where tags may occur multiple times. +nnoremap g + +if has('eval') +" Don't move the cursor to the first column for certain scroll commands (, , ). Thanks to jamessan in #vim on Freenode (2011-08-31 +" 02:27 CEST) for the 'nostartofline' tip. But I can't use 'nostartofline' +" directly because it also enables that feature for other commands which I +" don't want. + + " Set 'nostartofline' for a single movement. + function! s:TemporaryNostartofline(movement) + let l:startofline = &startofline + set nostartofline + execute 'normal! ' . a:movement + let &startofline = l:startofline + endfunction + + " Thanks to fow in #vim on Freenode (2012-02-16 15:38 CET) for the idea to + " use ""; Vim documentation reference: :help <>. + nnoremap + \ :call TemporaryNostartofline("C-F>") + nnoremap + \ :call TemporaryNostartofline("C-B>") + nnoremap + \ :call TemporaryNostartofline("C-D>") + nnoremap + \ :call TemporaryNostartofline("C-U>") +endif + +" Let Y yank to the end of the line, similar to D and C. Use yy if you want to +" yank a line. This fixes a weird inconsistency in Vi(m). +nnoremap Y y$ + +" Write before suspending, thanks to deryni in #vim on Freenode (2011-05-09 +" 20:02 CEST). To suspend without saving either unmap this or use :stop. +" Only the current buffer is written, thus switching to another buffer works +" too. +nnoremap :update:stop + +" 2 gives more verbose information, use it by default. Thanks to NCS_One +" in #vim on Freenode (2011-08-15 00:17 CEST). +nnoremap 2 + +" Use to move down a page and - to move up one like in mutt. Don't use +" nnoremap so the / 'nostartofline' fix (see above) works. +nmap +nmap - + +" Go to next and previous buffer. Thanks to elik in #vim on Freenode +" (2010-05-16 18:38 CEST) for this idea. +nnoremap gb :bnext +nnoremap gB :bprevious +if has('eval') + " But when starting again at the first buffer, print a warning which + " reminds me that I've already seen that buffer. + function! s:NextBuffer() + " Are we currently on the last buffer and moving to the first? + let l:last_buffer = 0 + if bufnr('%') == bufnr('$') && bufnr('$') > 1 + let l:last_buffer = 1 + endif + + " Go to the next buffer. + if !l:last_buffer + bnext + + " Go to the first buffer, silent is necessary or the following message + " won't be displayed because it's overwritten by the status message + " displayed when entering a buffer. + else + silent bnext + + echohl WarningMsg + echo 'Starting again at first buffer.' + echohl None + endif + endfunction + nnoremap gb :call NextBuffer() +endif + +" Fast access to buffers. +nnoremap 1 :1buffer +nnoremap 2 :2buffer +nnoremap 3 :3buffer +nnoremap 4 :4buffer +nnoremap 5 :5buffer +nnoremap 6 :6buffer +nnoremap 7 :7buffer +nnoremap 8 :8buffer +nnoremap 9 :9buffer +nnoremap 0 :10buffer + +" Use real tabs instead of soft tabs. +if has('eval') +" Switch from soft tabs to real tabs. + function! s:UseTabs() + setlocal noexpandtab shiftwidth=8 softtabstop=8 + endfunction + nnoremap t :call UseTabs() +endif +" Enable "verbatim" mode. Used to view files with long lines or without syntax +" coloring. 'list' is not changed, see next mapping. +nnoremap v :setlocal nowrap nospell synmaxcol=0 + \ :2match +" Toggle 'list'. +nnoremap l :set invlist + +" Make last active window the only window. Similar to o. +nnoremap O po + +" Maps to change spell language between English and German and disable spell +" checking. +if exists('+spell') + nnoremap sn :set nospell + nnoremap se :set spell spelllang=en_us + nnoremap sd :set spell spelllang=de_de +" If no spell support is available, these mappings do nothing. +else + nmap sn + nmap se + nmap sd +endif + +if has('eval') +" * and # for selections in visual mode. Thanks to +" http://got-ravings.blogspot.com/2008/07/vim-pr0n-visual-search-mappings.html +" and all nerds involved (godlygeek, strull in #vim on Freenode). + function! s:VSetSearch() + let l:temp = @@ " unnamed register + normal! gvy + " Added \C to force 'noignorecase' while searching the current visual + " selection. I want to search for the exact string in this case. + let @/ = '\C' . '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g') + let @@ = l:temp + endfunction + vnoremap * :call VSetSearch()// + vnoremap # :call VSetSearch()?? + +" Use 'noignorecase' for * and #. See comment in s:VSetSearch() for details. +" Thanks to the writers of s:VSetSearch(), see above. + function! s:NSetSearch() + let l:cword = expand('') + let l:regex = substitute(escape(l:cword, '\'), '\n', '\\n', 'g') + let @/ = '\C\V'. '\<' . l:regex . '\>' + endfunction + nnoremap * :call NSetSearch()// + nnoremap # :call NSetSearch()?? +endif + +" I often type "W" instead of "w" when trying to save a file. Fix my mistake. +" Thanks to Tony Mechelynck from the Vim +" mailing list for the commands. +if v:version < 700 + cnoreabbrev W w + cnoreabbrev Wa wa + cnoreabbrev Wq wq + cnoreabbrev Wqa wqa +else + cnoreabbrev W + \ ((getcmdtype() == ':' && getcmdpos() <= 2) ? 'w' : 'W') + cnoreabbrev Wa + \ ((getcmdtype() == ':' && getcmdpos() <= 3) ? 'wa' : 'Wa') + cnoreabbrev Wq + \ ((getcmdtype() == ':' && getcmdpos() <= 3) ? 'wq' : 'Wq') + cnoreabbrev Wqa + \ ((getcmdtype() == ':' && getcmdpos() <= 4) ? 'wqa' : 'Wqa') +endif +" Also fix my typo with "Q". +if v:version < 700 + cnoreabbrev Q q + cnoreabbrev Qa qa +else + cnoreabbrev Q + \ ((getcmdtype() == ':' && getcmdpos() <= 2) ? 'q' : 'Q') + cnoreabbrev Qa + \ ((getcmdtype() == ':' && getcmdpos() <= 3) ? 'qa' : 'Qa') +endif + +" In case 'hlsearch' is used disable it with . Thanks to frogonwheels and +" vimgor (bot) in #vim on Freenode (2010-03-30 05:58 CEST). +nnoremap :nohlsearch + +" in insert mode deletes a lot, break undo sequence before deleting the +" line so the change can be undone. Thanks to the vimrc_example.vim file in +" Vim's source. +inoremap u +" Same for (insert previously inserted text and leave insert mode). +inoremap u +" And for (insert previously inserted text). +inoremap u +" And for (delete word before cursor). +inoremap u + +if has('eval') +" New text-objects ii and ai to work on text with the same indentation. Thanks +" to http://vim.wikia.com/index.php?title=Indent_text_object&oldid=27126 +" (visited on 2011-11-19). + onoremap ai :call IndTxtObj(0) + onoremap ii :call IndTxtObj(1) + vnoremap ai :call IndTxtObj(0)gv + vnoremap ii :call IndTxtObj(1)gv + + function! s:IndTxtObj(inner) + let curline = line(".") + let lastline = line("$") + let i = indent(line(".")) - &shiftwidth * (v:count1 - 1) + let i = i < 0 ? 0 : i + if getline(".") !~ "^\\s*$" + let p = line(".") - 1 + let nextblank = getline(p) =~ "^\\s*$" + while p > 0 + \ && ((i == 0 && !nextblank) + \ || (i > 0 && ((indent(p) >= i + \ && !(nextblank && a:inner)) + \ || (nextblank && !a:inner)))) + - + let p = line(".") - 1 + let nextblank = getline(p) =~ "^\\s*$" + endwhile + normal! 0V + call cursor(curline, 0) + let p = line(".") + 1 + let nextblank = getline(p) =~ "^\\s*$" + while p <= lastline + \ && ((i == 0 && !nextblank) + \ || (i > 0 && ((indent(p) >= i + \ && !(nextblank && a:inner)) + \ || (nextblank && !a:inner)))) + + + let p = line(".") + 1 + let nextblank = getline(p) =~ "^\\s*$" + endwhile + normal! $ + endif + endfunction +endif + + +" ABBREVIATIONS + +" Fix some of my spelling mistakes (German). +inoreabbrev relle reelle +inoreabbrev reele reelle +" Fix some of my spelling mistakes (English). +inoreabbrev completly completely + + +" SYNTAX SETTINGS + +" Activate syntax coloring. +if has('syntax') + " But only if it wasn't already active. Prevents breaking the syntax + " coloring when reloading the vimrc. Thanks to johnLate for the idea. + if !exists('g:syntax_on') + syntax enable + endif + +" Don't highlight more than 500 columns as I normally don't have that long +" lines and they slow down syntax coloring. Thanks to Derek Wyatt +" (http://www.derekwyatt.org/vim/the-vimrc-file/). + if exists('+synmaxcol') + set synmaxcol=500 + endif + +" Use (limited) syntax based omni completion if no other omni completion is +" available. Taken from :help ft-syntax-omni. + if has('autocmd') && exists('+omnifunc') + augroup vimrc + autocmd FileType * + \ if &omnifunc == '' | + \ setlocal omnifunc=syntaxcomplete#Complete | + \ endif + augroup END + endif + +" Function to enable all custom highlights. Necessary as highlights are +" window-local and thus must be set for each new window. + function! s:CustomSyntaxHighlights() + " Not the first time called, nothing to do. + if exists('w:vimrc_syntax_run') + return + endif + let w:vimrc_syntax_run = 1 + +" Highlight lines longer than 78 characters. Thanks to Tony Mechelynck +" from the Vim mailing list. It can easily be +" disabled when necessary with :2match (in Vim >= 700). + if !&diff && exists(':2match') + " Use ColorColumn for overlong lines if available and my color + " scheme is used. + if &t_Co == 256 && s:HasSyntaxGroup('ColorColumn') + 2match ColorColumn /\%>78v./ + else + 2match Todo /\%>78v./ + endif + elseif !&diff + match Todo /\%>78v./ + endif + + if exists('*matchadd') +" Highlight some important keywords in all documents. + let l:todos = ['TODO', 'XXX', 'FIXME', 'NOTE', + \ 'CHANGED', 'REMOVED', 'DELETED'] + " Compatibility fix for Vim 6.4 which can't parse for in functions + " (without function it's ignored). + execute ' for l:x in l:todos' + \ '| call matchadd("Todo", l:x)' + \ '| endfor' + +" Highlight Unicode whitespace which is no normal whitespace (0x20). + let l:spaces = ['00a0', '1680', '180e', '2000', '2001', '2002', + \ '2003', '2004', '2005', '2006', '2007', '2008', + \ '2009', '200a', '200b', '200c', '200d', '202f', + \ '205f', '2060', '3000', 'feff'] + " Compatibility fix for Vim 6.4. Escape \ inside the " string or + " it won't work! + execute ' for l:x in l:spaces' + \ '| call matchadd("Error", "\\%u" . l:x)' + \ '| endfor' + +" Special highlight for tabs to reduce their visibility in contrast to other +" SpecialKey characters (e.g. ^L). + if &t_Co == 256 && s:HasSyntaxGroup('specialKeyTab') + call matchadd('specialKeyTab', '\t') + endif + endif + endfunction +" Enable highlights for the current and all new windows. Thanks to bairui in +" #vim on Freenode (2012-04-01 00:22 CEST) for the WinEnter suggestion. + call s:CustomSyntaxHighlights() + if has('autocmd') + augroup vimrc + autocmd WinEnter * call s:CustomSyntaxHighlights() + augroup END + endif + +" Settings for specific filetypes. + + " C + let g:c_no_if0_fold = 1 " fix weird double fold in #if0 in recent versions + " Haskell + let g:hs_highlight_delimiters = 1 + let g:hs_highlight_boolean = 1 + let g:hs_highlight_types = 1 + let g:hs_highlight_more_types = 1 + " Java + let g:java_highlight_java_lang_ids = 1 " color java.lang.* identifiers + " Perl + let g:perl_fold = 1 + let g:perl_fold_blocks = 1 + let g:perl_nofold_packages = 1 + let g:perl_include_pod = 1 " syntax coloring for PODs + " PHP + let g:php_folding = 3 " fold functions + let g:php_short_tags = 0 " no short tags (), not always usable + let g:php_sql_query = 1 " highlight SQL queries in strings + " Python + let g:python_highlight_all = 1 + " Shell + let g:sh_noisk = 1 " don't add . to 'iskeyword' + let g:sh_is_posix = 1 " POSIX shell (e.g. dash) is compatible enough + let g:is_posix = 1 " POSIX shell (e.g. dash) is compatible enough + let g:sh_fold_enabled = 7 " functions (1), heredoc (2) and if/do/for (4) + " Vim + let g:vimsyn_embed = 0 " don't highlight embedded languages + let g:vimsyn_folding = 'af' " folding for autogroups (a) and functions (f) + " XML + let g:xml_syntax_folding = 1 +endif + + +" PLUGIN SETTINGS + +if has('eval') +" Use pathogen which allows one 'runtimepath' entry per plugin. This makes +" installing/removing/updating plugins simple. (Used for plugins with more +" than one file.) Ignore errors in case pathogen is not installed. + if v:version >= 700 + silent! execute 'call pathogen#infect()' + endif + +" Settings for securemodelines. + " Only allow items I need (also includes spl which is not enabled by + " default). + if v:version >= 700 " need lists + let g:secure_modelines_allowed_items = ['ft', 'spl', 'fdm', + \ 'sw', 'sts', 'noet'] + endif + +" Settings for gnupg. + " Don't use temporary files for sensitive data. + let g:GPGUsePipes = 1 + +" Settings for the NERD commenter. + " Don't create any mappings I don't want to use. + let g:NERDCreateDefaultMappings = 0 + " Map toggle comment. + nmap NERDCommenterToggle + +" XPTemplate settings. + " Try to maintain snippet rendering even after editing outside of a + " snippet. + let g:xptemplate_strict = 0 + " Don't complete any braces automatically. + let g:xptemplate_brace_complete = 0 + " Only highlight the current placeholder. + let g:xptemplate_highlight = 'current' + +" CtrlP settings. + " Don't manage the working directory (the default setting is too slow for + " me). + let g:ctrlp_working_path_mode = 0 + + " Path to cache directory. I prefer to keep generated files as local as + " possible. + let g:ctrlp_cache_dir = $HOME . '/.vim/cache/ctrlp' + " Permanent cache, cleared by a crontab entry. Use to update the + " cache manually. + let g:ctrlp_clear_cache_on_exit = 0 + + " Don't switch the window if the selected buffer is already open. I want + " to open another view on this buffer in most cases. + let g:ctrlp_switch_buffer = 0 + +" FSWitch settings. + " Defaults don't work well for my projects. + augroup vimrc + autocmd BufEnter *.cc let b:fswitchdst = 'h' + \ | let b:fswitchlocs = './' + autocmd BufEnter *.h let b:fswitchdst = 'cc,c' + \ | let b:fswitchlocs = './' + augroup END + + " Switch to corresponding header/source file. + nnoremap h :FSHere + +" netrw settings. + " Don't create ~/.vim/.netrwhist history file. + let g:netrw_dirhistmax = 0 +endif + + +" AUTO COMMANDS + +" Use a custom auto group to prevent problems when the vimrc files is sourced +" multiple times. +if has('autocmd') + augroup vimrc + +" Go to last position of opened files. Taken from :help last-position-jump. + autocmd BufReadPost * + \ if line("'\"") > 1 && line("'\"") <= line('$') | + \ execute "normal! g'\"" | + \ endif +" But not for Git commits, go to beginning of the file. + autocmd BufReadPost COMMIT_EDITMSG normal! gg + +" Make sure 'list' and 'number' is disabled in help files. This is necessary +" when switching to a help buffer which is in the background with :buffer as +" these options are local to windows (and not only to buffers). This happens +" because I often want to use only one window and thus the help buffer is in +" the background. + autocmd BufWinEnter *.txt + \ if &filetype == 'help' | + \ setlocal nolist | + \ setlocal nonumber | + \ endif + +" Automatically disable 'paste' mode when leaving insert mode. Thanks to +" Raimondi in #vim on Freenode (2010-08-14 23:01 CEST). Very useful as I only +" want to paste once and then 'paste' gets automatically unset. InsertLeave +" doesn't exist in older Vims. Use "*p to paste X11's selection, no need for +" 'paste' in this case. + if exists('##InsertLeave') + autocmd InsertLeave * set nopaste + endif + +" Write all files when running :mak[e] before 'makeprg' is called. +" QuickFixCmdPre doesn't exist in older Vims. + if exists('##QuickFixCmdPre') + autocmd QuickFixCmdPre * wall + endif + +" Don't ignore case while in insert mode, but ignore case in all other modes. +" This causes / to honor the case and thus only complete matching +" capitalization. But while searching (/) 'ignorecase' is used. +" InsertEnter/InsertLeave doesn't exist in older Vims. + if exists('##InsertEnter') && exists('##InsertLeave') + autocmd InsertEnter * set noignorecase + autocmd InsertLeave * set ignorecase + endif + +" Display a warning when editing a file which contains "do not edit" (ignoring +" the case) and similar messages in the first lines of the file, for example +" template files which were preprocessed or auto-generated files. Especially +" useful when the header is not displayed on the first screen, e.g. when the +" old position is restored. + function! s:SearchForDoNotEditHeader() + " Only search the first 20 lines to prevent false positives, e.g. + " in scripts which write files containing this warning and ignore + " the case (\c). (Can't use search()'s {stopline} as we might not + " start searching from the top.) + let l:search = '\c\(do not \(edit\|modify\)\|autogenerated by\)' + let l:match = search(l:search, 'n') + if l:match == 0 || l:match > 20 + return + endif + + echoerr 'Do not edit this file! (Maybe a template file.)' + endfunction + autocmd BufRead * call s:SearchForDoNotEditHeader() + +" AFTER/FTPLUGIN AUTO COMMANDS + +" Disable spell checking for files which don't need it. + autocmd FileType deb setlocal nospell + autocmd FileType diff setlocal nospell + autocmd FileType tar setlocal nospell +" Fix to allow Vim edit crontab files as crontab doesn't work with +" backupcopy=auto. + autocmd FileType crontab setlocal backupcopy=yes +" Don't use the modeline in git commits as the diff created by `git commit -v` +" may contain one which could change the filetype or other settings of the +" commit buffer. Also make sure we use only 72 characters per line which is +" the recommendation for git commit messages (http://tpope.net/node/106). + autocmd FileType gitcommit let g:secure_modelines_allowed_items = [] | + \ setlocal textwidth=72 +" Fix 'include' setting for shell files to recognize '.' and 'source' +" commands. + autocmd FileType sh let &l:include = '^\s*\(\.\|source\)\s\+' +" Use the same comment string as for Vim files in Vimperator files. + autocmd FileType vimperator setlocal commentstring=\"%s +" Use TeX compiler for (La)TeX files. + autocmd FileType tex compiler tex + +" FTDETECT AUTO COMMANDS + +" Recognize .md as markdown files (Vim default is .mkd). + autocmd BufRead,BufNewFile *.md set filetype=mkd +" Recognize .test as Tcl files. + autocmd BufRead,BufNewFile *.test set filetype=tcl + +" OTHER AUTO COMMANDS + +" Disable spell checking, displaying of list characters and long lines when +" viewing documentation. + autocmd BufReadPost /usr/share/doc/* setlocal nospell nolist | 2match + +" Use diff filetype for mercurial patches in patch queue. + autocmd BufReadPost */.hg/patches/* set filetype=diff + + augroup END +endif + + +" CUSTOM FUNCTIONS AND COMMANDS + +if has('eval') +" Convenient command to see the difference between the current buffer and the +" file it was loaded from, thus the changes you made. Thanks to the +" vimrc_example.vim file in Vim's source. Modified to use the same filetype +" for the diffed file as the filetype for the original file. + if !exists(':DiffOrig') + command DiffOrig + \ let s:diff_orig_filetype = &filetype + \ | vertical new + \ | let &filetype = s:diff_orig_filetype + \ | unlet s:diff_orig_filetype + \ | set buftype=nofile + \ | read ++edit # + \ | 0d_ + \ | diffthis + \ | wincmd p + \ | diffthis + endif +endif diff --git a/x11/.gitignore b/x11/.gitignore new file mode 100644 index 0000000..91efa70 --- /dev/null +++ b/x11/.gitignore @@ -0,0 +1,7 @@ +# Generated with m4 or awk. +/Xresources +# Generated by Xmonad. +/xmonad/xmonad.errors +/xmonad/xmonad.hi +/xmonad/xmonad.o +/xmonad/xmonad-* diff --git a/x11/Makefile b/x11/Makefile new file mode 100644 index 0000000..23d5991 --- /dev/null +++ b/x11/Makefile @@ -0,0 +1,4 @@ +all: + @./setup.sh + +.PHONY: all diff --git a/x11/README b/x11/README new file mode 100644 index 0000000..6e1b10d --- /dev/null +++ b/x11/README @@ -0,0 +1,16 @@ +README +====== + +Useful X11 related commands. + + +xrandr +------ + +Auto detect monitor modes and arrange monitors: + + xrandr --output LVDS1 --auto --output VGA1 --auto --right-of LVDS1 + +Disable a monitor, important after disconnect: + + xrandr --output VGA1 --off diff --git a/x11/XCompose b/x11/XCompose new file mode 100644 index 0000000..177a74c --- /dev/null +++ b/x11/XCompose @@ -0,0 +1,44 @@ +# X configuration file for multi-key input sequences (compose key). +# +# `man XCompose` for more information. + +# Copyright (C) 2011-2013 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Load default compose file. +include "%L" + +# Umlauts like in Vim/GNU screen. + : adiaeresis # "ä" + : odiaeresis # "ö" + : udiaeresis # "ü" + : Adiaeresis # "Ä" + : Odiaeresis # "Ö" + : Udiaeresis # "Ü" +# + : adiaeresis # "ä" + : odiaeresis # "ö" + : udiaeresis # "ü" + : Adiaeresis # "Ä" + : Odiaeresis # "Ö" + : Udiaeresis # "Ü" +# + : adiaeresis # "ä" + : odiaeresis # "ö" + : udiaeresis # "ü" + : Adiaeresis # "Ä" + : Odiaeresis # "Ö" + : Udiaeresis # "Ü" diff --git a/x11/Xresources.in b/x11/Xresources.in new file mode 100644 index 0000000..abc0e12 --- /dev/null +++ b/x11/Xresources.in @@ -0,0 +1,133 @@ +! Configuration file for X11 programs. +! +! It is designed to work with xterm and rxvt (and their unicode variants). +! +! "Term" is an alias for all supported terminal emulators; it is automatically +! replaced by setup.sh. + +! Copyright (C) 2011-2015 Simon Ruderich +! +! This file 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 file is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with this file. If not, see . + + +! COLOR SETTINGS + +! Use gray on black with a light yellow cursor in terminals. +Term.foreground: #cccccc +Term.background: #000000 +Term.cursorColor: #ffff66 + +! Special case for urxvt to get transparent background. This requires a +! compositing manager which supports transparency like compton. Thanks to eto +! and adaedra in #herblstuftwm on Freenode (2014-05-04 15:50 ff) for their +! awesome help regarding transparency. +URxvt.background: [90]#000000 +! Necessary for transparency, see man page. +URxvt.depth: 32 + +! Enable pseudo transparency. Only used if compton is not available. +!NO_COMPTON URxvt.transparent: true +!NO_COMPTON URxvt.shading: 10 + +! Main console colors. +Term.color0: #000000 +Term.color1: #ff0000 +Term.color2: #00ff00 +Term.color3: #ffff00 +Term.color4: #0000ff +Term.color5: #ff00ff +Term.color6: #00ffff +Term.color7: #ffffff +! Bold console colors. +Term.color8: #404040 +Term.color9: #ff4040 +Term.color10: #40ff40 +Term.color11: #ffff40 +Term.color12: #4040ff +Term.color13: #ff40ff +Term.color14: #40ffff +Term.color15: #cccccc + +! Use 256 colors in XTerm. +XTerm.termName: xterm-256color + + +! MISC TERMINAL SETTINGS + +! Use Inconsolata as default font, SourceCodePro for replacement characters +! (e.g. greek letters), VL Gothic for Asian characters. +URxvt.font: xft:Inconsolata:pixelsize=17,xft:SourceCodePro-Regular:pixelsize=17,xft:VL Gothic:pixelsize=17 + +! Disable the scrollback buffer. I use screen/tmux so it is not necessary and +! only wastes memory. +XTerm.saveLines: 0 +URxvt.saveLines: 0 + +! Use the meta-key as expected by emacs/irssi. +XTerm.metaSendsEscape: true + +! Make sure XTerm allows send events. Necessary for stumpWM so Ctrl-t t can +! send a Ctrl-t to the application running in XTerm. Thanks to [df] in +! #stumpwm on Freenode (2009-05-18 22:05). +!XTerm*allowSendEvents: true + +! Disable support to enter non-ASCII keys by pressing Ctrl-Shift-. +! Either use digraph support in vim/screen or use the compose key instead. +! NOTE: If enabled can also be used to display used font for characters. +URxvt.iso14755: false +URxvt.iso14755_52: false + +! Disable printing with the "Print" key to prevent accidental prints. By +! default lpr is used. Rxvt instead of URxvt to ensure printing is disabled in +! case I use plain rxvt. +Rxvt.print-pipe: true + +! Do not use any perl extension scripts. +URxvt.perl-ext-common: + + +! XSCREENSAVER SETTINGS + +! Just blank the screen, no fancy screen savers. +xscreensaver.mode: blank + +! Blank after x time (h:mm:ss). +xscreensaver.timeout: 0:10:00 +! Lock screen after x time _after_ blank. +xscreensaver.lockTimeout: 2:00:00 +! Require password to unlock after blank. +xscreensaver.lock: True + +! No fade effects, enable/disable monitor immediately. +xscreensaver.fade: False +xscreensaver.unfade: False + +! Enable monitor power management. +xscreensaver.dpmsEnabled: True +! Disable monitor immediately when locking the screen. +xscreensaver.dpmsQuickOff: True +! Put monitor into standby (gets black), suspend (power-saving mode) and off +! after x time. +xscreensaver.dpmsStandby: 0:10:00 +xscreensaver.dpmsSuspend: 0:30:00 +xscreensaver.dpmsOff: 1:00:00 + +! Display splash screen on startup for x time. +xscreensaver.splash: True +xscreensaver.splashDuration: 0:00:01 + +! Disable "New Login" button. +xscreensaver.newLoginCommand: /bin/false + +! vim: ft=xdefaults diff --git a/x11/bin/xlockscreen b/x11/bin/xlockscreen new file mode 100755 index 0000000..11b8aec --- /dev/null +++ b/x11/bin/xlockscreen @@ -0,0 +1,106 @@ +#!/bin/sh + +# Helper script to start/lock the screen with an available screen locker. + +# Copyright (C) 2015 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set -eu + + +usage() { + printf 'usage: %s start \n' "$0" + printf ' %s lock\n' "$0" + exit 1 +} + +installed() { + type "$1" >/dev/null 2>&1 +} + + +if test $# -eq 0; then + usage +fi + +if test x"$1" = xstart; then + if test $# -ne 3; then + usage + fi + lock_time_minutes="$2" + lock_binary="$3" + + # NOTE: We must redirect stdout of the spawned background processes to + # /dev/null or a potential caller which uses our output will wait forever + # on the inherited stdin (and we become a zombie)! Thanks to Beano on [1] + # for the idea, read on 2015-08-23. + # + # [1]: https://stackoverflow.com/questions/3748432/insane-crond-behavior-keeps-making-defunct-bash-processes/3750028#3750028 + + if installed xscreensaver; then + printf 'xscreensaver.timeout: %d + xscreensaver.lock: True + xscreensaver.lockTimeout: 0 + ' "$lock_time_minutes" | xrdb -merge + xscreensaver >/dev/null & + echo xscreensaver + elif installed xautolock; then + if installed "$lock_binary"; then + # Terminate a running xautolock because we might have to replace + # its timeout and other settings with our values. + pkill -u "$USER" xautolock || true + + xautolock -secure -time "$lock_time_minutes" \ + -locker "$lock_binary" \ + >/dev/null & + echo xautolock + else + echo "Locker '$lock_binary' not installed. Auto lock won't work!" + exit 1 + fi + else + echo "No locker found. Auto lock won't work!" + exit 1 + fi + +elif test x"$1" = xlock; then + if test $# -ne 1; then + usage + fi + + if installed xscreensaver; then + # Start xscreensaver if it's not already running. xscreensaver-command + # ensures xscreensaver is available for the current X session. + xscreensaver-command -time >/dev/null 2>&1 || xscreensaver & + + # It can take a while for xscreensaver to start, wait until it's + # ready. a || b && c behaves like (a || b) && c. + while :; do + xscreensaver-command -lock || test $? -ne 255 && break + done + elif installed xtrlock; then + # Sleep is necessary to allow xtrlock to grab the keyboard input. + sleep 1 + exec xtrlock + elif installed xlock; then + exec xlock + else + echo 'No screen locker found!' + exit 1 + fi + +else + usage +fi diff --git a/x11/feh/keys b/x11/feh/keys new file mode 100644 index 0000000..8d95910 --- /dev/null +++ b/x11/feh/keys @@ -0,0 +1,45 @@ +# feh key mappings configuration file. + +# Copyright (C) 2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Disable all mappings which modify the image, I use feh as an image viewer +# only and never want to modify any files by accident. +orient_1 +orient_3 +flip +mirror +# Also disable mappings which create or _remove_ files/images. +save_filelist +save_image +delete + +# Vim-like movement bindings when scrolling inside an image. +scroll_left h +scroll_right l +scroll_up k +scroll_down j +# And when moving in the file list. +prev_img K BackSpace +next_img J space + +# Zoom in/out. +zoom_in plus +zoom_out minus +zoom_fit equal + +# Toggle the filename display. +toggle_filenames f diff --git a/x11/feh/themes b/x11/feh/themes new file mode 100644 index 0000000..7e073e6 --- /dev/null +++ b/x11/feh/themes @@ -0,0 +1,24 @@ +# feh themes configuration file. + +# Copyright (C) 2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Default options for feh. +# +# --scale-down: scale image to window width +# --geometry 500x500: fix flickering when using tiling window managers +# --draw-filename: display filename on screen (toggle with f) +feh --scale-down --geometry 500x500 --draw-filename diff --git a/x11/fonts/Inconsolata.otf b/x11/fonts/Inconsolata.otf new file mode 100644 index 0000000..3488898 Binary files /dev/null and b/x11/fonts/Inconsolata.otf differ diff --git a/x11/fonts/Inconsolata.sfd b/x11/fonts/Inconsolata.sfd new file mode 100644 index 0000000..3415c8b --- /dev/null +++ b/x11/fonts/Inconsolata.sfd @@ -0,0 +1,5730 @@ +SplineFontDB: 3.0 +FontName: Inconsolata +FullName: Inconsolata +FamilyName: Inconsolata +Weight: Medium +Copyright: Created by Raph Levien using his own tools and FontForge. Copyright 2006 Raph Levien. Released under the SIL Open Font License, http://scripts.sil.org/OFL. +UComments: "2005-8-26: Created." +Version: 001.010 +ItalicAngle: 0 +UnderlinePosition: -100 +UnderlineWidth: 50 +Ascent: 820 +Descent: 180 +LayerCount: 2 +Layer: 0 0 "Back" 1 +Layer: 1 0 "Fore" 0 +XUID: [1021 77 1780377399 11264577] +FSType: 8 +OS2Version: 0 +OS2_WeightWidthSlopeOnly: 0 +OS2_UseTypoMetrics: 0 +CreationTime: 1161020814 +ModificationTime: 1234036730 +PfmFamily: 17 +TTFWeight: 500 +TTFWidth: 5 +LineGap: 200 +VLineGap: 0 +Panose: 2 11 6 9 3 0 3 0 0 0 +OS2TypoAscent: 0 +OS2TypoAOffset: 1 +OS2TypoDescent: 0 +OS2TypoDOffset: 1 +OS2TypoLinegap: 0 +OS2WinAscent: 0 +OS2WinAOffset: 1 +OS2WinDescent: 0 +OS2WinDOffset: 1 +HheadAscent: 0 +HheadAOffset: 1 +HheadDescent: 0 +HheadDOffset: 1 +OS2Vendor: 'PfEd' +DEI: 91125 +LangName: 1033 +Encoding: Custom +UnicodeInterp: none +NameList: Adobe Glyph List +DisplaySize: -36 +AntiAlias: 1 +FitToEm: 1 +WinInfo: 64 16 14 +Grid +168 917 m 25 + 406.5 917 l 25 +EndSplineSet +TeXData: 1 0 0 629145 314572 209715 554697 1048576 209715 783286 444596 497025 792723 393216 433062 380633 303038 157286 324010 404750 52429 2506097 1059062 262144 +BeginChars: 359 294 + +StartChar: a +Encoding: 97 97 0 +Width: 600 +Flags: HMW +TeX: 97 0 +LayerCount: 2 +Fore +SplineSet +115 467 m 0 + 164.456 518.083 232.512 541.055 303.925 541.055 c 0 + 386.091 541.055 453.267 510.995 488.008 453.097 c 0 + 512.442 412.375 514 371.39 514 328 c 0 + 514 0 l 0 + 435 0 l 0 + 435 58 l 0 + 377.24 10.665 309.94 -13.0023 244.918 -13.0023 c 0 + 134.316 -13.0023 66.8187 59.1626 66.8187 136.825 c 0 + 66.8187 195.507 104.707 257.379 188.205 288.065 c 0 + 255.557 312.817 339.023 312 417 312 c 0 + 434 312 l 0 + 434 331 l 0 + 434 359.055 434.409 393.114 416.772 422.078 c 0 + 401.83 446.615 370.745 473.031 307.869 473.031 c 0 + 258.955 473.031 199.358 459.393 156 414 c 0 + 115 467 l 0 +437 248 m 0 + 418 248 l 0 + 362.991 248 292.114 251.465 244.035 239.987 c 0 + 177.665 224.143 150.668 180.909 150.668 142.456 c 0 + 150.668 95.137 191.681 50.8142 261.864 50.8142 c 0 + 331.199 50.8142 381.823 92.8437 401.058 113.287 c 0 + 436.77 151.242 437 185.578 437 213 c 0 + 437 248 l 0 +EndSplineSet +EndChar + +StartChar: c +Encoding: 99 99 1 +Width: 600 +Flags: HMW +TeX: 99 0 +LayerCount: 2 +Fore +SplineSet +539 442 m 4 + 480 373 l 4 + 470.825 379.924 477.126 390.809 472.703 399.753 c 4 + 469.634 405.96 426.164 469.074 335.78 469.074 c 4 + 238.504 469.074 160.969 393.768 160.969 273.126 c 4 + 160.969 149.42 239.6 62.9789 342.756 62.9789 c 4 + 395.811 62.9789 447.209 86.4429 483 127 c 4 + 531 71 l 4 + 480.516 16.5812 409.687 -13.0011 335.781 -13.0011 c 4 + 186.048 -13.0011 74.9996 104.892 74.9996 264.509 c 4 + 74.9996 423.38 185.476 540.028 341.051 540.028 c 4 + 426.18 540.028 497.315 503.103 539 442 c 4 +EndSplineSet +EndChar + +StartChar: m +Encoding: 109 109 2 +Width: 600 +Flags: HMW +TeX: 109 0 +LayerCount: 2 +Fore +SplineSet +54 0 m 0 + 54 529 l 0 + 131 529 l 0 + 130 477 l 0 + 154.337 514.017 194.92 542.056 238.342 542.056 c 0 + 285.783 542.056 323.7 508.722 332 465 c 0 + 352.564 511.823 399.84 542.002 450.616 542.002 c 0 + 480.394 542.002 513.14 530.575 533.429 499.943 c 0 + 556.856 464.574 555 419.808 555 376 c 0 + 555 -1 l 0 + 476 -1 l 0 + 476 375 l 0 + 476 399.068 478.585 429.361 468.835 451.652 c 0 + 460.274 471.228 443.933 481.204 426.805 481.204 c 0 + 394.659 481.204 374.014 448.262 365.249 433.479 c 0 + 345.703 400.513 343 377.821 343 350 c 0 + 343 0 l 0 + 265 0 l 0 + 265 368 l 0 + 265 389.832 266.608 415.372 259.774 437.513 c 0 + 250.804 466.572 229.599 478.297 210.74 478.297 c 0 + 189.54 478.297 165.885 464.471 146.732 428.907 c 0 + 131.729 401.049 130 377.928 130 353 c 0 + 130 0 l 0 + 54 0 l 0 +EndSplineSet +EndChar + +StartChar: s +Encoding: 115 115 3 +Width: 600 +Flags: HMW +TeX: 115 0 +LayerCount: 2 +Fore +SplineSet +511 459 m 0 + 462 386 l 0 + 459.954 386.487 455.921 388.387 455.967 395.318 c 0 + 455.994 399.389 456.754 402.17 453.49 406.383 c 0 + 433.342 432.386 382.005 479.074 306.539 479.074 c 0 + 246.687 479.074 195 449.386 195 406.786 c 0 + 195 389 204.202 363.327 247.446 342.429 c 0 + 296.926 318.517 382.175 306.563 441.996 272.983 c 0 + 504.635 237.822 519.699 189.926 519.699 153.285 c 0 + 519.699 73.3785 444.137 -12.0003 299.462 -12.0003 c 0 + 219.049 -12.0003 138.142 14.2177 76 72 c 0 + 124 155 l 0 + 129.709 152.331 129.203 145.694 129.13 144.104 c 0 + 128.917 139.47 128.401 136.208 132.349 131.72 c 0 + 149.099 112.681 207.222 58 297.964 58 c 0 + 373.592 58 434.068 92.1676 434.068 141.757 c 0 + 434.068 160.887 424.919 188.765 381.245 209.208 c 0 + 342.194 227.486 283.74 241.548 238.968 257.732 c 0 + 210.234 268.119 109.997 301.799 109.997 394.231 c 0 + 109.997 473.3 190.548 542.004 313.496 542.004 c 0 + 391.8 542.004 462.083 512.905 511 459 c 0 +EndSplineSet +EndChar + +StartChar: I +Encoding: 73 73 4 +Width: 600 +Flags: HMW +TeX: 73 0 +LayerCount: 2 +Fore +SplineSet +112 722 m 0 + 470 722 l 0 + 470 654 l 0 + 327 654 l 0 + 327 66 l 0 + 477 66 l 0 + 477 -1 l 0 + 104 -1 l 0 + 104 67 l 0 + 246 67 l 0 + 246 654 l 0 + 112 654 l 0 + 112 722 l 0 +EndSplineSet +EndChar + +StartChar: o +Encoding: 111 111 5 +Width: 600 +Flags: HMW +TeX: 111 0 +LayerCount: 2 +Fore +SplineSet +543.113 262.304 m 0 + 543.113 86.8043 430.326 -14 304.969 -14 c 0 + 171.548 -14 56.8677 99.5323 56.8677 260.578 c 0 + 56.8677 424.14 172.53 541.005 307.44 541.005 c 0 + 427.751 541.005 543.113 445.084 543.113 262.304 c 0 +301.758 470.103 m 0 + 220.795 470.103 144.985 397.575 144.985 267.806 c 0 + 144.985 137.225 221.249 57.9927 305.614 57.9927 c 0 + 382.884 57.9927 459.167 125.6 459.167 258.844 c 0 + 459.167 404.202 378.128 470.103 301.758 470.103 c 0 +EndSplineSet +EndChar + +StartChar: n +Encoding: 110 110 6 +Width: 600 +Flags: HMW +TeX: 110 0 +LayerCount: 2 +Fore +SplineSet +89 0 m 0 + 89 529 l 0 + 174 529 l 0 + 174 436 l 0 + 212.871 495.002 278.12 542.003 349.957 542.003 c 0 + 410.281 542.003 464.544 508.129 490.899 448.568 c 0 + 509.729 406.014 510 362.334 510 321 c 0 + 510 321 l 0 + 510 0 l 0 + 428 0 l 0 + 428 319 l 0 + 428 356.393 427.762 401.823 399.11 436.061 c 0 + 380.097 458.781 353.908 469.58 327.341 469.58 c 0 + 271.362 469.58 220.49 422.787 200.308 395.893 c 0 + 178.287 366.55 174 340.651 174 305 c 0 + 174 0 l 0 + 89 0 l 0 +EndSplineSet +EndChar + +StartChar: l +Encoding: 108 108 7 +Width: 600 +Flags: HMW +TeX: 108 0 +LayerCount: 2 +Fore +SplineSet +108 770 m 0 + 342 770 l 0 + 342 67 l 0 + 498 67 l 0 + 498 0 l 0 + 101 0 l 0 + 101 67 l 0 + 258 67 l 0 + 258 703 l 0 + 108 703 l 0 + 108 770 l 0 +EndSplineSet +EndChar + +StartChar: t +Encoding: 116 116 8 +Width: 600 +Flags: HMW +TeX: 116 0 +LayerCount: 2 +Fore +SplineSet +228 671 m 0 + 319 686 l 0 + 323.069 674.25 314.74 667.101 312.438 654.7 c 0 + 306.99 625.35 299 530 299 530 c 0 + 472 530 l 0 + 472 461 l 0 + 298 461 l 0 + 291.31 392.178 287.955 323.066 287.955 253.871 c 0 + 287.955 177.138 290.735 156.77 291.356 152.111 c 0 + 299.829 88.539 340.908 66.6734 380.424 66.6734 c 0 + 413.027 66.6734 454.079 81.5989 499 115 c 0 + 525 49 l 0 + 480.23 16.2302 418.815 -10.1214 355.783 -10.1214 c 0 + 301.714 -10.1214 260.342 10.8883 235.238 46.2593 c 0 + 204.429 89.6687 204 142.866 204 190.358 c 0 + 204 280.259 207.611 370.358 215 461 c 0 + 91 461 l 0 + 92 529 l 0 + 218 529 l 0 + 228 671 l 0 +EndSplineSet +EndChar + +StartChar: e +Encoding: 101 101 9 +Width: 600 +Flags: HMW +TeX: 101 0 +LayerCount: 2 +Fore +SplineSet +309.698 542.272 m 0 + 396.487 542.272 495.286 496.221 519.331 354.102 c 0 + 524.53 323.371 526.211 289.371 523 253 c 1 + 147.298 253 l 1 + 153.598 94.4857 256.131 55.4411 326.953 55.4411 c 0 + 379.589 55.4411 429.496 76.3575 464 115 c 1 + 510 70 l 1 + 464.675 15.507 396.045 -12.143 320.487 -12.143 c 0 + 176.7 -12.143 66.2985 82.2264 66.2985 258.611 c 0 + 66.2985 451.856 183.262 542.272 309.698 542.272 c 0 +150.008 317 m 1 + 441 317 l 1 + 450.942 402.839 389.68 478.169 303.883 478.169 c 0 + 247.072 478.169 166.495 441.85 150.008 317 c 1 +EndSplineSet +EndChar + +StartChar: space +Encoding: 32 32 10 +Width: 600 +Flags: HMW +TeX: 115 0 +LayerCount: 2 +EndChar + +StartChar: b +Encoding: 98 98 11 +Width: 600 +Flags: HMW +TeX: 98 0 +LayerCount: 2 +Fore +SplineSet +79 771 m 0 + 177 771 l 0 + 178.976 764.036 172.638 759.556 170.696 758.012 c 0 + 165.256 753.69 164 751.156 164 745 c 0 + 164 448 l 0 + 197.57 506.183 259.707 542.07 327.128 542.07 c 0 + 431.167 542.07 540.005 456.138 540.005 271.2 c 0 + 540.005 79.1558 427.245 -13.0764 318.695 -13.0764 c 0 + 255.173 -13.0764 196.766 18.3503 162 70 c 0 + 133 0 l 0 + 79 0 l 0 + 79 771 l 0 +298.069 470.353 m 0 + 245.668 470.353 197.567 440.714 177.844 392.983 c 0 + 165.809 363.856 163.969 329.782 163.969 281.904 c 0 + 163.969 236.092 163.584 204.899 167.224 177.364 c 0 + 180.563 76.4436 260.537 61.9726 296.744 61.9726 c 0 + 348.522 61.9726 453.238 91.5609 453.238 253.679 c 0 + 453.238 440.584 347.817 470.353 298.069 470.353 c 0 +EndSplineSet +EndChar + +StartChar: H +Encoding: 72 72 12 +Width: 600 +Flags: HMW +TeX: 72 0 +LayerCount: 2 +Fore +SplineSet +73 722 m 0 + 163 722 l 0 + 163.822 720.356 164.252 718.529 164.252 716.663 c 0 + 164.252 707.549 157 706.38 157 694 c 0 + 157 413 l 0 + 440 413 l 0 + 440 722 l 0 + 528 722 l 0 + 528.872 720.545 529.336 718.865 529.336 717.137 c 0 + 529.336 708.364 521 708.006 521 696 c 0 + 521 -1 l 0 + 439 -1 l 0 + 439 344 l 0 + 157 344 l 0 + 157 0 l 0 + 73 0 l 0 + 73 722 l 0 +EndSplineSet +EndChar + +StartChar: g +Encoding: 103 103 13 +Width: 600 +Flags: HMW +TeX: 103 0 +LayerCount: 2 +Fore +SplineSet +155.954 364.263 m 0 + 155.954 300.152 208.143 247.999 272.491 247.999 c 0 + 336.833 247.999 389.059 300.157 389.059 364.307 c 0 + 389.059 428.413 336.878 480.571 272.536 480.571 c 0 + 208.19 480.571 155.954 428.416 155.954 364.263 c 0 +277.609 546.548 m 0 + 325.887 546.548 370.362 528.527 403 496 c 1 + 443.962 530.332 496.755 547.196 550 543 c 1 + 560 475 l 1 + 549.913 476.74 539.695 477.615 529.459 477.615 c 0 + 496.841 477.615 464.884 468.735 437 452 c 1 + 454.566 425.561 464.002 394.366 464.002 362.278 c 0 + 464.002 264.564 378.096 180.942 273.257 180.942 c 0 + 250.3 180.942 227.525 185.021 206 193 c 1 + 200.797 188.707 168.184 161.819 168.184 133.805 c 0 + 168.184 117.119 179.985 104.638 200.262 99.0661 c 0 + 211.549 95.9645 236.341 92.4042 275.863 92.4042 c 0 + 335.853 92.4042 399.797 99.8481 455.06 77.4073 c 0 + 511.29 54.5739 537.372 8.31551 537.372 -37.512 c 0 + 537.372 -108.516 473.087 -199.384 293.795 -199.384 c 0 + 108.265 -199.384 54.4288 -131.698 54.4288 -73.9838 c 0 + 54.4288 -31.9211 83.7043 7.00723 140.521 43.2787 c 1 + 107.075 60.8546 98.0562 91.7838 98.0562 113.827 c 0 + 98.0562 147.839 119.806 183.618 158 216 c 1 + 109.489 247.565 79.7405 301.443 79.7405 359.36 c 0 + 79.7405 462.8 172.219 546.548 277.609 546.548 c 0 +196.923 28.2968 m 1 + 166.505 11.5929 130.974 -16.2077 130.974 -54.2593 c 0 + 130.974 -72.7564 140.35 -101.884 183.142 -118.899 c 0 + 223.159 -134.81 268.208 -136.199 292.38 -136.199 c 0 + 327.814 -136.199 372.581 -133.958 411.372 -113.024 c 0 + 447.725 -93.4056 460.904 -65.7032 460.904 -42.7611 c 0 + 460.904 -19.4526 446.825 11.4411 397.736 18.8405 c 0 + 367.367 23.4181 324.656 20.4798 285.59 21.9264 c 0 + 245.08 23.4265 216.987 25.7017 196.923 28.2968 c 1 +EndSplineSet +EndChar + +StartChar: h +Encoding: 104 104 14 +Width: 600 +Flags: HMW +TeX: 104 0 +LayerCount: 2 +Fore +SplineSet +91 0 m 4 + 91 770 l 4 + 187 770 l 4 + 187.379 768.886 187.572 767.712 187.572 766.526 c 4 + 187.572 760.484 182.866 756.916 180.206 754.11 c 4 + 176.27 749.956 176 746.931 176 743 c 4 + 176 436 l 4 + 214.871 495.002 280.12 542.003 351.957 542.003 c 4 + 412.281 542.003 466.544 508.129 492.899 448.568 c 4 + 511.729 406.014 512 362.334 512 321 c 4 + 512 321 l 4 + 512 0 l 4 + 430 0 l 4 + 430 319 l 4 + 430 356.393 429.762 401.823 401.11 436.061 c 4 + 382.097 458.781 355.908 469.58 329.341 469.58 c 4 + 273.362 469.58 222.49 422.787 202.308 395.893 c 4 + 180.287 366.55 176 340.651 176 305 c 4 + 176 0 l 4 + 91 0 l 4 +EndSplineSet +EndChar + +StartChar: u +Encoding: 117 117 15 +Width: 600 +Flags: HMW +TeX: 117 0 +LayerCount: 2 +Fore +SplineSet +83 529 m 0 + 167 529 l 0 + 167 234 l 0 + 167 198.5 166.87 157.109 185.678 119.763 c 0 + 206.758 77.9067 245.414 54.9999 286.847 54.9999 c 0 + 337.84 54.9999 384.893 89.1882 409.153 133.494 c 0 + 426.843 165.8 430 197.247 430 238 c 0 + 430 529 l 0 + 514 529 l 0 + 514 48 l 0 + 514 32.4901 514.914 15.8204 520 0 c 0 + 432 0 l 0 + 429.806 13.6499 429.662 27.494 430 41 c 0 + 431 81 l 0 + 396.509 22.5849 333.904 -13.0167 267.52 -13.0167 c 0 + 198.648 -13.0167 133.916 25.4335 102.995 94.9656 c 0 + 82.3165 141.466 81.8438 187.899 82 234 c 0 + 83 529 l 0 +EndSplineSet +EndChar + +StartChar: r +Encoding: 114 114 16 +Width: 600 +Flags: HMW +TeX: 114 0 +LayerCount: 2 +Fore +SplineSet +125 529 m 0 + 212 529 l 0 + 209 427 l 0 + 243.671 502.684 322.168 541.803 399.502 541.803 c 0 + 458.959 541.803 507.697 518.114 541 484 c 0 + 502 404 l 0 + 493.106 412.505 489.308 421.668 482.352 430.554 c 0 + 467.489 449.542 439.485 470.205 394.944 470.205 c 0 + 357.514 470.205 294.325 457.033 246.222 380.981 c 0 + 210.237 324.088 209 288.944 209 257 c 0 + 209 -1 l 0 + 125 -1 l 0 + 125 529 l 0 +EndSplineSet +EndChar + +StartChar: i +Encoding: 105 105 17 +Width: 600 +Flags: HMW +TeX: 105 0 +LayerCount: 2 +Fore +SplineSet +133 530 m 4 + 345 530 l 4 + 345 67 l 4 + 469 67 l 4 + 469 0 l 4 + 126 0 l 4 + 126 67 l 4 + 261 67 l 4 + 261 462 l 4 + 133 462 l 4 + 133 530 l 4 +305.003 760 m 4 + 338.171 760 365.019 733.28 365.019 700.493 c 4 + 365.019 667.727 338.182 640.992 304.99 640.992 c 4 + 271.818 640.992 244.981 667.716 244.981 700.486 c 4 + 244.981 733.264 271.822 760 305.003 760 c 4 +EndSplineSet +EndChar + +StartChar: f +Encoding: 102 102 18 +Width: 600 +Flags: HMW +TeX: 102 0 +LayerCount: 2 +Fore +SplineSet +408.022 777.453 m 0 + 474.61 777.453 532.121 750.586 570 705 c 1 + 532 628 l 1 + 528.434 627.638 523.23 629.721 522.592 637.659 c 0 + 522.194 642.608 523.122 645.776 519.403 651.402 c 0 + 497.139 685.077 454.727 711.981 403.749 711.981 c 0 + 359.969 711.981 319.106 692.476 297.273 653.356 c 0 + 277.495 617.916 278 577.346 278 539 c 2 + 278 498 l 1 + 451 498 l 1 + 451 432 l 1 + 278 432 l 1 + 278 0 l 1 + 198 0 l 1 + 198 432 l 1 + 83 432 l 1 + 83 498 l 1 + 198 498 l 1 + 198 550 l 2 + 198 596.99 199.926 641.1 227.059 685.226 c 0 + 264.056 745.394 333.642 777.453 408.022 777.453 c 0 +EndSplineSet +EndChar + +StartChar: v +Encoding: 118 118 19 +Width: 600 +Flags: HMW +TeX: 118 0 +LayerCount: 2 +Fore +SplineSet +56 530 m 0 + 156 530 l 0 + 158 520.53 152.295 514.363 152.295 507.316 c 0 + 152.295 504.529 153.032 502.45 154 500 c 0 + 307 113 l 0 + 392 310 l 0 + 421.967 379.454 449.99 452.863 464 530 c 0 + 539 530 l 0 + 521.386 449.313 491.663 372.127 460 298 c 0 + 331 -4 l 0 + 266 -4 l 0 + 56 530 l 0 +EndSplineSet +EndChar + +StartChar: d +Encoding: 100 100 20 +Width: 600 +Flags: HMW +TeX: 100 0 +LayerCount: 2 +Fore +SplineSet +440 452 m 0 + 440 771 l 0 + 529 771 l 0 + 529.429 763.115 525.033 757.358 522.644 753.665 c 0 + 518.515 747.282 517.991 744.04 518 738 c 0 + 519 49 l 0 + 519.023 32.976 519.825 16.2095 524 0 c 0 + 441 0 l 0 + 436.758 12.8474 436 26.4226 436 39 c 0 + 436 85 l 0 + 402.754 25.5822 340.198 -11.7426 272.502 -11.7426 c 0 + 170.172 -11.7426 61.9989 73.6686 61.9989 269.088 c 0 + 61.9989 471.408 183.85 543.089 284.756 543.089 c 0 + 357.905 543.089 414.551 506.411 440 452 c 0 +288.638 475.041 m 0 + 227.729 475.041 142.873 433.439 142.873 282.731 c 0 + 142.873 108.363 231.935 61.8091 291.87 61.8091 c 0 + 347.081 61.8091 401.871 98.7178 422.26 162.214 c 0 + 430.843 188.943 433.29 218.613 433.29 258.526 c 0 + 433.29 317.62 430.953 347.168 424.391 371.787 c 0 + 403.443 450.383 335.053 475.041 288.638 475.041 c 0 +EndSplineSet +EndChar + +StartChar: p +Encoding: 112 112 21 +Width: 600 +Flags: HMW +TeX: 112 0 +LayerCount: 2 +Fore +SplineSet +79 529 m 0 + 164 529 l 0 + 164 448 l 0 + 199.965 505.862 263.255 541 331.196 541 c 0 + 435.346 541 546.008 457.517 546.008 270.69 c 0 + 546.008 76.5707 432.1 -14.1497 323.885 -14.1497 c 0 + 259.582 -14.1497 200.339 17.6548 165 70 c 0 + 165 -193 l 0 + 80 -193 l 0 + 79 529 l 0 +300.599 469.911 m 0 + 247.269 469.911 198.023 440.745 177.865 393.197 c 0 + 166.21 365.704 163.875 333.505 163.875 288.853 c 0 + 163.875 212.177 163.543 168.56 179.045 132.849 c 0 + 199.943 84.7085 249.872 59.8372 300.077 59.8372 c 0 + 349.666 59.8372 459.207 86.5412 459.207 253.487 c 0 + 459.207 445.62 347.069 469.911 300.599 469.911 c 0 +EndSplineSet +EndChar + +StartChar: q +Encoding: 113 113 22 +Width: 600 +Flags: HMW +TeX: 113 0 +LayerCount: 2 +Fore +SplineSet +443 452 m 0 + 443 529 l 0 + 522 529 l 0 + 522 -193 l 0 + 439 -193 l 0 + 439 85 l 0 + 405.898 26.0553 344.027 -11.6567 276.61 -11.6567 c 0 + 159.718 -11.6567 58.9968 98.0805 58.9968 269.638 c 0 + 58.9968 449.541 172.706 543.066 288.684 543.066 c 0 + 406.139 543.066 443 451.618 443 452 c 0 +291.949 475.034 m 0 + 220.924 475.034 142.881 419.676 142.881 281.575 c 0 + 142.881 131.999 219.654 61.7898 295.168 61.7898 c 0 + 350.366 61.7898 404.936 99.0666 425.25 162.164 c 0 + 433.889 188.997 436.294 218.713 436.294 258.291 c 0 + 436.294 322.298 433.787 355.626 423.349 384.853 c 0 + 400.165 449.771 339.214 475.034 291.949 475.034 c 0 +EndSplineSet +EndChar + +StartChar: y +Encoding: 121 121 23 +Width: 600 +Flags: HMW +TeX: 121 0 +LayerCount: 2 +Fore +SplineSet +63 529 m 0 + 167 529 l 0 + 167.651 518.579 161.833 512.755 161.833 504.226 c 0 + 161.833 500.853 162.694 498.287 164 495 c 0 + 319 105 l 0 + 420 389 l 0 + 436.209 434.578 451.255 481.532 460 530 c 0 + 547 530 l 0 + 531.434 478.243 513.035 427.412 494 377 c 0 + 329 -60 l 0 + 317.685 -89.9672 306.505 -117.887 283.381 -143.905 c 0 + 248.107 -183.593 198.508 -201.18 150.696 -201.18 c 0 + 107.172 -201.18 66.5488 -186.251 36 -157 c 0 + 79 -82 l 0 + 85.8372 -87.3566 85.2476 -95.0835 88.2407 -100.819 c 0 + 91.1874 -106.465 111.21 -132.772 150.447 -132.772 c 0 + 175.241 -132.772 202.436 -121.95 224.474 -98.4823 c 0 + 241.247 -80.621 251.822 -58.0558 261 -37 c 0 + 278 2 l 0 + 63 529 l 0 +EndSplineSet +EndChar + +StartChar: period +Encoding: 46 46 24 +Width: 600 +Flags: HMW +TeX: 112 0 +LayerCount: 2 +Fore +SplineSet +355.002 53.4929 m 0 + 355.002 17.0088 324.552 -13.046 286.441 -13.046 c 0 + 248.415 -13.046 217.952 16.9803 217.952 53.509 c 0 + 217.952 89.9628 248.383 120.002 286.462 120.002 c 0 + 324.556 120.002 355.002 89.961 355.002 53.4929 c 0 +EndSplineSet +EndChar + +StartChar: comma +Encoding: 44 44 25 +Width: 600 +Flags: HMW +TeX: 99 0 +LayerCount: 2 +Fore +SplineSet +364.152 22.8349 m 0 + 364.152 -37.4943 321.706 -113.057 241 -195 c 0 + 201 -160 l 0 + 228.481 -134.726 247.951 -106.529 259.27 -87.9335 c 0 + 264.928 -78.6381 276.427 -58.8335 276.427 -39.6582 c 0 + 276.427 -15.8026 259.351 -5.13308 249.284 1.56253 c 0 + 239.047 8.37111 216.973 21.6939 216.973 52.8528 c 0 + 216.973 87.8494 245.536 118.93 283.672 118.93 c 0 + 324.887 118.93 364.152 82.133 364.152 22.8349 c 0 +EndSplineSet +EndChar + +StartChar: colon +Encoding: 58 58 26 +Width: 600 +Flags: HMW +TeX: 99 0 +LayerCount: 2 +Fore +Refer: 24 46 S 1 0 0 1 0 370 2 +Refer: 24 46 S 1 0 0 1 0 0 2 +EndChar + +StartChar: semicolon +Encoding: 59 59 27 +Width: 600 +Flags: HMW +TeX: 115 0 +LayerCount: 2 +Fore +Refer: 25 44 N 1 0 0 1 0 0 2 +Refer: 24 46 S 1 0 0 1 0 370 2 +EndChar + +StartChar: plus +Encoding: 43 43 28 +Width: 600 +Flags: HMW +TeX: 112 0 +LayerCount: 2 +Fore +SplineSet +267 606 m 5 + 340 606 l 5 + 340 408 l 5 + 538 408 l 5 + 538 337 l 5 + 340 337 l 5 + 340 120 l 5 + 267 120 l 5 + 267 337 l 5 + 62 337 l 5 + 62 408 l 5 + 267 408 l 5 + 267 606 l 5 +EndSplineSet +EndChar + +StartChar: minus +Encoding: 256 8722 29 +Width: 600 +Flags: HMW +TeX: 104 0 +LayerCount: 2 +Fore +SplineSet +62 398 m 29 + 538 398 l 29 + 538 327 l 29 + 62 327 l 29 + 62 398 l 29 +EndSplineSet +EndChar + +StartChar: equal +Encoding: 61 61 30 +Width: 600 +Flags: HMW +TeX: 101 0 +LayerCount: 2 +Fore +Refer: 29 8722 N 1 0 0 1 0 110 2 +Refer: 29 8722 N 1 0 0 1 0 -130 2 +EndChar + +StartChar: underscore +Encoding: 95 95 31 +Width: 600 +Flags: HMW +TeX: 117 0 +LayerCount: 2 +Fore +SplineSet +50 -22 m 29 + 550 -22 l 29 + 550 -93 l 29 + 50 -93 l 29 + 50 -22 l 29 +EndSplineSet +EndChar + +StartChar: less +Encoding: 60 60 32 +Width: 600 +Flags: HMW +TeX: 108 0 +LayerCount: 2 +Fore +SplineSet +541 575 m 29 + 541 657 l 29 + 50 399 l 29 + 50 343 l 29 + 544 55 l 29 + 544 142 l 29 + 139 370 l 29 + 541 575 l 29 +EndSplineSet +EndChar + +StartChar: greater +Encoding: 62 62 33 +Width: 600 +Flags: HMW +TeX: 103 0 +LayerCount: 2 +Fore +Refer: 32 60 S -1 0 0 1 600 0 2 +EndChar + +StartChar: quotesingle +Encoding: 39 39 34 +Width: 600 +Flags: HMWO +TeX: 113 0 +LayerCount: 2 +Fore +SplineSet +379.671 700.649 m 0 + 379.671 670.206 369.816 633.244 341 554 c 0 + 313 477 l 0 + 249 493 l 0 + 274 571 l 0 + 280.25 590.5 285.304 612.364 285.304 635.105 c 0 + 285.304 660.263 278.044 683.429 278.044 708.518 c 0 + 278.044 754.3 305.162 772.143 327.505 772.143 c 0 + 350.267 772.143 379.671 753.082 379.671 700.649 c 0 +EndSplineSet +EndChar + +StartChar: grave +Encoding: 96 96 35 +Width: 600 +Flags: HMW +TeX: 103 0 +LayerCount: 2 +Fore +Refer: 34 39 S -0.766045 -0.642788 0.642788 -0.766045 104.985 1311.87 2 +EndChar + +StartChar: slash +Encoding: 47 47 36 +Width: 600 +Flags: HMW +TeX: 115 0 +LayerCount: 2 +Fore +SplineSet +84 -15 m 25 + 447 770 l 25 + 516 735 l 25 + 152 -49 l 25 + 84 -15 l 25 +EndSplineSet +EndChar + +StartChar: backslash +Encoding: 92 92 37 +Width: 600 +Flags: HMW +TeX: 98 0 +LayerCount: 2 +Fore +Refer: 36 47 N -1 0 0 1 600 0 2 +EndChar + +StartChar: micro +Encoding: 181 181 38 +Width: 600 +Flags: HMW +TeX: 117 0 +LayerCount: 2 +Fore +SplineSet +38 -193 m 0 + 38.9384 -58.9867 61 87.3183 61 234 c 0 + 61 529 l 0 + 137 529 l 0 + 137 215 l 0 + 137 180.23 138.185 147.14 154.248 114.565 c 0 + 174.86 72.7648 211.805 49.9847 248.66 49.9847 c 0 + 290.595 49.9847 331.561 78.8859 352.027 125.633 c 0 + 365.243 155.818 367 186.455 367 222 c 0 + 367 529 l 0 + 441 529 l 0 + 441 134 l 0 + 441 116.206 440.844 95.0245 450.744 77.6249 c 0 + 459.417 62.3819 473.241 54.8661 487.238 54.8661 c 0 + 526.513 54.8661 551 111 551 111 c 0 + 582 52 l 0 + 559.818 18.1186 523.188 -12.1017 480.237 -12.1017 c 0 + 431.193 -12.1017 391.479 28.1352 385 78 c 0 + 358.195 22.6019 302.55 -13.0043 242.87 -13.0043 c 0 + 186.505 -13.0043 135.089 18.999 111 70 c 0 + 111.199 -18.023 110.861 -105.668 110 -193 c 0 + 38 -193 l 0 +EndSplineSet +EndChar + +StartChar: braceleft +Encoding: 123 123 39 +Width: 600 +Flags: HMW +TeX: 98 0 +LayerCount: 2 +Fore +SplineSet +71 329 m 0 + 94 329 l 0 + 114.58 329 146.235 328.585 171.534 355.122 c 0 + 198.692 383.608 201.554 425.157 201.554 453.492 c 0 + 201.554 481.497 198.598 507.731 198.598 536.425 c 0 + 198.598 580.04 204.818 645.199 255.772 691.645 c 0 + 311.368 742.324 385.82 738 448 738 c 0 + 483 738 l 0 + 483 672 l 0 + 443 672 l 0 + 392.342 672 357.045 676.742 325.874 657.279 c 0 + 281.263 629.425 279.43 573.026 279.43 549.494 c 0 + 279.43 521.751 282.855 496.368 282.855 468.063 c 0 + 282.855 440.501 279.771 406.244 264.439 374.889 c 0 + 247.328 339.898 217.845 312.378 182 297 c 0 + 225.958 281.72 279.876 237.615 279.876 116.516 c 0 + 279.876 80.6922 276.205 50.3097 276.205 19.6336 c 0 + 276.205 -20.2481 282.098 -70.9759 323.519 -99.512 c 0 + 355.221 -121.352 391.356 -119 439 -119 c 0 + 482 -119 l 0 + 482 -184 l 0 + 440 -184 l 0 + 368.421 -184 309.076 -187.506 259.023 -149.094 c 0 + 197.979 -102.247 194.437 -23.0053 194.437 19.058 c 0 + 194.437 64.2177 198.784 98.7588 198.784 134.884 c 0 + 198.784 184.919 190.964 218.659 168.219 240.946 c 0 + 144.453 264.235 114.606 264 95 264 c 0 + 71 264 l 0 + 71 329 l 0 +EndSplineSet +EndChar + +StartChar: braceright +Encoding: 125 125 40 +Width: 600 +Flags: HMW +TeX: 98 0 +LayerCount: 2 +Fore +Refer: 39 123 S -1 0 0 1 600 0 2 +EndChar + +StartChar: asterisk +Encoding: 42 42 41 +Width: 600 +Flags: HMW +TeX: 97 0 +LayerCount: 2 +Fore +SplineSet +257 601 m 0 + 351 601 l 0 + 349.036 587.217 345.49 584.406 344 570 c 0 + 326 396 l 0 + 510 480 l 0 + 541 409 l 0 + 342 349 l 0 + 488 174 l 0 + 425 124 l 0 + 300 316 l 0 + 170 123 l 0 + 107 174 l 0 + 258 348 l 0 + 58 409 l 0 + 88 484 l 0 + 275 396 l 0 + 257 601 l 0 +EndSplineSet +EndChar + +StartChar: O +Encoding: 79 79 42 +Width: 600 +Flags: HMW +TeX: 79 0 +LayerCount: 2 +Fore +SplineSet +556.008 359.504 m 0 + 556.008 296.095 551.428 206.273 513.069 128.645 c 0 + 465.538 32.4568 382.426 -11.0151 304.485 -11.0151 c 0 + 193.976 -11.0151 43.9996 78.3988 43.9996 362.113 c 0 + 43.9996 645.884 196.081 730 303.761 730 c 0 + 382.353 730 464.443 686.67 511.792 593.902 c 0 + 551.172 516.748 556.008 427.05 556.008 359.504 c 0 +300.361 654.01 m 0 + 224.496 654.01 123.971 587.911 123.971 372.659 c 0 + 123.971 143.053 223.619 67.987 304.834 67.987 c 0 + 353.415 67.987 409.355 95.4454 442.765 165.717 c 0 + 472.355 227.951 475.085 301.614 475.085 348.897 c 0 + 475.085 410.01 471.386 479.154 446.984 539.849 c 0 + 413.335 623.543 351.591 654.01 300.361 654.01 c 0 +EndSplineSet +EndChar + +StartChar: zero +Encoding: 48 48 43 +Width: 600 +Flags: HMWO +TeX: 122 0 +LayerCount: 2 +Fore +SplineSet +301.249 727 m 0 + 412.345 727 531.007 595.219 531.007 348.788 c 0 + 531.007 100.694 407.312 -13.0219 302.525 -13.0219 c 0 + 188.358 -13.0219 67.9924 121.658 67.9924 355.222 c 0 + 67.9924 586.285 186.665 727 301.249 727 c 0 +414.067 561.958 m 1 + 383.092 625.695 339.657 656 300.157 656 c 0 + 228.597 656 143.795 554.031 143.795 369.311 c 0 + 143.795 318.267 149.725 272.506 159.907 232.842 c 1 + 414.067 561.958 l 1 +440.863 484.525 m 1 + 186.653 159.413 l 1 + 218.03 96.0835 262.445 60.8848 305.327 60.8848 c 0 + 369.033 60.8848 456.099 137.611 456.099 339.376 c 0 + 456.099 395.528 450.46 443.805 440.863 484.525 c 1 +EndSplineSet +EndChar + +StartChar: one +Encoding: 49 49 44 +Width: 600 +Flags: HMW +TeX: 111 0 +LayerCount: 2 +Fore +SplineSet +357 723 m 0 + 357 -1 l 0 + 276 -1 l 0 + 276 622 l 0 + 131 579 l 0 + 112 624 l 0 + 301 723 l 0 + 357 723 l 0 +EndSplineSet +EndChar + +StartChar: two +Encoding: 50 50 45 +Width: 600 +Flags: HMW +TeX: 116 0 +LayerCount: 2 +Fore +SplineSet +100 610 m 0 + 142.552 682.72 220.175 727.008 302.107 727.008 c 0 + 419.975 727.008 511.536 636.692 511.536 524.194 c 0 + 511.536 420.356 437.434 346.096 384.502 296.506 c 0 + 332.446 247.737 248.223 175.987 188 71 c 0 + 491 71 l 0 + 496.284 71 498.692 71.7409 503.392 75.7939 c 0 + 505.8 77.8706 511.479 83.4955 519 81 c 0 + 519 0 l 0 + 95 0 l 0 + 95 51 l 0 + 155.807 170.93 222.305 245.442 304.763 319.728 c 0 + 357.118 366.894 431.226 430.278 431.226 518.244 c 0 + 431.226 595.847 369.481 655.449 292.555 655.449 c 0 + 229.497 655.449 186.147 616.16 169.108 589.668 c 0 + 162.928 580.06 165.889 572.819 159 563 c 0 + 100 610 l 0 +EndSplineSet +EndChar + +StartChar: N +Encoding: 78 78 46 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +68 0 m 0 + 68 722 l 0 + 147 722 l 0 + 450 187 l 0 + 450 723 l 0 + 536 723 l 0 + 536.929 716.255 533.916 710.683 532.621 708.22 c 0 + 529.844 702.938 528 700.058 528 692 c 0 + 528 -1 l 0 + 464 -1 l 0 + 146 568 l 0 + 146 0 l 0 + 68 0 l 0 +EndSplineSet +EndChar + +StartChar: four +Encoding: 52 52 47 +Width: 600 +Flags: HMW +TeX: 102 0 +LayerCount: 2 +Fore +SplineSet +373 723 m 0 + 441 723 l 0 + 441 271 l 0 + 534 271 l 0 + 534 199 l 0 + 441 199 l 0 + 441 0 l 0 + 357 0 l 0 + 357 200 l 0 + 66 200 l 0 + 66 260 l 0 + 373 723 l 0 +358 594 m 0 + 146 271 l 0 + 358 271 l 0 + 358 594 l 0 +EndSplineSet +EndChar + +StartChar: eight +Encoding: 56 56 48 +Width: 600 +Flags: HMW +TeX: 101 0 +LayerCount: 2 +Fore +SplineSet +309.222 731.061 m 0 + 415.174 731.061 497.201 655.222 497.201 560.081 c 0 + 497.201 490.519 451.989 422.756 382 386 c 0 + 463.398 348.449 521.364 271.387 521.364 186.38 c 0 + 521.364 76.38 425.926 -12.0638 299.122 -12.0638 c 0 + 174.777 -12.0638 79.845 73.9895 79.845 181.557 c 0 + 79.845 264.873 138.311 343.716 224 384 c 0 + 158.829 417.286 113.953 482.052 113.953 553.066 c 0 + 113.953 650.336 198.716 731.061 309.222 731.061 c 0 +285 351 m 0 + 216.282 322.472 162.993 260.535 162.993 192.304 c 0 + 162.993 119.655 224.278 60.9956 302.825 60.9956 c 0 + 380.01 60.9956 439.255 117.609 439.255 187.223 c 0 + 439.255 257.778 377.894 321.691 285 351 c 0 +303.003 663.016 m 0 + 239.989 663.016 191.919 616.894 191.919 559.982 c 0 + 191.919 464.568 319 415 319 415 c 0 + 375.248 445.252 418 499.154 418 554.724 c 0 + 418 615.015 367.541 663.016 303.003 663.016 c 0 +EndSplineSet +EndChar + +StartChar: five +Encoding: 53 53 49 +Width: 600 +Flags: HMW +TeX: 102 0 +LayerCount: 2 +Fore +SplineSet +133 722 m 0 + 499 722 l 0 + 499 649 l 0 + 201 649 l 0 + 190 441 l 0 + 227.409 459.661 267.74 469.014 307.613 469.014 c 0 + 428.503 469.014 526.046 382.829 526.046 228.267 c 0 + 526.046 71.7703 422.799 -13.0166 297.988 -13.0166 c 0 + 212.187 -13.0166 131.88 27.3246 84 98 c 0 + 156 152 l 0 + 165.915 144.928 159.968 133.516 164.636 124.688 c 0 + 168.652 117.094 219.025 57.9865 296.99 57.9865 c 0 + 374.5 57.9865 443.032 118.764 443.032 229.807 c 0 + 443.032 344.87 371.274 402.108 295.262 402.108 c 0 + 245.957 402.108 194.845 377.882 160 334 c 0 + 108 355 l 0 + 133 722 l 0 +EndSplineSet +EndChar + +StartChar: S +Encoding: 83 83 50 +Width: 600 +Flags: HMW +TeX: 83 0 +LayerCount: 2 +Fore +SplineSet +514 636 m 0 + 463 567 l 0 + 460.467 567.77 457.129 570.059 456.897 576.479 c 0 + 456.744 580.739 457.326 583.155 454.259 587.627 c 0 + 426.295 628.402 374.583 659.139 307.322 659.139 c 0 + 224.667 659.139 176.928 608.659 176.928 553.304 c 0 + 176.928 523.788 190.278 480.959 250.701 445.621 c 0 + 316.767 406.982 418.491 386.478 481.296 327.335 c 0 + 526.491 284.776 537.39 234.352 537.39 196.567 c 0 + 537.39 105.698 472.479 -12.0688 296.743 -12.0688 c 0 + 207.646 -12.0688 126.78 19.1667 70 81 c 0 + 118 164 l 0 + 123.54 161.188 123.285 154.812 123.259 152.899 c 0 + 123.193 148.118 122.894 145.188 126.519 140.598 c 0 + 158.801 99.712 219.842 60.9499 299.1 60.9499 c 0 + 403.921 60.9499 456.763 129.108 456.763 191.929 c 0 + 456.763 224.218 443.541 261.931 396.186 291.612 c 0 + 341.618 325.813 237.401 350.797 170.523 400.177 c 0 + 110.323 444.627 93.8001 498.906 93.8001 541.004 c 0 + 93.8001 639.749 183.363 726.008 313.761 726.008 c 0 + 392.466 726.008 465.102 694.099 514 636 c 0 +EndSplineSet +EndChar + +StartChar: M +Encoding: 77 77 51 +Width: 600 +Flags: HMW +TeX: 77 0 +LayerCount: 2 +Fore +SplineSet +57 722 m 0 + 121 722 l 0 + 300 369 l 0 + 482 723 l 0 + 543 723 l 0 + 543 -1 l 0 + 466 -1 l 0 + 466 545 l 0 + 310 254 l 0 + 279 254 l 0 + 133 541 l 0 + 133 -1 l 0 + 57 -1 l 0 + 57 722 l 0 +EndSplineSet +EndChar + +StartChar: L +Encoding: 76 76 52 +Width: 600 +Flags: HMW +TeX: 76 0 +LayerCount: 2 +Fore +SplineSet +87 722 m 0 + 181 722 l 0 + 182.252 713.763 178.671 707.037 176.957 703.776 c 0 + 173.543 697.278 171 693.469 171 683 c 0 + 171 69 l 0 + 519 69 l 0 + 519 -1 l 0 + 87 -1 l 0 + 87 722 l 0 +EndSplineSet +EndChar + +StartChar: ampersand +Encoding: 38 38 53 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +275.219 729.113 m 0 + 362.09 729.113 430.049 664.093 430.049 574.842 c 0 + 430.049 499.041 380.587 423.321 305 382 c 0 + 435 201 l 0 + 462.526 232.964 478.373 266.737 487.03 294.093 c 0 + 487.898 296.839 488.581 299.921 488.581 303.138 c 0 + 488.581 307.706 486.98 312.21 486.98 316.938 c 0 + 486.98 322.596 489.256 326.511 492 329 c 0 + 567 277 l 0 + 540.906 230.061 511.512 184.947 479 142 c 0 + 560 37 l 0 + 492 -14 l 0 + 428 88 l 0 + 382.006 30.9903 310.65 -12.0313 232.619 -12.0313 c 0 + 128.337 -12.0313 51.7317 66.2734 51.7317 169.432 c 0 + 51.7317 258.731 108.958 348.313 198 397 c 0 + 155.129 448.798 115.988 513.456 115.988 577.085 c 0 + 115.988 663.563 187.113 729.113 275.219 729.113 c 0 +195.898 575.613 m 0 + 195.898 545.141 208.5 503.946 266 432 c 0 + 319.757 461.715 354.165 516.513 354.165 569.305 c 0 + 354.165 624.184 316.438 660.403 273.735 660.403 c 0 + 232.647 660.403 195.898 626.428 195.898 575.613 c 0 +238 343 m 0 + 176.427 303.101 139.365 237.448 139.365 177.45 c 0 + 139.365 110.152 186.019 62.8265 245.174 62.8265 c 0 + 322.406 62.8265 386 143 386 143 c 0 + 238 343 l 0 +EndSplineSet +EndChar + +StartChar: F +Encoding: 70 70 54 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +100 723 m 0 + 516 723 l 0 + 516 652 l 0 + 182 652 l 0 + 182 425 l 0 + 452 425 l 0 + 452 355 l 0 + 182 355 l 0 + 182 0 l 0 + 100 0 l 0 + 100 723 l 0 +EndSplineSet +EndChar + +StartChar: w +Encoding: 119 119 55 +Width: 600 +Flags: HMW +TeX: 119 0 +LayerCount: 2 +Fore +SplineSet +28 530 m 0 + 113 530 l 0 + 116.047 520.997 112.999 513.233 111.087 507.077 c 0 + 108.216 497.832 108.458 493.651 110 486 c 0 + 187 104 l 0 + 278 480 l 0 + 329 480 l 0 + 441 105 l 0 + 486.611 406.209 492.089 465.021 490 529 c 0 + 567 529 l 0 + 544.196 351.317 514.841 174.519 479 -1 c 0 + 401 -1 l 0 + 303 342 l 0 + 210 -1 l 0 + 135 -1 l 0 + 28 530 l 0 +EndSplineSet +EndChar + +StartChar: quoteright +Encoding: 257 8217 56 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 25 44 S 1 0 0 1 0 620 2 +EndChar + +StartChar: quoteleft +Encoding: 258 8216 57 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 56 8217 N -1 0 0 -1 565.146 1163.92 2 +EndChar + +StartChar: quotedbl +Encoding: 34 34 58 +Width: 600 +Flags: HMW +TeX: 113 0 +LayerCount: 2 +Fore +Refer: 34 39 S 1 0 0 1 90 0 2 +Refer: 34 39 S 1 0 0 1 -110 0 2 +EndChar + +StartChar: T +Encoding: 84 84 59 +Width: 600 +Flags: HMW +TeX: 84 0 +LayerCount: 2 +Fore +SplineSet +46 723 m 0 + 546 723 l 0 + 546 650 l 0 + 333 650 l 0 + 333 -1 l 0 + 251 -1 l 0 + 251 650 l 0 + 46 650 l 0 + 46 723 l 0 +EndSplineSet +EndChar + +StartChar: hyphen +Encoding: 45 45 60 +Width: 600 +Flags: HMW +TeX: 104 0 +LayerCount: 2 +Fore +SplineSet +92 403 m 0 + 509 403 l 0 + 509 326 l 0 + 92 326 l 0 + 92 403 l 0 +EndSplineSet +EndChar + +StartChar: exclam +Encoding: 33 33 61 +Width: 600 +Flags: HMW +TeX: 101 0 +LayerCount: 2 +Fore +SplineSet +356.002 55.4912 m 0 + 356.002 17.7 325.296 -13.0169 287.479 -13.0169 c 0 + 249.672 -13.0169 218.954 17.6866 218.954 55.4935 c 0 + 218.954 93.2861 249.66 124.002 287.478 124.002 c 0 + 325.284 124.002 356.002 93.2972 356.002 55.4912 c 0 +289.272 774.001 m 0 + 311.02 774.001 335.403 759.407 344.346 724.32 c 0 + 346.091 717.475 348.76 704.489 348.76 677.25 c 0 + 348.76 632.978 340.895 589.116 338 545 c 0 + 317 225 l 0 + 259 225 l 0 + 242 545 l 0 + 237.955 621.137 230.565 649.274 230.565 686.67 c 0 + 230.565 708.378 233.144 724.012 238.462 736.818 c 0 + 248.803 761.721 269.202 774.001 289.272 774.001 c 0 +EndSplineSet +EndChar + +StartChar: exclamdown +Encoding: 161 161 62 +Width: 600 +Flags: HMW +TeX: 101 0 +LayerCount: 2 +Fore +Refer: 61 33 N -1 0 0 -1 574.958 760.985 2 +EndChar + +StartChar: U +Encoding: 85 85 63 +Width: 600 +Flags: HMW +TeX: 85 0 +LayerCount: 2 +Fore +SplineSet +68 722 m 0 + 159 722 l 0 + 159.791 720.163 160.2 718.172 160.2 716.15 c 0 + 160.2 709.235 155.631 704.498 152.571 700.195 c 0 + 148.296 694.182 148 690.266 148 685 c 0 + 148 248 l 0 + 148 212.142 148.701 177.155 165.336 141.578 c 0 + 191.299 86.0528 245.805 55.9211 303.067 55.9211 c 0 + 359.414 55.9211 413.783 85.3437 440.467 140.549 c 0 + 458.225 177.288 459 213.693 459 251 c 0 + 459 722 l 0 + 536 722 l 0 + 536 253 l 0 + 536 200.192 534.408 150.173 507.085 99.8136 c 0 + 466.018 24.1247 384.91 -13.0732 301.461 -13.0732 c 0 + 216.265 -13.0732 136.155 24.9771 96.1412 99.2172 c 0 + 69.4091 148.814 68 197.96 68 249 c 0 + 68 249 l 0 + 68 722 l 0 +EndSplineSet +EndChar + +StartChar: numbersign +Encoding: 35 35 64 +Width: 600 +Flags: HMW +TeX: 110 0 +LayerCount: 2 +Fore +SplineSet +211 723 m 5 + 281 726 l 5 + 256.94 527.366 l 5 + 384.587 528.891 l 5 + 407 717 l 5 + 479 720 l 5 + 455.758 529.742 l 5 + 561 531 l 5 + 555 475 l 5 + 448.941 473.939 l 5 + 425.118 278.915 l 5 + 540 281 l 5 + 534 227 l 5 + 418.548 225.134 l 5 + 393 16 l 5 + 323 12 l 5 + 348.259 223.998 l 5 + 219.943 221.924 l 5 + 195 16 l 5 + 127 13 l 5 + 151.587 220.82 l 5 + 39 219 l 5 + 44 272 l 5 + 157.887 274.066 l 5 + 181.217 471.262 l 5 + 55 470 l 5 + 59 525 l 5 + 187.757 526.539 l 5 + 211 723 l 5 +250.228 471.952 m 5 + 226.409 275.31 l 5 + 354.65 277.637 l 5 + 377.955 473.23 l 5 + 250.228 471.952 l 5 +EndSplineSet +EndChar + +StartChar: j +Encoding: 106 106 65 +Width: 600 +Flags: HMW +TeX: 106 0 +LayerCount: 2 +Fore +SplineSet +156 530 m 4 + 437 530 l 4 + 437 37 l 4 + 437 -8.68478 435.772 -52.1052 413.163 -96.3812 c 4 + 377.277 -166.657 303.238 -202.181 227.699 -202.181 c 4 + 162.017 -202.181 103.902 -175.027 66 -128 c 4 + 120 -56 l 4 + 127.204 -61.9473 125.358 -69.4816 130.11 -77.2483 c 4 + 134.378 -84.2222 169.009 -130.016 233.016 -130.016 c 4 + 277.791 -130.016 319.506 -106.298 339.459 -63.2398 c 4 + 352.497 -35.1019 353 -7.27543 353 21 c 4 + 353 461 l 4 + 156 461 l 4 + 156 530 l 4 +396.003 760 m 4 + 429.171 760 456.019 733.28 456.019 700.493 c 4 + 456.019 667.727 429.182 640.992 395.99 640.992 c 4 + 362.818 640.992 335.981 667.716 335.981 700.486 c 4 + 335.981 733.264 362.822 760 396.003 760 c 4 +EndSplineSet +EndChar + +StartChar: x +Encoding: 120 120 66 +Width: 600 +Flags: HMW +TeX: 120 0 +LayerCount: 2 +Fore +SplineSet +430 530 m 1 + 515 530 l 1 + 343.447 272.196 l 1 + 538 0 l 1 + 443 0 l 1 + 297.06 205.835 l 1 + 159 0 l 1 + 65 0 l 1 + 250.856 269.049 l 1 + 68 530 l 1 + 159 530 l 1 + 297.737 333.918 l 1 + 430 530 l 1 +EndSplineSet +EndChar + +StartChar: G +Encoding: 71 71 67 +Width: 600 +Flags: HMW +TeX: 71 0 +LayerCount: 2 +Fore +SplineSet +331.256 729.021 m 0 + 420.211 729.021 499.721 682.82 541 608 c 0 + 484 550 l 0 + 474.934 555.815 472.124 564.988 468.568 572.778 c 0 + 446.485 621.163 395.191 658.068 330.753 658.068 c 0 + 269.931 658.068 205.563 624.733 168.312 554.634 c 0 + 140.066 501.479 131.993 436.71 131.993 369.475 c 0 + 131.993 293.213 140.467 191.911 200.744 123.216 c 0 + 240.013 78.4622 291.335 59.9971 338.046 59.9971 c 0 + 381.069 59.9971 427.485 75.1275 468 104 c 0 + 468 276 l 0 + 337 276 l 0 + 337 346 l 0 + 543 346 l 0 + 543 64 l 0 + 474.935 13.8821 397.763 -11.0487 330.884 -11.0487 c 0 + 204.891 -11.0487 51.8871 79.1096 51.8871 352.371 c 0 + 51.8871 669.165 235.235 729.021 331.256 729.021 c 0 +EndSplineSet +EndChar + +StartChar: k +Encoding: 107 107 68 +Width: 600 +Flags: HMW +TeX: 107 0 +LayerCount: 2 +Fore +SplineSet +87 770 m 0 + 182 770 l 0 + 183.286 762.176 178.153 756.852 175.466 753.359 c 0 + 171.419 748.094 171 745.015 171 740 c 0 + 171 286 l 0 + 436 532 l 0 + 456.53 526.949 477.704 526 498 526 c 0 + 528 526 l 0 + 305 316 l 0 + 565 -1 l 0 + 562.299 -0.982364 559.597 -0.973546 556.896 -0.973546 c 0 + 501.401 -0.973546 457 -5 457 -5 c 0 + 241 265 l 0 + 171 200 l 0 + 171 -1 l 0 + 87 -1 l 0 + 87 770 l 0 +EndSplineSet +EndChar + +StartChar: z +Encoding: 122 122 69 +Width: 600 +Flags: HMW +TeX: 122 0 +LayerCount: 2 +Fore +SplineSet +92 530 m 0 + 504 530 l 0 + 504 473 l 0 + 181 71 l 0 + 496 71 l 0 + 512.142 71 516.579 80.1398 531 78 c 0 + 531 -1 l 0 + 68 -1 l 0 + 68 56 l 0 + 396 457 l 0 + 92 457 l 0 + 92 530 l 0 +EndSplineSet +EndChar + +StartChar: dollar +Encoding: 36 36 70 +Width: 600 +Flags: HMW +TeX: 100 0 +LayerCount: 2 +Fore +SplineSet +282 754 m 1 + 357 754 l 1 + 357.544 752.762 357.825 751.416 357.825 750.046 c 0 + 357.825 741.462 350 741.128 350 730 c 2 + 350 685.53 l 1 + 418.468 678.631 479.448 647.798 522 597 c 1 + 472 534 l 1 + 469.529 534.647 466.405 536.859 465.998 542.031 c 0 + 465.734 545.385 466.586 548.59 464.873 552.132 c 0 + 464.366 553.181 463.571 554.432 459.966 558.804 c 0 + 435.884 588.015 400.197 609.606 350 617.169 c 1 + 350 394.007 l 1 + 376.209 385.213 402.685 376.233 426.693 365.906 c 0 + 451.098 355.408 542.789 316.114 542.789 210.306 c 0 + 542.789 127.201 481.207 35.8962 350 18.7898 c 1 + 350 -54 l 1 + 282 -54 l 1 + 282 16.6512 l 1 + 202.131 21.6382 130.573 53.0648 79 109 c 1 + 129 178 l 1 + 134.731 175.387 134.178 168.719 134.1 167.269 c 0 + 133.829 162.202 133.224 159.078 137.667 154.35 c 0 + 170.199 119.732 221.081 90.2105 282 83.4419 c 1 + 282 338.141 l 1 + 260.848 345.221 239.279 353.278 218.422 363.137 c 0 + 121.008 409.184 101.838 474.448 101.838 516.644 c 0 + 101.838 600.059 175.207 670.816 282 684.586 c 1 + 282 754 l 1 +350 316.849 m 1 + 350 85.8432 l 1 + 424.317 100.222 467.128 152.561 467.128 204.903 c 0 + 467.128 228.695 458.246 267.247 409.599 293.705 c 0 + 393.686 302.36 373.118 309.563 350 316.849 c 1 +282 418.096 m 1 + 282 618.618 l 1 + 209.129 610.103 178.407 566.678 178.407 526.615 c 0 + 178.407 501.336 190.349 466.609 241.42 437.196 c 0 + 253.404 430.294 267.16 424.024 282 418.096 c 1 +EndSplineSet +EndChar + +StartChar: A +Encoding: 65 65 71 +Width: 600 +Flags: HMW +TeX: 65 0 +LayerCount: 2 +Fore +SplineSet +27 -1 m 0 + 282 735 l 0 + 291 735 l 0 + 570 0 l 0 + 486 0 l 0 + 406 211 l 0 + 177 211 l 0 + 107 -1 l 0 + 27 -1 l 0 +388 274 m 0 + 286 549 l 0 + 193 274 l 0 + 388 274 l 0 +EndSplineSet +EndChar + +StartChar: C +Encoding: 67 67 72 +Width: 600 +Flags: HMW +TeX: 67 0 +LayerCount: 2 +Fore +SplineSet +331.618 728 m 0 + 427.542 728 514.176 672.042 553 585 c 0 + 476 547 l 0 + 470.67 550.736 470.716 557.019 470.716 558.375 c 0 + 470.716 561.257 471.207 564.142 471.207 567.016 c 0 + 471.207 572.403 469.516 575.396 467.216 579.368 c 0 + 438.075 629.699 385.397 663.168 328.882 663.168 c 0 + 226.816 663.168 135.987 555.779 135.987 363.969 c 0 + 135.987 168.839 229.418 57.9939 335.655 57.9939 c 0 + 392.317 57.9939 449.702 90.8843 483 146 c 0 + 543 107 l 0 + 497.694 32.979 417.217 -12.0016 331.109 -12.0016 c 0 + 212.178 -12.0016 56.9666 77.8506 56.9666 356.807 c 0 + 56.9666 645.838 219.327 728 331.618 728 c 0 +EndSplineSet +EndChar + +StartChar: B +Encoding: 66 66 73 +Width: 600 +Flags: HMW +TeX: 66 0 +LayerCount: 2 +Fore +SplineSet +66 722 m 0 + 271 722 l 0 + 315.399 722 360.704 721.5 405.879 701.856 c 0 + 473.724 672.354 511 610.49 511 545.61 c 0 + 511 476.391 468.788 413.433 404 387 c 0 + 484.894 359.735 539.123 283.98 539.123 199.903 c 0 + 539.123 125.489 496.411 54.7898 418.712 21.7722 c 0 + 368.818 0.569996 319.11 0 270 0 c 0 + 66 0 l 0 + 66 722 l 0 +146 653 m 0 + 146 423 l 0 + 259 423 l 0 + 291.145 423 325.727 423.132 358.963 437.515 c 0 + 404.424 457.189 429.169 496.927 429.169 538.138 c 0 + 429.169 579.684 403.799 620.586 355.923 639.925 c 0 + 323.833 652.887 290.834 653 260 653 c 0 + 146 653 l 0 +146 355 m 0 + 146 71 l 0 + 284 71 l 0 + 315.204 71 345.804 71.5467 376.985 85.5968 c 0 + 426.877 108.078 454.347 156.379 454.347 208.01 c 0 + 454.347 260.227 425.928 311.754 372.336 337.19 c 0 + 336.297 354.296 300.473 355 264 355 c 0 + 146 355 l 0 +EndSplineSet +EndChar + +StartChar: bracketleft +Encoding: 91 91 74 +Width: 600 +Flags: HMW +TeX: 98 0 +LayerCount: 2 +Fore +SplineSet +162 776 m 0 + 493 776 l 0 + 493 707 l 0 + 236 707 l 0 + 236 -37 l 0 + 494 -37 l 0 + 494 -103 l 0 + 162 -103 l 0 + 162 776 l 0 +EndSplineSet +EndChar + +StartChar: bracketright +Encoding: 93 93 75 +Width: 600 +Flags: HMW +TeX: 98 0 +LayerCount: 2 +Fore +Refer: 74 91 S -1 0 0 1 600 0 2 +EndChar + +StartChar: parenleft +Encoding: 40 40 76 +Width: 600 +Flags: HMW +TeX: 112 0 +LayerCount: 2 +Fore +SplineSet +464 772 m 4 + 499 701 l 4 + 495.074 698.763 491.329 698.611 489.669 698.611 c 4 + 485.073 698.611 481.395 699.932 477.323 699.932 c 4 + 472.717 699.932 469.928 698.14 466.835 696.315 c 4 + 331.453 616.467 251.273 468.859 251.273 303.345 c 4 + 251.273 123.314 344.63 -46.9685 503 -139 c 4 + 465 -200 l 4 + 281.456 -103.658 170.68 88.9922 170.68 299.462 c 4 + 170.68 511.567 284.678 693.118 464 772 c 4 +EndSplineSet +EndChar + +StartChar: parenright +Encoding: 41 41 77 +Width: 600 +Flags: HMW +TeX: 112 0 +LayerCount: 2 +Fore +SplineSet +100 699 m 0 + 122 771 l 0 + 310.266 684.352 432 496.633 432 290.289 c 0 + 432 82.1043 308.169 -110.384 116 -202 c 0 + 94 -132 l 0 + 250.594 -49.1168 350.028 112.597 350.028 286.978 c 0 + 350.028 458.955 253.152 617.58 100 699 c 0 +EndSplineSet +EndChar + +StartChar: three +Encoding: 51 51 78 +Width: 600 +Flags: HMW +TeX: 116 0 +LayerCount: 2 +Fore +SplineSet +486.039 541.353 m 0 + 486.039 471.159 442.787 409.132 378 385 c 0 + 452.906 357.628 502.026 284.533 502.026 198.625 c 0 + 502.026 86.4453 418.041 -12.1905 279.723 -12.1905 c 0 + 207.414 -12.1905 138.424 16.1652 90 70 c 0 + 151 143 l 0 + 161.292 132.464 156.135 121.234 165.975 110.147 c 0 + 171.105 104.367 211.734 61.2614 278.997 61.2614 c 0 + 363.525 61.2614 424.303 129.155 424.303 208.449 c 0 + 424.303 294.507 352.456 345.579 254.688 345.579 c 0 + 242.418 345.579 230.159 344.711 218 343 c 0 + 218 408 l 0 + 286.501 408.15 319.346 420.748 332.04 426.323 c 0 + 382.02 448.274 409.043 495.946 409.043 539.93 c 0 + 409.043 600.917 357.627 652.425 283.533 652.425 c 0 + 238.887 652.425 192.677 633.092 159 597 c 0 + 114 647 l 0 + 159.315 696.504 222.364 724.29 287.492 724.29 c 0 + 401.687 724.29 486.039 639.912 486.039 541.353 c 0 +EndSplineSet +EndChar + +StartChar: D +Encoding: 68 68 79 +Width: 600 +Flags: HMW +TeX: 68 0 +LayerCount: 2 +Fore +SplineSet +72 722 m 0 + 241 722 l 0 + 304.677 722 356.645 717.434 409.104 683.3 c 0 + 501.966 622.876 543.181 501.213 543.181 362.199 c 0 + 543.181 204.202 486.7 81.1929 383.192 27.9784 c 0 + 332.292 1.81019 284.391 -1 227 -1 c 0 + 72 -1 l 0 + 72 722 l 0 +149 653 m 0 + 149 63 l 0 + 223 63 l 0 + 268.397 63 312.737 65.0195 358.002 95.5625 c 0 + 415.69 134.488 461.352 213.696 461.352 351.331 c 0 + 461.352 455.017 438.945 557.739 371.85 613.352 c 0 + 327.165 650.39 281.491 653 236 653 c 0 + 149 653 l 0 +EndSplineSet +EndChar + +StartChar: E +Encoding: 69 69 80 +Width: 600 +Flags: HMW +TeX: 69 0 +LayerCount: 2 +Fore +SplineSet +78 723 m 0 + 521 723 l 0 + 521 651 l 0 + 155 651 l 0 + 155 414 l 0 + 457 414 l 0 + 457 340 l 0 + 155 340 l 0 + 155 72 l 0 + 518 72 l 0 + 518 0 l 0 + 78 0 l 0 + 78 723 l 0 +EndSplineSet +EndChar + +StartChar: V +Encoding: 86 86 81 +Width: 600 +Flags: HMW +TeX: 86 0 +LayerCount: 2 +Fore +SplineSet +39 723 m 0 + 124 723 l 0 + 309 168 l 0 + 484 722 l 0 + 564 722 l 0 + 322 -5 l 0 + 285 -5 l 0 + 39 723 l 0 +EndSplineSet +EndChar + +StartChar: percent +Encoding: 37 37 82 +Width: 600 +Flags: HMW +TeX: 112 0 +LayerCount: 2 +Fore +SplineSet +463 722 m 0 + 541 722 l 0 + 137 0 l 0 + 63 0 l 0 + 463 722 l 0 +171.904 735.106 m 0 + 242.474 735.106 302.16 670.55 302.16 582.187 c 0 + 302.16 496.123 243.528 431.982 172.952 431.982 c 0 + 101.84 431.982 42.8516 496.911 42.8516 583.448 c 0 + 42.8516 672.526 103.042 735.106 171.904 735.106 c 0 +170.33 674.005 m 0 + 147.48 674.005 112.978 656.124 112.978 587.43 c 0 + 112.978 508.953 151.261 493.911 172.149 493.911 c 0 + 195.202 493.911 229.092 512.141 229.092 579.148 c 0 + 229.092 661.667 189.098 674.005 170.33 674.005 c 0 +569.018 138.593 m 0 + 569.018 51.7449 509.983 -12.1238 439.695 -12.1238 c 0 + 369.049 -12.1238 309.98 52.0529 309.98 138.262 c 0 + 309.98 225.089 369.219 289.001 439.589 289.001 c 0 + 510.127 289.001 569.018 224.871 569.018 138.593 c 0 +439.32 229.005 m 0 + 414.436 229.005 378.994 208.941 378.994 138.34 c 0 + 378.994 69.8907 413.149 46.7696 440.303 46.7696 c 0 + 465.114 46.7696 500.009 66.7942 500.009 135.903 c 0 + 500.009 210.33 463.157 229.005 439.32 229.005 c 0 +EndSplineSet +EndChar + +StartChar: J +Encoding: 74 74 83 +Width: 600 +Flags: HMW +TeX: 74 0 +LayerCount: 2 +Fore +SplineSet +209 722 m 0 + 539 722 l 0 + 539 654 l 0 + 428 654 l 0 + 428 242 l 0 + 428 189.714 427.529 134.891 399.871 83.1312 c 0 + 366.41 20.5134 303.824 -13.1014 235.465 -13.1014 c 0 + 171.621 -13.1014 109.768 15.8267 67 67 c 0 + 121 133 l 0 + 127.875 126.68 123.023 118.695 128.162 112.068 c 0 + 130.663 108.842 176.362 58.6812 236.758 58.6812 c 0 + 271.444 58.6812 302.787 75.9435 322.107 104.722 c 0 + 348.989 144.764 348 196.3 348 241 c 0 + 348 654 l 0 + 209 654 l 0 + 209 722 l 0 +EndSplineSet +EndChar + +StartChar: K +Encoding: 75 75 84 +Width: 600 +Flags: HMW +TeX: 75 0 +LayerCount: 2 +Fore +SplineSet +59 723 m 0 + 156 723 l 0 + 157.286 715.176 152.153 709.852 149.466 706.359 c 0 + 145.419 701.094 145 698.015 145 693 c 0 + 145 389 l 0 + 447 728 l 0 + 466.858 722.945 487.384 722 507 722 c 0 + 537 722 l 0 + 264 410 l 0 + 556 -1 l 0 + 498.81 -0.826198 453 -5 453 -5 c 0 + 202 361 l 0 + 145 299 l 0 + 145 0 l 0 + 59 0 l 0 + 59 723 l 0 +EndSplineSet +EndChar + +StartChar: P +Encoding: 80 80 85 +Width: 600 +Flags: HMW +TeX: 80 0 +LayerCount: 2 +Fore +SplineSet +78 722 m 0 + 298 722 l 0 + 344.56 722 389.35 720.81 434.624 697.494 c 0 + 502.828 662.37 538.016 591.718 538.016 518.699 c 0 + 538.016 445.503 502.883 376.352 436.114 342.409 c 0 + 392.262 320.116 348.977 319 304 319 c 0 + 304 319 l 0 + 162 319 l 0 + 162 0 l 0 + 78 0 l 0 + 78 722 l 0 +162 646 m 0 + 161 390 l 0 + 307 390 l 0 + 335.466 390 362.993 390.678 390.831 404.763 c 0 + 432.659 425.926 455.003 468.944 455.003 514.986 c 0 + 455.003 561.985 431.629 607.921 386.619 630.5 c 0 + 357.19 645.263 328.165 646 298 646 c 0 + 162 646 l 0 +EndSplineSet +EndChar + +StartChar: question +Encoding: 63 63 86 +Width: 600 +Flags: HMW +TeX: 113 0 +LayerCount: 2 +Fore +SplineSet +381.002 51.4929 m 0 + 381.002 15.0088 350.552 -15.046 312.441 -15.046 c 0 + 274.415 -15.046 243.952 14.9803 243.952 51.509 c 0 + 243.952 87.9628 274.383 118.002 312.462 118.002 c 0 + 350.556 118.002 381.002 87.961 381.002 51.4929 c 0 +84 650 m 0 + 134.425 727.691 220.637 771.06 307.402 771.06 c 0 + 438.699 771.06 513.24 674.633 513.24 566.639 c 0 + 513.24 457.756 436.646 413.666 398.404 379.676 c 0 + 350.692 337.269 348 302.835 348 262 c 0 + 348 214 l 0 + 272 214 l 0 + 272 262 l 0 + 272 314.014 275.26 354.806 326.449 411.013 c 0 + 361.471 449.468 421.576 496.796 421.576 572.709 c 0 + 421.576 641.182 368.948 695.153 299.634 695.153 c 0 + 241.046 695.153 179.542 656.112 143 595 c 0 + 84 650 l 0 +EndSplineSet +EndChar + +StartChar: at +Encoding: 64 64 87 +Width: 600 +Flags: HMW +TeX: 97 0 +LayerCount: 2 +Fore +SplineSet +514 35 m 0 + 465.464 3.64213 409.094 -13.0048 351.681 -13.0048 c 0 + 207.208 -13.0048 45.979 94.7502 45.979 363.717 c 0 + 45.979 626.559 197.939 733 324.448 733 c 0 + 408.454 733 485.773 686.98 523.017 604.767 c 0 + 548.262 549.038 549 493.218 549 438 c 0 + 549 203 l 0 + 479 203 l 0 + 479 247 l 0 + 450.306 212.734 407.914 192.94 363.251 192.94 c 0 + 280.295 192.94 212.67 260.162 212.67 343.965 c 0 + 212.67 406.432 250.973 468.115 322.793 496.582 c 0 + 368.543 514.716 414.747 515 459 515 c 0 + 476 515 l 0 + 475.939 600.733 407.704 671.014 321.098 671.014 c 0 + 220.711 671.014 112.988 575.649 112.988 367.243 c 0 + 112.988 141.221 246.229 52.9323 358.489 52.9323 c 0 + 402.842 52.9323 446.203 66.182 483 91 c 0 + 514 35 l 0 +479 457 m 0 + 460 457 l 0 + 418.559 457 369.9 456.608 330.805 429.771 c 0 + 299.601 408.352 284.927 377.014 284.927 347.37 c 0 + 284.927 297.233 325.741 256.964 376.598 256.964 c 0 + 410.056 256.964 444.081 274.841 462.01 309.68 c 0 + 480.087 344.808 479 389.066 479 435 c 0 + 479 457 l 0 +EndSplineSet +EndChar + +StartChar: bar +Encoding: 124 124 88 +Width: 600 +Flags: HMW +TeX: 98 0 +LayerCount: 2 +Fore +SplineSet +261 756 m 0 + 339 756 l 0 + 339 -175 l 0 + 261 -175 l 0 + 261 756 l 0 +EndSplineSet +EndChar + +StartChar: asciitilde +Encoding: 126 126 89 +Width: 600 +Flags: HMW +TeX: 97 0 +LayerCount: 2 +Fore +SplineSet +116 396 m 4 + 58 434 l 4 + 92.198 492.034 151.499 538.051 217.153 538.051 c 4 + 312.781 538.051 343.146 450.999 409.264 450.999 c 4 + 447.27 450.999 474.649 480.653 508 526 c 4 + 561 482 l 4 + 530.811 436.285 473.381 375.377 400.536 375.377 c 4 + 306.617 375.377 282.907 467.595 212.175 467.595 c 4 + 179.423 467.595 145.323 443.982 116 396 c 4 +EndSplineSet +EndChar + +StartChar: asciicircum +Encoding: 94 94 90 +Width: 600 +Flags: HMW +TeX: 97 0 +LayerCount: 2 +Fore +SplineSet +118 425 m 0 + 295 722 l 0 + 320 722 l 0 + 477 426 l 0 + 415 397 l 0 + 303 600 l 0 + 176 397 l 0 + 118 425 l 0 +EndSplineSet +EndChar + +StartChar: cent +Encoding: 162 162 91 +Width: 600 +Flags: HMW +TeX: 99 0 +LayerCount: 2 +Fore +SplineSet +340 723 m 1 + 418 715 l 1 + 418.775 707.498 415.212 701.298 413.826 698.827 c 0 + 410.853 693.526 409.047 690.934 408 683 c 2 + 395.457 587.822 l 1 + 458.442 575.242 504.754 541.294 533 498 c 1 + 482 432 l 1 + 476.607 435.758 476.706 442.016 476.706 443.549 c 0 + 476.706 450.099 478.707 455.066 472.749 462.134 c 0 + 457.796 479.871 428.657 504.643 386.192 517.517 c 1 + 332.752 112 l 1 + 333.469 111.999 l 2 + 389.462 111.999 444.705 135.589 485 177 c 1 + 527 121 l 1 + 477.291 66.4244 406.711 37.9886 331.604 37.9886 c 0 + 328.725 37.9886 325.862 38.0286 323.014 38.1081 c 1 + 306 -91 l 1 + 239 -83 l 1 + 255.422 48.0539 l 1 + 141.433 79.5748 66 182.291 66 315.836 c 0 + 66 471.215 168.407 585.207 323.673 592.709 c 1 + 340 723 l 1 +265.044 124.836 m 1 + 315.274 525.684 l 1 + 219.938 519.993 147.95 447.755 147.95 326.544 c 0 + 147.95 225.647 194.972 152.96 265.044 124.836 c 1 +EndSplineSet +EndChar + +StartChar: euro +Encoding: 164 8364 92 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +548 665 m 5 + 519 586 l 5 + 510.733 592.758 515.379 602.068 509.042 609.779 c 4 + 507.922 611.142 464.815 661.167 386.755 661.167 c 4 + 317.566 661.167 233.594 620.979 199.483 502.334 c 4 + 197.686 496.082 195.746 488.698 193.828 480 c 5 + 480 480 l 5 + 455 413 l 5 + 184.084 413 l 5 + 182.441 393.403 181.417 370.757 181.417 344.613 c 4 + 181.417 336.225 181.561 328.021 181.852 320 c 5 + 420 320 l 5 + 394 253 l 5 + 188.48 253 l 5 + 196.603 205.904 211.936 166.8 235.532 134.868 c 4 + 276.315 79.6765 335.261 56.791 388.936 56.791 c 4 + 435.098 56.791 479.134 73.5085 513 104 c 5 + 546 46 l 5 + 501.68 7.4161 444.786 -13.1265 384.233 -13.1265 c 4 + 290.458 -13.1265 145.304 38.4687 114.986 253 c 5 + 48 253 l 5 + 63 320 l 5 + 109.56 320 l 5 + 109.4 326.06 109.319 332.225 109.319 338.496 c 4 + 109.319 363.479 110.295 388.448 112.538 413 c 5 + 48 413 l 5 + 63 480 l 5 + 122.297 480 l 5 + 130.798 521.099 144.028 559.766 163.557 593.831 c 4 + 222.805 697.179 318.974 727.394 391.356 727.394 c 4 + 452.52 727.394 507.764 705.737 548 665 c 5 +EndSplineSet +EndChar + +StartChar: sterling +Encoding: 163 163 93 +Width: 600 +Flags: HMW +TeX: 115 0 +LayerCount: 2 +Fore +SplineSet +494 663 m 1 + 443 599 l 1 + 433.543 605.934 434.27 615.246 427.512 622.673 c 0 + 422.593 628.078 390.006 656.128 341.348 656.128 c 0 + 279.173 656.128 217.781 609.4 217.781 512.955 c 0 + 217.781 488.175 221.729 463.315 227.168 438 c 1 + 342 438 l 1 + 342 372 l 1 + 242.811 372 l 1 + 251.234 336.143 258.537 298.852 258.537 259.182 c 0 + 258.537 201.957 243.517 148.5 216 104 c 1 + 226.25 105.791 236.644 106.675 247.063 106.675 c 0 + 324.103 106.675 372.006 58.9164 438.359 58.9164 c 0 + 470.325 58.9164 500.468 70.8547 524 91 c 1 + 555 31 l 1 + 528.906 10.2532 484.714 -17.1633 434.141 -17.1633 c 0 + 360.259 -17.1633 311.803 34.666 227.673 34.666 c 0 + 203.994 34.666 159.283 30.2658 85 -9 c 1 + 55 57 l 1 + 108.912 81.9053 122.949 87.4528 141.287 115.98 c 0 + 167.053 156.062 181.214 204.698 181.214 256.851 c 0 + 181.214 296.572 172.952 334.482 163.82 372 c 1 + 88 372 l 1 + 88 438 l 1 + 148.325 438 l 1 + 143.399 462.328 139.93 486.842 139.93 511.928 c 0 + 139.93 641.884 235.856 722.006 343.371 722.006 c 0 + 398.585 722.006 452.418 701.138 494 663 c 1 +EndSplineSet +EndChar + +StartChar: Y +Encoding: 89 89 94 +Width: 600 +Flags: HMW +TeX: 89 0 +LayerCount: 2 +Fore +SplineSet +43 723 m 0 + 135 723 l 0 + 312 372 l 0 + 472 722 l 0 + 558 722 l 0 + 353 285 l 0 + 353 0 l 0 + 265 0 l 0 + 265 285 l 0 + 43 723 l 0 +EndSplineSet +EndChar + +StartChar: yen +Encoding: 165 165 95 +Width: 600 +Flags: HMW +TeX: 121 0 +LayerCount: 2 +Fore +SplineSet +52 723 m 1 + 142 723 l 1 + 310 421 l 1 + 464 722 l 1 + 550 722 l 1 + 348 342 l 1 + 348 318 l 1 + 504 318 l 1 + 504 252 l 1 + 348 252 l 1 + 348 179 l 1 + 504 179 l 1 + 504 114 l 1 + 348 114 l 1 + 348 0 l 1 + 269 0 l 1 + 269 114 l 1 + 107 114 l 1 + 107 179 l 1 + 269 179 l 1 + 269 252 l 1 + 107 252 l 1 + 107 318 l 1 + 269 318 l 1 + 269 342 l 1 + 52 723 l 1 +EndSplineSet +EndChar + +StartChar: Z +Encoding: 90 90 96 +Width: 600 +Flags: HMW +TeX: 90 0 +LayerCount: 2 +Fore +SplineSet +82 722 m 0 + 528 722 l 0 + 527 665 l 0 + 170 71 l 0 + 511 71 l 0 + 527.142 71 531.579 80.1398 546 78 c 0 + 546 -1 l 0 + 68 -1 l 0 + 68 56 l 0 + 432 649 l 0 + 82 649 l 0 + 82 722 l 0 +EndSplineSet +EndChar + +StartChar: Q +Encoding: 81 81 97 +Width: 600 +Flags: HMW +TeX: 81 0 +LayerCount: 2 +Fore +SplineSet +300.491 656.024 m 0 + 221.775 656.024 122.96 585.888 122.96 373.877 c 0 + 122.96 144.877 220.551 63.9921 305.427 63.9921 c 0 + 366.012 63.9921 478.121 108.342 478.121 348.259 c 0 + 478.121 408.965 473.721 479.175 448.587 540.782 c 0 + 413.795 626.06 351.323 656.024 300.491 656.024 c 0 +556.015 357.88 m 0 + 556.015 294.497 551.45 205.023 513.096 127.795 c 0 + 473.396 47.8558 408.806 4.43529 343.02 -7.54866 c 1 + 344.367 -47.6073 355.333 -95.0859 427.899 -95.0859 c 0 + 453.816 -95.0859 485.178 -90.5919 522 -89 c 1 + 520 -168 l 1 + 436.632 -167.285 386.166 -172.61 341.235 -150.307 c 0 + 288.619 -124.19 270.811 -74.3879 271.79 -8.40479 c 1 + 166.776 8.0711 43.9994 105.441 43.9994 361.966 c 0 + 43.9994 646.356 196.451 730 303.805 730 c 0 + 383.023 730 465.547 686.019 512.626 592.269 c 0 + 551.227 515.402 556.015 426.335 556.015 357.88 c 0 +EndSplineSet +EndChar + +StartChar: thorn +Encoding: 254 254 98 +Width: 600 +Flags: HMW +TeX: 116 0 +LayerCount: 2 +Fore +SplineSet +80 770 m 0 + 172 770 l 0 + 172.534 754.226 164 750.539 164 732 c 0 + 164 448 l 0 + 199.965 505.862 263.255 541 331.196 541 c 0 + 435.346 541 546.008 457.517 546.008 270.69 c 0 + 546.008 76.5707 432.1 -14.1497 323.885 -14.1497 c 0 + 259.582 -14.1497 200.339 17.6548 165 70 c 0 + 165 -193 l 0 + 80 -193 l 0 + 80 770 l 0 +300.599 469.911 m 0 + 247.269 469.911 198.023 440.745 177.865 393.197 c 0 + 166.21 365.704 163.875 333.505 163.875 288.853 c 0 + 163.875 212.177 163.543 168.56 179.045 132.849 c 0 + 199.943 84.7085 249.872 59.8372 300.077 59.8372 c 0 + 349.666 59.8372 459.207 86.5412 459.207 253.487 c 0 + 459.207 445.62 347.069 469.911 300.599 469.911 c 0 +EndSplineSet +EndChar + +StartChar: questiondown +Encoding: 191 191 99 +Width: 600 +Flags: HMW +TeX: 113 0 +LayerCount: 2 +Fore +Refer: 86 63 N -1 0 0 -1 601.159 755.969 2 +EndChar + +StartChar: plusminus +Encoding: 177 177 100 +Width: 600 +Flags: HMW +TeX: 112 0 +LayerCount: 2 +Fore +SplineSet +63 93 m 4 + 540 93 l 4 + 540 20 l 4 + 63 20 l 4 + 63 93 l 4 +EndSplineSet +Refer: 28 43 N 1 0 0 1 0 60 2 +EndChar + +StartChar: R +Encoding: 82 82 101 +Width: 600 +Flags: HMW +TeX: 82 0 +LayerCount: 2 +Fore +SplineSet +75 722 m 0 + 288 722 l 0 + 334.667 722 380.248 720.95 425.988 697.719 c 0 + 492.448 663.965 528.143 596.481 528.143 523.978 c 0 + 528.143 428.394 468.499 345.903 381 322 c 0 + 548 0 l 0 + 457 0 l 0 + 297 319 l 0 + 157 319 l 0 + 157 0 l 0 + 75 0 l 0 + 75 722 l 0 +157 646 m 0 + 157 390 l 0 + 297 390 l 0 + 325.466 390 352.993 390.678 380.831 404.763 c 0 + 422.659 425.926 445.003 468.944 445.003 514.986 c 0 + 445.003 561.985 421.629 607.921 376.619 630.5 c 0 + 347.19 645.263 318.165 646 288 646 c 0 + 157 646 l 0 +EndSplineSet +EndChar + +StartChar: X +Encoding: 88 88 102 +Width: 600 +Flags: HMW +TeX: 88 0 +LayerCount: 2 +Fore +SplineSet +449 723 m 1 + 530 723 l 1 + 347.292 370.084 l 1 + 552 0 l 1 + 461 0 l 1 + 300.474 286.156 l 1 + 146 0 l 1 + 57 0 l 1 + 254.441 368.201 l 1 + 61 723 l 1 + 148 723 l 1 + 300.153 448.564 l 1 + 449 723 l 1 +EndSplineSet +EndChar + +StartChar: six +Encoding: 54 54 103 +Width: 600 +Flags: HMW +TeX: 115 0 +LayerCount: 2 +Fore +SplineSet +342.659 730.138 m 0 + 401.412 730.138 458.584 705.809 501 664 c 0 + 445 602 l 0 + 434.368 609.82 434.59 620.671 427.517 628.077 c 0 + 423.092 632.711 391.165 658.246 343.16 658.246 c 0 + 291.254 658.246 172.411 625.987 168 379 c 0 + 199.898 432.999 258.013 466.137 321.005 466.137 c 0 + 423.075 466.137 519.08 379.808 519.08 229.538 c 0 + 519.08 80.8581 422.752 -12.0026 312.997 -12.0026 c 0 + 248.704 -12.0026 184.458 20.3794 142.414 83.8806 c 0 + 96.0423 153.919 87.8103 244.182 87.8103 328.725 c 0 + 87.8103 398.015 94.4787 482.075 118.688 550.855 c 0 + 163.122 677.091 256.592 730.138 342.659 730.138 c 0 +313.429 395.091 m 0 + 259.837 395.091 204.549 357.227 172 298 c 0 + 162.434 163.097 228.337 59.9447 316.419 59.9447 c 0 + 377.654 59.9447 440.168 112.511 440.168 225.41 c 0 + 440.168 349.842 371.467 395.091 313.429 395.091 c 0 +EndSplineSet +EndChar + +StartChar: nine +Encoding: 57 57 104 +Width: 600 +Flags: HMW +TeX: 110 0 +LayerCount: 2 +Fore +SplineSet +261.675 -12.1561 m 0 + 202.075 -12.1561 144.572 11.7985 102 54 c 0 + 158 116 l 0 + 170.321 108.179 167.108 95.6999 176.888 88.125 c 0 + 177.128 87.939 212.027 61.8787 263.838 61.8787 c 0 + 315.736 61.8787 375.697 88.07 406.577 161.072 c 0 + 414.19 179.068 432.572 227.741 436 340 c 0 + 402.346 291.195 346.701 261.958 287.116 261.958 c 0 + 182.228 261.958 88.9944 351.151 88.9944 489.856 c 0 + 88.9944 629.773 183.329 729 295.648 729 c 0 + 371.017 729 454.143 682.757 491.757 572.33 c 0 + 508.564 522.989 516.664 460.639 516.664 370.261 c 0 + 516.664 252.09 498.421 189.45 485.749 156.035 c 0 + 442.004 40.6809 349.796 -12.1561 261.675 -12.1561 c 0 +294.989 332.729 m 0 + 346.985 332.729 400.082 367.207 432 421 c 0 + 444.812 566.747 376.145 657.043 293.961 657.043 c 0 + 228.457 657.043 167.969 598.264 167.969 493.195 c 0 + 167.969 385.709 230.618 332.729 294.989 332.729 c 0 +EndSplineSet +EndChar + +StartChar: seven +Encoding: 55 55 105 +Width: 600 +Flags: HMW +TeX: 115 0 +LayerCount: 2 +Fore +SplineSet +101 722 m 0 + 510 722 l 0 + 510 677 l 0 + 461.138 565.327 415.446 452.266 373 338 c 0 + 331.553 226.425 293.2 113.7 258 0 c 0 + 167 0 l 0 + 209.792 129.784 255.811 258.503 305 386 c 0 + 338.534 472.918 373.54 559.268 410 645 c 0 + 101 645 l 0 + 101 722 l 0 +EndSplineSet +EndChar + +StartChar: W +Encoding: 87 87 106 +Width: 600 +Flags: HMW +TeX: 87 0 +LayerCount: 2 +Fore +SplineSet +30 722 m 0 + 105 722 l 0 + 183 234 l 0 + 299 669 l 0 + 324 669 l 0 + 441 232 l 0 + 507 722 l 0 + 575 722 l 0 + 461 -5 l 0 + 429 -5 l 0 + 305 472 l 0 + 179 -5 l 0 + 146 -5 l 0 + 30 722 l 0 +EndSplineSet +EndChar + +StartChar: acute +Encoding: 260 180 107 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +348 810 m 4 + 421 761 l 4 + 304 605 l 4 + 246 640 l 4 + 348 810 l 4 +EndSplineSet +EndChar + +StartChar: aacute +Encoding: 225 225 108 +Width: 600 +Flags: HMW +TeX: 97 0 +LayerCount: 2 +Fore +Refer: 107 180 S 1 0 0 1 0 0 2 +Refer: 0 97 N 1 0 0 1 0 0 2 +EndChar + +StartChar: agrave +Encoding: 224 224 109 +Width: 600 +Flags: HMW +TeX: 97 0 +LayerCount: 2 +Fore +Refer: 130 715 S 1 0 0 1 0 0 2 +Refer: 0 97 N 1 0 0 1 0 0 2 +EndChar + +StartChar: acircumflex +Encoding: 226 226 110 +Width: 600 +Flags: HMW +TeX: 97 0 +LayerCount: 2 +Fore +Refer: 137 710 S 1 0 0 1 8 0 2 +Refer: 0 97 N 1 0 0 1 0 0 2 +EndChar + +StartChar: atilde +Encoding: 227 227 111 +Width: 600 +Flags: HMW +TeX: 97 0 +LayerCount: 2 +Fore +Refer: 138 732 S 1 0 0 1 11 0 2 +Refer: 0 97 N 1 0 0 1 0 0 2 +EndChar + +StartChar: adieresis +Encoding: 228 228 112 +Width: 600 +Flags: HMW +TeX: 97 0 +LayerCount: 2 +Fore +Refer: 139 168 S 1 0 0 1 15 0 2 +Refer: 0 97 N 1 0 0 1 0 0 2 +EndChar + +StartChar: aring +Encoding: 229 229 113 +Width: 600 +Flags: HMW +TeX: 97 0 +LayerCount: 2 +Fore +Refer: 161 730 S 1 0 0 1 0 0 2 +Refer: 0 97 N 1 0 0 1 0 0 2 +EndChar + +StartChar: egrave +Encoding: 232 232 114 +Width: 600 +Flags: HMW +TeX: 101 0 +LayerCount: 2 +Fore +Refer: 130 715 S 1 0 0 1 0 0 2 +Refer: 9 101 N 1 0 0 1 0 0 2 +EndChar + +StartChar: eacute +Encoding: 233 233 115 +Width: 600 +Flags: HMW +TeX: 101 0 +LayerCount: 2 +Fore +Refer: 107 180 S 1 0 0 1 0 0 2 +Refer: 9 101 N 1 0 0 1 0 0 2 +EndChar + +StartChar: ecircumflex +Encoding: 234 234 116 +Width: 600 +Flags: HMW +TeX: 101 0 +LayerCount: 2 +Fore +Refer: 137 710 S 1 0 0 1 0 0 2 +Refer: 9 101 N 1 0 0 1 0 0 2 +EndChar + +StartChar: edieresis +Encoding: 235 235 117 +Width: 600 +Flags: HMW +TeX: 101 0 +LayerCount: 2 +Fore +Refer: 139 168 S 1 0 0 1 2 0 2 +Refer: 9 101 N 1 0 0 1 0 0 2 +EndChar + +StartChar: ograve +Encoding: 242 242 118 +Width: 600 +Flags: HMW +TeX: 111 0 +LayerCount: 2 +Fore +Refer: 130 715 S 1 0 0 1 0 0 2 +Refer: 5 111 N 1 0 0 1 0 0 2 +EndChar + +StartChar: oacute +Encoding: 243 243 119 +Width: 600 +Flags: HMW +TeX: 111 0 +LayerCount: 2 +Fore +Refer: 107 180 S 1 0 0 1 0 0 2 +Refer: 5 111 N 1 0 0 1 0 0 2 +EndChar + +StartChar: ocircumflex +Encoding: 244 244 120 +Width: 600 +Flags: HMW +TeX: 111 0 +LayerCount: 2 +Fore +Refer: 137 710 S 1 0 0 1 0 0 2 +Refer: 5 111 N 1 0 0 1 0 0 2 +EndChar + +StartChar: otilde +Encoding: 245 245 121 +Width: 600 +Flags: HMW +TeX: 111 0 +LayerCount: 2 +Fore +Refer: 138 732 S 1 0 0 1 0 0 2 +Refer: 5 111 N 1 0 0 1 0 0 2 +EndChar + +StartChar: odieresis +Encoding: 246 246 122 +Width: 600 +Flags: HMW +TeX: 111 0 +LayerCount: 2 +Fore +Refer: 139 168 S 1 0 0 1 0 0 2 +Refer: 5 111 N 1 0 0 1 0 0 2 +EndChar + +StartChar: oslash +Encoding: 248 248 123 +Width: 600 +Flags: HMW +TeX: 111 0 +LayerCount: 2 +Fore +SplineSet +301.758 470.103 m 0 + 220.795 470.103 144.985 397.575 144.985 267.806 c 0 + 144.985 210.232 159.811 162.64 183.62 127.42 c 1 + 362.111 455.844 l 1 + 342.74 465.435 322.083 470.103 301.758 470.103 c 0 +543.113 262.304 m 0 + 543.113 86.8043 430.326 -14 304.969 -14 c 0 + 267.109 -14 230.757 -4.85803 198.107 11.9174 c 1 + 151 -74 l 1 + 91 -43 l 1 + 142.317 51.4236 l 1 + 90.4093 100.283 56.8677 173.482 56.8677 260.578 c 0 + 56.8677 424.14 172.53 541.005 307.44 541.005 c 0 + 338.595 541.005 369.418 534.573 397.992 521.866 c 1 + 441 601 l 1 + 503 568 l 1 + 456.732 483.613 l 1 + 508.189 437.145 543.113 362.872 543.113 262.304 c 0 +416.343 409.949 m 1 + 234.443 78.1878 l 1 + 256.267 64.9671 280.584 57.9927 305.614 57.9927 c 0 + 382.884 57.9927 459.167 125.6 459.167 258.844 c 0 + 459.167 325.471 442.141 375.404 416.343 409.949 c 1 +EndSplineSet +EndChar + +StartChar: ugrave +Encoding: 249 249 124 +Width: 600 +Flags: HMW +TeX: 117 0 +LayerCount: 2 +Fore +Refer: 130 715 S 1 0 0 1 0 0 2 +Refer: 15 117 N 1 0 0 1 0 0 2 +EndChar + +StartChar: uacute +Encoding: 250 250 125 +Width: 600 +Flags: HMW +TeX: 117 0 +LayerCount: 2 +Fore +Refer: 107 180 S 1 0 0 1 0 0 2 +Refer: 15 117 N 1 0 0 1 0 0 2 +EndChar + +StartChar: ucircumflex +Encoding: 251 251 126 +Width: 600 +Flags: HMW +TeX: 117 0 +LayerCount: 2 +Fore +Refer: 137 710 S 1 0 0 1 0 0 2 +Refer: 15 117 N 1 0 0 1 0 0 2 +EndChar + +StartChar: udieresis +Encoding: 252 252 127 +Width: 600 +Flags: HMW +TeX: 117 0 +LayerCount: 2 +Fore +Refer: 139 168 S 1 0 0 1 0 0 2 +Refer: 15 117 N 1 0 0 1 0 0 2 +EndChar + +StartChar: yacute +Encoding: 253 253 128 +Width: 600 +Flags: HMW +TeX: 121 0 +LayerCount: 2 +Fore +Refer: 107 180 S 1 0 0 1 0 0 2 +Refer: 23 121 S 1 0 0 1 0 0 2 +EndChar + +StartChar: ydieresis +Encoding: 255 255 129 +Width: 600 +Flags: HMW +TeX: 121 0 +LayerCount: 2 +Fore +Refer: 139 168 S 1 0 0 1 0 0 2 +Refer: 23 121 N 1 0 0 1 0 0 2 +EndChar + +StartChar: uni02CB +Encoding: 259 715 130 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 107 180 S -1 0 0 1 640 0 2 +EndChar + +StartChar: igrave +Encoding: 236 236 131 +Width: 600 +Flags: HMW +TeX: 105 0 +LayerCount: 2 +Fore +Refer: 130 715 S 1 0 0 1 -50 0 2 +Refer: 136 305 N 1 0 0 1 0 0 2 +EndChar + +StartChar: iacute +Encoding: 237 237 132 +Width: 600 +Flags: HMW +TeX: 105 0 +LayerCount: 2 +Fore +Refer: 107 180 S 1 0 0 1 0 0 2 +Refer: 136 305 N 1 0 0 1 0 0 2 +EndChar + +StartChar: icircumflex +Encoding: 238 238 133 +Width: 600 +Flags: HMW +TeX: 105 0 +LayerCount: 2 +Fore +Refer: 137 710 S 1 0 0 1 -14 0 2 +Refer: 136 305 N 1 0 0 1 0 0 2 +EndChar + +StartChar: idieresis +Encoding: 239 239 134 +Width: 600 +Flags: HMW +TeX: 105 0 +LayerCount: 2 +Fore +Refer: 139 168 S 1 0 0 1 -2 0 2 +Refer: 136 305 N 1 0 0 1 0 0 2 +EndChar + +StartChar: ntilde +Encoding: 241 241 135 +Width: 600 +Flags: HMW +TeX: 110 0 +LayerCount: 2 +Fore +Refer: 138 732 S 1 0 0 1 -6 0 2 +Refer: 6 110 N 1 0 0 1 0 0 2 +EndChar + +StartChar: dotlessi +Encoding: 272 305 136 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +133 530 m 0 + 345 530 l 0 + 345 67 l 0 + 469 67 l 0 + 469 0 l 0 + 126 0 l 0 + 126 67 l 0 + 261 67 l 0 + 261 462 l 0 + 133 462 l 0 + 133 530 l 0 +EndSplineSet +EndChar + +StartChar: circumflex +Encoding: 261 710 137 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +165 631 m 0 + 294 794 l 0 + 319 794 l 0 + 447 630 l 0 + 393 590 l 0 + 303 709 l 0 + 209 591 l 0 + 165 631 l 0 +EndSplineSet +EndChar + +StartChar: tilde +Encoding: 262 732 138 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +167 646 m 0 + 115 683 l 0 + 157.86 750.837 200.854 783.268 246.029 783.268 c 0 + 292.862 783.268 323.97 749.067 338.861 733.55 c 0 + 357.642 713.979 375.041 696.93 396.658 696.93 c 0 + 425.237 696.93 438.799 723.991 464 758 c 0 + 507 712 l 0 + 466.944 662.14 435.39 629.754 392.65 629.754 c 0 + 325.264 629.754 293.884 717.432 242.844 717.432 c 0 + 212.153 717.432 194.763 690.786 167 646 c 0 +EndSplineSet +EndChar + +StartChar: dieresis +Encoding: 266 168 139 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +257.019 711.498 m 0 + 257.019 679.211 230.789 652.981 198.502 652.981 c 0 + 166.212 652.981 139.981 679.209 139.981 711.499 c 0 + 139.981 743.789 166.21 770.019 198.5 770.019 c 0 + 230.79 770.019 257.019 743.789 257.019 711.498 c 0 +463.002 711.512 m 0 + 463.002 679.168 436.956 652.991 405.005 652.991 c 0 + 373.061 652.991 346.998 679.155 346.998 711.514 c 0 + 346.998 743.862 373.052 770.035 405.008 770.035 c 0 + 436.936 770.035 463.002 743.877 463.002 711.512 c 0 +EndSplineSet +EndChar + +StartChar: scaron +Encoding: 168 353 140 +Width: 600 +Flags: HMW +TeX: 115 0 +LayerCount: 2 +Fore +Refer: 143 711 S 1 0 0 1 0 0 2 +Refer: 3 115 N 1 0 0 1 0 0 2 +EndChar + +StartChar: zcaron +Encoding: 184 382 141 +Width: 600 +Flags: HMW +TeX: 122 0 +LayerCount: 2 +Fore +Refer: 143 711 S 1 0 0 1 0 0 2 +Refer: 69 122 N 1 0 0 1 0 0 2 +EndChar + +StartChar: periodcentered +Encoding: 183 183 142 +Width: 600 +Flags: HMW +TeX: 112 0 +LayerCount: 2 +Fore +Refer: 24 46 S 1 0 0 1 0 330 2 +EndChar + +StartChar: caron +Encoding: 271 711 143 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 137 710 S -1 0 0 -1 612 1394 2 +EndChar + +StartChar: germandbls +Encoding: 223 223 144 +Width: 600 +Flags: HMW +TeX: 103 0 +LayerCount: 2 +Fore +SplineSet +74 0 m 4 + 74 490 l 4 + 74 542.807 74.667 596.235 98.2086 649.711 c 4 + 133.73 730.4 208.298 775.004 287.299 775.004 c 4 + 402.905 775.004 497.21 681.294 497.21 571.108 c 4 + 497.21 504.487 461.9 445.294 405 416 c 4 + 491.891 389.079 548.006 305.6 548.006 209.32 c 4 + 548.006 83.4294 454.191 -12.0295 335.412 -12.0295 c 4 + 292.776 -12.0295 250.921 0.470711 215 24 c 4 + 256 89 l 4 + 278.149 71.5086 305.639 61.9655 334.044 61.9655 c 4 + 407.901 61.9655 471.132 125.491 471.132 209.399 c 4 + 471.132 270.281 438.461 323.526 394.789 350.882 c 4 + 362.072 371.375 330.752 374 293 374 c 4 + 258 374 l 4 + 258 440 l 4 + 291 440 l 4 + 308.302 440 324.828 440.514 344.201 449.183 c 4 + 387.876 468.726 418.115 518.564 418.115 573.125 c 4 + 418.115 649.497 360.647 708.194 291.766 708.194 c 4 + 253.833 708.194 213.869 689.799 186.719 650.367 c 4 + 153.729 602.454 153 543.204 153 492 c 4 + 153 0 l 4 + 74 0 l 4 +EndSplineSet +EndChar + +StartChar: paragraph +Encoding: 182 182 145 +Width: 600 +Flags: HMW +TeX: 112 0 +LayerCount: 2 +Fore +SplineSet +515 771 m 0 + 515 -79 l 0 + 448 -79 l 0 + 448 705 l 0 + 360 705 l 0 + 360 -79 l 0 + 291 -79 l 0 + 291 373 l 0 + 173.556 380.691 83.9422 470.146 83.9422 574.545 c 0 + 83.9422 645.65 125.968 713.383 202.879 746.684 c 0 + 258.505 770.77 316.231 771 370 771 c 0 + 515 771 l 0 +EndSplineSet +EndChar + +StartChar: section +Encoding: 167 167 146 +Width: 600 +Flags: HMW +TeX: 115 0 +LayerCount: 2 +Fore +SplineSet +488 676 m 1 + 423 618 l 1 + 414.502 624.421 416.792 633.708 413.888 641.763 c 0 + 404.459 667.917 369.872 709.915 308.352 709.915 c 0 + 247.31 709.915 202.994 669.159 202.994 620.922 c 0 + 202.994 597.432 213.725 561.524 264.348 534.753 c 0 + 297.607 517.164 341.067 507.397 387.737 485.112 c 0 + 468.614 446.493 494.176 395.665 494.176 353.922 c 0 + 494.176 305.481 458.969 262.529 408.539 241.879 c 1 + 459.313 207.384 483.175 156.542 483.175 107.276 c 0 + 483.175 16.9904 402.922 -63.0207 285.774 -63.0207 c 0 + 208.624 -63.0207 133.499 -27.5045 85 36 c 1 + 146 107 l 1 + 154.994 103.32 153.114 93.2219 155.624 86.7075 c 0 + 159.14 77.5825 198.684 13.7598 286.023 13.7598 c 0 + 356.942 13.7598 400.23 57.0391 400.23 105.026 c 0 + 400.23 132.111 386.388 163.982 346.982 187.299 c 0 + 298.949 215.721 233.162 219.874 175.365 254.027 c 0 + 123.913 284.431 101.679 326.186 101.679 366.086 c 0 + 101.679 418.429 140.913 463.115 196.205 482.822 c 1 + 140.944 517.145 118.9 567.71 118.9 613.632 c 0 + 118.9 701.981 199.381 778.269 307.936 778.269 c 0 + 384.595 778.269 452.277 738.832 488 676 c 1 +238.744 461.796 m 1 + 207.924 451.724 185.96 423.141 185.96 389.457 c 0 + 185.96 363.602 199.372 327.898 248.47 303.876 c 0 + 283.42 286.776 323.54 281.479 365.239 264.586 c 1 + 390.576 277.358 407.453 303.587 407.453 333.72 c 0 + 407.453 360.138 394.181 398.165 340.303 424.753 c 0 + 310.54 439.44 274.629 447.456 238.744 461.796 c 1 +EndSplineSet +EndChar + +StartChar: copyright +Encoding: 169 169 147 +Width: 600 +Flags: HMW +TeX: 99 0 +LayerCount: 2 +Fore +SplineSet +313.62 491.091 m 0 + 386.544 491.091 443.024 445.507 458 384 c 0 + 398 361 l 0 + 391.517 368.856 395.372 377.023 393.506 384.631 c 0 + 391.425 393.116 373.381 433.152 316.115 433.152 c 0 + 261.422 433.152 207.997 399.047 207.997 326.991 c 0 + 207.997 256.911 256.399 201.947 317.234 201.947 c 0 + 353.531 201.947 386.837 222.046 404 254 c 0 + 455 220 l 0 + 422.956 171.427 369.074 140.974 312.13 140.974 c 0 + 217.884 140.974 142.846 222.734 142.846 319.43 c 0 + 142.846 418.338 220.235 491.091 313.62 491.091 c 0 +306.307 21.8879 m 0 + 152.945 21.8879 25.7487 152.286 25.7487 317.375 c 0 + 25.7487 483.34 153.371 614.02 306.766 614.02 c 0 + 459.736 614.02 587.017 483.767 587.017 318.262 c 0 + 587.017 152.432 459.471 21.8879 306.307 21.8879 c 0 +78.726 317.799 m 0 + 78.726 179.711 182.936 71.9098 307.826 71.9098 c 0 + 432.331 71.9098 537.005 179.647 537.005 318.685 c 0 + 537.005 457.352 432.659 565 308.142 565 c 0 + 183.437 565 78.726 457.059 78.726 317.799 c 0 +EndSplineSet +EndChar + +StartChar: registered +Encoding: 174 174 148 +Width: 600 +Flags: HMW +TeX: 114 0 +LayerCount: 2 +Fore +SplineSet +306.307 21.8879 m 4 + 152.945 21.8879 25.7487 152.286 25.7487 317.375 c 4 + 25.7487 483.34 153.371 614.02 306.766 614.02 c 4 + 459.736 614.02 587.017 483.767 587.017 318.262 c 4 + 587.017 152.432 459.471 21.8879 306.307 21.8879 c 4 +78.726 317.799 m 4 + 78.726 179.711 182.936 71.9098 307.826 71.9098 c 4 + 432.331 71.9098 537.005 179.647 537.005 318.685 c 4 + 537.005 457.352 432.659 565 308.142 565 c 4 + 183.437 565 78.726 457.059 78.726 317.799 c 4 +190 154 m 4 + 190 492 l 4 + 299 492 l 4 + 324.843 492 351.991 491.821 378.649 480.542 c 4 + 417.745 464 439 429.492 439 393.729 c 4 + 439 352.65 411.132 316.256 371 305 c 4 + 446 160 l 4 + 391 152 l 4 + 319 297 l 4 + 243 297 l 4 + 243 154 l 4 + 190 154 l 4 +243 445 m 4 + 243 343 l 4 + 303 343 l 4 + 322.021 343 344.797 342.906 363.189 354.544 c 4 + 378.83 364.441 386.001 379.476 386.001 393.691 c 4 + 386.001 408.753 377.925 424.775 360.288 434.695 c 4 + 341.595 445.21 319.037 445 300 445 c 4 + 243 445 l 4 +EndSplineSet +EndChar + +StartChar: uni00B9 +Encoding: 185 185 149 +Width: 600 +Flags: HMW +TeX: 117 0 +LayerCount: 2 +Fore +SplineSet +356 733 m 0 + 356 293 l 0 + 282 293 l 0 + 282 641 l 0 + 170 612 l 0 + 151 648 l 0 + 306 733 l 0 + 356 733 l 0 +EndSplineSet +EndChar + +StartChar: guilsinglleft +Encoding: 273 8249 150 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +178 293 m 0 + 354 464 l 0 + 399 416 l 0 + 259 279 l 0 + 407 117 l 0 + 361 71 l 0 + 178 266 l 0 + 178 293 l 0 +EndSplineSet +EndChar + +StartChar: guillemotleft +Encoding: 171 171 151 +Width: 600 +Flags: HMW +TeX: 103 0 +LayerCount: 2 +Fore +Refer: 150 8249 S 1 0 0 1 120 0 2 +Refer: 150 8249 S 1 0 0 1 -90 0 2 +EndChar + +StartChar: guilsinglright +Encoding: 274 8250 152 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 150 8249 N -1 0 0 1 585 0 2 +EndChar + +StartChar: guillemotright +Encoding: 187 187 153 +Width: 600 +Flags: HMW +TeX: 103 0 +LayerCount: 2 +Fore +Refer: 151 171 N -1 0 0 1 615 0 2 +EndChar + +StartChar: logicalnot +Encoding: 172 172 154 +Width: 600 +Flags: HMW +TeX: 108 0 +LayerCount: 2 +Fore +SplineSet +116 402 m 0 + 490 402 l 0 + 490 182 l 0 + 416 182 l 0 + 416 329 l 0 + 116 329 l 0 + 116 402 l 0 +EndSplineSet +EndChar + +StartChar: softhyphen +Encoding: 173 173 155 +Width: 600 +Flags: HMW +TeX: 115 0 +LayerCount: 2 +Fore +Refer: 60 45 N 1 0 0 1 0 0 2 +EndChar + +StartChar: degree +Encoding: 176 176 156 +Width: 600 +Flags: HMW +TeX: 100 0 +LayerCount: 2 +Fore +SplineSet +463.001 584.452 m 0 + 463.001 498.746 392.958 428.902 306.439 428.902 c 0 + 219.963 428.902 149.901 498.735 149.901 584.477 c 0 + 149.901 670.167 219.932 740.008 306.436 740.008 c 0 + 392.955 740.008 463.001 670.157 463.001 584.452 c 0 +307.636 679.001 m 0 + 260.52 679.001 220.977 638.292 220.977 585.822 c 0 + 220.977 533.609 260.369 492.878 307.592 492.878 c 0 + 354.564 492.878 394.083 533.556 394.083 586.131 c 0 + 394.083 638.327 354.712 679.001 307.636 679.001 c 0 +EndSplineSet +EndChar + +StartChar: uni00B2 +Encoding: 178 178 157 +Width: 600 +Flags: HMW +TeX: 117 0 +LayerCount: 2 +Fore +SplineSet +139 642 m 0 + 173.775 702.486 238.827 738.288 309.097 738.288 c 0 + 401.336 738.288 464.001 678.771 464.001 608.561 c 0 + 464.001 553.7 426.301 516.004 409.841 500.834 c 0 + 363.816 458.417 299.741 428.352 235 356 c 0 + 446 356 l 0 + 451.284 356 453.692 356.741 458.392 360.794 c 0 + 460.8 362.871 466.479 368.496 474 366 c 0 + 474 293 l 0 + 150 293 l 0 + 150 344 l 0 + 214.555 433.275 299.669 489.778 334.371 517.996 c 0 + 367.994 545.338 394.114 573.311 394.114 608.166 c 0 + 394.114 644.932 362.276 678.917 306.876 678.917 c 0 + 262.373 678.917 224.551 655.762 204.174 629.982 c 0 + 197.924 622.076 198.745 616.904 193 606 c 0 + 139 642 l 0 +EndSplineSet +EndChar + +StartChar: eth +Encoding: 240 240 158 +Width: 600 +Flags: HMW +TeX: 101 0 +LayerCount: 2 +Fore +SplineSet +305.228 470.011 m 0 + 226.957 470.011 144.996 405.543 144.996 269.224 c 0 + 144.996 134.476 222.952 57.9969 306.097 57.9969 c 0 + 371.358 57.9969 459.002 107.826 459.002 268.758 c 0 + 459.002 429.627 365.393 470.011 305.228 470.011 c 0 +411.85 660.892 m 1 + 482.806 580.388 543.317 462.269 543.317 293.321 c 0 + 543.317 230.904 536.102 156.905 498.489 94.5252 c 0 + 455.932 23.9469 383.677 -14.0061 306.684 -14.0061 c 0 + 172.735 -14.0061 56.7783 98.7597 56.7783 258.02 c 0 + 56.7783 417.046 169.434 541.31 298.018 541.31 c 0 + 351.944 541.31 401.981 518.882 437 481 c 1 + 413.678 540.162 379.782 593.873 337.517 639.819 c 1 + 190 598 l 1 + 169 653 l 1 + 289.257 685.865 l 1 + 253.708 715.612 213.989 740.637 171 760 c 1 + 265 779 l 1 + 294.809 762.216 330.445 738.683 366.105 706.867 c 1 + 491 741 l 1 + 511 689 l 1 + 411.85 660.892 l 1 +EndSplineSet +EndChar + +StartChar: Eth +Encoding: 208 208 159 +Width: 600 +Flags: HMW +TeX: 69 0 +LayerCount: 2 +Fore +SplineSet +101 722 m 0 + 263 722 l 0 + 325.631 722 375.745 716.402 426.079 679.13 c 0 + 512.98 614.782 550.114 487.96 550.114 365.114 c 0 + 550.114 211.219 490.967 72.9828 379.857 21.249 c 0 + 338.865 2.16283 300.228 -1 249 -1 c 0 + 101 -1 l 0 + 101 722 l 0 +176 654 m 0 + 176 66 l 0 + 245 66 l 0 + 286.258 66 324.723 68.2387 365.552 95.7969 c 0 + 435.377 142.927 472.256 240.81 472.256 355.09 c 0 + 472.256 435.567 454.827 524.974 411.342 584.517 c 0 + 362.022 652.05 302.634 654 258 654 c 0 + 176 654 l 0 +45 416 m 0 + 297 416 l 0 + 297 349 l 0 + 45 349 l 0 + 45 416 l 0 +EndSplineSet +EndChar + +StartChar: Thorn +Encoding: 222 222 160 +Width: 600 +Flags: HMW +TeX: 84 0 +LayerCount: 2 +Fore +SplineSet +78 722 m 0 + 169 722 l 0 + 169.521 720.466 169.785 718.85 169.785 717.216 c 0 + 169.785 710.792 165.82 706.356 163.318 702.38 c 0 + 160.184 697.398 160 694.17 160 690 c 0 + 160 586 l 0 + 298 586 l 0 + 344.584 586 389.359 584.805 434.624 561.494 c 0 + 502.828 526.371 538.016 455.718 538.016 382.699 c 0 + 538.016 309.503 502.883 240.352 436.114 206.409 c 0 + 392.262 184.116 348.977 183 304 183 c 0 + 160 183 l 0 + 160 0 l 0 + 78 0 l 0 + 78 722 l 0 +160 510 m 0 + 160 254 l 0 + 307 254 l 0 + 335.466 254 362.993 254.678 390.831 268.763 c 0 + 432.659 289.926 455.003 332.944 455.003 378.986 c 0 + 455.003 425.985 431.629 471.921 386.619 494.5 c 0 + 357.19 509.263 328.165 510 298 510 c 0 + 160 510 l 0 +EndSplineSet +EndChar + +StartChar: ring +Encoding: 268 730 161 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +413.005 700.997 m 0 + 413.005 645.145 366.039 598.958 306.924 598.958 c 0 + 247.95 598.958 200.921 645.101 200.921 701.065 c 0 + 200.921 756.856 247.86 803.005 306.911 803.005 c 0 + 366.013 803.005 413.005 756.837 413.005 700.997 c 0 +259.914 701.774 m 0 + 259.914 672.11 281.627 648.896 307.995 648.896 c 0 + 334.032 648.896 356.035 671.837 356.035 702.068 c 0 + 356.035 731.828 334.332 755.012 308.022 755.012 c 0 + 282 755.012 259.914 732.072 259.914 701.774 c 0 +EndSplineSet +EndChar + +StartChar: Aring +Encoding: 197 197 162 +Width: 600 +Flags: HMW +TeX: 65 0 +LayerCount: 2 +Fore +Refer: 161 730 S 1 0 0 1 -19 118 2 +Refer: 71 65 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Agrave +Encoding: 192 192 163 +Width: 600 +Flags: HMW +TeX: 65 0 +LayerCount: 2 +Fore +Refer: 195 -1 S 1 0 0 1 -30 138 2 +Refer: 71 65 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Aacute +Encoding: 193 193 164 +Width: 600 +Flags: HMW +TeX: 65 0 +LayerCount: 2 +Fore +Refer: 194 -1 S 1 0 0 1 -20 138 2 +Refer: 71 65 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Acircumflex +Encoding: 194 194 165 +Width: 600 +Flags: HMW +TeX: 65 0 +LayerCount: 2 +Fore +Refer: 190 -1 N 1 0 0 1 -14 143 2 +Refer: 71 65 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Atilde +Encoding: 195 195 166 +Width: 600 +Flags: HMW +TeX: 65 0 +LayerCount: 2 +Fore +Refer: 138 732 S 1 0 0 1 -5 146 2 +Refer: 71 65 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Adieresis +Encoding: 196 196 167 +Width: 600 +Flags: HMW +TeX: 65 0 +LayerCount: 2 +Fore +Refer: 139 168 S 1 0 0 1 -13 144 2 +Refer: 71 65 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Egrave +Encoding: 200 200 168 +Width: 600 +Flags: HMW +TeX: 69 0 +LayerCount: 2 +Fore +Refer: 195 -1 S 1 0 0 1 -30 138 2 +Refer: 80 69 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Eacute +Encoding: 201 201 169 +Width: 600 +Flags: HMW +TeX: 69 0 +LayerCount: 2 +Fore +Refer: 194 -1 S 1 0 0 1 0 138 2 +Refer: 80 69 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Ecircumflex +Encoding: 202 202 170 +Width: 600 +Flags: HMW +TeX: 69 0 +LayerCount: 2 +Fore +Refer: 190 -1 S 1 0 0 1 -4 143 2 +Refer: 80 69 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Edieresis +Encoding: 203 203 171 +Width: 600 +Flags: HMW +TeX: 69 0 +LayerCount: 2 +Fore +Refer: 139 168 S 1 0 0 1 -5 144 2 +Refer: 80 69 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Igrave +Encoding: 204 204 172 +Width: 600 +Flags: HMW +TeX: 73 0 +LayerCount: 2 +Fore +Refer: 195 -1 S 1 0 0 1 -30 138 2 +Refer: 4 73 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Iacute +Encoding: 205 205 173 +Width: 600 +Flags: HMW +TeX: 73 0 +LayerCount: 2 +Fore +Refer: 194 -1 S 1 0 0 1 0 138 2 +Refer: 4 73 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Icircumflex +Encoding: 206 206 174 +Width: 600 +Flags: HMW +TeX: 73 0 +LayerCount: 2 +Fore +Refer: 190 -1 S 1 0 0 1 -15 143 2 +Refer: 4 73 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Idieresis +Encoding: 207 207 175 +Width: 600 +Flags: HMW +TeX: 73 0 +LayerCount: 2 +Fore +Refer: 139 168 S 1 0 0 1 -9 144 2 +Refer: 4 73 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Ograve +Encoding: 210 210 176 +Width: 600 +Flags: HMW +TeX: 79 0 +LayerCount: 2 +Fore +Refer: 195 -1 S 1 0 0 1 -30 138 2 +Refer: 42 79 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Oacute +Encoding: 211 211 177 +Width: 600 +Flags: HMW +TeX: 79 0 +LayerCount: 2 +Fore +Refer: 194 -1 S 1 0 0 1 0 138 2 +Refer: 42 79 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Ocircumflex +Encoding: 212 212 178 +Width: 600 +Flags: HMW +TeX: 79 0 +LayerCount: 2 +Fore +Refer: 190 -1 S 1 0 0 1 -1 143 2 +Refer: 42 79 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Otilde +Encoding: 213 213 179 +Width: 600 +Flags: HMW +TeX: 79 0 +LayerCount: 2 +Fore +Refer: 138 732 S 1 0 0 1 0 146 2 +Refer: 42 79 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Odieresis +Encoding: 214 214 180 +Width: 600 +Flags: HMW +TeX: 79 0 +LayerCount: 2 +Fore +Refer: 139 168 S 1 0 0 1 -5 144 2 +Refer: 42 79 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Ugrave +Encoding: 217 217 181 +Width: 600 +Flags: HMW +TeX: 85 0 +LayerCount: 2 +Fore +Refer: 195 -1 S 1 0 0 1 -30 138 2 +Refer: 63 85 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Uacute +Encoding: 218 218 182 +Width: 600 +Flags: HMW +TeX: 85 0 +LayerCount: 2 +Fore +Refer: 194 -1 S 1 0 0 1 0 138 2 +Refer: 63 85 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Ucircumflex +Encoding: 219 219 183 +Width: 600 +Flags: HMW +TeX: 85 0 +LayerCount: 2 +Fore +Refer: 190 -1 S 1 0 0 1 -1 143 2 +Refer: 63 85 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Udieresis +Encoding: 220 220 184 +Width: 600 +Flags: HMW +TeX: 85 0 +LayerCount: 2 +Fore +Refer: 139 168 S 1 0 0 1 5 144 2 +Refer: 63 85 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Yacute +Encoding: 221 221 185 +Width: 600 +Flags: HMW +TeX: 89 0 +LayerCount: 2 +Fore +Refer: 194 -1 S 1 0 0 1 0 138 2 +Refer: 94 89 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Scaron +Encoding: 166 352 186 +Width: 600 +Flags: HMW +TeX: 83 0 +LayerCount: 2 +Fore +Refer: 191 -1 S 1 0 0 1 14 143 2 +Refer: 50 83 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Zcaron +Encoding: 180 381 187 +Width: 600 +Flags: HMW +TeX: 90 0 +LayerCount: 2 +Fore +Refer: 191 -1 S 1 0 0 1 8 143 2 +Refer: 96 90 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Ntilde +Encoding: 209 209 188 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 138 732 S 1 0 0 1 0 146 2 +Refer: 46 78 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Ydieresis +Encoding: 190 376 189 +Width: 600 +Flags: HMW +TeX: 89 0 +LayerCount: 2 +Fore +Refer: 139 168 S 1 0 0 1 -5 144 2 +Refer: 94 89 N 1 0 0 1 0 0 2 +EndChar + +StartChar: circumflex.cap +Encoding: 275 -1 190 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +142 659 m 0 + 294 774 l 0 + 319 774 l 0 + 462 661 l 0 + 424 617 l 0 + 304 699 l 0 + 175 620 l 0 + 142 659 l 0 +EndSplineSet +EndChar + +StartChar: caron.cap +Encoding: 276 -1 191 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 190 -1 N -1 0 0 -1 604 1391 2 +EndChar + +StartChar: ae +Encoding: 230 230 192 +Width: 600 +Flags: HMW +TeX: 97 0 +LayerCount: 2 +Fore +SplineSet +46 477 m 0 + 78.8401 518.176 128.534 541.042 179.797 541.042 c 0 + 236.11 541.042 284.02 513.302 309 469 c 0 + 334.856 513.703 382.031 541.063 431.036 541.063 c 0 + 472.731 541.063 518.654 520.729 547.495 473.472 c 0 + 578.346 422.921 578 363.164 578 311 c 0 + 578 267 l 0 + 337 257 l 0 + 337 203 l 0 + 337 175.493 338.021 151.766 349.064 126.614 c 0 + 368.654 81.9912 411.522 54.9866 456.731 54.9866 c 0 + 490.681 54.9866 522.098 70.3702 542 97 c 0 + 583 49 l 0 + 550.251 9.72841 501.736 -13.0005 450.565 -13.0005 c 0 + 391.56 -13.0005 336.63 17.1888 305 67 c 0 + 280.108 17.8701 229.631 -13.1551 174.237 -13.1551 c 0 + 90.7707 -13.1551 21.8352 56.2141 21.8352 143.282 c 0 + 21.8352 202.576 54.9902 266.973 127.653 299.766 c 0 + 170.84 319.256 212.144 320.928 240 322 c 0 + 266 323 l 0 + 266 353 l 0 + 266 374.299 265.203 393.531 258.429 412.515 c 0 + 244.402 451.823 210.556 476.08 174.377 476.08 c 0 + 141.829 476.08 108.382 456.741 87 426 c 0 + 46 477 l 0 +266 254 m 0 + 241 253 l 0 + 211.382 251.816 180.822 251.083 151.425 236.018 c 0 + 113.557 216.612 95.9804 181.173 95.9804 148.063 c 0 + 95.9804 97.6227 135.259 57.9703 182.206 57.9703 c 0 + 213.618 57.9703 245.532 76.2592 258.599 111.796 c 0 + 268.711 139.296 266 169.723 266 210 c 0 + 266 254 l 0 +337 323 m 0 + 511 330 l 0 + 511 353 l 0 + 511 376.887 510.557 401.019 500.259 424.945 c 0 + 486.37 457.213 459.423 476.188 430.019 476.188 c 0 + 401.442 476.188 375.8 458.055 358.925 432.777 c 0 + 338.424 402.068 337 371.27 337 343 c 0 + 337 323 l 0 +EndSplineSet +EndChar + +StartChar: oe +Encoding: 189 339 193 +Width: 600 +Flags: HMW +TeX: 111 0 +LayerCount: 2 +Fore +SplineSet +197.072 540.057 m 0 + 240.284 540.057 279.952 520.667 305 487 c 0 + 334.471 520.96 377.351 540.072 422.223 540.072 c 0 + 475.912 540.072 535.759 511.906 562.005 440.15 c 0 + 580.682 389.088 578 326.96 578 269 c 0 + 578 256 l 0 + 314 256 l 0 + 314.609 182.929 318.122 148.32 330.688 119.841 c 0 + 351.232 73.2809 394.067 53.9506 437.272 53.9506 c 0 + 470.728 53.9506 512.336 65.2296 542 99 c 0 + 583 49 l 0 + 544.141 8.97946 490.715 -13.6292 434.895 -13.6292 c 0 + 386.721 -13.6292 340.059 3.2209 303 34 c 0 + 271.715 5.40179 230.291 -13.0256 188.332 -13.0256 c 0 + 142.262 -13.0256 83.7901 10.4289 49.2458 81.4235 c 0 + 21.2947 138.868 16.9924 213.135 16.9924 274.024 c 0 + 16.9924 327.287 21.0077 390.061 49.5869 444.004 c 0 + 83.9791 508.918 142.432 540.057 197.072 540.057 c 0 +315 322 m 0 + 509 322 l 0 + 509 332 l 0 + 509 366.277 509.724 402.65 491.454 433.147 c 0 + 473.764 462.676 442.71 476.791 412.738 476.791 c 0 + 382.558 476.791 345.109 462.072 327.261 414.077 c 0 + 324.697 407.181 313.856 377.196 315 322 c 0 +86.9292 285.092 m 0 + 86.9292 245.957 89.3121 188.587 103.747 142.737 c 0 + 123.421 80.2444 163.532 57.8299 198.359 57.8299 c 0 + 227.31 57.8299 256.518 74.2456 256.518 103.197 c 0 + 256.518 118.213 241.952 172.81 241.952 273.514 c 0 + 241.952 359.739 252.376 403.185 252.376 419.746 c 0 + 252.376 450.246 226.518 470.076 196.284 470.076 c 0 + 163.481 470.076 128.259 447.486 107.574 402.839 c 0 + 89.1704 363.117 86.9292 317.746 86.9292 285.092 c 0 +EndSplineSet +EndChar + +StartChar: acute.cap +Encoding: 278 -1 194 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +387 779 m 0 + 433 698 l 0 + 237 627 l 0 + 210 675 l 0 + 387 779 l 0 +EndSplineSet +EndChar + +StartChar: grave.cap +Encoding: 277 -1 195 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 194 -1 N -1 0 0 1 637 0 2 +EndChar + +StartChar: ordfeminine +Encoding: 170 170 196 +Width: 600 +Flags: HMW +TeX: 111 0 +LayerCount: 2 +Fore +SplineSet +152 656 m 0 + 193.633 703.845 253.099 721.283 307.799 721.283 c 0 + 370.636 721.283 423.692 696.264 447.562 644.964 c 0 + 459.785 618.695 461 592.461 461 562 c 0 + 461 309 l 0 + 388 309 l 0 + 388 348 l 0 + 353.62 315.567 309.294 297.999 264.37 297.999 c 0 + 184.05 297.999 127.995 354.534 127.995 418.965 c 0 + 127.995 457.362 148.672 500.379 196.972 526.099 c 0 + 248.841 553.719 312.645 551 370 551 c 0 + 387 551 l 0 + 387 565 l 0 + 387 584.588 386.635 605.218 374.201 624.596 c 0 + 361.1 645.014 336.794 659.022 300.518 659.022 c 0 + 260.387 659.022 218.034 643.693 192 608 c 0 + 152 656 l 0 +390 491 m 0 + 371 491 l 0 + 340.994 491 302.242 493.162 271.69 487.742 c 0 + 220.555 478.672 202.865 447.25 202.865 422.155 c 0 + 202.865 389.707 231.214 360.688 275.85 360.688 c 0 + 311.446 360.688 343.688 377.899 364.269 397.046 c 0 + 389.322 420.354 390 444.06 390 471 c 0 + 390 491 l 0 +98 239 m 0 + 503 239 l 0 + 503 176 l 0 + 98 176 l 0 + 98 239 l 0 +EndSplineSet +EndChar + +StartChar: ordmasculine +Encoding: 186 186 197 +Width: 600 +Flags: HMW +TeX: 111 0 +LayerCount: 2 +Fore +SplineSet +301.826 721.011 m 0 + 385.223 721.011 470.107 653.808 470.107 514.756 c 0 + 470.107 364.793 379.364 296.94 294.598 296.94 c 0 + 202.824 296.94 120.827 374.446 120.827 500.869 c 0 + 120.827 633.779 205.502 721.011 301.826 721.011 c 0 +190.986 506.214 m 0 + 190.986 409.196 244.9 363.925 296.394 363.925 c 0 + 345.93 363.925 401 406.473 401 506.207 c 0 + 401 605.509 349.544 656 296.205 656 c 0 + 243.333 656 190.986 606.057 190.986 506.214 c 0 +98 239 m 0 + 503 239 l 0 + 503 176 l 0 + 98 176 l 0 + 98 239 l 0 +EndSplineSet +EndChar + +StartChar: uni02C9 +Encoding: 263 713 198 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +153 720 m 0 + 447 720 l 0 + 447 655 l 0 + 153 655 l 0 + 153 720 l 0 +EndSplineSet +EndChar + +StartChar: macron +Encoding: 175 175 199 +Width: 600 +Flags: HMW +TeX: 109 0 +LayerCount: 2 +Fore +Refer: 198 713 N 1 0 0 1 0 0 2 +EndChar + +StartChar: omacron +Encoding: 279 333 200 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 198 713 S 1 0 0 1 0 0 2 +Refer: 5 111 N 1 0 0 1 0 0 2 +EndChar + +StartChar: cedilla +Encoding: 269 184 201 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +313 0 m 0 + 363 0 l 0 + 357 -55 l 0 + 376 -56 l 0 + 390.785 -56.7788 405.994 -57.7164 420.883 -64.9414 c 0 + 442.973 -75.6606 455.07 -96.4917 455.07 -118.956 c 0 + 455.07 -160.352 414.433 -205.092 329.389 -205.092 c 0 + 284.871 -205.092 235.296 -192.447 192 -162 c 0 + 221 -114 l 0 + 257.397 -143.353 301.031 -155.011 336.064 -155.011 c 0 + 381.118 -155.011 389.002 -136.826 389.002 -126.739 c 0 + 389.002 -119.915 385.46 -112.176 376.38 -106.611 c 0 + 363.902 -98.9638 347.2 -99 334 -99 c 0 + 300 -99 l 0 + 313 0 l 0 +EndSplineSet +EndChar + +StartChar: ccedilla +Encoding: 231 231 202 +Width: 600 +Flags: HMW +TeX: 99 0 +LayerCount: 2 +Fore +Refer: 201 184 S 1 0 0 1 0 0 2 +Refer: 1 99 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Ccedilla +Encoding: 199 199 203 +Width: 600 +Flags: HMW +TeX: 67 0 +LayerCount: 2 +Fore +Refer: 201 184 S 1 0 0 1 0 0 2 +Refer: 72 67 N 1 0 0 1 0 0 2 +EndChar + +StartChar: uni00B3 +Encoding: 179 179 204 +Width: 600 +Flags: HMW +TeX: 117 0 +LayerCount: 2 +Fore +SplineSet +308.545 739.11 m 0 + 394.884 739.11 460.209 681.247 460.209 614.55 c 0 + 460.209 572.151 433.428 536.235 395 524 c 0 + 444.061 515.328 480.001 473.423 480.001 424.669 c 0 + 480.001 348.943 397.312 290.99 304.904 290.99 c 0 + 241.699 290.99 181.599 318.471 140 366 c 0 + 194 426 l 0 + 204.212 415.153 199.361 404.247 210.154 393.714 c 0 + 216.257 387.757 251.225 355.987 306.079 355.987 c 0 + 362.89 355.987 408.454 389.769 408.454 431.009 c 0 + 408.454 452.324 395.326 495.101 306.637 495.101 c 0 + 294.627 495.101 283.183 494.368 272 493 c 0 + 272 551 l 0 + 279.636 550.27 287.301 549.894 294.972 549.894 c 0 + 370.889 549.894 391.54 582.897 391.54 609.502 c 0 + 391.54 644.172 357.159 678.038 305.041 678.038 c 0 + 265.85 678.038 224.827 658.777 197 624 c 0 + 155 667 l 0 + 193.931 713.015 250.216 739.11 308.545 739.11 c 0 +EndSplineSet +EndChar + +StartChar: divide +Encoding: 247 247 205 +Width: 600 +Flags: HMW +TeX: 100 0 +LayerCount: 2 +Fore +SplineSet +92 403 m 0 + 509 403 l 0 + 509 326 l 0 + 92 326 l 0 + 92 403 l 0 +358 540.992 m 0 + 358 512.297 334.695 488.972 305.98 488.972 c 0 + 277.279 488.972 253.962 512.289 253.962 540.99 c 0 + 253.962 569.692 277.277 593.01 305.98 593.01 c 0 + 334.693 593.01 358 569.686 358 540.992 c 0 +358.01 183.993 m 0 + 358.01 155.275 334.682 131.943 305.964 131.943 c 0 + 277.243 131.943 253.913 155.271 253.913 183.992 c 0 + 253.913 212.712 277.242 236.04 305.963 236.04 c 0 + 334.68 236.04 358.01 212.71 358.01 183.993 c 0 +EndSplineSet +EndChar + +StartChar: Oslash +Encoding: 216 216 206 +Width: 600 +Flags: HMW +TeX: 79 0 +LayerCount: 2 +Fore +SplineSet +300.361 654.01 m 0 + 224.496 654.01 123.971 587.911 123.971 372.659 c 0 + 123.971 281.791 139.578 215.128 163.473 167.742 c 1 + 399.758 612.324 l 1 + 368.854 641.994 332.534 654.01 300.361 654.01 c 0 +556.008 359.504 m 0 + 556.008 296.095 551.428 206.273 513.069 128.645 c 0 + 465.538 32.4568 382.426 -11.0151 304.485 -11.0151 c 0 + 261.834 -11.0151 213.304 2.30387 169.786 34.9718 c 1 + 112 -73 l 1 + 52 -42 l 1 + 119.616 85.2228 l 1 + 75.1957 143.737 43.9996 232.717 43.9996 362.113 c 0 + 43.9996 645.884 196.081 730 303.761 730 c 0 + 349.84 730 397.121 715.105 437.897 684.085 c 1 + 491 784 l 1 + 553 751 l 1 + 488.971 631.363 l 1 + 497.238 619.916 504.885 607.435 511.792 593.902 c 0 + 551.172 516.748 556.008 427.05 556.008 359.504 c 0 +443.911 547.169 m 1 + 208.342 107.012 l 1 + 238.634 79.4207 273.138 67.987 304.834 67.987 c 0 + 353.415 67.987 409.354 95.4457 442.765 165.717 c 0 + 472.354 227.951 475.085 301.614 475.085 348.897 c 0 + 475.085 410.01 471.386 479.154 446.984 539.849 c 2 + 443.911 547.169 l 1 +EndSplineSet +EndChar + +StartChar: multiply +Encoding: 215 215 207 +Width: 600 +Flags: HMW +TeX: 109 0 +LayerCount: 2 +Fore +SplineSet +453 583 m 1 + 508 532 l 1 + 357.683 376.932 l 1 + 505 221 l 1 + 451 168 l 1 + 304.762 322.338 l 1 + 160 173 l 1 + 108 224 l 1 + 253.994 375.919 l 1 + 108 530 l 1 + 163 583 l 1 + 306.764 430.829 l 1 + 453 583 l 1 +EndSplineSet +EndChar + +StartChar: AE +Encoding: 198 198 208 +Width: 600 +Flags: HMW +TeX: 65 0 +LayerCount: 2 +Fore +SplineSet +242 723 m 0 + 571 723 l 0 + 571 651 l 0 + 370 651 l 0 + 372 414 l 0 + 541 414 l 0 + 541 340 l 0 + 373 340 l 0 + 375 72 l 0 + 568 72 l 0 + 568 0 l 0 + 302 0 l 0 + 302 196 l 0 + 151 196 l 0 + 89 0 l 0 + 15 0 l 0 + 242 723 l 0 +302 651 m 0 + 289 651 l 0 + 168 263 l 0 + 302 263 l 0 + 302 651 l 0 +EndSplineSet +EndChar + +StartChar: OE +Encoding: 188 338 209 +Width: 600 +Flags: HMW +TeX: 79 0 +LayerCount: 2 +Fore +SplineSet +303 690 m 0 + 303 723 l 0 + 571 723 l 0 + 571 651 l 0 + 375 651 l 0 + 375 414 l 0 + 541 414 l 0 + 541 340 l 0 + 375 340 l 0 + 375 72 l 0 + 568 72 l 0 + 568 0 l 0 + 302 0 l 0 + 302 36 l 0 + 278.697 7.88689 244.099 -8.08716 207.296 -8.08716 c 0 + 150.139 -8.08716 80.2583 30.5805 47.0562 139.126 c 0 + 42.7406 153.235 20.7902 225.823 20.7902 361.821 c 0 + 20.7902 459.095 28.5992 542.924 59.6634 615.563 c 0 + 98.0648 705.359 160.916 732.002 207.762 732.002 c 0 + 243.981 732.002 278.474 716.617 303 690 c 0 +94.9751 375.779 m 0 + 94.9751 343.461 94.9497 221.604 127.295 142.578 c 0 + 153.346 78.9291 191.363 62.9836 217.46 62.9836 c 0 + 257.506 62.9836 290.624 98.6049 302 150 c 0 + 302 562 l 0 + 289.634 601.236 259.887 665.004 207.671 665.004 c 0 + 173.506 665.004 138.571 636.141 117.537 573.058 c 0 + 110.441 551.779 94.9751 498.335 94.9751 375.779 c 0 +EndSplineSet +EndChar + +StartChar: currency +Encoding: 280 164 210 +Width: 600 +Flags: HMWO +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +300.7 516.248 m 0 + 236.708 516.248 184.352 463.893 184.352 399.9 c 0 + 184.352 335.907 236.708 283.553 300.7 283.553 c 0 + 364.693 283.553 417.049 335.907 417.049 399.9 c 0 + 417.049 463.893 364.693 516.248 300.7 516.248 c 0 +88.9004 569.9 m 1 + 130.1 611.1 l 1 + 195.483 545.717 l 1 + 225.127 567.202 261.503 579.9 300.7 579.9 c 0 + 339.284 579.9 375.133 567.597 404.52 546.719 c 1 + 468.9 611.1 l 1 + 510.1 569.9 l 1 + 446.011 505.811 l 1 + 467.803 476.042 480.7 439.404 480.7 399.9 c 0 + 480.7 360.703 468.002 324.327 446.517 294.683 c 1 + 510.1 231.1 l 1 + 468.9 189.9 l 1 + 405.22 253.58 l 1 + 375.704 232.4 339.591 219.9 300.7 219.9 c 0 + 261.196 219.9 224.558 232.797 194.789 254.589 c 1 + 130.1 189.9 l 1 + 88.9004 231.1 l 1 + 153.881 296.08 l 1 + 133.003 325.467 120.7 361.316 120.7 399.9 c 0 + 120.7 438.791 133.2 474.904 154.38 504.42 c 1 + 88.9004 569.9 l 1 +EndSplineSet +EndChar + +StartChar: brokenbar +Encoding: 281 166 211 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +261 756 m 0 + 339 756 l 0 + 339 342 l 0 + 261 342 l 0 + 261 756 l 0 +339 -175 m 0 + 261 -175 l 0 + 261 227 l 0 + 339 227 l 0 + 339 -175 l 0 +EndSplineSet +EndChar + +StartChar: onehalf +Encoding: 283 189 212 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 274 8260 S 1 0 0 1 0 0 2 +Refer: 157 178 N 0.8 0 0 0.8 201.3 -318.872 2 +Refer: 149 185 N 0.8 0 0 0.8 -107.4 198.6 2 +EndChar + +StartChar: nonbreakingspace +Encoding: 160 160 213 +Width: 600 +Flags: HMW +TeX: 110 0 +LayerCount: 2 +EndChar + +StartChar: ogonek +Encoding: 270 731 214 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +422 0 m 0 + 499 0 l 0 + 460.042 -34.9926 431.396 -66.5962 421.556 -77.7406 c 0 + 413.412 -86.9647 402.048 -100.705 402.048 -117.842 c 0 + 402.048 -135.64 414.849 -150.797 435.947 -150.797 c 0 + 443.138 -150.797 451.677 -149.114 463.857 -144.679 c 0 + 481.957 -138.087 493.634 -130.111 501 -124 c 0 + 501 -177 l 0 + 478.28 -196.689 449.7 -204.002 420.9 -204.002 c 0 + 360.858 -204.002 330.051 -171.745 330.051 -133.094 c 0 + 330.051 -95.7614 361.962 -49.529 422 0 c 0 +EndSplineSet +EndChar + +StartChar: Aogonek +Encoding: 285 260 215 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 214 731 S 1 0 0 1 72 0 2 +Refer: 71 65 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Lcaron +Encoding: 287 317 216 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 56 8217 S 0.8 0 0 0.8 206.515 136.393 2 +Refer: 52 76 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Sacute +Encoding: 288 346 217 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 194 -1 S 1 0 0 1 -20 138 2 +Refer: 50 83 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Scedilla +Encoding: 289 350 218 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 201 184 S 1 0 0 1 -37 0 2 +Refer: 50 83 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Tcaron +Encoding: 290 356 219 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 191 -1 S 1 0 0 1 8 143 2 +Refer: 59 84 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Zacute +Encoding: 291 377 220 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 194 -1 S 1 0 0 1 -20 138 2 +Refer: 96 90 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Zdotaccent +Encoding: 292 379 221 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 222 729 S 1 0 0 1 0 147 2 +Refer: 96 90 N 1 0 0 1 0 0 2 +EndChar + +StartChar: dotaccent +Encoding: 265 729 222 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +SplineSet +305.003 760 m 0 + 338.171 760 365.019 733.28 365.019 700.493 c 0 + 365.019 667.727 338.182 640.992 304.99 640.992 c 0 + 271.818 640.992 244.981 667.716 244.981 700.486 c 0 + 244.981 733.264 271.822 760 305.003 760 c 0 +EndSplineSet +EndChar + +StartChar: Racute +Encoding: 293 340 223 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 194 -1 S 1 0 0 1 -20 138 2 +Refer: 101 82 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Abreve +Encoding: 294 258 224 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 241 728 S 1 0 0 1 -11 160 2 +Refer: 71 65 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Lacute +Encoding: 295 313 225 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 194 -1 S 1 0 0 1 -20 138 2 +Refer: 52 76 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Cacute +Encoding: 296 262 226 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 194 -1 S 1 0 0 1 -20 138 2 +Refer: 72 67 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Ccaron +Encoding: 297 268 227 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 191 -1 S 1 0 0 1 27 143 2 +Refer: 72 67 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Eogonek +Encoding: 298 280 228 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 214 731 S 1 0 0 1 17 0 2 +Refer: 80 69 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Ecaron +Encoding: 299 282 229 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 191 -1 S 1 0 0 1 8 143 2 +Refer: 80 69 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Dcaron +Encoding: 300 270 230 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 191 -1 S 1 0 0 1 -22 143 2 +Refer: 79 68 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Dcroat +Encoding: 301 272 231 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 159 208 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Nacute +Encoding: 302 323 232 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 194 -1 S 1 0 0 1 -20 138 2 +Refer: 46 78 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Ncaron +Encoding: 303 327 233 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 191 -1 S 1 0 0 1 8 143 2 +Refer: 46 78 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Ohungarumlaut +Encoding: 304 336 234 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 270 -1 S 1 0 0 1 0 0 2 +Refer: 42 79 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Rcaron +Encoding: 305 344 235 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 191 -1 S 1 0 0 1 8 143 2 +Refer: 101 82 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Uring +Encoding: 306 366 236 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 161 730 S 1 0 0 1 -4 118 2 +Refer: 63 85 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Uhungarumlaut +Encoding: 307 368 237 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 270 -1 S 1 0 0 1 0 0 2 +Refer: 63 85 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Tcedilla +Encoding: 308 354 238 +Width: 600 +Flags: HMW +TeX: 78 0 +LayerCount: 2 +Fore +Refer: 201 184 S 1 0 0 1 -44 0 2 +Refer: 59 84 N 1 0 0 1 0 0 2 +EndChar + +StartChar: aogonek +Encoding: 309 261 239 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 214 731 S 1 0 0 1 14 0 2 +Refer: 0 97 N 1 0 0 1 0 0 2 +EndChar + +StartChar: hungarumlaut +Encoding: 267 733 240 +Width: 600 +Flags: MW +LayerCount: 2 +Fore +Refer: 107 180 S 1 0 0 1 -90 0 2 +Refer: 107 180 N 1 0 0 1 90 0 2 +EndChar + +StartChar: breve +Encoding: 264 728 241 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +169 749 m 0 + 195.428 707.212 242.085 666.993 299.32 666.993 c 0 + 347.638 666.993 397.467 696.856 437 748 c 0 + 470 700 l 0 + 430.784 646.838 369.515 606.983 299.498 606.983 c 0 + 236.205 606.983 172.965 640.673 127 696 c 0 + 169 749 l 0 +EndSplineSet +EndChar + +StartChar: eng +Encoding: 332 331 242 +Width: 600 +Flags: MW +LayerCount: 2 +Fore +SplineSet +89 0 m 0 + 89 529 l 0 + 174 529 l 0 + 174 436 l 0 + 212.871 495.002 278.12 542.003 349.957 542.003 c 0 + 410.281 542.003 464.544 508.129 490.899 448.568 c 0 + 509.729 406.014 510 362.334 510 321 c 0 + 510 65 l 0 + 510 16.919 509.539 -32.1813 489.487 -81.4966 c 0 + 457.36 -160.511 387.101 -203.685 314.113 -203.685 c 0 + 273.194 -203.685 233.402 -190.084 201 -165 c 0 + 241 -87 l 0 + 248.911 -88.73 247.814 -97.6079 250.927 -102.004 c 0 + 253.743 -105.982 279.85 -126.182 316.013 -126.182 c 0 + 347.932 -126.182 381.001 -110.476 402.714 -76.7224 c 0 + 427.982 -37.4432 428 10.8898 428 52 c 0 + 428 319 l 0 + 428 356.393 427.762 401.823 399.11 436.061 c 0 + 380.097 458.781 353.908 469.58 327.341 469.58 c 0 + 271.362 469.58 220.49 422.787 200.308 395.893 c 0 + 178.287 366.55 174 340.651 174 305 c 0 + 174 0 l 0 + 89 0 l 0 +EndSplineSet +EndChar + +StartChar: abreve +Encoding: 310 259 243 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 241 728 S 1 0 0 1 10 0 2 +Refer: 0 97 N 1 0 0 1 0 0 2 +EndChar + +StartChar: ccaron +Encoding: 311 269 244 +Width: 600 +Flags: MW +LayerCount: 2 +Fore +Refer: 1 99 N 1 0 0 1 0 0 2 +Refer: 143 711 S 1 0 0 1 0 0 2 +EndChar + +StartChar: dcaron +Encoding: 312 271 245 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +368 452 m 0 + 368 771 l 0 + 447 771 l 0 + 447 49 l 0 + 447 32.9912 447.786 16.2109 452 0 c 0 + 369 0 l 0 + 364.758 12.8477 364 26.4229 364 39 c 0 + 364 85 l 0 + 331.672 29.4834 274.151 -12.0137 209.492 -12.0137 c 0 + 97.8574 -12.0137 9.99902 105.708 9.99902 268.875 c 0 + 9.99902 443.625 112.897 543.229 220.226 543.229 c 0 + 283.503 543.229 340.554 507.905 368 452 c 0 +224.355 475.159 m 0 + 149.202 475.159 90.9316 392.789 90.9316 278.779 c 0 + 90.9316 171.018 142.046 61.8809 227.748 61.8809 c 0 + 273.537 61.8809 313.653 94.3154 335.296 129.689 c 0 + 358.192 167.108 361.312 207.25 361.312 255.021 c 0 + 361.312 325.707 359.835 363.117 343.567 397.269 c 0 + 320.504 445.688 266.849 475.159 224.355 475.159 c 0 +EndSplineSet +Refer: 56 8217 N 0.8 0 0 0.8 306.515 186.393 2 +EndChar + +StartChar: eogonek +Encoding: 313 281 246 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +309.849 542.279 m 0 + 396.962 542.279 495.692 495.772 519.469 353.277 c 0 + 524.642 322.276 526.146 288.58 523 253 c 1 + 147.298 253 l 1 + 153.598 94.4857 256.131 55.4411 326.953 55.4411 c 0 + 379.589 55.4411 429.496 76.3575 464 115 c 1 + 510 70 l 1 + 469 19 l 2 + 429.072 -30.6685 396.601 -67.9568 396.601 -101.807 c 0 + 396.601 -127.998 415.588 -147.006 441.833 -147.006 c 0 + 447.913 -147.006 467.621 -146.296 501 -125 c 1 + 500 -182 l 1 + 478.223 -193.942 451.111 -202.754 423.732 -202.754 c 0 + 365.924 -202.754 327.823 -164.029 327.823 -116.525 c 0 + 327.823 -82.2885 349.347 -41.4463 392 -1 c 1 + 366.185 -8.27677 339.549 -12.0058 312.827 -12.0058 c 0 + 173.799 -12.0058 66.4395 87.3647 66.4395 261.323 c 0 + 66.4395 451.743 183.571 542.279 309.849 542.279 c 0 +150.008 317 m 1 + 441 317 l 1 + 450.942 402.839 389.68 478.169 303.883 478.169 c 0 + 247.072 478.169 166.495 441.85 150.008 317 c 1 +EndSplineSet +EndChar + +StartChar: lcaron +Encoding: 314 318 247 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 56 8217 S 0.8 0 0 0.8 266.515 186.393 2 +Refer: 7 108 N 1 0 0 1 -20 0 2 +EndChar + +StartChar: lacute +Encoding: 315 314 248 +Width: 600 +Flags: MW +LayerCount: 2 +Fore +Refer: 7 108 N 1 0 0 1 0 0 2 +Refer: 194 -1 S 1 0 0 1 -20 188 2 +EndChar + +StartChar: nacute +Encoding: 316 324 249 +Width: 600 +Flags: MW +LayerCount: 2 +Fore +Refer: 107 180 S 1 0 0 1 0 0 2 +Refer: 6 110 N 1 0 0 1 0 0 2 +EndChar + +StartChar: ncaron +Encoding: 317 328 250 +Width: 600 +Flags: MW +LayerCount: 2 +Fore +Refer: 143 711 S 1 0 0 1 0 0 2 +Refer: 6 110 N 1 0 0 1 0 0 2 +EndChar + +StartChar: ohungarumlaut +Encoding: 318 337 251 +Width: 600 +Flags: MW +LayerCount: 2 +Fore +Refer: 240 733 S 1 0 0 1 0 0 2 +Refer: 5 111 N 1 0 0 1 0 0 2 +EndChar + +StartChar: rcaron +Encoding: 319 345 252 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 143 711 S 1 0 0 1 0 0 2 +Refer: 16 114 N 1 0 0 1 0 0 2 +EndChar + +StartChar: sacute +Encoding: 320 347 253 +Width: 600 +Flags: MW +LayerCount: 2 +Fore +Refer: 107 180 S 1 0 0 1 0 0 2 +Refer: 3 115 N 1 0 0 1 0 0 2 +EndChar + +StartChar: scedilla +Encoding: 322 351 254 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 201 184 S 1 0 0 1 -30 0 2 +Refer: 3 115 N 1 0 0 1 0 0 2 +EndChar + +StartChar: tcedilla +Encoding: 323 355 255 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 201 184 S 1 0 0 1 20 0 2 +Refer: 8 116 N 1 0 0 1 0 0 2 +EndChar + +StartChar: uring +Encoding: 324 367 256 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 161 730 S 1 0 0 1 0 0 2 +Refer: 15 117 N 1 0 0 1 0 0 2 +EndChar + +StartChar: uhungarumlaut +Encoding: 325 369 257 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 240 733 S 1 0 0 1 0 0 2 +Refer: 15 117 N 1 0 0 1 0 0 2 +EndChar + +StartChar: zdot +Encoding: 326 380 258 +Width: 600 +Flags: HMWO +LayerCount: 2 +Fore +Refer: 69 122 S 1 0 0 1 0 0 2 +Refer: 222 729 N 1 0 0 1 0 0 2 +EndChar + +StartChar: dotlessj +Encoding: 331 567 259 +Width: 600 +Flags: MW +LayerCount: 2 +Fore +SplineSet +156 530 m 0 + 437 530 l 0 + 437 37 l 0 + 437 -8.68478 435.772 -52.1052 413.163 -96.3812 c 0 + 377.277 -166.657 303.238 -202.181 227.699 -202.181 c 0 + 162.017 -202.181 103.902 -175.027 66 -128 c 0 + 120 -56 l 0 + 127.204 -61.9473 125.358 -69.4816 130.11 -77.2483 c 0 + 134.378 -84.2222 169.009 -130.016 233.016 -130.016 c 0 + 277.791 -130.016 319.506 -106.298 339.459 -63.2398 c 0 + 352.497 -35.1019 353 -7.27543 353 21 c 0 + 353 461 l 0 + 156 461 l 0 + 156 530 l 0 +EndSplineSet +EndChar + +StartChar: kgreenlandic +Encoding: 330 312 260 +Width: 600 +Flags: MW +LayerCount: 2 +Fore +SplineSet +87 529 m 0 + 182 529 l 0 + 182.131 528.206 182.196 527.403 182.196 526.598 c 0 + 182.196 519.678 177.642 515.346 174.831 511.514 c 0 + 171.215 506.587 171 503.254 171 499 c 0 + 171 286 l 0 + 436 532 l 0 + 456.53 526.949 477.704 526 498 526 c 0 + 528 526 l 0 + 305 316 l 0 + 565 -1 l 0 + 562.299 -0.982364 559.597 -0.973546 556.896 -0.973546 c 0 + 501.401 -0.973546 457 -5 457 -5 c 0 + 241 265 l 0 + 171 200 l 0 + 171 -1 l 0 + 87 -1 l 0 + 87 529 l 0 +EndSplineSet +EndChar + +StartChar: quotesinglbase +Encoding: 333 8218 261 +Width: 600 +Flags: MW +LayerCount: 2 +Fore +Refer: 25 44 N 1 0 0 1 0 0 2 +EndChar + +StartChar: quotedblright +Encoding: 335 8221 262 +Width: 600 +Flags: MW +LayerCount: 2 +Fore +Refer: 56 8217 S 1 0 0 1 -120 0 2 +Refer: 56 8217 N 1 0 0 1 120 0 2 +EndChar + +StartChar: quotedblbase +Encoding: 336 8222 263 +Width: 600 +Flags: MW +LayerCount: 2 +Fore +Refer: 56 8217 S 1 0 0 1 120 -620 2 +Refer: 56 8217 N 1 0 0 1 -120 -620 2 +EndChar + +StartChar: quotedblleft +Encoding: 334 8220 264 +Width: 600 +Flags: MW +LayerCount: 2 +Fore +Refer: 57 8216 S 1 0 0 1 120 0 2 +Refer: 57 8216 N 1 0 0 1 -120 0 2 +EndChar + +StartChar: ellipsis +Encoding: 337 8230 265 +Width: 600 +Flags: MW +LayerCount: 2 +Fore +Refer: 24 46 S 1 0 0 1 200 0 2 +Refer: 24 46 N 1 0 0 1 -200 0 2 +Refer: 24 46 N 1 0 0 1 0 0 2 +EndChar + +StartChar: uparrow +Encoding: 338 8593 266 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +78 468 m 1 + 295 742 l 1 + 320 742 l 1 + 521 466 l 1 + 463 427 l 1 + 340 593.819 l 1 + 340 -39 l 1 + 263 -39 l 1 + 263 594.4 l 1 + 128 427 l 1 + 78 468 l 1 +EndSplineSet +EndChar + +StartChar: downarrow +Encoding: 339 8595 267 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 266 8593 N -1 0 0 -1 599 703 2 +EndChar + +StartChar: visiblespace +Encoding: 340 9251 268 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +66 81 m 0 + 120 81 l 0 + 120 -24 l 0 + 478 -24 l 0 + 478 81 l 0 + 534 81 l 0 + 534 -76 l 0 + 66 -76 l 0 + 66 81 l 0 +EndSplineSet +EndChar + +StartChar: r.serif +Encoding: 341 -1 269 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +85 529 m 4 + 244 529 l 4 + 241 427 l 4 + 273.808 493.49 340.052 541.496 416.28 541.496 c 4 + 465.614 541.496 515.474 521.475 553 484 c 4 + 514 404 l 4 + 505.563 412.004 501.879 420.625 495.327 429.3 c 4 + 481.446 447.681 452.813 469.759 411.236 469.759 c 4 + 371.703 469.759 324.688 449.297 282.848 390.04 c 4 + 241.434 331.385 241 295.589 241 267 c 4 + 241 62 l 4 + 352 62 l 4 + 352 -1 l 4 + 83 -1 l 4 + 83 62 l 4 + 158 62 l 4 + 158 462 l 4 + 85 462 l 4 + 85 529 l 4 +EndSplineSet +EndChar + +StartChar: hungarumlaut.cap +Encoding: 343 -1 270 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +486 939 m 0 + 540 864 l 0 + 371 747 l 0 + 334 795 l 0 + 486 939 l 0 +280 939 m 0 + 334 864 l 0 + 165 747 l 0 + 128 795 l 0 + 280 939 l 0 +EndSplineSet +EndChar + +StartChar: uni2074 +Encoding: 344 8308 271 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +360 743 m 0 + 405 743 l 0 + 405 459 l 0 + 478 459 l 0 + 478 404 l 0 + 405 404 l 0 + 405 292 l 0 + 339 292 l 0 + 339 405 l 0 + 128 405 l 0 + 128 446 l 0 + 360 743 l 0 +340 630 m 0 + 204 459 l 0 + 340 459 l 0 + 340 630 l 0 +EndSplineSet +EndChar + +StartChar: onequarter +Encoding: 282 188 272 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 274 8260 S 1 0 0 1 0 0 2 +Refer: 271 8308 N 0.8 0 0 0.8 178.6 -314.5 2 +Refer: 149 185 N 0.8 0 0 0.8 -107.4 198.6 2 +EndChar + +StartChar: threequarters +Encoding: 284 190 273 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 274 8260 S 1 0 0 1 6 0 2 +Refer: 204 179 N 0.8 0 0 0.8 -90.9999 201.01 2 +Refer: 271 8308 N 0.8 0 0 0.8 178.6 -314.5 2 +EndChar + +StartChar: fraction +Encoding: 345 8260 274 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +98 -19 m 29 + 461 770 l 29 + 516 739 l 29 + 152 -49 l 29 + 98 -19 l 29 +EndSplineSet +EndChar + +StartChar: lslash +Encoding: 327 322 275 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +108 770 m 1 + 342 770 l 1 + 342 428.9 l 1 + 417 455 l 2 + 429 459 437 464 448 472 c 1 + 448 387 l 1 + 342 351.164 l 1 + 342 67 l 1 + 498 67 l 1 + 498 0 l 1 + 101 0 l 1 + 101 67 l 1 + 258 67 l 1 + 258 322.765 l 1 + 167 292 l 1 + 167 368 l 1 + 258 399.668 l 1 + 258 703 l 1 + 108 703 l 1 + 108 770 l 1 +EndSplineSet +EndChar + +StartChar: Lslash +Encoding: 286 321 276 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +95 722 m 1 + 189 722 l 1 + 189.172 720.866 189.256 719.721 189.256 718.572 c 0 + 189.256 703.818 179 701.431 179 683 c 2 + 179 380.515 l 1 + 371 443 l 2 + 381.223 446.327 390.329 449.186 401 454 c 1 + 401 380 l 1 + 179 308.815 l 1 + 179 69 l 1 + 527 69 l 1 + 527 -1 l 1 + 95 -1 l 1 + 95 281.88 l 1 + 33 262 l 1 + 33 333 l 1 + 95 353.178 l 1 + 95 722 l 1 +EndSplineSet +EndChar + +StartChar: Eng +Encoding: 346 330 277 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +69 0 m 0 + 69 722 l 0 + 154 722 l 0 + 154 628 l 0 + 195.063 692.14 265.789 735.013 341.737 735.013 c 0 + 413.041 735.013 477.286 696.601 508.242 629.025 c 0 + 529.38 582.882 530 536.67 530 491 c 0 + 530 491 l 0 + 530 203 l 0 + 530 162.878 529.279 123.251 510.426 83.1621 c 0 + 481.76 22.2073 421.615 -12.2234 354.689 -12.2234 c 0 + 319.213 -12.2234 284.072 -2.51385 253 16 c 0 + 294 88 l 0 + 300.652 84.108 301.561 78.1418 306.406 74.6071 c 0 + 308.777 72.8775 330.155 60.3705 357.435 60.3705 c 0 + 390.135 60.3705 419.596 78.287 435.091 111.214 c 0 + 447.894 138.419 448 169.63 448 197 c 0 + 448 489 l 0 + 448 522.737 448.069 561.745 430.159 597.471 c 0 + 409.568 638.545 370.917 662.054 327.377 662.054 c 0 + 264.705 662.054 206.267 613.375 180.496 576.603 c 0 + 158.142 544.705 154 516.425 154 478 c 0 + 154 0 l 0 + 69 0 l 0 +EndSplineSet +EndChar + +StartChar: dcroat +Encoding: 347 273 278 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +280.638 475.041 m 0 + 219.729 475.041 134.873 433.439 134.873 282.731 c 0 + 134.873 108.363 223.935 61.8091 283.87 61.8091 c 0 + 339.081 61.8091 393.871 98.7178 414.26 162.214 c 0 + 422.843 188.943 425.29 218.613 425.29 258.526 c 0 + 425.29 317.62 422.953 347.168 416.391 371.787 c 0 + 395.442 450.383 327.053 475.041 280.638 475.041 c 0 +510.157 630 m 1 + 511 49 l 2 + 511.023 32.976 511.825 16.2095 516 0 c 1 + 433 0 l 1 + 428.758 12.8474 428 26.4226 428 39 c 2 + 428 85 l 1 + 394.754 25.5822 332.198 -11.7426 264.502 -11.7426 c 0 + 162.172 -11.7426 53.9989 73.6686 53.9989 269.088 c 0 + 53.9989 471.408 175.85 543.089 276.756 543.089 c 0 + 349.905 543.089 406.551 506.411 432 452 c 1 + 432 630 l 1 + 344 630 l 1 + 344 692 l 1 + 432 692 l 1 + 432 771 l 1 + 521 771 l 1 + 521.429 763.115 517.033 757.358 514.644 753.665 c 0 + 510.515 747.282 509.991 744.04 510 738 c 2 + 510.067 692 l 1 + 561 692 l 1 + 561 630 l 1 + 510.157 630 l 1 +EndSplineSet +EndChar + +StartChar: Gbreve +Encoding: 348 286 279 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 241 728 S 1 0 0 1 10 167 2 +Refer: 67 71 N 1 0 0 1 0 0 2 +EndChar + +StartChar: Idotaccent +Encoding: 349 304 280 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 222 729 S 1 0 0 1 -20 157 2 +Refer: 4 73 N 1 0 0 1 0 0 2 +EndChar + +StartChar: cacute +Encoding: 321 263 281 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 107 180 S 1 0 0 1 0 0 2 +Refer: 1 99 N 1 0 0 1 0 0 2 +EndChar + +StartChar: ecaron +Encoding: 328 283 282 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 143 711 S 1 0 0 1 0 0 2 +Refer: 9 101 N 1 0 0 1 0 0 2 +EndChar + +StartChar: gbreve +Encoding: 342 287 283 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 241 728 S 1 0 0 1 10 0 2 +Refer: 13 103 N 1 0 0 1 0 0 2 +EndChar + +StartChar: racute +Encoding: 350 341 284 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 107 180 S 1 0 0 1 0 0 2 +Refer: 16 114 N 1 0 0 1 0 0 2 +EndChar + +StartChar: zacute +Encoding: 352 378 285 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 107 180 S 1 0 0 1 0 0 2 +Refer: 69 122 N 1 0 0 1 0 0 2 +EndChar + +StartChar: tcaron +Encoding: 351 357 286 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +Refer: 56 8217 S 0.8 0 0 0.8 276.515 226.393 2 +Refer: 8 116 N 1 0 0 1 -30 0 2 +EndChar + +StartChar: bullet +Encoding: 353 8226 287 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +405.001 343.496 m 0 + 405.001 290.47 361.103 246.968 306.461 246.968 c 0 + 251.887 246.968 207.967 290.437 207.967 343.507 c 0 + 207.967 396.512 251.854 440.001 306.474 440.001 c 0 + 361.085 440.001 405.001 396.528 405.001 343.496 c 0 +EndSplineSet +EndChar + +StartChar: florin +Encoding: 354 402 288 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +566 719 m 1 + 528 642 l 1 + 524.387 642.014 519.832 644.287 518.495 650.917 c 0 + 517.585 655.43 518.381 658.903 515.477 665.038 c 0 + 504.735 687.73 476.304 714.31 438.015 714.31 c 0 + 408.828 714.31 375.637 697.84 356.674 655.963 c 0 + 340.302 619.806 338.928 575.492 336 539 c 2 + 328.378 444 l 1 + 471 444 l 1 + 471 378 l 1 + 323.082 378 l 1 + 295 28 l 2 + 290.863 -23.5551 284.654 -73.9088 257.475 -120.242 c 0 + 224.265 -176.855 172.982 -203.002 125.302 -203.002 c 0 + 89.2414 -203.002 55.0861 -188.068 31 -162 c 1 + 78 -88 l 1 + 84.9954 -91.4507 87.1891 -97.9286 90.1488 -102.751 c 0 + 96.5551 -113.189 111.389 -124.965 131.92 -124.965 c 0 + 150.936 -124.965 174.229 -114.524 191.263 -83.2958 c 0 + 210.753 -47.5643 214.363 -4.0862 217 31 c 2 + 243.075 378 l 1 + 103 378 l 1 + 103 444 l 1 + 248.035 444 l 1 + 256 550 l 2 + 259.285 593.711 263.037 638.828 284.817 682.438 c 0 + 316.683 746.244 375.812 780 436.757 780 c 0 + 486.409 780 533.918 757.602 566 719 c 1 +EndSplineSet +EndChar + +StartChar: dagger +Encoding: 355 8224 289 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +261 756 m 1 + 339 756 l 1 + 339 529 l 1 + 531 529 l 1 + 531 460 l 1 + 339 460 l 1 + 339 -175 l 1 + 261 -175 l 1 + 261 460 l 1 + 67 460 l 1 + 67 529 l 1 + 261 529 l 1 + 261 756 l 1 +EndSplineSet +EndChar + +StartChar: daggerdbl +Encoding: 356 8225 290 +Width: 600 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +261 756 m 1 + 339 756 l 1 + 339 529 l 1 + 531 529 l 1 + 531 460 l 1 + 339 460 l 1 + 339 140 l 1 + 531 140 l 1 + 531 71 l 1 + 339 71 l 1 + 339 -175 l 1 + 261 -175 l 1 + 261 71 l 1 + 67 71 l 1 + 67 140 l 1 + 261 140 l 1 + 261 460 l 1 + 67 460 l 1 + 67 529 l 1 + 261 529 l 1 + 261 756 l 1 +EndSplineSet +EndChar + +StartChar: trademark +Encoding: 357 8482 291 +Width: 600 +VWidth: 1157 +Flags: HMW +LayerCount: 2 +Fore +SplineSet +286.552 735.33 m 5 + 286.552 689.01 l 5 + 182.332 689.01 l 5 + 182.332 370.56 l 5 + 130.222 370.56 l 5 + 130.222 689.01 l 5 + 30.6338 689.01 l 5 + 30.6338 735.33 l 5 + 286.552 735.33 l 5 +360.664 735.33 m 5 + 444.04 567.42 l 5 + 466.042 609.108 466.042 609.108 487.465 651.375 c 132 + 508.888 693.642 508.888 693.642 530.89 735.33 c 5 + 569.104 735.33 l 5 + 569.104 370.56 l 5 + 520.468 370.56 l 5 + 520.468 619.53 l 5 + 503.098 588.264 503.098 588.264 485.149 556.419 c 132 + 467.2 524.574 467.2 524.574 450.988 494.466 c 5 + 432.46 495.624 l 5 + 368.77 619.53 l 5 + 368.77 370.56 l 5 + 320.134 370.56 l 5 + 320.134 735.33 l 5 + 360.664 735.33 l 5 +EndSplineSet +EndChar + +StartChar: zero.noslash +Encoding: 358 -1 292 +Width: 600 +Flags: HW +LayerCount: 2 +Fore +SplineSet +517.025 357.799 m 4 + 517.025 137.688 423.592 -13.0208 297.523 -13.0208 c 4 + 183.255 -13.0208 82.8194 113.451 82.8194 341.437 c 4 + 82.8194 574.873 173.246 727.004 299.955 727.004 c 4 + 420.815 727.004 517.025 585.161 517.025 357.799 c 4 +299.205 656.004 m 4 + 273.981 656.004 230.75 644.394 201.424 580.18 c 4 + 177.708 528.251 159.966 454.416 159.966 351.701 c 4 + 159.966 277.625 175.139 200.382 194.564 153.681 c 4 + 226.53 76.8272 272.306 60.9815 302.777 60.9815 c 4 + 329.251 60.9815 369.189 73.0652 399.83 130.196 c 4 + 432.501 191.111 442.125 283.781 442.125 342.506 c 4 + 442.125 419.575 425.889 514.517 403.194 568.433 c 4 + 372.393 641.605 328.293 656.004 299.205 656.004 c 4 +EndSplineSet +EndChar + +StartChar: .notdef +Encoding: 0 -1 293 +Width: 600 +Flags: HW +LayerCount: 2 +EndChar +EndChars +EndSplineFont diff --git a/x11/fonts/README b/x11/fonts/README new file mode 100644 index 0000000..923c08b --- /dev/null +++ b/x11/fonts/README @@ -0,0 +1,10 @@ +README +====== + +Inconsolata is a free font licensed under the SIL Open Font License [1] and +was downloaded from [2]. SourceCodePro Regular is also licensed under the SIL +Open Font License [1] and was downloaded from [3]. + +[1] http://scripts.sil.org/OFL +[2] http://www.levien.com/type/myfonts/inconsolata.html +[3] https://github.com/adobe-fonts/source-code-pro/ diff --git a/x11/fonts/SourceCodePro-Regular.otf b/x11/fonts/SourceCodePro-Regular.otf new file mode 100644 index 0000000..4e3b9d0 Binary files /dev/null and b/x11/fonts/SourceCodePro-Regular.otf differ diff --git a/x11/herbstluftwm/autostart b/x11/herbstluftwm/autostart new file mode 100755 index 0000000..a9d530f --- /dev/null +++ b/x11/herbstluftwm/autostart @@ -0,0 +1,180 @@ +#!/bin/sh + +# Herbstluftm configuration file. + +# Copyright (C) 2014 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +set -eu + + +hc() { + herbstclient "$@" +} +installed() { + type "$1" >/dev/null 2>&1 +} +# $1: timeout +notify() { + if installed dzen2; then + read x + printf '%s\n' "$x" | sed 's/\^/^^/g' \ + | dzen2 -fg blue -bg yellow -y 15 -h 30 -p "$1" & + elif installed xmessage; then + # Fallback solution, display first line of stdin. + read x + xmessage -timeout "$1" "$x" & + else + # Last way to send a "message", create a stupid window layout so I + # notice something is up and look at the logs. + hc fullscreen off + hc floating off + hc pseudotile off + hc split vertical 0.1 + hc unlock # or we might not see the changes + fi +} + +# Tell all clients the configuration file was reloaded. Should be the first +# command in the autostart file. +hc emit_hook reload + + +# KEY BINDINGS + +# Use Super (= "Windows") key as modifier which is used for all herbstluftwm +# key bindings. +mod=Mod4 + +# Remove all existing key bindings. +hc keyunbind --all + +# Basic key bindings. +hc keybind $mod-Shift-Return spawn urxvt +hc keybind $mod-Shift-c close +hc keybind $mod-q reload +hc keybind $mod-Shift-q quit +# Lock the screen. +hc keybind $mod-z spawn "$HOME/.xlockscreen" lock + +# Tag key bindings. Create tags 1 to 0 with bindings to switch and move +# windows to them. +hc rename default 1 2>/dev/null || true +for i in `seq 1 9` 0; do + hc add "$i" + hc keybind "$mod-$i" use "$i" + hc keybind "$mod-Shift-$i" move "$i" +done +# Switch to last active tag. +hc keybind $mod-b use_previous + +# Layouting key bindings. +hc keybind $mod-space cycle_layout 1 horizontal max # toggle these layouts +hc keybind $mod-u split vertical 0.5 +hc keybind $mod-o split horizontal 0.5 +hc keybind $mod-r remove # remove a split +# Change window state. +hc keybind $mod-f fullscreen toggle +# Reset fullscreen and layout. Just in case I get confused. +hc keybind $mod-Shift-space chain , fullscreen off , set_layout horizontal + +# Focus key bindings. +hc keybind $mod-h focus left +hc keybind $mod-j focus down +hc keybind $mod-k focus up +hc keybind $mod-l focus right +# Move windows. +hc keybind $mod-Shift-h shift left +hc keybind $mod-Shift-j shift down +hc keybind $mod-Shift-k shift up +hc keybind $mod-Shift-l shift right +# Swap top and bottom frame (only works with two frames). +hc keybind $mod-s chain , lock , rotate , rotate , unlock + + +# MOUSE BINDINGS + +# Remove all existing key bindings. +hc mouseunbind --all + + +# GENERAL SETTINGS + +# Necessary for Java so it recognizes herbstluftwm as tiling window manager. +hc set wmname LG3D +# Auto-detect new monitors. +hc set auto_detect_monitors 1 + + +# WINDOW and FRAME SETTINGS + +# No border for frames, only for windows. +hc set frame_border_width 0 +hc set window_border_width 1 +# No gaps between frames or windows. +hc set frame_gap 0 +hc set window_gap 0 +# Inactive window borders are black, almost invisible on my black screen. +# Active window borders are dark red. +hc set window_border_normal_color '#000000' +hc set window_border_active_color '#990000' +# Transparent background for empty frames. +hc set frame_bg_transparent 1 + +# Use vertical layout for windows in frames per default. +hc set default_frame_layout 1 # vertical + + +# LAYOUT + +# Run only on startup, not when reloading the config. Thanks to The-Compiler +# in #herbstluftwm on Freenode (2014-01-10 16:26 CET) for the idea to use +# environment variables. +if ! hc getenv HLWMRC_LOADED >/dev/null; then + hc setenv HLWMRC_LOADED 1 + + # Setup my layout: Vertical split with my main terminal window in the top + # frame, secondary windows in the bottom frame. + hc split vertical 0.5 +fi + + +# RULES + +# Remove all existing rules. +hc unrule --all + +# * Do not focus new clients (default). +# * Don't allow clients to toggle fullscreen via EWMH. +# * Move new windows to the frame at the bottom of the screen. +hc rule focus=off \ + ewmhrequests=off \ + index=1 + +# Focus important windows when they are opened. +hc rule instance=xmessage focus=on + +# Move Iceweasel to tag 2. +hc rule instance=Navigator class=Iceweasel tag=2 + + +# After everything is done, allow redrawing of the windows. +hc unlock + + +# To notify me if set -eu has terminated the script (then this part won't get +# executed). +echo 'hlwm restarted' | notify 1 diff --git a/x11/katarakt.ini b/x11/katarakt.ini new file mode 100644 index 0000000..170c11d --- /dev/null +++ b/x11/katarakt.ini @@ -0,0 +1,24 @@ +; Katarakt (PDF viewer) configuration file. + +; Copyright (C) 2016 Simon Ruderich +; +; This file 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 file is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this file. If not, see . + + +[Settings] +; Immediately quit when failing to open a file. +quit_on_init_fail = 1 + +; Use grid layout per default which zooms to page width. +default_layout = grid diff --git a/x11/setup.sh b/x11/setup.sh new file mode 100755 index 0000000..a93d357 --- /dev/null +++ b/x11/setup.sh @@ -0,0 +1,97 @@ +#!/bin/sh + +# Setup script for X11 configuration files. + +# Copyright (C) 2011-2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +. ../lib.sh + + +if installed stumpwm; then + link stumpwmrc ~/.stumpwmrc +fi +if installed xmonad; then + link xmonad ~/.xmonad +fi +if installed herbstluftwm; then + link herbstluftwm ~/.config/herbstluftwm +fi + +if installed X; then + # Prevent code duplication. Term* rules are for all terminals; XTerm rules + # are for XTerm and UXTerm. + generate Xresources .in perl -ne \ + 'if (/^Term/) { + s/^Term//; + print "XTerm", $_; + print "UXTerm", $_; + print "URxvt", $_; + } elsif (/^XTerm/) { + print $_; + s/^XTerm//; + print "UXTerm", $_; + } else { + print $_; + }' + # Xresources uses ! as comment instead of #. + sed_i 's/^#/!/' Xresources + # Use urxvt's pseudo-transparency if neither compton nor xcompmgr are + # available. Better than nothing. + if ! installed compton && ! installed xcompmgr; then + echo 'Xresources: no compton found, enabling pseudo-transparency' + sed_i 's/^Rxvt\*background: \[/!&/' Xresources + sed_i 's/^!NO_COMPTON //' Xresources + fi + + if test ! "x`os`" = xdarwin; then + link xinitrc ~/.xinitrc + # Most display managers use ~/.xsession instead of ~/.xinitrc (which + # is used by e.g. startx). Provide both links. + link xinitrc ~/.xsession + fi + if test -f xinitrc.local; then + link xinitrc.local ~/.xinitrc.local + fi + link xmodmaprc ~/.xmodmaprc + link Xresources ~/.Xresources + link XCompose ~/.XCompose + + link fonts ~/.fonts + + link bin/xlockscreen ~/.xlockscreen +fi + +if installed xpdf; then + link xpdfrc ~/.xpdfrc +fi +if installed zathura; then + mkdir -p ~/.config/zathura + link zathurarc ~/.config/zathura/zathurarc +fi +if installed katarakt; then + link katarakt.ini ~/.config/katarakt.ini +fi + +if installed feh; then + mkdir -p ~/.config + link feh ~/.config/feh + # Older feh versions only support theme options and configure them through + # ~/.fehrc. + link feh/themes ~/.fehrc +fi diff --git a/x11/stumpwmrc b/x11/stumpwmrc new file mode 100644 index 0000000..a8ac453 --- /dev/null +++ b/x11/stumpwmrc @@ -0,0 +1,40 @@ +;; Configuration file for Stumpwm. + +;; Copyright (C) 2011-2012 Simon Ruderich +;; +;; This file 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 file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this file. If not, see . + + +(in-package :stumpwm) + + +;;; MODE LINE + +;; Display mode line at the bottom of the screen. +(setf *mode-line-position* :bottom) +;; Display mode line and allow loading of stumpwmrc multiple times. Thanks to +;; http://prael.wordpress.com/stumpwmrc/ and +;; http://hcl-club.lu/svn/development/lisp/.stumpwmrc +(if (not (head-mode-line (current-head))) + (toggle-mode-line (current-screen) (current-head))) + + +;;; KEY MAPPINGS + +;; Remove bindings to kill a window. Too dangerous for a Vim user. +(undefine-key *group-root-map* (kbd "k")) +(undefine-key *group-root-map* (kbd "C-k")) +(undefine-key *group-root-map* (kbd "K")) + +;; vim: ft=lisp diff --git a/x11/xinitrc b/x11/xinitrc new file mode 100755 index 0000000..480fbc6 --- /dev/null +++ b/x11/xinitrc @@ -0,0 +1,192 @@ +#!/bin/sh + +# startx configuration file. + +# Copyright (C) 2011-2014 Simon Ruderich +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +# Some systems don't set the LANG environment variable when starting xinitrc, +# this causes problems for rxvt-unicode-256color which fails to display UTF-8 +# characters correctly when LANG is missing and for notify.py which also needs +# LANG set (for Python's decode() function). Therefore load my general shell +# environment which also includes $LANG. +if test -f "$HOME/.shell/env"; then + . "$HOME/.shell/env" +fi + + +installed() { + type "$1" >/dev/null 2>&1 +} +error() { + if installed xmessage; then + xmessage "$@" & + else + # Log message to a file which is displayed by my Zsh setup on startup. + printf '%s\n' "$*" >>"$HOME/.xinitrc.errors" + fi +} +# Save PID of the most recently started background process. Used to terminate +# them when logging out to prevent unused background processes. On some +# systems this is only necessary for some programs (like ssh-agent), haven't +# yet figured out why. +save_background_pid() { + background_pids="$background_pids $!" +} +background_pids= + + +# Options, can be modified in ~/.xinitrc.local. To disable a boolean option +# set it to an empty value. +# +# Default to use a background image. +set_background=yes +# Default to display a warning if no screen locker is not available. +screen_lock_force=yes +# Lock screen after x minutes of inactivity. +screen_lock_time=3 +# Locker program to lock the screen (with xautolock). +screen_locker=xtrlock + +# Load settings for the local system. +if test -f "$HOME/.xinitrc.local"; then + . "$HOME/.xinitrc.local" +fi + + +# Start ssh-agent if no agent is running, thanks to +# http://code.haskell.org/XMonadContrib/scripts/xinitrc (read on 2011-06-19). +if test -z "$SSH_AGENT_PID" && test -x /usr/bin/ssh-agent; then + # -s to force bourne shell output. This file is a bourne shell script even + # if the environment might suggest otherwise. + eval `/usr/bin/ssh-agent -s` >/dev/null +fi + +# Use a black background for the root window. +xsetroot -solid black + +# Force English keyboard layout. +if installed setxkbmap; then + setxkbmap -option compose:menu us +fi + +# Use the Caps lock as Ctrl because it's easier to reach and very useful for +# all programs. Caps lock is removed completely. Thanks to +# http://snarfed.org/space/switch%20control%20and%20caps%20lock +if xmodmap | grep -E '^lock.*Caps_Lock' >/dev/null; then + xmodmap -e 'remove Lock = Caps_Lock' + xmodmap -e 'remove Control = Control_L' + xmodmap -e 'keysym Caps_Lock = Control_L' + xmodmap -e 'add Control = Control_L' +fi +# Move grave and tilde next to left shift key. This setting may only be +# necessary because of my German keyboard which I use with an English layout. +xmodmap -e 'keycode 94 = grave asciitilde' + +# Enable scrolling with trackpoint and middle mouse on Thinkpads, also disable +# touchpad. Thanks to DerRoteBaron. +if xinput 2>/dev/null | grep 'TPPS/2 IBM TrackPoint' >/dev/null; then + xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation" 8 1 + xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Button" 8 2 + xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Axes" 8 6 7 4 5 + xinput --disable "SynPS/2 Synaptics TouchPad" +fi + +# Disable annoying audio bell. Thanks to Sebastian Rachuj. +xset b off + +# Load settings for X programs. Xdefaults is deprecated. +xrdb "$HOME/.Xresources" + +# Change the background if available. +if test -f "$HOME/.background" && test -n "$set_background"; then + if installed hsetroot; then + hsetroot -full "$HOME/.background" + elif installed feh; then + feh --bg-scale "$HOME/.background" + # Remove the unnecessary ~/.fehbg file created by `feh`. I don't want + # to restore the background, I just run `feh` on each startx run. + # --no-fehbg is only available in recent feh releases. + rm -f "$HOME/.fehbg" + fi +fi + +# Display timed reminders and recheck the file for changes every minute (-z1). +if installed remind && test -f "$HOME/.reminders"; then + remind -z1 -k'.shell/bin/notify.py %s &' "$HOME/.reminders" & + save_background_pid +fi + +# Set color temperature of display according to time of day. +if installed redshift; then + redshift -l 49.9:10.9 -t 5500:4500 >/dev/null & +fi + + +# Start best available screen locker. +xlockscreen=`"$HOME/.xlockscreen" start "$screen_lock_time" "$screen_locker"` +if test $? -ne 0 && test -n "$screen_lock_force"; then + error "$xlockscreen" +fi + + +# Use compton to get transparent windows. See ~/.Xresources for configuration +# of urxvt. +if installed compton; then + compton & +# xcompmgr as fallback. +elif installed xcompmgr; then + xcompmgr & +fi + + +# My window manager doesn't start a terminal emulator on its own, start one +# when I login. +(urxvt || rxvt || xterm) & + +# Start window manager. +failed= +if installed herbstluftwm; then + herbstluftwm --locked || failed=1 +elif installed xmonad; then + xmonad || failed=1 +elif installed stumpwm; then + stumpwm || failed=1 +else + failed='no window manager found' +fi +# Fallback in case my window manager failed to start. Otherwise X terminates +# the session immediately (because xinitrc finishes). +if test -n "$failed"; then + if test x"$failed" = x1; then + failed='failed to start window manager' + fi + error "$failed (spawning fallback terminal)" + urxvt || rxvt || xterm +fi + + +# Cleanup. +# +# Kill ssh-agent to prevent unused background processes. +if test -x /usr/bin/ssh-agent; then + /usr/bin/ssh-agent -k >/dev/null + # No `eval` necessary, we terminate anyway. +fi +# Kill remaining background processes. +if test -n "$background_pids"; then + kill $background_pids +fi diff --git a/x11/xmodmaprc b/x11/xmodmaprc new file mode 100644 index 0000000..224bfce --- /dev/null +++ b/x11/xmodmaprc @@ -0,0 +1,35 @@ +! Keymap configuration file for xmodmap. +! +! Not actively used at the moment, ~/.xinitrc performs the same settings. Only +! necessary in case the settings reset itself and a manual run is necessary. +! Keep in sync with settings in xinitrc. + +! Copyright (C) 2011-2013 Simon Ruderich +! +! This file 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 file is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with this file. If not, see . + + +! Use the Caps lock as Ctrl because it's easier to reach and very useful for +! all programs. Caps lock is removed completely. Thanks to +! http://snarfed.org/space/switch%20control%20and%20caps%20lock +remove Lock = Caps_Lock +remove Control = Control_L +keysym Caps_Lock = Control_L +add Control = Control_L + +! Move grave and tilde next to left shift key. This setting may only be +! necessary because of my German keyboard which I use with English settings. +keycode 94 = grave asciitilde + +! vim: ft=xmodmap diff --git a/x11/xmonad/xmonad.hs b/x11/xmonad/xmonad.hs new file mode 100644 index 0000000..bdee75d --- /dev/null +++ b/x11/xmonad/xmonad.hs @@ -0,0 +1,196 @@ +-- xmonad configuration file. + +-- Copyright (C) 2011-2015 Simon Ruderich +-- +-- This file 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 file is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this file. If not, see . + + +import XMonad hiding ( (|||) ) +import XMonad.Actions.CycleWS (toggleWS) +import XMonad.Hooks.ManageHelpers ((-?>), composeOne) +import XMonad.Hooks.SetWMName (setWMName) +import XMonad.Layout.LayoutCombinators ((|||), JumpToLayout(..)) +import XMonad.Layout.Named (named) +import XMonad.Layout.NoBorders (smartBorders) +import XMonad.Layout.TwoPane (TwoPane(..)) +import XMonad.Util.EZConfig (additionalKeys) +import qualified XMonad.StackSet as W + + +-- Prevent new windows from spawning in the master pane. Taken from +-- http://haskell.org/haskellwiki/Xmonad/Frequently_asked_questions on +-- 2009-06-30. Thanks. Modified to not steal focus from the master pane when a +-- new window is created, thanks to vav in #xmonad on Freenode (2010-04-15 +-- 21:59 CEST). +avoidMaster :: W.StackSet i l a s sd -> W.StackSet i l a s sd +avoidMaster = W.modify' $ \c -> case c of + W.Stack t [] (r:rs) -> W.Stack r [] (t:rs) + _ -> c + +-- Create my custom layout. +-- +-- Only use horizontal (Mirror tiled) and fullscreen layouts, but allow +-- switching to other layouts with bindings. +-- +-- The master pane is at the top of the screen. To make sure new windows don't +-- spawn in the master pane avoidMaster (see below) is used. Borders are only +-- drawn when the screen has more then one window (smartBorders). +-- +-- Thanks to jrick in #xmonad on Freenode (2009-06-29 22:19 CEST) for telling +-- me how to remove the vertical tiled layout. +-- +-- JumpToLayout (from LayoutCombinators) is used to jump to specific layouts, +-- thanks to aavogt in #xmonad on Freenode (2011-06-12 22:13 CEST). +-- +-- named is used to name layouts which allows switching to a specific layout +-- (see below), thanks to vav in #xmonad on Freenode (2011-06-12 22:28 CEST). +-- +-- The limit layout displays only one window in the lower pane, thanks to to +-- Qantourisc (2010-06-12 15:15 CEST) for the hint to use TwoPane. +-- +-- onWorkspace is used for a special layout for Gimp, thanks to Nathan Howell +-- (http://nathanhowell.net/2009/03/08/xmonad-and-the-gimp/) for this layout +-- (read on 2011-06-19). +myLayoutHook = + named "Default" (smartBorders $ Mirror tiled) + ||| named "Full" (smartBorders Full) + ||| named "Vertical" (smartBorders tiled) + ||| named "Limit" (smartBorders $ Mirror $ TwoPane delta ratio) + where + -- Default tiling algorithm partitions the screen into two panes. + tiled = Tall nmaster delta ratio + -- The default number of windows in the master pane. + nmaster = 1 + -- Percent of screen to increment by when resizing panes. + delta = 3/100 + -- Default proportion of screen occupied by master pane. + ratio = 1/2 + +-- Don't spawn new windows in the master pane (which is at the top of the +-- screen). Thanks to dschoepe, aavogt and especially vav in #xmonad on +-- Freenode (2009-06-30 02:10f CEST). +-- +-- Also some applications are spawned on specific workspaces. Thanks to +-- dschoepe and ivanm in #xmonad on Freenode (2009-07-12 14:50 CEST). +myManageHook :: ManageHook +myManageHook = composeOne + -- Browser on "2". + [ className =? "Iceweasel" -?> doF (W.shift "2") + -- Miscellaneous on "3". + , className =? "Wireshark" -?> doF (W.shift "3") + , title =? "OpenOffice.org" -?> doF (W.shift "3") -- splash screen + , className =? "OpenOffice.org 2.4" -?> doF (W.shift "3") + , className =? "Vncviewer" -?> doF (W.shift "3") + -- Wine on "4". + , className =? "Wine" -?> doF (W.shift "4") + -- Gimp on "5". + , className =? "Gimp" -?> doF (W.shift "5") + + -- Don't spawn new windows in the master pane. + , return True -?> doF avoidMaster + -- Prevent windows which get moved to other workspaces from removing the + -- focus of the currently selected window. Thanks to vav in #xmonad on + -- Freenode (2010-04-15 21:04 CEST). + , return True -?> doF W.focusDown + ] + +-- Switch to next layout, but skip all layouts not in layouts argument. This +-- allows switching to some layouts with mappings but excluding them from +-- meta-space (which gets mapped to this function). Thanks to aavogt in +-- #xmonad on Freenode for this function (2011-06-13 12:45 CEST) and +-- rootzlevel in #xmonad on Freenode for fixes (2011-06-13 15:20 CEST), +-- modified to take list of layouts to switch to, not layouts to exclude. +nextLayoutIncluding :: [String] -> X () +nextLayoutIncluding layouts = do + cws <- gets (W.workspace . W.current . windowset) + sendMessageWithNoRefresh NextLayout cws + nextLayoutIncluding' layouts 1000 -- nobody has more than 1000 layouts + +nextLayoutIncluding' :: [String] -> Int -> X () +nextLayoutIncluding' layouts iterations = do + cws <- gets (W.workspace . W.current . windowset) + -- iterations prevents an endless loop if no valid layout can be found. + if not ((description $ W.layout cws) `elem` layouts) && iterations > 0 + -- Skip over excluded layouts. + then do + sendMessageWithNoRefresh NextLayout cws + nextLayoutIncluding' layouts (iterations - 1) + -- Found allowed layout, show it. + else refresh + +-- Use additional workspaces. Access with meta 1,2,..,9,0 for the first ten, +-- meta f1,f2,..,f10 for the second ten workspaces (see mappings below). +myWorkspaces :: [String] +myWorkspaces = map show [1 .. 20 :: Int] + +-- Use Windows (= Super) key as main key as it doesn't conflict with any other +-- key bindings. +myModMask :: KeyMask +myModMask = mod4Mask + +myKeys :: [((KeyMask, KeySym), X ())] +myKeys = [ + -- Switch to next layout, but only use the listed layouts. + ((myModMask, xK_space), nextLayoutIncluding ["Default", "Full"]) + -- Switch to vertical tiled layout. + , ((myModMask, xK_v), sendMessage $ JumpToLayout "Vertical") + -- Switch to limit layout which displays only one window in the lower + -- pane. + , ((myModMask, xK_b), sendMessage $ JumpToLayout "Limit") + + -- Switch to last active workspace, thanks to moljac024 in #xmonad on + -- Freenode (2010-12-18 14:45 CET). + , ((myModMask, xK_b), toggleWS) + + -- Lock the screen. + , ((myModMask, xK_z), spawn "$HOME/.xlockscreen lock") + ] + ++ + -- When using multiple screens, switching to another workspace causes + -- xmonad to pull the workspace to the current screen if it was also + -- displayed on another one. This is confusing for me so the following + -- code changes it to just switch to the screen where the workspace is + -- already displayed. + -- + -- Thanks to the xmonad FAQ, read on 2010-06-16 13:42 CEST + -- (http://www.haskell.org/haskellwiki/Xmonad/Frequently_asked_questions). + -- Thanks to MrElendig in #xmonad on Freenode (2010-06-17 17:16 CEST) how + -- to use the default xmonad workspaces. Thanks to geekosaur and OODavo in + -- #xmonad on Freenode (2012-12-23 01:14 CET) how to use more workspaces. + [((m .|. myModMask, k), windows $ f i) + | (i, k) <- zip myWorkspaces ([xK_1 .. xK_9] ++ [xK_0] -- 1..9,0 + ++ [xK_F1 .. xK_F10]) -- f1..f10 + , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]] + +main :: IO () +main = xmonad $ defaultConfig + -- Change main key. + { modMask = myModMask + -- Inactive borders are black - invisible on my black screen. + , normalBorderColor = "#000000" + -- Active borders are dark red. + , focusedBorderColor = "#990000" + -- Use my layout and manage hooks (see above). + , layoutHook = myLayoutHook + , manageHook = myManageHook + -- Use unicode rxvt as my terminal. + , terminal = "urxvt" + -- Necessary for Java so it recognizes xmonad as tiling window manager. + , startupHook = setWMName "LG3D" + -- Use more workspaces than the default. + , workspaces = myWorkspaces + } + `additionalKeys` myKeys + +-- vim: nospell diff --git a/x11/xpdfrc b/x11/xpdfrc new file mode 100644 index 0000000..e558209 --- /dev/null +++ b/x11/xpdfrc @@ -0,0 +1,48 @@ +# xpdf configuration file. + +# Copyright (C) 2011-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Include the system wide configuration file as xpdf doesn't load it +# automatically if ~/.xpdfrc is present. +include /etc/xpdf/xpdfrc + + +# Toggle outline. +bind ctrl-o any toggleOutline + +# Vi like bindings for scrolling. +# +# j/k are mapped to page* (and not scroll*) or pressing j/k won't scroll +# up/down when the whole page is viewed. +bind j any pageDown +bind k any pageUp +bind h any scrollLeft(16) +bind l any scrollRight(16) +# +bind ctrl-b any pageUp +bind ctrl-f any pageDown + +# Vi like bindings for searching. +bind / any find +bind n any findNext + +# Zoom to full page on startup, change to "normal" zoom mode by pressing 0. +initialZoom page + +# Use Elinks to open URLs. No quotes around %s, xpdf must handle the quoting +# or it causes security vulnerabilities with manipulated URLs. +urlCommand "elinks -remote %s" diff --git a/x11/zathurarc b/x11/zathurarc new file mode 100644 index 0000000..e295150 --- /dev/null +++ b/x11/zathurarc @@ -0,0 +1,40 @@ +# zathura (pdf viewer) configuration file. + +# Copyright (C) 2011-2012 Simon Ruderich +# +# This file 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 file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# SETTINGS + +# Save position and zoom level of opened files. +set save_position true +set save_zoom_level true + +# Don't display status and inputbar for maximum space efficiency. +set show_statusbar false +set show_inputbar false + + +# MAPPINGS + +# Quit zathura. +map q quit + +# Zoom in and out. +map + zoom in +map - zoom out + +# Reload current PDF (in case autoreload doesn't work). +map r reload