Repository: Falkor/dotfiles Branch: master Commit: 7368911f6607 Files: 125 Total size: 490.0 KB Directory structure: gitextract_yqw0d9yy/ ├── .Makefile.after ├── .falkor/ │ └── config ├── .gitignore ├── .gitmodules ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── LICENSE ├── Makefile ├── README.md ├── VERSION ├── Vagrantfile ├── atom/ │ ├── README.md │ └── package-list.txt ├── bash/ │ ├── .bash_profile │ ├── .bashrc │ ├── .inputrc │ ├── README.md │ ├── custom/ │ │ ├── .gitignore │ │ └── README.md │ └── preexec.bash ├── bin/ │ ├── git-changelog │ └── sshb ├── brew/ │ ├── Brewfile │ └── Brewfile.minimal ├── curl/ │ └── .curlrc ├── direnv/ │ ├── .gitignore │ ├── direnvrc │ ├── envrc │ └── init.sh ├── docs/ │ ├── contributing/ │ │ ├── index.md │ │ ├── layout.md │ │ ├── setup.md │ │ └── versioning.md │ ├── emacs/ │ │ └── index.md │ ├── index.md │ ├── rtfd.md │ └── vagrant.md ├── git/ │ ├── .gitconfig │ ├── .gitignore │ ├── README.md │ ├── config.local.example │ └── ignore ├── gnupg/ │ ├── 4F156AD7-transition-statement.md.asc │ ├── DD01D5C0-transition-statement.md.asc │ ├── README.md │ ├── dirmngr.conf │ ├── gpg-agent.conf │ ├── gpg.conf │ ├── scdaemon.conf │ └── scripts/ │ └── generate-gpg-key ├── install.sh ├── mkdocs.yml ├── oh-my-zsh/ │ ├── .gitignore │ ├── .p10k.zsh │ ├── .zlogin │ ├── .zprofile │ ├── .zshenv │ ├── .zshrc │ ├── README.md │ └── custom/ │ ├── .gitignore │ ├── completions/ │ │ ├── _assh │ │ ├── _devbox │ │ ├── _gh │ │ ├── _git-subtree │ │ ├── _keybase │ │ ├── _mkdocs │ │ ├── _parallel │ │ ├── _poetry │ │ ├── _rvm │ │ ├── _toolbox │ │ └── _ykman │ └── plugins/ │ ├── falkor/ │ │ └── falkor.plugin.zsh │ └── zsh-completions.local/ │ └── zsh-completions.plugin.zsh ├── pyenv/ │ └── init.sh ├── screen/ │ ├── .screenrc │ └── README.md ├── screenshots/ │ └── src/ │ └── .gitignore ├── shell/ │ ├── .gitignore │ ├── available/ │ │ ├── asdf.sh │ │ ├── assh.sh │ │ ├── atom.sh │ │ ├── autojump.sh │ │ ├── beets.sh │ │ ├── curl.sh │ │ ├── direnv.sh │ │ ├── easybuild.sh │ │ ├── fzf.sh │ │ ├── glab.sh │ │ ├── go.sh │ │ ├── gpg-agent.sh │ │ ├── llvm.sh │ │ ├── nix.sh │ │ ├── nvm.sh │ │ ├── pdk.sh │ │ ├── pipx.sh │ │ ├── pyenv.sh │ │ ├── screen.sh │ │ ├── spacemacs.sh │ │ ├── taskwarrior.sh │ │ ├── toolbox.sh │ │ ├── uv.sh │ │ ├── vagrant.sh │ │ └── vim.sh │ └── custom/ │ └── .gitignore ├── systemd/ │ └── user/ │ ├── rtags-rdm.service │ └── rtags-rdm.socket ├── tests/ │ ├── 01-install_script.bats │ ├── README.md │ ├── setup_bats.sh │ └── test_helper.bash ├── tmux/ │ ├── README.md │ └── tmux.conf └── vim/ ├── .oldfr/ │ └── .vimrc ├── README.md ├── config/ │ ├── autocmd.vim │ ├── general.vim │ ├── init.vim │ ├── keybindings.vim │ ├── neobundle.vim │ ├── plugins.vim │ ├── theme.vim │ └── vimrc ├── init.vim └── old/ ├── .vimrc └── xdg.vim ================================================ FILE CONTENTS ================================================ ================================================ FILE: .Makefile.after ================================================ # -*- mode: makefile; -*- #################################################################################### # .Makefile.after (local hook for GNU make, extending Makefile) # Time-stamp: # __ __ _ __ _ _ __ _ # | \/ | __ _| | _____ / _(_) | ___ __ _ / _| |_ ___ _ __ # | |\/| |/ _` | |/ / _ \ |_| | |/ _ \ / _` | |_| __/ _ \ '__| # _| | | | (_| | < __/ _| | | __/| (_| | _| || __/ | # (_)_| |_|\__,_|_|\_\___|_| |_|_|\___(_)__,_|_| \__\___|_| ################################################################################### INSTALL_SCRIPT=./install.sh BATS=$(shell which bats 2>/dev/null) .PHONY: tests install: setup $(INSTALL_SCRIPT) --all --dry-run uninstall: $(INSTALL_SCRIPT) --delete --all --dry-run ifeq ($(BATS),) tests: @echo "the Unit tests of Falkor's dotfiles rely on Bats which does not seem present on your system" @echo "See https://github.com/sstephenson/bats for details" @echo "installation notes can be found in tests/setup_bats.sh" else tests: $(BATS) tests endif ================================================ FILE: .falkor/config ================================================ # config # /!\ DO NOT EDIT THIS FILE: it has been automatically generated --- :project: :name: Falkor's Dotfiles :type: - :none :by: Falkor :author: Sebastien Varrette aka Falkor :mail: Sebastien.Varrette@uni.lu :summary: Sebastien Varrette aka Falkor's dotfiles :description: Sebastien Varrette aka Falkor's dotfiles :forge: :github :source: https://github.com/Falkor/dotfiles :project_page: https://github.com/Falkor/dotfiles :origin: https://github.com/Falkor/dotfiles.git :license: GPL-3.0 :issues_url: https://github.com/Falkor/dotfiles/issues :tags: - dotfiles - zsh - bash - git - vim :gitflow: :branches: :master: production :develop: master ================================================ FILE: .gitignore ================================================ .vagrant/ ================================================ FILE: .gitmodules ================================================ [submodule ".submodules/Makefiles"] path = .submodules/Makefiles url = https://github.com/Falkor/Makefiles.git branch = devel [submodule "tests/helpers/assertions"] path = tests/helpers/assertions url = https://github.com/jasonkarns/bats-assert [submodule "oh-my-zsh/custom/themes/powerlevel10k"] path = oh-my-zsh/custom/themes/powerlevel10k url = https://github.com/romkatv/powerlevel10k.git [submodule "oh-my-zsh/custom/plugins/zsh-syntax-highlighting"] path = oh-my-zsh/custom/plugins/zsh-syntax-highlighting url = https://github.com/zsh-users/zsh-syntax-highlighting.git [submodule "oh-my-zsh/custom/plugins/zsh-completions"] path = oh-my-zsh/custom/plugins/zsh-completions url = https://github.com/zsh-users/zsh-completions.git [submodule "oh-my-zsh/custom/plugins/nix-zsh-completions"] path = oh-my-zsh/custom/plugins/nix-zsh-completions url = https://github.com/nix-community/nix-zsh-completions.git ================================================ FILE: .travis.yml ================================================ language: bash sudo: false cache: - apt os: - linux # - osx before_script: - source ./tests/setup_bats.sh addons: apt: packages: - zsh hosts: - travis.dev env: - TRAVIS_CI_RUN=true GIT_SSH='ssh -o StrictHostKeyChecking=no' GIT_AUTHOR_NAME='Travis CI' GIT_AUTHOR_EMAIL='travis@example.com' before install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install bats; fi # install: # - if [ "$(uname -s)" != "Darwin" ]; then sudo apt-get update -qq && sudo apt-get install -y zsh; fi script: - bats tests notifications: email: on_success: never slack: secure: NBN4QhHuaXpwZIxUOzZi29Z4iW0EK/d2ID7zZqz+1RDO/9BD7QqX5unM/SFP46oTbhEqNH/vMLLMFQ9i9l7Z1i6Z6nCNRiLRIjgPSL+3GMamPQm1Pj4JaLkwLHogxHdRvozfU3tdSG9uGmK++Aak/NLC/i5TASGrBMgKrmXLXEk= ================================================ FILE: CODE_OF_CONDUCT.md ================================================ # Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at Sebastien.Varrette@uni.lu. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] [homepage]: http://contributor-covenant.org [version]: http://contributor-covenant.org/version/1/4/ ================================================ FILE: LICENSE ================================================ Copyright (C) 2016 Sebastien Varrette aka Falkor 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. 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. ================================================ FILE: Makefile ================================================ #################################################################################### # Makefile (configuration file for GNU make - see http://www.gnu.org/software/make/) # Time-stamp: # __ __ _ __ _ _ # | \/ | __ _| | _____ / _(_) | ___ # | |\/| |/ _` | |/ / _ \ |_| | |/ _ \ # | | | | (_| | < __/ _| | | __/ # |_| |_|\__,_|_|\_\___|_| |_|_|\___| # # Copyright (c) 2012 Sebastien Varrette # . http://varrette.gforge.uni.lu # #################################################################################### # ############################## Variables Declarations ############################## SHELL = /bin/bash UNAME = $(shell uname) # Some directories SUPER_DIR = $(shell basename `pwd`) XDG_CACHE_HOME ?= $(HOME)/.cache XDG_CONFIG_HOME ?= $(HOME)/.config XDG_DATA_HOME ?= $(HOME)/.local/share # Git stuff management HAS_GITFLOW = $(shell git flow version 2>/dev/null || [ $$? -eq 0 ]) LAST_TAG_COMMIT = $(shell git rev-list --tags --max-count=1) LAST_TAG = $(shell git describe --tags $(LAST_TAG_COMMIT) ) TAG_PREFIX = "v" # GITFLOW_BR_MASTER = $(shell git config --get gitflow.branch.master) # GITFLOW_BR_DEVELOP = $(shell git config --get gitflow.branch.develop) GITFLOW_BR_MASTER=production GITFLOW_BR_DEVELOP=master CURRENT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD) GIT_BRANCHES = $(shell git for-each-ref --format='%(refname:short)' refs/heads/ | xargs echo) GIT_REMOTES = $(shell git remote | xargs echo ) GIT_ROOTDIR = $(shell git rev-parse --show-toplevel) GIT_HOOKSDIR = .git/hooks SRC_HOOKSDIR = config/hooks #SRC_HOOKSDIR_TO_ROOTDIR = $(shell git -C "$(GIT_ROOTDIR)/$(SRC_HOOKSDIR)" rev-parse --show-cdup) SRC_PRECOMMIT_HOOK = $(wildcard $(SRC_HOOKSDIR)/pre-commit*.sh) GIT_DIRTY = $(shell git diff --shortstat 2> /dev/null | tail -n1 ) # Git subtrees repositories # Format: '[|]' - don't forget the quotes. if branch is ignored, 'master' is used #GIT_SUBTREE_REPOS = 'https://github.com/ULHPC/easybuild-framework.git|develop' \ 'https://github.com/hpcugent/easybuild-wiki.git' GITSTATS = ./.submodules/gitstats/gitstats GITSTATS_DIR = gitstats # Branches to update on 'make up' GIT_BRANCHES_TO_UPDATE = $(GITFLOW_BR_DEVELOP) $(GITFLOW_BR_MASTER) ifeq (,$(wildcard .bumpversion.cfg)) VERSION = $(shell [ -f VERSION ] && head VERSION || echo '0.0.1') else VERSION = $(shell bumpversion --dry-run --allow-dirty --list minor | grep current_version | cut -d '=' -f 2) endif # OR try to guess directly from the last git tag #VERSION = $(shell git describe --tags $(LAST_TAG_COMMIT) | sed "s/^$(TAG_PREFIX)//") MAJOR = $(shell echo $(VERSION) | sed "s/^\([0-9]*\).*/\1/") MINOR = $(shell echo $(VERSION) | sed "s/[0-9]*\.\([0-9]*\).*/\1/") PATCH = $(shell echo $(VERSION) | sed "s/[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/") # total number of commits BUILD = $(shell git log --oneline | wc -l | sed -e "s/[ \t]*//g") #REVISION = $(shell git rev-list $(LAST_TAG).. --count) ifeq (,$(wildcard .bumpversion.cfg)) NEXT_MAJOR_VERSION = $(shell expr $(MAJOR) + 1).0.0-b$(BUILD) NEXT_MINOR_VERSION = $(MAJOR).$(shell expr $(MINOR) + 1).0-b$(BUILD) NEXT_PATCH_VERSION = $(MAJOR).$(MINOR).$(shell expr $(PATCH) + 1)-b$(BUILD) else NEXT_MAJOR_VERSION = $(shell expr $(MAJOR) + 1).0.0 NEXT_MINOR_VERSION = $(MAJOR).$(shell expr $(MINOR) + 1).0 NEXT_PATCH_VERSION = $(MAJOR).$(MINOR).$(shell expr $(PATCH) + 1) endif # Python stuff # See https://pip.pypa.io/en/stable/user_guide/#requirements-files PIP_REQUIREMENTS_FILE = requirements.txt ##################### Main targets ##################### # Default targets - append your own with TARGETS += TARGETS = # Default targets for 'make [dist]clean' - append your own with [DIST]CLEAN_TARGETS += [dist]clean- CLEAN_TARGETS = clean-gitstats DISTCLEAN_TARGETS = # Default targets for 'make setup' - append your own with SETUP_TARGETS += setup- SETUP_TARGETS = setup-git setup-gitflow setup-submodules setup-subtrees setup-githooks # Default targets for 'make git-clone'. To append your own: # Define GIT_CLONE_TARGETS = ################### Custom Makefile ################### # Local configuration - Kept for compatibity reason LOCAL_MAKEFILE = .Makefile.local # Makefile custom hooks MAKEFILE_BEFORE = .Makefile.before MAKEFILE_AFTER = .Makefile.after ### Main variables .PHONY: all info archive clean help release start_bump_major start_bump_minor start_bump_patch subtree_setup subtree_up subtree_diff upgrade versioninfo doc ############################### Now starting rules ################################ # Load local settings, if existing (to override variable eventually) ifneq (,$(wildcard $(LOCAL_MAKEFILE))) include $(LOCAL_MAKEFILE) endif ifneq (,$(wildcard $(MAKEFILE_BEFORE))) include $(MAKEFILE_BEFORE) endif ### Below default could be set in .Makefile.{local,before} # Default python virtualenv - by default under venv/$(basename ) PYTHON_VENV_DIR ?= venv PYTHON_VENV ?= $(SUPER_DIR) # Default Git clone parameters (url, target path for the working directory) PYENV_GIT_REPO_URL ?= https://github.com/pyenv/pyenv.git PYENV_GIT_REPO ?= $(XDG_DATA_HOME)/pyenv PYENV_VIRTUALENV_GIT_REPO_URL ?= https://github.com/pyenv/pyenv-virtualenv.git PYENV_VIRTUALENV_GIT_REPO ?= $(XDG_DATA_HOME)/pyenv/plugins/pyenv-virtualenv # Required rule : what's to be done each time all: $(TARGETS) # Test values of variables - for debug purposes info: @echo "--- Compilation commands --- " @echo "HAS_GITFLOW -> '$(HAS_GITFLOW)'" @echo "--- Directories --- " @echo "SUPER_DIR -> '$(SUPER_DIR)'" @echo "XDG_CONFIG_HOME -> '$(XDG_CONFIG_HOME)'" @echo "XDG_CACHE_HOME -> '$(XDG_CACHE_HOME)'" @echo "XDG_DATA_HOME -> '$(XDG_DATA_HOME)'" @echo "--- Git stuff ---" @echo "GIT_ROOTDIR -> '$(GIT_ROOTDIR)'" @echo "GITFLOW -> '$(GITFLOW)'" @echo "GITFLOW_BR_MASTER -> '$(GITFLOW_BR_MASTER)'" @echo "GITFLOW_BR_DEVELOP -> '$(GITFLOW_BR_DEVELOP)'" @echo "CURRENT_BRANCH -> '$(CURRENT_BRANCH)'" @echo "GIT_BRANCHES -> '$(GIT_BRANCHES)'" @echo "GIT_REMOTES -> '$(GIT_REMOTES)'" @echo "GIT_DIRTY -> '$(GIT_DIRTY)'" @echo "GIT_SUBTREE_REPOS -> '$(GIT_SUBTREE_REPOS)'" @echo "GIT_BRANCHES_TO_UPDATE -> '$(GIT_BRANCHES_TO_UPDATE)'" @echo "GIT_HOOKSDIR -> '$(GIT_HOOKSDIR)'" @echo "SRC_HOOKSDIR -> '$(SRC_HOOKSDIR)'" @echo "SRC_HOOKSDIR_TO_ROOTDIR-> '$(SRC_HOOKSDIR_TO_ROOTDIR)'" @echo "SRC_PRECOMMIT_HOOK -> '$(SRC_PRECOMMIT_HOOK)'" @echo "--- Python stuff ---" @echo "PYTHON_VENV_DIR -> '${PYTHON_VENV_DIR}'" @echo "PYTHON_VENV -> '${PYTHON_VENV}'" @echo "PYENV_GIT_REPO_URL -> '${PYENV_GIT_REPO_URL}'" @echo "PYENV_GIT_REPO -> '${PYENV_GIT_REPO}'" @echo "PYENV_VIRTUALENV_GIT_REPO_URL -> '${PYENV_VIRTUALENV_GIT_REPO_URL}'" @echo "PYENV_VIRTUALENV_GIT_REPO -> '${PYENV_VIRTUALENV_GIT_REPO}'" @echo "" @echo "Consider running 'make versioninfo' to get info on git versionning variables" ############################### Archiving ################################ archive: clean tar -C ../ -cvzf ../$(SUPER_DIR)-$(VERSION).tar.gz --exclude ".svn" --exclude ".git" --exclude "*~" --exclude ".DS_Store" $(SUPER_DIR)/ ############################### Git Bootstrapping rules ################################ .PHONE: setup setup-git setup-gitflow setup-xdg setup-git-lfs setup: $(SETUP_TARGETS) @if [ -d "$(GIT_ROOTDIR)/$(SRC_HOOKSDIR)" ]; then \ echo "=> setup local git hooks"; \ $(MAKE) setup_git_hooks; \ fi @if [ -f .gitattributes ] && [ -n "$(shell grep '=lfs' .gitattributes)" ]; then \ echo "=> setup git-lfs"; \ $(MAKE) setup-git-lfs; \ fi @if [ -f .envrc ]; then \ $(MAKE) setup-direnv; \ fi setup-git: -git fetch origin -git branch --track $(GITFLOW_BR_MASTER) origin/$(GITFLOW_BR_MASTER) setup-gitflow: git config gitflow.branch.master $(GITFLOW_BR_MASTER) git config gitflow.branch.develop $(GITFLOW_BR_DEVELOP) git config gitflow.prefix.feature feature/ git config gitflow.prefix.release release/ git config gitflow.prefix.hotfix hotfix/ git config gitflow.prefix.support support/ git config gitflow.prefix.versiontag $(TAG_PREFIX) setup-submodules: -$(MAKE) update setup-subtrees: $(if $(GIT_SUBTREE_REPOS), $(MAKE) subtree_setup) setup-githooks: @if [ -d "$(GIT_ROOTDIR)/$(SRC_HOOKSDIR)" ]; then \ echo "=> setup local git hooks"; \ $(MAKE) _setup_git_hooks; \ fi _setup_git_hooks: @if [ -n "$(SRC_PRECOMMIT_HOOK)" ]; then \ if [ -f "$(GIT_ROOTDIR)/$(SRC_PRECOMMIT_HOOK)" ] && [ ! -f "$(GIT_ROOTDIR)/$(GIT_HOOKSDIR)/pre-commit" ]; then \ echo "=> setup Git pre-commit hook"; \ ln -s ../../$(SRC_PRECOMMIT_HOOK) $(GIT_ROOTDIR)/$(GIT_HOOKSDIR)/pre-commit; \ fi ; \ fi ifneq (,$(shell which git-lfs 2>/dev/null)) setup-git-lfs: git-lfs pull else setup-git-lfs: @echo "*** ERROR *** git-lfs extension not found on your system" @echo " install it (see https://git-lfs.github.com/) and run " @echo " make $@" endif setup-xdg: @echo "=> setup XDG Base Directories" mkdir -p $(XDG_CONFIG_HOME) mkdir -p $(XDG_DATA_HOME) mkdir -p $(XDG_CACHE_HOME) define __SHELL_PROFILE_SOURCE_IF_PRESENT # Add the following to your favorite shell config (~/.bashrc or ~/.zshrc etc.) if [ -f "$1" ]; then . $1 fi endef .PHONY: setup-shell-direnv setup-shell-pyenv setup-shell-direnv: $(info $(call __SHELL_PROFILE_SOURCE_IF_PRESENT,$(XDG_CONFIG_HOME)/direnv/init.sh)) setup-shell-pyenv: $(info $(call __SHELL_PROFILE_SOURCE_IF_PRESENT,$(XDG_CONFIG_HOME)/pyenv/init.sh)) # --- Direnv .PHONY: setup-direnv setup-pyenv setup-venv setup-python setup-direnv: setup-xdg @echo "=> setup direnv -- see https://varrette.gforge.uni.lu/tutorials/pyenv.html" mkdir -p $(XDG_CONFIG_HOME)/direnv @if [ ! -f "$(XDG_CONFIG_HOME)/direnv/init.sh" ]; then \ echo " - creating $(XDG_CONFIG_HOME)/direnv/init.sh"; \ curl -o $(XDG_CONFIG_HOME)/direnv/init.sh https://raw.githubusercontent.com/Falkor/dotfiles/master/shell/available/direnv.sh; \ fi @echo " - sample override of direnv-stdlib in $(XDG_CONFIG_HOME)/direnv/direnvrc" @if [ ! -f "$(XDG_CONFIG_HOME)/direnv/direnvrc" ]; then \ curl -o $(XDG_CONFIG_HOME)/direnv/direnvrc https://raw.githubusercontent.com/Falkor/dotfiles/master/direnv/direnvrc; \ fi @echo " - sample '.envrc' for your projects in $(XDG_CONFIG_HOME)/direnv/envrc" @if [ ! -f "$(XDG_CONFIG_HOME)/direnv/envrc" ]; then \ curl -o $(XDG_CONFIG_HOME)/direnv/envrc https://raw.githubusercontent.com/Falkor/dotfiles/master/direnv/envrc; \ fi @$(MAKE) setup-shell-direnv # --- pyenv setup-pyenv: setup-xdg git-clone-pyenv git-clone-pyenv-virtualenv @echo "=> setup pyenv -- see https://varrette.gforge.uni.lu/tutorials/pyenv.html" mkdir -p $(XDG_CONFIG_HOME)/pyenv @if [ ! -f "$(XDG_CONFIG_HOME)/pyenv/init.sh" ]; then \ echo " - creating $(XDG_CONFIG_HOME)/pyenv/init.sh"; \ curl -o $(XDG_CONFIG_HOME)/pyenv/init.sh https://raw.githubusercontent.com/Falkor/dotfiles/master/shell/available/pyenv.sh; \ fi @$(MAKE) setup-shell-pyenv # --- venv setup-venv: python3 -m venv $(PYTHON_VENV_DIR)/$(PYTHON_VENV) # --- python ifneq (,$(wildcard ./$(PIP_REQUIREMENTS_FILE))) setup-python: @echo "=> updating pip version" pip install --upgrade pip @echo "=> installing Python dependencies from Requirements files '$(PIP_REQUIREMENTS_FILE)'" pip install -r $(PIP_REQUIREMENTS_FILE) else setup-python: @echo "=> updating pip version" pip install --upgrade pip endif ### Git clone ####### # Usage: $(eval $(call __GIT_CLONE,,,)) ## define __GIT_CLONE .PHONY: git-clone-$1 git-clone-$1: @if [ ! -d "$2" ]; then \ mkdir -p $(shell dirname $2); \ echo "=> cloning '$3' into $2"; \ git clone $3 $2; \ else \ echo "... existing directory '$2', thus exiting"; \ fi GIT_CLONE_TARGETS += git-clone-$1 endef $(eval $(call __GIT_CLONE,pyenv,$(PYENV_GIT_REPO),$(PYENV_GIT_REPO_URL))) $(eval $(call __GIT_CLONE,pyenv-virtualenv,$(PYENV_VIRTUALENV_GIT_REPO),$(PYENV_VIRTUALENV_GIT_REPO_URL))) fetch: git fetch --all -v versioninfo: @echo "Current version: $(VERSION)" @echo "Last tag: $(LAST_TAG)" @echo "$(shell git rev-list $(LAST_TAG).. --count) commit(s) since last tag" @echo "Build: $(BUILD) (total number of commits)" @echo "next major version: $(NEXT_MAJOR_VERSION)" @echo "next minor version: $(NEXT_MINOR_VERSION)" @echo "next patch version: $(NEXT_PATCH_VERSION)" ### Git flow management ifeq ($(HAS_GITFLOW),) start_bump_patch start_bump_minor start_bump_major release: @echo "Unable to find git-flow on your system. " @echo "See https://github.com/nvie/gitflow for installation details" else define __VERSION_BUMP start_bump_$1: $$(if $$(GIT_DIRTY), $$(error "Unable to bump version: Dirty Git repository")) @echo "Start the '$1' release of the repository from $$(VERSION) to $2" git pull origin git flow release start $2 @sleep 1 @if [ -f VERSION ]; then \ echo $2 > VERSION; \ git commit -s -m "$1 bump to version $2" VERSION; \ fi @if [ -f .bumpversion.cfg ]; then \ echo "=> using 'bumpversion [...] $1'"; \ bumpversion --commit --no-tag $1; \ fi @echo "=> run 'make release' once you finished the bump" endef $(eval $(call __VERSION_BUMP,patch,$(NEXT_PATCH_VERSION))) $(eval $(call __VERSION_BUMP,minor,$(NEXT_MINOR_VERSION))) $(eval $(call __VERSION_BUMP,major,$(NEXT_MAJOR_VERSION))) release: clean @if [ -f .bumpversion.cfg ]; then \ echo "=> release using 'bumpversion [...] release'"; \ bumpversion --commit --no-tag release; \ fi git flow release finish -s $(VERSION:%rc=%) git checkout $(GITFLOW_BR_MASTER) git push origin git checkout $(GITFLOW_BR_DEVELOP) git push origin git push origin --tags endif ### Git (submodule|branch) management: pull and upgrade to the latest version up update: $(if $(GIT_DIRTY), $(error "Unable to pull latest commits: Dirty Git repository")) @for br in $(GIT_BRANCHES_TO_UPDATE); do \ echo -e "\n=> Pulling and updating the local branch '$$br'\n"; \ git checkout $$br; \ git pull origin $$br; \ done git checkout $(CURRENT_BRANCH) @echo "=> updating (NOT upgrading) git submodule" git submodule init git submodule update ### Git submodule upgrade upgrade: update git submodule foreach 'git fetch origin; git checkout $$(git rev-parse --abbrev-ref HEAD); git reset --hard origin/$$(git rev-parse --abbrev-ref HEAD); git submodule update --recursive; git clean -dfx' -@for submoddir in $(shell git submodule status | awk '{ print $$2 }' | xargs echo); do \ git commit -s -m "Upgrading Git submodule '$$submoddir' to the latest version" $$submoddir || true;\ done ### Git subtree management ifeq ($(GIT_SUBTREE_REPOS),) subtree_setup subtree_diff subtree_up: @echo "no repository configured in GIT_SUBTREE_REPOS..." else subtree_setup: @for elem in $(GIT_SUBTREE_REPOS); do \ url=`echo $$elem | cut -d '|' -f 1`; \ repo=`basename $$url .git`; \ if [[ ! "$(GIT_REMOTES)" =~ "$$repo" ]]; then \ echo "=> initializing Git remote '$$repo'"; \ git remote add -f $$repo $$url; \ fi \ done subtree_diff: @for elem in $(GIT_SUBTREE_REPOS); do \ url=`echo $$elem | cut -d '|' -f 1`; \ repo=`basename $$url .git`; \ path=`echo $$repo | tr '-' '/'`; \ br=`echo $$elem | cut -d '|' -f 2`; \ [ "$$br" == "$$url" ] && br='master'; \ echo -e "\n============ diff on subtree '$$path' with remote '$$repo/$$br' ===========\n"; \ git diff $${repo}/$$br $(CURRENT_BRANCH):$$path; \ done subtree_up: $(if $(GIT_DIRTY), $(error "Unable to pull subtree(s): Dirty Git repository")) @for elem in $(GIT_SUBTREE_REPOS); do \ url=`echo $$elem | cut -d '|' -f 1`; \ repo=`basename $$url .git`; \ path=`echo $$repo | tr '-' '/'`; \ br=`echo $$elem | cut -d '|' -f 2`; \ [ "$$br" == "$$url" ] && br='master'; \ echo -e "\n===> pulling changes into subtree '$$path' using remote '$$repo/$$br'"; \ echo -e " \__ fetching remote '$$repo'"; \ git fetch $$repo; \ echo -e " \__ pulling changes"; \ git subtree pull --prefix $$path --squash $${repo} $${br}; \ done endif ### [Dist]Clean option clean: $(CLEAN_TARGETS) distclean: $(DISTCLEAN_TARGETS) clean-gitstats: @if [ -d "$(GITSTATS_DIR)" ]; then \ echo "==> removing '$(GITSTATS_DIR)' directory"; \ rm -rf $(GITSTATS_DIR); \ fi # Perform various git statistics stats: @if [ ! -d $(GITSTATS_DIR) ]; then mkdir -p $(GITSTATS_DIR); fi $(GITSTATS) . $(GITSTATS_DIR)/ doc: @if [ -n "`which mkdocs`" ]; then \ mkdocs serve; \ fi # # force recompilation # force : # @touch $(MAIN_TEX) # @$(MAKE) # print help message help : @echo '+----------------------------------------------------------------------+' @echo '| Available Commands |' @echo '+----------------------------------------------------------------------+' @echo '| make setup: Initiate git-flow for your local copy of the repository|' @echo '| make start_bump_{major,minor,patch}: start a new version release with|' @echo '| git-flow at a given level (major, minor or patch bump) |' @echo '| make release: Finalize the release using git-flow |' @echo '+----------------------------------------------------------------------+' ifneq (,$(wildcard $(MAKEFILE_AFTER))) include $(MAKEFILE_AFTER) endif ================================================ FILE: README.md ================================================ -*- mode: markdown; mode: visual-line; fill-column: 80 -*- [![Licence](https://img.shields.io/badge/license-GPL--3.0-blue.svg)](http://www.gnu.org/licenses/gpl-3.0.html) ![By Falkor](https://img.shields.io/badge/by-Falkor-blue.svg) [![Build Status](https://travis-ci.org/Falkor/dotfiles.svg?branch=master)](https://travis-ci.org/Falkor/dotfiles) [![github](https://img.shields.io/badge/git-github-lightgray.svg)](https://github.com/Falkor/dotfiles) [![Falkor/dotfiles issues](https://img.shields.io/github/issues/Falkor/dotfiles.svg)](https://github.com/Falkor/dotfiles/issues) ![](https://img.shields.io/github/stars/Falkor/dotfiles.svg) [![Documentation Status](https://readthedocs.org/projects/falkor-dotfiles/badge/?version=latest)](https://readthedocs.org/projects/falkor-dotfiles/?badge=latest) ______ _ _ _ _____ _ __ _ _ | ____| | | | ( ) | __ \ | | / _(_) | | |__ __ _| | | _____ _ __/ ___ | | | | ___ | |_| |_ _| | ___ ___ | __/ _` | | |/ / _ \| '__|/ __| | | | |/ _ \| __| _| | |/ _ \ __| | | | (_| | | < (_) | | \__ \ | |__| | (_) | |_| | | | | __\__ \ |_| \__,_|_|_|\_\___/|_| |___/ |_____/ \___/ \__|_| |_|_|\___|___/ Copyright (c) 2011-2025 Sebastien Varrette aka Falkor # Sebastien Varrette aka Falkor's dotfiles These are my configuration files for `bash`, `zsh`, `git`, `vim` etc. so as to set up a system the way I like it. For instance, here is a screenshot of my terminal illustrating its behaviour on classical contexts commonly met on a daily usage of interactions with git repositories etc. ![](https://raw.githubusercontent.com/Falkor/dotfiles/master/screenshots/screenshot_falkor_iterm.png) __Warning:__ Use these dotfiles at your own risk! In the sequel, when providing a command, `$>` denotes a prompt and is not part of the commands. ## Pre-requisites You should install the following elements to use the full functionality of these config files: * bash * bash-completions * zsh * zsh-completions * screen * git * subversion * vim * screen On __Mac OS__, assuming you have installed [HomeBrew](http://brew.sh/) (you really should), you can use `brew/Brewfile.minimal` to install these dependencies as follows: ~~~bash # Install brew bundle -- see https://github.com/Homebrew/homebrew-bundle $> brew tap Homebrew/bundle # Collect the Brewfile $> curl -o /tmp/Brewfile https://raw.githubusercontent.com/Falkor/dotfiles/master/brew/Brewfile.minimal # Install Falkor's dotfile dependencies $> brew bundle --file=/tmp/Brewfile -v ~~~ On __Linux__: ~~~bash # Debian / Ubuntu $> sudo apt-get install git git-flow bash-completion screen curl subversion zsh fonts-font-awesome ~~~ ## Falkor's dotfiles Installation ### All-in-one git-free install Using `curl` (adapt the `--all` option to whatever you prefer -- see below table): ``` bash $> curl -fsSL https://raw.githubusercontent.com/Falkor/dotfiles/master/install.sh | bash -s -- --all ``` ### Using Git and the embedded Makefile This repository is hosted on [Github](https://github.com/Falkor/dotfiles). You can clone the repository wherever you want. Personally, I like to keep it in `~/git/github.com/Falkor/dotfiles`, with `~/.dotfiles.falkor.d` as a symlink. This behaviour will be reflected in the `install.sh` script _i.e._ if it is invoked from a directory that differs from `~/.dotfiles.falkor.d`, a symlink will be created toward the place where your cloned this repository. Otherwise, to clone this repository directly into `~/.dotfiles.falkor.d/`, proceed as follows $> git clone https://github.com/Falkor/dotfiles.git ~/.dotfiles.falkor.d **`/!\ IMPORTANT`**: Once cloned, initiate your local copy of the repository by running: $> cd ~/.dotfiles.falkor.d $> make setup This will initiate the [Git submodules of this repository](.gitmodules) and setup the [git flow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) layout for this repository. Now to install all my dotfiles, run: ~~~bash $> make install ~~~ ### Using Git and the embedded `install.sh` script The above `make install` command actually runs (see `.Makefile.after`): ~~~bash $> ./install.sh --all # Equivalent of 'make install' ~~~ Note that __by default__ (_i.e._ without option), the `install.sh` script does nothing __except__ cloning the Falkor/dotfiles directory if it does not yet exists (in `~/.dotfiles.falkor.d` by default). * if you __do not want to install everything__ but only a subpart, kindly refer to the below table to find the proper command-line argument to use. Ex: ```bash $> ./install.sh --zsh --vim --git ``` * if you want to install everything in a row, use as suggested above the `--all` option ## Updating / Upgrading Upgrading is normally as simple as: $> make -C ~/.config/dotfiles.falkor.d update OR, if you prefer a more atomic approach: $> cd ~/.config/dotfiles.falkor.d $> make update Note that if you wish to __upgrade__ the [Git submodules](.gitmodules) to the latest version, you should run: $> make upgrade ## Uninstalling / Removing Falkor's dotfile You can use `install.sh --delete` to remove Falkor's dotfiles. __`/!\ IMPORTANT`__: pay attention to use the options matching you installation package. * if you install __all__ dotfiles, run: ```bash $> ./install.sh --delete --all # OR make uninstall ``` * if you install __only__ a subpart of the dotfiles, adapt the command line option. Ex: ```bash $> ./install.sh --delete --zsh --vim --git ``` ## What's included and how to customize? | Tools | Type | Installation | Documentation | |--------------------------------------------------------------------------------|-----------------------|-------------------------|----------------------------------------------| | [Bourne-Again shell (bash)](http://tiswww.case.edu/php/chet/bash/bashtop.html) | shell | `./install.sh --bash` | [`bash/README.md`](bash/README.md) | | [zsh](http://www.zsh.org/) / [Oh-my-zsh](http://ohmyz.sh/) | shell | `./install.sh --zsh` | [`oh-my-zsh/README.md`](oh-my-zsh/README.md) | | [VI iMproved (vim)](http://www.vim.org/) | editor | `./install.sh --vim` | [`vim/README.md`](vim/README.md) | | [GNU Emacs](https://www.gnu.org/software/emacs/) | editor | `./install.sh --emacs` | `emacs/README.md` | | [Git `--fast-version-control`](https://git-scm.com/) | VCS | `./install.sh --git` | [`git/README.md`](git/README.md) | | [GNU screen](https://www.gnu.org/software/screen/) | terminal multiplexers | `./install.sh --screen` | [`screen/README.md`](screen/README.md) | | | | | | As mentioned above, if you want to install all dotfiles in one shot, just use $> ./install.sh --all # OR 'make install' ## Issues / Feature request You can submit bug / issues / feature request using the [`Falkor/dotfiles` Project Tracker](https://github.com/Falkor/dotfiles/issues) ## Developments / Contributing to the code If you want to contribute to the code, you shall be aware of the way this repository is organized and developed. These elements are detailed on `docs/contributing/` ## Licence This project is released under the terms of the [GPL-3.0](LICENCE) licence. [![Licence](https://www.gnu.org/graphics/gplv3-88x31.png)](http://www.gnu.org/licenses/gpl-3.0.html) ## Resources You can find of course many other resources in terms dotfiles repositories. I suggest you to take a look at the following places I inspired: * [Your unofficial guide to dotfiles on GitHub](https://dotfiles.github.io/) * My friend [H.Cartiaux's dotfiles](https://github.com/hcartiaux/dotfiles) * [Holman's does dotfiles](https://github.com/holman/dotfiles), for his idea of bundling the [homebrew](http://brew.sh) configuration * [Mathias’s dotfiles](https://github.com/mathiasbynens/dotfiles), for featuring `~/.osx` _i.e._ sensible hacker defaults for OS X; * [Awesome dotfiles](https://github.com/webpro/awesome-dotfiles), a curated list of dotfiles resources. Inspired by the [awesome](https://github.com/sindresorhus/awesome) list thing. * [Carlo's dotfiles](https://github.com/caarlos0/dotfiles) ================================================ FILE: VERSION ================================================ 1.4.0-b458 ================================================ FILE: Vagrantfile ================================================ # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # (nearly) All below boxes were generated using [vagrant-vms](https://github.com/Falkor/vagrant-vms/) { :centos => 'centos/7', :debian => 'debian/contrib-jessie64', :ubuntu => 'ubuntu/trusty64' }.each do |os,name| boxname = os.to_s.downcase.gsub(/_/, '-') # Only the Ubuntu box is booted by default config.vm.define boxname, :autostart => (os =~ /ubuntu/), :primary => (os =~ /ubuntu/) do |local| local.vm.box = name local.vm.host_name = ENV['VAGRANT_HOSTNAME'] || boxname.concat(".vagrant.com") end end end ================================================ FILE: atom/README.md ================================================ Generate the package list using: apm list --installed --bare > package-list.txt Import it with apm install --packages-file ./package-list.txt ================================================ FILE: atom/package-list.txt ================================================ atomic-emacs@0.9.2 auto-indent@0.5.0 autocomplete-clang@0.10.0 build@0.67.0 build-cmake@0.8.3 build-tools@4.5.7 busy@0.7.0 clock@1.9.0 emacs-flow@0.1.2 git-plus@7.2.0 language-cmake@0.3.0 language-latex@1.0.0 language-lisp@0.2.0 latex@0.42.2 linter-clang@3.4.6 markdown-scroll-sync@2.1.2 open-recent@5.0.0 pdf-view@0.54.0 tree-view-git-status@1.3.0 ================================================ FILE: bash/.bash_profile ================================================ # -*- mode:sh; -*- # # ~/.bash_profile # [[ -f ~/.bashrc ]] && . ~/.bashrc || true [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* ================================================ FILE: bash/.bashrc ================================================ #! /bin/bash ################################################################################ # .bashrc -- my personal Bourne-Again shell (aka bash) configuration # see https://github.com/Falkor/dotfiles # # Copyright (c) 2010-2017 Sebastien Varrette # https://varrette.gforge.uni.lu # _ _ # | |__ __ _ ___| |__ _ __ ___ # | '_ \ / _` / __| '_ \| '__/ __| # _ | |_) | (_| \__ \ | | | | | (__ # (_) |_.__/ \__,_|___/_| |_|_| \___| # ################################################################################ # This file is NOT part of GNU bash # # 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 . ################################################################################ # Resources: # - http://bitbucket.org/dmpayton/dotfiles/src/tip/.bashrc # - https://github.com/rtomayko/dotfiles/blob/rtomayko/.bashrc # If not running interactively, don't do anything case $- in *i*) ;; *) return;; esac # Basic variables : ${HOME=~} : ${LOGNAME=$(id -un)} : ${UNAME=$(uname)} # See https://specifications.freedesktop.org/basedir-spec/latest/ : ${XDG_CONFIG_HOME=$HOME/.config} : ${XDG_DATA_HOME=$HOME/.local/share} : ${XDG_CACHE_HOME=$HOME/.cache} export XDG_CONFIG_HOME XDG_DATA_HOME XDG_CACHE_HOME # complete hostnames from this file : ${HOSTFILE=~/.ssh/known_hosts} # readline config : ${INPUTRC=~/.inputrc} # Get rid of mail notification unset MAILCHECK # Local configuration BASH_CUSTOM_CONFIG_DIR=$XDG_CONFIG_HOME/bash/custom COMMON_CONFIG_DIR=$XDG_CONFIG_HOME/shell COMMON_CUSTOM_CONFIG_DIR=$COMMON_CONFIG_DIR/custom # ---------------------------------------------------------------------- # SHELL OPTIONS # ---------------------------------------------------------------------- # bring in system bashrc test -r /etc/bashrc && . /etc/bashrc # shell opts. see bash(1) for details shopt -s cdspell >/dev/null 2>&1 # correct minor errors in the spelling # of a directory in a cd command shopt -s extglob >/dev/null 2>&1 # extended pattern matching shopt -s hostcomplete >/dev/null 2>&1 # perform hostname completion # on '@' #shopt -s no_empty_cmd_completion >/dev/null 2>&1 shopt -u mailwarn >/dev/null 2>&1 # default umask umask 0022 # ---------------------------------------------------------------------- # LS WITH COLORS # ---------------------------------------------------------------------- #for *BSD/darwin export CLICOLOR=1 # we always pass these to ls(1) LS_COMMON="-hB" ls --color=auto &> /dev/null && LS_COMMON="${LS_COMMON} --color=auto" || true alias ls="command ls ${LS_COMMON}" # ---------------------------------------------------------------------- # ALIASES # ---------------------------------------------------------------------- # these use the ls aliases above alias ll="ls -l" alias la="ll -a" alias l.="ls -d .*" # Mandatory aliases to confirm destructive operations alias cp='cp -iv' alias mv='mv -iv' alias rm='rm -i' alias ..='cd ..' # Color aliases alias grep='grep --color=auto' #alias fgrep='fgrep --color=auto' #alias egrep='egrep --color=auto' # ---------------------------------------------------------------------- # ENVIRONMENT CONFIGURATION # ---------------------------------------------------------------------- # detect interactive shell case "$-" in *i*) INTERACTIVE=yes ;; *) unset INTERACTIVE ;; esac # detect login shell case "$0" in -*) LOGIN=yes ;; *) unset LOGIN ;; esac # enable en_US locale w/ UTF-8 encodings if not already configured : ${LANG:="en_US.UTF-8"} : ${LANGUAGE:="en"} : ${LC_ALL:="en_US.UTF-8"} export LANG LANGUAGE LC_ALL # ---------------------------------------------------------------------- # PATH # ---------------------------------------------------------------------- pathadd() { if [ -d "$1" ] && ! echo $PATH | grep -E -q "(^|:)$1($|:)" ; then [ "$2" = "after" ] && PATH="$PATH:${1%/}" || PATH="${1%/}:$PATH" fi } pathrm() { PATH="$(echo $PATH | sed -e "s;\(^\|:\)${1%/}\(:\|\$\);\1\2;g" -e 's;^:\|:$;;g' -e 's;::;:;g')" } # Complete default PATH eventually for bindir in /usr/local/bin $HOME/bin; do pathadd ${bindir} done pathadd $HOME/.rvm/bin after manpathadd() { if [ -d "$1" ] && ! echo $MANPATH | grep -E -q "(^|:)$1($|:)" ; then [ "$2" = "after" ] && MANPATH="$MANPATH:${1%/}" || MANPATH="${1%/}:$MANPATH" fi } # Complete default MANPATH eventually # for mandir in /usr/local/share/man $HOME/share/man; do # manpathadd ${mandir} # done PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib # ---------------------------------------------------------------------- # MACOS X / DARWIN SPECIFIC # ---------------------------------------------------------------------- # if [ "${UNAME}" = "Darwin" ]; then # test -x "/usr/libexec/java_home" && # export JAVE_HOME=$(/usr/libexec/java_home) # fi # ---------------------------------------------------------------------- # PAGER / EDITOR # ---------------------------------------------------------------------- # Default editor test -n "$(command -v vim)" && EDITOR=vim || EDITOR=nano export EDITOR # Default pager ('less' is so much better than 'more'...) if test -n "$(command -v less)" ; then #PAGER="less -FirSwX" PAGER="less" MANPAGER="$PAGER" else PAGER=more MANPAGER="$PAGER" fi export PAGER MANPAGER # ---------------------------------------------------------------------- # BASH COMPLETION # ---------------------------------------------------------------------- # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). if ! shopt -oq posix; then test -n "$(command -v brew)" && BREW_BASH_COMPLETION="$(brew --prefix)/etc/bash_completion" || BREW_BASH_COMPLETION="" for f in /usr/share/bash-completion/bash_completion \ /etc/bash_completion ${BREW_BASH_COMPLETION} \ /opt/local/etc/bash_completion do if [ -r "$f" ]; then . $f break fi done fi # ---------------------------------------------------------------------- # OAR Batch scheduler # ---------------------------------------------------------------------- # Resources: # - http://wiki-oar.imag.fr/index.php/Customization_tips # - http://wiki-oar.imag.fr/index.php/Oarsh_and_bash_completion # oarsh completion function _oarsh_complete_() { local word=${COMP_WORDS[COMP_CWORD]} local list list=$(uniq "$OAR_NODEFILE" | tr '\n' ' ') COMPREPLY=($(compgen -W "$list" -- "${word}")) } complete -F _oarsh_complete_ oarsh # Job + Remaining time __oar_ps1_remaining_time(){ if [ -n "$OAR_JOB_WALLTIME_SECONDS" -a -n "$OAR_NODE_FILE" -a -r "$OAR_NODE_FILE" ]; then DATE_NOW=$(date +%s) DATE_JOB_START=$(stat -c %Y "$OAR_NODE_FILE") DATE_TMP=$OAR_JOB_WALLTIME_SECONDS ((DATE_TMP = (DATE_TMP - DATE_NOW + DATE_JOB_START) / 60)) echo -n "[OAR$OAR_JOB_ID->$DATE_TMP]" fi } # OAR motd test -n "$INTERACTIVE" && test -n "$OAR_NODE_FILE" && ( echo "[OAR] OAR_JOB_ID=$OAR_JOB_ID" echo "[OAR] Your nodes are:" sort "$OAR_NODE_FILE" | uniq -c | awk '{printf(" %s*%d\n",$2,$1)}END{printf("\n")}' | sed -e 's/,$//' ) # ---------------------------------------------------------------------- # BASH HISTORY # ---------------------------------------------------------------------- # Increase the history size HISTSIZE=10000 HISTFILESIZE=20000 # Add date and time to the history HISTTIMEFORMAT="[%d/%m/%Y %H:%M:%S] " # ---------------------------------------------------------------------- # VERSION CONTROL SYSTEM - CVS, SVN and GIT # ---------------------------------------------------------------------- # === CVS === export CVS_RSH='ssh' # === SVN === export SVN_EDITOR=$EDITOR # Some code from https://github.com/nojhan/liquidprompt _LP_OPEN_ESC="\[" _LP_CLOSE_ESC="\]" ti_sgr0="$( { tput sgr0 || tput me ; } 2>/dev/null )" LP_COLOR_UP=${LP_COLOR_UP:-$GREEN} LP_COLOR_CHANGES=${LP_COLOR_CHANGES:-$RED} LP_COLOR_DIFF=${LP_COLOR_DIFF:-$PURPLE} NO_COL="${_LP_OPEN_ESC}${ti_sgr0}${_LP_CLOSE_ESC}" # Escape the given strings # Must be used for all strings injected in PS1 that may comes from remote sources, # like $PWD, VCS branch names... _lp_escape() { echo -nE "${1//\\/\\\\}" } # Get the branch name of the current directory # For the first level of the repository, gives the repository name _lp_svn_branch() { local root= local url= eval "$(LANG=C LC_ALL=C svn info 2>/dev/null | sed -n 's/^URL: \(.*\)/url="\1"/p;s/^Repository Root: \(.*\)/root="\1"/p' )" [[ -z "${root-}" ]] && return # Make url relative to root url="${url:${#root}}" if [[ "$url" == */trunk* ]]; then echo -n trunk elif [[ "$url" == */branches/?* ]]; then url="${url##*/branches/}" _lp_escape "${url%/*}" elif [[ "$url" == */tags/?* ]]; then url="${url##*/tags/}" _lp_escape "${url%/*}" else _lp_escape "${root##*/}" fi } # Set a color depending on the branch state: # - green if the repository is clean # (use $LP_SVN_STATUS_OPTIONS to define what that means with # the --depth option of 'svn status') # - red if there is changes to commit # Note that, due to subversion way of managing changes, # informations are only displayed for the CURRENT directory. _lp_svn_branch_color() { (( LP_ENABLE_SVN )) || return local branch branch="$(_lp_svn_branch)" if [[ -n "$branch" ]]; then local changes changes=$(( $(svn status | \grep -c -v "?") )) if (( changes == 0 )); then echo -nE "${LP_COLOR_UP}${branch}${NO_COL}" else echo -nE "${LP_COLOR_CHANGES}${branch}${NO_COL}(${LP_COLOR_DIFF}$changes${NO_COL})" # changes to commit fi fi } ## display the current subversion revision (to be used later in the prompt) __svn_ps1() { ( local svnversion svnversion=$(svnversion | sed -e "s/[:M]//g") # Continue if $svnversion is numerical let $svnversion if [[ "$?" -eq "0" ]] then printf " (%s:%s)" "$(_lp_svn_branch_color)" "$(svnversion)" fi ) 2>/dev/null } # === GIT === # render __git_ps1 even better so as to show activity in a git repository # # see https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh for # configuration info of the GIT_PS1* variables # export GIT_PS1_SHOWDIRTYSTATE=true export GIT_PS1_SHOWSTASHSTATE=true export GIT_PS1_SHOWUNTRACKEDFILES=true #export GIT_PS1_SHOWUPSTREAM="auto" export GIT_PS1_DESCRIBE_STYLE='branch' #export GIT_PS1_SHOWCOLORHINTS=true function_exists() { declare -f -F $1 > /dev/null return $? } # GIT bash completion and access to __git_ps1 is set in if ! type __git_ps1 &>/dev/null then # Try to load separately the file git-prompt for f in \ /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh \ /etc/bash-completion.d/git-prompt \ /usr/share/git/completion/git-prompt.sh \ /usr/lib/git-core/git-sh-prompt do if [ -r "$f" ]; then . $f break fi done fi # ---------------------------------------------------------------------- # PROMPT # ---------------------------------------------------------------------- # Previous version: #PS1='\[\e[36;1m\][\t]\[\e[0m\]:$?: \u@\[\e[4;36m\]\h\[\e[0m\] \[\e[34;1m\]\W\[\e[0m\]\[\e[0;32m\]$(__git_ps1 "(%s)")$(__svn_ps1)\[\e[0m\]> ' # Define some colors to use in the prompt RESET_COLOR="\[\e[0m\]" BOLD_COLOR="\[\e[1m\]" # B&W WHITE="\[\e[0;37m\]" GRAY="\[\e[1;30m\]" BLACK="\[\e[0;30m\]" # RGB RED="\[\e[0;31m\]" GREEN="\[\e[0;32m\]" BLUE="\[\e[34;1m\]" # other YELLOW="\[\e[0;33m\]" LIGHT_CYAN="\[\e[36;1m\]" CYAN_UNDERLINE="\[\e[4;36m\]" # Configure user color and prompt type depending on whoami if [ "$LOGNAME" = "root" ]; then COLOR_USER="${RED}" P="#" else COLOR_USER="${WHITE}" P="" fi # Configure a set of useful variables for the prompt if [[ "$(echo $UNAME | grep -c -i -e '^.*bsd$')" == "1" ]] ; then DOMAIN=$(hostname | cut -d '.' -f 2) else DOMAIN=$(hostname -f | cut -d '.' -f 2) fi # get virtualization information XENTYPE="" if [ -f "/sys/hypervisor/uuid" ]; then if [ "$( # `--------' ^ `------' `------' `--------'`--------------' # cyan | root:red cyan light green # | underline blue (absent if not relevant) # exit code of # the previous command # # The git/svn status part is quite interesting: if you are in a directory under # version control, you have the following information in the prompt: # - under GIT: current branch name, followed by a '*' if the repository has # uncommitted changes, followed by a '+' if some elements were # 'git add'ed but not commited. # - under SVN: show (svn:XX[M]) where XX is the current revision number, # followed by 'M' if the repository has uncommitted changes # # `domain` reflect the current domain of the machine that run the prompt # (guessed from hostname -f) # `xentype` is DOM0 or domU depending if the machine is a Xen dom0 or domU # Finally, is the environment variable PS1_EXTRA is set (or passed to the # kernel), then its content is displayed here. # # This prompt is perfect for terminal with black background, in my case the # Vizor color set (see http://visor.binaryage.com/) or iTerm2 __set_my_prompt() { PS1="$(__colorized_exit_status) ${LIGHT_CYAN}[\t]${RESET_COLOR} ${COLOR_USER}\u${RESET_COLOR}@${CYAN_UNDERLINE}\h${RESET_COLOR}(${PS1_EXTRAINFO}) ${BLUE}\W${RESET_COLOR}${GREEN}\$(__git_ps1 \" (%s)\")\$(__svn_ps1)${RESET_COLOR}${P}> " } # TODO: define the same for white background. # -------------------------------------------------------------------- # SSH/GPG AGENT # -------------------------------------------------------------------- # # ssh-agent initialization - using keychain # #if [ ! -e "$SSH_AUTH_SOCK" ]; then # # eval `ssh-agent` 1>/dev/null; # #keychain --clear --noask ~/.ssh/id_dsa # #. ~/.keychain/${HOSTNAME}-sh # # gpg-agent initialization # #if [ ! -e "$GPG_AGENT_INFO" ]; then # # eval `gpg-agent --daemon > $HOME/.gpg-agent-info`; # # source $HOME/.gpg-agent-info; # #fi ###### # Remove duplicate entries from a PATH style value while retaining # the original order. Use PATH if no is given. # Usage: puniq [] # # Example: # $ puniq /usr/bin:/usr/local/bin:/usr/bin # /usr/bin:/usr/local/bin ### puniq () { echo "$1" |tr : '\n' |nl |sort -u -k 2,2 |sort -n | cut -f 2- |tr '\n' : |sed -e 's/:$//' -e 's/^://' } # ------------------------------------------------------------------- # USER SHELL ENVIRONMENT # ------------------------------------------------------------------- # Set the color prompt by default when interactive if [ -n "$PS1" ]; then __set_my_prompt fi export PS1 # MOTD test -n "$INTERACTIVE" -a -n "$LOGIN" && { uname -npsr uptime } # Customizations for f in \ ~/.bash_aliases \ ~/.bash_private do if [ -r "$f" ]; then . $f fi done #______________________________________________ # Load Eventually [custom] local configs either # - common to all shells (from ~/.config/shell/[custom/]*.sh typically) # - specific to bash (from ~/.config/bash/custom/*.sh typically) for d in \ ${COMMON_CONFIG_DIR} \ ${COMMON_CUSTOM_CONFIG_DIR} \ ${BASH_CUSTOM_CONFIG_DIR} do if [ -d "${d}" ]; then for f in ${d}/*.sh; do [[ -r "$f" ]] && source $f done for f in ${d}/*.bash; do [[ -r "$f" ]] && source $f done fi done # Add RVM to PATH for scripting. Make sure this is the last PATH variable change. if [ -d "$HOME/.rvm" ]; then export PATH="$PATH:$HOME/.rvm/bin" [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" [[ -r "${rvm_path}/scripts/completion" ]] && . ${rvm_path}/scripts/completion fi #______________________ # condense PATH entries PATH="$(puniq "$PATH")" MANPATH="$(puniq "$MANPATH")" PKG_CONFIG_PATH="$(puniq "$PKG_CONFIG_PATH")" LD_LIBRARY_PATH="$(puniq "$LD_LIBRARY_PATH")" export PATH MANPATH PKG_CONFIG_PATH LD_LIBRARY_PATH # I hate this ring #set bell-style visible ================================================ FILE: bash/.inputrc ================================================ # -*- mode:sh; -*- ################################################################################ # .inputrc -- my personal Readline configuration # see https://github.com/Falkor/dotfiles # # Copyright (c) 2010 Sebastien Varrette # http://varrette.gforge.uni.lu # _ _ # (_)_ __ _ __ _ _| |_ _ __ ___ # | | '_ \| '_ \| | | | __| '__/ __| # _| | | | | |_) | |_| | |_| | | (__ # (_)_|_| |_| .__/ \__,_|\__|_| \___| # |_| ################################################################################ # Resource # - https://github.com/rtomayko/dotfiles/blob/rtomayko/.inputrc # do not bell on tab-completion set bell-style bell # set expand-tilde off # set input-meta off # set convert-meta on # set output-meta off # set horizontal-scroll-mode off # set history-preserve-point on # set mark-directories on # set mark-symlinked-directories on # set match-hidden-files off # # completion settings # set page-completions off # set completion-query-items 2000 # set completion-ignore-case off # set show-all-if-ambiguous on # set show-all-if-unmodified on # set completion-prefix-display-length 10 # set print-completions-horizontally off # mappings for Ctrl-up-arrow and Ctrl-down-arrow for word moving ## arrow up #"\e[A":forward-word ## arrow down #"\e[B":backward-word # mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving #"\e[1;5C": forward-word #"\e[1;5D": backward-word #"\e[5C": forward-word #"\e[5D": backward-word #"\e\e[C": forward-word #"\e\e[D": backward-word ================================================ FILE: bash/README.md ================================================ # DEPRECATED!!! Falkor's Dotfiles -- Bourne-Again Shell (bash) configuration **IMPORTANT**: consider these configurations as deprecated and obsolete. You should better switch to [oh-my-bash](https://github.com/ohmybash/oh-my-bash) as instructed [here](https://gitlab.com/svarrette-anssi/tutorial-git/-/blob/main/docs/TP/config.md?ref_type=heads#bash-oh-my-bash) > [Oh-My-Bash](https://ohmybash.github.io/) is an open source, community-driven framework for managing your [BASH](https://www.gnu.org/software/bash/) configuration. It comes bundled with a ton of helpful functions, helpers, plugins, themes, and a few things that make you shout..." See the available [themes](https://github.com/ohmybash/oh-my-bash/blob/master/themes/THEMES.md) to find your prefered one. Below instuctions will setup the minimalist [`purity` theme](https://github.com/ohmybash/oh-my-bash/blob/master/themes/THEMES.md#purity) ```bash # Preliminaries: install fonts and dependencies sudo apt install curl fontconfig fonts-powerline fonts-font-awesome # Install oh-my-bash: download installer, check it and run it curl -fsSL --skip-existing -o /tmp/oh-my-bash-installer.sh \ https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh less /tmp/oh-my-bash-installer.sh # review installer bash /tmp/oh-my-bash-installer.sh # run it # adapting theme sed -i 's/OSH_THEME=\"font\"/OSH_THEME=\"purity\"/' ~/.bashrc # Enjoy ! source ~/.bashrc # cleanup rm /tmp/oh-my-bash-installer.sh ``` ## Old README content ## Screenshot ![](https://raw.githubusercontent.com/Falkor/dotfiles/master/screenshots/screenshot_falkor_bash.png) ## Installation You can use the `install.sh` script featured with the [Falkor's dotfile](https://github.com/Falkor/dotfile) repository. ``` bash cd ~/.dotfiles.falkor.d ./install.sh --bash ``` This will setup the following files: * `~/.bashrc` * `~/.inputrc` * `~/.bash_profile` * `~/.bash_aliases` ## Uninstall ``` bash cd ~/.dotfiles.falkor.d ./install.sh --delete --bash ``` ## Customizations Use the `~/.bash_private` as a place holder for your own customization. This file is loaded by the `.bashrc` file. ================================================ FILE: bash/custom/.gitignore ================================================ *.sh ================================================ FILE: bash/custom/README.md ================================================ Place here all your local (custom) settings as `*.sh` files. They are sourced by Falkor's bashrc ================================================ FILE: bash/preexec.bash ================================================ #!/bin/bash # preexec.bash -- Bash support for ZSH-like 'preexec' and 'precmd' functions. # The 'preexec' function is executed before each interactive command is # executed, with the interactive command as its argument. The 'precmd' # function is executed before each prompt is displayed. # To use, in order: # 1. source this file # 2. define 'preexec' and/or 'precmd' functions (AFTER sourcing this file), # 3. as near as possible to the end of your shell setup, run 'preexec_install' # to kick everything off. # Note: this module requires 2 bash features which you must not otherwise be # using: the "DEBUG" trap, and the "PROMPT_COMMAND" variable. preexec_install # will override these and if you override one or the other this _will_ break. # This is known to support bash3, as well as *mostly* support bash2.05b. It # has been tested with the default shells on MacOS X 10.4 "Tiger", Ubuntu 5.10 # "Breezy Badger", Ubuntu 6.06 "Dapper Drake", and Ubuntu 6.10 "Edgy Eft". # Copy screen-run variables from the remote host, if they're available. if [[ "$SCREEN_RUN_HOST" == "" ]] then SCREEN_RUN_HOST="$LC_SCREEN_RUN_HOST" SCREEN_RUN_USER="$LC_SCREEN_RUN_USER" fi # This variable describes whether we are currently in "interactive mode"; # i.e. whether this shell has just executed a prompt and is waiting for user # input. It documents whether the current command invoked by the trace hook is # run interactively by the user; it's set immediately after the prompt hook, # and unset as soon as the trace hook is run. preexec_interactive_mode="" # Default do-nothing implementation of preexec. function preexec () { true } # Default do-nothing implementation of precmd. function precmd () { true } # This function is installed as the PROMPT_COMMAND; it is invoked before each # interactive prompt display. It sets a variable to indicate that the prompt # was just displayed, to allow the DEBUG trap, below, to know that the next # command is likely interactive. function preexec_invoke_cmd () { precmd preexec_interactive_mode="yes" } # This function is installed as the DEBUG trap. It is invoked before each # interactive prompt display. Its purpose is to inspect the current # environment to attempt to detect if the current command is being invoked # interactively, and invoke 'preexec' if so. function preexec_invoke_exec () { if [[ -n "$COMP_LINE" ]] then # We're in the middle of a completer. This obviously can't be # an interactively issued command. return fi if [[ -z "$preexec_interactive_mode" ]] then # We're doing something related to displaying the prompt. Let the # prompt set the title instead of me. return else # If we're in a subshell, then the prompt won't be re-displayed to put # us back into interactive mode, so let's not set the variable back. # In other words, if you have a subshell like # (sleep 1; sleep 2) # You want to see the 'sleep 2' as a set_command_title as well. if [[ 0 -eq "$BASH_SUBSHELL" ]] then preexec_interactive_mode="" fi fi if [[ "preexec_invoke_cmd" == "$BASH_COMMAND" ]] then # Sadly, there's no cleaner way to detect two prompts being displayed # one after another. This makes it important that PROMPT_COMMAND # remain set _exactly_ as below in preexec_install. Let's switch back # out of interactive mode and not trace any of the commands run in # precmd. # Given their buggy interaction between BASH_COMMAND and debug traps, # versions of bash prior to 3.1 can't detect this at all. preexec_interactive_mode="" return fi # In more recent versions of bash, this could be set via the "BASH_COMMAND" # variable, but using history here is better in some ways: for example, "ps # auxf | less" will show up with both sides of the pipe if we use history, # but only as "ps auxf" if not. local this_command=`history 1 | sed -e "s/^[ ]*[0-9]*[ ]*//g"`; # If none of the previous checks have earlied out of this function, then # the command is in fact interactive and we should invoke the user's # preexec hook with the running command as an argument. preexec "$this_command" } # Execute this to set up preexec and precmd execution. function preexec_install () { # *BOTH* of these options need to be set for the DEBUG trap to be invoked # in ( ) subshells. This smells like a bug in bash to me. The null stderr # redirections are to quiet errors on bash2.05 (i.e. OSX's default shell) # where the options can't be set, and it's impossible to inherit the trap # into subshells. set -o functrace > /dev/null 2>&1 shopt -s extdebug > /dev/null 2>&1 # Finally, install the actual traps. PROMPT_COMMAND="${PROMPT_COMMAND};preexec_invoke_cmd" trap 'preexec_invoke_exec' DEBUG } # Since this is the reason that 99% of everybody is going to bother with a # pre-exec hook anyway, we'll include it in this module. # Change the title of the xterm. function preexec_xterm_title () { local title="$1" echo -ne "\033]0;$title\007" > /dev/stderr } function preexec_screen_title () { local title="$1" echo -ne "\033k$1\033\\" > /dev/stderr } # Abbreviate the "user@host" string as much as possible to preserve space in # screen titles. Elide the host if the host is the same, elide the user if the # user is the same. function preexec_screen_user_at_host () { local RESULT="" if [[ "$SCREEN_RUN_HOST" == "$SCREEN_HOST" ]] then return else if [[ "$SCREEN_RUN_USER" == "$USER" ]] then echo -n "@${SCREEN_HOST}" else echo -n "${USER}@${SCREEN_HOST}" fi fi } function preexec_xterm_title_install () { # These functions are defined here because they only make sense with the # preexec_install below. function precmd () { preexec_xterm_title "${TERM} - ${USER}@${SCREEN_HOST} `dirs -0` $PROMPTCHAR" if [[ "${TERM}" == screen ]] then preexec_screen_title "`preexec_screen_user_at_host`${PROMPTCHAR}" fi } function preexec () { # xterm seems to treat backslashes funny; they terminate the escape # sequence or something. I'm not sure why, but if we don't escape them # by doubling them (like so) then running an interactive command with a # backslash in it will result in a messed-up terminal and half a # terminal title echoed onto the command line. thiscmd="$(echo "$1" | sed -e 's/\\/\\\\/g' | head -n 1)" preexec_xterm_title "${TERM} - $thiscmd {`dirs -0`} (${USER}@${SCREEN_HOST})" if [[ "${TERM}" == screen ]] then local cutit="$1" local cmdtitle=`echo "$cutit" | cut -d " " -f 1` if [[ "$cmdtitle" == "exec" ]] then local cmdtitle=`echo "$cutit" | cut -d " " -f 2` fi if [[ "$cmdtitle" == "screen" ]] then # Since stacked screens are quite common, it would be nice to # just display them as '$$'. local cmdtitle="${PROMPTCHAR}" else local cmdtitle=":$cmdtitle" fi preexec_screen_title "`preexec_screen_user_at_host`${PROMPTCHAR}$cmdtitle" fi } preexec_install } ================================================ FILE: bin/git-changelog ================================================ #!/usr/bin/env ruby ################################################################################ # git-changelog -- populate a ChangeLog fie from the commit messages # see http://github.com/Falkor/dotfiles # # Copyright (c) 2010 Sebastien Varrette # http://varrette.gforge.uni.lu # # _ _ _ _ # __ _(_) |_ ___| |__ __ _ _ __ __ _ ___| | ___ __ _ # / _` | | __|____ / __| '_ \ / _` | '_ \ / _` |/ _ \ |/ _ \ / _` | # | (_| | | ||_____| (__| | | | (_| | | | | (_| | __/ | (_) | (_| | # \__, |_|\__| \___|_| |_|\__,_|_| |_|\__, |\___|_|\___/ \__, | # |___/ |___/ |___/ # ################################################################################ # This file is NOT part of GIT # # 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 . ################################################################################ # Courtesy from http://snipplr.com/view/6261/ruby-git-changelog/ cmd=`git log --pretty='format:%ci::%an <%ae>::%s'` list = {} list_order = [] cmd.each do |l| date, author, subject = l.chomp.split("::") date, time, zone = date.split(" ") id = "#{date}\t#{author}" if not list[id] list[id] = [] list_order << {:id => id, :value => list[id]} end list[id] << subject end # list.each do |id, value| list_order.each do |i| id = i[:id] value = i[:value] puts "#{id}" puts value.map { |e| "\t* #{e}" }.join("\n") puts "\n" end ================================================ FILE: bin/sshb ================================================ #!/bin/bash ################################################################################ # _ _ _ _____ # ___ ___| |__ | |__ (_)_ _|__ _ __ _ __ ___ # / __/ __| '_ \| '_ \ _____ | | | |/ _ \ '__| '_ ` _ \ # \__ \__ \ | | | |_) | |_____| | | | | __/ | | | | | | | # |___/___/_| |_|_.__/ |_| |_|\___|_| |_| |_| |_| # _ _ # __ _ __| | __| | ___ _ __ # / _` |/ _` |/ _` |/ _ \| '_ \ # | (_| | (_| | (_| | (_) | | | | # \__,_|\__,_|\__,_|\___/|_| |_| # ################################################################################ # SSH with host name and IP address in background (only in iTerm.app) # All credits to [kpumuk](http://github.com/kpumuk/dotfiles.git) # First, check to see if we have the correct terminal! if [ "$(tty)" == 'not a tty' ] || [ "$TERM_PROGRAM" != "iTerm.app" ] ; then /usr/bin/ssh "$@" exit $? fi function __calculate_iterm_window_dimensions { local size=( $(osascript -e "tell application \"iTerm\" get bounds of window 1 end tell" | tr ',' ' ') ) local x1=${size[0]} y1=${size[1]} x2=${size[2]} y2=${size[3]} # 15px - scrollbar width local w=$(( $x2 - $x1 - 15 )) # 44px - titlebar + tabs height local h=$(( $y2 - $y1 - 44)) echo "${w}x${h}" } # Console dimensions DIMENSIONS=$(__calculate_iterm_window_dimensions) BG_COLOR="#000000" # Background color FG_COLOR="#fffafa" # Foreground color #FG_COLOR="#662020" # Foreground color GRAVITY="NorthEast" # Text gravity (NorthWest, North, NorthEast, # West, Center, East, SouthWest, South, SouthEast) OFFSET1="20,10" # Text offset (host name) OFFSET2="20,80" # Text offset (ip address) FONT_SIZE="60" # Font size in points FONT_STYLE="Normal" # Font style (Any, Italic, Normal, Oblique) # Font path #FONT="$HOME/bin/.bash/bash/resources/SimpleLife.ttf" HOSTNAME=`echo $@ | sed -e "s/.*@//" -e "s/ .*//"` output=`dscacheutil -q host -a name $HOSTNAME` RESOLVED_HOSTNAME=`echo -e "$output"|grep '^name:'|awk '{print $2}'` RESOLVED_IP=`echo -e "$output"|grep '^ip_address:'|awk '{print $2}'` function set_bg { local tty=$(tty) osascript -e " tell application \"iTerm\" repeat with theTerminal in terminals tell theTerminal try tell session id \"$tty\" set background image path to \"$1\" end tell on error errmesg number errn end try end tell end repeat end tell" } on_exit () { if [ ! -f /tmp/iTermBG.empty.png ]; then convert -size "$DIMENSIONS" xc:"$BG_COLOR" "/tmp/iTermBG.empty.png" fi set_bg "/tmp/iTermBG.empty.png" rm "/tmp/iTermBG.$$.png" } trap on_exit EXIT # -font "$FONT" convert \ -size "$DIMENSIONS" xc:"$BG_COLOR" -gravity "$GRAVITY" -fill "$FG_COLOR" \ -family "Georgia" -style "$FONT_STYLE" -pointsize "$FONT_SIZE" -antialias \ -draw "text $OFFSET1 '${RESOLVED_HOSTNAME:-$HOSTNAME}'" \ -pointsize 30 -draw "text $OFFSET2 '${RESOLVED_IP:-}'" \ "/tmp/iTermBG.$$.png" 2>/dev/null set_bg "/tmp/iTermBG.$$.png" /usr/bin/ssh "$@" ================================================ FILE: brew/Brewfile ================================================ # -*- mode: ruby -*- # Minimal Brewfile # # Pre-configuration for brew sources tap 'buo/cask-upgrade' tap 'caskroom/cask' tap 'caskroom/fonts' tap 'homebrew/bundle' tap 'homebrew/completions' tap 'homebrew/core' tap 'homebrew/dupes' tap 'homebrew/services' tap 'homebrew/versions' tap 'railwaycat/emacsmacport' # Couple of mandatory applications brew 'autoconf' brew 'autojump' brew 'readline' brew 'bash' brew 'boost', args: ['with-mpi', 'without-single'] brew 'cmake' brew 'coreutils' brew 'ctags-exuberant' brew 'chromaprint' brew 'dsh' brew 'figlet' brew 'gdbm' brew 'git', args: [ 'without-completions'] brew 'git-crypt' brew 'git-extras' brew 'git-flow-avh' brew 'gnuplot', args: ['with-aquaterm', 'with-qt', 'with-pdflib-lite', 'with-cairo' ] brew 'htop' brew 'imapfilter' brew 'imagemagick' brew 'ipcalc' brew 'jpegoptim' brew 'libyaml' brew 'lua' brew 'mas' brew 'mkdocs' brew 'mr' brew 'ninja' brew 'nmap' brew 'offlineimap' brew 'optipng' brew 'openssl' brew 'perl' brew 'pow' brew 'qt' brew 'sqlite' brew 'packer' brew 'pandoc' brew 'parallel' brew 'python' brew 'homebrew/science/r' # R statistical brew 'ruby' brew 'stow' brew 'subversion' brew 'task' brew 'timewarrior' brew 'tree' brew 'terminal-notifier' brew 'tig' brew 'vim' brew 'watch' brew 'wget' # more recent rsync brew 'homebrew/dupes/rsync' # completions brew 'bash-completion' brew 'brew-cask-completion' brew 'zsh-completions' # Mac GUIs Apps cask '1password' cask 'alfred' cask 'aquaterm' cask 'atom' cask 'calibre' cask 'emacs-mac' cask 'dropbox' cask 'gpgtools' cask 'google-chrome' cask 'gpgtools' cask 'mactex' cask 'marked' cask 'omnigraffle' cask 'rowanj-gitx' cask 'rstudio' cask 'skim' cask 'skype' cask 'spamsieve' cask 'the-unarchiver' cask 'vagrant' cask 'vagrant-manager' cask 'virtualbox' cask 'xquartz' cask 'yujitach-menumeters' # Special fonts cask 'font-source-code-pro-for-powerline' cask 'font-hack-nerd-font' cask 'font-lato' # Mac Store Apps mas 'Numbers', id: 409203825 mas 'Keynote', id: 409183694 mas 'Slack', id: 803453959 mas 'Pages', id: 409201541 mas 'Tweetbot', id: 557168941 mas "Xcode", id: 497799835 ================================================ FILE: brew/Brewfile.minimal ================================================ # -*- mode: ruby -*- # Minimal Brewfile for Falkor's dotfile installation -- # see https://github.com/Falkor/dotfiles # Pre-configuration for brew sources tap "buo/cask-upgrade" tap "d12frosted/emacs-plus" tap "homebrew/bundle" tap "homebrew/cask" tap "homebrew/cask-fonts" tap "homebrew/cask-versions" tap "homebrew/core" tap "homebrew/services" tap "romkatv/powerlevel10k" # Couple of mandatory applications brew 'readline' brew 'bash' brew 'bash-completion' brew 'coreutils' brew 'curl' brew 'git' brew "git-extras" brew "git-flow-avh" brew 'mas' brew "romkatv/powerlevel10k/powerlevel10k" brew 'subversion' brew 'terminal-notifier' brew 'tig' brew 'vim' brew 'wget' # completions brew 'bash-completion' brew 'brew-cask-completion' brew 'zsh-completions' # Mac GUIs Apps cask 'atom' brew "d12frosted/emacs-plus/emacs-plus@27", args: ["with-spacemacs-icon"] cask "iterm2" cask "sublime-text" mas "Xcode", id: 497799835 # Special fonts cask 'font-source-code-pro-for-powerline' cask 'font-hack-nerd-font' ================================================ FILE: curl/.curlrc ================================================ # Reference: https://github.com/davidosomething/dotfiles # https://github.com/drduh/macOS-Security-and-Privacy-Guide#curl #user-agent = "Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Firefox/45.0" referer = ";auto" connect-timeout = 10 progress-bar max-time = 90 #verbose show-error remote-time ipv4 ================================================ FILE: direnv/.gitignore ================================================ allow ================================================ FILE: direnv/direnvrc ================================================ # -*- mode: sh; -*- # Custom global configuration for [direnv](https://direnv.net/) # i.e. override/complete the direnv-stdlib: # https://github.com/direnv/direnv/blob/master/stdlib.sh # # Quick installation of this file: # mkdir -p ~/.config/direnv # cd ~/.config/direnv # curl -o direnvrc https://raw.githubusercontent.com/Falkor/dotfiles/master/direnv/direnvrc # # Sample .envrc you can use for Python projects based on the # layouts defined in this file: # https://github.com/Falkor/dotfiles/blob/master/direnv/envrc # ############################ Python ############################ # Workfow based on: # - 'pyenv' to easily switch to a special version of python # - 'pyenv-virtualenv' to manage python versions AND virtualenvs # # Typical .envrc for your python project using the below functions: # if [ -f ".python-version" ]; then # pyversion=$(head .python-version) # else # pyversion=2.7.16 # fi # pvenv=$(basename $PWD) # # use python ${pyversion} # layout virtualenv ${pyversion} ${pvenv} # layout activate ${pvenv} # # Adapted from # - https://github.com/direnv/direnv/wiki/Python#-pyenv and # - https://github.com/direnv/direnv/wiki/Python#-virtualenvwrapper # - https://github.com/direnv/direnv/wiki/Python#venv-stdlib-module # # Side note: # It appeared required to reload the pyenv [virtualenv-]init as for # It May be due to the fact that direnv is creating a new bash # sub-process to load the stdlib, direnvrc and .envrc ### # === Use a specific python version (with pyenv) === # Usage in .envrc: # use python use_python() { if has pyenv; then local pyversion=$1 eval "$(pyenv init --path)" eval "$(pyenv init -)" pyenv local ${pyversion} || log_error "Could not find pyenv version '${pyversion}'. Consider running 'pyenv install ${pyversion}'" fi } # === Support for Python >=3.3 venv === # See https://github.com/direnv/direnv/wiki/Python#venv-stdlib-module # Python 3.3 and later provide built-in support for virtual environments via the venv module in the standard library. # Usage in .envrc: # export VIRTUAL_ENV_HOME=.venv # Default: ~/venv # layout python-venv # creates ${VIRTUAL_ENV_HOME}/ venv realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" } layout_python-venv() { local pvenv=$1 VIRTUAL_ENV_HOME=${VIRTUAL_ENV_HOME:-~/venv} VIRTUAL_ENV=${VIRTUAL_ENV:-${VIRTUAL_ENV_HOME}/${pvenv}} unset PYTHONHOME export VIRTUAL_ENV if [[ ! -d $VIRTUAL_ENV ]]; then log_status "no venv found; creating $VIRTUAL_ENV" python3 -m venv "$VIRTUAL_ENV" fi PATH_add "${VIRTUAL_ENV}/bin" } # === Create a new virtualenv === # Usage in .envrc: # layout virtualenv layout_virtualenv() { local pyversion=$1 local pvenv=$2 if has pyenv; then pyenv local ${pyversion} if [ -n "$(which pyenv-virtualenv)" ]; then eval "$(pyenv virtualenv-init -)" pyenv virtualenv --force --quiet ${pyversion} ${pvenv} else log_error "pyenv-virtualenv is not installed." fi elif has python3; then # Use venv by default layout_python-venv ${pvenv} else log_error "pyenv or python3 venv not found." fi } # === Activate a virtualenv === # Note that pyenv-virtualenv uses 'python -m venv' if it is # available (CPython 3.3 and newer) and 'virtualenv' otherwise # Usage in .envrc: # layout activate layout_activate() { if has pyenv; then local pyenvprefix=$(pyenv prefix) local pyversion=$(pyenv version-name) local pvenv="$1" # Below initialization is necessary to recall ;( pyenv activate ${pvenv} else source ${VIRTUAL_ENV}/bin/activate fi } ================================================ FILE: direnv/envrc ================================================ # -*- mode: sh; -*- # (rootdir)/.envrc : local direnv configuration file # Assumes the presence of '~/.config/direnv/direnvrc' from # https://github.com/Falkor/dotfiles/blob/master/direnv/direnvrc # # Grab the latest version of this file from # https://github.com/Falkor/dotfiles/blob/master/direnv/envrc # # Quick installation of this file for your project: # cd /path/to/projectdir # curl -o .envrc https://raw.githubusercontent.com/Falkor/dotfiles/master/direnv/envrc # Default python version and virtualenv (basename of the root project directory) [ -f ".python-version" ] && pyversion=$(head .python-version) || pyversion=3.7.4 [ -f ".python-virtualenv" ] && pvenv=$(head .python-virtualenv) || pvenv=$(basename $PWD) use python ${pyversion} # Create the virtualenv if not yet done layout virtualenv ${pyversion} ${pvenv} # activate it layout activate ${pvenv} ================================================ FILE: direnv/init.sh ================================================ # Custom load for direnv # See https://direnv.net/ if [ -n "$(which direnv 2>/dev/null)" ]; then eval "$(direnv hook $(basename $SHELL))" # export DIRENV_WARN_TIMEOUT=100s # See https://github.com/direnv/direnv/wiki/Python#restoring-the-ps show_virtual_env() { if [[ -n "$VIRTUAL_ENV" && -n "$DIRENV_DIR" ]]; then echo "($(basename $VIRTUAL_ENV))" fi } if [[ -n ${ZSH_VERSION-} ]]; then setopt PROMPT_SUBST else export -f show_virtual_env fi PS1='$(show_virtual_env) '$PS1 fi ================================================ FILE: docs/contributing/index.md ================================================ This project is released under the terms of the [GPL-3.0 Licence](LICENSE). So you are more than welcome to contribute to its development as follows: 1. [Fork](https://help.github.com/articles/fork-a-repo/) it. 2. Clone your _forked_ copy of this repository as follows (adapt accordingly): $> mkdir -p ~/git/github.com/ $> cd ~/git/github.com/ $> git clone https://github.com//dotfiles.git 3. **`/!\ IMPORTANT`**: Once cloned, initiate your local copy of the repository ([Git-flow](https://github.com/nvie/gitflow), Git [submodules](.gitmodules) etc.) by running: $> cd dotfiles $> make setup 4. Create your own feature branch $> git checkout -b my-new-feature 5. Commit your changes (`git commit -am 'Added some feature'`) 6. Push to the branch (`git push origin my-new-feature`) 7. Create a new [Pull Request](https://help.github.com/articles/using-pull-requests/) to submit your changes to me. This assumes that you have understood the [directory tree structure](layout.md) of this repository. Finally, you shall be aware of the way the [semantic versioning](versioning.md) procedure of this Puppet module are handled. ================================================ FILE: docs/contributing/layout.md ================================================ This dotfile repository is organized as follows: ~~~bash . ├── LICENSE # GPL v3 Licence ├── Makefile # GNU Make configuration ├── README.md # This file ├── VERSION # /!\ DO NOT EDIT. Current repository version ├── Vagrantfile # Pilot Vagrant to test this repository ├── bash/ │   ├── .bashrc # bash configuration │   └── .inputrc # readline configuration ├── bin/ # some bin scripts ├── docs/ # [Read the Docs](readthedocs.org) main directory ├── emacs # [My emacs configuration](https://github.com/Falkor/emacs-config2/) ├── fonts/ # Exported fonts ├── git/ # My git configuration ├── install.sh # Installation script ├── mkdocs.yml # [Read the Docs](readthedocs.org) configuration ├── oh-my-zsh/ │ └── custom │ ├── *.zsh # Some custom ZSH [completion] files │ ├── plugins │ │   ├── falkor │ │   │   └── falkor.plugin.zsh # personal ZSH aliases / functions │ │   └── zsh-completions # plugin to integrate zsh-completions to oh-my-zsh │ └── private_aliases.zsh # NOT MEANT TO BE TRACKED ├── screen/ # GNU screen configuration ├── screenshots/ # screenshots to illustrate my configs └── vim/ # Vim configuration ~~~ ================================================ FILE: docs/contributing/setup.md ================================================ There is a number of pre-requisite programs / framework you shall install to be able to correctly contribute to this Puppet module. ### Git Branching Model The Git branching model for this repository follows the guidelines of [gitflow](http://nvie.com/posts/a-successful-git-branching-model/). In particular, the central repository holds two main branches with an infinite lifetime: * `production`: the *production-ready* branch * `master`: the main branch where the latest developments interviene. This is the *default* branch you get when you clone the repository. Thus you are more than encouraged to install the [git-flow](https://github.com/nvie/gitflow) extensions following the [installation procedures](https://github.com/nvie/gitflow/wiki/Installation) to take full advantage of the proposed operations. The associated [bash completion](https://github.com/bobthecow/git-flow-completion) might interest you also. ### Repository Setup As mentioned in the [installation notes](/), to make your local copy of the repository ready to use the [git-flow](https://github.com/nvie/gitflow) workflow $> make setup This will also initiate the [Git submodules of this repository](.gitmodules). ================================================ FILE: docs/contributing/versioning.md ================================================ The operation consisting of releasing a new version of this repository is automated by a set of tasks within the root `Makefile`. In this context, a version number have the following format: ..[-b] where: * `< major >` corresponds to the major version number * `< minor >` corresponds to the minor version number * `< patch >` corresponds to the patching version number * (eventually) `< build >` states the build number _i.e._ the total number of commits within the `master` branch. Example: \`1.0.0-b28\` The current version number is stored in the root file `VERSION`. __/!\ NEVER MAKE ANY MANUAL CHANGES TO THIS FILE__ For more information on the version, run: $> make versioninfo If a new version number such be bumped, you simply have to run: $> make start_bump_{major,minor,patch} This will start the release process for you using `git-flow`. Once you have finished to commit your last changes, make the release effective by running: $> make release It will finish the release using `git-flow`, create the appropriate tag in the `production` branch and merge all things the way they should be. ================================================ FILE: docs/emacs/index.md ================================================ # Falkor's Dotfiles -- GNU Emacs configuration ## Screenshot ![](https://raw.githubusercontent.com/Falkor/dotfiles/master/screenshots/screenshot_falkor_emacs.png) ================================================ FILE: docs/index.md ================================================ -*- mode: markdown; mode: visual-line; -*- # Falkor/dotfiles [![Licence](https://img.shields.io/badge/license-GPL--3.0-blue.svg)](http://www.gnu.org/licenses/gpl-3.0.html) ![By Falkor](https://img.shields.io/badge/by-Falkor-blue.svg) [![Build Status](https://travis-ci.org/Falkor/dotfiles.svg?branch=master)](https://travis-ci.org/Falkor/dotfiles) [![github](https://img.shields.io/badge/git-github-lightgray.svg)](https://github.com/Falkor/dotfiles) [![Falkor/dotfiles issues](https://img.shields.io/github/issues/Falkor/dotfiles.svg)](https://github.com/Falkor/dotfiles/issues) ![](https://img.shields.io/github/stars/Falkor/dotfiles.svg) [![Documentation Status](https://readthedocs.org/projects/falkor-dotfiles/badge/?version=latest)](https://readthedocs.org/projects/falkor-dotfiles/?badge=latest) Copyright (c) 2011-2016 Sebastien Varrette aka Falkor | [Project Page](https://github.com/Falkor/dotfiles) | [Documentation](http://falkor-dotfiles.readthedocs.org/en/latest/) | [Issues](https://github.com/Falkor/dotfiles/issues) | ----------- The [`Falkor/dotfiles`](https://github.com/Falkor/dotfiles) repository holds my configuration files for `bash`, `zsh`, `git`, `vim` etc. so as to set up a system the way I like it. This is the main page of the documentation for this repository, which is hosted and managed by [Read the Docs](http://falkor-dotfiles.readthedocs.org/en/latest/). It proposes to detail the following elements: * An [Overview](overview.md) of the project is proposed, with installation notes. * How to [test these dotfiles with Vagrant](vagrant.md) * How to [contribute](contributing/index.md) to these development. In particular, we detail: - the [directory tree structure](contributing/layout.md) - the steps to follow to [setup this repository](contributing/setup.md) - information as regard the [semantic versioning](contributing/versioning.md) of this Puppet module. - Apart form the directory layout, we will cover various configuration aspects (mainly [git-flow](https://github.com/nvie/gitflow)) * Details on the [Read the Docs](http://falkor-dotfiles.readthedocs.org/en/latest/) management. ================================================ FILE: docs/rtfd.md ================================================ The documentation for this project is handled by [Read the Docs](https://readthedocs.org/), a web service dedicated to documentation management for the open source community. * [Reference documentation](https://docs.readthedocs.org/en/latest/) By default, the [`Falkor/dotfiles`](https://github.com/Falkor/dotfiles) repository is bound to the [falkor-dotfiles](http://falkor-dotfiles.rtfd.org) project on Read the Docs (to avoid confusion with other `dotfiles` projects). You might wish to generate locally the docs: * Install [`mkdocs`](http://www.mkdocs.org/#installation) * Preview your documentation from the project root by running `mkdocs serve` and visit with your favorite browser the URL `http://localhost:8000` * build the full documentation locally (in the `site/` directory) by running `mkdocs build`. ================================================ FILE: docs/vagrant.md ================================================ -*- mode: markdown; mode: visual-line; -*- # Falkor's dotfiles Tests with Vagrant The best way to test these dotfiles in a non-intrusive way is to rely on [Vagrant](http://www.vagrantup.com/). [Vagrant](http://vagrantup.com/) uses [Oracle's VirtualBox](http://www.virtualbox.org/) to build configurable, lightweight, and portable virtual machines dynamically. * [Reference installation notes](http://docs.vagrantup.com/v2/installation/) -- assuming you have installed [Oracle's VirtualBox](http://www.virtualbox.org/) * [installation notes on Mac OS](http://sourabhbajaj.com/mac-setup/Vagrant/README.html) using [Homebrew](http://brew.sh/) and [Cask](http://sourabhbajaj.com/mac-setup/Homebrew/Cask.html) The `Vagrantfile` at the root of the repository pilot the provisioning of many vagrant boxes generated through the [vagrant-vms](https://github.com/falkor/vagrant-vms) repository and available on [Vagrant cloud](https://atlas.hashicorp.com/boxes/search?utf8=%E2%9C%93&sort=&provider=virtualbox&q=svarrette). You can list the available vagrant box as follows: $> vagrant status Current machine states: centos-7 not created (virtualbox) debian-7 not created (virtualbox) This environment represents multiple VMs. The VMs are all listed above with their current state. For more information about a specific VM, run `vagrant status NAME`. As suggested, you can run a debian 7 machine for instance by issuing: $> vagrant up debian-7 Then you can ssh into the machine afterwards: $> vagrant ssh debian-7 Once within the box, feel free to try my dotfiles. You can install them by running: $> /vagrant/install.sh # /vagrant mounts the root of the Falkor's dotfile repository $> chsh -s $(which zsh) # Set zsh as the login shell ================================================ FILE: git/.gitconfig ================================================ # -*- mode: gitconfig; -*- ################################################################################ # .gitconfig -- my personal GIT configuration # see http://github.com/Falkor/dotfiles # # Copyright (c) 2010 Sebastien Varrette # http://varrette.gforge.uni.lu # # _ _ __ _ # __ _(_) |_ ___ ___ _ __ / _(_) __ _ # / _` | | __/ __/ _ \| '_ \| |_| |/ _` | # | (_| | | || (_| (_) | | | | _| | (_| | # (_)__, |_|\__\___\___/|_| |_|_| |_|\__, | # |___/ |___/ # ################################################################################ # Resources: # - http://stackoverflow.com/questions/267761/what-does-your-gitconfig-contain # As introduced in Git >= 1.7.10 (see http://git-scm.com/docs/git-config#_includes) [include] # For username / credentials / private business etc. path = config.local [alias] up = pull origin pu = push origin st = status df = diff ci = commit -s w = whatchanged --abbrev-commit ls = ls-files gr = log --graph --pretty=format:'%C(auto)%h -%d %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit grd = log --graph --pretty=format:'%C(auto)%h -%d %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit # From http://progit.org/book/ch2-11.html unadd = reset HEAD unstage = reset HEAD -- last = log -1 HEAD amend = commit --amend # From http://j.shirley.im/tech/git-flow/ feature-start = flow feature start feature-finish = ! git flow feature finish # From https://github.com/tgamblin/dotfiles/blob/master/home/.gitconfig br = branch --sort=-committerdate \ --format '%(HEAD) %(color:yellow)%(objectname:short)%(color:reset) %(if)%(HEAD)%(then)%(color:green)%(refname:short)%(color:reset)%(else)%(refname:short)%(end) - %(color:cyan)(%(committerdate:relative))%(color:reset)' bv = branch --sort=-committerdate \ --format '%(HEAD) %(color:yellow)%(objectname:short)%(color:reset) %(if)%(HEAD)%(then)%(color:green)%(refname:short)%(color:reset)%(else)%(refname:short)%(end) - %(color:cyan)(%(committerdate:relative))%(color:reset)%(if)%(upstream)%(then) -> %(color:magenta)%(upstream:short) %(color:white)%(upstream:track)%(color:reset)%(end)' # # `git b` with no arguments shows branches ordered by commit date # (most recent first) # # With arguments, it behaves like `git branch` # b = !"f() { \ if [ $# -ne 0 ]; then \ git branch \"$@\"; \ else \ git for-each-ref --sort=-committerdate refs/heads/ \ --format='%(HEAD) %(color:yellow)%(objectname:short)%(color:reset) %(if)%(HEAD)%(then)%(color:green)%(refname:short)%(color:reset)%(else)%(refname:short)%(end) - %(color:cyan)(%(committerdate:relative))%(color:reset)'; \ fi; \ }; f" # # Make tarball out of the current head. Tarball and the contained # directory will be named by the date and current HEADs SHA. # tarball = !"f() { \ filename=\"$1\"; \ if [ \"x$filename\" = x ]; then \ name=\"$(basename $(git rev-parse --show-toplevel))\" && \ head=$(git log -1 --format=\"%h\" HEAD) && \ dstamp=$(git log -1 --format=\"%ci\" HEAD | awk '{print $1}') && \ filename=\"${name}-${dstamp}-${head}\"; \ fi; \ git archive --format=tar.gz --prefix=\"${filename}/\" HEAD -o ${filename}.tar.gz; \ }; f" # # Git Statistics # # - ghstats # Show same statistics that GitHub's contributors page does: # commits, insertions, & deletions, over the current branch. # # - lcontrib: # Use `git blame` to sum up lines contributed by all users # that are still in the current HEAD. This differs from # ghstats becausae it shows only lines in the current # snapshot, NOT insertions and deletions from all commits. # # - scontrib: # Show raw #commits made by users in current branch. # # All of the above aliases can take paths as arguments, e.g., if # your repo has a subdirectory called "lib", you could do: # # git ghstats lib # # You can provide relative or absolute paths. You can also exclude # paths from the statistics using git pathspecs, e.g. if you # wanted to exclude contributions made in a directory containing # external dependencies: # # # In the repository root # git ghstats . ":(exclude)lib/external" # # NOTE: You cannot currently use relative paths with exclude. # ONLY do this one in the repository root. # scontrib = !"f() {\ printf '%7s %-30s %s\n' COMMITS NAME EMAIL && \ git log --branches --pretty=format:'%<(30)%aN %aE' HEAD -- $( \ for d in \"$@\"; do echo \"${GIT_PREFIX:-${d}}\"; done \ )| sort | uniq -c | sort -nr; \ }; f" lcontrib = "!f() { \ for file in $( \ git ls-tree --name-only -r HEAD -- $( \ for d in \"$@\"; do echo \"${GIT_PREFIX:-${d}}\"; done \ ) \ ); do \ git blame -w --line-porcelain $file | \ perl -ne '\ if (/^[0-9a-f]{40} / .. /^filename /) { \ $author = $_ if (s/^author //); \ } else { \ print $author unless /^\\s*(\\#.*)?$/; \ }'; \ done | sort | uniq -c | sort -nr; \ }; f" ghstats = "!f() { \ printf \"%-8s%-9s%-9s%-9s%s\\n\" '#' COMMITS INSERTED DELETED AUTHOR; \ git log --use-mailmap --shortstat HEAD -- $( \ for d in \"$@\"; do \ echo \"${GIT_PREFIX:-${d}}\"; \ done \ ) | perl -e ' \ while (<>) { \ if (/^Author: (.*)$/) { \ $a = $1; \ $c{$a} = 0 unless defined $c{$a}; \ $i{$a}=0 unless defined $i{$a}; \ $d{$a}=0 unless defined $d{$a}; \ } \ if (/^ (\\d+) files? changed(?:, (\\d+) insertions?\\(\\+\\))?(?:, (\\d+) deletions?\\(\\-\\))?/) { \ $c{$a} += 1; \ $i{$a} += $2; \ $d{$a} += $3; \ } \ }; \ printf(\"%-9d%-9d%-9d%s\\n\", $c{$_}, $i{$_}, $d{$_}, $_) for (keys %i);' \ | sort -nr | nl -n ln -w 5; \ }; f" closed = "!for br in $(git branch); do if git is-merged $br &>/dev/null; then echo $br; fi; done" # get the github name of this repository by looking at all the github # remotes and picking the most popular name there. ghname = "!f() {\ git remote -v |\ perl -ne '\ if (s/.*github.com[:\\/]([^\\/]*)\\/([^.\\s]*).*/\\2/) { print; }'|\ sort |\ uniq |\ head -1;\ }; f" [color] diff = auto status = auto branch = auto ui = auto ui = true [color "branch"] current = yellow reverse local = green remote = red [color "diff"] meta = yellow bold frag = magenta bold Old = red bold new = green bold [color "status"] added = green bold changed = magenta untracked = red [core] autocrlf = input safecrlf = warn # pager = less -FRSX # Switch to Delta - https://github.com/dandavison/delta pager = delta editor = vim mergeoptions = --no-edit [interactive] diffFilter = delta --color-only [delta] navigate = true # use n and N to move between diff sections side-by-side = true [pull] #rebase = false rebase = true [push] default = matching [filter "lfs"] clean = git-lfs clean -- %f smudge = git-lfs smudge -- %f process = git-lfs filter-process required = true [merge] tool = meld conflictstyle = diff3 [diff] guitool = meld colorMoved = default ================================================ FILE: git/.gitignore ================================================ *.local ================================================ FILE: git/README.md ================================================ # Falkor's Dotfiles -- some git configuration ![](https://git-scm.com/images/logo@2x.png) [Git](https://git-scm.com/) is probably one of the most awesome productivity tool I use so far. > [Git](https://git-scm.com/) is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. If you want to know more bout git, you might wish to take a look at the slides I made as an [introduction to git](https://github.com/ULHPC/documents/blob/master/slides/ULHPC_School/2015/intro_git/intro_git.pdf) during the [UL HPC School](https://hpc.uni.lu/hpc-school/2015/06/index.html). See also the [Git Cheat Sheet](https://training.github.com/kit/downloads/github-git-cheat-sheet.pdf) proposed on Github. ## Git installation Installation of [Git](http://git-scm.com/) is relatively simple (actually it comes bundled with your system normally): ### Linux / Mac OS ```bash $ apt install git git-flow # On Debian-like systems $ yum install git gitflow # On CentOS-like systems $ brew install git git-flow # On Mac OS, using [Homebrew](http://mxcl.github.com/homebrew/) ``` ### Windows Use [git-for-windows](https://git-for-windows.github.io/), which includes Git Bash/GUI and Shell Integration * use PLINk from Putty * install Git bash + command prompt * select checkout windows / commit unix ## Git configuration The way I organize my git configurations is as follows: | File | Alternative | Visibility | Description | |------------------------------|----------------------|------------|------------------------------------------------| | `~/.config/git/config` | `~/.gitconfig` | Public | general aliases and core/colors configurations | | `~/.config/git/config.local` | `~/.gitconfig.local` | Private | username / credentials / private business etc. | Note that this hierarchy assume the availability of the `include.path` directive within Git which was introduced in __Git >= 1.7.10__ (see ) A sample `config.local.example` is provided that you can inspire to create your own (not-tracked) `config.local` file. ## Installation for Falkor's Git configuration You can use the `install.sh` script featured with the [Falkor's dotfile](https://github.com/Falkor/dotfile) repository. ``` bash $ cd ~/.config/dotfiles.falkor.d $ ./install.sh --git # OR ./install.sh --with-git # Copy and adapt local configuration $ cd ~/.config/git/ $ cp ~/.config/dotfiles.falkor.d/git/config.local.example config.local $ vim ~/.config/git/config.local # /!\ ADAPT name , email etc. ``` ## Uninstall ``` bash $ cd ~/.config/dotfiles.falkor.d $ ./install.sh --delete --git ``` ## Resources Consider these resources to become more familiar (if not yet) with Git: * [Simple Git Guide](http://rogerdudler.github.io/git-guide/) * [Git book](http://book.git-scm.com/index.html) * [Github:help](http://help.github.com/mac-set-up-git/) * [Git reference](http://gitref.org/) * [Git Cheat Sheet](https://training.github.com/kit/downloads/github-git-cheat-sheet.pdf) proposed on Github. ================================================ FILE: git/config.local.example ================================================ # ~/.config/git/config.local # Local [private] Git configuration [user] name = "Firsname Lastname" email = "firsname.lastname@domain.org" # signingKey = # signingKey = ~/.ssh/id_ed25519-sk ### In case you want to use your SSH key for commit signs #[gpg] # format = ssh #[gpg "ssh"] # allowedSignersFile = ~/.ssh/allowed_signers ### uncomment to automatically sign each commit/tag # [commit] # gpgsign = true # [tag] # gpgsign = true # [init] # defaultBranch = master ================================================ FILE: git/ignore ================================================ # Automatically created by GitHub for Mac .DS_Store .AppleDouble .LSOverride # Icon must end with two \r Icon # Thumbnails ._* # Files that might appear in the root of a volume .DocumentRevisions-V100 .fseventsd .Spotlight-V100 .TemporaryItems .Trashes .VolumeIcon.icns # Directories potentially created on remote AFP share .AppleDB .AppleDesktop Network Trash Folder Temporary Items .apdisk ================================================ FILE: gnupg/4F156AD7-transition-statement.md.asc ================================================ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 - -*- mode: markdown; mode; auto-fill; -*- Time-stamp: I am transitioning my GPG keys from an old 1024-bit DSA key (`0xA403AC45DD01D5C0`) to a new 4096-bit RSA key (`0x5D08BCDD4F156AD7`). The old key will continue to be valid for a short period of time after the posting of this message, but future signatures will be created from the new key and I prefer all new correspondance to be encrypted with the new key. This transition document is signed with both keys to certify the transition. The **old** key was: pub 1024D/0xA403AC45DD01D5C0 2006-05-19 Key fingerprint = E273 5952 5AB9 A7FA D786 2C15 A403 AC45 DD01 D5C0 The **new** key is: pub 4096R/0x5D08BCDD4F156AD7 2017-03-01 Key fingerprint = 1A53 FD6E 09A4 4DBA 7A9F D72B 5D08 BCDD 4F15 6AD7 Note that the signing of this message may have been done by a **SUBKEY** of the above key. - -------------------------------------------------------------------------------- To fetch the new key from a public key server, you can use the following: gpg --keyserver pgp.mit.edu --recv-key 5D08BCDD4F156AD7 * _If you already know my old key_, you can verify that the new key has been signed by the old one using: gpg --check-sigs 5D08BCDD4F156AD7 * _If you don’t know (yet) my old key_, or you want to be extra careful, you can check the fingerprint against the one above: gpg --fingerprint 5D08BCDD4F156AD7 You can verify the signatures on this message by downloading the plain text file as linked and running: gpg --verify Finally, if you are satisfied that you have the right key, that the UIDs match what you expect, and you are certain of my identity, I would appreciate it if you would sign my new key: gpg --sign-key 5D08BCDD4F156AD7 gpg --keyserver pgp.mit.edu --send-key 5D08BCDD4F156AD7 - -------------------------------------------------------------------------------- Please contact me via e-mail at if you have any questions about this document or this transition. Sebastien Varrette -----BEGIN PGP SIGNATURE----- iQIcBAEBCgAGBQJYvH+TAAoJECjhDmEWLJXUVDEP/3S1wocVFhwAcomJF5PdrKPU QBXbsnxf7jfBOdGI5Ou4uKHLOdGORnxsHaU4ForPto5g1vAPEtP6dGXOLrWok1Dq 87KQKJJoncdnIitscYO3btY3zbOef+6it9cEOzEK8wR/jgBJ8JRiZSW/j1Q2eFiR pGKkcWBMHthsW3VUZb3hih1HA71oxurmkF3Pky9Sr4EYVOtQjZM7HuHgiYHIRsq4 LtibsZe+vC6Jw8RULmeUBGf+CmfO2RfycBe0dAO07QbT7Su8wnC5Rxzg9sW07fjq bNQaCXxz9cGRi9ikC9LALGSynTGiPoaGcLfXS6w6OaBzz/dkC+hoEyEw/o1jbQfk rnHJ9w4DiefR9fbEU0/uhIqjejx+4MWRK1qkpYivSCd5e89glB4+fHwfuS+Mk8wz RNH9n3wg4FWuqsM5W7zl6e4CjflkMiAbOKIiefNby8hGePj1BZB2eIXEnTjb2efa jK2wWRe/613AlF5eeKqoJlQJJXIh+N1SkzJy/VjDZf3KVRGsL6f2YosLSAMl4RN1 ZAILPjuJ09HawQDqrEsI/X3tiXV/b+8bOs66zbLe/widTk/XeGCaLmetmZVjNTsG d/ojJcmwwncnU9p8x3MjuQMT1oxdK7PEc3aQlTjzLANUQ0qFDSHtQYMPkCiKOSyo 4lu0PDRyH7r3krMQqbk3 =6JDX -----END PGP SIGNATURE----- ================================================ FILE: gnupg/DD01D5C0-transition-statement.md.asc ================================================ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 - -*- mode: markdown; mode; auto-fill; -*- Time-stamp: I am transitioning my GPG keys from an old 1024-bit DSA key (`0xA403AC45DD01D5C0`) to a new 4096-bit RSA key (`0x5D08BCDD4F156AD7`). The old key will continue to be valid for a short period of time after the posting of this message, but future signatures will be created from the new key and I prefer all new correspondance to be encrypted with the new key. This transition document is signed with both keys to certify the transition. The **old** key was: pub 1024D/0xA403AC45DD01D5C0 2006-05-19 Key fingerprint = E273 5952 5AB9 A7FA D786 2C15 A403 AC45 DD01 D5C0 The **new** key is: pub 4096R/0x5D08BCDD4F156AD7 2017-03-01 Key fingerprint = 1A53 FD6E 09A4 4DBA 7A9F D72B 5D08 BCDD 4F15 6AD7 Note that the signing of this message may have been done by a **SUBKEY** of the above key. - -------------------------------------------------------------------------------- To fetch the new key from a public key server, you can use the following: gpg --keyserver pgp.mit.edu --recv-key 5D08BCDD4F156AD7 * _If you already know my old key_, you can verify that the new key has been signed by the old one using: gpg --check-sigs 5D08BCDD4F156AD7 * _If you don’t know (yet) my old key_, or you want to be extra careful, you can check the fingerprint against the one above: gpg --fingerprint 5D08BCDD4F156AD7 You can verify the signatures on this message by downloading the plain text file as linked and running: gpg --verify Finally, if you are satisfied that you have the right key, that the UIDs match what you expect, and you are certain of my identity, I would appreciate it if you would sign my new key: gpg --sign-key 5D08BCDD4F156AD7 gpg --keyserver pgp.mit.edu --send-key 5D08BCDD4F156AD7 - -------------------------------------------------------------------------------- Please contact me via e-mail at if you have any questions about this document or this transition. Sebastien Varrette -----BEGIN PGP SIGNATURE----- iEYEAREKAAYFAli8ftYACgkQpAOsRd0B1cCriwCfXtx48Ei/Rp4LGB8Dot7EdnXB 20kAniG/ZpvwPf85ZQJ/Z0uqj9RhjECF =9ND2 -----END PGP SIGNATURE----- ================================================ FILE: gnupg/README.md ================================================ # GPG: Gnu Privacy Guard * Old resources, still usefull: * [Tutorial](https://futureboy.us/pgp.html) + [personnal Tutorial](https://varrette.gforge.uni.lu/blog/2017/03/14/tutorial-gpg-gnu-privacy-guard/) * [GPG Keypairs](https://stelfox.net/knowledge_base/linux/gpg_keypairs/) * [Generating More Secure GPG Keys: A Step-by-Step Guide](https://spin.atomicobject.com/2013/11/24/secure-gpg-keys-guide/) * [Guide to using YubiKey for GPG and SSH](https://github.com/drduh/YubiKey-Guide) * [OpenPGP Best Practices](https://riseup.net/en/security/message-security/openpgp/best-practices) * [GnuPG](https://www.gnupg.org/): implementation of the OpenPGP standard aka [RFC4880](http://www.ietf.org/rfc/rfc4880.txt) - Hybrid encryption framework based on [Web of Trust](https://en.wikipedia.org/wiki/Web_of_trust) - `Mail | Document | Git commit...` encryption / signature ![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/4d/PGP_diagram.svg/575px-PGP_diagram.svg.png) [TOC] ## Installation Apart from the below (preferred) solutions per OS, a cross-platform approach relies on Thunderbird and the [Enigmail](https://enigmail.wiki/) extension. ### Linux/BSD * Install the `gnupg` package. * You might also consider [GPGME -- GnuPG Made Easy]() -- [tutorial](http://www.nico.schottelius.org/docs/a-small-introduction-for-using-gpgme/) ### Mac OS X * Install the [GPGTools Suite](https://gpgtools.org/) - GPG for Apple Mail and GPG Keychain - GPhttps://github.com/Falkor/dotfiles/blob/master/gnupg/gpg.confG Services and MacGPG ### Windows [Gpg4win](http://www.gpg4win.org/) (GNU Privacy Guard for Windows) is the reference package implementation to use [GPG](https://www.gnupg.org/) under windows -- [tutorial](https://www.deepdotweb.com/2015/02/21/pgp-tutorial-for-windows-kleopatra-gpg4win/) It includes the following programs: * __GnuPG__, which forms the heart of Gpg4win - the actual encryption software. * __Kleopatra__, the central certificate administration of Gpg4win, which ensures uniform user navigation for all cryptographic operations. * __GNU Privacy Assistant (GPA)__, an alternative program for managing certificates, in addition to Kleopatra. * __GnuPG for Outlook (GpgOL)__, an extension for Microsoft Outlook 2003 and 2007, which is used to sign and encrypt messages. * __GPG Explorer eXtension (GpgEX)__, an extension for Windows Explorer which can be used to sign and encrypt files using the context menu. * __Claws Mail__, a full e-mail program that offers very good support for GnuPG. ## Configuration see `{gpg,dirmngr,gpg-agent}.conf` which are provided as [part of my personnal dotfiles](https://github.com/Falkor/dotfiles/tree/master/gnupg). Enable them as follows: ```bash cd ~/.gnupg ln -s ../path/to/dotfile/repo/gnupg config.gnupg.d # convenient directory ln -s config.gnupg.d/gpg.conf . ln -s config.gnupg.d/dirmngr.conf . ln -s config.gnupg.d/gpg-agent.conf . ``` #### Pinentry You can configure your favorite pinentry program to prompt for your GPG passphrase/PIN ```bash # Debian-like systems $ sudo apt install pinentry-curses pinentry-qt pinentry-gtk2 $ sudo update-alternatives --config pinentry There ahttps://github.com/Falkor/dotfiles/blob/master/gnupg/gpg.confre 5 choices for the alternative pinentry (providing /usr/bin/pinentry). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/pinentry-gnome3 90 auto mode 1 /usr/bin/pinentry-curses 50 manual mode 2 /usr/bin/pinentry-gnome3 90 manual mode 3 /usr/bin/pinentry-gtk-2 85 manual mode 4 /usr/bin/pinentry-qt 80 manual mode 5 /usr/bin/pinentry-tty 30 manual mode Press to keep the current choice[*], or type selection number: 1 update-alternatives: using /usr/bin/pinentry-curses to provide /usr/bin/pinentry (pinentry) in manual mode ``` Note that when using `pinentry-{tty,ncurses}`, it may happen that you don't get access to the pinentry program. It's most likely a problem tied to the GPG_TTY environnement variable - ensure you set somewhere in your shell ```bash export GPG_TTY=$(tty) ``` Alternatively, you can force your GPG agent to reset the tty used (in particular) by your pinentry program. ```bash gpg-connect-agent "updatestartuptty" /bye >/dev/null ``` Note that managing the correct TTY across multiple tabs in your favorite shell (Guake etc.) can be cumbersome. So it's probably easier to rely on a pinentry GUI like **pinentry-gtk-2**. ## GPG Key Generation Consider using the provided script [`scripts/generate-gpg-key`](https://github.com/Falkor/dotfiles/blob/master/gnupg/scripts/generate-gpg-key) which implements and automate the generation of GPG key pairs according to [recommended best practices](https://help.riseup.net/en/security/message-security/openpgp/best-practices). ```bash $ ./scripts/generate-gpg-key -h # help $ ./scripts/generate-gpg-key # By default, operate in a temporary directory Working directory: GNUPGHOME = /tmp/user//tmp.c26KOD8LdO => generating batch file for the master key /tmp/user//tmp.c26KOD8LdO/generate-master-key.batch => generating master key gpg: keybox '/tmp/user//tmp.c26KOD8LdO/pubring.kbx' created gpg: === Generating your GPG key === gpg: -> Generating master key (for certification only) gpg: /tmp/user//tmp.c26KOD8LdO/trustdb.gpg: trustdb created gpg: directory '/tmp/user//tmp.c26KOD8LdO/openpgp-revocs.d' created gpg: revocation certificate stored as '/tmp/user//tmp.c26KOD8LdO/openpgp-revocs.d/C808C0230ED24EF393EDFCA6EC70200B9BF93DCB.rev' gpg: done === Current GPG key status === gpg: checking the trustdb gpg: marginals needed: 3 completes needed: 1 trust model: pgp gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u /tmp/user//tmp.c26KOD8LdO/pubring.kbx ----------------------------------------- sec rsa4096/0x3156CC64BB58247D [C] 6D1F481568A1D64F98BF228B3156CC64BB58247D uid [ultimate] => collecting generated Key ID Master Key ID for : 6D1F481568A1D64F98BF228B3156CC64BB58247D => Generating subkey for 'sign' usage => Generating subkey for 'encrypt' usage => Generating subkey for 'auth' usage === Current GPG key status === /tmp/user//tmp.c26KOD8LdO/pubring.kbx ----------------------------------------- sec rsa4096/0x3156CC64BB58247D [C] 6D1F481568A1D64F98BF228B3156CC64BB58247D uid [ultimate] ssb rsa4096/0x48D1E2129D0CCEC6 [S] [expires: ] ssb rsa4096/0xEE74576ED76B1148 [E] [expires: ] ssb rsa4096/0x68E5153F63FA7B79 [A] [expires: ] => exports/backup your public key => exports/backup your **private** master key => exports/backup your **private** subkeys => revocation cerfificate for OpenPGP (master) key 6D1F481568A1D64F98BF228B3156CC64BB58247D: /tmp/user//tmp.c26KOD8LdO/openpgp-revocs.d/6D1F481568A1D64F98BF228B3156CC64BB58247D.rev => export GPG's trustDB to a text file => preparing for (optional) SSH support via the GPG subkey with 'A[uth]' usage assumes you specify the key to use in sshcontrol file via its keygrip internal identifier Current keygrips in use: (gpg -K --with-keygrip [...]) sec rsa4096/0x3156CC64BB58247D [C] 6D1F481568A1D64F98BF228B3156CC64BB58247D Keygrip = 6F165EAF3AF6A678A072841654E6702974A885B3 uid [ultimate] ssb rsa4096/0x48D1E2129D0CCEC6 [S] [expires: ] Keygrip = CC34AFAD18486AD790CCA9A708D858057F022FD2 ssb rsa4096/0xEE74576ED76B1148 [E] [expires: ] Keygrip = CBE87BF5CB84AE288E4829BE66B286FBCDFEAEAE ssb rsa4096/0x68E5153F63FA7B79 [A] [expires: ] Keygrip = 47A0554C7508280F10E277B40186257857DD6E03 selected keygrip (subkey with 'A' usage): '47A0554C7508280F10E277B40186257857DD6E03' => creating /tmp/user//tmp.c26KOD8LdO/sshcontrol /!\ WARNING: To get gpg-agent to handle requests from SSH, you still need to: /!\ WARNING: - add 'enable-ssh-support' into ${GNUPGOME}/gpg-agent.conf /!\ WARNING: - change the value of the SSH_AUTH_SOCK environment variable in your favorite shell configuration (.bashrc,.zshrc etc.) /!\ WARNING: export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) /!\ WARNING: gpgconf --launch gpg-agent /!\ WARNING: To cleanup the working directory (NOT done by default): /!\ WARNING: rm -rf /tmp/user//tmp.c26KOD8LdO ``` If you want to generate them in the persistent (expected) directory, use ```bash $ export GNUPGHOME=$HOME/.gnupg # To place in your shell config $ ./scripts/generate-gpg-key -d ~${GNUPGHOME} ``` ### Customization: add a photo and/or other identities Assuming you have a JPEG photo of you, you can attach it in your key with **addphoto** > Note: photographs must be in a JPG format and should be as small (in byte size) as possible. A reasonable rule is to make a picture that is no larger than 240 pixels wide by 288 pixels high, and a size less than 10,000 bytes. Use a face shot like you would with a passport photograph. ```bash # Collect the Master Key ID $ gpg -K --keyid-format 0xlong # vvvvvvvvvvvvvvvvvv sec rsa4096/0x3156CC64BB58247D [C] # <--- 0xlong version 6D1F481568A1D64F98BF228B3156CC64BB58247D # <--- exact version uid [ultimate] ssb rsa4096/0x48D1E2129D0CCEC6 [S] [expires: ] ssb rsa4096/0xEE74576ED76B1148 [E] [expires: ] ssb rsa4096/0x68E5153F63FA7B79 [A] [expires: ] # Fully automated version to collect KEYID $ KEYID=$(gpg --keyid-format long --with-colons --fingerprint $(git config --get user.email) | awk '{print $1}') # ... Edit the master key from its ID $ gpg --edit-key ${KEYID} # Note: you may rely purely on the email attached to the key with # gpg --edit-key $(git config --get user.email) # [...] gpg> addphoto Pick an image to use for your photo ID. The image must be a JPEG file. Remember that the image is stored within your public key. If you use a very large picture, your key will become very large as well! Keeping the image close to 240x288 is a good size to use. Enter JPEG filename for photo ID: ~/path/to/picture.jpeg # The photo will be displayed -- confirm it Is this photo correct (y/N/q)? y sec rsa4096/3156CC64BB58247D created: expires: never usage: C trust: ultimate validity: ultimate ssb rsa4096/48D1E2129D0CCEC6 created: expires: usage: S ssb rsa4096/EE74576ED76B1148 created: expires: usage: E ssb rsa4096/68E5153F63FA7B79 created: expires: usage: A gpg> save ``` To add another identity with **adduid**: ```bash # As above $ gpg --edit-key ${KEYID} # Note: you may rely purely on the email attached to the key with # gpg --edit-key $(git config --get user.email) gpg> adduid Real name: Email address: Comment: You selected this USER-ID: " " Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O sec rsa4096/3156CC64BB58247D created: expires: never usage: C trust: ultimate validity: ultimate ssb rsa4096/48D1E2129D0CCEC6 created: expires: usage: S ssb rsa4096/EE74576ED76B1148 created: expires: usage: E ssb rsa4096/68E5153F63FA7B79 created: expires: usage: A [ultimate] (1) [ultimate] (2) [jpeg image of size 4617] [ unknown] (3). gpg> save ``` Now if you check your key: ```bash $ gpg -K --keyid-format 0xlong # vvvvvvvvvvvvvvvvvv sec rsa4096/0x3156CC64BB58247D [C] # <--- long version 6D1F481568A1D64F98BF228B3156CC64BB58247D # <--- exact version uid [ultimate] uid [ultimate] [jpeg image of size 4617] uid [ultimate] ssb rsa4096/0x48D1E2129D0CCEC6 [S] [expires: ] ssb rsa4096/0xEE74576ED76B1148 [E] [expires: ] ssb rsa4096/0x68E5153F63FA7B79 [A] [expires: ] ``` ### ~~Customization: enforce stronger cryptography preferences.~~ **/!\ UPDATE (2023) does not seem required any more. defaults seems ok** By default, the encryption preferences specified in your public key are probably not as strong as they should be. Thus you should set stronger default security preferences (to use SHA512, AES256 and ZLIB by default) using the `setpref` command, *i.e.*: ```bash # As above $ gpg --edit-key ${KEYID} # Note: you may rely purely on the email attached to the key with # gpg --edit-key $(git config --get user.email) ``` See also [Gist: GPG Cheat Sheet and best practices ](https://gist.github.com/MorganGeek/5e6b89d351d34dfbc576db610b0c02e8) ## Transfer your GPG key to [Multiple] Yubikeys If you own security keys (such as yubikeys), it's time to transfer the generated keys to them! See (the excellent) [Dr Duh Yubikey guide](https://github.com/drduh/YubiKey-Guide#configure-smartcard) for detailed instructions. ## Enable SSH access using a GPG key for authentication Resources: * [blog: How to enable SSH access using a GPG key for authentication](https://opensource.com/article/19/4/gpg-subkeys-ssh) * [Gist: OpenPGP SSH access with Yubikey and GnuPG](https://gist.github.com/artizirk/d09ce3570021b0f65469cb450bee5e29) ### Setup (sshcontrol, gpg-agent etc.) This assumes you have a dedicated GPG subkey with authenticate capability (which is the case from the above scripted generation) ```bash $ gpg -K --keyid-format long --with-keygrip $(git config --get user.email) sec rsa4096/0x3156CC64BB58247D [C] 6D1F481568A1D64F98BF228B3156CC64BB58247D Keygrip = 6F165EAF3AF6A678A072841654E6702974A885B3 uid [ultimate] uid [ultimate] [jpeg image of size 4617] uid [ultimate] ssb rsa4096/0x48D1E2129D0CCEC6 [S] [expires: ] Keygrip = CC34AFAD18486AD790CCA9A708D858057F022FD2 ssb rsa4096/0xEE74576ED76B1148 [E] [expires: ] Keygrip = CBE87BF5CB84AE288E4829BE66B286FBCDFEAEAE ssb rsa4096/0x68E5153F63FA7B79 [A] [expires: ] # <-- Subkey we're interested to Keygrip = 47A0554C7508280F10E277B40186257857DD6E03 # <-- Associated Keygrip to put into ~/.gnupg/sshcontrol ``` Normally the `sshcontrol` file was already populated. othewise create it as follows: ```bash # /!\ ADAPT Keygrip accordingly - pay attention (again) to select your 'A' subkey echo "" > ~/.gnupg/sshcontrol ``` * To get **gpg-agent** to handle requests from SSH, you need to enable support by adding the line `enable-ssh-support` in `~/.gnupg/gpg-agent.conf` (already done in the provided configuration) * Then you need to tell SSH _how_ to access the **gpg-agent**. This is done by changing the value of the `SSH_AUTH_SOCK` environment variable. Add the following lines in your favorite shell configuration (`.bashrc`,`.zshrc` etc.): ```bash export GPG_TTY=$(tty) export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" gpgconf --launch gpg-agent ``` A more complete setup is provided in a dedicated script you can source in your favorite shell configuration (`.bashrc`,`.zshrc` etc.). In particular, you probably want to do the above only if `enable-ssh-support` is present in the `gpg-agent.conf` configuration file. You can check that it works as follows: ```bash # If GPG keys moved to Yubikey and Yubikey is absent $ ssh-add -L # Lists public key of all identities currently represented by the agent. The agent has no identities. # Plug [one of] your Yubikey(s) $ ssh-add -L ssh-rsa == cardno: ``` ### Save public key for identity file configuration So it's a good idea to extract the OpenPGP SSH public key which can be added (as "normal") in any server `~/.ssh/authorized_key` file. ```bash # remove the trailing comment cardno serial $ ssh-add -L | grep cardno | sed 's/\(cardno\):.*$/\1/' | tee ~/.ssh/id_rsa_openpgp_yubikey.pub ssh-rsa == cardno # /!\ IMPORTANT: put the same access rights you would put on an SSH private key or some ssh-agent wrappers may fail $ chmod 400 ~/.ssh/id_rsa_openpgp_yubikey.pub ``` As per [DrDuh Yubikey Guide on SSH](https://github.com/drduh/YubiKey-Guide#optional-save-public-key-for-identity-file-configuration): > By default, SSH attempts to use all the identities available via the agent. That's why when using the `IdentityFile` option in an ssh config, you typically point to a private key path. For the YubiKey - indeed, in general for keys stored in an ssh agent - `IdentityFile` should point to the *public* key file and `ssh` will select the appropriate private key from those available via the ssh agent. with `IdentitiesOnly yes`, `ssh` will not automatically enumerate public keys loaded into `ssh-agent` or `gpg-agent`. This means `publickey` authentication will not proceed unless explicitly named by `ssh -i [identity_file]` or in `.ssh/config` on a per-host basis. For instance with github: ```bash Host github.com IdentitiesOnly yes IdentityFile ~/.ssh/id_rsa_openpgp_yubikey.pub ``` Check that it works (after uploading the public key in yoru profile, : ```bash # Better have a 'journal -fax' running in parallel to detect TTY issue $ ssh git@github.com PTY allocation request failed on channel 0 Hi svarrette-anssi! You've successfully authenticated, but GitHub does not provide shell access. Connection to github.com closed. ``` *Note* **if you are using multiple yubikeys** to store the same GPG indentity (see [`yubikeys.md`](../yubikeys.md#transfer-your-gpg-keys-to-your-first-yubikey) ), repeat the same test with each yubikey to ensure it works just fine -- **recall to invoke [`yubi-switch`](https://github.com/Falkor/dotfiles/blob/master/oh-my-zsh/custom/plugins/falkor/falkor.plugin.zsh#L366) prior to running the ssh command**. ## GPG CLI Usage ~~~bash gpg --list-keys [pattern] # List available PGP key(s) gpg --keyserver keys.openpgp.org --search-keys # Search \& Import gpg --keyserver keys.openpgp.org --recv-keys # Import gpg --keyserver keys.openpgp.org --send-keys # Export to server ~~~ `/!\ IMPORTANT:` sending _encrypted_ mails to `user@domain.org` assumes that you **trust** his key, _i.e._ that you _sign_ (after careful check) this key (using GPG Keychain / GPA). ~~~bash gpg [-K] --fingerprint # Get (with -K) / Check fingerprint gpg --sign-key --ask-cert-level # Sign Key AFTER check gpg --keyserver keys.openpgp.org --send-keys # Send back signed key ~~~ Now if you want to encrypt / decrypt / digitally sign files: ~~~bash gpg --encrypt [-r ] # => .gpg rm -f # /!\ WARNING: encryption does not delete the input (clear-text) file gpg --decrypt .gpg # Decrypt PGP encrypted file gpg --armor --detach-sign # Generate signature file .asc ~~~ ## GPG Keychain / Keyring * Linux / Mac OS: `~/.gnupg/` * Windows: `C:\\Documents and Settings\\Application Data\gnupg\` More genrally, you can manage your secret data with a [system keyring](https://dev.to/setevoy/what-is-linux-keyring-gnome-keyring-secret-service-and-d-bus-4kgd), i.e. [Kwallet](https://utils.kde.org/projects/kwalletmanager/) or [`gnome-keyring`](https://wiki.gnome.org/Projects/GnomeKeyring) etc. For instance, to install `gnome-keyring` (on Debian systems (even when relying on KDE Plasma as it's way better supported than Kwallet -- see [blog](https://www.jwillikers.com/gnome-keyring-in-kde-plasma)) ```bash $ sudo apt install gnome-keyring seahorse # Autostart SSH and Secrets components of the GNOME keyring on login cp /etc/xdg/autostart/{gnome-keyring-secrets.desktop,gnome-keyring-ssh.desktop} ~/.config/autostart/ sed -i '/^OnlyShowIn.*$/d' ~/.config/autostart/gnome-keyring-secrets.desktop sed -i '/^OnlyShowIn.*$/d' ~/.config/autostart/gnome-keyring-ssh.desktop ``` ## Using GPG within git * Sign tags using your GPG key with the `-s` option - add Signed-off-by line by the committer using `-s` : `git commit -s [...]` - GPG sign commit with `-S`: `git commit -s -S [...]` - tag sign: `git tag -s ` * Assumes that you have configured git with your GPG signing key ID (typically into `~/.config/git/config.local`). Example below -- see also [my personal configuration](https://github.com/Falkor/dotfiles/blob/master/git/config.local.example) ~~~ini [user] name = Firstname Lastname email = firstname.lastname@domain.com signingkey = 0x [commit] gpgsign = true [tag] gpgsign = true ~~~ ## (old notes) Using GPG within Keybase.io * [Blog: GPG: Strong Keys, Rotation, and Keybase](https://sungo.wtf/2016/11/23/gpg-strong-keys-rotation-and-keybase.html) * [Playing with Keybase.io](http://nishanttotla.com/blog/playing-with-keybase-io/) * **Alternative to Keybase.io: [Keyoxide](https://keyoxide.org)** * Both rely on GPG Notations which can be added to user ID(s) and can be used to create [OpenPGP identity proofs](https://keyoxide.org/guides/openpgp-proofs). [Keybase.io](https://keybase.io) aims to make life with GPG easier. It does a really good job but it encourages a bad behavior in key management, _i.e._ by default, it creates and stores a private key on their server. We can never truly verify the condition of their server so a Keybase-hosted private key should always be considered untrustworthy. So we will configure [Keybase.io](https://keybase.io) to just use our existing key Install keybase: ~~~bash $> {apt | dnf | brew cask} install keybase ~~~ You can then configure the completion files on your system: * [Bash completion file](https://github.com/dtiersch/keybase-completion) -- see [Issue #147](https://github.com/keybase/keybase-issues/issues/147) in the Keybase Bugtracker * [ZSH completion file](https://github.com/rbirnie/oh-my-zsh-keybase/blob/master/keybase/_keybase) -- see [Issue #519](https://github.com/keybase/keybase-issues/issues/519) in the Keybase Bugtracker Now you can select your (local) gpg key and import the **public** key to Keybase.io (thus using the `--no-import` option). ~~~bash keybase pgp select --no-import # Algo Key Id Created UserId = ==== ====== ======= ====== 1 4096R [...] Choose a key: 1 ▶ INFO Bundle unlocked: ▶ INFO Generated new PGP key: ▶ INFO user: ▶ INFO 4096-bit RSA key, ID , created ▶ INFO Key imported ~~~ **Adding Trust Using Public Account** ~~~bash # prove that the twitter account @ really belongs to you $ keybase prove twitter # repeat for github, your web site etc... $ keybase prove github $ keybase prove web https:// ~~~ ## (Old notes) Using GPG within Git-crypt * [reference doc](https://www.agwa.name/projects/git-crypt/) * [Github project](https://github.com/AGWA/git-crypt) * [tutorial](http://www.starkandwayne.com/blog/secure-your-boshworkspace-with-git-crypt/) ### Installation ~~~bash # OSX brew install git-crypt # Debian/Ubuntu sudo apt-get install libssl-dev cd /tmp && wget https://github.com/AGWA/git-crypt/archive/0.5.0.zip unzip 0.5.0.zip && cd git-crypt-0.5.0/ make && sudo make install ~~~ ### Initial Repository Setup Configure/setup a repository to use `git-crypt` as follows: ```bash $ git-crypt init ``` This will generate a symmetric key for encrypting your files (stored in `.git/git-crypt/keys/default`). You need also to enable a git [pre-commit hook](https://git-scm.com/book/it/v2/Customizing-Git-Git-Hooks) to avoid accidentally adding unencrypted files -- see [issue #45](https://github.com/AGWA/git-crypt/issues/45). Example of such a pre-commit hook, to be placed as `.git/hooks/pre-commit` (in executable mode), can be found on [this gist](https://gist.github.com/Falkor/848c82daa63710b6c132bb42029b30ef) -- [raw version](https://gist.github.com/Falkor/848c82daa63710b6c132bb42029b30ef/raw/605a40d778c521e8993a316fa2568ad384fd06ff/pre-commit.git-crypt.sh) ```bash $ curl -o .git/hooks/pre-commit $ chmod +x .git/hooks/pre-commit ``` Now you can **share the repository with others (or with yourself) using GPG**: ```bash $ git-crypt add-gpg-user ``` This will create a encrypted version of the symmetric key and stores it in `.git-crypt/keys/default/0/.gpg`. Example: ~~~bash # Add yourself i.e. sign the encryption key with my GPG key and store it into '.git-crypt/' $> git-crypt add-gpg-user [master d91d341] Add 1 git-crypt collaborator 2 files changed, 3 insertions(+) create mode 100644 .git-crypt/.gitattributes> p create mode 100644 .git-crypt/keys/default/0/.gpg ~~~ This encrypted key can be decrypted by running: $> git-crypt unlock You can add as many collaborators as you wish. Note that since distributing keys can be cumbersome, the above mentioned [tutorial](http://www.starkandwayne.com/blog/secure-your-boshworkspace-with-git-crypt/) combines `git-crypt` with the [keybase.io](https://keybase.io/docs/command_line) service, which seems btw very promising however request some tests. ### Encrypted files configuration within `.gitattributes` Specify files/wildcard patterns to encrypt by creating a [`.gitattributes`](https://git-scm.com/docs/gitattributes) file at the root of the repository through the following format: ``` filter=git-crypt diff=git-crypt ``` Example: ~~~bash # # specify which files to encrypt using [git-crypt](https://www.agwa.name/projects/git-crypt/) # # Certificate private keys *.key filter=git-crypt diff=git-crypt # Host SSH private keys *ssh_*_key filter=git-crypt diff=git-crypt # runner config *.toml filter=git-crypt diff=git-crypt # Apache htaccess pasword protected *.htpasswd filter=git-crypt diff=git-crypt # specific apache vhost hosting LDAP binding credentials servers/gaia/www/etc/httpd/sites-available/default-ssl filter=git-crypt diff=git-crypt ~~~ Remember to commit the `.gitattributes` file. `/!\ IMPORTANT:` you should have **unlock** the repository before adding an encrypted file. Assuming you plan to add a `*.key` file (thus expected to be encrypted), proceed as follows: ~~~bash # Eventually unlock the repository $ git-crypt unlock $ echo 'secret' > secret.key $ git add secret.key $ git commit -s -m "add secret.key (encrypted) file" secret.key ~~~ Note that thanks to the pre-commit hook, in case you have forgotten to unlock the repository, the above commit command would fail as follows: ~~~bash $ git commit -s -m "add secret.key (encrypted) file" secret.key encrypted: secret.key *** WARNING: staged/committed version is NOT ENCRYPTED! *** Warning: one or more files is marked for encryption via .gitattributes but was staged and/or committed before the .gitattributes file was in effect. Run 'git-crypt status' with the '-f' option to stage an encrypted version. ~~~ So assuming you did well, you can commit the file and check that the content is indeed encrypted: ~~~bash $ git commit -s -m "add secret.key (encrypted) file" secret.key [master 9ae570f] add secret.key (encrypted) file 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 secret.key $ cat secret.key secret # Lock back the repository $ git-crypt lock $ cat secret.key GITCRYPT�ἅ�)&f\���Lp�<% ~~~ `/!\ IMPORTANT`: the pre-commit hook is a nice safeguard but **remains local** to your personal copy of the repository. In particular, it is **not shared** with you collaborator upon cloning operations. You'll typically need to integrate the setup of that hook through the `[m|r]ake setup` operation ## (Old notes) Using GPG for Password Management with `pass` Another nice git-based approach that team nicely with GPG relies on the `pass` utility and a carefully crafted git repository ### Password repository layout Passwords are meant to be stored into a git repository where each password is contained in a file, encrypted with GnuPG using public keys of all the allowed admins. The structure of the passwords repository is thus typically as follows: ~~~bash Password Store ├── admin_gnupg # GnuPG configuration directory for the password repository │   ├── gpg.conf # admin group definition │   ├── pubring # holds the administrator's public keys │   └── reencrypt.sh # facility script to re-encrypt every password when admin group changes ├── extra │   ├── ... │   └── twitter │   └── login.gpg # encrypted password to connect to twitter with login 'login' └── [...] ~~~ When possible, passwords should be stored with the following structure: ///.gpg ### Password management (the manual way) To display a password, you just need to decrypt the GPG-encrypted password, typically as follows: gpg -d extra/twitter/ULHPC.gpg To add a new encrypted password, use: GNUPGHOME=/admin_gnupg gpg -r admin -e -o extra/twitter/ULHPC.gpg Then, don't forget to git add/commit/push your changes. ### Password management using the [`pass` utility](http://zx2c4.com/projects/password-store/) _Pass_ is an utility to insert, display or copy to clipboard passwords stored into git repository. It is not mandatory to use it, but it eases password management. After installation (`brew install pass`), using pass requires two configuration steps: * Set the `PASSWORD_STORE_DIR` environment variable, which contains the path of the password repository: export PASSWORD_STORE_DIR= * Set the GNUPGHOME environement variable to the admin_gnupg subdirectory: export GNUPGHOME=$PASSWORD_STORE_DIR/admin_gnupg Then the CLI usage is summarized below: ~~~bash $ pass help # Pass usage $ pass git pull # Fetch latest passwords $ pass # List passwords $ pass extra/twitter/login # Display a password $ pass -c extra/twitter/login # Copy a password to clipboard $ pass insert extra/twitter/toto # Insert a new password $ pass git push # Push your changes ~~~ _Notes_: Git commit is done automatically by the `pass` utility. If you need to add comments in addition to the password, use the `-m` option to insert extra lines. ### Extra `pass` Utilities / commodities * Zsh/Bash completions: * Env sourcing (in your .zshrc): ```bash eval `/path/to/passwords-repo/.passrc` ``` * shell alias: ```pass alias pass='eval `/path/to/passwords-repo/.passrc` && pass' ``` ================================================ FILE: gnupg/dirmngr.conf ================================================ # Time-stamp: ################################################################################ # ~/.gnupg/dirmngr.conf: GnuPG's network access daemon configuration # _ _ __ # __| (_)_ __ _ __ ___ _ __ __ _ _ __ ___ ___ _ __ / _| # / _` | | '__| '_ ` _ \| '_ \ / _` | '__/ __/ _ \| '_ \| |_ # | (_| | | | | | | | | | | | | (_| | | | (_| (_) | | | | _| # \__,_|_|_| |_| |_| |_|_| |_|\__, |_|(_)___\___/|_| |_|_| # |___/ # Adapted from https://github.com/bfrg/gpg-guide/blob/master/dirmngr.conf # Since GnuPG 2.1 dirmngr takes care of OpenPGP keyservers. ################################################################################ # ┌───────────────────────────────────────────────────────────────────────────┐ # │ Key servers │ # └───────────────────────────────────────────────────────────────────────────┘ # Now managed by dirmngr # See https://frank.sauerburger.io/2020/01/15/openpgp-keyservers.html # Note: SKS peer mesh graphs: https://spider.pgpkeys.eu/graphs/ keyserver hkps://keys.openpgp.org #keyserver hkps://keyserver.ubuntu.com:443 #keyserver hkps://hkps.pool.sks-keyservers.net #keyserver hkps://pgp.ocf.berkeley.edu # Proxy to use for keyservers #keyserver-options http-proxy=http://127.0.0.1:8118 #keyserver-options http-proxy=socks5-hostname://127.0.0.1:9050 ================================================ FILE: gnupg/gpg-agent.conf ================================================ # Time-stamp: #################################################################################### # ~/.gnupg/gpg-agent.conf - Secret key management for GnuPG configuration # _ __ # __ _ _ __ __ _ __ _ __ _ ___ _ __ | |_ ___ ___ _ __ / _| # / _` | '_ \ / _` |_____ / _` |/ _` |/ _ \ '_ \| __| / __/ _ \| '_ \| |_ # | (_| | |_) | (_| |_____| (_| | (_| | __/ | | | |_ | (_| (_) | | | | _| # \__, | .__/ \__, | \__,_|\__, |\___|_| |_|\__(_)___\___/|_| |_|_| # |___/|_| |___/ |___/ # # Daemon to manage secret (private) keys independently from any protocol # The agent is automatically started on demand by gpg, gpgconf, or gpg-connect-agent # After changing the configuration, reload the agent with # gpg-connect-agent reloadagent /bye # # In case you want to use the included SSH Agent, you may start the agent using: # gpg-connect-agent /bye # # If you want to manually terminate the currently-running agent, you can safely # do so with: # gpgconf --kill gpg-agent # # Resources: # - https://github.com/bfrg/gpg-guide/blob/master/gpg-agent.conf # - https://github.com/drduh/config/blob/master/gpg-agent.conf # Documentation: # https://www.gnupg.org/documentation/manuals/gnupg/Agent-Options.html #################################################################################### ttyname $GPG_TTY default-cache-ttl 60 max-cache-ttl 120 # Select PIN entry program (qt, curses, gnome3,...) # Debian/Ubuntu; select default program with # sudo update-alternatives --config pinentry # pinentry-program /usr/bin/pinentry-curses # pinentry-program /usr/bin/pinentry-tty # pinentry-program /usr/bin/pinentry-gtk-2 # pinentry-program /usr/bin/pinentry-x11 # pinentry-program /usr/bin/pinentry-qt # pinentry-program /usr/local/bin/pinentry-curses # pinentry-program /usr/local/bin/pinentry-mac # pinentry-program /opt/homebrew/bin/pinentry-mac # ┌───────────────────────────────────────────────────────────────────────────┐ # │ Use GnuPG agent for SSH keys (instead of ssh-agent) │ # └───────────────────────────────────────────────────────────────────────────┘ # See also https://gist.github.com/artizirk/d09ce3570021b0f65469cb450bee5e29 enable-ssh-support # Time a SSH cache entry is valid # default-cache-ttl-ssh 600 # # Note: Make sure that gpg-agent is always started with login. # # This can be done by adding the following to ~/.bashrc or ~/.zshrc: # # Start gpg-agent if not already running # if ! pgrep -x -u "${USER}" gpg-agent &> /dev/null; then # gpg-connect-agent /bye &> /dev/null # fi # # Additionally add: # # Set SSH to use gpg-agent (see 'man gpg-agent', section EXAMPLES) # unset SSH_AGENT_PID # if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then # # export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh" # export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" # fi # # # Set GPG TTY as stated in 'man gpg-agent' # export GPG_TTY=$(tty) # # # Refresh gpg-agent tty in case user switches into an X session # gpg-connect-agent updatestartuptty /bye > /dev/null # # For more details, see https://wiki.archlinux.org/title/GnuPG#SSH_agent # # The above code is provided in gpg-agent.sh you can source in your favorite # shell config ================================================ FILE: gnupg/gpg.conf ================================================ # Time-stamp: ################################################################################ # ~/.gnupg/gpg.conf # ___ ____ ____ ____ ____ __ _ # / _ \ _ __ ___ _ __ | _ \ / ___| _ \ / ___|___ _ __ / _(_) __ _ # | | | | '_ \ / _ \ '_ \| |_) | | _| |_) | | | / _ \| '_ \| |_| |/ _` | # | |_| | |_) | __/ | | | __/| |_| | __/ | |__| (_) | | | | _| | (_| | # \___/| .__/ \___|_| |_|_| \____|_| \____\___/|_| |_|_| |_|\__, | # |_| |___/ # # Adapted from https://github.com/drduh/config/blob/master/gpg.conf # Documentation: # https://www.gnupg.org/documentation/manuals/gnupg/GPG-Configuration-Options.html # https://www.gnupg.org/documentation/manuals/gnupg/GPG-Esoteric-Options.html # 'gpg --version' to get capabilities ################################################################################ # ┌───────────────────────────────────────────────────────────────────────────┐ # │ Default key and recipient │ # └───────────────────────────────────────────────────────────────────────────┘ # Default/trusted key ID to use (helpful with throw-keyids) # Only useful if you have more than one secret key in your keyring #default-key 0x #trusted-key 0x # Group recipient keys (preferred ID last) #group keygroup = 0xFF00000000000001 0xFF00000000000002 0xFF3E7D88647EBCDB default-recipient-self # ┌───────────────────────────────────────────────────────────────────────────┐ # │ Algorithms and ciphers │ # └───────────────────────────────────────────────────────────────────────────┘ # Use AES256, 192, or 128 as cipher personal-cipher-preferences AES256 AES192 AES # Use SHA512, 384, or 256 as digest personal-digest-preferences SHA512 SHA384 SHA256 # Use ZLIB, BZIP2, ZIP, or no compression personal-compress-preferences ZLIB BZIP2 ZIP Uncompressed # Default preferences for new keys default-preference-list SHA512 SHA384 SHA256 AES256 AES192 AES ZLIB BZIP2 ZIP Uncompressed # SHA512 as digest to sign keys cert-digest-algo SHA512 # SHA512 as digest for symmetric ops s2k-digest-algo SHA512 # AES256 as cipher for symmetric ops s2k-cipher-algo AES256 # Disable obsolete algo disable-cipher-algo 3DES #Deactivated, because there are a lot of SHA-1 based signatures out there and we still need to support them for a little while longer. #weak-digest SHA1 # ┌───────────────────────────────────────────────────────────────────────────┐ # │ Behavior │ # └───────────────────────────────────────────────────────────────────────────┘ # UTF-8 support for compatibility charset utf-8 # Show Unix timestamps fixed-list-mode # No comments in signature no-comments # No version in output no-emit-version # Disable banner no-greeting # Long hexidecimal key format keyid-format 0xlong # Display UID validity list-options show-uid-validity verify-options show-uid-validity # Display all keys and their fingerprints with-fingerprint # Display key origins and updates #with-key-origin # Cross-certify subkeys are present and valid require-cross-certification # Disable caching of passphrase for symmetrical ops no-symkey-cache # Enable smartcard use-agent # Disable recipient key ID in messages #throw-keyids # Verbose output #verbose # Show expired subkeys #list-options show-unusable-subkeys # ┌───────────────────────────────────────────────────────────────────────────┐ # │ Key servers │ # └───────────────────────────────────────────────────────────────────────────┘ # Now managed by dirmngr -- see dirmngr.conf # ┌───────────────────────────────────────────────────────────────────────────┐ # │ SSH support │ # └───────────────────────────────────────────────────────────────────────────┘ ================================================ FILE: gnupg/scdaemon.conf ================================================ # Time-stamp: ################################################################################### # _ __ # ___ ___ __| | __ _ ___ _ __ ___ ___ _ __ ___ ___ _ __ / _| # / __|/ __/ _` |/ _` |/ _ \ '_ ` _ \ / _ \| '_ \ / __/ _ \| '_ \| |_ # \__ \ (_| (_| | (_| | __/ | | | | | (_) | | | || (_| (_) | | | | _| # |___/\___\__,_|\__,_|\___|_| |_| |_|\___/|_| |_(_)___\___/|_| |_|_| # ################################################################################### # Smartcard daemon for the GnuPG system # # Reminder: GnuPG Smart Card stack looks something like this # Yubikey -> pcscd -> scdaemon -> gpg-agent -> gpg commandline tool and other clients # # After any changes in this file, it's probably a good idea to restart your gpg-agent: # systemctl --user restart gpg-agent.service ### # https://support.yubico.com/hc/en-us/articles/4819584884124-Resolving-GPG-s-CCID-conflicts # logfile /tmp/scdaemon.log # debug-all # instruct scdaemon to use pcsc interface instead of the default direct connect mode. disable-ccid disable-application piv pcsc-shared pcsc-driver /usr/lib/x86_64-linux-gnu/libpcsclite.so.1 card-timeout 1 # Always try to use yubikey as the first reader # even when other smart card readers are connected # Name of the reader can be found using the pcsc_scan command # If you have problems with gpg not recognizing the Yubikey # then make sure that the string here matches exacly pcsc_scan # command output. Also check journalctl -f for errors. reader-port Yubico YubiKey ================================================ FILE: gnupg/scripts/generate-gpg-key ================================================ #! /bin/bash # Time-stamp: ############################################################################################ # ____ ____ ____ _ __ ____ _ _ # / ___| _ \ / ___| | |/ /___ _ _ / ___| ___ _ __ ___ _ __ __ _| |_(_) ___ _ __ # | | _| |_) | | _ | ' // _ \ | | | | | _ / _ \ '_ \ / _ \ '__/ _` | __| |/ _ \| '_ \ . # | |_| | __/| |_| | | . \ __/ |_| | | |_| | __/ | | | __/ | | (_| | |_| | (_) | | | | # \____|_| \____| |_|\_\___|\__, | \____|\___|_| |_|\___|_| \__,_|\__|_|\___/|_| |_| # |___/ # # copyright (c) S. Varrette # # Creates a new GPG keypair following recommended [ULHPC]/LAM best practices # # Usage: see generate-gpg-key -h ############################################################################################ # set -o errexit -o pipefail # FIXME breaks script at subkey_entry # cosmetics COLOR_BOLD="\033[1m" COLOR_VIOLET="\033[0;35m" COLOR_RESET="\033[0m" # Local variables # SCRIPTDIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" #TOP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && git rev-parse --show-toplevel)" CMD_PREFIX= # OPTS= GIT_AUTHOR_NAME="$(git config --get user.name)" GIT_AUTHOR_EMAIL="$(git config --get user.email)" # Default GPG algo GPG_ALGO=rsa4096 ################################################################################ info() { echo -e "${COLOR_BOLD}$*${COLOR_RESET}"; } error() { echo -e "${COLOR_BOLD}*** ERROR *** $*${COLOR_RESET}"; } warning() { echo -e "${COLOR_VIOLET}/!\\ WARNING:${COLOR_RESET} $*"; } print_error_and_exit() { error "$*"; exit 1; } usage() { cat < $(date +%F) [C] # Master key uid [ultimate] ssb rsa4096/ $(date +%F) [S] [expires: ] ssb rsa4096/ $(date +%F) [E] [expires: ] ssb rsa4096/ $(date +%F) [A] [expires: ] USAGE $(basename "$0") [-d /path/to/tmpdir] OPTIONS: -n --dry-run Dry run mode: (tries to) echo the commands to be run -a --algo ALGO Set sub key algorithm (Ex: rsa4086, ed25519). Default: ${GPG_ALGO}. See supported algorithms with 'gpg --with-colons --list-config curve' -d --dir DIR Set working directory (Default: random temporary directory) EXAMPLE $(basename "$0") $(basename "$0") -d ~/.gnupg You're free afterwards to import the GPG keys to your Yubikeys following for instance the following guide: https://github.com/drduh/YubiKey-Guide EOF } #### # ask to continue. exit 1 if the answer is no (actually starts with n|N*) ## really_continue() { echo -e -n "${COLOR_VIOLET}/!\\ WARNING:${COLOR_RESET} Are you sure you want to continue? [Y|n] " read -r ans case $ans in n*|N*) exit 1;; esac } print_current_gpg_key() { info "=== Current GPG key status ===" ${CMD_PREFIX} gpg -K --keyid-format 0xlong } ################################################################################ # Check for options while [ $# -ge 1 ]; do case $1 in -h | --help) usage; exit 0;; -n | --dry-run) CMD_PREFIX="echo";; -a | --algo) shift; GPG_ALGO="$1";; -d | --prefix | --*dir) shift; WORKDIR="$1";; *) # OPTS="$*"; break;; esac shift done # Safeguards [ -z "$(which gpg)" ] && print_error_and_exit "Unable to find gpg" [ -z "${GIT_AUTHOR_NAME}" ] && print_error_and_exit "Unable to get GIT_AUTHOR_NAME variable (from git config --get user.name)" [ -z "${GIT_AUTHOR_EMAIL}" ] && print_error_and_exit "Unable to get GIT_AUTHOR_EMAIL variable (from git config --get user.email)" [ -z "${WORKDIR}" ] && GNUPGHOME="$(mktemp -d)" || GNUPGHOME="${WORKDIR}" export GNUPGHOME info "Working directory: GNUPGHOME = ${GNUPGHOME}" ### Generating Master key MASTER_KEY_BATCH=${GNUPGHOME}/generate-master-key.batch if [ ! -f "${MASTER_KEY_BATCH}" ]; then info "=> generating batch file for the master key ${MASTER_KEY_BATCH}" cat > "${MASTER_KEY_BATCH}" << EOF %echo === Generating your GPG key === %echo -> Generating master key (for certification only) Key-Type: RSA Key-Length: 4096 # Key generated is a master key ("certificate") Key-Usage: cert # select a name and email address Name-Real: ${GIT_AUTHOR_NAME} Name-Email: ${GIT_AUTHOR_EMAIL} # Do not set the key to expire Expire-Date: 0 # Do a commit here, so that we can later print "done" :-) %commit %echo done EOF fi if [ ! -f "${GNUPGHOME}/pubring.kbx" ]; then info "=> generating master key" ${CMD_PREFIX} gpg --generate-key --batch "${MASTER_KEY_BATCH}" fi print_current_gpg_key ### Generatind dedicated subkeys (one per usage) info "=> collecting generated Key ID" KEYID=$(gpg --list-options show-only-fpr-mbox --list-secret-keys "${GIT_AUTHOR_EMAIL}" | awk '{print $1}' | head -n1) # Alternative way: # KEYID=$(gpg --keyid-format long --with-colons --fingerprint "${GIT_AUTHOR_EMAIL}" | grep pub | cut -d ':' -f 5 | head -n1) [ -z "${KEYID}" ] && print_error_and_exit "No KeyID collected... exiting" echo " Master Key ID for ${GIT_AUTHOR_EMAIL}: ${KEYID}" for type in sign encrypt auth; do subtype=${type:0:1} # echo " - checking '${type}' subkey (ssb format: '${subtype}')" subkey_entry="$(gpg --keyid-format long --with-colons -K "${GIT_AUTHOR_EMAIL}" | grep ssb | cut -d ':' -f 5,12 | grep -E ":${subtype}" | head -n1)" if [ -z "${subkey_entry}" ]; then info "=> Generating subkey for '${type}' usage" ${CMD_PREFIX} gpg --batch --quick-add-key "${KEYID}" "${GPG_ALGO}" "${type}" 1y else echo " ... found existing ${type} subkey (with ID: $(echo "${subkey_entry}" | cut -d':' -f1))" fi done print_current_gpg_key ### Backup your GPG keys GPG_EXPORT_DIR=${GNUPGHOME}/backup.d/${GIT_AUTHOR_EMAIL} GPG_PUBLIC_KEY=${GPG_EXPORT_DIR}/$(whoami).asc GPG_PRIVATE_KEY=${GPG_EXPORT_DIR}/private-key-$(whoami).asc GPG_PRIVATE_SUBKEY=${GPG_EXPORT_DIR}/private-subkeys-$(whoami).asc GPG_TRUSTDB=${GPG_EXPORT_DIR}/trustdb.txt GPG_REVOKE=${GNUPGHOME}/openpgp-revocs.d/${KEYID}.rev ${CMD_PREFIX} mkdir -p ${GPG_EXPORT_DIR} if [ ! -f "${GPG_PUBLIC_KEY}" ]; then info "=> exports/backup your public key" ${CMD_PREFIX} gpg --armor --export ${KEYID} > ${GPG_PUBLIC_KEY} fi if [ ! -f "${GPG_PRIVATE_KEY}" ]; then info "=> exports/backup your **private** master key" ${CMD_PREFIX} gpg --armor --export-secret-keys ${KEYID} > ${GPG_PRIVATE_KEY} ${CMD_PREFIX} chmod 400 ${GPG_PRIVATE_KEY} fi if [ ! -f "${GPG_PRIVATE_SUBKEY}" ]; then info "=> exports/backup your **private** subkeys" ${CMD_PREFIX} gpg --armor --export-secret-subkeys ${KEYID} > ${GPG_PRIVATE_SUBKEY} ${CMD_PREFIX} chmod 400 ${GPG_PRIVATE_SUBKEY} fi if [ -f "${GPG_REVOKE}" ]; then info "=> revocation cerfificate for OpenPGP (master) key ${KEYID}:" echo " ${GPG_REVOKE}" # else # info "=> generating revocation certificate for Key ID ${KEYID}" # ${CMD_PREFIX} gpg --output ${GPG_REVOKE} --gen-revoke ${KEYID} # warning "Better keep the $(basename ${GPG_REVOKE}) certificate file stored (or printed)" # warning "in a (secondary) place that allows retrieval in case the main backup fails." fi info "=> export GPG's trustDB to a text file" ${CMD_PREFIX} gpg --export-ownertrust > ${GPG_TRUSTDB} ### Prepare SSH usage via the GPG subkey with 'A' usage GPG_KEYGRIP_SUBKEY_A=$(gpg -K --keyid-format long --with-keygrip ${GIT_AUTHOR_EMAIL} | grep -A1 '\[A\]' | grep Keygrip | sed 's/.*Keygrip\s*=\s*//') GPG_SSHCONTROL=${GNUPGHOME}/sshcontrol if [ ! -f "${GPG_SSHCONTROL}" ]; then info "=> preparing for (optional) SSH support via the GPG subkey with 'A[uth]' usage" echo " assumes you specify the key to use in sshcontrol file via its keygrip internal identifier" echo " Current keygrips in use: (gpg -K --with-keygrip [...])" ${CMD_PREFIX} gpg -K --keyid-format long --with-keygrip ${GIT_AUTHOR_EMAIL} info " selected keygrip (subkey with 'A' usage): '${GPG_KEYGRIP_SUBKEY_A}'" info "=> creating ${GPG_SSHCONTROL}" echo "${GPG_KEYGRIP_SUBKEY_A}" > ${GPG_SSHCONTROL} warning "To get gpg-agent to handle requests from SSH, you still need to:" warning "- add 'enable-ssh-support' into \${GNUPGOME}/gpg-agent.conf" warning "- change the value of the SSH_AUTH_SOCK environment variable in your favorite shell configuration (.bashrc,.zshrc etc.)" warning " export SSH_AUTH_SOCK=\$(gpgconf --list-dirs agent-ssh-socket)" warning " gpgconf --launch gpg-agent" fi warning "To cleanup the working directory (NOT done by default):" warning " rm -rf ${GNUPGHOME}" #${CMD_PREFIX} rm -rf ${GNUPGHOME}/* ================================================ FILE: install.sh ================================================ #!/usr/bin/env bash # Time-stamp: ################################################################################ # _____ _ _ _ _ _ __ _ _ # | ___|_ _| | | _____ _ __( )___ __| | ___ | |_ / _(_) | ___ ___ # | |_ / _` | | |/ / _ \| '__|// __| / _` |/ _ \| __| |_| | |/ _ \/ __| # | _| (_| | | < (_) | | \__ \ | (_| | (_) | |_| _| | | __/\__ \ # |_| \__,_|_|_|\_\___/|_| |___/ \__,_|\___/ \__|_| |_|_|\___||___/ # ################################################################################ # Installation script for Falkor aka S.Varrette's dotfiles within the homedir of the # user running this script. # Adapted from the install script set for [ULHPC/dotfiles](https://github.com/ULHPC/dotfiles) #set -x # Debug ### Global variables VERSION=0.1 COMMAND=$(basename "$0") VERBOSE="" DEBUG="" SIMULATION="" UPDATE="" MODE="" FORCE="" ### displayed colors COLOR_GREEN="\033[0;32m" COLOR_RED="\033[0;31m" COLOR_YELLOW="\033[0;33m" COLOR_VIOLET="\033[0;35m" COLOR_BACK="\033[0m" ### Local variables SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DOTFILES_DIR=dotfiles.falkor.d [ -n "${XDG_CONFIG_HOME}" ] && PREFIX="${XDG_CONFIG_HOME}" || PREFIX="$HOME/.config" [ -n "${XDG_DATA_HOME}" ] && DATADIR="${XDG_DATA_HOME}" || DATADIR="$HOME/.local/share" [ "$COMMAND" == 'bash' ] && COMMAND="${PREFIX}/${DOTFILES_DIR}/install.sh" # List of available dotfiles -- now get by __set_falkor_dotfiles_available() #AVAILABLE_DOTFILES=$(find ${SCRIPTDIR}/ -mindepth 1 -maxdepth 1 -type d \( ! -iname '.*' \) -exec basename {} \; | grep -Ev '(bin|docs|screenshots|tests)' | xargs echo rvm ) AVAILABLE_DOTFILES= # GIT URLs OH_MY_ZSH_REPO="https://github.com/robbyrussell/oh-my-zsh.git" ZSH_THEME_POWERLEVEL9K_REPO="https://github.com/bhilburn/powerlevel9k.git" ZSH_THEME_POWERLEVEL10K_REPO="https://github.com/romkatv/powerlevel10k.git" # What to take care of (default is empty) WITH_SHELL="" # Common shell stuff WITH_BASH="" WITH_ZSH="" WITH_EMACS="" WITH_VIM="" WITH_GIT="" WITH_SCREEN="" WITH_BREW="" WITH_CURL="" WITH_RVM="" WITH_DIRENV="" # Default action ACTION="install" ####################### ### print functions ### ####################### ###### # Print information in the following form: '[$2] $1' ($2=INFO if not submitted) # usage: info text [title] ## info() { [ -z "$1" ] && print_error_and_exit "[${FUNCNAME[0]}] missing text argument" local text=$1 local title=$2 # add default title if not submitted but don't print anything [ -n "$text" ] && text="${title:==>} $text" echo -e "${COLOR_GREEN}$text${COLOR_BACK}" } debug() { [ -n "$DEBUG" ] && info "$1" "[${COLOR_YELLOW}DEBUG${COLOR_BACK}]"; } verbose() { [ -n "$VERBOSE" ] && info "$1"; } error() { info "$1" "[${COLOR_RED}ERROR${COLOR_BACK}]"; } warning() { info "$1" "[${COLOR_VIOLET}WARNING${COLOR_BACK}]"; } print_error_and_exit() { local text=$1 [ -z "$1" ] && text=" Bad format" error "$text. '$COMMAND -h' for help." exit 1 } print_version() { cat < REPORTING BUGS Please report bugs using the Issue Tracker of the project: COPYRIGHT This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. EOF } ######################### ### toolbox functions ### ######################### ##### # execute a local command # usage: execute command ### execute() { [ $# -eq 0 ] && print_error_and_exit "[${FUNCNAME[0]}] missing command argument" debug "[${FUNCNAME[0]}] $*" [ -n "${SIMULATION}" ] && echo "(simulation) $*" || eval "$*" local exit_status=$? debug "[${FUNCNAME[0]}] exit status: $exit_status" return $exit_status } #### # ask to continue. exit 1 if the answer is no # usage: really_continue text ## really_continue() { [ -n "${FORCE}" ] && return || true echo -e -n "[${COLOR_VIOLET}WARNING${COLOR_BACK}] $1 Are you sure you want to continue? [Y|n] " read ans case $ans in n*|N*) exit 1;; esac } ##### # Check availability of binaries passed as arguments on the current system # usage: check_bin prog1 prog2 ... ## check_bin() { [ $# -eq 0 ] && print_error_and_exit "[${FUNCNAME[0]}] missing argument" for appl in "$@"; do echo -n -e "=> checking availability of the command '$appl' on your system \t" local tmp=$(which $appl) [ -z "$tmp" ] && print_error_and_exit "Please install $appl or check \$PATH." || echo -e "[${COLOR_GREEN} OK ${COLOR_BACK}]" done } ### # Get the available dotfiles out of ## __set_falkor_dotfiles_available() { local path=${1:-${SCRIPTDIR}} AVAILABLE_DOTFILES=$(find ${path}/ -mindepth 1 -maxdepth 1 -type d \( ! -iname '.*' \) -exec basename {} \; | grep -Ev '(bin|docs|screenshots|tests)' | xargs echo rvm) } #### # Add (or remove) a given link pointing to the corresponding dotfile. # A backup of the file is performed if it previoiusly existed. # Upon removal, the link is deleted only if it targets the expected dotfile ## add_or_remove_link() { [ $# -lt 2 ] && print_error_and_exit "[${FUNCNAME[0]}] missing argument(s). Format: ${FUNCNAME[0]} []" local source=$1 local dst=$2 # prefix for the source local prefix=$3 # debug "source=$source" # debug "dst=$dst" # debug "prefix=$prefix" [ -n "${prefix}" ] && src="${prefix}/${source}" || src="${source}" # debug "src=$src" if [ "${MODE}" == "--delete" ]; then debug "removing dst='$dst' (if symlink pointing to src='$source' =? $(readlink "$dst"))" if [[ -h "${dst}" && "$(readlink "${dst}")" == "${source}" ]]; then warning "removing the symlink '$dst'" [ -n "${VERBOSE}" ] && really_continue execute "rm $dst" if [ -f "${dst}.bak" ]; then warning "restoring ${dst} from ${dst}.bak" execute "mv ${dst}.bak ${dst}" fi fi else # get rid of ../ in the path upon checking # real_srcpath=$(python -c "import os,sys; print os.path.abspath(sys.argv[1])" "${src}") real_srcpath=$(realpath ${src}) [ ! -e "${real_srcpath}" ] && print_error_and_exit "Unable to find the dotfile '${src}'\n(interpreted path: '${real_srcpath}')" #[ ! -e "${src}" ] && print_error_and_exit "Unable to find the dotfile '${src}'\n(interpreted path: '${real_srcpath}')" debug "attempt to add '$dst' symlink (pointing to '$source') if needed" # return if the symlink already exists [[ -h "${dst}" && "$(readlink "${dst}")" == "${source}" ]] && return if [ -e "${dst}" ]; then warning "The file '${dst}' already exists and will be backuped (as ${dst}.bak)" execute "mv ${dst}{,.bak}" fi execute "ln -sf ${source} ${dst}" fi } ### # Enable (or disable) a specific dotfile customization common to all shells # (bash, zsh...) ## shell_custom_enable() { local name=$1 local configdir="${PREFIX_HOME}${PREFIX}/shell" if [ "${ACTION}" == 'install' ]; then if [ ! -d "${configdir}" ]; then WITH_SHELL="--shell" __shell fi else configdir=${PREFIX_HOME}${INSTALL_DIR}/shell fi local src="${configdir}/available/${name}.sh" local dst="${configdir}/${name}.sh" add_or_remove_link "available/${name}.sh" "${configdir}/${name}.sh" "${configdir}" } add_or_remove_copy() { [ $# -ne 2 ] && print_error_and_exit "[${FUNCNAME[0]}] missing argument(s). Format: ${FUNCNAME[0]} " local src=$1 local dst=$2 [ ! -f "${src}" ] && print_error_and_exit "Unable to find the dotfile '${src}'" if [ "${MODE}" == "--delete" ]; then debug "removing dst='${dst}'" if [[ -f $dst ]]; then warning "removing the file '$dst'" [ -n "${VERBOSE}" ] && really_continue "$@" execute "rm ${dst}" if [ -f "${dst}.bak" ]; then warning "restoring ${dst} from ${dst}.bak" execute "mv ${dst}.bak ${dst}" fi fi else debug "copying '$dst' from '$src'" check_bin shasum # return if the symlink already exists local checksum_src=$(shasum "${src}" | cut -d ' ' -f 1) local checksum_dst=$(shasum "${dst}" | cut -d ' ' -f 1) if [ "${checksum_src}" == "${checksum_dst}" ]; then echo " - NOT copying '$dst' from '$src' since they are the same files" return fi if [ -f "${dst}" ]; then warning "The file '$dst' already exists and will be backuped (as ${dst}.bak)" execute "cp ${dst}{,.bak}" fi execute "cp ${src} ${dst}" fi } # install_ohmyzsh() { # check_bin zsh # local omzsh_dir="${DATADIR}/oh-my-zsh" # if [ ! -d "${omzsh_dir}" ]; then # info "installing Oh-My-ZSH in ${DATADIR} -- see http://ohmyz.sh/" # # installation by curl if available # if [ -n "$(which curl)" ]; then # echo " - installation using curl" # warning " " # warning "Remember to Exit the zsh shell to continue the installation!!!" # warning " " # [ -z "${SIMULATION}" ] && sh -c "$(ZSH=${omzsh_dir} curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" # elif [ -n "$(which wget)" ]; then # echo " - installation using wget" # [ -z "${SIMULATION}" ] && sh -c "$(ZSH=${omzsh_dir} wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" # else # print_error_and_exit "Unable to install oh-my-zsh/. You shall install 'curl' or 'wget' on your system" # fi # fi # } # install_custom_ohmyzsh() { # info "installing Falkor custom plugins for oh-my-zsh/" # local customdir="$HOME/.oh-my-zsh/custom/" # #local falkor_customdir="${INSTALL_DIR}/oh-my-zsh/custom" # local falkor_customdir="${PREFIX_HOME}${PREFIX}/zsh/custom" # [ ! -h "${customdir}/.ref" ] && execute "ln -s ${falkor_customdir} ${customdir}/.ref" # for f in `ls ${falkor_customdir}/*.zsh`; do # ff="$(basename $f)" # if [ ! -h "${customdir}/$ff" ]; then # echo " - add custom '$ff'" # execute "ln -s .ref/$ff ${customdir}/$ff" # fi # done # local private_aliases="${customdir}/private_aliases.zsh" # if [ ! -f "${private_aliases}" ]; then # cat << 'EOF' > ${private_aliases} # # # # private_aliases.zsh # # # # Add your local (private) aliases for zsh here. # EOF # fi # local plugindir="${customdir}/plugins" # local falkor_plugindir="${falkor_customdir}/plugins" # [ ! -h "${plugindir}/.ref" ] && execute "ln -s ../.ref/plugins ${plugindir}/.ref" # for d in `ls -d ${falkor_plugindir}/*`; do # dd=`basename $d` # if [ ! -h "${plugindir}/$dd" ]; then # echo " - installing custom oh-my-zsh plugin '$dd'" # execute "ln -s .ref/$dd ${plugindir}/$dd" # fi # done # local themedir="${customdir}/themes" # [ ! -d "${themedir}" ] && execute "mkdir -p ${customdir}/themes" # local falkor_themedir="${falkor_customdir}/themes" # [ ! -h "${themedir}/.ref" ] && execute "ln -s ../.ref/themes ${themedir}/.ref" # for d in `ls -d ${falkor_themedir}/*`; do # dd=`basename $d` # if [ ! -h "${themedir}/$dd" ]; then # echo " - installing custom oh-my-zsh theme '$dd'" # execute "ln -s .ref/$dd ${themedir}/$dd" # fi # done # # } # courtesy of https://github.com/holman/dotfiles/blob/master/script/bootstrap setup_gitconfig_local () { local gitconfig_local=${1:-"${PREFIX_HOME}${PREFIX}/git/config.local"} local dotfile_gitconfig_local="${PREFIX_HOME}${INSTALL_DIR}/git/$(basename ${gitconfig_local})" if [ -f "${dotfile_gitconfig_local}" ]; then #add_or_remove_link "${dotfile_gitconfig_local}" "${gitconfig_local}" return fi if [ ! -f "${gitconfig_local}" ]; then info "setup Local/private gitconfig '${gitconfig_local}'" [ -n "${SIMULATION}" ] && return cat > $gitconfig_local <<'EOF' # -*- mode: gitconfig; -*- ################################################################################ # [.git]config.local -- Private part of the GIT configuration # . to hold username / credentials etc . # NOT meant to be staged for commit under github # __ _ _ __ __ _ _ _ # | _| __ _(_) ||_ | ___ ___ _ __ / _(_) __ _ | | ___ ___ __ _| | # | | / _` | | __| |/ __/ _ \| '_ \| |_| |/ _` | | |/ _ \ / __/ _` | | # | || (_| | | |_| | (_| (_) | | | | _| | (_| |_| | (_) | (_| (_| | | # | (_)__, |_|\__| |\___\___/|_| |_|_| |_|\__, (_)_|\___/ \___\__,_|_| # |__||___/ |__| |___/ # # See also: http://github.com/Falkor/dotfiles ################################################################################ EOF local git_credential='cache' local git_authorname= local git_email= if [ "$(uname -s)" == "Darwin" ]; then git_authorname=$(dscl . -read /Users/$(whoami) RealName | tail -n1) git_credential='osxkeychain' elif [ "$(uname -s)" == "Linux" ]; then git_authorname=$(getent passwd $(whoami) | cut -d ':' -f 5 | cut -d ',' -f 1) fi [ -n "${GIT_AUTHOR_NAME}" ] && git_authorname="${GIT_AUTHOR_NAME}" [ -n "${GIT_AUTHOR_EMAIL}" ] && git_email="${GIT_AUTHOR_EMAIL}" if [ -z "${git_authorname}" ]; then echo -e -n "[${COLOR_VIOLET}WARNING${COLOR_BACK}] Enter you Git author name: " read -e git_authorname fi if [ -z "${git_email}" ]; then echo -e -n "[${COLOR_VIOLET}WARNING${COLOR_BACK}] Enter you Git author (${git_authorname}) email: " read -e git_email fi cat >> $gitconfig_local </dev/null) if [ $? -eq 0 ]; then echo -e -n "[${COLOR_VIOLET}WARNING${COLOR_BACK}] Make '${PREFIX_HOME}${INSTALL_DIR}' a symlink to ${SCRIPTDIR} [Y|n]? " ans='Yes' [ -z "${FORCE}" ] && read ans || true case $ans in n*|N*) ;; *) add_or_remove_link "${SCRIPTDIR}" "${PREFIX_HOME}${INSTALL_DIR}"; ;; esac fi fi # Final fallback solution: clone it (in recursive mode to collect all submodules) if [ ! -e "${PREFIX_HOME}${INSTALL_DIR}" ]; then info "Cloning Falkor dotfiles in '${PREFIX_HOME}${INSTALL_DIR}'"; execute "git clone -q https://github.com/Falkor/dotfiles.git ${PREFIX_HOME}${INSTALL_DIR}"; execute "cd ${PREFIX_HOME}${INSTALL_DIR} && git submodule init" execute "cd ${PREFIX_HOME}${INSTALL_DIR} && git submodule update" fi __set_falkor_dotfiles_available "${PREFIX_HOME}${INSTALL_DIR}" } ## Try to change the current shell to $1 if needed using chsh __change_user_shell() { local target=${1:-bash} local current_shell=$(expr "$SHELL" : '.*/\(.*\)') local real_target=$(grep /${target}$ /etc/shells | tail -1) if [ "${current_shell}" != "${target}" ]; then check_bin chsh warning "Attempt to change current shell (${current_shell}) to ${target} (actually ${real_target})" really_continue execute "chsh -s ${real_target}" fi } ### # Utility function to bootstrap (or clean) a specific dotfile # configuration directory # Usage: __setup_or_clean_configdir '' '' # where: # - is a dotfile directory (under ~/.config/dotfiles.falkor.d/) # - is [ 'install', 'uninstall'] ## __setup_or_clean_configdir() { [ $# -ne 2 ] && print_error_and_exit "[${FUNCNAME[0]}] missing command argument" local name=$1 local action=$2 local shortname=${name} [ "${name}" == 'oh-my-zsh' ] && shortname='zsh' [ ! -d "${PREFIX_HOME}${INSTALL_DIR}/${name}" ] && return if [ "${ACTION}" == "${action}" ]; then add_or_remove_link "${DOTFILES_DIR}/${name}" "${PREFIX_HOME}${PREFIX}/${shortname}" "${PREFIX_HOME}${PREFIX}" fi } setup_configdir() { __setup_or_clean_configdir "$1" 'install' } clean_configdir() { __setup_or_clean_configdir "$1" 'uninstall' } ## Install common shell configs __shell(){ [ -z "${WITH_SHELL}" ] && return info "${ACTION} Common Shell configuration ~/.config/shell/" setup_configdir 'shell' # for n in ${SCRIPTDIR}/shell/available/*.sh; do # name=$(basename ${n} .sh) # if [[ "${AVAILABLE_DOTFILES}" == *${name}* ]]; then # warning "skipping ${name} custom shell setup as it comes bundled separately" # continue # fi # shell_custom_enable "${name}" # done clean_configdir 'shell' } ## Install/remove specific dotfiles __bash(){ [ -z "${WITH_BASH}" ] && return info "${ACTION} Falkor's Bourne-Again shell (Bash) configuration ~/.bashrc ~/.inputrc ~/.bash_profile" setup_configdir 'bash' add_or_remove_link "${PREFIX}/bash/.bashrc" ~/.bashrc "${PREFIX_HOME}" add_or_remove_link "${PREFIX}/bash/.inputrc" ~/.inputrc "${PREFIX_HOME}" add_or_remove_link "${PREFIX}/bash/.bash_profile" ~/.bash_profile info "${ACTION} custom aliases from Falkor's Oh-My-ZSH plugin (made compatible with bash) ~/${PREFIX}/bash/custom/aliases.sh" add_or_remove_link "${PREFIX_HOME}${INSTALL_DIR}/oh-my-zsh/custom/plugins/falkor/falkor.plugin.zsh" "${PREFIX_HOME}${PREFIX}/bash/custom/aliases.sh" clean_configdir 'bash' __shell } # Zsh __zsh(){ [ -z "${WITH_ZSH}" ] && return info "${ACTION} Falkor's ZSH / Oh-My-ZSH configuration" check_bin zsh setup_configdir 'oh-my-zsh' # specific Oh-my-zsh config dirs local omzsh_dir="${DATADIR}/oh-my-zsh" local configdir="${PREFIX}/zsh" local omzsh_custom_dir="${configdir}/custom" local omzsh_custom_theme_dir="${configdir}/themes" # falkor's dotfiles config dirs for ZSH local zsh_dir="${PREFIX_HOME}${PREFIX}/zsh" local zsh_custom_dir="${zsh_dir}/custom" local zsh_custom_theme_dir="${zsh_custom_dir}/themes" powerlevel10k_themedir="${zsh_custom_theme_dir}/powerlevel10k" # Let's go add_or_remove_link "${PREFIX}/zsh/.zshenv" ~/.zshenv "${PREFIX_HOME}" if [ "${ACTION}" == "install" ]; then if [ ! -d "${omzsh_dir}" ]; then check_bin git execute "git clone ${OH_MY_ZSH_REPO} ${omzsh_dir}" || print_error_and_exit "Unable to install oh-my-zsh/. Check your network connection" fi # Powerlevel10k should be a submodule of the dotfile if [ ! -f "${powerlevel10k_themedir}/.git" ]; then echo "=> '${powerlevel10k_themedir}/.git'" echo $(test -d "${powerlevel10k_themedir}/.git") info "updating (expected) git submodule for powerlevel10k theme" execute "cd ${PREFIX_HOME}${INSTALL_DIR} && git submodule init" execute "cd ${PREFIX_HOME}${INSTALL_DIR} && git submodule update" fi __change_user_shell 'zsh' else [ -d "${omzsh_dir}" ] && execute "rm -rf ${omzsh_dir}" || true __change_user_shell 'bash' fi clean_configdir 'oh-my-zsh' __shell } # GNU Emacs __emacs(){ [ -z "${WITH_EMACS}" ] && return info "${ACTION} Falkor's Emacs configuration" warning "For performance reason, make this installation independently following instructions on" warning " https://github.com/Falkor/spacemacs " # add_or_remove_link $INSTALL_DIR/emacs ~/.emacs.d # add_or_remove_link ~/.emacs.d/.emacs ~/.emacs } # VI iMproved ([m]Vim) __vim(){ [ -z "${WITH_VIM}" ] && return info "${ACTION} Falkor's VIM configuration" setup_configdir 'vim' shell_custom_enable 'vim' if [ "${MODE}" != "--delete" ]; then warning "To use effectively this vim configuration, you need to export VIMINIT" warning "as done in ~/${PREFIX}/shell/vim.sh : " warning " " warning " export VIMINIT='let \$MYVIMRC=\"\$XDG_CONFIG_HOME/vim/vimrc\" | source \$MYVIMRC'" warning " " fi clean_configdir 'vim' } # Git __git(){ [ -z "${WITH_GIT}" ] && return info "${ACTION} Falkor's Git configuration ~/.gitconfig[.local]" setup_configdir 'git' [ "${ACTION}" != "install" ] && setup_gitconfig_local clean_configdir 'git' } ## GNU Screen __screen(){ [ -z "${WITH_SCREEN}" ] && return info "${ACTION} ULHPC GNU Screen configuration ~/.screenrc" setup_configdir 'screen' add_or_remove_link "${PREFIX}/screen/.screenrc" ~/.screenrc "${PREFIX_HOME}" clean_configdir 'screen' } ## HomeBrew -- http://brew.sh __brew(){ [ -z "${WITH_BREW}" -o "$(uname -s)" == "Darwin" -o "${ACTION}" != "install" ] && return [ -z "$(which brew)" ] && return brewfile="${INSTALL_DIR}/brew/Brewfile" [ ! -f "${brewfile}" ] && print_error_and_exit "Unable to find the Brew file '${brewfile}'" info "${ACTION} Brew Bundle configuration from '${brewfile}'" execute "brew tap Homebrew/bundle" # Install brew bundle -- see https://github.com/Homebrew/homebrew-bundle execute "brew bundle --file=${brewfile} -v" } ## Curl -- https://curl.haxx.se __curl() { [ -z "${WITH_CURL}" ] && return [ -z "$(which curl)" ] && return info "${ACTION} CURL configuration" setup_configdir 'curl' shell_custom_enable 'curl' clean_configdir 'curl' } # Direnv -- see http://direnv.net __direnv(){ [ -z "${WITH_DIRENV}" ] && return info "${ACTION} Falkor's direnv configuration ~/.config/direnv/direnvrc" setup_configdir 'direnv' clean_configdir 'direnv' } ## RVM -- see https://rvm.io/rvm/install __rvm(){ [ -z "${WITH_RVM}" ] && return info "${ACTION} RVM -- see https://rvm.io/rvm/install" if [ "${ACTION}" != 'install' ]; then [ -z "$(which rvm)" ] && warning "Unable to find the rvm command thus exiting" && return execute "rvm implode" execute "gem uninstall rvm" return # Exiting uninstall fi if [ ! -d "$HOME/.rvm" ]; then execute "gpg --keyserver hkp://keys.gnupg.net --keyserver-options timeout=5 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3" check_bin 'curl' execute "\curl -sSL https://get.rvm.io | bash -s stable --ignore-dotfiles --with-default-gems='bundler rake git_remote_branch'" fi } ################################################################################ ################################################################################ # Let's go TARGETS= # Check for options while [ $# -ge 1 ]; do case $1 in -h | --help) print_help; exit 0;; -V | --version) print_version; exit 0;; --debug) DEBUG="--debug"; VERBOSE="--verbose";; -v | --verbose) VERBOSE="--verbose";; -f | --force) FORCE="--force";; -n | --dry-run) SIMULATION="--dry-run";; -u | --update) UPDATE="--update";; --delete | --remove | --uninstall) ACTION="uninstall"; MODE="--delete";; # -d | --dir | --installdir) # shift; # INSTALL_DIR=$1 # # DOTFILES_DIR=$(basename ${INSTALL_DIR}) # # PREFIX=$(dirname ${INSTALL_DIR}) # ;; # --dotfiledir) shift; DOTFILES_DIR=$1;; --prefix) shift; PREFIX=$1;; --with-bash | --bash) TARGETS+='--bash';; --with-direnv| --direnv) TARGETS+='--direnv';; --with-zsh | --zsh) TARGETS+='--zsh';; --with-shell | --shell) TARGETS+='--shell';; --with-emacs | --emacs) TARGETS+='--emacs';; --with-vim | --vim) TARGETS+='--vim';; --with-git | --git) TARGETS+='--git';; --with-screen| --screen) TARGETS+='--screen';; --with-brew | --brew) TARGETS+='--brew';; --with-curl | --curl) TARGETS+='--curl';; --with-rvm | --rvm) TARGETS+='--curl --rvm';; -r | --recommended) TARGETS+='--bash --vim --git --screen --curl';; -a | --all) TARGETS+='--bash --brew --zsh --emacs --vim --git --screen --curl --rvm';; esac shift done debug "SCRIPTDIR=${SCRIPTDIR}" PREFIX_HOME='' if [[ $PREFIX == "${HOME}"* ]]; then PREFIX_HOME="$HOME/" PREFIX="${PREFIX/#$HOME\//}" fi INSTALL_DIR=${PREFIX}/${DOTFILES_DIR} [ -z "${INSTALL_DIR}" ] && print_error_and_exit "Wrong installation directory" setup_installdir info "About to ${ACTION} Falkor's dotfiles from ${INSTALL_DIR}" really_continue # Update the repository if already present [[ -n "${UPDATE}" && -d "${PREFIX_HOME}${INSTALL_DIR}" ]] && execute "( cd ${PREFIX_HOME}${INSTALL_DIR} ; git pull )" cd ~ if [ -z "${TARGETS}" ]; then warning " " warning "By default, this installer does nothing except updating ${INSTALL_DIR}." warning "Use '$COMMAND --all' to install all available configs. OR use a discrete set of options." warning "Ex: '$COMMAND $MODE --zsh --vim'" warning " " exit 0 fi for target in ${TARGETS}; do case $target in *bash*) WITH_SHELL='--shell'; WITH_BASH="$target"; __bash;; *brew*) WITH_BREW="$target"; __brew;; *curl*) WITH_CURL="$target"; __curl;; *direnv*) WITH_DIRENV="$target"; __direnv;; *emacs*) WITH_EMACS="$target"; __emacs;; *git*) WITH_GIT="$target"; __git;; *rvm*) WITH_RVM="$target"; __rvm;; *screen*) WITH_SCREEN="$target"; __screen;; *shell*) WITH_SHELL="$target"; __shell;; *vim*) WITH_VIM="$target"; __vim;; *zsh*) WITH_SHELL='--shell'; WITH_ZSH="$target"; __zsh;; esac done ================================================ FILE: mkdocs.yml ================================================ site_name: Falkor/dotfiles pages: - Home: 'index.md' - Overview and Installation: 'overview.md' - Shells: - Bourne-Again Shell (bash): 'bash/README.md' - Z-shell (zsh) / Oh-My-ZSH: 'oh-my-zsh/README.md' - Editors: - VIm: 'vim/README.md' - Emacs: 'emacs/index.md' - Misc: - Git: 'git/README.md' - GNU Screen: 'screen/README.md' - Tests with Vagrant: 'vagrant.md' - Documentation (RTFD): 'rtfd.md' - Contributing: - 'Overview': 'contributing/index.md' - 'Directory Layout': 'contributing/layout.md' - 'Repository Setup and Developments': 'contributing/setup.md' - 'Semantic Versioning': 'contributing/versioning.md' theme: readthedocs ================================================ FILE: oh-my-zsh/.gitignore ================================================ .zcompdump* /custom.zshenv /custom.zshrc .zsh_history ================================================ FILE: oh-my-zsh/.p10k.zsh ================================================ # Generated by Powerlevel10k configuration wizard on 2020-12-23 at 12:00 CET. # Based on romkatv/powerlevel10k/config/p10k-rainbow.zsh, checksum 21088. # Wizard options: nerdfont-complete + powerline, small icons, rainbow, unicode, # slanted separators, slanted heads, slanted tails, 2 lines, disconnected, left frame, # lightest-ornaments, compact, many icons, concise, instant_prompt=verbose. # Type `p10k configure` to generate another config. # # Config for Powerlevel10k with powerline prompt style with colorful background. # Type `p10k configure` to generate your own config based on it. # # Tip: Looking for a nice color? Here's a one-liner to print colormap. # # for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done # Temporarily change options. 'builtin' 'local' '-a' 'p10k_config_opts' [[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases') [[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob') [[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand') 'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' () { emulate -L zsh -o extended_glob # Unset all configuration options. This allows you to apply configuration changes without # restarting zsh. Edit ~/.p10k.zsh and type `source ~/.p10k.zsh`. unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR' # Zsh >= 5.1 is required. autoload -Uz is-at-least && is-at-least 5.1 || return # The list of segments shown on the left. Fill it with the most important segments. typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( # =========================[ Line #1 ]========================= os_icon # os identifier dir # current directory vcs # git status # =========================[ Line #2 ]========================= newline # \n # prompt_char # prompt symbol ) # The list of segments shown on the right. Fill it with less important segments. # Right prompt on the last prompt line (where you are typing your commands) gets # automatically hidden when the input line reaches it. Right prompt above the # last prompt line gets hidden if it would overlap with left prompt. typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( # =========================[ Line #1 ]========================= status # exit code of the last command command_execution_time # duration of the last command background_jobs # presence of background jobs direnv # direnv status (https://direnv.net/) asdf # asdf version manager (https://github.com/asdf-vm/asdf) virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html) anaconda # conda environment (https://conda.io/) pyenv # python environment (https://github.com/pyenv/pyenv) goenv # go environment (https://github.com/syndbg/goenv) nodenv # node.js version from nodenv (https://github.com/nodenv/nodenv) nvm # node.js version from nvm (https://github.com/nvm-sh/nvm) nodeenv # node.js environment (https://github.com/ekalinin/nodeenv) # node_version # node.js version # go_version # go version (https://golang.org) # rust_version # rustc version (https://www.rust-lang.org) # dotnet_version # .NET version (https://dotnet.microsoft.com) # php_version # php version (https://www.php.net/) # laravel_version # laravel php framework version (https://laravel.com/) # java_version # java version (https://www.java.com/) # package # name@version from package.json (https://docs.npmjs.com/files/package.json) rbenv # ruby version from rbenv (https://github.com/rbenv/rbenv) rvm # ruby version from rvm (https://rvm.io) fvm # flutter version management (https://github.com/leoafarias/fvm) luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv) jenv # java version from jenv (https://github.com/jenv/jenv) plenv # perl version from plenv (https://github.com/tokuhirom/plenv) phpenv # php version from phpenv (https://github.com/phpenv/phpenv) scalaenv # scala version from scalaenv (https://github.com/scalaenv/scalaenv) haskell_stack # haskell version from stack (https://haskellstack.org/) kubecontext # current kubernetes context (https://kubernetes.io/) terraform # terraform workspace (https://www.terraform.io) aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) aws_eb_env # aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) azure # azure account name (https://docs.microsoft.com/en-us/cli/azure) gcloud # google cloud cli account and project (https://cloud.google.com/) google_app_cred # google application credentials (https://cloud.google.com/docs/authentication/production) context # user@hostname nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) ranger # ranger shell (https://github.com/ranger/ranger) nnn # nnn shell (https://github.com/jarun/nnn) vim_shell # vim shell indicator (:sh) midnight_commander # midnight commander shell (https://midnight-commander.org/) nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) vi_mode # vi mode (you don't need this if you've enabled prompt_char) # vpn_ip # virtual private network indicator # load # CPU load # disk_usage # disk usage # ram # free RAM # swap # used swap todo # todo items (https://github.com/todotxt/todo.txt-cli) timewarrior # timewarrior tracking status (https://timewarrior.net/) taskwarrior # taskwarrior task count (https://taskwarrior.org/) # time # current time # =========================[ Line #2 ]========================= newline # ip # ip address and bandwidth usage for a specified network interface # public_ip # public IP address # proxy # system-wide http/https/ftp proxy # battery # internal battery # wifi # wifi speed # example # example user-defined segment (see prompt_example function below) ) # Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you. typeset -g POWERLEVEL9K_MODE=nerdfont-complete # When set to `moderate`, some icons will have an extra space after them. This is meant to avoid # icon overlap when using non-monospace fonts. When set to `none`, spaces are not added. typeset -g POWERLEVEL9K_ICON_PADDING=none # When set to true, icons appear before content on both sides of the prompt. When set # to false, icons go after content. If empty or not set, icons go before content in the left # prompt and after content in the right prompt. # # You can also override it for a specific segment: # # POWERLEVEL9K_STATUS_ICON_BEFORE_CONTENT=false # # Or for a specific segment in specific state: # # POWERLEVEL9K_DIR_NOT_WRITABLE_ICON_BEFORE_CONTENT=false typeset -g POWERLEVEL9K_ICON_BEFORE_CONTENT= # Add an empty line before each prompt. typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=false # Connect left prompt lines with these symbols. You'll probably want to use the same color # as POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND below. typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='%244F╭─' typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX='%244F├─' typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX='%244F╰─❯' # Connect right prompt lines with these symbols. typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX= typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX= typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX= # Filler between left and right prompt on the first prompt line. You can set it to ' ', '·' or # '─'. The last two make it easier to see the alignment between left and right prompt and to # separate prompt from command output. You might want to set POWERLEVEL9K_PROMPT_ADD_NEWLINE=false # for more compact prompt if using using this option. typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_BACKGROUND= typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_GAP_BACKGROUND= if [[ $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR != ' ' ]]; then # The color of the filler. You'll probably want to match the color of POWERLEVEL9K_MULTILINE # ornaments defined above. typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=244 # Start filler from the edge of the screen if there are no left segments on the first line. typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_FIRST_SEGMENT_END_SYMBOL='%{%}' # End filler on the edge of the screen if there are no right segments on the first line. typeset -g POWERLEVEL9K_EMPTY_LINE_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='%{%}' fi # Separator between same-color segments on the left. typeset -g POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='\u2571' # Separator between same-color segments on the right. typeset -g POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR='\u2571' # Separator between different-color segments on the left. typeset -g POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='\uE0BC' # Separator between different-color segments on the right. typeset -g POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='\uE0BA' # The right end of left prompt. # typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0BC' typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0B0' # The left end of right prompt. typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0BA' # typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0B2' # The left end of left prompt. typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0BA' # The right end of right prompt. typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0BC' # Left prompt terminator for lines without any segments. typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL= #################################[ os_icon: os identifier ]################################## # OS identifier color. typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND=232 typeset -g POWERLEVEL9K_OS_ICON_BACKGROUND=7 # Custom icon. # typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='⭐' ################################[ prompt_char: prompt symbol ]################################ # Transparent background. typeset -g POWERLEVEL9K_PROMPT_CHAR_BACKGROUND= # Green prompt symbol if the last command succeeded. typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=76 # Red prompt symbol if the last command failed. typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=196 # Default prompt symbol. typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯' # Prompt symbol in command vi mode. typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮' # Prompt symbol in visual vi mode. typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='V' # Prompt symbol in overwrite vi mode. typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='▶' typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true # No line terminator if prompt_char is the last segment. typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL= # No line introducer if prompt_char is the first segment. typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL= # No surrounding whitespace. typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_{LEFT,RIGHT}_WHITESPACE= ##################################[ dir: current directory ]################################## # Current directory background color. typeset -g POWERLEVEL9K_DIR_BACKGROUND=4 # Default current directory foreground color. typeset -g POWERLEVEL9K_DIR_FOREGROUND=254 # If directory is too long, shorten some of its segments to the shortest possible unique # prefix. The shortened directory can be tab-completed to the original. typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_folders # typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_with_folder_marker # Replace removed segment suffixes with this symbol. #typeset -g POWERLEVEL9K_SHORTEN_DELIMITER= # Color of the shortened directory segments. typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=250 # Color of the anchor directory segments. Anchor segments are never shortened. The first # segment is always an anchor. typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=255 # Display anchor directory segments in bold. typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=true # Don't shorten directories that contain any of these files. They are anchors. local anchor_files=( .bzr .citc .git .hg .node-version .python-version .go-version .ruby-version .lua-version .java-version .perl-version .php-version .tool-version .shorten_folder_marker .svn .terraform CVS Cargo.toml composer.json go.mod package.json stack.yaml ) typeset -g POWERLEVEL9K_SHORTEN_FOLDER_MARKER="(${(j:|:)anchor_files})" # If set to "first" ("last"), remove everything before the first (last) subdirectory that contains # files matching $POWERLEVEL9K_SHORTEN_FOLDER_MARKER. For example, when the current directory is # /foo/bar/git_repo/nested_git_repo/baz, prompt will display git_repo/nested_git_repo/baz (first) # or nested_git_repo/baz (last). This assumes that git_repo and nested_git_repo contain markers # and other directories don't. # # Optionally, "first" and "last" can be followed by ":" where is an integer. # This moves the truncation point to the right (positive offset) or to the left (negative offset) # relative to the marker. Plain "first" and "last" are equivalent to "first:0" and "last:0" # respectively. typeset -g POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=false # Don't shorten this many last directory segments. They are anchors. typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1 # Shorten directory if it's longer than this even if there is space for it. The value can # be either absolute (e.g., '80') or a percentage of terminal width (e.g, '50%'). If empty, # directory will be shortened only when prompt doesn't fit or when other parameters demand it # (see POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS and POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT below). # If set to `0`, directory will always be shortened to its minimum length. typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=0 # When `dir` segment is on the last prompt line, try to shorten it enough to leave at least this # many columns for typing commands. typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40 # When `dir` segment is on the last prompt line, try to shorten it enough to leave at least # COLUMNS * POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT * 0.01 columns for typing commands. typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT=50 # If set to true, embed a hyperlink into the directory. Useful for quickly # opening a directory in the file manager simply by clicking the link. # Can also be handy when the directory is shortened, as it allows you to see # the full directory that was used in previous commands. typeset -g POWERLEVEL9K_DIR_HYPERLINK=false # Enable special styling for non-writable and non-existent directories. See POWERLEVEL9K_LOCK_ICON # and POWERLEVEL9K_DIR_CLASSES below. typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v3 # The default icon shown next to non-writable and non-existent directories when # POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v3. # typeset -g POWERLEVEL9K_LOCK_ICON='⭐' # POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons and colors for different # directories. It must be an array with 3 * N elements. Each triplet consists of: # # 1. A pattern against which the current directory ($PWD) is matched. Matching is done with # extended_glob option enabled. # 2. Directory class for the purpose of styling. # 3. An empty string. # # Triplets are tried in order. The first triplet whose pattern matches $PWD wins. # # If POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v3, non-writable and non-existent directories # acquire class suffix _NOT_WRITABLE and NON_EXISTENT respectively. # # For example, given these settings: # # typeset -g POWERLEVEL9K_DIR_CLASSES=( # '~/work(|/*)' WORK '' # '~(|/*)' HOME '' # '*' DEFAULT '') # # Whenever the current directory is ~/work or a subdirectory of ~/work, it gets styled with one # of the following classes depending on its writability and existence: WORK, WORK_NOT_WRITABLE or # WORK_NON_EXISTENT. # # Simply assigning classes to directories doesn't have any visible effects. It merely gives you an # option to define custom colors and icons for different directory classes. # # # Styling for WORK. # typeset -g POWERLEVEL9K_DIR_WORK_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_DIR_WORK_BACKGROUND=4 # typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=254 # typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=250 # typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=255 # # # Styling for WORK_NOT_WRITABLE. # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_BACKGROUND=4 # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND=254 # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_SHORTENED_FOREGROUND=250 # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_ANCHOR_FOREGROUND=255 # # # Styling for WORK_NON_EXISTENT. # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_BACKGROUND=4 # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_FOREGROUND=254 # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_SHORTENED_FOREGROUND=250 # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_ANCHOR_FOREGROUND=255 # # If a styling parameter isn't explicitly defined for some class, it falls back to the classless # parameter. For example, if POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND is not set, it falls # back to POWERLEVEL9K_DIR_FOREGROUND. # # typeset -g POWERLEVEL9K_DIR_CLASSES=() # Custom prefix. # typeset -g POWERLEVEL9K_DIR_PREFIX='in ' #####################################[ vcs: git status ]###################################### # Version control system colors. typeset -g POWERLEVEL9K_VCS_CLEAN_BACKGROUND=2 typeset -g POWERLEVEL9K_VCS_MODIFIED_BACKGROUND=3 typeset -g POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND=3 typeset -g POWERLEVEL9K_VCS_CONFLICTED_BACKGROUND=3 # typeset -g POWERLEVEL9K_VCS_LOADING_BACKGROUND=8 # Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon. # typeset -g POWERLEVEL9K_VCS_BRANCH_ICON='\uF126 ' typeset -g POWERLEVEL9K_VCS_BRANCH_ICON='\ue0a0 ' # Untracked files icon. It's really a question mark, your font isn't broken. # Change the value of this parameter to show a different icon. # typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='\u25CF' # filled circle # typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='\uf059' # circled question mark typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='\uf421' # triangle warning typeset -g POWERLEVEL9K_VCS_STAGED_ICON='±' typeset -g POWERLEVEL9K_VCS_UNSTAGED_ICON='!' typeset -g POWERLEVEL9K_VCS_STASH_ICON='≡' typeset -g POWERLEVEL9K_VCS_TAG_ICON=' \uF02B' # Below icons are not used any more # typeset -g POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON='\u2193' # typeset -g POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON='\u2191' # Formatter for Git status. # # Example output: master ⇣42⇡42 *42 merge ~42 +42 !42 ?42. # # You can edit the function to customize how Git status looks. # # VCS_STATUS_* parameters are set by gitstatus plugin. See reference: # https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.zsh. function my_git_formatter() { emulate -L zsh if [[ -n $P9K_CONTENT ]]; then # If P9K_CONTENT is not empty, use it. It's either "loading" or from vcs_info (not from # gitstatus plugin). VCS_STATUS_* parameters are not available in this case. typeset -g my_git_format=$P9K_CONTENT return fi # Styling for different parts of Git status. local meta='%7F' # white foreground local clean='%0F' # black foreground local modified='%0F' # black foreground local untracked='%88F' # black red foreground local conflicted='%1F' # red foreground local tagged='%242F' # light gray foreground local res if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then local branch=${(V)VCS_STATUS_LOCAL_BRANCH} # If local branch name is at most 32 characters long, show it in full. # Otherwise show the first 12 … the last 12. # Tip: To always show local branch name in full without truncation, delete the next line. (( $#branch > 32 )) && branch[13,-13]="…" # <-- this line res+="${clean}${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}${branch//\%/%%}" fi if [[ -n $VCS_STATUS_TAG # Show tag only if not on a branch. # Tip: To always show tag, delete the next line. # && -z $VCS_STATUS_LOCAL_BRANCH # <-- this line ]]; then local tag=${(V)VCS_STATUS_TAG} # If tag name is at most 32 characters long, show it in full. # Otherwise show the first 12 … the last 12. # Tip: To always show tag name in full without truncation, delete the next line. (( $#tag > 32 )) && tag[13,-13]="…" # <-- this line res+="${tagged}${(g::)POWERLEVEL9K_VCS_TAG_ICON}${tag//\%/%%}" fi # Display the current Git commit if there is no branch and no tag. # Tip: To always display the current Git commit, delete the next line. [[ -z $VCS_STATUS_LOCAL_BRANCH && -z $VCS_STATUS_LOCAL_BRANCH ]] && # <-- this line res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}" # Show tracking branch name if it differs from local branch. if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" fi # ⇣42 if behind the remote. (( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}⇣${VCS_STATUS_COMMITS_BEHIND}" # ⇡42 if ahead of the remote; no leading space if also behind the remote: ⇣42⇡42. (( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" " (( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}⇡${VCS_STATUS_COMMITS_AHEAD}" # ⇠42 if behind the push remote. # (( VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" ${clean}⇠${VCS_STATUS_PUSH_COMMITS_BEHIND}" # (( VCS_STATUS_PUSH_COMMITS_AHEAD && !VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" " # ⇢42 if ahead of the push remote; no leading space if also behind: ⇠42⇢42. # (( VCS_STATUS_PUSH_COMMITS_AHEAD )) && res+="${clean}⇢${VCS_STATUS_PUSH_COMMITS_AHEAD}" # *42 if have stashes. (( VCS_STATUS_STASHES )) && res+=" ${clean}${(g::)POWERLEVEL9K_VCS_STASH_ICON}${VCS_STATUS_STASHES}" # 'merge' if the repo is in an unusual state. [[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}" # ~42 if have merge conflicts. (( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}" # +42 if have staged changes. (( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}${(g::)POWERLEVEL9K_VCS_STAGED_ICON}${VCS_STATUS_NUM_STAGED}" # !42 if have unstaged changes. (( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}${(g::)POWERLEVEL9K_VCS_UNSTAGED_ICON}${VCS_STATUS_NUM_UNSTAGED}" # ?42 if have untracked files. It's really a question mark, your font isn't broken. # See POWERLEVEL9K_VCS_UNTRACKED_ICON above if you want to use a different icon. # Remove the next line if you don't want to see untracked files at all. # (( VCS_STATUS_NUM_UNTRACKED )) && res+=" ${untracked}${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}${VCS_STATUS_NUM_UNTRACKED}" (( VCS_STATUS_NUM_UNTRACKED )) && res+=" ${untracked}${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}" # "─" if the number of unstaged files is unknown. This can happen due to # POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY (see below) being set to a non-negative number lower # than the number of files in the Git index, or due to bash.showDirtyState being set to false # in the repository config. The number of staged and untracked files may also be unknown # in this case. (( VCS_STATUS_HAS_UNSTAGED == -1 )) && res+=" ${modified}─" typeset -g my_git_format=$res } functions -M my_git_formatter 2>/dev/null # Don't count the number of unstaged, untracked and conflicted files in Git repositories with # more than this many files in the index. Negative value means infinity. # # If you are working in Git repositories with tens of millions of files and seeing performance # sagging, try setting POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY to a number lower than the output # of `git ls-files | wc -l`. Alternatively, add `bash.showDirtyState = false` to the repository's # config: `git config bash.showDirtyState false`. typeset -g POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=-1 # Don't show Git status in prompt for repositories whose workdir matches this pattern. # For example, if set to '~', the Git repository at $HOME/.git will be ignored. # Multiple patterns can be combined with '|': '~(|/foo)|/bar/baz/*'. typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~' # Disable the default Git status formatting. typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true # Install our own Git status formatter. typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter()))+${my_git_format}}' # Enable counters for staged, unstaged, etc. typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1 # Custom icon. # typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION='⭐' # Custom prefix. # typeset -g POWERLEVEL9K_VCS_PREFIX='on ' # Show status of repositories of these types. You can add svn and/or hg if you are # using them. If you do, your prompt may become slow even when your current directory # isn't in an svn or hg reposotiry. typeset -g POWERLEVEL9K_VCS_BACKENDS=(git) ##########################[ status: exit code of the last command ]########################### # Enable OK_PIPE, ERROR_PIPE and ERROR_SIGNAL status states to allow us to enable, disable and # style them independently from the regular OK and ERROR state. typeset -g POWERLEVEL9K_STATUS_EXTENDED_STATES=true # Status on success. No content, just an icon. No need to show it if prompt_char is enabled as # it will signify success by turning green. typeset -g POWERLEVEL9K_STATUS_OK=true typeset -g POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION='✔' # typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=2 # typeset -g POWERLEVEL9K_STATUS_OK_BACKGROUND=0 # Status when some part of a pipe command fails but the overall exit status is zero. It may look # like this: 1|0. typeset -g POWERLEVEL9K_STATUS_OK_PIPE=true typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION='✔' # typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=2 # typeset -g POWERLEVEL9K_STATUS_OK_PIPE_BACKGROUND=0 # Status when it's just an error code (e.g., '1'). No need to show it if prompt_char is enabled as # it will signify error by turning red. typeset -g POWERLEVEL9K_STATUS_ERROR=true typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION='✘' # typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=3 # typeset -g POWERLEVEL9K_STATUS_ERROR_BACKGROUND=1 # Status when the last command was terminated by a signal. typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL=true # Use terse signal names: "INT" instead of "SIGINT(2)". typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION='✘' # typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=3 # typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_BACKGROUND=1 # Status when some part of a pipe command fails and the overall exit status is also non-zero. # It may look like this: 1|0. typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE=true typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION='✘' # typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=3 # typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_BACKGROUND=1 ###################[ command_execution_time: duration of the last command ]################### # Execution time color. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=0 typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND=3 # Show duration of the last command if takes at least this many seconds. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 # Show this many fractional digits. Zero means round to seconds. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 # Duration format: 1d 2h 3m 4s. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s' # Custom icon. # typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION='⭐' # Custom prefix. # typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX='took ' #######################[ background_jobs: presence of background jobs ]####################### # Background jobs color. # typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=6 # typeset -g POWERLEVEL9K_BACKGROUND_JOBS_BACKGROUND=0 # Don't show the number of background jobs. typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false # Custom icon. # typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='⭐' #######################[ direnv: direnv status (https://direnv.net/) ]######################## # Direnv color. # typeset -g POWERLEVEL9K_DIRENV_FOREGROUND=3 # typeset -g POWERLEVEL9K_DIRENV_BACKGROUND=0 # Custom icon. # typeset -g POWERLEVEL9K_DIRENV_VISUAL_IDENTIFIER_EXPANSION='⭐' ###############[ asdf: asdf version manager (https://github.com/asdf-vm/asdf) ]############### # Default asdf color. Only used to display tools for which there is no color override (see below). # Tip: Override these parameters for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_FOREGROUND and # POWERLEVEL9K_ASDF_${TOOL}_BACKGROUND. typeset -g POWERLEVEL9K_ASDF_FOREGROUND=0 typeset -g POWERLEVEL9K_ASDF_BACKGROUND=7 # There are four parameters that can be used to hide asdf tools. Each parameter describes # conditions under which a tool gets hidden. Parameters can hide tools but not unhide them. If at # least one parameter decides to hide a tool, that tool gets hidden. If no parameter decides to # hide a tool, it gets shown. # # Special note on the difference between POWERLEVEL9K_ASDF_SOURCES and # POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW. Consider the effect of the following commands: # # asdf local python 3.8.1 # asdf global python 3.8.1 # # After running both commands the current python version is 3.8.1 and its source is "local" as # it takes precedence over "global". If POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW is set to false, # it'll hide python version in this case because 3.8.1 is the same as the global version. # POWERLEVEL9K_ASDF_SOURCES will hide python version only if the value of this parameter doesn't # contain "local". # Hide tool versions that don't come from one of these sources. # # Available sources: # # - shell `asdf current` says "set by ASDF_${TOOL}_VERSION environment variable" # - local `asdf current` says "set by /some/not/home/directory/file" # - global `asdf current` says "set by /home/username/file" # # Note: If this parameter is set to (shell local global), it won't hide tools. # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SOURCES. typeset -g POWERLEVEL9K_ASDF_SOURCES=(shell local global) # If set to false, hide tool versions that are the same as global. # # Note: The name of this parameter doesn't reflect its meaning at all. # Note: If this parameter is set to true, it won't hide tools. # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_PROMPT_ALWAYS_SHOW. typeset -g POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW=false # If set to false, hide tool versions that are equal to "system". # # Note: If this parameter is set to true, it won't hide tools. # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SHOW_SYSTEM. typeset -g POWERLEVEL9K_ASDF_SHOW_SYSTEM=true # If set to non-empty value, hide tools unless there is a file matching the specified file pattern # in the current directory, or its parent directory, or its grandparent directory, and so on. # # Note: If this parameter is set to empty value, it won't hide tools. # Note: SHOW_ON_UPGLOB isn't specific to asdf. It works with all prompt segments. # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SHOW_ON_UPGLOB. # # Example: Hide nodejs version when there is no package.json and no *.js files in the current # directory, in `..`, in `../..` and so on. # # typeset -g POWERLEVEL9K_ASDF_NODEJS_SHOW_ON_UPGLOB='*.js|package.json' typeset -g POWERLEVEL9K_ASDF_SHOW_ON_UPGLOB= # Ruby version from asdf. typeset -g POWERLEVEL9K_ASDF_RUBY_FOREGROUND=0 typeset -g POWERLEVEL9K_ASDF_RUBY_BACKGROUND=1 # typeset -g POWERLEVEL9K_ASDF_RUBY_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_RUBY_SHOW_ON_UPGLOB='*.foo|*.bar' # Python version from asdf. typeset -g POWERLEVEL9K_ASDF_PYTHON_FOREGROUND=0 typeset -g POWERLEVEL9K_ASDF_PYTHON_BACKGROUND=4 # typeset -g POWERLEVEL9K_ASDF_PYTHON_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_PYTHON_SHOW_ON_UPGLOB='*.foo|*.bar' # Go version from asdf. typeset -g POWERLEVEL9K_ASDF_GOLANG_FOREGROUND=0 typeset -g POWERLEVEL9K_ASDF_GOLANG_BACKGROUND=4 # typeset -g POWERLEVEL9K_ASDF_GOLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_GOLANG_SHOW_ON_UPGLOB='*.foo|*.bar' # Node.js version from asdf. typeset -g POWERLEVEL9K_ASDF_NODEJS_FOREGROUND=0 typeset -g POWERLEVEL9K_ASDF_NODEJS_BACKGROUND=2 # typeset -g POWERLEVEL9K_ASDF_NODEJS_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_NODEJS_SHOW_ON_UPGLOB='*.foo|*.bar' # Rust version from asdf. typeset -g POWERLEVEL9K_ASDF_RUST_FOREGROUND=0 typeset -g POWERLEVEL9K_ASDF_RUST_BACKGROUND=208 # typeset -g POWERLEVEL9K_ASDF_RUST_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_RUST_SHOW_ON_UPGLOB='*.foo|*.bar' # .NET Core version from asdf. typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_FOREGROUND=0 typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_BACKGROUND=5 # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_SHOW_ON_UPGLOB='*.foo|*.bar' # Flutter version from asdf. typeset -g POWERLEVEL9K_ASDF_FLUTTER_FOREGROUND=0 typeset -g POWERLEVEL9K_ASDF_FLUTTER_BACKGROUND=4 # typeset -g POWERLEVEL9K_ASDF_FLUTTER_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_FLUTTER_SHOW_ON_UPGLOB='*.foo|*.bar' # Lua version from asdf. typeset -g POWERLEVEL9K_ASDF_LUA_FOREGROUND=0 typeset -g POWERLEVEL9K_ASDF_LUA_BACKGROUND=4 # typeset -g POWERLEVEL9K_ASDF_LUA_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_LUA_SHOW_ON_UPGLOB='*.foo|*.bar' # Java version from asdf. typeset -g POWERLEVEL9K_ASDF_JAVA_FOREGROUND=1 typeset -g POWERLEVEL9K_ASDF_JAVA_BACKGROUND=7 # typeset -g POWERLEVEL9K_ASDF_JAVA_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_JAVA_SHOW_ON_UPGLOB='*.foo|*.bar' # Perl version from asdf. typeset -g POWERLEVEL9K_ASDF_PERL_FOREGROUND=0 typeset -g POWERLEVEL9K_ASDF_PERL_BACKGROUND=4 # typeset -g POWERLEVEL9K_ASDF_PERL_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_PERL_SHOW_ON_UPGLOB='*.foo|*.bar' # Erlang version from asdf. typeset -g POWERLEVEL9K_ASDF_ERLANG_FOREGROUND=0 typeset -g POWERLEVEL9K_ASDF_ERLANG_BACKGROUND=1 # typeset -g POWERLEVEL9K_ASDF_ERLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_ERLANG_SHOW_ON_UPGLOB='*.foo|*.bar' # Elixir version from asdf. typeset -g POWERLEVEL9K_ASDF_ELIXIR_FOREGROUND=0 typeset -g POWERLEVEL9K_ASDF_ELIXIR_BACKGROUND=5 # typeset -g POWERLEVEL9K_ASDF_ELIXIR_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_ELIXIR_SHOW_ON_UPGLOB='*.foo|*.bar' # Postgres version from asdf. typeset -g POWERLEVEL9K_ASDF_POSTGRES_FOREGROUND=0 typeset -g POWERLEVEL9K_ASDF_POSTGRES_BACKGROUND=6 # typeset -g POWERLEVEL9K_ASDF_POSTGRES_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_POSTGRES_SHOW_ON_UPGLOB='*.foo|*.bar' # PHP version from asdf. typeset -g POWERLEVEL9K_ASDF_PHP_FOREGROUND=0 typeset -g POWERLEVEL9K_ASDF_PHP_BACKGROUND=5 # typeset -g POWERLEVEL9K_ASDF_PHP_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_PHP_SHOW_ON_UPGLOB='*.foo|*.bar' # Haskell version from asdf. typeset -g POWERLEVEL9K_ASDF_HASKELL_FOREGROUND=0 typeset -g POWERLEVEL9K_ASDF_HASKELL_BACKGROUND=3 # typeset -g POWERLEVEL9K_ASDF_HASKELL_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_HASKELL_SHOW_ON_UPGLOB='*.foo|*.bar' # Julia version from asdf. typeset -g POWERLEVEL9K_ASDF_JULIA_FOREGROUND=0 typeset -g POWERLEVEL9K_ASDF_JULIA_BACKGROUND=2 # typeset -g POWERLEVEL9K_ASDF_JULIA_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_JULIA_SHOW_ON_UPGLOB='*.foo|*.bar' ##########[ nordvpn: nordvpn connection status, linux only (https://nordvpn.com/) ]########### # NordVPN connection indicator color. # typeset -g POWERLEVEL9K_NORDVPN_FOREGROUND=7 # typeset -g POWERLEVEL9K_NORDVPN_BACKGROUND=4 # Hide NordVPN connection indicator when not connected. typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_CONTENT_EXPANSION= typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_VISUAL_IDENTIFIER_EXPANSION= # Custom icon. # typeset -g POWERLEVEL9K_NORDVPN_VISUAL_IDENTIFIER_EXPANSION='⭐' #################[ ranger: ranger shell (https://github.com/ranger/ranger) ]################## # Ranger shell color. # typeset -g POWERLEVEL9K_RANGER_FOREGROUND=3 # typeset -g POWERLEVEL9K_RANGER_BACKGROUND=0 # Custom icon. # typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐' ######################[ nnn: nnn shell (https://github.com/jarun/nnn) ]####################### # Nnn shell color. # typeset -g POWERLEVEL9K_NNN_FOREGROUND=0 # typeset -g POWERLEVEL9K_NNN_BACKGROUND=6 # Custom icon. # typeset -g POWERLEVEL9K_NNN_VISUAL_IDENTIFIER_EXPANSION='⭐' ###########################[ vim_shell: vim shell indicator (:sh) ]########################### # Vim shell indicator color. # typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=0 # typeset -g POWERLEVEL9K_VIM_SHELL_BACKGROUND=2 # Custom icon. # typeset -g POWERLEVEL9K_VIM_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' ######[ midnight_commander: midnight commander shell (https://midnight-commander.org/) ]###### # Midnight Commander shell color. # typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_FOREGROUND=3 # typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_BACKGROUND=0 # Custom icon. # typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='⭐' #[ nix_shell: nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) ]## # Nix shell color. # typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=0 # typeset -g POWERLEVEL9K_NIX_SHELL_BACKGROUND=4 # Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line. # typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION= # Custom icon. # typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' ##################################[ disk_usage: disk usage ]################################## # Colors for different levels of disk usage. # typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=3 # typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_BACKGROUND=0 # typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_FOREGROUND=0 # typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_BACKGROUND=3 # typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_FOREGROUND=7 # typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_BACKGROUND=1 # Thresholds for different levels of disk usage (percentage points). typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90 typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95 # If set to true, hide disk usage when below $POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL percent. typeset -g POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=false # Custom icon. # typeset -g POWERLEVEL9K_DISK_USAGE_VISUAL_IDENTIFIER_EXPANSION='⭐' ###########[ vi_mode: vi mode (you don't need this if you've enabled prompt_char) ]########### # Foreground color. typeset -g POWERLEVEL9K_VI_MODE_FOREGROUND=0 # Text and color for normal (a.k.a. command) vi mode. typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING=NORMAL typeset -g POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND=2 # Text and color for visual vi mode. typeset -g POWERLEVEL9K_VI_VISUAL_MODE_STRING=VISUAL typeset -g POWERLEVEL9K_VI_MODE_VISUAL_BACKGROUND=4 # Text and color for overtype (a.k.a. overwrite and replace) vi mode. typeset -g POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=OVERTYPE typeset -g POWERLEVEL9K_VI_MODE_OVERWRITE_BACKGROUND=3 # Text and color for insert vi mode. typeset -g POWERLEVEL9K_VI_INSERT_MODE_STRING= typeset -g POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND=8 ######################################[ ram: free RAM ]####################################### # RAM color. # typeset -g POWERLEVEL9K_RAM_FOREGROUND=0 # typeset -g POWERLEVEL9K_RAM_BACKGROUND=3 # Custom icon. # typeset -g POWERLEVEL9K_RAM_VISUAL_IDENTIFIER_EXPANSION='⭐' #####################################[ swap: used swap ]###################################### # Swap color. # typeset -g POWERLEVEL9K_SWAP_FOREGROUND=0 # typeset -g POWERLEVEL9K_SWAP_BACKGROUND=3 # Custom icon. # typeset -g POWERLEVEL9K_SWAP_VISUAL_IDENTIFIER_EXPANSION='⭐' ######################################[ load: CPU load ]###################################### # Show average CPU load over this many last minutes. Valid values are 1, 5 and 15. typeset -g POWERLEVEL9K_LOAD_WHICH=5 # Load color when load is under 50%. # typeset -g POWERLEVEL9K_LOAD_NORMAL_FOREGROUND=0 # typeset -g POWERLEVEL9K_LOAD_NORMAL_BACKGROUND=2 # Load color when load is between 50% and 70%. # typeset -g POWERLEVEL9K_LOAD_WARNING_FOREGROUND=0 # typeset -g POWERLEVEL9K_LOAD_WARNING_BACKGROUND=3 # Load color when load is over 70%. # typeset -g POWERLEVEL9K_LOAD_CRITICAL_FOREGROUND=0 # typeset -g POWERLEVEL9K_LOAD_CRITICAL_BACKGROUND=1 # Custom icon. # typeset -g POWERLEVEL9K_LOAD_VISUAL_IDENTIFIER_EXPANSION='⭐' ################[ todo: todo items (https://github.com/todotxt/todo.txt-cli) ]################ # Todo color. # typeset -g POWERLEVEL9K_TODO_FOREGROUND=0 # typeset -g POWERLEVEL9K_TODO_BACKGROUND=8 # Hide todo when the total number of tasks is zero. typeset -g POWERLEVEL9K_TODO_HIDE_ZERO_TOTAL=true # Hide todo when the number of tasks after filtering is zero. typeset -g POWERLEVEL9K_TODO_HIDE_ZERO_FILTERED=false # Todo format. The following parameters are available within the expansion. # # - P9K_TODO_TOTAL_TASK_COUNT The total number of tasks. # - P9K_TODO_FILTERED_TASK_COUNT The number of tasks after filtering. # # These variables correspond to the last line of the output of `todo.sh -p ls`: # # TODO: 24 of 42 tasks shown # # Here 24 is P9K_TODO_FILTERED_TASK_COUNT and 42 is P9K_TODO_TOTAL_TASK_COUNT. # # typeset -g POWERLEVEL9K_TODO_CONTENT_EXPANSION='$P9K_TODO_FILTERED_TASK_COUNT' # Custom icon. # typeset -g POWERLEVEL9K_TODO_VISUAL_IDENTIFIER_EXPANSION='⭐' ###########[ timewarrior: timewarrior tracking status (https://timewarrior.net/) ]############ # Timewarrior color. # typeset -g POWERLEVEL9K_TIMEWARRIOR_FOREGROUND=255 # typeset -g POWERLEVEL9K_TIMEWARRIOR_BACKGROUND=8 # If the tracked task is longer than 24 characters, truncate and append "…". # Tip: To always display tasks without truncation, delete the following parameter. # Tip: To hide task names and display just the icon when time tracking is enabled, set the # value of the following parameter to "". typeset -g POWERLEVEL9K_TIMEWARRIOR_CONTENT_EXPANSION='${P9K_CONTENT:0:24}${${P9K_CONTENT:24}:+…}' # Custom icon. # typeset -g POWERLEVEL9K_TIMEWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' ##############[ taskwarrior: taskwarrior task count (https://taskwarrior.org/) ]############## # Taskwarrior color. # typeset -g POWERLEVEL9K_TASKWARRIOR_FOREGROUND=0 # typeset -g POWERLEVEL9K_TASKWARRIOR_BACKGROUND=6 # Taskwarrior segment format. The following parameters are available within the expansion. # # - P9K_TASKWARRIOR_PENDING_COUNT The number of pending tasks: `task +PENDING count`. # - P9K_TASKWARRIOR_OVERDUE_COUNT The number of overdue tasks: `task +OVERDUE count`. # # Zero values are represented as empty parameters. # # The default format: # # '${P9K_TASKWARRIOR_OVERDUE_COUNT:+"!$P9K_TASKWARRIOR_OVERDUE_COUNT/"}$P9K_TASKWARRIOR_PENDING_COUNT' # # typeset -g POWERLEVEL9K_TASKWARRIOR_CONTENT_EXPANSION='$P9K_TASKWARRIOR_PENDING_COUNT' # Custom icon. # typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' ##################################[ context: user@hostname ]################################## # Context color when running with privileges. typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1 typeset -g POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND=0 # Context color in SSH without privileges. typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=3 typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_BACKGROUND=0 # Default context color (no privileges, no SSH). typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=3 typeset -g POWERLEVEL9K_CONTEXT_BACKGROUND=0 # Context format when running with privileges: user@hostname. typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%n@%m' # Context format when in SSH without privileges: user@hostname. typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_TEMPLATE='%n@%m' # Default context format (no privileges, no SSH): user@hostname. typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n@%m' # Don't show context unless running with privileges or in SSH. # Tip: Remove the next line to always show context. typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION= # Custom icon. # typeset -g POWERLEVEL9K_CONTEXT_VISUAL_IDENTIFIER_EXPANSION='⭐' # Custom prefix. # typeset -g POWERLEVEL9K_CONTEXT_PREFIX='with ' ###[ virtualenv: python virtual environment (https://docs.python.org/3/library/venv.html) ]### # Python virtual environment color. # typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=0 # typeset -g POWERLEVEL9K_VIRTUALENV_BACKGROUND=4 # Don't show Python version next to the virtual environment name. typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false # If set to "false", won't show virtualenv if pyenv is already shown. # If set to "if-different", won't show virtualenv if it's the same as pyenv. typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV=false # Separate environment name from Python version only with a space. typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER= # Custom icon. # typeset -g POWERLEVEL9K_VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION='⭐' #####################[ anaconda: conda environment (https://conda.io/) ]###################### # Anaconda environment color. # typeset -g POWERLEVEL9K_ANACONDA_FOREGROUND=0 # typeset -g POWERLEVEL9K_ANACONDA_BACKGROUND=4 # Anaconda segment format. The following parameters are available within the expansion. # # - CONDA_PREFIX Absolute path to the active Anaconda/Miniconda environment. # - CONDA_DEFAULT_ENV Name of the active Anaconda/Miniconda environment. # - CONDA_PROMPT_MODIFIER Configurable prompt modifier (see below). # - P9K_ANACONDA_PYTHON_VERSION Current python version (python --version). # # CONDA_PROMPT_MODIFIER can be configured with the following command: # # conda config --set env_prompt '({default_env}) ' # # The last argument is a Python format string that can use the following variables: # # - prefix The same as CONDA_PREFIX. # - default_env The same as CONDA_DEFAULT_ENV. # - name The last segment of CONDA_PREFIX. # - stacked_env Comma-separated list of names in the environment stack. The first element is # always the same as default_env. # # Note: '({default_env}) ' is the default value of env_prompt. # # The default value of POWERLEVEL9K_ANACONDA_CONTENT_EXPANSION expands to $CONDA_PROMPT_MODIFIER # without the surrounding parentheses, or to the last path component of CONDA_PREFIX if the former # is empty. typeset -g POWERLEVEL9K_ANACONDA_CONTENT_EXPANSION='${${${${CONDA_PROMPT_MODIFIER#\(}% }%\)}:-${CONDA_PREFIX:t}}' # Custom icon. # typeset -g POWERLEVEL9K_ANACONDA_VISUAL_IDENTIFIER_EXPANSION='⭐' ################[ pyenv: python environment (https://github.com/pyenv/pyenv) ]################ # Pyenv color. # typeset -g POWERLEVEL9K_PYENV_FOREGROUND=0 # typeset -g POWERLEVEL9K_PYENV_BACKGROUND=4 # Hide python version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_PYENV_SOURCES=(shell local global) # If set to false, hide python version if it's the same as global: # $(pyenv version-name) == $(pyenv global). typeset -g POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false # If set to false, hide python version if it's equal to "system". typeset -g POWERLEVEL9K_PYENV_SHOW_SYSTEM=true # Pyenv segment format. The following parameters are available within the expansion. # # - P9K_CONTENT Current pyenv environment (pyenv version-name). # - P9K_PYENV_PYTHON_VERSION Current python version (python --version). # # The default format has the following logic: # # 1. Display "$P9K_CONTENT $P9K_PYENV_PYTHON_VERSION" if $P9K_PYENV_PYTHON_VERSION is not # empty and unequal to $P9K_CONTENT. # 2. Otherwise display just "$P9K_CONTENT". typeset -g POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${P9K_CONTENT}${${P9K_PYENV_PYTHON_VERSION:#$P9K_CONTENT}:+ $P9K_PYENV_PYTHON_VERSION}' # Custom icon. # typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION='⭐' ################[ goenv: go environment (https://github.com/syndbg/goenv) ]################ # Goenv color. # typeset -g POWERLEVEL9K_GOENV_FOREGROUND=0 # typeset -g POWERLEVEL9K_GOENV_BACKGROUND=4 # Hide go version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_GOENV_SOURCES=(shell local global) # If set to false, hide go version if it's the same as global: # $(goenv version-name) == $(goenv global). typeset -g POWERLEVEL9K_GOENV_PROMPT_ALWAYS_SHOW=false # If set to false, hide go version if it's equal to "system". typeset -g POWERLEVEL9K_GOENV_SHOW_SYSTEM=true # Custom icon. # typeset -g POWERLEVEL9K_GOENV_VISUAL_IDENTIFIER_EXPANSION='⭐' ##########[ nodenv: node.js version from nodenv (https://github.com/nodenv/nodenv) ]########## # Nodenv color. # typeset -g POWERLEVEL9K_NODENV_FOREGROUND=2 # typeset -g POWERLEVEL9K_NODENV_BACKGROUND=0 # Hide node version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_NODENV_SOURCES=(shell local global) # If set to false, hide node version if it's the same as global: # $(nodenv version-name) == $(nodenv global). typeset -g POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false # If set to false, hide node version if it's equal to "system". typeset -g POWERLEVEL9K_NODENV_SHOW_SYSTEM=true # Custom icon. # typeset -g POWERLEVEL9K_NODENV_VISUAL_IDENTIFIER_EXPANSION='⭐' ##############[ nvm: node.js version from nvm (https://github.com/nvm-sh/nvm) ]############### # Nvm color. # typeset -g POWERLEVEL9K_NVM_FOREGROUND=0 # typeset -g POWERLEVEL9K_NVM_BACKGROUND=5 # Custom icon. # typeset -g POWERLEVEL9K_NVM_VISUAL_IDENTIFIER_EXPANSION='⭐' ############[ nodeenv: node.js environment (https://github.com/ekalinin/nodeenv) ]############ # Nodeenv color. # typeset -g POWERLEVEL9K_NODEENV_FOREGROUND=2 # typeset -g POWERLEVEL9K_NODEENV_BACKGROUND=0 # Don't show Node version next to the environment name. typeset -g POWERLEVEL9K_NODEENV_SHOW_NODE_VERSION=false # Separate environment name from Node version only with a space. typeset -g POWERLEVEL9K_NODEENV_{LEFT,RIGHT}_DELIMITER= # Custom icon. # typeset -g POWERLEVEL9K_NODEENV_VISUAL_IDENTIFIER_EXPANSION='⭐' ##############################[ node_version: node.js version ]############################### # Node version color. # typeset -g POWERLEVEL9K_NODE_VERSION_FOREGROUND=7 # typeset -g POWERLEVEL9K_NODE_VERSION_BACKGROUND=2 # Show node version only when in a directory tree containing package.json. typeset -g POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=true # Custom icon. # typeset -g POWERLEVEL9K_NODE_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' #######################[ go_version: go version (https://golang.org) ]######################## # Go version color. # typeset -g POWERLEVEL9K_GO_VERSION_FOREGROUND=255 # typeset -g POWERLEVEL9K_GO_VERSION_BACKGROUND=2 # Show go version only when in a go project subdirectory. typeset -g POWERLEVEL9K_GO_VERSION_PROJECT_ONLY=true # Custom icon. # typeset -g POWERLEVEL9K_GO_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' #################[ rust_version: rustc version (https://www.rust-lang.org) ]################## # Rust version color. # typeset -g POWERLEVEL9K_RUST_VERSION_FOREGROUND=0 # typeset -g POWERLEVEL9K_RUST_VERSION_BACKGROUND=208 # Show rust version only when in a rust project subdirectory. typeset -g POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY=true # Custom icon. # typeset -g POWERLEVEL9K_RUST_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' ###############[ dotnet_version: .NET version (https://dotnet.microsoft.com) ]################ # .NET version color. # typeset -g POWERLEVEL9K_DOTNET_VERSION_FOREGROUND=7 # typeset -g POWERLEVEL9K_DOTNET_VERSION_BACKGROUND=5 # Show .NET version only when in a .NET project subdirectory. typeset -g POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY=true # Custom icon. # typeset -g POWERLEVEL9K_DOTNET_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' #####################[ php_version: php version (https://www.php.net/) ]###################### # PHP version color. typeset -g POWERLEVEL9K_PHP_VERSION_FOREGROUND=0 typeset -g POWERLEVEL9K_PHP_VERSION_BACKGROUND=5 # Show PHP version only when in a PHP project subdirectory. typeset -g POWERLEVEL9K_PHP_VERSION_PROJECT_ONLY=true # Custom icon. # typeset -g POWERLEVEL9K_PHP_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' ##########[ laravel_version: laravel php framework version (https://laravel.com/) ]########### # Laravel version color. typeset -g POWERLEVEL9K_LARAVEL_VERSION_FOREGROUND=1 typeset -g POWERLEVEL9K_LARAVEL_VERSION_BACKGROUND=7 # Custom icon. # typeset -g POWERLEVEL9K_LARAVEL_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' #############[ rbenv: ruby version from rbenv (https://github.com/rbenv/rbenv) ]############## # Rbenv color. # typeset -g POWERLEVEL9K_RBENV_FOREGROUND=0 # typeset -g POWERLEVEL9K_RBENV_BACKGROUND=1 # Hide ruby version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_RBENV_SOURCES=(shell local global) # If set to false, hide ruby version if it's the same as global: # $(rbenv version-name) == $(rbenv global). typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false # If set to false, hide ruby version if it's equal to "system". typeset -g POWERLEVEL9K_RBENV_SHOW_SYSTEM=true # Custom icon. # typeset -g POWERLEVEL9K_RBENV_VISUAL_IDENTIFIER_EXPANSION='⭐' ####################[ java_version: java version (https://www.java.com/) ]#################### # Java version color. typeset -g POWERLEVEL9K_JAVA_VERSION_FOREGROUND=1 typeset -g POWERLEVEL9K_JAVA_VERSION_BACKGROUND=7 # Show java version only when in a java project subdirectory. typeset -g POWERLEVEL9K_JAVA_VERSION_PROJECT_ONLY=true # Show brief version. typeset -g POWERLEVEL9K_JAVA_VERSION_FULL=false # Custom icon. # typeset -g POWERLEVEL9K_JAVA_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' ###[ package: name@version from package.json (https://docs.npmjs.com/files/package.json) ]#### # Package color. # typeset -g POWERLEVEL9K_PACKAGE_FOREGROUND=0 # typeset -g POWERLEVEL9K_PACKAGE_BACKGROUND=6 # Package format. The following parameters are available within the expansion. # # - P9K_PACKAGE_NAME The value of `name` field in package.json. # - P9K_PACKAGE_VERSION The value of `version` field in package.json. # # typeset -g POWERLEVEL9K_PACKAGE_CONTENT_EXPANSION='${P9K_PACKAGE_NAME//\%/%%}@${P9K_PACKAGE_VERSION//\%/%%}' # Custom icon. # typeset -g POWERLEVEL9K_PACKAGE_VISUAL_IDENTIFIER_EXPANSION='⭐' #######################[ rvm: ruby version from rvm (https://rvm.io) ]######################## # Rvm color. # typeset -g POWERLEVEL9K_RVM_FOREGROUND=0 # typeset -g POWERLEVEL9K_RVM_BACKGROUND=240 # Don't show @gemset at the end. typeset -g POWERLEVEL9K_RVM_SHOW_GEMSET=false # Don't show ruby- at the front. typeset -g POWERLEVEL9K_RVM_SHOW_PREFIX=false # Custom icon. # typeset -g POWERLEVEL9K_RVM_VISUAL_IDENTIFIER_EXPANSION='⭐' ###########[ fvm: flutter version management (https://github.com/leoafarias/fvm) ]############ # Fvm color. # typeset -g POWERLEVEL9K_FVM_FOREGROUND=0 # typeset -g POWERLEVEL9K_FVM_BACKGROUND=4 # Custom icon. # typeset -g POWERLEVEL9K_FVM_VISUAL_IDENTIFIER_EXPANSION='⭐' ##########[ luaenv: lua version from luaenv (https://github.com/cehoffman/luaenv) ]########### # Lua color. # typeset -g POWERLEVEL9K_LUAENV_FOREGROUND=0 # typeset -g POWERLEVEL9K_LUAENV_BACKGROUND=4 # Hide lua version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_LUAENV_SOURCES=(shell local global) # If set to false, hide lua version if it's the same as global: # $(luaenv version-name) == $(luaenv global). typeset -g POWERLEVEL9K_LUAENV_PROMPT_ALWAYS_SHOW=false # If set to false, hide lua version if it's equal to "system". typeset -g POWERLEVEL9K_LUAENV_SHOW_SYSTEM=true # Custom icon. # typeset -g POWERLEVEL9K_LUAENV_VISUAL_IDENTIFIER_EXPANSION='⭐' ###############[ jenv: java version from jenv (https://github.com/jenv/jenv) ]################ # Java color. # typeset -g POWERLEVEL9K_JENV_FOREGROUND=1 # typeset -g POWERLEVEL9K_JENV_BACKGROUND=7 # Hide java version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_JENV_SOURCES=(shell local global) # If set to false, hide java version if it's the same as global: # $(jenv version-name) == $(jenv global). typeset -g POWERLEVEL9K_JENV_PROMPT_ALWAYS_SHOW=false # If set to false, hide java version if it's equal to "system". typeset -g POWERLEVEL9K_JENV_SHOW_SYSTEM=true # Custom icon. # typeset -g POWERLEVEL9K_JENV_VISUAL_IDENTIFIER_EXPANSION='⭐' ###########[ plenv: perl version from plenv (https://github.com/tokuhirom/plenv) ]############ # Perl color. # typeset -g POWERLEVEL9K_PLENV_FOREGROUND=0 # typeset -g POWERLEVEL9K_PLENV_BACKGROUND=4 # Hide perl version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_PLENV_SOURCES=(shell local global) # If set to false, hide perl version if it's the same as global: # $(plenv version-name) == $(plenv global). typeset -g POWERLEVEL9K_PLENV_PROMPT_ALWAYS_SHOW=false # If set to false, hide perl version if it's equal to "system". typeset -g POWERLEVEL9K_PLENV_SHOW_SYSTEM=true # Custom icon. # typeset -g POWERLEVEL9K_PLENV_VISUAL_IDENTIFIER_EXPANSION='⭐' ############[ phpenv: php version from phpenv (https://github.com/phpenv/phpenv) ]############ # PHP color. # typeset -g POWERLEVEL9K_PHPENV_FOREGROUND=0 # typeset -g POWERLEVEL9K_PHPENV_BACKGROUND=5 # Hide php version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_PHPENV_SOURCES=(shell local global) # If set to false, hide php version if it's the same as global: # $(phpenv version-name) == $(phpenv global). typeset -g POWERLEVEL9K_PHPENV_PROMPT_ALWAYS_SHOW=false # If set to false, hide PHP version if it's equal to "system". typeset -g POWERLEVEL9K_PHPENV_SHOW_SYSTEM=true # Custom icon. # typeset -g POWERLEVEL9K_PHPENV_VISUAL_IDENTIFIER_EXPANSION='⭐' #######[ scalaenv: scala version from scalaenv (https://github.com/scalaenv/scalaenv) ]####### # Scala color. # typeset -g POWERLEVEL9K_SCALAENV_FOREGROUND=0 # typeset -g POWERLEVEL9K_SCALAENV_BACKGROUND=1 # Hide scala version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_SCALAENV_SOURCES=(shell local global) # If set to false, hide scala version if it's the same as global: # $(scalaenv version-name) == $(scalaenv global). typeset -g POWERLEVEL9K_SCALAENV_PROMPT_ALWAYS_SHOW=false # If set to false, hide scala version if it's equal to "system". typeset -g POWERLEVEL9K_SCALAENV_SHOW_SYSTEM=true # Custom icon. # typeset -g POWERLEVEL9K_SCALAENV_VISUAL_IDENTIFIER_EXPANSION='⭐' ##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]########### # Haskell color. # typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=0 # typeset -g POWERLEVEL9K_HASKELL_STACK_BACKGROUND=3 # Hide haskell version if it doesn't come from one of these sources. # # shell: version is set by STACK_YAML # local: version is set by stack.yaml up the directory tree # global: version is set by the implicit global project (~/.stack/global-project/stack.yaml) typeset -g POWERLEVEL9K_HASKELL_STACK_SOURCES=(shell local) # If set to false, hide haskell version if it's the same as in the implicit global project. typeset -g POWERLEVEL9K_HASKELL_STACK_ALWAYS_SHOW=true # Custom icon. # typeset -g POWERLEVEL9K_HASKELL_STACK_VISUAL_IDENTIFIER_EXPANSION='⭐' ################[ terraform: terraform workspace (https://www.terraform.io) ]################# # Don't show terraform workspace if it's literally "default". typeset -g POWERLEVEL9K_TERRAFORM_SHOW_DEFAULT=false # POWERLEVEL9K_TERRAFORM_CLASSES is an array with even number of elements. The first element # in each pair defines a pattern against which the current terraform workspace gets matched. # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) # that gets matched. If you unset all POWERLEVEL9K_TERRAFORM_*CONTENT_EXPANSION parameters, # you'll see this value in your prompt. The second element of each pair in # POWERLEVEL9K_TERRAFORM_CLASSES defines the workspace class. Patterns are tried in order. The # first match wins. # # For example, given these settings: # # typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( # '*prod*' PROD # '*test*' TEST # '*' OTHER) # # If your current terraform workspace is "project_test", its class is TEST because "project_test" # doesn't match the pattern '*prod*' but does match '*test*'. # # You can define different colors, icons and content expansions for different classes: # # typeset -g POWERLEVEL9K_TERRAFORM_TEST_FOREGROUND=2 # typeset -g POWERLEVEL9K_TERRAFORM_TEST_BACKGROUND=0 # typeset -g POWERLEVEL9K_TERRAFORM_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_TERRAFORM_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( # '*prod*' PROD # These values are examples that are unlikely # '*test*' TEST # to match your needs. Customize them as needed. '*' OTHER) typeset -g POWERLEVEL9K_TERRAFORM_OTHER_FOREGROUND=4 typeset -g POWERLEVEL9K_TERRAFORM_OTHER_BACKGROUND=0 # typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# # Show kubecontext only when the the command you are typing invokes one of these tools. # Tip: Remove the next line to always show kubecontext. typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile' # Kubernetes context classes for the purpose of using different colors, icons and expansions with # different contexts. # # POWERLEVEL9K_KUBECONTEXT_CLASSES is an array with even number of elements. The first element # in each pair defines a pattern against which the current kubernetes context gets matched. # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) # that gets matched. If you unset all POWERLEVEL9K_KUBECONTEXT_*CONTENT_EXPANSION parameters, # you'll see this value in your prompt. The second element of each pair in # POWERLEVEL9K_KUBECONTEXT_CLASSES defines the context class. Patterns are tried in order. The # first match wins. # # For example, given these settings: # # typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=( # '*prod*' PROD # '*test*' TEST # '*' DEFAULT) # # If your current kubernetes context is "deathray-testing/default", its class is TEST # because "deathray-testing/default" doesn't match the pattern '*prod*' but does match '*test*'. # # You can define different colors, icons and content expansions for different classes: # # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_FOREGROUND=0 # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_BACKGROUND=2 # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=( # '*prod*' PROD # These values are examples that are unlikely # '*test*' TEST # to match your needs. Customize them as needed. '*' DEFAULT) typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=7 typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_BACKGROUND=5 # typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' # Use POWERLEVEL9K_KUBECONTEXT_CONTENT_EXPANSION to specify the content displayed by kubecontext # segment. Parameter expansions are very flexible and fast, too. See reference: # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion. # # Within the expansion the following parameters are always available: # # - P9K_CONTENT The content that would've been displayed if there was no content # expansion defined. # - P9K_KUBECONTEXT_NAME The current context's name. Corresponds to column NAME in the # output of `kubectl config get-contexts`. # - P9K_KUBECONTEXT_CLUSTER The current context's cluster. Corresponds to column CLUSTER in the # output of `kubectl config get-contexts`. # - P9K_KUBECONTEXT_NAMESPACE The current context's namespace. Corresponds to column NAMESPACE # in the output of `kubectl config get-contexts`. If there is no # namespace, the parameter is set to "default". # - P9K_KUBECONTEXT_USER The current context's user. Corresponds to column AUTHINFO in the # output of `kubectl config get-contexts`. # # If the context points to Google Kubernetes Engine (GKE) or Elastic Kubernetes Service (EKS), # the following extra parameters are available: # # - P9K_KUBECONTEXT_CLOUD_NAME Either "gke" or "eks". # - P9K_KUBECONTEXT_CLOUD_ACCOUNT Account/project ID. # - P9K_KUBECONTEXT_CLOUD_ZONE Availability zone. # - P9K_KUBECONTEXT_CLOUD_CLUSTER Cluster. # # P9K_KUBECONTEXT_CLOUD_* parameters are derived from P9K_KUBECONTEXT_CLUSTER. For example, # if P9K_KUBECONTEXT_CLUSTER is "gke_my-account_us-east1-a_my-cluster-01": # # - P9K_KUBECONTEXT_CLOUD_NAME=gke # - P9K_KUBECONTEXT_CLOUD_ACCOUNT=my-account # - P9K_KUBECONTEXT_CLOUD_ZONE=us-east1-a # - P9K_KUBECONTEXT_CLOUD_CLUSTER=my-cluster-01 # # If P9K_KUBECONTEXT_CLUSTER is "arn:aws:eks:us-east-1:123456789012:cluster/my-cluster-01": # # - P9K_KUBECONTEXT_CLOUD_NAME=eks # - P9K_KUBECONTEXT_CLOUD_ACCOUNT=123456789012 # - P9K_KUBECONTEXT_CLOUD_ZONE=us-east-1 # - P9K_KUBECONTEXT_CLOUD_CLUSTER=my-cluster-01 typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION= # Show P9K_KUBECONTEXT_CLOUD_CLUSTER if it's not empty and fall back to P9K_KUBECONTEXT_NAME. POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='${P9K_KUBECONTEXT_CLOUD_CLUSTER:-${P9K_KUBECONTEXT_NAME}}' # Append the current context's namespace if it's not "default". POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}' # Custom prefix. # typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='at ' #[ aws: aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) ]# # Show aws only when the the command you are typing invokes one of these tools. # Tip: Remove the next line to always show aws. typeset -g POWERLEVEL9K_AWS_SHOW_ON_COMMAND='aws|awless|terraform|pulumi|terragrunt' # POWERLEVEL9K_AWS_CLASSES is an array with even number of elements. The first element # in each pair defines a pattern against which the current AWS profile gets matched. # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) # that gets matched. If you unset all POWERLEVEL9K_AWS_*CONTENT_EXPANSION parameters, # you'll see this value in your prompt. The second element of each pair in # POWERLEVEL9K_AWS_CLASSES defines the profile class. Patterns are tried in order. The # first match wins. # # For example, given these settings: # # typeset -g POWERLEVEL9K_AWS_CLASSES=( # '*prod*' PROD # '*test*' TEST # '*' DEFAULT) # # If your current AWS profile is "company_test", its class is TEST # because "company_test" doesn't match the pattern '*prod*' but does match '*test*'. # # You can define different colors, icons and content expansions for different classes: # # typeset -g POWERLEVEL9K_AWS_TEST_FOREGROUND=28 # typeset -g POWERLEVEL9K_AWS_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_AWS_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' typeset -g POWERLEVEL9K_AWS_CLASSES=( # '*prod*' PROD # These values are examples that are unlikely # '*test*' TEST # to match your needs. Customize them as needed. '*' DEFAULT) # typeset -g POWERLEVEL9K_AWS_DEFAULT_FOREGROUND=7 # typeset -g POWERLEVEL9K_AWS_DEFAULT_BACKGROUND=1 # typeset -g POWERLEVEL9K_AWS_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' #[ aws_eb_env: aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) ]# # AWS Elastic Beanstalk environment color. # typeset -g POWERLEVEL9K_AWS_EB_ENV_FOREGROUND=2 # typeset -g POWERLEVEL9K_AWS_EB_ENV_BACKGROUND=0 # Custom icon. # typeset -g POWERLEVEL9K_AWS_EB_ENV_VISUAL_IDENTIFIER_EXPANSION='⭐' ##########[ azure: azure account name (https://docs.microsoft.com/en-us/cli/azure) ]########## # Show azure only when the the command you are typing invokes one of these tools. # Tip: Remove the next line to always show azure. typeset -g POWERLEVEL9K_AZURE_SHOW_ON_COMMAND='az|terraform|pulumi|terragrunt' # Azure account name color. # typeset -g POWERLEVEL9K_AZURE_FOREGROUND=7 # typeset -g POWERLEVEL9K_AZURE_BACKGROUND=4 # Custom icon. # typeset -g POWERLEVEL9K_AZURE_VISUAL_IDENTIFIER_EXPANSION='⭐' ##########[ gcloud: google cloud account and project (https://cloud.google.com/) ]########### # Show gcloud only when the the command you are typing invokes one of these tools. # Tip: Remove the next line to always show gcloud. typeset -g POWERLEVEL9K_GCLOUD_SHOW_ON_COMMAND='gcloud|gcs' # Google cloud color. # typeset -g POWERLEVEL9K_GCLOUD_FOREGROUND=7 # typeset -g POWERLEVEL9K_GCLOUD_BACKGROUND=4 # Google cloud format. Change the value of POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION and/or # POWERLEVEL9K_GCLOUD_COMPLETE_CONTENT_EXPANSION if the default is too verbose or not informative # enough. You can use the following parameters in the expansions. Each of them corresponds to the # output of `gcloud` tool. # # Parameter | Source # -------------------------|-------------------------------------------------------------------- # P9K_GCLOUD_CONFIGURATION | gcloud config configurations list --format='value(name)' # P9K_GCLOUD_ACCOUNT | gcloud config get-value account # P9K_GCLOUD_PROJECT_ID | gcloud config get-value project # P9K_GCLOUD_PROJECT_NAME | gcloud projects describe $P9K_GCLOUD_PROJECT_ID --format='value(name)' # # Note: ${VARIABLE//\%/%%} expands to ${VARIABLE} with all occurrences of '%' replaced with '%%'. # # Obtaining project name requires sending a request to Google servers. This can take a long time # and even fail. When project name is unknown, P9K_GCLOUD_PROJECT_NAME is not set and gcloud # prompt segment is in state PARTIAL. When project name gets known, P9K_GCLOUD_PROJECT_NAME gets # set and gcloud prompt segment transitions to state COMPLETE. # # You can customize the format, icon and colors of gcloud segment separately for states PARTIAL # and COMPLETE. You can also hide gcloud in state PARTIAL by setting # POWERLEVEL9K_GCLOUD_PARTIAL_VISUAL_IDENTIFIER_EXPANSION and # POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION to empty. typeset -g POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION='${P9K_GCLOUD_PROJECT_ID//\%/%%}' typeset -g POWERLEVEL9K_GCLOUD_COMPLETE_CONTENT_EXPANSION='${P9K_GCLOUD_PROJECT_NAME//\%/%%}' # Send a request to Google (by means of `gcloud projects describe ...`) to obtain project name # this often. Negative value disables periodic polling. In this mode project name is retrieved # only when the current configuration, account or project id changes. typeset -g POWERLEVEL9K_GCLOUD_REFRESH_PROJECT_NAME_SECONDS=60 # Custom icon. # typeset -g POWERLEVEL9K_GCLOUD_VISUAL_IDENTIFIER_EXPANSION='⭐' #[ google_app_cred: google application credentials (https://cloud.google.com/docs/authentication/production) ]# # Show google_app_cred only when the the command you are typing invokes one of these tools. # Tip: Remove the next line to always show google_app_cred. typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_SHOW_ON_COMMAND='terraform|pulumi|terragrunt' # Google application credentials classes for the purpose of using different colors, icons and # expansions with different credentials. # # POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES is an array with even number of elements. The first # element in each pair defines a pattern against which the current kubernetes context gets # matched. More specifically, it's P9K_CONTENT prior to the application of context expansion # (see below) that gets matched. If you unset all POWERLEVEL9K_GOOGLE_APP_CRED_*CONTENT_EXPANSION # parameters, you'll see this value in your prompt. The second element of each pair in # POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES defines the context class. Patterns are tried in order. # The first match wins. # # For example, given these settings: # # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES=( # '*:*prod*:*' PROD # '*:*test*:*' TEST # '*' DEFAULT) # # If your current Google application credentials is "service_account deathray-testing x@y.com", # its class is TEST because it doesn't match the pattern '* *prod* *' but does match '* *test* *'. # # You can define different colors, icons and content expansions for different classes: # # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_FOREGROUND=28 # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_CONTENT_EXPANSION='$P9K_GOOGLE_APP_CRED_PROJECT_ID' typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES=( # '*:*prod*:*' PROD # These values are examples that are unlikely # '*:*test*:*' TEST # to match your needs. Customize them as needed. '*' DEFAULT) # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_FOREGROUND=7 # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_BACKGROUND=4 # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' # Use POWERLEVEL9K_GOOGLE_APP_CRED_CONTENT_EXPANSION to specify the content displayed by # google_app_cred segment. Parameter expansions are very flexible and fast, too. See reference: # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion. # # You can use the following parameters in the expansion. Each of them corresponds to one of the # fields in the JSON file pointed to by GOOGLE_APPLICATION_CREDENTIALS. # # Parameter | JSON key file field # ---------------------------------+--------------- # P9K_GOOGLE_APP_CRED_TYPE | type # P9K_GOOGLE_APP_CRED_PROJECT_ID | project_id # P9K_GOOGLE_APP_CRED_CLIENT_EMAIL | client_email # # Note: ${VARIABLE//\%/%%} expands to ${VARIABLE} with all occurrences of '%' replaced by '%%'. typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_CONTENT_EXPANSION='${P9K_GOOGLE_APP_CRED_PROJECT_ID//\%/%%}' ###############################[ public_ip: public IP address ]############################### # Public IP color. # typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=7 # typeset -g POWERLEVEL9K_PUBLIC_IP_BACKGROUND=0 # Custom icon. # typeset -g POWERLEVEL9K_PUBLIC_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' ########################[ vpn_ip: virtual private network indicator ]######################### # VPN IP color. # typeset -g POWERLEVEL9K_VPN_IP_FOREGROUND=0 # typeset -g POWERLEVEL9K_VPN_IP_BACKGROUND=6 # When on VPN, show just an icon without the IP address. # Tip: To display the private IP address when on VPN, remove the next line. typeset -g POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION= # Regular expression for the VPN network interface. Run `ifconfig` or `ip -4 a show` while on VPN # to see the name of the interface. typeset -g POWERLEVEL9K_VPN_IP_INTERFACE='(gpd|wg|(.*tun))[0-9]*' # If set to true, show one segment per matching network interface. If set to false, show only # one segment corresponding to the first matching network interface. # Tip: If you set it to true, you'll probably want to unset POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION. typeset -g POWERLEVEL9K_VPN_IP_SHOW_ALL=false # Custom icon. # typeset -g POWERLEVEL9K_VPN_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' ###########[ ip: ip address and bandwidth usage for a specified network interface ]########### # IP color. typeset -g POWERLEVEL9K_IP_BACKGROUND=4 typeset -g POWERLEVEL9K_IP_FOREGROUND=0 # The following parameters are accessible within the expansion: # # Parameter | Meaning # ----------------------+--------------- # P9K_IP_IP | IP address # P9K_IP_INTERFACE | network interface # P9K_IP_RX_BYTES | total number of bytes received # P9K_IP_TX_BYTES | total number of bytes sent # P9K_IP_RX_RATE | receive rate (since last prompt) # P9K_IP_TX_RATE | send rate (since last prompt) typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='${P9K_IP_RX_RATE:+⇣$P9K_IP_RX_RATE }${P9K_IP_TX_RATE:+⇡$P9K_IP_TX_RATE }$P9K_IP_IP' # Show information for the first network interface whose name matches this regular expression. # Run `ifconfig` or `ip -4 a show` to see the names of all network interfaces. typeset -g POWERLEVEL9K_IP_INTERFACE='e.*' # Custom icon. # typeset -g POWERLEVEL9K_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' #########################[ proxy: system-wide http/https/ftp proxy ]########################## # Proxy color. # typeset -g POWERLEVEL9K_PROXY_FOREGROUND=4 # typeset -g POWERLEVEL9K_PROXY_BACKGROUND=0 # Custom icon. # typeset -g POWERLEVEL9K_PROXY_VISUAL_IDENTIFIER_EXPANSION='⭐' ################################[ battery: internal battery ]################################# # Show battery in red when it's below this level and not connected to power supply. typeset -g POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20 typeset -g POWERLEVEL9K_BATTERY_LOW_FOREGROUND=1 # Show battery in green when it's charging or fully charged. typeset -g POWERLEVEL9K_BATTERY_{CHARGING,CHARGED}_FOREGROUND=2 # Show battery in yellow when it's discharging. typeset -g POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=3 # Battery pictograms going from low to high level of charge. typeset -g POWERLEVEL9K_BATTERY_STAGES='\uf58d\uf579\uf57a\uf57b\uf57c\uf57d\uf57e\uf57f\uf580\uf581\uf578' # Don't show the remaining time to charge/discharge. typeset -g POWERLEVEL9K_BATTERY_VERBOSE=false # typeset -g POWERLEVEL9K_BATTERY_BACKGROUND=0 #####################################[ wifi: wifi speed ]##################################### # WiFi color. # typeset -g POWERLEVEL9K_WIFI_FOREGROUND=0 # typeset -g POWERLEVEL9K_WIFI_BACKGROUND=4 # Custom icon. # typeset -g POWERLEVEL9K_WIFI_VISUAL_IDENTIFIER_EXPANSION='⭐' # Use different colors and icons depending on signal strength ($P9K_WIFI_BARS). # # # Wifi colors and icons for different signal strength levels (low to high). # typeset -g my_wifi_fg=(0 0 0 0 0) # <-- change these values # typeset -g my_wifi_icon=('WiFi' 'WiFi' 'WiFi' 'WiFi' 'WiFi') # <-- change these values # # typeset -g POWERLEVEL9K_WIFI_CONTENT_EXPANSION='%F{${my_wifi_fg[P9K_WIFI_BARS+1]}}$P9K_WIFI_LAST_TX_RATE Mbps' # typeset -g POWERLEVEL9K_WIFI_VISUAL_IDENTIFIER_EXPANSION='%F{${my_wifi_fg[P9K_WIFI_BARS+1]}}${my_wifi_icon[P9K_WIFI_BARS+1]}' # # The following parameters are accessible within the expansions: # # Parameter | Meaning # ----------------------+--------------- # P9K_WIFI_SSID | service set identifier, a.k.a. network name # P9K_WIFI_LINK_AUTH | authentication protocol such as "wpa2-psk" or "none"; empty if unknown # P9K_WIFI_LAST_TX_RATE | wireless transmit rate in megabits per second # P9K_WIFI_RSSI | signal strength in dBm, from -120 to 0 # P9K_WIFI_NOISE | noise in dBm, from -120 to 0 # P9K_WIFI_BARS | signal strength in bars, from 0 to 4 (derived from P9K_WIFI_RSSI and P9K_WIFI_NOISE) ####################################[ time: current time ]#################################### # Current time color. # typeset -g POWERLEVEL9K_TIME_FOREGROUND=0 # typeset -g POWERLEVEL9K_TIME_BACKGROUND=7 # Format for the current time: 09:51:02. See `man 3 strftime`. typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}' # If set to true, time will update when you hit enter. This way prompts for the past # commands will contain the start times of their commands as opposed to the default # behavior where they contain the end times of their preceding commands. typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false # Custom icon. # typeset -g POWERLEVEL9K_TIME_VISUAL_IDENTIFIER_EXPANSION='⭐' # Custom prefix. # typeset -g POWERLEVEL9K_TIME_PREFIX='at ' # Example of a user-defined prompt segment. Function prompt_example will be called on every # prompt if `example` prompt segment is added to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS or # POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS. It displays an icon and yellow text on red background # greeting the user. # # Type `p10k help segment` for documentation and a more sophisticated example. function prompt_example() { p10k segment -b 1 -f 3 -i '⭐' -t 'hello, %n' } # User-defined prompt segments may optionally provide an instant_prompt_* function. Its job # is to generate the prompt segment for display in instant prompt. See # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt. # # Powerlevel10k will call instant_prompt_* at the same time as the regular prompt_* function # and will record all `p10k segment` calls it makes. When displaying instant prompt, Powerlevel10k # will replay these calls without actually calling instant_prompt_*. It is imperative that # instant_prompt_* always makes the same `p10k segment` calls regardless of environment. If this # rule is not observed, the content of instant prompt will be incorrect. # # Usually, you should either not define instant_prompt_* or simply call prompt_* from it. If # instant_prompt_* is not defined for a segment, the segment won't be shown in instant prompt. function instant_prompt_example() { # Since prompt_example always makes the same `p10k segment` calls, we can call it from # instant_prompt_example. This will give us the same `example` prompt segment in the instant # and regular prompts. prompt_example } # User-defined prompt segments can be customized the same way as built-in segments. # typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=3 # typeset -g POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='⭐' # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt # when accepting a command line. Supported values: # # - off: Don't change prompt when accepting a command line. # - always: Trim down prompt when accepting a command line. # - same-dir: Trim down prompt when accepting a command line unless this is the first command # typed after changing current working directory. typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off # Instant prompt mode. # # - off: Disable instant prompt. Choose this if you've tried instant prompt and found # it incompatible with your zsh configuration files. # - quiet: Enable instant prompt and don't print warnings when detecting console output # during zsh initialization. Choose this if you've read and understood # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt. # - verbose: Enable instant prompt and print a warning when detecting console output during # zsh initialization. Choose this if you've never tried instant prompt, haven't # seen the warning, or if you are unsure what this all means. typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized. # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you # really need it. typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true # If p10k is already loaded, reload configuration. # This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true. (( ! $+functions[p10k] )) || p10k reload } # Tell `p10k configure` which file it should overwrite. typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a} (( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]} 'builtin' 'unset' 'p10k_config_opts' ================================================ FILE: oh-my-zsh/.zlogin ================================================ # -*- mode:sh; -*- ############################################################################### # This file is load **after** .zshrc # # Reminder: # 1. `~/.zshenv` : Usually run for every zsh # 2. `$ZDOTDIR/.zprofile`: Run for login shells # 3. `$ZDOTDIR/.zshrc`: Run for interactive shells.` # 4. `$ZDOTDIR/.zlogin`: Run for login shells (**after** .zshrc) # Load RVM into a shell session *as a function* [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* ================================================ FILE: oh-my-zsh/.zprofile ================================================ # -*- mode: sh -*- ############################################################################### # This file is load **before** .zshrc # # Reminder: # 1. `~/.zshenv` : Usually run for every zsh # 2. `$ZDOTDIR/.zprofile`: Run for login shells # 3. `$ZDOTDIR/.zshrc`: Run for interactive shells.` # 4. `$ZDOTDIR/.zlogin`: Run for login shells (**after** .zshrc) # check_task=$( which task 2>/dev/null ) # if [ -n "${check_task}" ]; then # task # fi # Created by `pipx` on 2024-06-13 15:40:32 export PATH="$PATH:/home/svarrette/.local/bin" ================================================ FILE: oh-my-zsh/.zshenv ================================================ # -*- mode: sh; -*- ############################################################################### # .zshenv -- My ZSH configuration (feat. Oh-my-zsh) # . see https://github.com/Falkor/dotfiles # _ # _______| |__ ___ _ ____ __ # |_ / __| '_ \ / _ \ '_ \ \ / / # _ / /\__ \ | | | __/ | | \ V / # (_)___|___/_| |_|\___|_| |_|\_/ # ############################################################################### # Resources: # - https://github.com/smaximov/zsh-config # # The proposed ZSH startup files are read the the below order: # (see http://zsh.sourceforge.net/Guide/zshguide02.html) # # 1. `~/.zshenv` : Usually run for every zsh # 2. `$ZDOTDIR/.zprofile`: Run for login shells # 3. `$ZDOTDIR/.zshrc`: Run for interactive shells.` # 4. `$ZDOTDIR/.zlogin`: Run for login shells (**after** .zshrc) # # In particular, assuming Falkor's dotfiles zsh repository are available under # ~/.config/zsh/, it should be sufficient to ake `~/.zshenv` a symbolic link # pointing to `$ZDOTDIR/.zshenv` (as this file sets $ZDOTDIR) # # ln -s .config/zsh/.zshenv ~/.zshenv # # === OVERVIEW === # This configuration enforces: # - `XDG_*` variables are set according to XDG Base Directory Specification # (see https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html): # * `XDG_CONFIG_HOME`: `~/.config` # * `XDG_DATA_HOME`: `~/.local/share` # * `XDG_CACHE_HOME`: `~/.cache` # - Some additional variables are set: # * `ZDOTDIR`: `$XDG_CONFIG_HOME/zsh` # * `ZSH`: `$XDG_DATA_HOME/oh-my-zsh` # * `ZSH_CACHE_DIR`: `$XDG_CACHE_HOME/zsh` # - ZSH config files located under `$ZDOTDIR`. # - Oh My Zsh files located under `$ZSH`. ############################################################################### # XDG Base Directory Specification # See https://specifications.freedesktop.org/basedir-spec/latest/ export XDG_CONFIG_HOME=$HOME/.config export XDG_CACHE_HOME=$HOME/.cache export XDG_DATA_HOME=$HOME/.local/share # enable en_US locale w/ UTF-8 encodings if not already configured export LANG=en_US.UTF-8 export LANGUAGE=en export LC_ALL="${LANG}" # Editor / pager unset ALTERNATE_EDITOR # Preferred editor for local and remote sessions test -n "$(command -v vim)" && EDITOR=vim || EDITOR=nano # Uncomment if you prefer macvim # [[ -n $SSH_CONNECTION ]] && EDITOR='mvim' export EDITOR #export EDITOR='emacsclient -t' if test -n "$(command -v less)" ; then PAGER="less -FirSwX" MANPAGER="less -FiRswX" else PAGER=more MANPAGER="$PAGER" fi export PAGER MANPAGER export VISUAL=$EDITOR export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib # ====== ZSH Specific variables ========= export ZDOTDIR=$XDG_CONFIG_HOME/zsh export ZSH_CACHE_DIR=$XDG_CACHE_HOME/zsh # Store ZSH files under XDG_CONFIG_HOME base directory. # This works by symlinking ~/.zshenv to ~/.config/zsh/.zshenv (this file). export HISTFILE=$ZSH_CACHE_DIR/zhistory # Bugfix titles in tabs under iTerm2 - see https://gitlab.com/gnachman/iterm2/-/issues/8145 export DISABLE_AUTO_TITLE="true" #================================================================ # [Final] Custom ZSH enviroment variables [[ -f $ZDOTDIR/custom.zshenv ]] && source $ZDOTDIR/custom.zshenv #================================================================ # $HOME, sweet $HOME export PATH export TERM="xterm-256color" # === Now ${ZDOTDIR}/.zshrc will be loaded.... === # Begin added by argcomplete fpath=( /usr/lib/python3/dist-packages/argcomplete/bash_completion.d "${fpath[@]}" ) # End added by argcomplete ================================================ FILE: oh-my-zsh/.zshrc ================================================ # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.config/zsh/.zshrc. # Initialization code that may require console input (password prompts, [y/n] # confirmations, etc.) must go above this block; everything else may go below. if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi # -*- mode:sh; -*- ############################################################################### # __ ___ _ __ __ __ _________ _ _ # | _/ _ \| |__ | \/ |_ |_ |__ / ___|| | | | # | | | | | '_ \ _____| |\/| | | | | | / /\___ \| |_| | # | | |_| | | | |_____| | | | |_| | |/ /_ ___) | _ | # | |\___/|_| |_| |_| |_|\__, | /____|____/|_| |_| # |__| |___/__| # ############################################################################### # Resources: # - https://github.com/smaximov/zsh-config # # You SHOULD have made `~/.zshenv` a symbolic link pointing to # `$ZDOTDIR/.zshenv` as follow: # # ln -s .config/zsh/.zshenv ~/.zshenv # # This ensure all expected environment variable (in particular the ones of # XDG Base Directory Specification (see https://specifications.freedesktop.org/basedir-spec/latest/) # are set ############################################################################### # Path to your oh-my-zsh installation. export ZSH=$XDG_DATA_HOME/oh-my-zsh # Custom directory location ZSH_CUSTOM=$ZDOTDIR/custom ## Update / check ZSH config # Courtesy https://github.com/smaximov/zsh-config/blob/master/lib/functions.zsh update-zsh-config() { omz update if [ -d "$XDG_CONFIG_HOME/dotfiles.falkor.d/.git" ]; then echo echo "=> Updating Falkor's dotfiles to the latest version" echo git -C $XDG_CONFIG_HOME/dotfiles.falkor.d pull --rebase origin fi } ################## Oh-My-ZSH (optional) customizations ######################## # # === Oh-My-ZSH Prompt Theme === # - Default themes:'$ZSH/themes/*' i.e. ~/.local/share/oh-my-zsh/themes/* # - Custom themes: '$ZSH_CUSTOM/themes/*' i.e. ~/config/zsh/custom/themes/* # Specific to powerlevel9k # ZSH_THEME="powerlevel9k/powerlevel9k" ZSH_THEME="powerlevel10k/powerlevel10k" # Customization of powerlevel9k: see custom falkor plugin below # OR overwrite these settings in $ZDOTDIR/custom.zshrc i.e. ~/config/zsh/custom.zshrc # update every 7 days by default export UPDATE_ZSH_DAYS=7 # Uncomment the following line to disable auto-setting terminal title. # DISABLE_AUTO_TITLE="true" # Uncomment the following line to enable command auto-correction. # ENABLE_CORRECTION="true" # Uncomment the following line to display red dots whilst waiting for completion. # COMPLETION_WAITING_DOTS="true" # Uncomment the following line if you want to disable marking untracked files # under VCS as dirty. This makes repository status check for large repositories # much, much faster. # DISABLE_UNTRACKED_FILES_DIRTY="true" ############################################################################## # # === Oh-My-ZSH Plugins === plugins=() # Add them wisely, as too many plugins slow down shell startup. #___________________ # - Default plugins: '$ZSH/plugins/*' i.e. ~/.local/share/oh-my-zsh/plugins/* # See https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins plugins+=(zsh-syntax-highlighting) # plugins+=(git-flow git-extras git-remote-branch) # Git plugins+=(git-flow git-extras) # Git plugins+=(nix-zsh-completions) # Nix plugins+=(rake gem rvm) # Ruby stuff plugins+=(pip) # Python stuff plugins+=(docker docker-compose) # Docker stuff plugins+=(kubectl minikube) # Kubernetes stuff if [[ "$(uname)" == "Darwin" ]]; then plugins+=(macos marked2) # Mac OS fi # Misc plugins+=(cp taskwarrior) plugins+=(zsh-ssh) #__________________ # - Custom plugins: '$ZSH_CUSTOM/plugins/*' i.e. ~/config./zsh/custom/plugins/ # plugins+=(falkor zsh-completions) #_______________________________________ # [Final] Custom Oh-my-ZSH configuration # (for instance to change the plugins/themes set by Falkor's dotfiles) [[ -f $ZDOTDIR/custom.zshrc ]] && source $ZDOTDIR/custom.zshrc ############################################################################## # Create ZSH cache directory unless it already exists [[ -d $ZSH_CACHE_DIR ]] || mkdir -p $ZSH_CACHE_DIR # Disable fancy colored shell prompts and auto-update on dumb terminals # if [ $TERM = "dumb" ]; then # unsetopt zle # PS1="$ " # DISABLE_AUTO_UPDATE=true # fi typeset -U fpath fpath=(~/git/github.com/Falkor/falkorlib/completion $fpath) # Load Oh-my-zsh source $ZSH/oh-my-zsh.sh # Load eventually common [custom] configuration, either: # - generic ZSH functions defined in $ZDOTDIR/lib # - common to all shells (from ~/.config/shell/[custom/]*.sh typically) # - specific custom to zsh (from ~/.config/zsh/custom/*.zsh for d in \ ${ZDOTDIR}/lib \ ${XDG_CONFIG_HOME}/shell \ ${XDG_CONFIG_HOME}/shell/custom \ ${ZDOTDIR}/custom do if [ -d "${d}" ]; then for f in ${d}/*.(sh|zsh)(N); do [[ -r "$f" ]] && source $f done fi done # Force re-completion autoload -U compinit && compinit # /!\ Reverse order (last $d below will be the first PATH entry!) for d in \ /usr/local/bin \ ${HOME}/.rvm/bin \ ${HOME}/.cargo/bin \ ${HOME}/.local/bin \ ${HOME}/bin do if [ -d "${d}" ]; then export PATH="${d}:$PATH" fi done typeset -U PATH path # Bindkeys - use sudo showkey -a to get sequences # Shift-Left / Shift-Right bindkey "^[[1;2D" backward-word bindkey "^[[1;2C" forward-word # Shift-Up / Shift-Down bindkey "^[[1;2A" beginning-of-line bindkey "^[[1;2B" end-of-line # rm -rf ${XDG_CONFIG_HOME}/zsh/.zcompdump* # To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh. [[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh ================================================ FILE: oh-my-zsh/README.md ================================================ # Falkor's Dotfiles -- OhMyZSH Customization ![](http://ohmyz.sh/img/OMZLogo_BnW.png) > [Oh-My-Zsh](http://ohmyz.sh) is an open source, community-driven framework for managing your ZSH configuration. It comes bundled with a ton of helpful functions, helpers, plugins, themes, and a few things that make you shout... So I use [Oh-My-Zsh](http://ohmyz.sh) using the excellent [powerlevel10k](https://github.com/romkatv/powerlevel10k) prompt theme and the [Darkside iTerm Color scheme](https://github.com/mbadolato/iTerm2-Color-Schemes/blob/master/schemes/Darkside.itermcolors). The font I use is [Meslo Nerd Font patched for Powerlevel10k](https://github.com/romkatv/powerlevel10k#meslo-nerd-font-patched-for-powerlevel10k) at 15pt (for both Regular and Non-ASCII font). You can find more information on the way I configured iTerm2 on [my blog](https://varrette.gforge.uni.lu/blog/2017/01/17/configuring-mac-os-on-your-brand-new-laptop/#iterm2-configuration). ## Screenshot ![](https://raw.githubusercontent.com/Falkor/dotfiles/master/screenshots/screenshot_falkor_iterm.png) ## Pre-requisites ### Dependency packages Install [fzf](https://github.com/junegunn/fzf) ### Meslo Nerd Font patched for Powerlevel10k See [instructions from powerlevel10k](https://github.com/romkatv/powerlevel10k#meslo-nerd-font-patched-for-powerlevel10k): if you are using iTerm2 or Termux, `p10k configure` can install the recommended font for you. Simply answer Yes when asked whether to install Meslo Nerd Font. ### Alternative: [Source Code Pro Patched fonts](https://github.com/Falkor/dotfiles/blob/master/fonts/SourceCodePro%2BPowerline%2BAwesome%2BRegular.ttf) You should install the [Source Code Pro Patched fonts](https://github.com/Falkor/dotfiles/raw/master/fonts/SourceCodePro%2BPowerline%2BAwesome%2BRegular.ttf) following [these instructions](https://github.com/bhilburn/powerlevel9k/wiki/Install-Instructions#step-2-install-powerline-fonts) yet adapted to this font. ### [Darkside](https://github.com/mbadolato/iTerm2-Color-Schemes/blob/master/schemes/Darkside.itermcolors) Color Scheme ![](https://github.com/mbadolato/iTerm2-Color-Schemes/raw/master/screenshots/darkside.png) You can find it (and many other color schemes) on and within [the associated github repository](https://github.com/mbadolato/iTerm2-Color-Schemes) (under `scheme/`). Install it within [iTerm2](https://www.iterm2.com/) by picking `Darkside[.itermcolors]` under `iTerm Preferences / Profiles / Colors / Load Presets`. You'll have to repeat it for all your profiles. ## Falkor's Custom plugin for Oh-My-ZSH Lots of things I do every day have been shortened within one, two or three character mnemonic aliases. You can find these aliases (together with my prompt customization) under the form of a [custom plugin for oh-My-ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Customization) named... [`Falkor`](custom/plugins/falkor/falkor.plugin.zsh) See [`falkor.plugin.zsh`](custom/plugins/falkor/falkor.plugin.zsh) for more details. ## Installation, the lazy way * [Install zsh](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH) * [Install Oh-My-ZSH](http://ohmyz.sh/) ```bash curl -fsSL --skip-existing -o /tmp/oh-my-zsh-installer.sh \ https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh less /tmp/oh-my-zsh-installer.sh # review installer # run it to install into $XDG_DATA_HOME/zsh ZSH=$HOME/.local/share/oh-my-zsh sh /tmp/oh-my-zsh-installer.sh ``` * Clone [Falkor's dotfile](https://github.com/Falkor/dotfile) as suggested, _i.e._ ```bash git clone https://github.com/Falkor/dotfiles.git ~/.config/dotfiles.falkor.d ``` Now run: ``` bash cd ~/.config/dotfiles.falkor.d ./install.sh -n --zsh # DRY_RUN ./install.sh --zsh ``` This will configure the following components: * `~/.zshenv` * `~/.config/zsh` * `~/.local/share/oh-my-zsh` (Oh-My-ZSH) * `$ZSH_CUSTOM`, pointing to `~/.config/zsh/custom` ## Uninstall ``` bash cd ~/.config/dotfiles.falkor.d ./install.sh --delete --zsh ``` ## Customizations you can define your own aliases under `~/.oh-my-zsh/custom/private_aliases.zsh` (which is **not meant to be tracked** thus ignored within [Falkor's dotfiles `oh-my-zsh/custom/.gitignore`](.gitignore) for instance). Follow also [this guide from Oh-My-ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Customization) for more details. In particular, you can install the following completions: ```bash git clone https://github.com/sunlei/zsh-ssh ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-ssh ``` ## Note on [Powerlevel10k](https://github.com/romkatv/powerlevel10k) theme configuration You might wish to reproduce my configuration of [Powerlevel10k](https://github.com/romkatv/powerlevel10k) as depicted in the above screenshot yet without installing my dotfiles. * Install the [recommended fonts](https://github.com/romkatv/powerlevel10k#meslo-nerd-font-patched-for-powerlevel10k). I prepared a dedicated script to install nerd fonts in another repository so feel free to use it (see [`scripts/font-install`](https://gitlab.com/svarrette-anssi/tutorial-git/-/blob/main/scripts/font-install)) ```bash wget -nv -P /tmp https://gitlab.com/svarrette-anssi/tutorial-git/-/raw/main/scripts/font-install less /tmp/font-install # review the script /tmp/font-install -h # help / usage /tmp/font-install # dry-run /tmp/font-install -x # => install FiraCode Meslo SourceCodePro ``` * Configure your favorite Terminal to use the patched Fonts with glyphs you just installed - also install your favorite [color scheme](https://gogh-co.github.io/Gogh/), in my case: DarkSide * Install [Powerlevel10k for your plugin manager](https://github.com/romkatv/powerlevel10k#get-started) if not yet done: ```bash git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k" ``` - In your zsh configuration, set `ZSH_THEME="powerlevel10k/powerlevel10k` * Copy [`p10k-falkor.zsh`](.p10k.zsh) into `$ZSH/.p10k.zsh` * Restart zsh See also [the official prompt customization guide](https://github.com/bhilburn/powerlevel9k#prompt-customization) for alternative segments you might wish to integrate. ================================================ FILE: oh-my-zsh/custom/.gitignore ================================================ /*.zsh ================================================ FILE: oh-my-zsh/custom/completions/_assh ================================================ #compdef assh ############################################################################### # -*- mode:sh; -*- # Time-stamp: # # Zsh completion for [assh](https://github.com/moul/advanced-ssh-config) # # Copyright (c) 2017 Sebastien Varrette ############################################################################### # Enable this completion file by adding somewhere in your zsh configuration (most # probably ~/.zshrc): # fpath=(/path/to/this/dir $fpath) # # Test modification of this file in live in your shell: # # unfunction _assh && autoload -U _assh # typeset -A opt_args # Main dispatcher _assh() { local -a _assh_cmds _assh_cmds=( 'info:Display system-wide information' 'config:Manage ssh and assh configuration' 'sockets:Manage control sockets' 'help:Shows a list of commands or help for one command' 'connect:Connect to host SSH socket, used by ProxyCommand' ) local curcontext="$curcontext" state line ret=1 typeset -A opt_args _arguments -C \ '(- *)'{-h,--help}'[show this help message and exit]' \ '(- *)'{--version,-v}"[Show the version and exit]" \ '(- *)'{-q,--quiet}"Silence warnings" \ '(- *)'{-V,--verbose}'[Enable verbose output]' \ '(- *)'{--debug,-D}'[Enable debug mode]' \ '(-c --config)'{-c,--config=}'[location of config file]:filename:_files' \ ': :->command' \ '*:: :->options' && ret=0 case $state in (command) _describe -t commands 'assh' _assh_cmds && ret=0 ;; (options) curcontext=${curcontext%:*}-$line[1]: case $line[1] in (config) __assh_config && ret=0;; (connect) _hosts && ret=0;; (info) ret=0;; (sockets) __assh_sockets && ret=0;; (help) # could do better here to avoid repetition _describe -t commands 'assh help' _assh_cmds && ret=0 ;; esac ;; esac return ret } ## Manage ssh and assh configuration __assh_config() { local -a _assh_config_cmds _assh_config_cmds=( 'build:Build .ssh/config' 'json:Returns the JSON output' 'list:List all hosts from assh config' 'graphviz:Generate a Graphviz graph of the hosts' 'search:Search entries by given search text' 'help:Shows a list of commands or help for one command' ) local curcontext="$curcontext" state line typeset -A opt_args _arguments -C \ '--help[show this help message and exit]' \ ': :->command' \ '*:: :->options' case $state in (command) _describe -t commands "assh config subcommand" _assh_config_cmds ;; (options) case $line[1] in (help) _describe -t commands 'assh config help' _assh_config_cmds && ret=0 ;; (build) _arguments -C \ {-h,--help}'[show this help message and exit]' \ {-e,--expand}'[Expand all fields]' \ '--ignore-known-hosts:Ignore known-hosts file' && ret=0 ;; (json|list) _arguments -C \ {-e,--expand}'[Expand all fields]' && ret=0 ;; (graphviz) _arguments -C \ '--show-isolated-hosts:Show isolated hosts' && ret=0 ;; esac ;; esac return ret } # Manage control sockets __assh_sockets() { local -a _assh_config_cmds _assh_sockets_cmds=( 'list:List active control sockets' 'flush:Close control sockets' 'master:Open a master control socket' ) local curcontext="$curcontext" state line typeset -A opt_args _arguments -C \ '--help[show this help message and exit]' \ ': :->command' \ '*:: :->options' case $state in (command) _describe -t commands "assh sockets subcommand" _assh_sockets_cmds ;; (options) case $line[1] in (help) _describe -t commands 'assh sockets help' _assh_sockets_cmds && ret=0 ;; (list|flush|master) _arguments -C \ {-h,--help}'[show this help message and exit]' && ret=0 ;; esac ;; esac return ret } ================================================ FILE: oh-my-zsh/custom/completions/_devbox ================================================ #compdef devbox compdef _devbox devbox # zsh completion for devbox -*- shell-script -*- __devbox_debug() { local file="$BASH_COMP_DEBUG_FILE" if [[ -n ${file} ]]; then echo "$*" >> "${file}" fi } _devbox() { local shellCompDirectiveError=1 local shellCompDirectiveNoSpace=2 local shellCompDirectiveNoFileComp=4 local shellCompDirectiveFilterFileExt=8 local shellCompDirectiveFilterDirs=16 local shellCompDirectiveKeepOrder=32 local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder local -a completions __devbox_debug "\n========= starting completion logic ==========" __devbox_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" # The user could have moved the cursor backwards on the command-line. # We need to trigger completion from the $CURRENT location, so we need # to truncate the command-line ($words) up to the $CURRENT location. # (We cannot use $CURSOR as its value does not work when a command is an alias.) words=("${=words[1,CURRENT]}") __devbox_debug "Truncated words[*]: ${words[*]}," lastParam=${words[-1]} lastChar=${lastParam[-1]} __devbox_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" # For zsh, when completing a flag with an = (e.g., devbox -n=) # completions must be prefixed with the flag setopt local_options BASH_REMATCH if [[ "${lastParam}" =~ '-.*=' ]]; then # We are dealing with a flag with an = flagPrefix="-P ${BASH_REMATCH}" fi # Prepare the command to obtain completions requestComp="${words[1]} __complete ${words[2,-1]}" if [ "${lastChar}" = "" ]; then # If the last parameter is complete (there is a space following it) # We add an extra empty parameter so we can indicate this to the go completion code. __devbox_debug "Adding extra empty parameter" requestComp="${requestComp} \"\"" fi __devbox_debug "About to call: eval ${requestComp}" # Use eval to handle any environment variables and such out=$(eval ${requestComp} 2>/dev/null) __devbox_debug "completion output: ${out}" # Extract the directive integer following a : from the last line local lastLine while IFS='\n' read -r line; do lastLine=${line} done < <(printf "%s\n" "${out[@]}") __devbox_debug "last line: ${lastLine}" if [ "${lastLine[1]}" = : ]; then directive=${lastLine[2,-1]} # Remove the directive including the : and the newline local suffix (( suffix=${#lastLine}+2)) out=${out[1,-$suffix]} else # There is no directive specified. Leave $out as is. __devbox_debug "No directive found. Setting do default" directive=0 fi __devbox_debug "directive: ${directive}" __devbox_debug "completions: ${out}" __devbox_debug "flagPrefix: ${flagPrefix}" if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then __devbox_debug "Completion received error. Ignoring completions." return fi local activeHelpMarker="_activeHelp_ " local endIndex=${#activeHelpMarker} local startIndex=$((${#activeHelpMarker}+1)) local hasActiveHelp=0 while IFS='\n' read -r comp; do # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker) if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then __devbox_debug "ActiveHelp found: $comp" comp="${comp[$startIndex,-1]}" if [ -n "$comp" ]; then compadd -x "${comp}" __devbox_debug "ActiveHelp will need delimiter" hasActiveHelp=1 fi continue fi if [ -n "$comp" ]; then # If requested, completions are returned with a description. # The description is preceded by a TAB character. # For zsh's _describe, we need to use a : instead of a TAB. # We first need to escape any : as part of the completion itself. comp=${comp//:/\\:} local tab="$(printf '\t')" comp=${comp//$tab/:} __devbox_debug "Adding completion: ${comp}" completions+=${comp} lastComp=$comp fi done < <(printf "%s\n" "${out[@]}") # Add a delimiter after the activeHelp statements, but only if: # - there are completions following the activeHelp statements, or # - file completion will be performed (so there will be choices after the activeHelp) if [ $hasActiveHelp -eq 1 ]; then if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then __devbox_debug "Adding activeHelp delimiter" compadd -x "--" hasActiveHelp=0 fi fi if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then __devbox_debug "Activating nospace." noSpace="-S ''" fi if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then __devbox_debug "Activating keep order." keepOrder="-V" fi if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then # File extension filtering local filteringCmd filteringCmd='_files' for filter in ${completions[@]}; do if [ ${filter[1]} != '*' ]; then # zsh requires a glob pattern to do file filtering filter="\*.$filter" fi filteringCmd+=" -g $filter" done filteringCmd+=" ${flagPrefix}" __devbox_debug "File filtering command: $filteringCmd" _arguments '*:filename:'"$filteringCmd" elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then # File completion for directories only local subdir subdir="${completions[1]}" if [ -n "$subdir" ]; then __devbox_debug "Listing directories in $subdir" pushd "${subdir}" >/dev/null 2>&1 else __devbox_debug "Listing directories in ." fi local result _arguments '*:dirname:_files -/'" ${flagPrefix}" result=$? if [ -n "$subdir" ]; then popd >/dev/null 2>&1 fi return $result else __devbox_debug "Calling _describe" if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then __devbox_debug "_describe found some completions" # Return the success of having called _describe return 0 else __devbox_debug "_describe did not find completions." __devbox_debug "Checking if we should do file completion." if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then __devbox_debug "deactivating file completion" # We must return an error code here to let zsh know that there were no # completions found by _describe; this is what will trigger other # matching algorithms to attempt to find completions. # For example zsh can match letters in the middle of words. return 1 else # Perform file completion __devbox_debug "Activating file completion" # We must return the result of this command, so it must be the # last command, or else we must store its result to return it. _arguments '*:filename:_files'" ${flagPrefix}" fi fi fi } # don't run the completion function when being source-ed or eval-ed if [ "$funcstack[1]" = "_devbox" ]; then _devbox fi ================================================ FILE: oh-my-zsh/custom/completions/_gh ================================================ #compdef gh compdef _gh gh # zsh completion for gh -*- shell-script -*- __gh_debug() { local file="$BASH_COMP_DEBUG_FILE" if [[ -n ${file} ]]; then echo "$*" >> "${file}" fi } _gh() { local shellCompDirectiveError=1 local shellCompDirectiveNoSpace=2 local shellCompDirectiveNoFileComp=4 local shellCompDirectiveFilterFileExt=8 local shellCompDirectiveFilterDirs=16 local shellCompDirectiveKeepOrder=32 local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder local -a completions __gh_debug "\n========= starting completion logic ==========" __gh_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" # The user could have moved the cursor backwards on the command-line. # We need to trigger completion from the $CURRENT location, so we need # to truncate the command-line ($words) up to the $CURRENT location. # (We cannot use $CURSOR as its value does not work when a command is an alias.) words=("${=words[1,CURRENT]}") __gh_debug "Truncated words[*]: ${words[*]}," lastParam=${words[-1]} lastChar=${lastParam[-1]} __gh_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" # For zsh, when completing a flag with an = (e.g., gh -n=) # completions must be prefixed with the flag setopt local_options BASH_REMATCH if [[ "${lastParam}" =~ '-.*=' ]]; then # We are dealing with a flag with an = flagPrefix="-P ${BASH_REMATCH}" fi # Prepare the command to obtain completions requestComp="${words[1]} __complete ${words[2,-1]}" if [ "${lastChar}" = "" ]; then # If the last parameter is complete (there is a space following it) # We add an extra empty parameter so we can indicate this to the go completion code. __gh_debug "Adding extra empty parameter" requestComp="${requestComp} \"\"" fi __gh_debug "About to call: eval ${requestComp}" # Use eval to handle any environment variables and such out=$(eval ${requestComp} 2>/dev/null) __gh_debug "completion output: ${out}" # Extract the directive integer following a : from the last line local lastLine while IFS='\n' read -r line; do lastLine=${line} done < <(printf "%s\n" "${out[@]}") __gh_debug "last line: ${lastLine}" if [ "${lastLine[1]}" = : ]; then directive=${lastLine[2,-1]} # Remove the directive including the : and the newline local suffix (( suffix=${#lastLine}+2)) out=${out[1,-$suffix]} else # There is no directive specified. Leave $out as is. __gh_debug "No directive found. Setting do default" directive=0 fi __gh_debug "directive: ${directive}" __gh_debug "completions: ${out}" __gh_debug "flagPrefix: ${flagPrefix}" if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then __gh_debug "Completion received error. Ignoring completions." return fi local activeHelpMarker="_activeHelp_ " local endIndex=${#activeHelpMarker} local startIndex=$((${#activeHelpMarker}+1)) local hasActiveHelp=0 while IFS='\n' read -r comp; do # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker) if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then __gh_debug "ActiveHelp found: $comp" comp="${comp[$startIndex,-1]}" if [ -n "$comp" ]; then compadd -x "${comp}" __gh_debug "ActiveHelp will need delimiter" hasActiveHelp=1 fi continue fi if [ -n "$comp" ]; then # If requested, completions are returned with a description. # The description is preceded by a TAB character. # For zsh's _describe, we need to use a : instead of a TAB. # We first need to escape any : as part of the completion itself. comp=${comp//:/\\:} local tab="$(printf '\t')" comp=${comp//$tab/:} __gh_debug "Adding completion: ${comp}" completions+=${comp} lastComp=$comp fi done < <(printf "%s\n" "${out[@]}") # Add a delimiter after the activeHelp statements, but only if: # - there are completions following the activeHelp statements, or # - file completion will be performed (so there will be choices after the activeHelp) if [ $hasActiveHelp -eq 1 ]; then if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then __gh_debug "Adding activeHelp delimiter" compadd -x "--" hasActiveHelp=0 fi fi if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then __gh_debug "Activating nospace." noSpace="-S ''" fi if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then __gh_debug "Activating keep order." keepOrder="-V" fi if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then # File extension filtering local filteringCmd filteringCmd='_files' for filter in ${completions[@]}; do if [ ${filter[1]} != '*' ]; then # zsh requires a glob pattern to do file filtering filter="\*.$filter" fi filteringCmd+=" -g $filter" done filteringCmd+=" ${flagPrefix}" __gh_debug "File filtering command: $filteringCmd" _arguments '*:filename:'"$filteringCmd" elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then # File completion for directories only local subdir subdir="${completions[1]}" if [ -n "$subdir" ]; then __gh_debug "Listing directories in $subdir" pushd "${subdir}" >/dev/null 2>&1 else __gh_debug "Listing directories in ." fi local result _arguments '*:dirname:_files -/'" ${flagPrefix}" result=$? if [ -n "$subdir" ]; then popd >/dev/null 2>&1 fi return $result else __gh_debug "Calling _describe" if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then __gh_debug "_describe found some completions" # Return the success of having called _describe return 0 else __gh_debug "_describe did not find completions." __gh_debug "Checking if we should do file completion." if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then __gh_debug "deactivating file completion" # We must return an error code here to let zsh know that there were no # completions found by _describe; this is what will trigger other # matching algorithms to attempt to find completions. # For example zsh can match letters in the middle of words. return 1 else # Perform file completion __gh_debug "Activating file completion" # We must return the result of this command, so it must be the # last command, or else we must store its result to return it. _arguments '*:filename:_files'" ${flagPrefix}" fi fi fi } # don't run the completion function when being source-ed or eval-ed if [ "$funcstack[1]" = "_gh" ]; then _gh fi ================================================ FILE: oh-my-zsh/custom/completions/_git-subtree ================================================ #compdef git-subtree #description mange subtree paths __git_subtree() { local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -C \ '(-h --help)'{-h,--help}'[show the help]' \ '-q[quiet command output]' \ '-d[show debug messages]' \ ': :->command' \ '*:: :->option-or-argument' && ret=0 case $state in (command) declare -a commands commands=( 'add:add a new subtree' 'merge:merge remote refspec into prefix' 'pull:fetch remote refspec and merge' 'push:push local changes to remote refspec' 'split:separate local subtree into separate branch') _describe -t commands command commands && ret=0 ;; (option-or-argument) curcontext=${curcontext%:*}-$line[1]: case $line[1] in (add|merge|pull|push) _arguments -w -S -s \ '--squash[merge subtree changes as a single commit]' \ '(-P,--prefix)'{-P,--prefix=}'[path to the subdirectory]:subtree path:_directories -r ""' \ '(-m,--message)'{-m,--message=}'[commit message for the merge]' \ ':repository:__git_any_repositories' \ ':remote branch:__git_remotes' && ret=0 ;; (split) _arguments -w -S -s \ '--annotate=[add message as annotation to each commit]' \ '(-b,--branch)'{-b,--branch=}'[name of branch to contain new history]: :__git_local_branch_names' \ '(-P,--prefix)'{-P,--prefix=}'[path to the subdirectory]:subtree path:_directories -r ""' \ '--ignore-joins[force regeneration of entire history, skips rejoin points]' \ '--onto=[commit id of first revision of subproject history]: :__git_tree_ishs' \ '--rejoin[merge newly created history back into main project]' && ret=0 ;; esac ;; esac return ret } # vim: set ft=zsh: ================================================ FILE: oh-my-zsh/custom/completions/_keybase ================================================ #compdef keybase #autoload # keybase completion, based on cli help text # https://github.com/rbirnie/oh-my-zsh-keybase local curcontext="$curcontext" state line ret=1 local -a _command_args _arguments -C -A "-v" -A "--version" \ '(- 1 *)'{-v,--version}'[display version information]' \ '1: :->cmds' \ '*:: :->args' && ret=0 case $state in cmds) _values "keybase command" \ "btc[add a signed cryptocurrency address to your profile]" \ "cert[print out the CA cert the client uses to authorize HTTPS connections]" \ "dir[sign or verify a directory's contents]" \ "config[make an initial configuration file]" \ "decrypt[decrypt a file]" \ "encrypt[encrypt a message and output to stdout or a file]" \ "help[display help]" \ "id[Identify a user, but do not accept or reject trust]" \ "join[establish a new account on keybase.io]" \ "keygen[generate a new PGP public key and optionally push it to the server]" \ "list-signatures[list of your non-revoked signatures]" \ "list-tracking[list people you are tracking]" \ "login[establish a session]" \ "logout[logout from the server]" \ "pull[pull your public (& private, if possible) key(s) from the server]" \ "push[push a PGP key from the client to the server]" \ "prove[add a proof of identity]" \ "reset[reset the local setup, deleting all local cached state]" \ "revoke[revoke the currently active PGP keys]" \ "revoke-signatures[revoke a proof or signature]" \ "search[search all users]" \ "sign[sign a message]" \ "status[print current status]" \ "switch[switch to a different user, and nuke the current state]" \ "track[verify a user's authenticity and optionally track them]" \ "untrack[untrack this user]" \ "update[update the keybase client software]" \ "verify[verify a file]" \ "version[output version information about this client]" ret=0 ;; args) case $line[1] in help) _values 'commands' \ 'btc' \ 'cert' \ 'dir' \ 'config' \ 'decrypt' \ 'encrypt' \ 'help' \ 'id' \ 'join' \ 'keygen' \ 'list-signatures' \ 'list-tracking' \ 'login' \ 'logout' \ 'pull' \ 'push' \ 'prove' \ 'reset' \ 'revoke' \ 'revoke-signatures' \ 'search' \ 'sign' \ 'status' \ 'switch' \ 'track' \ 'untrack' \ 'update' \ 'verify' \ 'version' && ret=0 ;; btc) _values "btc command" \ 'btc[the address to sign and publicly post]' _command_args=( '(--force)--force[force overwrite, revoking any old addresses]' ) ;; cert) _values "cert command" \ 'host[which host to authorize]' _command_args=( '(--all)--all[list all possible certs in JSON form]' \ ) ;; config) _command_args=( '(--get)--get[Read the given configuration option]:GET' \ '(--json)--json[interpret the value as JSON]' \ '(--pretty)--pretty[pretty-print JSON]' \ '(--server)--server[specify which server to use]:SERVER' \ '(--reset-server)--reset-server[reset the server to default]' \ ) ;; decrypt) _command_args=( '(--base64)--base64[output result as base64-encoded data]' \ '(--track-remote)--track-remote[remotely track by default]' \ '(--track-local)--track-local[do not prompt for remote tracking]' \ '(--assert)--assert=-[provide an identity assertion]:ASSERT' \ '(--batch)--batch[batch-mode without interactivity]' \ '(--prompt-remote)--prompt-remote[prompt for remote tracking]' \ '(--track)--track[prompt for tracking if necessary]' \ '(--no-id)--no-id[do not try to ID the user]' \ '(--signed)--signed[assert signed]' \ '(--signed-by)--signed-by=-[assert signed by the given user]:SIGNED_BY' \ '(--message)--message=-[provide the message on the command line]:MESSAGE' \ '(--output)--output=-[output to the given file]:OUTPUT'\ ) _files ;; dir) _values "dir command" \ "sign[sign a directory's contents]" \ "verify[verify a directory's contents]" ;; encrypt) _command_args=( '(--track-remote)--track-remote[remotely track by default]' \ '(--track-local)--track-local[do not prompt for remote tracking]' \ '(--assert)--assert=-[provide an identity assertion]:ASSERT' \ '(--batch)--batch[batch-mode without interactivity]' \ '(--prompt-remote)--prompt-remote[prompt for remote tracking]' \ '(--sign)--sign[sign in addition to encrypting]' \ '(--message)--message=-[provide the message on the command line]:MESSAGE' \ '(--binary)--binary[output in binary (rather than ASCII/armored)]' \ '(--output)--output=-[the output file to write the encryption to]' \ ) _values "encrypt command" \ 'them[the username of the receiver]' _files ;; id) _values "id command" \ 'them[the username to id]' _command_args=( '(--assert)--assert=-[provide a key assertion]:ASSERT' \ ) ;; keygen) _command_args=( '(--push)--push[true if we should push]' \ '(--secret)--secret[push the secret key to the server]' \ '(--update)--update[update the public key with new key fields]' \ ) ;; list-signatures) _command_args=( '(--revoked)--revoked[show revoked signatures too]' \ '(--verbose)--verbose[a full dump, with more gory details]' \ '(--json)--json[output in json format; default is simple text list]' \ '(--type)--type=-[the type of signatures to output; choose from "track","proof","currency","self"; all by default]:TYPE' \ ) ;; list-tracking) _command_args=( '(--verbose)--verbose[a full dump, with more gory details]' \ '(--json)--json[output in json format; default is simple text list]' \ ) _values "list-tracking" \ 'filter[a regex to filter by]' ;; login) _command_args=( '(--no-key-pull)--no-key-pull[do not pull secret key from server]' \ ) ;; pull) _command_args=( '(--force)--force[force repull from server even if it is already stored locally]' \ ) ;; push) _command_args=( '(--gen)--gen[generate a new key]' \ '(--show-public-only-keys)--show-public-only-keys[Allow picking of public keys for which no secret key is available (not recommended)]' \ '(--skip-add-email)--skip-add-email[Skip the prompt asking if we want to store email to key; do not do it]' \ '(--add-email)--add-email[Add email to key by default, if needed]' \ '(--secret)--secret[push the secret key to the server]' \ '(--update)--update[update the public key with new key fields]' \ ) _values "push command" \ 'search[search parameter to find the right key]' ;; prove) _command_args=( '(--help)--help[Show this help message and exit.]' \ '(--force)--force[do not stop for any prompts]' \ '(--output)--output[output proof text to file (rather than standard out)]:OUTPUT' \ ) _values "push command" \ 'service[the name of service; can be one of: {twitter,github,web,dns,reddit,coinbase,hackernews}]' \ 'remote_name[username or hostname at that service]' ;; reset|revoke|switch) _command_args=( '(--force)--force[do not prompt for approval; force it]' \ ) ;; revoke-signatures) _command_args=( '(--seqno)--seqno[specify signature as a sequence number]' \ ) ;; search) _command_args=( '(--verbose)--verbose[a full dump, with more gory details]' \ '(--json)--json[output in json format; default is simple text list]' \ ) ;; sign) _command_args=( '(--message)--message=-[provide the message on the command line]:MESSAGE' \ '(--binary)--binary[output in binary (rather than ASCII/armored)]' \ '(--clearsign)--clearsign[make a clear signature]' \ '(--detach-sign)--detach-sign[make a detached signature]' \ '(--output)--output=-[specify an output file]:OUTPUT:_files' \ ) _files ;; status) _command_args=( '(--text)--text[output in text format; default is JSON]' \ ) ;; track) _command_args=( '(--track-remote)--track-remote[remotely track by default]' \ '(--track-local)--track-local[do not prompt for remote tracking]' \ '(--assert)--assert=-[provide an identity assertion]:ASSERT' \ '(--batch)--batch[batch-mode without interactivity]' \ '(--prompt-remote)--prompt-remote[prompt for remote tracking]' \ ) _values "untrack command" \ 'them[the username of the user to track]' ;; untrack) _command_args=( '(--remove-key)--remove-key[remove key from GPG keyring]' \ '(--batch)--batch[run in batch mode / do not prompt]' \ '(--keep-key)--keep-key[preserve key in GPG keyring]' \ ) _values "untrack command" \ 'them[the username of the user to untrack]' ;; update) _command_args=( '(--npm)--npm=-[an alternate path for NPM]:NPM' \ '(--url)--url=-[specify a URL prefix for fetching]:URL' \ '(--skip-cleanup)--skip-cleanup[Do not cleanup temporary stuff after install]' \ '(--cmd)--cmd=-[the command to run]:CMD' \ '(--prefix)--prefix=-[the prefix to install to]:PREFIX' \ '(--global)--global[install globally; do not try to guess prefix]' \ ) ;; verify) _command_args=( '(--base64)--base64[output result as base64-encoded data]' \ '(--track-remote)--track-remote[remotely track by default]' \ '(--track-local)--track-local[do not prompt for remote tracking]' \ '(--assert)--assert=-[provide an identity assertion]:ASSERT' \ '(--batch)--batch[batch-mode without interactivity]' \ '(--prompt-remote)--prompt-remote[prompt for remote tracking]' \ '(--track)--track[prompt for tracking if necessary]' \ '(--no-id)--no-id[do not try to ID the user]' \ '(--signed)--signed[assert signed]' \ '(--signed-by)--signed-by=-[assert signed by the given user]:SIGNED_BY' \ '(--message)--message=-[provide the message on the command line]:MESSAGE' \ ) _files ;; esac ;; esac _arguments \ $_command_args \ '(-h)'--help'[Show help message and exit.]' \ && return 0 return ret ================================================ FILE: oh-my-zsh/custom/completions/_mkdocs ================================================ #compdef mkdocs ######################################################################################## # -*- mode:sh; -*- # Time-stamp: # # Zsh completion for [MkDocs](http://www.mkdocs.org/) # # Copyright (c) 2017 Sebastien Varrette ################################################################################ # Enable this completion file by adding somewhere in your zsh configuration (most # probably ~/.zshrc): # fpath=(/path/to/this/dir $fpath) # Test modification in live in your shell: # # unfunction _mkdocs && autoload -U _mkdocs # typeset -A opt_args # Main dispatcher _mkdocs() { local -a _mkdocs_cmds _mkdocs_cmds=( 'build:Build the MkDocs documentation' 'gh-deploy:Deploy your documentation to GitHub Pages' 'json:Build the MkDocs documentation to JSON files...' 'new:Create a new MkDocs project' 'serve:Run the builtin development server' ) local curcontext="$curcontext" state line ret=1 typeset -A opt_args _arguments -C \ '(- *)'{-h,--help}'[show this help message and exit]' \ '(- *)'{--version,-V}"[Show the version and exit]" \ '(- *)'{-q,--quiet}"Silence warnings" \ '(- *)'{-v,--verbose}'[Enable verbose output]' \ ': :->command' \ '*:: :->options' && ret=0 case $state in (command) _describe -t commands 'mkdocs' _mkdocs_cmds && ret=0 ;; (options) curcontext=${curcontext%:*}-$line[1]: case $line[1] in (build) ret=0;; (serve) __mkdocs_serve && ret=0;; (new) _arguments -C \ {-h,--help}'[show this help message and exit]' \ ":dir:_directories" && ret=0;; esac ;; esac return ret } ## Run the builtin development server __mkdocs_serve() { local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -s -S \ {-h,--help}'[show this help message and exit]:' \ {-q,--quiet}"[Silence warnings]:" \ {-v,--verbose}'[Enable verbose output]' \ {-s,--strict}'[Enable strict mode. This will cause MkDocs to abort the build on any warnings.]' \ '--theme[The theme to use when building your documentation]:theme:(readthedocs mkdocs)' \ '--livereload[Enable the live reloading in the development server (this is the default)]' \ '--no-livereload[Disable the live reloading in the development server]' \ '--dirtyreload[Enable the live reloading in the development server, but only re-build files that have changed]' \ '--dev-addr[IP address and port to serve documentation locally]:host:(localhost\:8000 localhost\:8080)' \ "*::args:_nothing" } _mkdocs "$@" ================================================ FILE: oh-my-zsh/custom/completions/_parallel ================================================ #compdef parallel ############################################################################### # -*- mode:sh; -*- # Zsh completion for GNU parallel # # Adapted from https://github.com/cgjosephlee/GNU-parallel-zsh-completion/ # (completed with my other options) ############################################################################### # Enable this completion file by adding somewhere in your zsh configuration (most # probably ~/.zshrc): # fpath=(/path/to/this/dir $fpath) # # Test modification of this file in live in your shell: # # unfunction _parallel && autoload -U _parallel # local args args+=( '(--bar)--bar[Show progress as a progress bar]' '(--bg)--bg[Run command in background]' '(--dry-run)--dry-run[Print the job to run and do nothing]' '(--eta)--eta[Show the estimated number of seconds before finishing]' '(-j --jobs --max-procs -P)'{-j+,--jobs,--max-procs,-P+}'[Run this many jobs in parallel (see manual)]:int:' '(--joblog)--joblog[Logfile for executed jobs]::_files' '(-k --keep-order)'{-k,--keep-order}'[Keep sequence of output same as the order of input]' '(--fg)--fg[Run command in foreground]' '(-C --colsep)'{-C,--colsep}'[Column separator]:regexp:' '(--number-of-cores)--number-of-cores[Print the number of physical CPU cores and exit]' '(--number-of-threads)--number-of-threads[Print the number of hyperthreaded CPU cores and exit]' '(--pipe --spreadstdin)'{--pipe,--spreadstdin}'[Spread input to jobs on stdin]' '(-p --interactive)'{-p,--interactive}'[Prompt the user about whether to run each command line (implies -v)]' '(--plus)--plus[Activate additional replacement strings]' '(--progress)--progress[Show progress of computations]' '(-r --no-run-if-empty)'{-r,--no-run-if-empty}'[Skip if the stdin only contains whitespace]' '(--recstart)--recstart[String used to split at record start]:string:' '(--recend)--recend[String used to split at record end]:string:' '(--resume --resume-failed --retry-failed)'{--resume,--resume-failed,--retry-failed}'[Retry all failed jobs in joblog (see manual)]' '(--retries)--retries[Retry n times]:int:' '(--rpl)--rpl[Use tag as a replacement string for perl expression]:string:' '(--regexp)--regexp[Interpret --recstart and --recend as regular expressions]:string:' '(--semaphore)--semaphore[Work as a counting semaphore (implies --bg)]' '(--tag)--tag[Tag lines with arguments as prefix and TAB (\t)]' '(--tee)--tee[Pipe all data to all jobs]' '(--trim)--trim[Trim white space in input]:string:(( n\:\ No\ trim l\:\ Left\ trim r\:\ Right\ trim lr\:\ Both\ trim rl\:\ Both\ trim ))' '(--use-cores-instead-of-threads)--use-cores-instead-of-threads[Use physical cores instead of hyperthreaded cores as parallelism degree]' '(-v --verbose)'{-v,--verbose}'[Print the job to be run on stderr]' '(-):command: _command_names -e' '*::args: _normal' ) _arguments -s $args ================================================ FILE: oh-my-zsh/custom/completions/_poetry ================================================ #compdef poetry _poetry_82f996e0042b8327_complete() { local state com cur local -a opts local -a coms cur=${words[${#words[@]}]} # lookup for command for word in ${words[@]:1}; do if [[ $word != -* ]]; then com=$word break fi done if [[ ${cur} == --* ]]; then state="option" opts+=("--ansi:Force ANSI output." "--directory:The working directory for the Poetry command \(defaults to the current working directory\)." "--help:Display help for the given command. When no command is given display help for the list command." "--no-ansi:Disable ANSI output." "--no-cache:Disables Poetry source caches." "--no-interaction:Do not ask any interactive question." "--no-plugins:Disables plugins." "--quiet:Do not output any message." "--verbose:Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug." "--version:Display this application version.") elif [[ $cur == $com ]]; then state="command" coms+=("about:Shows information about Poetry." "add:Adds a new dependency to pyproject.toml and installs it." "build:Builds a package, as a tarball and a wheel by default." "'cache clear':Clears a Poetry cache by name." "'cache list':List Poetry\'s caches." "check:Validates the content of the pyproject.toml file and its consistency with the poetry.lock file." "config:Manages configuration settings." "'debug info':Shows debug information." "'debug resolve':Debugs dependency resolution." "'env info':Displays information about the current environment." "'env list':Lists all virtualenvs associated with the current project." "'env remove':Remove virtual environments associated with the project." "'env use':Activates or creates a new virtualenv for the current project." "export:Exports the lock file to alternative formats." "help:Displays help for a command." "init:Creates a basic pyproject.toml file in the current directory." "install:Installs the project dependencies." "list:Lists commands." "lock:Locks the project dependencies." "new:Creates a new Python project at ." "publish:Publishes a package to a remote repository." "remove:Removes a package from the project dependencies." "run:Runs a command in the appropriate environment." "search:Searches for packages on remote repositories." "'self add':Add additional packages to Poetry\'s runtime environment." "'self install':Install locked packages \(incl. addons\) required by this Poetry installation." "'self lock':Lock the Poetry installation\'s system requirements." "'self remove':Remove additional packages from Poetry\'s runtime environment." "'self show':Show packages from Poetry\'s runtime environment." "'self show plugins':Shows information about the currently installed plugins." "'self update':Updates Poetry to the latest version." "shell:Spawns a shell within the virtual environment." "show:Shows information about packages." "'source add':Add source configuration for project." "'source remove':Remove source configured for the project." "'source show':Show information about sources configured for the project." "update:Update the dependencies as according to the pyproject.toml file." "version:Shows the version of the project or bumps it when a valid bump rule is provided.") fi case $state in (command) _describe 'command' coms ;; (option) case "$com" in (about) opts+=() ;; (add) opts+=("--allow-prereleases:Accept prereleases." "--dev:Add as a development dependency. \(Deprecated\) Use --group=dev instead." "--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--editable:Add vcs/path dependencies as editable." "--extras:Extras to activate for the dependency." "--group:The group to add the dependency to." "--lock:Do not perform operations \(only update the lockfile\)." "--optional:Add as an optional dependency." "--platform:Platforms for which the dependency must be installed." "--python:Python version for which the dependency must be installed." "--source:Name of the source to use to install the package.") ;; (build) opts+=("--format:Limit the format to either sdist or wheel." "--output:Set output directory for build artifacts. Default is \`dist\`.") ;; ('cache clear') opts+=("--all:Clear all entries in the cache.") ;; ('cache list') opts+=() ;; (check) opts+=("--lock:Checks that poetry.lock exists for the current version of pyproject.toml.") ;; (config) opts+=("--list:List configuration settings." "--local:Set/Get from the project\'s local configuration." "--unset:Unset configuration setting.") ;; ('debug info') opts+=() ;; ('debug resolve') opts+=("--extras:Extras to activate for the dependency." "--install:Show what would be installed for the current system." "--python:Python version\(s\) to use for resolution." "--tree:Display the dependency tree.") ;; ('env info') opts+=("--executable:Only display the environment\'s python executable path." "--path:Only display the environment\'s path.") ;; ('env list') opts+=("--full-path:Output the full paths of the virtualenvs.") ;; ('env remove') opts+=("--all:Remove all managed virtual environments associated with the project.") ;; ('env use') opts+=() ;; (export) opts+=("--all-extras:Include all sets of extra dependencies." "--dev:Include development dependencies. \(Deprecated\)" "--extras:Extra sets of dependencies to include." "--format:Format to export to. Currently, only constraints.txt and requirements.txt are supported." "--only:The only dependency groups to include." "--output:The name of the output file." "--with:The optional dependency groups to include." "--with-credentials:Include credentials for extra indices." "--without:The dependency groups to ignore." "--without-hashes:Exclude hashes from the exported file." "--without-urls:Exclude source repository urls from the exported file.") ;; (help) opts+=() ;; (init) opts+=("--author:Author name of the package." "--dependency:Package to require, with an optional version constraint, e.g. requests:\^2.10.0 or requests=2.11.1." "--description:Description of the package." "--dev-dependency:Package to require for development, with an optional version constraint, e.g. requests:\^2.10.0 or requests=2.11.1." "--license:License of the package." "--name:Name of the package." "--python:Compatible Python versions.") ;; (install) opts+=("--all-extras:Install all extra dependencies." "--compile:Compile Python source files to bytecode. \(This option has no effect if modern-installation is disabled because the old installer always compiles.\)" "--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--extras:Extra sets of dependencies to install." "--no-dev:Do not install the development dependencies. \(Deprecated\)" "--no-directory:Do not install any directory path dependencies\; useful to install dependencies without source code, e.g. for caching of Docker layers\)" "--no-root:Do not install the root package \(the current project\)." "--only:The only dependency groups to include." "--only-root:Exclude all dependencies." "--remove-untracked:Removes packages not present in the lock file. \(Deprecated\)" "--sync:Synchronize the environment with the locked packages and the specified groups." "--with:The optional dependency groups to include." "--without:The dependency groups to ignore.") ;; (list) opts+=() ;; (lock) opts+=("--check:Check that the poetry.lock file corresponds to the current version of pyproject.toml. \(Deprecated\) Use poetry check --lock instead." "--no-update:Do not update locked versions, only refresh lock file.") ;; (new) opts+=("--name:Set the resulting package name." "--readme:Specify the readme file format. Default is md." "--src:Use the src layout for the project.") ;; (publish) opts+=("--build:Build the package before publishing." "--cert:Certificate authority to access the repository." "--client-cert:Client certificate to access the repository." "--dist-dir:Dist directory where built artifact are stored. Default is \`dist\`." "--dry-run:Perform all actions except upload the package." "--password:The password to access the repository." "--repository:The repository to publish the package to." "--skip-existing:Ignore errors from files already existing in the repository." "--username:The username to access the repository.") ;; (remove) opts+=("--dev:Remove a package from the development dependencies. \(Deprecated\) Use --group=dev instead." "--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--group:The group to remove the dependency from." "--lock:Do not perform operations \(only update the lockfile\).") ;; (run) opts+=() ;; (search) opts+=() ;; ('self add') opts+=("--allow-prereleases:Accept prereleases." "--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--editable:Add vcs/path dependencies as editable." "--extras:Extras to activate for the dependency." "--source:Name of the source to use to install the package.") ;; ('self install') opts+=("--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--sync:Synchronize the environment with the locked packages and the specified groups.") ;; ('self lock') opts+=("--check:Check that the poetry.lock file corresponds to the current version of pyproject.toml. \(Deprecated\) Use poetry check --lock instead." "--no-update:Do not update locked versions, only refresh lock file.") ;; ('self remove') opts+=("--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\).") ;; ('self show') opts+=("--addons:List only add-on packages installed." "--latest:Show the latest version." "--outdated:Show the latest version but only for packages that are outdated." "--tree:List the dependencies as a tree.") ;; ('self show plugins') opts+=() ;; ('self update') opts+=("--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--preview:Allow the installation of pre-release versions.") ;; (shell) opts+=() ;; (show) opts+=("--all:Show all packages \(even those not compatible with current system\)." "--latest:Show the latest version." "--no-dev:Do not list the development dependencies. \(Deprecated\)" "--only:The only dependency groups to include." "--outdated:Show the latest version but only for packages that are outdated." "--top-level:Show only top-level dependencies." "--tree:List the dependencies as a tree." "--why:When showing the full list, or a --tree for a single package, display whether they are a direct dependency or required by other packages" "--with:The optional dependency groups to include." "--without:The dependency groups to ignore.") ;; ('source add') opts+=("--default:Set this source as the default \(disable PyPI\). A default source will also be the fallback source if you add other sources. \(Deprecated, use --priority\)" "--priority:Set the priority of this source. One of: default, primary, secondary, supplemental, explicit. Defaults to primary." "--secondary:Set this source as secondary. \(Deprecated, use --priority\)") ;; ('source remove') opts+=() ;; ('source show') opts+=() ;; (update) opts+=("--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--lock:Do not perform operations \(only update the lockfile\)." "--no-dev:Do not update the development dependencies. \(Deprecated\)" "--only:The only dependency groups to include." "--sync:Synchronize the environment with the locked packages and the specified groups." "--with:The optional dependency groups to include." "--without:The dependency groups to ignore.") ;; (version) opts+=("--dry-run:Do not update pyproject.toml file" "--next-phase:Increment the phase of the current version" "--short:Output the version number only") ;; esac _describe 'option' opts ;; *) # fallback to file completion _arguments '*:file:_files' esac } _poetry_82f996e0042b8327_complete "$@" compdef _poetry_82f996e0042b8327_complete /home/svarrette/.local/share/pipx/venvs/poetry/bin/poetry ================================================ FILE: oh-my-zsh/custom/completions/_rvm ================================================ #compdef rvm \typeset curcontext state line cmds ret curcontext="$curcontext" ret=1 _arguments -C \ '(- 1 *)'{-v,--version}'[display version information]' \ '(-l|--level)'{-l,--level}'+[patch level to use with rvm use / install]:number' \ '(--bin)--bin[path for binaries to be placed (~/.rvm/bin/)]:path:_files' \ '(--source)--source[src directory to use (~/.rvm/src/)]:path:_files' \ '(--archives)--archives[directory for downloaded files (~/.rvm/archives/)]:path:_files' \ '-S[Specify a script file to attempt to load and run (rubydo)]:file:_files' \ '-e[Execute code from the command line]:code' \ '(-G)-G[root gem path to use]:path:_files' \ '(--gems)--gems[Used to set the gems_flag, use with remove to remove gems]' \ '(--archive)--archive[Used to set the archive_flag, use with remove to remove archive]' \ '(--patch)--patch[With MRI Rubies you may specify one or more full paths to patches]' \ '(-C|--configure)'{-C,--configure}'=[custom configure options]' \ '(--nice)--nice[process niceness (for slow computers, default 0)]:number' \ '(--ree)--ree-options[Options passed directly to ree ./installer on the command line]:options' \ '(--head)--head[with update, updates rvm to git head version]' \ '(--rubygems)--rubygems[with update, updates rubygems for selected ruby]' \ '(--default)--default[with ruby select, sets a default ruby for new shells]' \ '(--debug)--debug[Toggle debug mode on for very verbose output]' \ '(--trace)--trace[Toggle trace mode on to see EVERYTHING rvm is doing]' \ '(--force)--force[Force install, even given ruby is already install]' \ '(--summary)--summary[Used with rubydo to print out a summary of the commands run]' \ '(--latest)--latest[with gemset --dump skips version strings for latest gem]' \ '(--gems)--gems[with uninstall/remove removes gems with the interpreter]' \ '(--docs)--docs[with install, attempt to generate ri after installation]' \ '(--reconfigure)--reconfigure[Force ./configure on install even if Makefile already exists]' \ '(--quiet-curl)--quiet-curl[Makes curl silent when fetching data]' \ '1: :->cmds' \ '*: :->args' && ret=0 case $state in cmds) cmds=( ${(f)"$(_call_program commands rvm help 2> /dev/null | __rvm_sed -e '/^== Action/,/^== Implementation/!d; / :: /!d; s/^[ *]*\([^ ]*\) *:: *\(.*\)/\1:\2/')"} ) cmds+=( $(rvm list strings) ) _describe -t commands 'rvm command' cmds && ret=0 ;; args) case $line[1] in (use|uninstall|remove|list) if (( CURRENT == 3 )); then # See if we’ve made it to the ‘@’; eg, 1.9.2@ if ! __rvm_grep '@' <<< "${line[CURRENT-1]}" >/dev/null ; then _values -S , 'rubies' \ $(rvm list strings | __rvm_sed -e 's/ruby-\([^) ]*\)-\([^) ]*\)/ruby-\1-\2 \1-\2 \1/g') \ default system $(rvm alias list names) && ret=0 else # Construct a full version string for each of the gemsets. # Eg, 1.9.2@min 1.9.2@rail3 … _values -S , 'gemsets' \ $(rvm ${line[CURRENT-1]%%@*} gemset list | __rvm_awk '/^[ -_[:alnum:]]+$/ {print "'${line[CURRENT-1]%%@*}'@"$1}') fi fi ;; (install|fetch) _values -S , 'rubies' $(rvm list known_strings) && ret=0 ;; gemset) if (( CURRENT == 3 )); then _values 'gemset_commands' $(rvm gemset help | __rvm_sed -e '/create/!d; s/^.*[{]\(.*\)[}].*$/\1/; s/,/ /g') else #_values -S , 'gemsets' $(rvm gemset list | __rvm_grep -v gemset 2>/dev/null) _values -S , 'gemsets' $(rvm gemset list | __rvm_grep -Ev '(gemset|info)' 2>/dev/null | __rvm_awk '/^[ -_[:alnum:]]+$/ {print '$1'}') fi ret=0 ;; package) if (( CURRENT == 3 )); then _values 'package_commands' $(rvm package | __rvm_sed -e '/Usage/!d; s/^.*[{]\(.*\)[}] [{].*$/\1/; s/,/ /g') else _values 'packages' $(rvm package | __rvm_sed -e '/Usage/!d; s/^.*[}] [{]\(.*\)[}].*$/\1/; s/,/ /g') fi ret=0 ;; *) (( ret )) && _message 'no more arguments' ;; esac ;; esac return ret ================================================ FILE: oh-my-zsh/custom/completions/_toolbox ================================================ #compdef toolbox compdef _toolbox toolbox # zsh completion for toolbox -*- shell-script -*- __toolbox_debug() { local file="$BASH_COMP_DEBUG_FILE" if [[ -n ${file} ]]; then echo "$*" >> "${file}" fi } _toolbox() { local shellCompDirectiveError=1 local shellCompDirectiveNoSpace=2 local shellCompDirectiveNoFileComp=4 local shellCompDirectiveFilterFileExt=8 local shellCompDirectiveFilterDirs=16 local shellCompDirectiveKeepOrder=32 local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder local -a completions __toolbox_debug "\n========= starting completion logic ==========" __toolbox_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" # The user could have moved the cursor backwards on the command-line. # We need to trigger completion from the $CURRENT location, so we need # to truncate the command-line ($words) up to the $CURRENT location. # (We cannot use $CURSOR as its value does not work when a command is an alias.) words=("${=words[1,CURRENT]}") __toolbox_debug "Truncated words[*]: ${words[*]}," lastParam=${words[-1]} lastChar=${lastParam[-1]} __toolbox_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" # For zsh, when completing a flag with an = (e.g., toolbox -n=) # completions must be prefixed with the flag setopt local_options BASH_REMATCH if [[ "${lastParam}" =~ '-.*=' ]]; then # We are dealing with a flag with an = flagPrefix="-P ${BASH_REMATCH}" fi # Prepare the command to obtain completions requestComp="${words[1]} __complete ${words[2,-1]}" if [ "${lastChar}" = "" ]; then # If the last parameter is complete (there is a space following it) # We add an extra empty parameter so we can indicate this to the go completion code. __toolbox_debug "Adding extra empty parameter" requestComp="${requestComp} \"\"" fi __toolbox_debug "About to call: eval ${requestComp}" # Use eval to handle any environment variables and such out=$(eval ${requestComp} 2>/dev/null) __toolbox_debug "completion output: ${out}" # Extract the directive integer following a : from the last line local lastLine while IFS='\n' read -r line; do lastLine=${line} done < <(printf "%s\n" "${out[@]}") __toolbox_debug "last line: ${lastLine}" if [ "${lastLine[1]}" = : ]; then directive=${lastLine[2,-1]} # Remove the directive including the : and the newline local suffix (( suffix=${#lastLine}+2)) out=${out[1,-$suffix]} else # There is no directive specified. Leave $out as is. __toolbox_debug "No directive found. Setting do default" directive=0 fi __toolbox_debug "directive: ${directive}" __toolbox_debug "completions: ${out}" __toolbox_debug "flagPrefix: ${flagPrefix}" if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then __toolbox_debug "Completion received error. Ignoring completions." return fi local activeHelpMarker="_activeHelp_ " local endIndex=${#activeHelpMarker} local startIndex=$((${#activeHelpMarker}+1)) local hasActiveHelp=0 while IFS='\n' read -r comp; do # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker) if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then __toolbox_debug "ActiveHelp found: $comp" comp="${comp[$startIndex,-1]}" if [ -n "$comp" ]; then compadd -x "${comp}" __toolbox_debug "ActiveHelp will need delimiter" hasActiveHelp=1 fi continue fi if [ -n "$comp" ]; then # If requested, completions are returned with a description. # The description is preceded by a TAB character. # For zsh's _describe, we need to use a : instead of a TAB. # We first need to escape any : as part of the completion itself. comp=${comp//:/\\:} local tab="$(printf '\t')" comp=${comp//$tab/:} __toolbox_debug "Adding completion: ${comp}" completions+=${comp} lastComp=$comp fi done < <(printf "%s\n" "${out[@]}") # Add a delimiter after the activeHelp statements, but only if: # - there are completions following the activeHelp statements, or # - file completion will be performed (so there will be choices after the activeHelp) if [ $hasActiveHelp -eq 1 ]; then if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then __toolbox_debug "Adding activeHelp delimiter" compadd -x "--" hasActiveHelp=0 fi fi if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then __toolbox_debug "Activating nospace." noSpace="-S ''" fi if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then __toolbox_debug "Activating keep order." keepOrder="-V" fi if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then # File extension filtering local filteringCmd filteringCmd='_files' for filter in ${completions[@]}; do if [ ${filter[1]} != '*' ]; then # zsh requires a glob pattern to do file filtering filter="\*.$filter" fi filteringCmd+=" -g $filter" done filteringCmd+=" ${flagPrefix}" __toolbox_debug "File filtering command: $filteringCmd" _arguments '*:filename:'"$filteringCmd" elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then # File completion for directories only local subdir subdir="${completions[1]}" if [ -n "$subdir" ]; then __toolbox_debug "Listing directories in $subdir" pushd "${subdir}" >/dev/null 2>&1 else __toolbox_debug "Listing directories in ." fi local result _arguments '*:dirname:_files -/'" ${flagPrefix}" result=$? if [ -n "$subdir" ]; then popd >/dev/null 2>&1 fi return $result else __toolbox_debug "Calling _describe" if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then __toolbox_debug "_describe found some completions" # Return the success of having called _describe return 0 else __toolbox_debug "_describe did not find completions." __toolbox_debug "Checking if we should do file completion." if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then __toolbox_debug "deactivating file completion" # We must return an error code here to let zsh know that there were no # completions found by _describe; this is what will trigger other # matching algorithms to attempt to find completions. # For example zsh can match letters in the middle of words. return 1 else # Perform file completion __toolbox_debug "Activating file completion" # We must return the result of this command, so it must be the # last command, or else we must store its result to return it. _arguments '*:filename:_files'" ${flagPrefix}" fi fi fi } # don't run the completion function when being source-ed or eval-ed if [ "$funcstack[1]" = "_toolbox" ]; then _toolbox fi ================================================ FILE: oh-my-zsh/custom/completions/_ykman ================================================ #compdef ykman _ykman_completion() { local -a completions local -a completions_with_descriptions local -a response (( ! $+commands[ykman] )) && return 1 response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) _YKMAN_COMPLETE=zsh_complete ykman)}") for type key descr in ${response}; do if [[ "$type" == "plain" ]]; then if [[ "$descr" == "_" ]]; then completions+=("$key") else completions_with_descriptions+=("$key":"$descr") fi elif [[ "$type" == "dir" ]]; then _path_files -/ elif [[ "$type" == "file" ]]; then _path_files -f fi done if [ -n "$completions_with_descriptions" ]; then _describe -V unsorted completions_with_descriptions -U fi if [ -n "$completions" ]; then compadd -U -V unsorted -a completions fi } if [[ $zsh_eval_context[-1] == loadautofunc ]]; then # autoload from fpath, call function directly _ykman_completion "$@" else # eval/source/. command, register function for later compdef _ykman_completion ykman fi ================================================ FILE: oh-my-zsh/custom/plugins/falkor/falkor.plugin.zsh ================================================ # -*- mode: sh; -*- ##################################################################################### # Time-stamp: # _____ _ _ _ ___ _ __ __ _____ _ # | ___|_ _| | | _____ _ __( )___ / _ \| |__ | \/ |_ _|__ /___| |__ # | |_ / _` | | |/ / _ \| '__|// __| | | | | '_ \| |\/| | | | | / // __| '_ \ # | _| (_| | | < (_) | | \__ \ | |_| | | | | | | | |_| |/ /_\__ \ | | | # |_| \__,_|_|_|\_\___/|_| |___/ \___/|_| |_|_| |_|\__, /____|___/_| |_| # |___/ # ____ _ _ # | _ \| |_ _ __ _(_)_ __ # | |_) | | | | |/ _` | | '_ \ # | __/| | |_| | (_| | | | | | # |_| |_|\__,_|\__, |_|_| |_| # |___/ ##################################################################################### # . Copyright (c) 2016-2025 Sebastien Varrette # # Personal Custom plugin for Oh My Zsh, mainly designed to host my favorite # aliases and my theme specialization # Install nerd-font (see https://github.com/ryanoasis/nerd-fonts#font-installation) # On Mac OS X: # brew tap caskroom/fonts # brew cask install font-hack-nerd-font # Then in iTerm2, change the font for non-ASCII Font to 14pt Hack Regular Nerd Font Complete # ### Organization # # ~/.config/zsh/custom # ├── plugins # └── falkor # └── falkor.plugin.zsh # ### Usage: # # In your .zshrc, add the following # # [...] # plugins=(...) # Whatever default plugins you wish to use # # Custom plugins # plugins+=(falkor) ##################################################################################### export DEFAULT_USER="$USER" # =================================================================== # ================== Falkor's Command Aliases ======================= # =================================================================== # ------------------------------------------------------------------- # make some commands (potentially) less destructive # ------------------------------------------------------------------- alias rm='rm -i' # ls, the common ones I use a lot shortened for rapid fire usage #alias l='ls -lFh' #size,show type,human readable alias la='ls -lAFh' #long list,show almost all,show type,human readable alias lr='ls -tRFh' #sorted by date,recursive,show type,human readable alias lt='ls -ltFh' #long list,sorted by date,show type,human readable alias ll='ls -l' #long list # fuzzy typing alias car='cat' # ------------------------------------------------------------------- # Git -- most comes from the git plugin # ------------------------------------------------------------------- alias g='git' alias ga='git add' alias gb='git branch -a' # age of each branch alias gbage='for k in `git branch -a | perl -pe '\''s/^..(.*?)( ->.*)?$/\1/'\''`; do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k -- | head -n 1`\\t$k; done | sort -r' # stop bother me with merge messages gbnoedit() { git config branch.$(git rev-parse --abbrev-ref HEAD).mergeoptions --no-edit } alias gc='git checkout' alias gcount='git shortlog -sn' if [[ -n ${ZSH_VERSION-} ]]; then compdef gcount=git fi alias gcl='git clone' alias clone='git clone' alias gd='git diff' alias dg='git diff' alias GD='git diff HEAD~1 HEAD' alias gf='git fetch -va' alias gfp='git fetch -va --prune' alias gg="git log --graph --pretty=format:'%C(auto)%h -%d %s %Cgreen(%cr)%Creset %C(bold blue)<%an>%Creset' --abbrev-commit --max-count=20" alias ggl="git log --graph --pretty=format:'%C(auto)%h -%d %s %Cgreen(%cr)%Creset %C(bold blue)<%an>%Creset' --abbrev-commit" alias gl='git log --graph --oneline --decorate --max-count=20' gm() { git commit -s -m "$*" } gma() { git commit -s -am "$*" } gms() { git commit -s -S -m "$*" } gmas() { git commit -s -S -am "$*" } # Conventional commit helpers -- see https://www.conventionalcommits.org/ __git-conventional-commit() { local type="$1" local scope="$2" local ref="" shift 2 local body="$*" local msg="" # extract reference when applicable if [[ "${body}" =~ 'ref[s]*:([0-9]+)' ]]; then # ref="\nRefs: ${BASH_REMATCH[1]}" # Does not work ;( ref="\n\nRefs: $(echo "${body}" | sed 's/.*ref[s]*:\([[:digit:]]\+\)/\#\1/' | sed 's/,/, \#/g')" body=$(echo "${body}" | sed 's/ref[s]*:.*$//') fi if [ -z "${body}" ]; then msg="${type}: ${scope}${ref}" else msg="${type}(${scope}): ${body}${ref}" fi echo -e "${msg}" } feat-gm() { gm "$(__git-conventional-commit 'feat' $*)" } feat-gma() { gma "$(__git-conventional-commit 'feat' $*)" } fix-gm() { gm "$(__git-conventional-commit 'fix' $*)" } fix-gma() { gma "$(__git-conventional-commit 'fix' $*)" } refactor-gm() { gm "$(__git-conventional-commit 'refactor' $*)" } refactor-gma(){ gma "$(__git-conventional-commit 'refactor' $*)" } docs-gm() { gm "$(__git-conventional-commit 'docs' $*)" } docs-gma() { gma "$(__git-conventional-commit 'docs' $*)" } # perf # revert # style # test alias p='git push' alias gp='git push' alias gpu='git push' alias gpd='git push --dry-run' alias gpoat='git push origin --all && git push origin --tags' [[ -n ${ZSH_VERSION-} ]] && compdef _git gpoat=git-push alias gr='git remote -v' alias gra='git remote add' alias grr='git remote rm' alias grt='cd $(git rev-parse --show-toplevel || echo ".")' alias s='git status' alias gs='git status' alias gss='git status --short' function gsa() { local url=$1 local dir=`basename $url .git` [ -d ".submodules" ] && dir=".submodules/$dir" [ $# -eq 2 ] && dir=$2 echo "=> adding git submodule from '$url' in '$dir'" git submodule add $url $dir git commit -s -m "Add '$dir' as git submodule from '$url'" .gitmodules $dir } #alias gsa='git submodule add' alias gsi='git submodule init' alias gsu='git submodule update' gsupgrade() { git submodule foreach 'git fetch origin; git checkout $(git rev-parse --abbrev-ref HEAD); git reset --hard origin/$(git rev-parse --abbrev-ref HEAD); git submodule update --recursive; git clean -dfx' } alias u='git pull' alias up='git pull' alias gu='git pull' alias gta='git tag -a -m' alias cdroot='git rev-parse && cd ./$(git rev-parse --show-cdup)' #------- # Myrepo #-------- alias mradd='mr register' alias mrup='(cd ~; mr -j update)' # ------------ # Utilities # ------------ bup() { echo "Updating your [Homebrew] system" brew update brew upgrade brew cu brew cleanup } alias o='open' alias of='lsof -nP +c 15 | grep LISTEN' alias m='make -j8' alias skim='open -a Skim' nospace-in-filename(){ local f="$*" echo "=> replacing ' ' (space) with '-' in '${f}'" mv $f $(echo $f| tr ' ' '-') } if [[ -n ${ZSH_VERSION-} ]]; then zstyle ":completion:*:*:skim:*" file-patterns "*.pdf *(-/)" zcompclean() { rm -rf ${XDG_CONFIG_HOME}/zsh/.zcompdump* autoload -U compinit && compinit } # https://stackoverflow.com/questions/59940971/zsh-autocomplete-slow-for-ssh/64147638#64147638 # FIX for slow SSH completion refresh_ssh_autocomplete () { host_list=($(cat ~/.ssh/config | grep 'Host ' | awk '{s = s $2 " "} END {print s}')) zstyle ':completion:*:(ssh|scp|sftp):*' hosts $host_list } fi alias mkdir='mkdir -p' # Search for files and page it search() { find . -iname "*$@*" | less; } if [[ -n ${ZSH_VERSION-} ]]; then alias refresh='sourcezshrc' else alias refresh='source ~/.profile' fi alias sshx='ssh -C -X -c blowfish' alias proxy='ssh -C -q -T -n -N -D 1080' alias rsyncfalkor='rsync -P -avzu' alias nothankyouadobe="sudo -H killall ACCFinderSync \"Core Sync\" AdobeCRDaemon \"Adobe Creative\" AdobeIPCBroker node \"Adobe Desktop Service\" \"Adobe Crash Reporter\";sudo -H rm -rf \"/Library/LaunchAgents/com.adobe.AAM.Updater-1.0.plist\" \"/Library/LaunchAgents/com.adobe.AdobeCreativeCloud.plist\" \"/Library/LaunchDaemons/com.adobe.*.plist\"" topgrep() { if [[ $# -ne 1 ]]; then echo "Usage: topgrep " else top -pid $(pgrep $1) fi } mkcd () { mkdir -p "$@" && cd "$@" } #alias diff='colordiff' # for colors alias draw='figlet -c -w 80' # Which directory is hiding all the bytes? alias dux='du -h -d 1 | sort -n' # Ask more gently to run the last command ;) alias pls='sudo `fc -n -l -1`' alias ":q"="exit" # Quick tarball backup backup() { [[ -z "$1" ]] && return local dst=$(echo $1 | sed "s/^\./dot/" ) local archive="backup_$(date +%F)_${dst}.tgz" echo "=> creating tarball archive '${archive}' to backup '$@'" tar cvzf ${archive} $@ } # Optimize PDF/JPEG/PNG size optipdf () { local pdf=$1 local res=`basename $pdf .pdf`-optimized.pdf noglob gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -sOutputFile=$res $pdf local opti_size=`du -k $res | cut -f1` local size=`du -k $pdf | cut -f1` if [[ "$opti_size" -lt "$size" ]]; then echo " => optimized PDF of smaller size ($opti_size vs. $size) thus overwrite $pdf" mv $res $pdf git commit -s -m "reduce size of PDF '$pdf'" $pdf else echo " => already optimized PDF thus discarded" rm -f $res fi } alias reducepdf='optipdf' if [[ -n ${ZSH_VERSION-} ]]; then compdef '_files -g "*.pdf"' optipdf fi alias optipng='optipng -o9 -zm1-9 -strip all' alias optijpg='jpegoptim' # --------------------------------------------- # United Colors of Benetton: Colors everywhere # --------------------------------------------- # Less with syntax color - alias lessh='LESSOPEN="| /usr/local/bin/src-hilite-lesspipe.sh %s" less -M ' # man with colors -- thanks @hcartiaux for the tip man() { env LESS_TERMCAP_mb=$'\E[01;31m' \ LESS_TERMCAP_md=$'\E[01;38;5;74m' \ LESS_TERMCAP_me=$'\E[0m' \ LESS_TERMCAP_se=$'\E[0m' \ LESS_TERMCAP_so=$'\E[38;5;246m' \ LESS_TERMCAP_ue=$'\E[0m' \ LESS_TERMCAP_us=$'\E[04;38;5;146m' \ man "$@" } # TaskWarrior alias t='task list' # --------------- # Emacs business # --------------- #alias es="emacs --daemon" #alias em="emacsclient -nw --alternate-editor='vim'" # --------------- # iTerm2 business # --------------- # Setup tab and window title functions for iterm2 # iterm behaviour: until window name is explicitly set, it'll always track tab title. # So, to have different window and tab titles, iterm_window() must be called # first. iterm_both() resets this behaviour and has window track tab title again). # Source: http://superuser.com/a/344397 set_iterm_name() { mode=$1; shift echo -ne "\033]$mode;$@\007" } iterm_both() { set_iterm_name 0 $@; } iterm_tab() { set_iterm_name 1 $@; } title() { iterm_both $@; } iterm_window() { set_iterm_name 2 $@; } # GPG management gpg-update-tty() { export GPG_TTY=$(tty) gpg-connect-agent "updatestartuptty" /bye >/dev/null } # ------------------- # Yubikey management # ------------------- # https://github.com/drduh/YubiKey-Guide#switching-between-two-or-more-yubikeys yubi-switch() { echo '=> switch Yubikey' gpg-connect-agent "scd serialno" "learn --force" /bye echo '=> reset GPG_TTY' export GPG_TTY=$(tty) echo '=> force pinentry reset' gpg-connect-agent "updatestartuptty" /bye >/dev/null } # --------------- # ZSH management # --------------- alias zshenv="$EDITOR ${HOME}/.zshenv" # Quick access to the .zshenv file alias zshrc="$EDITOR ${XDG_CONFIG_HOME}/zsh/zshrc" # Quick access to the .zshrc file alias sourcezshrc="source ${XDG_CONFIG_HOME}/zsh/zshrc" alias zshfalkor="$EDITOR ${XDG_CONFIG_HOME}/zsh/custom/plugins/falkor/falkor.plugin.zsh" # Quick access to this file #----------------------- # Global alias (for ZSH) # ---------------------- if [[ -n ${ZSH_VERSION-} ]]; then alias -g L="| less" # Write L after a command to page through the output. alias -g H="| head -n 20" # Write H after a command to get the 20 first lines alias -g G='| grep --color -i' # Write G after the command to grep it alias -g TL='| tail -20' alias -g NUL="> /dev/null 2>&1" # You get the idea. fi ================================================ FILE: oh-my-zsh/custom/plugins/zsh-completions.local/zsh-completions.plugin.zsh ================================================ # -*- mode:sh; -*- ############################################################################### # Include the zsh-completions installed by Homebrew _homebrew-installed() { type brew &> /dev/null } _zsh-completion-from-homebrew-installed() { brew --prefix zsh-completions &> /dev/null } # RVM Completion if [[ -d "$HOME/.rvm/scripts/zsh/Completion" ]]; then fpath=($HOME/.rvm/scripts/zsh/Completion $fpath) fi # General Homebrew ZSH completions if _homebrew-installed && _zsh-completion-from-homebrew-installed ; then fpath=('/usr/local/share/zsh-completions' $fpath) fi # My custom completions fpath=("${XDG_CONFIG_HOME}/zsh/custom/completions" $fpath) ================================================ FILE: pyenv/init.sh ================================================ # Initialization of the pyenv and pyenv-virtualenv # - pyenv: https://github.com/pyenv/pyenv # - pyenv-virtualenv: https://github.com/pyenv/pyenv-virtualenv if [ -n "$(which pyenv 2>/dev/null)" ]; then eval "$(pyenv init --path)" # Required since 1.2.27-21 eval "$(pyenv init -)" eval "$(pyenv virtualenv-init -)" export PYENV_VIRTUALENV_DISABLE_PROMPT=1 fi ================================================ FILE: screen/.screenrc ================================================ # -*- mode:sh; -*- ################################################################################### # .screenrc -- configuration file for [screen](http://www.gnu.org/software/screen/) # Time-stamp: # # ___ ___ _ __ ___ ___ _ __ _ __ ___ # / __|/ __| '__/ _ \/ _ \ '_ \| '__/ __| # _\__ \ (__| | | __/ __/ | | | | | (__ # (_)___/\___|_| \___|\___|_| |_|_| \___| # ################################################################################### # Resources: # * gyaresu's .screenrc: http://delicious.com/search?p=screenrc ################################################################################### # Don't display the copyright page startup_message off # tab-completion flash in heading bar vbell off # keep scrollback n lines defscrollback 1000 shelltitle "$ |bash" # THIS IS THE PRETTY BIT #change the hardstatus settings to give an window list at the bottom of the ##screen, with the time and date and with the current window highlighted hardstatus alwayslastline #hardstatus string '%{= mK}%-Lw%{= KW}%50>%n%f* %t%{= mK}%+Lw%< %{= kG}%-=%D %d %M %Y %c:%s%{-}' hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]' ================================================ FILE: screen/README.md ================================================ # Falkor's Dotfiles - GNU Screen configuration [GNU Screen](http://www.gnu.org/software/screen/‎) is a tool to manage persistent terminal sessions. It allows to create several virtual consoles inside a single terminal, enabling: * the user to connect to a remote system by ssh then start screen and create multiple terminal windows and run applications in each, without the need for additional ssh connections; * the decoupling of the terminal from the running applications, thus even if the network connection is broken, or the user needs to disconnect from the remote system, the applications started in screen windows, will keep running and the user can later reconnect to the screen session and continue work. I personally dislike the fact that by default there is no visual way to know that I'm under a screen session. The provided [`.screenrc`](.screenrc) helps to offer a status bar displaying the valuable information of the screen: * the host running the original screen session (bottom left) * a window list at the bottom -- the current one beeing placed between red parenthesis * date and time (I always like to keep track of the time ;)) ## Screenshot ![](https://raw.githubusercontent.com/Falkor/dotfiles/master/screenshots/screenshot_falkor_screen.png) ## Installation You can use the `install.sh` script featured with the [Falkor's dotfile](https://github.com/Falkor/dotfile) repository. ``` bash $> cd ~/.dotfiles.falkor.d $> ./install.sh --screen # OR ./install.sh --with-screen ``` This will setup the following files: * `~/.screenrc` ## Uninstall ``` bash $> cd ~/.dotfiles.falkor.d $> ./install.sh --delete --screen ``` ## Basic commands (cheat-sheet) You can start a screen session (_i.e._ creates a single window with a shell in it) with the `screen` command. Its main command-lines options are listed below: | Command | Description | |--------------|--------------------------------------------------------------------------------------------------------------| | `screen` | start a new screen session | | `screen -ls` | does not start screen, but prints a list of `pid.tty.host` strings identifying your current screen sessions. | | `screen -r` | resumes from a __detached__ screen session | | `screen -x` | attach to a not detached screen session in __Multi display mode__* | | | | * _Note_: Multi display mode allows you and another user to _share_ the same session which proves to be quite useful to debug remote systems. Once within a screen, you can invoke a screen command which consist of a "`CTRL + a`" sequence followed by another character. The main commands are listed in the below table: | Screen Command | Mnemonic | Description | |----------------------------|-------------|-----------------------------------------------------------------| | `CTRL + a c` | (create) | creates a new Screen window. The default Screen number is zero. | | `CTRL + a n` | (next) | switches to the next window. | | `CTRL + a p` | (prev) | switches to the previous window. | | `CTRL + a d` | (detach) | detaches from a Screen | | `CTRL + a A` | (title) | rename the current window | | `CTRL + a 0-9` | (go to 0-9) | switches between windows 0 through 9. | | `CTRL + a k` or `CTRL + d` | (kill) | destroy the current window | | `CTRL + a ?` | (help) | display a list of all the command options available for Screen. | | | | | ================================================ FILE: screenshots/src/.gitignore ================================================ *.tiff ================================================ FILE: shell/.gitignore ================================================ /*.sh ================================================ FILE: shell/available/asdf.sh ================================================ # asdf - Multiple Runtime Version Manager # See https://asdf-vm.com/ # # Installation in a (tentative) XDG compliant way # git clone https://github.com/asdf-vm/asdf.git ~/.local/share/asdf --branch v0.15.0 # See https://github.com/asdf-vm/asdf/issues/687 # # Below are config to 'simulate' XDG behaviour through # https://asdf-vm.com/manage/configuration.html if [ -d "${XDG_DATA_HOME}/asdf" ]; then export ASDF_DIR="${XDG_DATA_HOME}/asdf" # location of asdf core scripts # location where asdf will install plugins, shims and tool versions. export ASDF_DATA_DIR="${XDG_DATA_HOME}/asdf" if [ -f "${ASDF_DIR}/asdf.sh" ]; then . "${ASDF_DIR}/asdf.sh" fi # Setup completion if [[ -n ${ZSH_VERSION-} ]]; then # append completions to fpath fpath=(${ASDF_DIR}/completions $fpath) # initialise completions with ZSH's compinit autoload -Uz compinit && compinit else if [ -f "${ASDF_DIR}/completions/asdf.$(basename $SHELL)" ]; then . "${ASDF_DIR}/completions/asdf.$(basename $SHELL)" fi fi # https://asdf-vm.com/manage/configuration.html#asdfrc export ASDF_CONFIG_FILE="${XDG_CONFIG_HOME}/asdf/asdfrc" # https://github.com/asdf-community/asdf-python#default-python-packages export ASDF_PYTHON_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME}/asdf/default-python-packages" # https://github.com/asdf-vm/asdf-nodejs#default-npm-packages export ASDF_NPM_DEFAULT_PACKAGES_FILE="$HOME/.config/asdf/default-npm-packages" fi ================================================ FILE: shell/available/assh.sh ================================================ # Wrapper for Advanced-SSH # See https://github.com/moul/assh # if [ -x "$(command -v assh 2>/dev/null)" ]; then alias ssh="assh wrapper ssh --" fi ================================================ FILE: shell/available/atom.sh ================================================ # Settings for Atom if [ -x "$(command -v atom 2>/dev/null)" ]; then export ATOM_HOME=$XDG_CONFIG_HOME/atom fi ================================================ FILE: shell/available/autojump.sh ================================================ # Autojump -- a faster way to navigate your filesystem # Use # j # # To cd into the recent directory you visited those fullpath matches # # # For more info: https://github.com/wting/autojump AUTOJUMP_CONFIG="/usr/local/etc/profile.d/autojump.sh" if [[ -n ${ZSH_VERSION-} ]]; then [ ! -f "${AUTOJUMP_CONFIG}" ] && AUTOJUMP_CONFIG="/usr/share/autojump/autojump.zsh" else [ ! -f "${AUTOJUMP_CONFIG}" ] && AUTOJUMP_CONFIG="/usr/share/autojump/autojump.sh" fi [ -f "${AUTOJUMP_CONFIG}" ] && . ${AUTOJUMP_CONFIG} || true ================================================ FILE: shell/available/beets.sh ================================================ # Bash completion for Beets # See http://beets.readthedocs.io/en/latest/reference/cli.html#completion # # if [ -x "$(command -v beet 2>/dev/null)" ]; then # case $shell in # bash) eval "$(beet completion)";; # zsh) # autoload bashcompinit; # bashcompinit; # _get_comp_words_by_ref() { :; }; # compopt() { :; }; # _filedir() { :; }; # eval "$(beet completion)" # ;; # *) # ;; # esac # fi ================================================ FILE: shell/available/curl.sh ================================================ # Customization for curl, assuming XDG Base Directory setup # See https://specifications.freedesktop.org/basedir-spec/latest/ # Place this file in the custom directory settings for your favorite shell if [ -x "$(command -v curl 2>/dev/null)" ]; then export CURL_HOME="$XDG_CONFIG_HOME/curl" fi ================================================ FILE: shell/available/direnv.sh ================================================ # Custom load for direnv # See https://direnv.net/ if [ -x "$(command -v direnv 2>/dev/null)" ]; then eval "$(direnv hook $(basename $SHELL))" # export DIRENV_WARN_TIMEOUT=100s # See https://github.com/direnv/direnv/wiki/Python#restoring-the-ps show_virtual_env() { if [[ -n "$VIRTUAL_ENV" && -n "$DIRENV_DIR" ]]; then echo "($(basename $VIRTUAL_ENV))" fi } if [[ -n ${ZSH_VERSION-} ]]; then setopt PROMPT_SUBST else export -f show_virtual_env fi PS1='$(show_virtual_env) '$PS1 fi ================================================ FILE: shell/available/easybuild.sh ================================================ # http://easybuild.readthedocs.io/en/latest/Installation.html if [ -x "$(command -v eb 2>/dev/null)" ]; then export EASYBUILD_PREFIX=$HOME/.local/easybuild export EASYBUILD_MODULES_TOOL=Lmod fi ================================================ FILE: shell/available/fzf.sh ================================================ # Wrapper for fzf (Command-line fuzzy finder) # See https://github.com/junegunn/fzf # if [ -x "$(command -v fzf 2>/dev/null)" ]; then source <(fzf --zsh) fi ================================================ FILE: shell/available/glab.sh ================================================ # gitlab CLI # see https://docs.gitlab.com/cli/ if [ -x "$(command -v glab 2>/dev/null)" ]; then if [[ -n ${ZSH_VERSION-} ]]; then # zsh completion source <(glab completion -s zsh); compdef _glab glab else # bash completion source <(glab completion -s bash) fi fi ================================================ FILE: shell/available/go.sh ================================================ if [ -x "$(command -v go 2>/dev/null)" ]; then export GOPATH=${XDG_CACHE_HOME}/go export PATH=${GOPATH}/bin:$PATH fi ================================================ FILE: shell/available/gpg-agent.sh ================================================ # gpg-agent - Secret key management for GnuPG configuration # # Daemon to manage secret (private) keys independently from any protocol # The agent is automatically started on demand by gpg, gpgconf, or gpg-connect-agent # After changing the configuration, reload the agent with # gpg-connect-agent reloadagent /bye # if [ -x "$(command -v gpg-agent 2>/dev/null)" ]; then # check if ssh-support is enable in your gpg-agent config if [ -f $(gpgconf --list-dirs homedir)/gpg-agent.conf ] && [ -n "$(grep -ve '^#' $(gpgconf --list-dirs homedir)/gpg-agent.conf | grep enable-ssh-support)" ]; then export GPG_TTY=$(tty) export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" gpgconf --launch gpg-agent fi fi ================================================ FILE: shell/available/llvm.sh ================================================ # Mac OS config if [ -x "$(command -v brew 2>/dev/null)" ]; then export LLVMPATH=$(brew --prefix llvm) export PATH=${LLVMPATH}/bin:$PATH fi ================================================ FILE: shell/available/nix.sh ================================================ # Nix installer # if [ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then . $HOME/.nix-profile/etc/profile.d/nix.sh fi # added by Nix installer if [ -x "$(command -v nix 2>/dev/null)" ]; then # Bugfix locales - see https://nixos.wiki/wiki/Locales # Assumes you have run: # nix-env -iA nixpkgs.glibcLocales export LOCALE_ARCHIVE="$(nix-env --installed --no-name --out-path --query glibc-locales)/lib/locale/locale-archive" fi ================================================ FILE: shell/available/nvm.sh ================================================ # NVM: Node Version Manager # See https://github.com/nvm-sh/nvm if [ -x "$(command -v nvm 2>/dev/null)" ]; then [[ -n ${ZSH_VERSION-} ]] && setopt no_aliases export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$(brew --prefix nvm)/nvm.sh" ] && . "$(brew --prefix nvm)/nvm.sh" # This loads nvm [ -s "$(brew --prefix nvm)/etc/bash_completion.d/nvm" ] && . "$(brew --prefix nvm)/etc/bash_completion.d/nvm" # This loads nvm bash_completion [[ -n ${ZSH_VERSION-} ]] && setopt aliases fi ================================================ FILE: shell/available/pdk.sh ================================================ # https://puppet.com/docs/pdk/1.x/pdk_install.html # Add /opt/puppetlabs/pdk/bin to the path for sh compatible users PDKDIR=/opt/puppetlabs/pdk if [ -d "${PDKDIR}" ]; then if ! echo "$PATH" | grep -q "${PDKDIR}/bin" ; then export PATH=$PATH:${PDKDIR}/bin fi fi ================================================ FILE: shell/available/pipx.sh ================================================ # Wrapper for pipx # See https://github.com/pypa/pipx # if [ -x "$(command -v pipx 2>/dev/null)" ]; then # Add ~/.local/bin if [ -n "${XDG_CACHE_HOME}" ]; then export PATH="${XDG_CACHE_HOME}/bin:$PATH" fi # pipx completions # eval "$(register-python-argcomplete pipx)" fi ================================================ FILE: shell/available/pyenv.sh ================================================ # Initialization of the pyenv and pyenv-virtualenv # - pyenv: https://github.com/pyenv/pyenv # - pyenv-virtualenv: https://github.com/pyenv/pyenv-virtualenv if [ -x "$(command -v pyenv 2>/dev/null)" ]; then eval "$(pyenv init -)" eval "$(pyenv virtualenv-init -)" export PYENV_VIRTUALENV_DISABLE_PROMPT=1 fi ================================================ FILE: shell/available/screen.sh ================================================ # Specific configuration for screen # See https://github.com/Falkor/dotfiles/tree/master/screen if [ -x "$(command -v screen 2>/dev/null)" ]; then export SCREENRC=~/.config/screen/screenrc fi ================================================ FILE: shell/available/spacemacs.sh ================================================ # Spacemacs # inspired from https://practical.li/spacemacs/install-spacemacs/#clone-practicalli-spacemacs-configuration # if [ -d "${XDG_CONFIG_HOME}/spacemacs" ]; then # Set XDG location of Emacs Spacemacs configuration export SPACEMACSDIR="$XDG_CONFIG_HOME/spacemacs" fi ================================================ FILE: shell/available/taskwarrior.sh ================================================ # Specific configuration for TaskWarrior # See https://taskwarrior.org/docs/configuration.html if [ -x "$(command -v task 2>/dev/null)" ]; then # export TASKRC=~/.config/task/taskrc # export TASKDATA=~/.config/task fi ================================================ FILE: shell/available/toolbox.sh ================================================ # Wrapper for toolbx # See https://containertoolbx.org/ if [ -x "$(command -v toolbox 2>/dev/null)" ]; then if [[ -n ${ZSH_VERSION-} ]]; then # zsh completion # /usr/share/zsh/site-functions/_toolbox else # bash completion # /usr/share/bash-completion/completions/toolbox.bash fi fi ================================================ FILE: shell/available/uv.sh ================================================ # Wrapper for uv, an extremely fast Python package and project manager, written in Rust # See https://docs.astral.sh/uv/ if [ -x "$(command -v uv 2>/dev/null)" ]; then if [[ -n ${ZSH_VERSION-} ]]; then # zsh completion eval "$(uv generate-shell-completion zsh)" # /usr/share/zsh/site-functions/_toolbox else # bash completion # /usr/share/bash-completion/completions/toolbox.bash fi fi ================================================ FILE: shell/available/vagrant.sh ================================================ # Vagrant aliases # See also https://www.calebwoods.com/2015/05/05/vagrant-guest-commands/ if [ -x "$(command -v vagrant 2>/dev/null)" ]; then alias vup="vagrant up" alias vh="vagrant halt" alias vs="vagrant status" alias v="vagrant ssh" vc() { vagrant ssh -c "$@" } fi ================================================ FILE: shell/available/vim.sh ================================================ # XDG compliant setup for vim # Assuming you install your vim configuration under ~/.config/vim/vimrc as done # by default by Falkor's dotfiles -- see https://github.com/Falkor/dotfiles if [ -f "${XDG_CONFIG_HOME}/vim/vimrc" ]; then export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC' fi ================================================ FILE: shell/custom/.gitignore ================================================ *.sh ================================================ FILE: systemd/user/rtags-rdm.service ================================================ # RTags Server Daemon # https://github.com/Andersbakken/rtags/wiki/Setup#integration-with-systemd-gnu-linux # [Unit] Description=RTags Daemon Requires=rtags-rdm.socket [Service] Type=simple ExecStart=/usr/bin/rtags-rdm -v --inactivity-timeout 300 --log-flush ExecStartPost=/bin/sh -c "echo +19 > /proc/$MAINPID/autogroup" Nice=19 CPUSchedulingPolicy=idle ================================================ FILE: systemd/user/rtags-rdm.socket ================================================ # RTAgs Server Management # https://github.com/Andersbakken/rtags/wiki/Setup#integration-with-systemd-gnu-linux # See rtags-rc : default socket location is XDG_RUNTIME_DIR/rdm.socket [Unit] Description=RTags daemon socket [Socket] ListenStream=%t/rdm.socket [Install] WantedBy=default.target ================================================ FILE: tests/01-install_script.bats ================================================ #! /usr/bin/env bats ################################################################################ # 01-install_script.bats # Time-stamp: # # Bats: Bash Automated Testing System -- https://github.com/sstephenson/bats # Installation: # == OS X == # # $> brew install bats # # before_install: # - if [ "$(uname -s)" == "Darwin" ]; then brew install bats; fi # # # == Debian-like == # # $> sudo apt-get install software-properties-common # $> sudo apt-get install python-software-properties # $> sudo add-apt-repository ppa:duggan/bats --yes # $> sudo apt-get update -qq # $> sudo apt-get install -qq bats # # before_install: # - sudo add-apt-repository ppa:duggan/bats --yes # - sudo apt-get update -qq # - sudo apt-get install -qq bats # # # == Manual == # # before_script: # - git clone https://github.com/sstephenson/bats.git /tmp/bats # - mkdir -p /tmp/local # - bash /tmp/bats/install.sh /tmp/local # - export PATH=$PATH:/tmp/local/bin # # Resources: # - How to use Bats to test your command line tools: # https://blog.engineyard.com/2014/bats-test-command-line-tools # - Ex of travis-CI integration: # https://github.com/duggan/pontoon/blob/master/.travis.yml # - Another project using bats: # https://github.com/ekalinin/envirius/tree/master/tests ################################################################################ load test_helper DOTFILE_INSTALL="$BATS_TEST_DIRNAME/../install.sh --force --offline" setup() { # Avoid to run the tests on your machine case "$(hostname -f)" in *travis* | *testing*) echo "=> Tests on travis resources";; *vagrant*) echo "=> Tests on vagrant resources";; *) # Detect TRAVIS_CI_RUN environment variable (set in .travis.yml) if [ -z "${TRAVIS_CI_RUN}" ]; then echo "tests on $(hostname -f) skiped" skip fi;; esac } # teardown() { # # if [ -d "${DOTFILES_D}" ]; then # # echo "Dotfile ${DOTFILES_D} exists and will be removed" # # rm -rf ${DOTFILES_D} # # fi # } @test "default install (no option)" { run $DOTFILE_INSTALL [ $status -eq 0 ] [ -d "${DOTFILES_D}" ] } @test "install --bash" { run $DOTFILE_INSTALL --bash assert_success assert_falkor_dotfile_present "bash/.bashrc" assert_falkor_dotfile_present "bash/.inputrc" assert_falkor_dotfile_present "bash/.bash_profile" assert [ -e "${DOTFILES_D}/bash/custom/aliases.sh" ] } @test "install --bash --delete" { run $DOTFILE_INSTALL --bash --delete assert_success assert_falkor_dotfile_absent "bash/.bashrc" assert_falkor_dotfile_absent "bash/.inputrc" assert_falkor_dotfile_absent "bash/.bash_profile" assert [ ! -e "${DOTFILES_D}/bash/custom/aliases.sh" ] } @test "install --vim" { run $DOTFILE_INSTALL --vim assert_success assert [ -e "${DOTFILES_D}/vim/vimrc" ] } # @test "install --vim --delete" { # run $DOTFILE_INSTALL --vim --delete # assert_success # assert [ ! -e "${DOTFILES_D}/vim" ] # } @test "install --screen" { run $DOTFILE_INSTALL --screen assert_success assert_falkor_dotfile_present "screen/.screenrc" } @test "install --screen --delete" { run $DOTFILE_INSTALL --screen --delete assert_success assert_falkor_dotfile_absent "screen/.screenrc" } @test "install --git" { [ -n "${TRAVIS_CI_RUN}" ] && skip run $DOTFILE_INSTALL --git assert_success assert_falkor_dotfile_present "git/config" assert_falkor_dotfile_present "git/config.local" } @test "install --git --delete" { [ -n "${TRAVIS_CI_RUN}" ] && skip run $DOTFILE_INSTALL --git --delete assert_success assert_falkor_dotfile_absent "git/config" assert_falkor_dotfile_absent "git/config.local" } # @test "install --zsh" { # #[ -n "${TRAVIS_CI_RUN}" ] && skip # run bash -c "echo password | $DOTFILE_INSTALL --zsh" # assert_success # assert_falkor_dotfile_present "oh-my-zsh/.zshrc" # assert [ -h "${TARGET}/.oh-my-zsh/custom/plugins/falkor" ] # assert [ -h "${TARGET}/.oh-my-zsh/custom/themes/powerlevel9k" ] # } # @test "install --zsh --delete" { # #[ -n "${TRAVIS_CI_RUN}" ] && skip # run bash -c "echo y | $DOTFILE_INSTALL --zsh --delete" # assert_success # assert_falkor_dotfile_absent "oh-my-zsh/.zshrc" # assert [ ! -e "${TARGET}/.oh-my-zsh/custom/plugins/falkor" ] # assert [ ! -e "${TARGET}/.oh-my-zsh/custom/themes/powerlevel9k" ] # } ================================================ FILE: tests/README.md ================================================ -*- mode: markdown; mode: visual-line; fill-column: 80 -*- ------------------------------------- # Automatic Tests of Falkor/dotfiles These tests are based on [Bats](https://github.com/sstephenson/bats): Bash Automated Testing System. Coupled with [Travis-CI](https://docs.travis-ci.com/), it offers a nice continuous integration framework -- see [Travis CI for Complete Beginners](https://docs.travis-ci.com/user/for-beginners) ## Pre-requisites ### Bats installation I made a `setup_bats.sh` script for that (also for easier integration with travis) which roughly performs the following actions: * On Mac OS: use [Homebrew](http://brew.sh/) to install the `bats` package * On Linux system, a manual installation is performed under `/tmp/local/bin` (to ensure a full compliance with Travis virtualized boxes), which consists in: ```bash $> git clone https://github.com/sstephenson/bats.git /tmp/bats $> mkdir -p /tmp/local $> bash /tmp/bats/install.sh /tmp/local $> export PATH=$PATH:/tmp/local/bin ``` Note that their is normally a way to rely on Debian packages yet I never managed to make it work. For the records, the procedure would have been: ```bash $> apt-get install software-properties-common python-software-properties # to get 'add-apt-repository' $> add-apt-repository ppa:duggan/bats --yes $> apt-get update -qq $> apt-get install -qq bats ``` However the package repository does not work any more W: Failed to fetch http://ppa.launchpad.net/duggan/bats/ubuntu/dists/wheezy/main/binary-amd64/Packages 404 Not Found ### Travis integration Take a look at the repository [.travis.yml](../.travis.yml) ## Directory Layout ```bash tests/ ├── *.bats # The bats files, each defining a set of unit tests ├── README.md # This file └── setup_bats.sh # run/source this file to install Bats on your system ``` ## Run the tests Simply run $> bats . # from the tests directory OR, from the root repository $> make tests # from the root directory of the dotfiles repository ## Resources You might find the below links interestings: * [Bats Wiki](https://github.com/sstephenson/bats/wiki) and [Homepage](https://github.com/sstephenson/bats) * [How to use Bats to test your command line tools](https://blog.engineyard.com/2014/bats-test-command-line-tools) ================================================ FILE: tests/setup_bats.sh ================================================ #! /bin/bash ################################################################################ # setup_bats.sh - Setup Bats -- Bash Automated Testing System # . See https://github.com/sstephenson/bats # Time-stamp: # # Usage: # source setup_bats.sh # # You SHOULD source this file since it might alter the PATH variable ################################################################################ COLOR_RED="\033[0;31m" COLOR_BACK="\033[0m" print_error_and_exit() { echo -e "${COLOR_RED}***ERROR***${COLOR_BACK} $*" exit 1 } if [ "$(uname -s)" == "Darwin" ]; then [ -z "`which brew`" ] && print_error_and_exit "Install Homebrew: see http://brew.sh/" if [ -z "`which bats`" ]; then echo "=> installing bats" brew install bats else echo "... bats seems to be already installed" fi elif [ "$(uname -s)" == "Linux" ]; then if [ -z "`which bats`" ]; then echo "=> manual install of bats" if [ ! -d /tmp/bats ]; then git clone https://github.com/sstephenson/bats.git /tmp/bats else cd /tmp/bats; git pull; cd - fi mkdir -p /tmp/local bash /tmp/bats/install.sh /tmp/local export PATH=$PATH:/tmp/local/bin else echo "... bats seems to be already installed" fi else print_error_and_exit "unsupported system" fi ================================================ FILE: tests/test_helper.bash ================================================ #! /usr/bin/env bash ################################################################################ # test_helper.bash - # Time-stamp: # # Copyright (c) 2016 Sebastien Varrette # ################################################################################ # Colors COLOR_RED="\033[0;31m" COLOR_BACK="\033[0m" # Constant #DOTFILES_D=${DOTFILES_D:=$HOME/.config/dotfiles.falkor.d} DOTFILES_D=${DOTFILES_D:=$HOME/.config} TARGET=${TARGET:=$HOME} # See https://github.com/jasonkarns/bats-assert # Note: flunk forces a test failure with an optional message load helpers/assertions/all print_error_and_exit() { echo -e "${COLOR_RED}***ERROR***${COLOR_BACK} $*" exit 1 } assert_falkor_dotfile_present() { local filename=$(basename $1) local falkor_dotfile=${DOTFILES_D}/$1 local relative_target=${falkor_dotfile/#$HOME\//} local dotfile=${TARGET}/$filename if [[ ! -e "${dotfile}" ]]; then flunk "the dotfile '${dotfile}' does not exists" else if [[ -h "${dotfile}" ]]; then if [ "$(readlink $dotfile)" != "${relative_target}" ]; then flunk "the dotfile '$dotfile' is a symlink yet it does not point to '${relative_target}' (but to '$(readlink $dotfile)')" fi elif [[ -f "${dotfile}" ]]; then local checksum_src=`shasum $dotfile | cut -d ' ' -f 1` local checksum_dst=`shasum $falkor_dotfile | cut -d ' ' -f 1` if [ "${checksum_src}" != "${checksum_dst}" ]; then flunk "${dotfile} is present and a file, yet its content differs from '${falkor_dotfile}'" fi fi fi } assert_falkor_dotfile_absent() { local filename=$(basename $1) local falkor_dotfile=${DOTFILES_D}/$1 local dotfile=${TARGET}/$filename if [[ -e "${dotfile}" ]]; then if [[ -h "${dotfile}" ]]; then if [ "$(readlink $dotfile)" == "${falkor_dotfile}" ]; then flunk "the dotfile '$dotfile' is a symlink still pointing to '${falkor_dotfile}'" fi elif [[ -f "${dotfile}" ]]; then local checksum_src=`shasum $dotfile | cut -d ' ' -f 1` local checksum_dst=`shasum $falkor_dotfile | cut -d ' ' -f 1` if [ "${checksum_src}" == "${checksum_dst}" ]; then flunk "${dotfile} is present and a file, yet its content is the same as the one of '${falkor_dotfile}'" fi fi fi } ================================================ FILE: tmux/README.md ================================================ # Tmux [Tmux](https://github.com/tmux/tmux/wiki/Getting-Started), a modern terminal multiplexer, alternative to GNU screen. * [cheatsheet](https://tmuxcheatsheet.com/) ## Installation ```bash # Install Tmux Plugin Manager: https://github.com/tmux-plugins/tpm git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm # Copy/symlink the present tmux.conf under ~/.config/tmux/ ``` ```bash sudo apt install tmux tmuxinator ``` You also need to install [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm) which helps to manage several interesting plugins -- see [plugin list](https://github.com/tmux-plugins/list): ```bash git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm ``` ## Configuration The default configuration is located under `$XDG_CONFIG_HOME/tmux/tmux.conf` (for compliance with the [XDG Base Directory Specifications](https://specifications.freedesktop.org/basedir-spec/latest/)). Copy or symlink the present [`tmux.conf`](tmux.conf) under `~/.config/tmux/` The first time you run `tmux`, install the defined plugins with `Ctrl+b I` (aka ` I`) ## Reminder of the main `tmux` commands Kindly refer to many [cheatsheets](https://geoffcorey.github.io/tmux/linux/tpm/cli/2023/12/23/tmux-and-tpm.html) existing online, yet here are a recall of the main commands: * You can start a tmux session (_i.e._ creates a single window with a shell in it) with the `tmux` command. | Command | Description | | :------------------------------ | :------------------------------------------------- | | `tmux [new -s ]` | start a new tmux session (named ``) | | `tmux ls` | list current tmux sessions | | `tmux attach [-t ] [-r] ` | attach to a named screen session (`-r`: read-only) | | `tmux kill-session [-t ]` | kill session `` (all: `tmux kill-server`) | Once within a tmux session, similarly to [Gnu screen](../screen/README.md), you can invoke a command which consist of a "`CTRL + b`" sequence followed by another character. The main commands are listed in the below table: | __Command__ | __Description__ | | :--------------- | :----------------------------------- | | `Ctrl+b c` | __create__ new tab | | `Ctrl+b n` | go to __next__ tab | | `Ctrl+b p` | go to __previous__ tab | | `Ctrl+b ,` | rename / set tab title | | `Ctrl+b x` | kill current tab | | `Ctrl+b [0-9]` | switch to tab number __[0-9]__ | | `Ctrl+b d` | __detach__ | | `Ctrl+b &` | quit and killall _(not recommended)_ | | `Ctrl+b [` | Enter/leave copy mode | | | \texti{(up/down; space to select} | | `Ctrl+b ?` | Help | | `Ctrl+b %` | vertical split pane | | `Ctrl+b "` | horizontal split pane | | `Ctrl+b ` | move to pane | | `Ctrl+b q` | Show pane numbers | With the Tmux plugins installed, you also have access to other commands: | __Command__ | __Tmux plugin__ | __Description__ | | :--------------- | :----------------------------------------------------------: | :----------------------------------------------- | | `Ctrl+b SPACE` | [tmux-which-key](https://github.com/alexwforsythe/tmux-which-key) | Nice menu facilitating key navigation | | `Ctrl+b I` | [Tmux plugin manager](https://github.com/tmux-plugins/tpm) | __install__ plugins and refresh tmux environment | | `Ctrl+b U` | | __update__ plugins | | `Ctrl+b Alt u` | | remove/uninstall plugins not on the plugin list | | `Ctrl+b shift p` | [tmux-logging](https://github.com/tmux-plugins/tmux-logging) | Enter/leave logging mode | ================================================ FILE: tmux/tmux.conf ================================================ # Time-stamp: ################################################################################ # tmux.conf - TMux configuration ################################################################################ # _ __ # | |_ _ __ ___ _ ___ __ ___ ___ _ __ / _| # | __| '_ ` _ \| | | \ \/ / / __/ _ \| '_ \| |_ # | |_| | | | | | |_| |> < | (_| (_) | | | | _| # (_)__|_| |_| |_|\__,_/_/\_(_)___\___/|_| |_|_| # ################################################################################ # Install Tmux Plugin Manager: https://github.com/tmux-plugins/tpm # git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm # # Then install the present configuration file into ~/.tmux.conf (or better) # $XDG_CONFIG_HOME/tmux/tmux.conf # # If you intend to use the 'falkor' theme for tmux-powerline, ensure # ~/.config/tmux-powerline points to tmux-powerline # # TMux cheatsheet: https://tmuxcheatsheet.com/ ################################################################################ ### List of enabled plugins: https://github.com/tmux-plugins/list set -g @plugin 'tmux-plugins/tpm' # Tmux Plugin Manager # number of sensible defaults for Tmux, such as enabling mouse support and making it easier to split and resize panes. set -g @plugin 'tmux-plugins/tmux-sensible' ### tmux-powerline: https://github.com/erikw/tmux-powerline # see falkor theme under tmux-powerline/themes/ set -g @plugin 'erikw/tmux-powerline' #### https://github.com/tmux-plugins/tmux-sidebar # prefix + Tab - toggle sidebar with a directory tree # prefix + Backspace - toggle sidebar and move cursor to it (focus it) set -g @plugin 'tmux-plugins/tmux-sidebar' # Alternative (assuming https://github.com/nvim-tree/nvim-tree.lua is installed) # et -g @treemux-tree-nvim-init-file '~/.tmux/plugins/treemux/configs/treemux_init.lua' # set -g @plugin 'kiyoon/treemux' ### https://github.com/tmux-plugins/tmux-logging set -g @plugin 'tmux-plugins/tmux-logging' # SHIFT p ### SPACE set -g @plugin 'alexwforsythe/tmux-which-key' # Custom bindings bind-key -T prefix X confirm-before kill-session # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)!!! run '~/.config/tmux/plugins/tpm/tpm' ================================================ FILE: vim/.oldfr/.vimrc ================================================ " " .vimrc -- my personal VIM configuration " see http://github.com/Falkor/dotfiles " " Copyright (c) 2010 Sebastien Varrette " http://varrette.gforge.uni.lu " " _ " __ _(_)_ __ ___ _ __ ___ " \ \ / / | '_ ` _ \| '__/ __| " \ V /| | | | | | | | | (__ " (_)_/ |_|_| |_| |_|_| \___| " " " To be reworked... for instance using " http://github.com/rtomayko/dotfiles/blob/rtomayko/.vimrc " " /etc/vim/vimrc ou ~/.vimrc " Fichier de configuration de Vim " Formation Debian GNU/Linux par Alexis de Lattre " http://www.via.ecp.fr/~alexis/formation-linux/ " ':help options.txt' ou ':help nom_du_paramtre' dans Vim " pour avoir de l'aide sur les paramtres de ce fichier de configuration " Avertissement par flash (visual bell) plutt que par beep set vb " Encoding set enc=iso-8859-1 " Active la coloration syntaxique syntax on " Utiliser le jeu de couleurs standard colorscheme default set background=dark " Affiche la position du curseur 'ligne,colonne' set ruler " Affiche une barre de status en bas de l'cran set laststatus=2 " Contenu de la barre de status set statusline=%<%f%h%m%r%=%l,%c\ %P " Largeur maxi du texte insr " '72' permet de wrapper automatiquement 72 caractres " '0' dsactive la fonction set textwidth=0 " Wrappe 72 caractres avec la touche '#' map # {v}! par 72 " Wrappe et justifie 72 caractres avec la touche '@' map @ {v}! par 72j " Ne pas assurer la compatibilit avec l'ancien Vi set nocompatible " Nombre de colonnes "set columns=80 " Nombre de commandes dans l'historique set history=50 " Options du fichier ~/.viminfo set viminfo='20,\"50 " Active la touche Backspace set backspace=2 " Autorise le passage d'une ligne l'autre avec les flches gauche et droite set whichwrap=<,>,[,] " Garde toujours une ligne visible l'cran au dessus du curseur set scrolloff=1 " Affiche les commandes dans la barre de status set showcmd " Affiche la paire de parenthses set showmatch " Essaye de garder le curseur dans la mme colonne quand on change de ligne set nostartofline " Option de la compltion automatique set wildmode=list:full " Par dfaut, ne garde pas l'indentation de la ligne prcdente " quand on commence une nouvelle ligne set noautoindent " Options d'indentation pour un fichier C set cinoptions=(0 " xterm-debian est un terminal couleur if &term =~ "xterm-debian" || &term =~ "xterm-xfree86" set t_Co=16 set t_Sf=[3%dm set t_Sb=[4%dm endif " Quand on fait de la programmation, on veut qu'il n'y ait jamais de " vraies tabulations insres mais seulement 4 espaces autocmd BufNewfile,BufRead *.c set expandtab autocmd BufNewfile,BufRead *.c set tabstop=4 autocmd BufNewfile,BufRead *.h set expandtab autocmd BufNewfile,BufRead *.h set tabstop=4 autocmd BufNewfile,BufRead *.cpp set expandtab autocmd BufNewfile,BufRead *.cpp set tabstop=4 " Dcommentez les 2 lignes suivantes si vous voulez avoir les tabulations et " les espaces marqus en caractres bleus "set list "set listchars=tab:>-,trail:- " Les recherches ne sont pas 'case sensitives' set ignorecase " Mettre en surlign les expressions recherches set hlsearch " Fichier d'aide set helpfile=$VIMRUNTIME/doc/help.txt.gz " Le dcoupage des folders se base sur l'indentation set foldmethod=indent " 12 niveaux d'indentation par dfaut pour les folders set foldlevel=12 " Police de caractre pour Gvim qui supporte le symbole euro set guifont=-misc-fixed-medium-r-semicondensed-*-*-111-75-75-c-*-iso8859-15 ================================================ FILE: vim/README.md ================================================ # Falkor's Dotfiles -- vim configuration ## Screenshot ![](https://raw.githubusercontent.com/Falkor/dotfiles/master/screenshots/screenshot_falkor_vim.png) ## Installation You can use the `install.sh` script featured with the [Falkor's dotfile](https://github.com/Falkor/dotfile) repository. ``` bash $> cd ~/.config/dotfiles.falkor.d $> ./install.sh --vim # OR ./install.sh --with-vim ``` This will setup the configuration files in `~/.config/vim`, following the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/latest/) To be able to inform vim about this 'exotic' location (ssuming the `$XDG_*` variables are configured in your shell), you need to setup the environment variable `$VIMINIT` as follows (see `shell/available/vim.sh`): ~~~bash # XDG compliant setup for vim # Assuming you install your vim configuration under ~/.config/vim/vimrc as done # by default by Falkor's dotfiles -- see https://github.com/Falkor/dotfiles export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC' ~~~ Upon the first launch, vim will also setup the directory `~/.cache/vim/` to host in particular the packages installed automatically with [NeoBundle](https://github.com/Shougo/neobundle.vim/blob/master/doc/neobundle.txt). ## Uninstall ``` bash $> cd ~/.config/dotfiles.falkor.d $> ./install.sh --delete --vim ``` ## Customizations * define your own custom bundle in `~/.vimrc.local.bundles` * use `.vimrc.local` to place your local custom vim code. ================================================ FILE: vim/config/autocmd.vim ================================================ " File Types {{{ "------------------------------------------------- "" The PC is fast enough, do syntax highlight syncing from start " augroup vimrc-sync-fromstart " autocmd! " autocmd BufEnter * :syntax sync fromstart " augroup END "" txt " augroup vimrc-wrapping " autocmd! " autocmd BufRead,BufNewFile *.txt call s:setupWrapping() " augroup END " authorize change of line using left/right arrow set whichwrap=<,>,[,] "" make/cmake augroup vimrc-make-cmake autocmd! autocmd FileType make setlocal noexpandtab autocmd BufNewFile,BufRead CMakeLists.txt setlocal filetype=cmake augroup END set autoread "" always delete trailing whitespace UNLESS it's a markdown file "" The function :FixWhitespace comes from NeoBundle bronson/vim-trailing-whitespace let g:extra_whitespace_ignored_filetypes = [ 'md' ] autocmd BufWritePre * :FixWhitespace " Update Emacs Time-stamp " autocmd BufWritePre *.* :%s/^\s*\(\/\/\|#\|%\|"\)\s\+Time-stamp:\s\+<\zs.*/\=strftime('%a %Y-%m-%d') . ' ' . strftime('%H:%M') . ' ' . $USER . '>'/e augroup MyAutoCmd " Update filetype on save if empty autocmd BufWritePost * \ if &l:filetype ==# '' || exists('b:ftdetect') \ | unlet! b:ftdetect \ | filetype detect \ | endif autocmd FileType crontab setlocal nobackup nowritebackup autocmd FileType gitcommit setlocal spell autocmd FileType gitcommit,qfreplace setlocal nofoldenable autocmd FileType zsh setlocal foldenable foldmethod=marker " Improved include pattern autocmd FileType html \ setlocal includeexpr=substitute(v:fname,'^\\/','','') | \ setlocal path+=./;/ autocmd FileType markdown \ setlocal spell expandtab autoindent \ formatoptions=tcroqn2 comments=n:> autocmd FileType apache setlocal path+=./;/ autocmd FileType cam setlocal nonumber synmaxcol=10000 autocmd FileType go highlight default link goErr WarningMsg | \ match goErr /\/ autocmd FileType python \ if has('python') || has('python3') | \ setlocal omnifunc=jedi#completions | \ else | \ setlocal omnifunc= | \ endif autocmd BufWritePost ~/.vim/doc/* :helptags ~/.vim/doc augroup END " vim-python augroup vimrc-python autocmd! autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=8 colorcolumn=79 \ formatoptions+=croq softtabstop=4 smartindent \ cinwords=if,elif,else,for,while,try,except,finally,def,class,with augroup END " }}} " Internal Plugin Settings " {{{ " ------------------------ " PHP "{{{ let g:PHP_removeCRwhenUnix = 0 " }}} " Python "{{{ let g:python_highlight_all = 1 " }}} " Vim "{{{ let g:vimsyntax_noerror = 1 "let g:vim_indent_cont = 0 " }}} " Bash "{{{ let g:is_bash = 1 " }}} " Java "{{{ let g:java_highlight_functions = 'style' let g:java_highlight_all = 1 let g:java_highlight_debug = 1 let g:java_allow_cpp_keywords = 1 let g:java_space_errors = 1 let g:java_highlight_functions = 1 " }}} " JavaScript "{{{ let g:SimpleJsIndenter_BriefMode = 1 let g:SimpleJsIndenter_CaseIndentLevel = -1 " }}} " Ruby "{{{ augroup vimrc-ruby autocmd! autocmd BufNewFile,BufRead *.rb,*.rbw,*.gemspec setlocal filetype=ruby autocmd FileType ruby set tabstop=2|set shiftwidth=2|set expandtab softtabstop=2 smartindent augroup END let g:tagbar_type_ruby = { \ 'kinds' : [ \ 'm:modules', \ 'c:classes', \ 'd:describes', \ 'C:contexts', \ 'f:methods', \ 'F:singleton methods' \ ] \ } " }}} " Markdown "{{{ let g:markdown_fenced_languages = [ \ 'coffee', \ 'css', \ 'erb=eruby', \ 'javascript', \ 'js=javascript', \ 'json=javascript', \ 'ruby', \ 'sass', \ 'xml', \ 'vim' \] " }}} " }}} " vim: set ts=2 sw=2 tw=80 noet : ================================================ FILE: vim/config/general.vim ================================================ " General Settings "--------------------------------------------------------- " General {{{ set mouse=a " Enable mouse to scroll in command-line mode set modeline " automatically setting options from modelines set report=0 " Don't report on line changes set noerrorbells " Don't trigger bell on error set visualbell t_vb= " Don't make any faces set lazyredraw " don't redraw while in macros set hidden " hide buffers when abandoned instead of unload set fileformats=unix,dos,mac " Use Unix as the standard file type set magic " For regular expressions turn magic on set path=.,** " Directories to search when using gf set virtualedit=block " Position cursor anywhere in visual block set history=1000 " Search and commands remembered set synmaxcol=1000 " Don't syntax highlight long lines syntax on syntax sync minlines=256 " Update syntax highlighting for more lines set ttyfast " Indicate a fast terminal connection set formatoptions+=1 " Don't break lines after a one-letter word set formatoptions-=t " Don't auto-wrap text if has('vim_starting') set encoding=utf-8 " The encoding displayed. set fileencoding=utf-8 " The encoding written to file. "setglobal bomb " put "byte order mark" (BOM) at the start of Unicode files. "set fileencodings=ucs-bom,utf-8,latin1 set binary endif " What to save for views: " set viewoptions-=options viewoptions+=slash,unix " What not to save in sessions: set sessionoptions-=options set sessionoptions-=globals set sessionoptions-=folds set sessionoptions-=help set sessionoptions-=buffers set clipboard=unnamed " if has('clipboard') || has('gui_running') " set clipboard=unnamed,unnamedplus " endif " General }}} " Wildmenu {{{ " -------- if has('wildmenu') set nowildmenu set wildmode=list:longest,full set wildoptions=tagfile set wildignorecase set wildignore+=.git,*.pyc,*.spl,*.o,*.out,*~,#*#,%* set wildignore+=*.jpg,*.jpeg,*.png,*.gif,*.zip,**/tmp/**,*.DS_Store endif " }}} " Tabs and Indents {{{ " ---------------- set textwidth=80 " Text width maximum chars before wrapping set expandtab " Do expand tabs to spaces as default set tabstop=2 " The number of spaces a tab is set softtabstop=2 " While performing editing operations set smarttab " Tab insert blanks according to 'shiftwidth' set autoindent " Don't Use same indenting on new lines set smartindent " Smart autoindenting on new lines set shiftround " Round indent to multiple of 'shiftwidth' set shiftwidth=2 " Number of spaces to use in auto(indent) " }}} " Folds {{{ " ----- if has('folding') set foldenable set foldmethod=syntax set foldlevelstart=99 set foldtext=FoldText() endif " }}} " Time {{{ " -------- set timeout ttimeout set timeoutlen=750 " Time out on mappings set ttimeoutlen=250 " Time out on key codes set updatetime=1000 " Idle time to write swap if has('nvim') " https://github.com/neovim/neovim/issues/2017 set ttimeoutlen=-1 endif " }}} " Searching {{{ " --------- set ignorecase " Search ignoring case set smartcase " Keep case when searching with * set infercase set incsearch " Incremental search set hlsearch " Highlight search results set wrapscan " Searches wrap around the end of the file set showmatch " Jump to matching bracket set matchpairs+=<:> " Add HTML brackets to pair matching set matchtime=1 " Tenths of a second to show the matching paren set cpoptions-=m " showmatch will wait 0.5s or until a char is typed " }}} " Behavior {{{ " -------- set linebreak " Break long lines at 'breakat' set breakat=\ \ ;:,!? " Long lines break chars set nostartofline " Cursor in same column for few commands set whichwrap+=h,l,<,>,[,],~ " Move to following line on certain keys set splitbelow splitright " Splits open bottom right set switchbuf=usetab,split " Switch buffer behavior set backspace=eol,start,indent " Intuitive backspacing in insert mode set diffopt=filler,iwhite " Diff mode: show fillers, ignore white set showfulltag " Show tag and tidy search in completion set completeopt=menuone " Show menu even for one item set complete=. " No wins, buffs, tags, include scanning set nowrap " No wrap by default " }}} set shell=/bin/sh " Use Bourne shell for command substitution " Editor UI Appearance {{{ " -------------------- set noshowmode " Don't show mode in cmd window set shortmess=aoOTI " Shorten messages and don't show intro set scrolloff=3 " Keep at least 3 lines above/below set sidescrolloff=3 " Keep at least 3 lines left/right set pumheight=20 " Pop-up menu's line height set number " Show line numbers "set relativenumber " Use relative instead of absolute line numbers set ruler " Enable default status ruler set nolist " Show hidden characters set showtabline=2 " Always show the tabs line set tabpagemax=30 " Maximum number of tab pages set winwidth=30 " Minimum width for current window set winheight=1 " Minimum height for current window set previewheight=8 " Completion preview height set helpheight=12 " Minimum help window height set display=lastline set title " No need for a title " Title format: see https://coderwall.com/p/lznfyw/better-title-string-for-vim " directory info (max 12 char) | buff. no | filename | modified | Type | Row no. set titlestring=...%{strpart(expand(\"%:p:h\"),stridx(expand(\"%:p:h\"),\"/\",strlen(expand(\"%:p:h\"))-12))}%=%n.\ \ %{expand(\"%:t:r\")}\ %m\ %Y\ \ \ \ %l\ of\ %L set showcmd " Show command in status line set cmdheight=2 " Height of the command line set cmdwinheight=5 " Command-line lines set noequalalways " Don't resize windows on split or close set laststatus=2 " Always show a status line set colorcolumn=80 " Highlight the 80th character limit " Do not display completion messages " Patch: https://groups.google.com/forum/#!topic/vim_dev/WeBBjkXE8H8 if has('patch-7.4.314') set shortmess+=c endif " For snippet_complete marker if has('conceal') && v:version >= 703 set conceallevel=2 concealcursor=niv endif " }}} " vim: set ts=2 sw=2 tw=80 noet foldmethod=marker: " ================================================ FILE: vim/config/init.vim ================================================ " Vim Initialization " ------------------ " Global Mappings "{{{ " Use spacebar instead of '\' as leader. Require before loading plugins. let g:mapleader="\" let g:maplocalleader=',' " Release keymappings for plug-in. nnoremap xnoremap nnoremap , xnoremap , " }}} " XDG and Vim directory Settings "{{{ " mkdir -p "$(XDG_CACHE_HOME)/vim/"{backup,session,swap,tags,undo,view,notes}; " for vimdir in ['swap', 'backup', 'undo', 'plugins', 'shada', 'viminfo'] " swap: swp files, stored in directory " backup .bak files, stored in backupdir if !isdirectory($VARPATH . vimdir) call mkdir( $VARPATH . vimdir, "p") endif endfor if has('nvim') set shada='30,/100,:50,<10,@10,s50,h,n$VARPATH/shada else set viminfo='30,/100,:500,<10,@10,s10,h,n$VARPATH/viminfo endif set undofile swapfile nobackup set directory=$VARPATH/swap//,$VARPATH,~/tmp,/var/tmp,/tmp set undodir=$VARPATH/undo//,$VARPATH,~/tmp,/var/tmp,/tmp set backupdir=$VARPATH/backup/,$VARPATH,~/tmp,/var/tmp,/tmp set viewdir=$VARPATH/view/ set nospell spellfile=$VIMPATH/spell/en.utf-8.add " Don't backup files in temp directories or shm if exists('&backupskip') set backupskip+=/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/*,/private/var/*,.vault.vim endif " Don't keep swap files in temp directories or shm augroup swapskip autocmd! silent! autocmd BufNewFile,BufReadPre \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/*,/private/var/*,.vault.vim \ setlocal noswapfile augroup END " Don't keep undo files in temp directories or shm if has('persistent_undo') augroup undoskip autocmd! silent! autocmd BufWritePre \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/*,/private/var/*,.vault.vim \ setlocal noundofile augroup END endif " Don't keep viminfo for files in temp directories or shm augroup viminfoskip autocmd! silent! autocmd BufNewFile,BufReadPre \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/*,/private/var/*,.vault.vim \ setlocal viminfo= augroup END set viminfo+=n$VARPATH/viminfo set runtimepath=$XDG_CONFIG_HOME/vim,$XDG_CONFIG_HOME/vim/after,$VIM,$VIMRUNTIME " }}} " Set augroup "{{{ augroup MyAutoCmd autocmd! augroup END " }}} " Load vault settings "{{{ if filereadable(expand('$VIMPATH/.vault.vim')) execute 'source' expand('$VIMPATH/.vault.vim') endif " }}} " Setup NeoBundle "{{{ let s:plugins_dir = expand('$VARPATH/plugins') "let g:neobundle#types#git#default_protocol = 'https' if has('vim_starting') if isdirectory($XDG_CONFIG_HOME.'/vim') " Respect XDG let $MYVIMRC=expand('$XDG_CONFIG_HOME/vim/vimrc') set runtimepath=$VIMPATH,$VIM/vimfiles,$VIMRUNTIME endif " Load NeoBundle for package management if &runtimepath !~? '/neobundle.vim' if ! isdirectory(s:plugins_dir.'/neobundle.vim') " Clone NeoBundle if not found echo "Installing NeoBundle..." echo " " execute printf('!git clone %s://github.com/Shougo/neobundle.vim.git', \ (exists('$http_proxy') ? 'https' : 'git')) \ s:plugins_dir.'/neobundle.vim' endif execute 'set runtimepath^='.s:plugins_dir.'/neobundle.vim' endif " Load minimal version of vim while SSHing if len($SSH_CLIENT) let $VIM_MINIMAL = 1 endif endif " }}} " Disable default plugins "{{{ " Disable menu.vim if has('gui_running') set guioptions=Mc endif " Disable pre-bundled plugins let g:loaded_getscript = 1 let g:loaded_getscriptPlugin = 1 let g:loaded_matchparen = 1 let g:loaded_netrw = 1 let g:loaded_netrwPlugin = 1 let g:loaded_netrwFileHandlers = 1 let g:loaded_netrwSettings = 1 let g:loaded_rrhelper = 1 let g:loaded_tar = 1 let g:loaded_tarPlugin = 1 let g:loaded_2html_plugin = 1 let g:loaded_vimball = 1 let g:loaded_vimballPlugin = 1 let g:loaded_zip = 1 let g:loaded_zipPlugin = 1 let g:loaded_gzip = 1 " }}} " vim: set ts=2 sw=2 tw=80 noet : ================================================ FILE: vim/config/keybindings.vim ================================================ " Key Bindings and Abbreviations "--------------------------------------------------------- " Documentation reminder for shortcuts: " {cmd} {attr} {lhs} {rhs} " where " {cmd} is one of ':map', ':map!', ':nmap', ':vmap', ':imap', " ':cmap', ':smap', ':xmap', ':omap', ':lmap', etc. " {attr} is optional and one or more of the following: , , "