├── .local └── share │ ├── zsh │ ├── zsh-syntax-highlighting │ │ ├── .version │ │ ├── .revision-hash │ │ ├── highlighters │ │ │ ├── line │ │ │ │ └── line-highlighter.zsh │ │ │ ├── root │ │ │ │ └── root-highlighter.zsh │ │ │ ├── cursor │ │ │ │ └── cursor-highlighter.zsh │ │ │ ├── pattern │ │ │ │ └── pattern-highlighter.zsh │ │ │ ├── regexp │ │ │ │ └── regexp-highlighter.zsh │ │ │ └── brackets │ │ │ │ └── brackets-highlighter.zsh │ │ └── zsh-syntax-highlighting.zsh │ ├── almostontop │ │ ├── version │ │ ├── _almostontop │ │ ├── README.md │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ └── almostontop.plugin.zsh │ ├── 5-arrow-movement.plugin.zsh │ ├── substring-search │ │ ├── zsh-history-substring-search.plugin.zsh │ │ └── zsh-history-substring-search.zsh │ ├── zsh-auto-notify │ │ ├── img │ │ │ └── notification-example.png │ │ ├── ISSUE_TEMPLATE.md │ │ ├── tests │ │ │ ├── test_auto_notify_format.zunit │ │ │ ├── test_is_auto_notify_ignored.zunit │ │ │ ├── test_plugin.zunit │ │ │ └── test_auto_notify_send.zunit │ │ ├── CHANGELOG.md │ │ ├── .circleci │ │ │ └── config.yml │ │ ├── auto-notify.plugin.zsh │ │ ├── README.rst │ │ └── LICENSE │ ├── 6-cmdedit.plugin.zsh │ ├── 3-history.plugin.zsh │ ├── 2-vars-and-opts.plugin.zsh │ ├── 4-waiting-dots.plugin.zsh │ ├── 1-prompt.plugin.zsh │ └── zsh-bash-completions-fallback │ │ ├── README.md │ │ ├── zsh-bash-completions-fallback.plugin.zsh │ │ ├── bash-completions-getter.sh │ │ └── LICENSE │ └── fonts │ ├── UbuntuMono-Bold.ttf │ ├── UbuntuMono-Italic.ttf │ ├── UbuntuMono-Regular.ttf │ ├── UbuntuMono-BoldItalic.ttf │ └── UFL.txt ├── .config ├── micro │ ├── buffers │ │ └── history │ ├── bindings.json │ ├── settings.json │ └── colorschemes │ │ └── modded-cmc-16.micro ├── tmux │ └── tmux.conf └── neofetch │ └── config.conf ├── Documents └── plain-text │ └── cup-ascii ├── README.md ├── .zshrc ├── autoinstall └── gnome-terminal.dconf /.local/share/zsh/zsh-syntax-highlighting/.version: -------------------------------------------------------------------------------- 1 | 0.7.1 2 | -------------------------------------------------------------------------------- /.local/share/zsh/almostontop/version: -------------------------------------------------------------------------------- 1 | ALMOSTONTOP_VERSION=0.6.0 2 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-syntax-highlighting/.revision-hash: -------------------------------------------------------------------------------- 1 | 932e29a0c75411cb618f02995b66c0a4a25699bc 2 | -------------------------------------------------------------------------------- /.config/micro/buffers/history: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damntrain/dots/HEAD/.config/micro/buffers/history -------------------------------------------------------------------------------- /.config/micro/bindings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Alt-/": "lua:comment.comment", 3 | "CtrlUnderscore": "lua:comment.comment" 4 | } 5 | -------------------------------------------------------------------------------- /.local/share/fonts/UbuntuMono-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damntrain/dots/HEAD/.local/share/fonts/UbuntuMono-Bold.ttf -------------------------------------------------------------------------------- /.local/share/fonts/UbuntuMono-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damntrain/dots/HEAD/.local/share/fonts/UbuntuMono-Italic.ttf -------------------------------------------------------------------------------- /.local/share/fonts/UbuntuMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damntrain/dots/HEAD/.local/share/fonts/UbuntuMono-Regular.ttf -------------------------------------------------------------------------------- /.local/share/fonts/UbuntuMono-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damntrain/dots/HEAD/.local/share/fonts/UbuntuMono-BoldItalic.ttf -------------------------------------------------------------------------------- /.local/share/zsh/5-arrow-movement.plugin.zsh: -------------------------------------------------------------------------------- 1 | # Zle arrow-movement 2 | bindkey "^[[1;5D" backward-word 3 | bindkey "^[[1;5C" forward-word -------------------------------------------------------------------------------- /.local/share/zsh/substring-search/zsh-history-substring-search.plugin.zsh: -------------------------------------------------------------------------------- 1 | 0=${(%):-%N} 2 | source ${0:A:h}/zsh-history-substring-search.zsh 3 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-auto-notify/img/notification-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damntrain/dots/HEAD/.local/share/zsh/zsh-auto-notify/img/notification-example.png -------------------------------------------------------------------------------- /Documents/plain-text/cup-ascii: -------------------------------------------------------------------------------- 1 | 2 | (((( 3 | )))) 4 | _ .---. 5 | ( |`---'| 6 | \| | 7 | : .___, : 8 | `-----' 9 | -------------------------------------------------------------------------------- /.local/share/zsh/6-cmdedit.plugin.zsh: -------------------------------------------------------------------------------- 1 | # Command-line Editor and the keybind to it (press ctrl+x and ctrl+e) 2 | autoload -U edit-command-line 3 | zle -N edit-command-line 4 | bindkey '^x^e' edit-command-line -------------------------------------------------------------------------------- /.local/share/zsh/3-history.plugin.zsh: -------------------------------------------------------------------------------- 1 | # History proporties 2 | HISTFILE=$ZHOME/history #zhome is declared in main .zshrc 3 | HISTSIZE=1000 4 | SAVEHIST=1000 5 | setopt hist_ignore_dups 6 | setopt share_history 7 | -------------------------------------------------------------------------------- /.local/share/zsh/2-vars-and-opts.plugin.zsh: -------------------------------------------------------------------------------- 1 | # Variables 2 | # Path/fpath 3 | export PATH=$PATH:$HOME/.local/bin 4 | # Editor 5 | export EDITOR=micro 6 | 7 | # Opts 8 | setopt notify 9 | setopt complete_aliases -------------------------------------------------------------------------------- /.local/share/zsh/4-waiting-dots.plugin.zsh: -------------------------------------------------------------------------------- 1 | # Waiting dots, for "..." when slowly completing 2 | # http://stackoverflow.com/a/844299 3 | expand-or-complete-with-dots() { 4 | echo -n "\e[31m...\e[0m" 5 | zle expand-or-complete 6 | zle redisplay 7 | } 8 | zle -N expand-or-complete-with-dots 9 | bindkey "^I" expand-or-complete-with-dots -------------------------------------------------------------------------------- /.config/micro/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "autosu": true, 3 | "backup": false, 4 | "colorscheme": "modded-cmc-16", 5 | "divreverse": false, 6 | "eofnewline": false, 7 | "fastdirty": true, 8 | "mkparents": true, 9 | "pluginchannels": [ 10 | "https://raw.githubusercontent.com/micro-editor/plugin-channel/master/channel.json" 11 | ], 12 | "pluginrepos": [], 13 | "softwrap": true 14 | } 15 | -------------------------------------------------------------------------------- /.local/share/zsh/almostontop/_almostontop: -------------------------------------------------------------------------------- 1 | #compdef almostontop 2 | 3 | _almostontop_cmds() { 4 | local commands; commands=( 5 | 'on:Enables almostontop plugin' 6 | 'off:Disables almostontop plugin' 7 | 'toggle:Toggles almostontop plugin' 8 | ) 9 | _describe -t commands 'almostontop command' commands "$@" 10 | } 11 | 12 | _almostontop() { 13 | _arguments -C '1: :_almostontop_cmds' 14 | } 15 | 16 | _almostontop "$@" 17 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-auto-notify/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Issue Details 2 | 3 | Please provide the following details when opening an issue: 4 | 5 | ## Operating System (uname -a) 6 | 7 | ## zsh version (zsh --version) 8 | 9 | ## auto-notify version (echo "$AUTO_NOTIFY_VERSION") 10 | 11 | ## How is auto-notify installed? 12 | 13 | - [ ] zplug 14 | - [ ] oh-my-zsh 15 | - [ ] Antigen 16 | - [ ] Other (please specify) 17 | 18 | ## Steps to reproduce the issue 19 | 20 | ## gist link to your zshrc 21 | -------------------------------------------------------------------------------- /.local/share/zsh/almostontop/README.md: -------------------------------------------------------------------------------- 1 | # almostontop 2 | 3 | ## Description 4 | almostontop zsh plugin. It clears previous command output every time before new command 5 | executed in shell. Insipred by [`alwaysontop`](https://github.com/swirepe/alwaysontop) plugin for bash 6 | 7 | ## Usage 8 | source `almostontop.plugin.zsh` file and enjoy! 9 | 10 | [![asciicast](https://asciinema.org/a/Rl1O4nJ1sknh66AscsZBk7CJb.svg)](https://asciinema.org/a/Rl1O4nJ1sknh66AscsZBk7CJb) 11 | 12 | ## Author 13 | [Sergey Valiev](https://github.com/Valiev) 14 | -------------------------------------------------------------------------------- /.local/share/zsh/1-prompt.plugin.zsh: -------------------------------------------------------------------------------- 1 | local char='>' 2 | if [[ "$container" != "" ]] 3 | then 4 | getlogo () # You need nerd-fonts to be able to see this 5 | { 6 | source /etc/os-release 7 | case $ID in 8 | arch) logo=;; 9 | fedora) logo=;; 10 | centos) logo=;; 11 | alpine) logo=;; 12 | debian) logo=;; 13 | opensuse*) logo=;; 14 | ubuntu) logo=;; 15 | esac 16 | printf $logo 17 | } 18 | local logo=$(getlogo) 19 | local char2="%K{magenta}%F{black} $logo %k%f" 20 | fi 21 | if [[ "$TMUX" == "" ]] 22 | then 23 | local pth='%K{white}%F{black} %~ %k%f' 24 | fi 25 | 26 | ZLE_RPROMPT_INDENT=0 27 | PROMPT="%(?.%F{green}$char.%F{red}$char)%f " 28 | RPROMPT="$pth$char2" 29 | -------------------------------------------------------------------------------- /.local/share/zsh/almostontop/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | almostontop changelog 2 | ===================== 3 | 4 | ## 0.6.0 5 | * Changed the way to keep prompt and highlighted text with `zle redisplay` 6 | * Fix for https://github.com/Valiev/almostontop/issues/6 7 | 8 | ## 0.5.0 9 | * Command will be shown without variables evaluation and/or 10 | interpolation, fix for https://github.com/Valiev/almostontop/issues/5 11 | 12 | 13 | ## 0.4.0 14 | * `^X^L` keys to toggle `almostontop` 15 | * Fix for https://github.com/Valiev/almostontop/issues/4 16 | 17 | ## 0.3.0 18 | * Start with versioning 19 | 20 | ## 0.2.1 21 | * Fix for https://github.com/Valiev/almostontop/issues/3 22 | 23 | ## 0.2.0 24 | * `zsh` auto-completion 25 | 26 | ## 0.1.0 27 | * Initial commit 28 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-auto-notify/tests/test_auto_notify_format.zunit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zunit 2 | 3 | @setup { 4 | load "../auto-notify.plugin.zsh" 5 | } 6 | 7 | @test 'auto-notify-format no parameters' { 8 | run _auto_notify_format "Hello World" "foo" "bar" "baz" 9 | 10 | assert $state equals 0 11 | assert "$output" same_as "Hello World" 12 | } 13 | 14 | @test 'auto-notify-format correct formatting 1' { 15 | run _auto_notify_format "Command run is - %command (%elapsed seconds)" "zypper up" "10" "0" 16 | 17 | assert $state equals 0 18 | assert "$output" same_as "Command run is - zypper up (10 seconds)" 19 | } 20 | 21 | @test 'auto-notify-format correct formatting 2' { 22 | run _auto_notify_format "Exit code is %exit_code!" "zypper up" "10" "-101" 23 | 24 | assert $state equals 0 25 | assert "$output" same_as "Exit code is -101!" 26 | } 27 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-auto-notify/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Changelog for zsh-auto-notify 2 | ============================= 3 | 4 | 0.8.0 5 | ----- 6 | * Change notify-send application title to `zsh` 7 | 8 | 0.7.0 9 | ----- 10 | * Allow alternate `AUTO_NOTIFY_WHITELIST` for specifying commands to allow 11 | 12 | 0.6.0 13 | ----- 14 | * Display warning and disable auto-notify if notify-send is not installed (Linux only) 15 | 16 | 0.5.1 17 | ----- 18 | * Improved handling of MacOS notifications via #16 (Thanks @dmitmel!) 19 | 20 | 0.5.0 21 | ----- 22 | * Support changing notification title and body using AUTO_NOTIFY_TITLE and AUTO_NOTIFY_BODY 23 | 24 | 0.4.0 25 | ----- 26 | * Add `AUTO_NOTIFY_EXPIRE_TIME` configuration option 27 | * Improvements to notification formatting 28 | * Exit code is now displayed in notifications 29 | * Notifications on linux now show as critical if long command exits with non-zero exit code 30 | 31 | 0.3.0 32 | ----- 33 | * Add support for environments where standard history is disabled. Fixed in #10 34 | 35 | 0.2.0 36 | ----- 37 | * Initial stable release 38 | -------------------------------------------------------------------------------- /.local/share/zsh/almostontop/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Sergey Valiev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # My weird, kinky, and not well-organized config files 3 | 4 | ![thelookofit](https://user-images.githubusercontent.com/51455723/170556296-3d1d0a80-94d7-4b6b-b7e1-a505c0bbe10f.png) 5 | 6 | ### Contains config files for: 7 | - Zsh 8 | - Tmux 9 | - Micro 10 | - Neofetch 11 | - Gnome-terminal 12 | 13 | ### Recommendations 14 | Before applying, make sure that you have all the software installed (zsh, tmux, and so on as listed above) 15 | i recommend putting these configs meaningfully and manually in places where they should be, instead of running installcript, running script will make irreversible changes and won't backup any existed configs for you 16 | 17 | In case you only want that tmux.conf, it is better to use with any vte-based terminal emulator (gnome-terminal with ubuntu-mono fonts in my case), triangle symbols that i use for tabs look broken in other terminals, you can still change these symbols to your font-specific ones, so it may work as well in any other terminal, the reason why it's not done this way already is the fact that it requires nerd-fonts 18 | 19 | ## 20 | ###### *A lot of stuff here is mostly a result of my crappy copy-pasting pieces of .files made by other people, so don't expect anything to be well-organized inside* 21 | -------------------------------------------------------------------------------- /.config/micro/colorschemes/modded-cmc-16.micro: -------------------------------------------------------------------------------- 1 | #CaptainMcClellan's personal color scheme. 2 | # 16 colour version. 3 | color-link comment "italic black" 4 | color-link constant "cyan" 5 | color-link constant.bool "bold cyan" 6 | color-link constant.bool.true "bold green" 7 | color-link constant.bool.false "bold red" 8 | color-link constant.string "yellow" 9 | color-link constant.string.url "underline blue, white" 10 | #color-link constant.number "constant" 11 | color-link constant.specialChar "bold magenta" 12 | color-link identifier "bold red" 13 | color-link identifier.macro "bold red" 14 | color-link identifier.var "bold blue" 15 | #color-link identifier.class "bold green" 16 | color-link identifier.class "bold white" 17 | color-link statement "bold yellow" 18 | color-link symbol "red" 19 | color-link symbol.brackets "blue" 20 | color-link symbol.tag "bold blue" 21 | color-link symbol.tag.extended "bold green" 22 | color-link preproc "bold cyan" 23 | color-link type "green" 24 | color-link type.keyword "bold green" 25 | color-link special "magenta" 26 | color-link ignore "default" 27 | color-link error "bold ,brightred" 28 | color-link todo "underline black,brightyellow" 29 | color-link indent-char ",brightgreen" 30 | color-link line-number "black" 31 | color-link line-number.scrollbar "green" 32 | color-link statusline "15,background" 33 | color-link tabbar "15,background" 34 | color-link current-line-number "bold white" 35 | color-link current-line-number.scroller "red" 36 | color-link diff-added "green" 37 | color-link diff-modified "yellow" 38 | color-link diff-deleted "red" 39 | color-link gutter-error ",red" 40 | color-link gutter-warning "red" 41 | color-link color-column "cyan" 42 | color-link underlined.url "underline blue, white" 43 | color-link divider "black" 44 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-auto-notify/tests/test_is_auto_notify_ignored.zunit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zunit 2 | 3 | @setup { 4 | load "../auto-notify.plugin.zsh" 5 | } 6 | 7 | @test 'is_auto_notify_ignored - commands outside AUTO_NOTIFY_IGNORE' { 8 | run _is_auto_notify_ignored "echo hello world" 9 | 10 | assert $state equals 0 11 | assert "$output" same_as "no" 12 | } 13 | 14 | @test 'is_auto_notify_ignored - all commands in AUTO_NOTIFY_IGNORE' { 15 | for command in $AUTO_NOTIFY_IGNORE; do 16 | run _is_auto_notify_ignored $command 17 | 18 | assert $state equals 0 19 | assert "$output" same_as "yes" 20 | done 21 | } 22 | 23 | @test 'is_auto_notify_ignored - piped commands which are not ignored' { 24 | run _is_auto_notify_ignored "echo hello world | base64 -e" 25 | 26 | assert $state equals 0 27 | assert "$output" same_as "no" 28 | } 29 | 30 | @test 'is_auto_notify_ignored - piped commands which are ignored' { 31 | run _is_auto_notify_ignored "echo hello world | hexdump | less -R" 32 | 33 | assert $state equals 0 34 | assert "$output" same_as "yes" 35 | } 36 | 37 | @test 'is_auto_notify_ignored - AUTO_NOTIFY_WHITELIST disallowed' { 38 | AUTO_NOTIFY_WHITELIST="foobar" 39 | 40 | run _is_auto_notify_ignored "boom baz" 41 | 42 | assert $state equals 0 43 | assert "$output" same_as "yes" 44 | } 45 | 46 | @test 'is_auto_notify_ignored - AUTO_NOTIFY_WHITELIST allowed' { 47 | AUTO_NOTIFY_WHITELIST="foobar" 48 | 49 | run _is_auto_notify_ignored "foobar baz" 50 | 51 | assert $state equals 0 52 | assert "$output" same_as "no" 53 | } 54 | 55 | @test 'is_auto_notify_ignored - AUTO_NOTIFY_WHITELIST allowed with sudo' { 56 | AUTO_NOTIFY_WHITELIST="foobar" 57 | 58 | run _is_auto_notify_ignored "sudo foobar baz" 59 | 60 | assert $state equals 0 61 | assert "$output" same_as "no" 62 | } 63 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-auto-notify/tests/test_plugin.zunit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zunit 2 | 3 | @setup { 4 | function uname { 5 | printf "Linux" 6 | } 7 | # Mock function for passing builds where we don't 8 | # really need notify-send to be installed (e.g. Mac OSX) 9 | function notify-send { 10 | } 11 | } 12 | 13 | @test 'version exported' { 14 | git_version="$(git tag --list | sort -V | tail -1)" 15 | git tag --list 16 | 17 | load "../auto-notify.plugin.zsh" 18 | 19 | assert "$AUTO_NOTIFY_VERSION" is_not_empty 20 | assert "$AUTO_NOTIFY_VERSION" same_as "$git_version" 21 | } 22 | 23 | @test 'print warning if notify-send is not installed' { 24 | function type { 25 | return 1 26 | } 27 | 28 | run load "../auto-notify.plugin.zsh" 29 | 30 | assert "$lines[1]" same_as "'notify-send' must be installed for zsh-auto-notify to work" 31 | assert "$lines[2]" same_as "Please install it with your relevant package manager" 32 | 33 | @test 'dont load auto-notify if notify-send is not installed' { 34 | function type { 35 | return 1 36 | } 37 | 38 | load "../auto-notify.plugin.zsh" 39 | 40 | assert "_auto_notify_track" not_in $preexec_functions 41 | assert "_auto_notify_send" not_in $precmd_functions 42 | } 43 | 44 | 45 | @test 'hook functions are loaded by default' { 46 | load "../auto-notify.plugin.zsh" 47 | 48 | assert '_auto_notify_track' in $preexec_functions 49 | assert '_auto_notify_send' in $precmd_functions 50 | } 51 | 52 | @test 'enable/disable auto-notify' { 53 | load "../auto-notify.plugin.zsh" 54 | 55 | disable_auto_notify 56 | assert '_auto_notify_track' not_in $preexec_functions 57 | assert '_auto_notify_send' not_in $precmd_functions 58 | 59 | enable_auto_notify 60 | assert '_auto_notify_track' in $preexec_functions 61 | assert '_auto_notify_send' in $precmd_functions 62 | } 63 | -------------------------------------------------------------------------------- /.local/share/zsh/almostontop/almostontop.plugin.zsh: -------------------------------------------------------------------------------- 1 | source "${0:h}/version" 2 | 3 | if [ "x$ALMOSONTOP" = "xfalse" ]; then 4 | # doing nothing here 5 | else 6 | ALMOSONTOP=true 7 | fi 8 | 9 | if [ "$ALMOSTONTOP_COLOR" = "" ]; then 10 | ALMOSTONTOP_COLOR="green" 11 | fi 12 | 13 | function _accept_line_almostontop { 14 | if [ "x$ALMOSONTOP" = "xtrue" ]; then 15 | # 1. put cursor to the top of the screen 16 | tput cup 0 0 17 | # 2. redraw line with prompt and command (with highlighted text as well) 18 | zle redisplay 19 | fi 20 | zle .accept-line 21 | } 22 | 23 | zle -N accept-line _accept_line_almostontop 24 | 25 | function almostontop 26 | { 27 | # Help message if there no args 28 | if [ $# -eq 0 ]; then 29 | almostontop_usage 30 | fi 31 | 32 | local arg=$1 33 | if [ "x$arg" = "xon" ]; then 34 | ALMOSONTOP=true 35 | fi 36 | 37 | if [ "x$arg" = "xoff" ]; then 38 | ALMOSONTOP=false 39 | fi 40 | 41 | if [ "x$arg" = "xtoggle" ]; then 42 | almostontop_toggle 43 | fi 44 | } 45 | 46 | function almostontop_toggle 47 | { 48 | if [ "x$ALMOSONTOP" = "xtrue" ]; then 49 | almostontop off 50 | else 51 | almostontop on 52 | fi 53 | } 54 | 55 | # Create widget so it could be bound with keys 56 | zle -N almostontop_toggle almostontop_toggle 57 | 58 | # "ctrl-X ctrl-L" to toggle almostontop, alike "ctrl-L" to clear screen 59 | bindkey "^X^L" almostontop_toggle 60 | 61 | function almostontop_usage 62 | { 63 | cat <<-EOF 64 | Usage: almostontop 65 | 66 | Commands: 67 | on Enables almostontop plugin 68 | off Disables almostontop plugin 69 | toggle Toggles almostontop plugin 70 | 71 | Description: 72 | almostontop clears previous command output every time before new command 73 | executed in shell. Insipred by 'alwaysontop' plugin for bash: 74 | https://github.com/swirepe/alwaysontop 75 | 76 | Version: $ALMOSTONTOP_VERSION 77 | EOF 78 | } 79 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-auto-notify/.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | 4 | test: &test 5 | steps: 6 | - checkout 7 | - run: 8 | name: Install Dependencies 9 | command: apt-get update && apt-get install -y curl git ncurses-bin 10 | - run: 11 | name: Download requirements 12 | command: | 13 | mkdir -p ~/bin 14 | curl -L https://raw.githubusercontent.com/molovo/revolver/master/revolver > ~/bin/revolver 15 | curl -L https://github.com/molovo/zunit/releases/download/v0.8.2/zunit > ~/bin/zunit 16 | chmod u+x ~/bin/{revolver,zunit} 17 | - run: 18 | name: Run Zunit 19 | command: | 20 | export TERM="xterm-256color" 21 | export PATH="$HOME/bin:$PATH" 22 | zunit --verbose 23 | 24 | 25 | jobs: 26 | lint: 27 | docker: 28 | - image: "python:3.7-stretch" 29 | steps: 30 | - checkout 31 | - run: 32 | name: run restructuredtext linter 33 | command: | 34 | pip install restructuredtext_lint 35 | rst-lint *.rst 36 | 37 | test-zsh-5.1: 38 | docker: 39 | - image: "zshusers/zsh:5.1.1" 40 | <<: *test 41 | 42 | test-zsh-5.2: 43 | docker: 44 | - image: "zshusers/zsh:5.2" 45 | <<: *test 46 | 47 | test-zsh-5.3: 48 | docker: 49 | - image: "zshusers/zsh:5.3.1" 50 | <<: *test 51 | 52 | test-zsh-5.4: 53 | docker: 54 | - image: "zshusers/zsh:5.4.2" 55 | <<: *test 56 | 57 | test-zsh-5.5: 58 | docker: 59 | - image: "zshusers/zsh:5.5.1" 60 | <<: *test 61 | 62 | test-zsh-5.6: 63 | docker: 64 | - image: "zshusers/zsh:5.6.2" 65 | <<: *test 66 | 67 | workflows: 68 | version: 2 69 | test: 70 | jobs: 71 | - lint 72 | - test-zsh-5.1 73 | - test-zsh-5.2 74 | - test-zsh-5.3 75 | - test-zsh-5.4 76 | - test-zsh-5.5 77 | - test-zsh-5.6 78 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-syntax-highlighting/highlighters/line/line-highlighter.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | 31 | # Define default styles. 32 | : ${ZSH_HIGHLIGHT_STYLES[line]:=} 33 | 34 | # Whether the root highlighter should be called or not. 35 | _zsh_highlight_highlighter_line_predicate() 36 | { 37 | _zsh_highlight_buffer_modified 38 | } 39 | 40 | # root highlighting function. 41 | _zsh_highlight_highlighter_line_paint() 42 | { 43 | _zsh_highlight_add_highlight 0 $#BUFFER line 44 | } 45 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-syntax-highlighting/highlighters/root/root-highlighter.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | 31 | # Define default styles. 32 | : ${ZSH_HIGHLIGHT_STYLES[root]:=standout} 33 | 34 | # Whether the root highlighter should be called or not. 35 | _zsh_highlight_highlighter_root_predicate() 36 | { 37 | _zsh_highlight_buffer_modified 38 | } 39 | 40 | # root highlighting function. 41 | _zsh_highlight_highlighter_root_paint() 42 | { 43 | if (( EUID == 0 )) { _zsh_highlight_add_highlight 0 $#BUFFER root } 44 | } 45 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-syntax-highlighting/highlighters/cursor/cursor-highlighter.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | 31 | # Define default styles. 32 | : ${ZSH_HIGHLIGHT_STYLES[cursor]:=standout} 33 | 34 | # Whether the cursor highlighter should be called or not. 35 | _zsh_highlight_highlighter_cursor_predicate() 36 | { 37 | # remove cursor highlighting when the line is finished 38 | [[ $WIDGET == zle-line-finish ]] || _zsh_highlight_cursor_moved 39 | } 40 | 41 | # Cursor highlighting function. 42 | _zsh_highlight_highlighter_cursor_paint() 43 | { 44 | [[ $WIDGET == zle-line-finish ]] && return 45 | 46 | _zsh_highlight_add_highlight $CURSOR $(( $CURSOR + 1 )) cursor 47 | } 48 | -------------------------------------------------------------------------------- /.zshrc: -------------------------------------------------------------------------------- 1 | ######################## 2 | # Essential internals # 3 | ####################### 4 | 5 | # Home for plugins and other stuff 6 | # the main directory is used for essential/main parts 7 | # these parts will be loaded automatically by loadatstart function if they are 8 | # named correctly 9 | # subdirectories are used for additional plugins 10 | # these plugins should be loaded manually by loadplug 11 | ZHOME=$HOME/.local/share/zsh/ 12 | 13 | # Functions 14 | # (note, you will see "unfunction funcname" at the end of every function 15 | # that i decided to use only for initialization 16 | # these functions won't be available in interactive environments 17 | # they are used only once at shell startup) 18 | 19 | function loadplug () 20 | # To load plugins located in $ZHOME manually 21 | # used to load additional plugins from $ZHOME subdirs 22 | { 23 | local plug=("$@") 24 | source $ZHOME/$plug 25 | } 26 | 27 | function loadmain () 28 | # Load any file with .plugin.zsh extension in $ZHOME root dir 29 | # (files in subdirs are not included) 30 | # used to load essential parts 31 | # to modify order of sourcing you should modify filenames in $ZHOME 32 | { 33 | for file in $ZHOME/*.plugin.zsh 34 | do 35 | source $file 36 | done 37 | unfunction loadmain 38 | } 39 | 40 | function completions () 41 | # Bahaviour of completion system 42 | # declared as a function in order to manage order of loading here in zshrc 43 | # and i don't really want to separate that from main .zshrc file 44 | { 45 | zstyle ':completion:*:matches' group 'yes' 46 | zstyle ':completion:*' group-name '' 47 | zstyle ':completion:*' completer _expand _complete _ignored _approximate 48 | zstyle ':completion:*' list-colors '' 49 | zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s 50 | zstyle ':completion:*' menu select=1 51 | zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s 52 | zstyle ':completion:*' rehash true 53 | zstyle ':completion:*' list-dirs-first true 54 | zstyle :compinstall filename "$HOME/.zshrc" 55 | autoload -Uz compinit 56 | compinit 57 | unfunction completions 58 | } 59 | 60 | ##################################################### 61 | # The main, actually running part of this rc-script # 62 | ##################################################### 63 | completions 64 | # Autumatically load essentials 65 | loadmain 66 | # Addictional-completions (from bash) 67 | loadplug zsh-bash-completions-fallback/zsh-bash-completions-fallback.plugin.zsh 68 | # Almostontop 69 | loadplug almostontop/almostontop.plugin.zsh 70 | # Zsh-syntax-highlight 71 | loadplug zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 72 | # Auto-notify 73 | loadplug zsh-auto-notify/auto-notify.plugin.zsh 74 | # Fishlike search 75 | loadplug substring-search/zsh-history-substring-search.plugin.zsh 76 | bindkey '^[[A' history-substring-search-up 77 | bindkey '^[[B' history-substring-search-down 78 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-syntax-highlighting/highlighters/pattern/pattern-highlighter.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | 31 | # List of keyword and color pairs. 32 | typeset -gA ZSH_HIGHLIGHT_PATTERNS 33 | 34 | # Whether the pattern highlighter should be called or not. 35 | _zsh_highlight_highlighter_pattern_predicate() 36 | { 37 | _zsh_highlight_buffer_modified 38 | } 39 | 40 | # Pattern syntax highlighting function. 41 | _zsh_highlight_highlighter_pattern_paint() 42 | { 43 | setopt localoptions extendedglob 44 | local pattern 45 | for pattern in ${(k)ZSH_HIGHLIGHT_PATTERNS}; do 46 | _zsh_highlight_pattern_highlighter_loop "$BUFFER" "$pattern" 47 | done 48 | } 49 | 50 | _zsh_highlight_pattern_highlighter_loop() 51 | { 52 | # This does *not* do its job syntactically, sorry. 53 | local buf="$1" pat="$2" 54 | local -a match mbegin mend 55 | local MATCH; integer MBEGIN MEND 56 | if [[ "$buf" == (#b)(*)(${~pat})* ]]; then 57 | region_highlight+=("$((mbegin[2] - 1)) $mend[2] $ZSH_HIGHLIGHT_PATTERNS[$pat]") 58 | "$0" "$match[1]" "$pat"; return $? 59 | fi 60 | } 61 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-syntax-highlighting/highlighters/regexp/regexp-highlighter.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2010-2016 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | 31 | # List of keyword and color pairs. 32 | typeset -gA ZSH_HIGHLIGHT_REGEXP 33 | 34 | # Whether the pattern highlighter should be called or not. 35 | _zsh_highlight_highlighter_regexp_predicate() 36 | { 37 | _zsh_highlight_buffer_modified 38 | } 39 | 40 | # Pattern syntax highlighting function. 41 | _zsh_highlight_highlighter_regexp_paint() 42 | { 43 | setopt localoptions extendedglob 44 | local pattern 45 | for pattern in ${(k)ZSH_HIGHLIGHT_REGEXP}; do 46 | _zsh_highlight_regexp_highlighter_loop "$BUFFER" "$pattern" 47 | done 48 | } 49 | 50 | _zsh_highlight_regexp_highlighter_loop() 51 | { 52 | local buf="$1" pat="$2" 53 | integer OFFSET=0 54 | local MATCH; integer MBEGIN MEND 55 | local -a match mbegin mend 56 | while true; do 57 | [[ "$buf" =~ "$pat" ]] || return; 58 | region_highlight+=("$((MBEGIN - 1 + OFFSET)) $((MEND + OFFSET)) $ZSH_HIGHLIGHT_REGEXP[$pat]") 59 | buf="$buf[$(($MEND+1)),-1]" 60 | OFFSET=$((MEND+OFFSET)); 61 | done 62 | } 63 | -------------------------------------------------------------------------------- /autoinstall: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Set variables 3 | # Source directory 4 | repodir="$( dirname -- "$0"; )" 5 | # Colors 6 | RED='\033[1;31m' 7 | NC='\033[0m' 8 | GRN='\033[0;32m' 9 | YLW='\033[0;33m' 10 | PRP='\033[1;35m' 11 | 12 | # Functions 13 | conprompt () # Confirmation prompt 14 | { 15 | if [[ $int = 1 ]] # At this point, $int variable used for separating behaviour for interactive and non-interactive setups, keep in mind that this is not the only way i'm doing such separation, because i'm a dumbo. 16 | then 17 | echo -e "${YLW}There are still some software missing\nI recommend installing ${RED}missing parts${YLW}\nBut you can continue anyway${NC}" 18 | echo -e ${PRP} 19 | read -p "Continue anyway? (y/n) " yn 20 | echo -e ${NC} 21 | case $yn in 22 | [yY] ) 23 | true ;; 24 | * ) 25 | echo -e "${RED}Exiting${NC}" 26 | exit;; 27 | esac 28 | fi 29 | } 30 | 31 | has() #checks if dependency is installed 32 | { 33 | type -p "$1" >/dev/null && dependency=$1; 34 | } 35 | 36 | # Balls parts 37 | ball.pt0 () # Not made for non-interactive setup, that's why it won't be included in balls_rollout 38 | { 39 | echo -e "${YLW}Looking for desired dependencies...${NC}" 40 | for i in {zsh,tmux,micro,gnome-terminal,neofetch} 41 | do 42 | if has "$i" 43 | then 44 | have="$have $i" 45 | else 46 | missing="$missing $i" 47 | fi 48 | done 49 | if [[ $missing < "?" ]] 50 | then 51 | true 52 | echo -e "${GRN}Looks like you have everything needed${NC}" 53 | else 54 | false 55 | echo -e "${RED}Missing parts:${NC}$missing" 56 | conprompt 57 | fi 58 | 59 | } 60 | 61 | ball.pt1 () 62 | { 63 | echo -e "${YLW}Putting balls in your jaws..." 64 | cp -r $repodir/{Documents,.config,.local,.zshrc} $HOME 65 | } 66 | 67 | ball.pt2 () 68 | { 69 | echo -e "${YLW}Updating fonts..." 70 | fc-cache -f 71 | } 72 | 73 | ball.pt3 () 74 | { 75 | echo -e "${YLW}Applying gnome-terminal settings..." 76 | dconf load /org/gnome/terminal/legacy/ < $repodir/gnome-terminal.dconf 77 | cp /usr/share/applications/*gnome*?erminal*.desktop $HOME/.local/share/applications/ 78 | sed -i 's/Actions=new-window;preferences/Actions=new-window;new-session;preferences/' $HOME/.local/share/applications/*gnome*?erminal*.desktop 79 | printf "\n[Desktop Action new-session]\nName=New Session\nExec=gnome-terminal -- tmux new\n" >> $HOME/.local/share/applications/*gnome*?erminal*.desktop 80 | } 81 | 82 | # Actual installation process 83 | balls_rollout () 84 | { 85 | for i in {1..3} 86 | do 87 | ball.pt$i 88 | done 89 | echo -e "${GRN}Everything done, enjoy 🥒" 90 | } 91 | 92 | # Message to make everything clear for user 93 | warn () 94 | { 95 | echo -e "${RED}Be aware${NC}\nRunning this script will cause irreversible changes\nIt will replace your existing configuration files\nIt's not made for everyone\nIt's made to recreate my setup as simply as possible." 96 | } 97 | 98 | # Message for help option 99 | help() 100 | { 101 | echo -e "Without options this script will run interactively\nOptions:\n${GRN}-a${NC}\tFully-automatic non-interactive setup (without warning and asking prompt)\n${GRN}-c${NC}\tWill check for desired software\n${GRN}-h${NC}\tWill show you this text" 102 | } 103 | 104 | # Interactive side 105 | interactive-balls () 106 | { 107 | int=1 108 | warn 109 | echo -e ${PRP} 110 | read -p "Can i put my balls in your jaws? (y/n) " yn 111 | echo -e ${NC} 112 | case $yn in 113 | [yY] ) 114 | ball.pt0 115 | balls_rollout;; 116 | * ) 117 | echo -e "${RED}Sadje :<${NC}";; 118 | esac 119 | } 120 | 121 | # Running part of the script 122 | # Act depending on option 123 | while getopts ":ahc" option; do 124 | case $option in 125 | a) # Non-interactive setup 126 | balls_rollout 127 | exit;; 128 | h) 129 | help 130 | exit;; 131 | c) # For dependency-checking 132 | ball.pt0 133 | exit;; 134 | \?) 135 | echo -e "${RED}Invalid option${NC}\ntry ${GRN}autoinstall -h${NC} to get list of options" 136 | exit;; 137 | 138 | esac 139 | done 140 | 141 | # This part will run when no options set 142 | interactive-balls 143 | -------------------------------------------------------------------------------- /.config/tmux/tmux.conf: -------------------------------------------------------------------------------- 1 | # Plugins autoload, load like this "run-shell path/to/plugin-file.tmux" 2 | 3 | # Default shell 4 | set -g default-shell /usr/bin/zsh 5 | 6 | # Statusbar-tweaking 7 | set -g status-position top 8 | set -g status-justify right 9 | set -g status-style bg=terminal 10 | set -g status-fg colour15 11 | set -g status-bg black 12 | set -g status-interval 1 13 | set -g status-right-length 10 14 | setw -g window-status-separator "" 15 | 16 | # Some other coloring 17 | # Colors for overview and tmux-messages/tmux-enter-the-command prompt 18 | set-window-option -g mode-style bg=colour8,fg=white 19 | set -g message-style bg=black,fg=white 20 | # Colors for items in statusbar 21 | setw -g window-status-format "#[bg=black,fg=colour8]◢#[bg=colour8,fg=white] #I #[bg=colour8,fg=white]#W #[bg=black,fg=colour8]◣" 22 | setw -g window-status-current-format "#[bg=terminal,fg=black]◤#[bg=terminal,fg=terminal,bold] #I #[bg=terminal,fg=terminal,nobold]#W #[bg=terminal,fg=black]◥" 23 | set -g status-justify left 24 | set -g status-right '#[bg=colour8,fg=terminal]#{?client_prefix, • ,}' 25 | set-option -g status-left ' ' 26 | 27 | # Set title for actual terminal-emulator 28 | set -g set-titles on 29 | set -g set-titles-string "#W" 30 | 31 | # If running inside tmux ($TMUX is set), then change the status line to red 32 | %if #{TMUX} 33 | set -g status-bg red 34 | %endif 35 | 36 | # Enable RGB colour if running in xterm(1) 37 | set-option -sa terminal-overrides ",xterm*:Tc" 38 | 39 | # Change the default $TERM to tmux-256color 40 | set -g default-terminal "tmux-256color" 41 | 42 | # Scrollback history limit 43 | set -g history-limit 5000 44 | 45 | # Set bell/ring enabled 46 | set-window-option -g visual-bell off 47 | set-window-option -g bell-action any 48 | 49 | # Don't keep windows around after they exit 50 | set -g remain-on-exit off 51 | 52 | # Count windows from 1 53 | set -g base-index 1 54 | setw -g pane-base-index 1 55 | 56 | # Automatically renumber windows when some closes 57 | set -g renumber-windows on 58 | 59 | # Pane-border-tweaking 60 | # PWD at the top 61 | set-window-option -g pane-border-status top 62 | set-window-option -g pane-border-format "#[align=left]#[fg=dim]─ #{s|$HOME|~|:pane_current_path} ─" 63 | # Pane-border colors 64 | set -g pane-active-border-style fg=terminal,bold 65 | set -g pane-border-style fg=colour8,dim,overline 66 | 67 | # Change the prefix key to Ctrl-w 68 | set -g prefix C-w 69 | unbind C-b 70 | bind C-a send-prefix 71 | 72 | # Turn the mouse on, but without copy mode dragging 73 | set -g mouse on 74 | unbind -n MouseDrag1Pane 75 | unbind -Tcopy-mode MouseDrag1Pane 76 | 77 | # Keybinds 78 | # Spawn/kill a pane or window 79 | bind c next-window 80 | bind C new-window -c "#{pane_current_path}" 81 | bind e split -hc "#{pane_current_path}" 82 | bind s split -c "#{pane_current_path}" 83 | bind q kill-pane 84 | bind x kill-window 85 | # Change current tab (window) using alt+1-9 86 | bind -n M-1 selectw -t:1 87 | bind -n M-2 selectw -t:2 88 | bind -n M-3 selectw -t:3 89 | bind -n M-4 selectw -t:4 90 | bind -n M-5 selectw -t:5 91 | bind -n M-6 selectw -t:6 92 | bind -n M-7 selectw -t:7 93 | bind -n M-8 selectw -t:8 94 | bind -n M-9 selectw -t:9 95 | # Same as previous but for tabs above 9 96 | bind F1 selectw -t:10 97 | bind F2 selectw -t:11 98 | bind F3 selectw -t:12 99 | bind F4 selectw -t:13 100 | bind F5 selectw -t:14 101 | bind F6 selectw -t:15 102 | bind F7 selectw -t:16 103 | bind F8 selectw -t:17 104 | bind F9 selectw -t:18 105 | bind F10 selectw -t:19 106 | bind F11 selectw -t:20 107 | bind F12 selectw -t:21 108 | # Enter copy-mode and scroll back 109 | bind -n S-Pageup copy-mode -u 110 | # Hide/show status-bar 111 | bind h set-option status 112 | # Overview-mode 113 | bind t choose-tree -Zs 114 | # Change focus 115 | bind w selectp -t :.+ 116 | # Search 117 | bind -n C-M-f copy-mode \; send-key ^S 118 | # Pop-up window 119 | bind p display-popup 120 | # Move panes 121 | bind S-right swap-pane -D 122 | bind S-left swap-pane -U 123 | # Scroll speed 124 | bind -T copy-mode WheelUpPane select-pane \; send-keys -X -N 2 scroll-up 125 | bind -T copy-mode WheelDownPane select-pane \; send-keys -X -N 2 scroll-down 126 | # Keys to toggle monitoring activity in a window and the synchronize-panes option 127 | bind m set monitor-activity 128 | bind y set synchronize-panes\; display 'synchronize-panes #{?synchronize-panes,on,off}' 129 | 130 | # Create a single default session - because a session is created here, tmux 131 | # should be started with "tmux attach" rather than "tmux new" 132 | new -d -s $USER -------------------------------------------------------------------------------- /gnome-terminal.dconf: -------------------------------------------------------------------------------- 1 | [/] 2 | default-show-menubar=false 3 | headerbar=@mb false 4 | new-tab-position='last' 5 | shortcuts-enabled=true 6 | theme-variant='dark' 7 | 8 | [keybindings] 9 | close-tab='disabled' 10 | close-window='disabled' 11 | find='disabled' 12 | find-clear='disabled' 13 | find-next='disabled' 14 | find-previous='disabled' 15 | full-screen='F11' 16 | move-tab-left='disabled' 17 | move-tab-right='disabled' 18 | new-tab='disabled' 19 | new-window='disabled' 20 | next-tab='disabled' 21 | prev-tab='disabled' 22 | switch-to-tab-1='disabled' 23 | switch-to-tab-10='disabled' 24 | switch-to-tab-2='disabled' 25 | switch-to-tab-3='disabled' 26 | switch-to-tab-4='disabled' 27 | switch-to-tab-5='disabled' 28 | switch-to-tab-6='disabled' 29 | switch-to-tab-7='disabled' 30 | switch-to-tab-8='disabled' 31 | switch-to-tab-9='disabled' 32 | 33 | [profiles:] 34 | default='f2719c6e-e7e7-444d-93ae-aca79be83342' 35 | list=['347bd026-4c7a-4eb1-9ece-05c7b8f405d9', 'f2719c6e-e7e7-444d-93ae-aca79be83342'] 36 | 37 | [profiles:/:347bd026-4c7a-4eb1-9ece-05c7b8f405d9] 38 | allow-bold=true 39 | audible-bell=false 40 | background-color='#FDFDF0F0EDED' 41 | background-transparency-percent=75 42 | bold-color='#1C1C1E1E2626' 43 | bold-color-same-as-fg=true 44 | bold-is-bright=true 45 | cursor-background-color='#1C1C1E1E2626' 46 | cursor-colors-set=true 47 | cursor-foreground-color='#FDFDF0F0EDED' 48 | cursor-shape='block' 49 | custom-command='tmux a' 50 | default-size-columns=132 51 | default-size-rows=29 52 | exit-action='close' 53 | font='Ubuntu Mono 11' 54 | foreground-color='#1C1C1E1E2626' 55 | login-shell=true 56 | palette=['#161616161C1C', '#DADA10103F3F', '#1E1EB9B98080', '#F6F666661E1E', '#2626BBBBD9D9', '#EEEE6464AEAE', '#1D1D89899191', '#FAFADADAD1D1', '#1A1A1C1C2323', '#F4F43E3E5C5C', '#0707DADA8C8C', '#F7F77D7D2626', '#3F3FC6C6DEDE', '#F0F07575B7B7', '#1E1EAEAEAEAE', '#FDFDF0F0EDED'] 57 | scroll-on-output=false 58 | scrollback-lines=0 59 | scrollback-unlimited=false 60 | scrollbar-policy='never' 61 | text-blink-mode='always' 62 | title='' 63 | use-custom-command=true 64 | use-system-font=false 65 | use-theme-background=false 66 | use-theme-colors=false 67 | use-theme-transparency=false 68 | use-transparent-background=false 69 | visible-name='Horizon Bright' 70 | 71 | [profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9] 72 | audible-bell=false 73 | background-color='rgb(253,246,227)' 74 | background-transparency-percent=10 75 | bold-color-same-as-fg=true 76 | bold-is-bright=true 77 | cursor-shape='block' 78 | custom-command='tmux a' 79 | default-size-columns=132 80 | default-size-rows=28 81 | font='Ubuntu Mono 11' 82 | foreground-color='rgb(101,123,131)' 83 | login-shell=true 84 | palette=['rgb(23,20,33)', 'rgb(192,28,40)', 'rgb(38,162,105)', 'rgb(162,115,76)', 'rgb(18,72,139)', 'rgb(163,71,186)', 'rgb(42,161,179)', 'rgb(208,207,204)', 'rgb(94,92,100)', 'rgb(246,97,81)', 'rgb(51,209,122)', 'rgb(233,173,12)', 'rgb(42,123,222)', 'rgb(192,97,203)', 'rgb(51,199,222)', 'rgb(255,255,255)'] 85 | scroll-on-output=false 86 | scrollback-lines=0 87 | scrollback-unlimited=false 88 | scrollbar-policy='never' 89 | text-blink-mode='always' 90 | title='' 91 | use-custom-command=true 92 | use-system-font=false 93 | use-theme-colors=true 94 | use-transparent-background=false 95 | 96 | [profiles:/:f2719c6e-e7e7-444d-93ae-aca79be83342] 97 | allow-bold=true 98 | audible-bell=true 99 | background-color='#1e1e1e1e1e1e' 100 | background-transparency-percent=2 101 | bold-color='#f7f7f6f6ecec' 102 | bold-color-same-as-fg=true 103 | bold-is-bright=true 104 | cell-width-scale=1.0 105 | cursor-background-color='#f7f7f6f6ecec' 106 | cursor-colors-set=true 107 | cursor-foreground-color='#1e1e1e1e1e1e' 108 | cursor-shape='block' 109 | custom-command='tmux a' 110 | default-size-columns=132 111 | default-size-rows=29 112 | exit-action='close' 113 | font='Ubuntu Mono 11' 114 | foreground-color='#f7f7f6f6ecec' 115 | login-shell=true 116 | palette=['#343439393535', '#cfcf3f3f6161', '#7b7bb7b75b5b', '#e9e9b3b32a2a', '#4c4c9a9ad4d4', '#a5a57f7fc4c4', '#38389a9aadad', '#fafafafaf6f6', '#59595b5b5959', '#d1d18f8fa6a6', '#76767f7f2c2c', '#787859592f2f', '#131359597979', '#606042429191', '#7676bbbbcaca', '#b2b2b5b5aeae'] 117 | scroll-on-output=false 118 | scrollback-lines=0 119 | scrollback-unlimited=false 120 | scrollbar-policy='never' 121 | text-blink-mode='always' 122 | title='' 123 | use-custom-command=true 124 | use-system-font=false 125 | use-theme-background=false 126 | use-theme-colors=false 127 | use-theme-transparency=false 128 | use-transparent-background=false 129 | visible-name='Japanesque' 130 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-auto-notify/tests/test_auto_notify_send.zunit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zunit 2 | 3 | @setup { 4 | load "../auto-notify.plugin.zsh" 5 | 6 | function notify-send { 7 | echo - "Notification Title: $1" 8 | echo - "Notification Body: $2" 9 | echo - "${@:3}" 10 | } 11 | 12 | function uname { 13 | echo - "Linux" 14 | } 15 | 16 | # Mock date function to return a frozen timestamp 17 | function date { 18 | if [[ "$1" == +"%s" ]]; then 19 | echo - "11100" 20 | else 21 | date - "$@" 22 | fi 23 | } 24 | } 25 | 26 | @test 'auto-notify-send does not send notification if tracking not set' { 27 | unset AUTO_COMMAND 28 | unset AUTO_COMMAND_FULL 29 | unset AUTO_COMMAND_START 30 | 31 | run _auto_notify_send 32 | 33 | assert $state equals 0 34 | assert "$output" is_empty 35 | } 36 | 37 | @test 'auto-notify-send does not send notification for short task' { 38 | AUTO_COMMAND="foo bar -r" 39 | AUTO_COMMAND_FULL="foo bar -r" 40 | AUTO_COMMAND_START=11099 41 | run _auto_notify_send 42 | 43 | assert $state equals 0 44 | assert "$output" is_empty 45 | } 46 | 47 | @test 'auto-notify-send does not send notification for ignored commands' { 48 | for command in $AUTO_NOTIFY_IGNORE; do 49 | AUTO_COMMAND="somealias" 50 | AUTO_COMMAND_FULL="$command" 51 | AUTO_COMMAND_START=11000 52 | run _auto_notify_send 53 | 54 | assert $state equals 0 55 | assert "$output" is_empty 56 | done 57 | } 58 | 59 | @test 'auto-notify-send does not send notification for ignored piped commands' { 60 | AUTO_COMMAND="echo hello world | less -r" 61 | AUTO_COMMAND_FULL="echo hello world | less -r" 62 | AUTO_COMMAND_START=11000 63 | run _auto_notify_send 64 | 65 | assert $state equals 0 66 | assert "$output" is_empty 67 | } 68 | 69 | @test 'auto-notify-send does not send notification for ignored commands with arguments' { 70 | for command in $AUTO_NOTIFY_IGNORE; do 71 | AUTO_COMMAND="somealias bar -r" 72 | AUTO_COMMAND_FULL="$command bar -r" 73 | AUTO_COMMAND_START=11000 74 | run _auto_notify_send 75 | 76 | assert $state equals 0 77 | assert "$output" is_empty 78 | done 79 | } 80 | 81 | @test 'auto-notify-send sends notification on Linux' { 82 | AUTO_COMMAND="f bar -r" 83 | AUTO_COMMAND_FULL="foo bar -r" 84 | AUTO_COMMAND_START=11080 85 | AUTO_NOTIFY_EXPIRE_TIME=15000 86 | run _auto_notify_send 87 | 88 | assert $state equals 0 89 | assert "$lines[1]" same_as 'Notification Title: "f bar -r" Completed' 90 | assert "$lines[2]" same_as "Notification Body: Total time: 20 seconds" 91 | assert "$lines[3]" same_as "Exit code: 0" 92 | assert "$lines[4]" same_as "--app-name=zsh --urgency=normal --expire-time=15000" 93 | } 94 | 95 | @test 'auto-notify-send sends notification on macOS' { 96 | AUTO_COMMAND="f bar -r" 97 | AUTO_COMMAND_FULL="foo bar -r" 98 | AUTO_COMMAND_START=11080 99 | 100 | function uname { 101 | echo - "Darwin" 102 | } 103 | 104 | function osascript { 105 | echo - "${@}" 106 | } 107 | 108 | run _auto_notify_send 109 | 110 | assert $state equals 0 111 | assert "$lines[1]" same_as '-e on run argv -e display notification (item 1 of argv) with title (item 2 of argv) -e end run Total time: 20 seconds' 112 | assert "$lines[2]" same_as 'Exit code: 0 "f bar -r" Completed' 113 | } 114 | 115 | @test 'auto-notify-send sends warning on unsupported platform' { 116 | AUTO_COMMAND="f bar -r" 117 | AUTO_COMMAND_FULL="foo bar -r" 118 | AUTO_COMMAND_START=11080 119 | 120 | function uname { 121 | echo - "Hal9000" 122 | } 123 | 124 | run _auto_notify_send 125 | assert $state equals 0 126 | assert "$lines[1]" same_as "Unknown platform for sending notifications: Hal9000" 127 | assert "$lines[2]" same_as "Please post an issue on gitub.com/MichaelAquilina/zsh-auto-notify/issues/" 128 | } 129 | 130 | @test 'auto-notify-send sends custom message' { 131 | AUTO_COMMAND="doom -i" 132 | AUTO_COMMAND_FULL="doom -i" 133 | AUTO_COMMAND_START=11055 134 | AUTO_NOTIFY_TITLE="%command has completed in %elapseds yo" 135 | AUTO_NOTIFY_BODY="%command exited with code %exit_code" 136 | 137 | run _auto_notify_send 138 | 139 | assert $state equals 0 140 | assert "$lines[1]" same_as 'Notification Title: doom -i has completed in 45s yo' 141 | assert "$lines[2]" same_as "Notification Body: doom -i exited with code 0" 142 | } 143 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-syntax-highlighting/highlighters/brackets/brackets-highlighter.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2010-2017 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | 31 | # Define default styles. 32 | : ${ZSH_HIGHLIGHT_STYLES[bracket-error]:=fg=red,bold} 33 | : ${ZSH_HIGHLIGHT_STYLES[bracket-level-1]:=fg=blue,bold} 34 | : ${ZSH_HIGHLIGHT_STYLES[bracket-level-2]:=fg=green,bold} 35 | : ${ZSH_HIGHLIGHT_STYLES[bracket-level-3]:=fg=magenta,bold} 36 | : ${ZSH_HIGHLIGHT_STYLES[bracket-level-4]:=fg=yellow,bold} 37 | : ${ZSH_HIGHLIGHT_STYLES[bracket-level-5]:=fg=cyan,bold} 38 | : ${ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]:=standout} 39 | 40 | # Whether the brackets highlighter should be called or not. 41 | _zsh_highlight_highlighter_brackets_predicate() 42 | { 43 | [[ $WIDGET == zle-line-finish ]] || _zsh_highlight_cursor_moved || _zsh_highlight_buffer_modified 44 | } 45 | 46 | # Brackets highlighting function. 47 | _zsh_highlight_highlighter_brackets_paint() 48 | { 49 | local char style 50 | local -i bracket_color_size=${#ZSH_HIGHLIGHT_STYLES[(I)bracket-level-*]} buflen=${#BUFFER} level=0 matchingpos pos 51 | local -A levelpos lastoflevel matching 52 | 53 | # Find all brackets and remember which one is matching 54 | for (( pos = 1; pos <= buflen; pos++ )) ; do 55 | char=$BUFFER[pos] 56 | case $char in 57 | ["([{"]) 58 | levelpos[$pos]=$((++level)) 59 | lastoflevel[$level]=$pos 60 | ;; 61 | [")]}"]) 62 | if (( level > 0 )); then 63 | matchingpos=$lastoflevel[$level] 64 | levelpos[$pos]=$((level--)) 65 | if _zsh_highlight_brackets_match $matchingpos $pos; then 66 | matching[$matchingpos]=$pos 67 | matching[$pos]=$matchingpos 68 | fi 69 | else 70 | levelpos[$pos]=-1 71 | fi 72 | ;; 73 | esac 74 | done 75 | 76 | # Now highlight all found brackets 77 | for pos in ${(k)levelpos}; do 78 | if (( $+matching[$pos] )); then 79 | if (( bracket_color_size )); then 80 | _zsh_highlight_add_highlight $((pos - 1)) $pos bracket-level-$(( (levelpos[$pos] - 1) % bracket_color_size + 1 )) 81 | fi 82 | else 83 | _zsh_highlight_add_highlight $((pos - 1)) $pos bracket-error 84 | fi 85 | done 86 | 87 | # If cursor is on a bracket, then highlight corresponding bracket, if any. 88 | if [[ $WIDGET != zle-line-finish ]]; then 89 | pos=$((CURSOR + 1)) 90 | if (( $+levelpos[$pos] )) && (( $+matching[$pos] )); then 91 | local -i otherpos=$matching[$pos] 92 | _zsh_highlight_add_highlight $((otherpos - 1)) $otherpos cursor-matchingbracket 93 | fi 94 | fi 95 | } 96 | 97 | # Helper function to differentiate type 98 | _zsh_highlight_brackets_match() 99 | { 100 | case $BUFFER[$1] in 101 | \() [[ $BUFFER[$2] == \) ]];; 102 | \[) [[ $BUFFER[$2] == \] ]];; 103 | \{) [[ $BUFFER[$2] == \} ]];; 104 | *) false;; 105 | esac 106 | } 107 | -------------------------------------------------------------------------------- /.local/share/fonts/UFL.txt: -------------------------------------------------------------------------------- 1 | ------------------------------- 2 | UBUNTU FONT LICENCE Version 1.0 3 | ------------------------------- 4 | 5 | PREAMBLE 6 | This licence allows the licensed fonts to be used, studied, modified and 7 | redistributed freely. The fonts, including any derivative works, can be 8 | bundled, embedded, and redistributed provided the terms of this licence 9 | are met. The fonts and derivatives, however, cannot be released under 10 | any other licence. The requirement for fonts to remain under this 11 | licence does not require any document created using the fonts or their 12 | derivatives to be published under this licence, as long as the primary 13 | purpose of the document is not to be a vehicle for the distribution of 14 | the fonts. 15 | 16 | DEFINITIONS 17 | "Font Software" refers to the set of files released by the Copyright 18 | Holder(s) under this licence and clearly marked as such. This may 19 | include source files, build scripts and documentation. 20 | 21 | "Original Version" refers to the collection of Font Software components 22 | as received under this licence. 23 | 24 | "Modified Version" refers to any derivative made by adding to, deleting, 25 | or substituting -- in part or in whole -- any of the components of the 26 | Original Version, by changing formats or by porting the Font Software to 27 | a new environment. 28 | 29 | "Copyright Holder(s)" refers to all individuals and companies who have a 30 | copyright ownership of the Font Software. 31 | 32 | "Substantially Changed" refers to Modified Versions which can be easily 33 | identified as dissimilar to the Font Software by users of the Font 34 | Software comparing the Original Version with the Modified Version. 35 | 36 | To "Propagate" a work means to do anything with it that, without 37 | permission, would make you directly or secondarily liable for 38 | infringement under applicable copyright law, except executing it on a 39 | computer or modifying a private copy. Propagation includes copying, 40 | distribution (with or without modification and with or without charging 41 | a redistribution fee), making available to the public, and in some 42 | countries other activities as well. 43 | 44 | PERMISSION & CONDITIONS 45 | This licence does not grant any rights under trademark law and all such 46 | rights are reserved. 47 | 48 | Permission is hereby granted, free of charge, to any person obtaining a 49 | copy of the Font Software, to propagate the Font Software, subject to 50 | the below conditions: 51 | 52 | 1) Each copy of the Font Software must contain the above copyright 53 | notice and this licence. These can be included either as stand-alone 54 | text files, human-readable headers or in the appropriate machine- 55 | readable metadata fields within text or binary files as long as those 56 | fields can be easily viewed by the user. 57 | 58 | 2) The font name complies with the following: 59 | (a) The Original Version must retain its name, unmodified. 60 | (b) Modified Versions which are Substantially Changed must be renamed to 61 | avoid use of the name of the Original Version or similar names entirely. 62 | (c) Modified Versions which are not Substantially Changed must be 63 | renamed to both (i) retain the name of the Original Version and (ii) add 64 | additional naming elements to distinguish the Modified Version from the 65 | Original Version. The name of such Modified Versions must be the name of 66 | the Original Version, with "derivative X" where X represents the name of 67 | the new work, appended to that name. 68 | 69 | 3) The name(s) of the Copyright Holder(s) and any contributor to the 70 | Font Software shall not be used to promote, endorse or advertise any 71 | Modified Version, except (i) as required by this licence, (ii) to 72 | acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with 73 | their explicit written permission. 74 | 75 | 4) The Font Software, modified or unmodified, in part or in whole, must 76 | be distributed entirely under this licence, and must not be distributed 77 | under any other licence. The requirement for fonts to remain under this 78 | licence does not affect any document created using the Font Software, 79 | except any version of the Font Software extracted from a document 80 | created using the Font Software may only be distributed under this 81 | licence. 82 | 83 | TERMINATION 84 | This licence becomes null and void if any of the above conditions are 85 | not met. 86 | 87 | DISCLAIMER 88 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 89 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 90 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 91 | COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 92 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 93 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 94 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 95 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER 96 | DEALINGS IN THE FONT SOFTWARE. 97 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-auto-notify/auto-notify.plugin.zsh: -------------------------------------------------------------------------------- 1 | export AUTO_NOTIFY_VERSION="0.8.0" 2 | 3 | # Time it takes for a notification to expire 4 | export AUTO_NOTIFY_EXPIRE_TIME=8000 5 | # Threshold in seconds for when to automatically show a notification 6 | export AUTO_NOTIFY_THRESHOLD=15 7 | # List of commands/programs to ignore sending notifications for 8 | export AUTO_NOTIFY_IGNORE=( 9 | "vi" "info" "systemctl" "vim" "nvim" "less" "more" "man" "tig" "watch" "git commit" "top" "htop" "ssh" "nano" "micro" "tmux" "showkey" "cmus" "gnome-terminal" "sensors" "powertop" "intel_gpu_top" "sleep" "yes" "echo" "sml" "SMLoadr" 10 | ) 11 | 12 | function _auto_notify_format() { 13 | local MESSAGE="$1" 14 | local command="$2" 15 | local elapsed="$3" 16 | local exit_code="$4" 17 | MESSAGE="${MESSAGE//\%command/$command}" 18 | MESSAGE="${MESSAGE//\%elapsed/$elapsed}" 19 | MESSAGE="${MESSAGE//\%exit_code/$exit_code}" 20 | printf "%s" "$MESSAGE" 21 | } 22 | 23 | function _auto_notify_message() { 24 | local command="$1" 25 | local elapsed="$2" 26 | local exit_code="$3" 27 | local platform="$(uname)" 28 | # Run using echo -e in order to make sure notify-send picks up new line 29 | local DEFAULT_TITLE="\"%command\" Completed" 30 | local DEFAULT_BODY="$(echo -e "Total time: %elapsed seconds\nExit code: %exit_code")" 31 | 32 | local title="${AUTO_NOTIFY_TITLE:-$DEFAULT_TITLE}" 33 | local text="${AUTO_NOTIFY_BODY:-$DEFAULT_BODY}" 34 | 35 | title="$(_auto_notify_format "$title" "$command" "$elapsed" "$exit_code")" 36 | body="$(_auto_notify_format "$text" "$command" "$elapsed" "$exit_code")" 37 | 38 | if [[ "$platform" == "Linux" ]]; then 39 | local urgency="normal" 40 | if [[ "$exit_code" != "0" ]]; then 41 | urgency="critical" 42 | fi 43 | notify-send "$title" "$body" --app-name=zsh "--urgency=$urgency" "--expire-time=$AUTO_NOTIFY_EXPIRE_TIME" --icon utilities-terminal 44 | elif [[ "$platform" == "Darwin" ]]; then 45 | osascript \ 46 | -e 'on run argv' \ 47 | -e 'display notification (item 1 of argv) with title (item 2 of argv)' \ 48 | -e 'end run' \ 49 | "$body" "$title" 50 | else 51 | printf "Unknown platform for sending notifications: $platform\n" 52 | printf "Please post an issue on gitub.com/MichaelAquilina/zsh-auto-notify/issues/\n" 53 | fi 54 | } 55 | 56 | function _is_auto_notify_ignored() { 57 | local command="$1" 58 | # split the command if its been piped one or more times 59 | local command_list=("${(@s/|/)command}") 60 | local target_command="${command_list[-1]}" 61 | # Remove leading whitespace 62 | target_command="$(echo "$target_command" | sed -e 's/^ *//')" 63 | 64 | # Remove sudo prefix from command if detected 65 | if [[ "$target_command" == "sudo "* ]]; then 66 | target_command="${target_command/sudo /}" 67 | fi 68 | 69 | # If AUTO_NOTIFY_WHITELIST is defined, then auto-notify will ignore 70 | # any item not defined in the white list 71 | # Otherwise - the alternative (default) approach is used where the 72 | # AUTO_NOTIFY_IGNORE blacklist is used to ignore commands 73 | 74 | if [[ -n "$AUTO_NOTIFY_WHITELIST" ]]; then 75 | for allowed in $AUTO_NOTIFY_WHITELIST; do 76 | if [[ "$target_command" == "$allowed"* ]]; then 77 | print "no" 78 | return 79 | fi 80 | done 81 | print "yes" 82 | else 83 | for ignore in $AUTO_NOTIFY_IGNORE; do 84 | if [[ "$target_command" == "$ignore"* ]]; then 85 | print "yes" 86 | return 87 | fi 88 | done 89 | print "no" 90 | fi 91 | } 92 | 93 | function _auto_notify_send() { 94 | # Immediately store the exit code before it goes away 95 | local exit_code="$?" 96 | 97 | if [[ -z "$AUTO_COMMAND" && -z "$AUTO_COMMAND_START" ]]; then 98 | return 99 | fi 100 | 101 | if [[ "$(_is_auto_notify_ignored "$AUTO_COMMAND_FULL")" == "no" ]]; then 102 | local current="$(date +"%s")" 103 | let "elapsed = current - AUTO_COMMAND_START" 104 | 105 | if [[ $elapsed -gt $AUTO_NOTIFY_THRESHOLD ]]; then 106 | _auto_notify_message "$AUTO_COMMAND" "$elapsed" "$exit_code" 107 | fi 108 | fi 109 | 110 | # Empty tracking so that notifications are not 111 | # triggered for any commands not run (e.g ctrl+C when typing) 112 | _auto_notify_reset_tracking 113 | } 114 | 115 | function _auto_notify_track() { 116 | # $1 is the string the user typed, but only when history is enabled 117 | # $2 is a single-line, size-limited version of the command that is always available 118 | # To still do something useful when history is disabled, although with reduced functionality, fall back to $2 when $1 is empty 119 | AUTO_COMMAND="${1:-$2}" 120 | AUTO_COMMAND_FULL="$3" 121 | AUTO_COMMAND_START="$(date +"%s")" 122 | } 123 | 124 | function _auto_notify_reset_tracking() { 125 | # Command start time in seconds since epoch 126 | unset AUTO_COMMAND_START 127 | # Full command that the user has executed after alias expansion 128 | unset AUTO_COMMAND_FULL 129 | # Command that the user has executed 130 | unset AUTO_COMMAND 131 | } 132 | 133 | function disable_auto_notify() { 134 | add-zsh-hook -D preexec _auto_notify_track 135 | add-zsh-hook -D precmd _auto_notify_send 136 | } 137 | 138 | function enable_auto_notify() { 139 | autoload -Uz add-zsh-hook 140 | add-zsh-hook preexec _auto_notify_track 141 | add-zsh-hook precmd _auto_notify_send 142 | } 143 | 144 | _auto_notify_reset_tracking 145 | 146 | 147 | platform="$(uname)" 148 | if [[ "$platform" == "Linux" ]] && ! type notify-send > /dev/null; then 149 | printf "'notify-send' must be installed for zsh-auto-notify to work\n" 150 | printf "Please install it with your relevant package manager\n" 151 | else 152 | enable_auto_notify 153 | fi 154 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-auto-notify/README.rst: -------------------------------------------------------------------------------- 1 | ZSH Auto-Notify 2 | =============== 3 | 4 | |CircleCI| |Version| |GPLv3| 5 | 6 | Simple zsh plugin that automatically sends out a notification when a long running task 7 | has completed. 8 | 9 | Useful for those commands you don't predict will take long to run or just plain forgot 10 | to keep track of. Leave the task running and go do something else - ``auto-notify`` will 11 | let you know when the task is done! :tada: 12 | 13 | * Usage_ 14 | * Requirements_ 15 | * Installation_ 16 | * Configuration_ 17 | * `Temporarily Disabling Notifications`_ 18 | * Contributing_ 19 | * `Running Tests`_ 20 | 21 | Usage 22 | ----- 23 | 24 | You don't need to do anything. Once it's installed, 25 | ``zsh-auto-notify`` will let you know if a long running task has completed its work via a 26 | notification in your desktop environment. 27 | 28 | .. image:: img/notification-example.png 29 | 30 | Requirements 31 | ------------ 32 | 33 | ``auto-notify`` officially supports zsh versions 5.1 onwards. 34 | 35 | It is possible the plugin might work on even older versions. 36 | However they would not have been tested as part of the CI test process. 37 | 38 | Supported desktop environments: 39 | 40 | * Linux X/Wayland (Requires ``notify-send`` to be installed) 41 | * MacOSX 42 | 43 | Installation 44 | ------------ 45 | 46 | Add one of the following to your ``.zshrc`` file depending on your 47 | package manager: 48 | 49 | ZPlug_ 50 | 51 | :: 52 | 53 | zplug "MichaelAquilina/zsh-auto-notify" 54 | 55 | Antigen_ 56 | 57 | :: 58 | 59 | antigen bundle "MichaelAquilina/zsh-auto-notify" 60 | 61 | Zgen_ 62 | 63 | :: 64 | 65 | zgen load "MichaelAquilina/zsh-auto-notify" 66 | 67 | oh-my-zsh_ 68 | 69 | Copy this repository to ``$ZSH_CUSTOM/custom/plugins``, where ``$ZSH_CUSTOM`` 70 | is the directory with custom plugins of oh-my-zsh `(read more) `_: 71 | :: 72 | 73 | git clone https://github.com/MichaelAquilina/zsh-auto-notify.git $ZSH_CUSTOM/plugins/auto-notify 74 | 75 | 76 | Then add this line to your ``.zshrc``. Make sure it is **before** the line ``source $ZSH/oh-my-zsh.sh``. 77 | 78 | :: 79 | 80 | plugins=(auto-notify $plugins) 81 | 82 | 83 | Configuration 84 | ------------- 85 | 86 | **Notification Threshold** 87 | 88 | By default, ``auto-notify`` will send notifications for tasks that take longer than 10 seconds. You 89 | can configure this value by setting the environment variable ``AUTO_NOTIFY_THRESHOLD``: 90 | 91 | :: 92 | 93 | # Set threshold to 20seconds 94 | export AUTO_NOTIFY_THRESHOLD=20 95 | 96 | **Notification Formatting** 97 | 98 | You can change the formatting of notifications by setting the values for ``AUTO_NOTIFY_TITLE`` and 99 | ``AUTO_NOTIFY_BODY``. When writing these values, the following variables will be replaced according to 100 | the data that ``auto-notify`` has detected: 101 | 102 | * ``%command`` - the command that the user executed 103 | * ``%elapsed`` - number of seconds that elapsed 104 | * ``%exit_code`` - the exit code of the command that was executed 105 | 106 | An example of how these values can be set is shown below: 107 | 108 | :: 109 | 110 | export AUTO_NOTIFY_TITLE="Hey! %command has just finished" 111 | export AUTO_NOTIFY_BODY="It completed in %elapsed seconds with exit code %exit_code" 112 | 113 | **Notification Expiration Time** 114 | 115 | You can set how long a notification sent by ``auto-notify`` will remain showing by setting the environment 116 | variable ``AUTO_NOTIFY_EXPIRE_TIME`` to a custom value in milliseconds. The default value is set to 8 seconds. 117 | NOTE: This configuration option currently only works for Linux. 118 | 119 | :: 120 | 121 | # Set notification expiry to 10 seconds 122 | export AUTO_NOTIFY_EXPIRE_TIME=10000 123 | 124 | 125 | **Ignored Commands** 126 | 127 | A number of commands do not get notifications for long running times due to their nature (e.g. ``watch`` or ``man``). 128 | The list of ignored commands is specified in the ``AUTO_NOTIFY_IGNORE`` environment variable. This can be modified 129 | or completely overwritten based on your use case. 130 | 131 | :: 132 | 133 | # Add docker to list of ignored commands 134 | AUTO_NOTIFY_IGNORE+=("docker") 135 | 136 | Make sure that you append to the array above *after* your plugin manager has been loaded in your ``zshrc``. 137 | 138 | If you wish to completely redefine what is ignored and not ignored, then just set ``AUTO_NOTIFY_IGNORE`` to 139 | a new array. 140 | 141 | :: 142 | 143 | # redefine what is ignored by auto-notify 144 | export AUTO_NOTIFY_IGNORE=("docker" "man" "sleep") 145 | 146 | **Using a Whitelist to ignore commands** 147 | 148 | If you wish to use a whitelist approach instead of the default blacklist approach used by ``AUTO_NOTIFY_IGNORE``, 149 | you can do so by defining the environment variable ``AUTO_NOTIFY_WHITELIST`` with the elements you wish to 150 | allow ``auto-notify`` to track and send notifications for. NOTE: If ``AUTO_NOTIFY_WHITELIST`` is defined, 151 | then all the values in ``AUTO_NOTIFY_IGNORE`` are not used. 152 | 153 | :: 154 | 155 | export AUTO_NOTIFY_WHITELIST=("apt-get" "docker") 156 | 157 | Temporarily Disabling Notifications 158 | ----------------------------------- 159 | 160 | You can temporarily disable auto notify by running the command ``disable_auto_notify``. 161 | 162 | When you want to re-enable notifications, run the command ``enable_auto_notify``. 163 | 164 | Contributing 165 | ------------ 166 | 167 | Pull requests and Feedback are welcome! :tada: 168 | 169 | I have tried to cater for as many use cases that I can think of. 170 | However, they are naturally tailored to to my own workflow and I could 171 | be missing many others. 172 | 173 | Because of this if there is a specific use case that does not work as 174 | you would expect or if you have any suggestions to how the plugin should 175 | behave, feel free to `open an 176 | issue `__ 177 | 178 | Running Tests 179 | ------------- 180 | 181 | Install `zunit `__. Run ``zunit`` in the root 182 | directory of the repo. 183 | 184 | :: 185 | 186 | $ zunit 187 | Launching ZUnit 188 | ZUnit: 0.8.2 189 | ZSH: zsh 5.3.1 (x86_64-suse-linux-gnu) 190 | 191 | ✔ version exported 192 | ✔ hook functions are loaded by default 193 | ✔ enable/disable auto-notify 194 | ✔ auto-notify-send does not send notification for short task 195 | ✔ auto-notify-send does not send notification for ignored commands 196 | 197 | NOTE: It is required that you use a minimum zunit version of 0.8.2 198 | 199 | .. _Zplug: https://github.com/zplug/zplug 200 | 201 | .. _Antigen: https://github.com/zsh-users/antigen 202 | 203 | .. _ZGen: https://github.com/tarjoilija/zgen 204 | 205 | .. _oh-my-zsh: https://github.com/robbyrussell/oh-my-zsh 206 | 207 | .. |GPLv3| image:: https://img.shields.io/badge/License-GPL%20v3-blue.svg 208 | :target: https://www.gnu.org/licenses/gpl-3.0 209 | 210 | .. |CircleCI| image:: https://circleci.com/gh/MichaelAquilina/zsh-auto-notify.svg?style=svg 211 | :target: https://circleci.com/gh/MichaelAquilina/zsh-auto-notify 212 | 213 | .. |Version| image:: https://badge.fury.io/gh/MichaelAquilina%2Fzsh-auto-notify.svg 214 | :target: https://badge.fury.io/gh/MichaelAquilina%2Fzsh-auto-notify 215 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-bash-completions-fallback/README.md: -------------------------------------------------------------------------------- 1 | # zsh-bash-completions-fallback 2 | 3 | This plugin is intended to use the bash completions when a zsh completion is not 4 | available. 5 | 6 | While this could be supported natively via `bashcompinit`, this doesn't 7 | actually work most of the times, as completion scripts may use syntax not 8 | supported by zsh, and so it's just better to implement this querying the bash 9 | itself, using a bash script called at completion time (based on [Brian Baffa 10 | implementation](https://brbsix.github.io/2015/11/29/accessing-tab-completion-programmatically-in-bash/) 11 | and including various fixes to support commands and completion parameters). 12 | 13 | Make sure you load this after other plugins to prevent their completions to be 14 | replaced by the (simpler) bash ones. 15 | 16 | Most of all bash completions can now work as they precisely do in bash, as per 17 | the `compopt` simulation that is added here. It may be used to control the 18 | output or avoid adding spaces or limit the results. 19 | 20 | The plugin by default works by lazy-loading the completions the first time you 21 | hit TAB to complete a command, however this can be controlled using the 22 | `$ZSH_BASH_COMPLETIONS_FALLBACK_LAZYLOAD_DISABLE` parameter, to load them all 23 | on startup. 24 | 25 | If a new bash completion has been installed in the system, you can just restart 26 | zsh or call `_bash_completions_load`, if instead you want this to be handled 27 | automatically, you can use `$ZSH_BASH_COMPLETIONS_FALLBACK_LAZYLOAD_AUTO_UPDATE` 28 | to update all the the available completions at every TAB-completion. 29 | This is disabled by default, to avoid IO operations at each completion, but it 30 | is still very fast in most of the platforms. 31 | 32 | Once loaded you can see all the completions available via bash (through this 33 | script) using: 34 | 35 | _bash_completions_fallback_list_handled_completions 36 | 37 | 38 | Requirements 39 | ------------------------------------------------------------------------------ 40 | 41 | * [ZSH](http://zsh.sourceforge.net) 4.3 or newer 42 | * [GNU Bash](https://www.gnu.org/software/bash/) 4 or newer 43 | 44 | Install 45 | ------------------------------------------------------------------------------ 46 | 47 | Using [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh): 48 | 49 | 1. Clone this repository in oh-my-zsh's plugins directory: 50 | 51 | git clone https://github.com/3v1n0/zsh-bash-completions-fallback ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-bash-completions-fallback 52 | 53 | 2. Activate the plugin in `~/.zshrc` (make sure it's set as the last one not to 54 | replace completions provided by other plugins): 55 | 56 | plugins=( [plugins...] zsh-bash-completions-fallback) 57 | 58 | 3. Source `~/.zshrc` (or restart zsh) to take changes into account 59 | 60 | source ~/.zshrc 61 | 62 | Using [Zinit](https://github.com/zdharma/zinit): 63 | 64 | - If you're using normal loading mode: 65 | 66 | # Replace `light` with `load` if you want some more debugging 67 | zinit ice depth=1 # optional, but avoids downloading the full history 68 | zinit light 3v1n0/zsh-bash-completions-fallback 69 | 70 | - If you're using turbo mode, you can avoid using the internal lazy mode: 71 | 72 | zinit wait lucid nocd depth=1 \ 73 | atinit='ZSH_BASH_COMPLETIONS_FALLBACK_LAZYLOAD_DISABLE=true' \ 74 | for 3v1n0/zsh-bash-completions-fallback 75 | 76 | - Add those to your `~/.zshrc` to keep the changes persistent 77 | 78 | Using other plugins manager: 79 | 80 | # Depending on the tool the syntax may vary but it's generally just 81 | $your_plugin_manager 3v1n0/zsh-bash-completions-fallback 82 | 83 | Manual installation: 84 | 85 | 1. Clone this repository in a folder (like ~/.zsh-bash-completions-fallback): 86 | 87 | git clone https://github.com/3v1n0/zsh-bash-completions-fallback $HOME/.zsh-bash-completions-fallback 88 | 89 | 2. Add to your `~/.zshrc`: 90 | 91 | source $HOME/.zsh-bash-completions-fallback/zsh-bash-completions-fallback.plugin.zsh 92 | 93 | 3. Source `~/.zshrc` (or restart zsh) to start using the plugin 94 | 95 | # This plugin requires compinit, so make sure that your ~/.zshrc or 96 | # your package manager loads it before, otherwise this is needed 97 | #autoload -U compinit && compinit 98 | source ~/.zshrc 99 | 100 | 4. Of course in case you want to test it temporary you just have to `source` the plugin file (`zsh-bash-completions-fallback.plugin.zsh`) 101 | 102 | Configuration 103 | ------------------------------------------------------------------------------ 104 | 105 | This script defines the following global variables. You may override their 106 | default values only after having loaded this script into your ZSH session. 107 | 108 | * `ZSH_BASH_COMPLETIONS_FALLBACK_PATH` overrides the default bash completions 109 | path that is set to `/usr/share/bash-completion` by default. 110 | 111 | * `ZSH_BASH_COMPLETIONS_FALLBACK_REPLACE_ALL` set (to any value) to allow to 112 | replace all the zsh completions, even if we already have one for the given 113 | command. 114 | 115 | * `ZSH_BASH_COMPLETIONS_FALLBACK_WHITELIST` an array of commands for which we 116 | want to enable the bash completions, this allow to filter the commands to use 117 | a bash completion for. Set it to a value such as `(gdbus zramctl)` to enable 118 | it only for the `gdbus` and `zramctl` commands. 119 | This also can be used with `$ZSH_BASH_COMPLETIONS_FALLBACK_REPLACE_ALL` to 120 | only use a subset of completions from bash only. 121 | 122 | * `ZSH_BASH_COMPLETIONS_FALLBACK_BLACKLIST` an array of commands for which we 123 | want to disable the bash completions. 124 | 125 | * `ZSH_BASH_COMPLETIONS_FALLBACK_REPLACE_LIST` an array of commands for which we 126 | want to give priority to the bash completions over the zsh ones. 127 | So, in case a zsh completion for such commands is available, we just ignore it 128 | and replace it with the bash ones. 129 | This has no effect if `$ZSH_BASH_COMPLETIONS_FALLBACK_REPLACE_ALL` is set. 130 | 131 | * `ZSH_BASH_COMPLETIONS_FALLBACK_PRELOAD_ALL` set this variable (to any value) 132 | to always preload completions even for non-available commands. We don't do it 133 | by default and if any command is added at later times, the user can manually 134 | call `_bash_completions_load` (or source this file again) 135 | 136 | * `ZSH_BASH_COMPLETIONS_FALLBACK_LAZYLOAD_DISABLE` set this variable (to any 137 | value) in order to disable the lazy loading of the completions at the fist 138 | time the tab-completion is triggered. By setting this the completions are 139 | loaded instead at startup. 140 | 141 | * `ZSH_BASH_COMPLETIONS_FALLBACK_LOAD_NATIVE_COMPLETIONS` set this variable to 142 | a value that is different from `true` not to ask the bash for all its suported 143 | completions, but only relying in the provided completion files. 144 | 145 | * `ZSH_BASH_COMPLETIONS_FALLBACK_LAZYLOAD_AUTO_UPDATE` set this variable (to any 146 | value) to automatically check for new completions and to install them at every 147 | tab-completion if the threshold from the last update set in 148 | `$ZSH_BASH_COMPLETIONS_FALLBACK_AUTO_UPDATE_THRESHOLD` has passed. 149 | This is not affected by the value of 150 | `$ZSH_BASH_COMPLETIONS_FALLBACK_LAZYLOAD_DISABLE` and it will work both in 151 | case lazy loading is enabled or not. 152 | 153 | * `ZSH_BASH_COMPLETIONS_FALLBACK_AUTO_UPDATE_THRESHOLD`: Sets a threshold (in 154 | seconds) to check if the completions have been changed in case the lazy load 155 | update is enabled. This is set by default at 300 seconds. 156 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-bash-completions-fallback/zsh-bash-completions-fallback.plugin.zsh: -------------------------------------------------------------------------------- 1 | [[ -o interactive ]] || return 0 2 | 3 | _bash_completions_getter_path=${0:A:h}/bash-completions-getter.sh 4 | 5 | function _bash_completions_fallback_completer { 6 | emulate -L zsh 7 | unsetopt nomatch badpattern 8 | local out=("${(@f)$( \ 9 | ZSH_NAME="$name" \ 10 | ZSH_BUFFER="$BUFFER" \ 11 | ZSH_CURSOR="$CURSOR" \ 12 | ZSH_WORDBREAKS="$WORDCHARS" \ 13 | ZSH_WORDS="${words[@]}" \ 14 | ZSH_CURRENT=$((CURRENT-1)) \ 15 | bash -c \ 16 | "source ${_bash_completions_getter_path}; get_completions")}"); 17 | 18 | local -a -U bopts=("${(ps: :)${(@f)out:0:1}}"); 19 | local -a -U bcompletions=("${(@f)out:1}") 20 | local -a -U compoptions=() 21 | 22 | if ((${bopts[(Ie)nospace]})); then 23 | compoptions+=(-S '') 24 | fi 25 | 26 | if ((${bopts[(Ie)nosort]})); then 27 | compoptions+=(-o 'nosort') 28 | fi 29 | 30 | local compadd_opts=("${compoptions[@]}") 31 | if [ -n "$bcompletions" ]; then 32 | compadd_opts+=(-Q) 33 | 34 | if ((${bopts[(Ie)filenames]})); then 35 | compset -P '*/' && \ 36 | bcompletions=(${bcompletions##*/}) 37 | compset -S '/*' && \ 38 | bcompletions=(${bcompletions%%/*}) 39 | compadd_opts+=(-f) 40 | fi 41 | fi 42 | 43 | if [ -z "$bcompletions" ] || 44 | ! compadd "${compadd_opts[@]}" -a bcompletions; then 45 | 46 | if ((${bopts[(Ie)default]})) || ((${bopts[(Ie)bashdefault]})); then 47 | _default "${compoptions[@]}" 48 | elif ((${bopts[(Ie)dirnames]})); then 49 | _directories "${compoptions[@]}" 50 | fi 51 | fi 52 | 53 | if ((${bopts[(Ie)plusdirs]})); then 54 | _directories "${compoptions[@]}" 55 | fi 56 | 57 | return $? 58 | } 59 | 60 | function _bash_completions_fetch_supported_commands { 61 | emulate -L zsh 62 | setopt extended_glob typeset_silent no_short_loops 63 | unsetopt nomatch 64 | 65 | local bash_completions=${ZSH_BASH_COMPLETIONS_FALLBACK_PATH:-/usr/share/bash-completion} 66 | local -a dirs=( 67 | ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions 68 | ) 69 | 70 | for dir in ${(@s/:/)${XDG_DATA_DIRS:-/usr/local/share:/usr/share}}; do 71 | dirs+=("$dir/bash-completion/completions") 72 | done 73 | 74 | dirs+=("$bash_completions/completions") 75 | 76 | for dir in "${dirs[@]}"; do 77 | for c in "$dir"/*; do 78 | [ ! -f "$c" ] && continue 79 | local command=${${${c:t}#_}%.bash}; 80 | _bash_completions_commands+=($command) 81 | done 82 | done 83 | 84 | if [ -n "${ZSH_BASH_COMPLETIONS_FALLBACK_LOAD_NATIVE_COMPLETIONS-:true}" ]; then 85 | local out=("${(u@f)$( \ 86 | bash -c \ 87 | "source ${_bash_completions_getter_path}; get_defined_completions")}"); 88 | _bash_completions_commands+=($out) 89 | fi 90 | } 91 | 92 | function _bash_completions_load { 93 | local bash_completions=${ZSH_BASH_COMPLETIONS_FALLBACK_PATH:-/usr/share/bash-completion} 94 | local reserved_words=( 95 | "do" 96 | "done" 97 | "esac" 98 | "then" 99 | "elif" 100 | "else" 101 | "fi" 102 | "for" 103 | "case" 104 | "if" 105 | "while" 106 | "function" 107 | "repeat" 108 | "time" 109 | "until" 110 | "select" 111 | "coproc" 112 | "nocorrect" 113 | "foreach" 114 | "end" 115 | "declare" 116 | "export" 117 | "float" 118 | "integer" 119 | "local" 120 | "readonly" 121 | "typeset" 122 | ) 123 | 124 | if ! [ -f /etc/bash_completion ] && 125 | ! [ -f "$bash_completions/bash_completion" ]; then 126 | return 1; 127 | fi 128 | 129 | local -a -U _bash_completions_commands=() 130 | _bash_completions_fetch_supported_commands 131 | 132 | for completion in $_bash_completions_commands; do 133 | if [ ${#ZSH_BASH_COMPLETIONS_FALLBACK_WHITELIST} -gt 0 ] && 134 | ! ((${ZSH_BASH_COMPLETIONS_FALLBACK_WHITELIST[(I)${completion}]})); then 135 | continue; 136 | fi 137 | 138 | if [ -z "$ZSH_BASH_COMPLETIONS_FALLBACK_PRELOAD_ALL" ] && 139 | ! [[ -v commands[$completion] ]] && 140 | ! [[ -v aliases[$completion] ]]; then 141 | continue; 142 | elif ((${reserved_words[(Ie)${completion}]})); then 143 | continue; 144 | fi 145 | 146 | if ((${ZSH_BASH_COMPLETIONS_FALLBACK_BLACKLIST[(Ie)${completion}]})); then 147 | continue; 148 | fi 149 | 150 | if ((${ZSH_BASH_COMPLETIONS_FALLBACK_REPLACE_LIST[(Ie)${completion}]})) || 151 | [ -n "$ZSH_BASH_COMPLETIONS_FALLBACK_REPLACE_ALL" ] || 152 | ! [[ -v _comps[$completion] ]]; then 153 | 154 | compdef _bash_completions_fallback_completer $completion 155 | fi 156 | done 157 | } 158 | 159 | function _bash_completion_get_current_tab_completer() 160 | { 161 | local current_binding=(${$(bindkey '^I')}) 162 | echo "${${current_binding[2]}:-expand-or-complete}" 163 | } 164 | 165 | typeset -g _bash_completions_loaded= 166 | integer -g _bash_completions_available=0 167 | integer -g _bash_completions_last_checked_timestamp=$EPOCHSECONDS 168 | 169 | function _bash-completion-init-and-continue() 170 | { 171 | local update_threshold=${ZSH_BASH_COMPLETIONS_FALLBACK_AUTO_UPDATE_THRESHOLD:-300} 172 | if [ -n "$ZSH_BASH_COMPLETIONS_FALLBACK_LAZYLOAD_AUTO_UPDATE" ] && 173 | [ -n "$EPOCHSECONDS" ] && 174 | [ $EPOCHSECONDS -gt \ 175 | $((_bash_completions_last_checked_timestamp + update_threshold)) ]; then 176 | local -a -U _bash_completions_commands=() 177 | _bash_completions_fetch_supported_commands 178 | 179 | if [ $_bash_completions_available -ne ${#_bash_completions_commands[@]} ]; then 180 | typeset -g _bash_completions_available=${#_bash_completions_commands[@]} 181 | typeset -g _bash_completions_loaded= 182 | fi 183 | fi 184 | 185 | if [ -n "$_bash_completions_loaded" ]; then 186 | zle $_bash_completion_previous_binding 187 | return $? 188 | fi 189 | 190 | local current_binding=$(_bash_completion_get_current_tab_completer) 191 | (( ${+functions[_bash_completions_lazy_load]} )) && \ 192 | unfunction _bash_completions_lazy_load 193 | _bash_completions_load 194 | _bash_completions_loaded=1 195 | 196 | if [[ "$current_binding" == "_bash-completion-init-and-continue" ]]; then 197 | bindkey "^I" $_bash_completion_previous_binding 198 | zle $_bash_completion_previous_binding 199 | unset _bash_completion_previous_binding 200 | unfunction _bash-completion-init-and-continue 201 | return 202 | fi 203 | 204 | zle $_bash_completion_previous_binding 205 | } 206 | 207 | function _bash_completions_lazy_load() 208 | { 209 | local default_binding=$(_bash_completion_get_current_tab_completer) 210 | typeset -g _bash_completion_previous_binding=$default_binding 211 | 212 | zle -N _bash-completion-init-and-continue 213 | bindkey "^I" _bash-completion-init-and-continue 214 | } 215 | 216 | if [ -n "$ZSH_BASH_COMPLETIONS_FALLBACK_LAZYLOAD_DISABLE" ]; then 217 | _bash_completions_load 218 | 219 | if [ -n "$ZSH_BASH_COMPLETIONS_FALLBACK_LAZYLOAD_AUTO_UPDATE" ]; then 220 | _bash_completions_lazy_load 221 | fi 222 | else 223 | _bash_completions_lazy_load 224 | fi 225 | 226 | function _bash_completions_fallback_list_handled_completions() 227 | { 228 | local -a our_completions=(); 229 | for command completion in ${(kv)_comps}; do 230 | if [ "$completion" = _bash_completions_fallback_completer ]; then 231 | our_completions+=($command) 232 | fi 233 | done 234 | 235 | printf "%-32s\n" ${(o)our_completions[@]} 236 | } 237 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-bash-completions-fallback/bash-completions-getter.sh: -------------------------------------------------------------------------------- 1 | 2 | # Copyright 2020: Marco Trevisan 3 | # Original Author: Brian Beffa 4 | # Original source: https://brbsix.github.io/2015/11/29/accessing-tab-completion-programmatically-in-bash/ 5 | # License: LGPLv3 (http://www.gnu.org/licenses/lgpl-3.0.txt) 6 | # 7 | 8 | compopt() { 9 | # TODO implement default case addition and removal 10 | [ -z "$_COMP_OPTIONS" ] && 11 | _COMP_OPTIONS=() 12 | 13 | while [ ${#@} -gt 0 ]; do 14 | case "$1" in 15 | -o|+o) 16 | local opt="${2#\'}" 17 | local opt="${opt%\'}" 18 | 19 | if [ "$1" == "-o" ]; then 20 | _COMP_OPTIONS+=("$opt") 21 | else 22 | local del=("$opt") 23 | _COMP_OPTIONS=("${_COMP_OPTIONS[@]/$del}") 24 | fi 25 | 26 | shift 2 27 | ;; 28 | esac 29 | done 30 | 31 | return 0 32 | } 33 | 34 | source_bash_completion() { 35 | local src_name='bash_completion' 36 | if [ -n "${ZSH_BASH_COMPLETIONS_FALLBACK_PATH}" ] && 37 | [ -f "${ZSH_BASH_COMPLETIONS_FALLBACK_PATH}/$src_name" ]; then 38 | source "${ZSH_BASH_COMPLETIONS_FALLBACK_PATH}/$src_name" 39 | elif [ -f "/etc/$src_name" ]; then 40 | source "/etc/$src_name" 41 | elif [[ $BASH_SOURCE == */* ]] && 42 | [ -f "${BASH_SOURCE%/*}/$src_name" ]; then 43 | source "${BASH_SOURCE%/*}/$src_name" 44 | else 45 | local -a dirs=() 46 | local OIFS=$IFS IFS=: dir 47 | local lookup_dirs=(${XDG_DATA_DIRS:-/usr/local/share:/usr/share}) 48 | IFS=$OIFS 49 | 50 | for dir in ${lookup_dirs[@]}; do 51 | if [ -f "$dir/bash-completion/$src_name" ]; then 52 | source "$dir/bash-completion/$src_name" 53 | return 0 54 | fi 55 | done 56 | fi 57 | 58 | return 1 59 | } 60 | 61 | parse_quoted_arguments() { 62 | local args="${1#\'}" 63 | args="${args%\'}" 64 | local QUOTED_ARGS=() 65 | quote="${2:-\"}" 66 | 67 | if [[ "${args:$i}" == *"${quote}"* ]]; then 68 | new_args="${args}" 69 | 70 | for ((i = 1; i < "${#args}"; i++)); do 71 | if [[ "${args:$i}" =~ [^${quote}]*${quote}([^${quote}]*)${quote} ]]; then 72 | local m="${BASH_REMATCH[1]}" 73 | QUOTED_ARGS+=("${m}") 74 | placeholder="____QUOTED_ARG_${#QUOTED_ARGS[@]}____" 75 | new_args=${new_args/"${quote}${m}${quote}"/${placeholder}} 76 | i=$((i + ${#BASH_REMATCH} - 1)) 77 | fi 78 | 79 | if [[ "${args:$i}" != *"${quote}"* ]]; then 80 | break 81 | fi 82 | done 83 | 84 | args="${new_args}" 85 | fi 86 | 87 | UNQUOTED_ARGS=($args) 88 | 89 | if [ -n "$QUOTED_ARGS" ]; then 90 | for ((i = 0; i < ${#QUOTED_ARGS[@]}; i++)); do 91 | placeholder="____QUOTED_ARG_$((i+1))____" 92 | UNQUOTED_ARGS=("${UNQUOTED_ARGS[@]/$placeholder/"${QUOTED_ARGS[$i]}"}") 93 | done 94 | fi 95 | } 96 | 97 | parse_complete_options() { 98 | unset COMPLETE_ACTION 99 | unset COMPLETE_ACTION_TYPE 100 | unset COMPLETE_SUPPORTED_COMMANDS 101 | unset COMPLETE_OPTION 102 | unset COMPLETE_WORDS 103 | 104 | COMPLETE_ACTION= 105 | COMPLETE_SUPPORTED_COMMANDS=() 106 | COMPLETE_WORDS=() 107 | COMPLETE_OPTION= 108 | 109 | while [ ${#@} -gt 0 ]; do 110 | case "$1" in 111 | -F|-C) 112 | [ -n "$COMPLETE_ACTION" ] && 113 | return 2 114 | 115 | COMPLETE_ACTION="${2}" 116 | COMPLETE_ACTION_TYPE=${1#-} 117 | shift 2 118 | ;; 119 | -pr|-D|-E|-A|-G|-F|-C|-P|-S) 120 | shift 2 121 | ;; 122 | -o) 123 | COMPLETE_OPTION="${2}" 124 | shift 2 125 | ;; 126 | -W) 127 | parse_quoted_arguments "$2" 128 | COMPLETE_WORDS=("${UNQUOTED_ARGS[@]}") 129 | shift 2 130 | ;; 131 | -X) 132 | # TODO, but to support this we also need to handle compopt and -o 133 | shift 2 134 | ;; 135 | -*) 136 | shift 137 | ;; 138 | *) 139 | break 140 | ;; 141 | esac 142 | done 143 | 144 | [ -z "$COMPLETE_ACTION" ] && [ -z "$COMPLETE_WORDS" ] \ 145 | && return; 146 | 147 | while [ ${#@} -gt 0 ]; do 148 | COMPLETE_SUPPORTED_COMMANDS+=("$1") 149 | shift 150 | done 151 | } 152 | 153 | get_completions() { 154 | local COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS COMP_WORDBREAKS 155 | local completion COMPREPLY=() cmd_name 156 | 157 | _COMP_OPTIONS=() 158 | 159 | COMP_LINE=${ZSH_BUFFER} 160 | COMP_POINT=${ZSH_CURSOR:-${#COMP_LINE}} 161 | COMP_WORDBREAKS=${ZSH_WORDBREAKS} 162 | COMP_WORDS=(${ZSH_WORDS[@]}) 163 | cmd_name=${ZSH_NAME} 164 | 165 | 166 | # add '' to COMP_WORDS if the last character of the command line is a space 167 | [[ "${COMP_LINE[@]: -1}" = ' ' ]] && COMP_WORDS+=('') 168 | 169 | # index of the last word as fallback 170 | COMP_CWORD=${ZSH_CURRENT:-$(( ${#COMP_WORDS[@]} - 1 ))} 171 | 172 | # load completion 173 | source_bash_completion 174 | 175 | # load completion, in case getting from the specific command file 176 | completion_command=$(complete -p "$cmd_name" 2>/dev/null) 177 | if [ -z "$completion_command" ]; then 178 | _completion_loader "$cmd_name" 179 | completion_command=$(complete -p "$cmd_name" 2>/dev/null) 180 | fi 181 | # detect completion function or command 182 | if [[ "$completion_command" =~ \ 183 | ^complete[[:space:]]+(.+) ]]; then 184 | local args="${BASH_REMATCH[1]}"; 185 | parse_quoted_arguments "$args" "'" 186 | parse_complete_options "${UNQUOTED_ARGS[@]}" 187 | 188 | completion="$COMPLETE_ACTION" 189 | _COMP_OPTIONS+=("$COMPLETE_OPTION") 190 | else 191 | return 1; 192 | fi 193 | 194 | # ensure completion was detected 195 | if ([[ -z "$completion" ]] || [[ "$completion" == "_minimal" ]]); then 196 | if [ -n "$COMPLETE_WORDS" ]; then 197 | echo "${_COMP_OPTIONS[@]}" 198 | printf "%s\n" "${COMPLETE_WORDS[@]}" 199 | return 0 200 | fi 201 | 202 | return 1 203 | fi 204 | 205 | # execute completion function or command (exporting the needed variables) 206 | # This may fail if compopt is called, but there's no easy way to pre-fill 207 | # the bash input with some stuff, using only bashy things. 208 | local -a cmd=("$completion") 209 | cmd+=("$cmd_name") 210 | cmd+=("'${COMP_WORDS[${COMP_CWORD}]}'") 211 | 212 | if [ ${COMP_CWORD} -gt 0 ]; then 213 | cmd+=("'${COMP_WORDS[$((COMP_CWORD-1))]}'"); 214 | else 215 | cmd+=(''); 216 | fi 217 | 218 | if [ "$COMPLETE_ACTION_TYPE" == 'C' ]; then 219 | export COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS COMP_WORDBREAKS 220 | COMPREPLY=($("${cmd[@]}")) 221 | else 222 | ${cmd[@]} 223 | fi 224 | 225 | [ -n "$COMPLETE_WORDS" ] && 226 | COMPREPLY+=("${COMPLETE_WORDS[@]}") 227 | 228 | # print options, followed by completions to stdout 229 | echo "${_COMP_OPTIONS[@]}" 230 | printf "%s\n" "${COMPREPLY[@]}" 231 | } 232 | 233 | get_defined_completions() { 234 | local defined_completions=() 235 | # Redefine complete bash builtin function to catch all the defined actions 236 | # We may call `builtin complete "$@"` at the end to override the actual 237 | # function, but this doesn't seem to be needed in this case, so let's save 238 | # some cycles. 239 | function complete() { 240 | parse_complete_options "$@" 241 | defined_completions+=("${COMPLETE_SUPPORTED_COMMANDS[@]}") 242 | } 243 | 244 | source_bash_completion 245 | unset -f complete 246 | 247 | printf "%s\n" "${defined_completions[@]}" 248 | } 249 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-bash-completions-fallback/LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # Copyright (c) 2010-2016 zsh-syntax-highlighting contributors 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted 6 | # provided that the following conditions are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright notice, this list of conditions 9 | # and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright notice, this list of 11 | # conditions and the following disclaimer in the documentation and/or other materials provided 12 | # with the distribution. 13 | # * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors 14 | # may be used to endorse or promote products derived from this software without specific prior 15 | # written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------------- 26 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 27 | # vim: ft=zsh sw=2 ts=2 et 28 | # ------------------------------------------------------------------------------------------------- 29 | 30 | # First of all, ensure predictable parsing. 31 | typeset zsh_highlight__aliases="$(builtin alias -Lm '[^+]*')" 32 | # In zsh <= 5.2, `alias -L` emits aliases that begin with a plus sign ('alias -- +foo=42') 33 | # them without a '--' guard, so they don't round trip. 34 | # 35 | # Hence, we exclude them from unaliasing: 36 | builtin unalias -m '[^+]*' 37 | 38 | # Set $0 to the expected value, regardless of functionargzero. 39 | 0=${(%):-%N} 40 | if true; then 41 | # $0 is reliable 42 | typeset -g ZSH_HIGHLIGHT_VERSION=$(<"${0:A:h}"/.version) 43 | typeset -g ZSH_HIGHLIGHT_REVISION=$(<"${0:A:h}"/.revision-hash) 44 | if [[ $ZSH_HIGHLIGHT_REVISION == \$Format:* ]]; then 45 | # When running from a source tree without 'make install', $ZSH_HIGHLIGHT_REVISION 46 | # would be set to '$Format:%H$' literally. That's an invalid value, and obtaining 47 | # the valid value (via `git rev-parse HEAD`, as Makefile does) might be costly, so: 48 | ZSH_HIGHLIGHT_REVISION=HEAD 49 | fi 50 | fi 51 | 52 | # ------------------------------------------------------------------------------------------------- 53 | # Core highlighting update system 54 | # ------------------------------------------------------------------------------------------------- 55 | 56 | # Use workaround for bug in ZSH? 57 | # zsh-users/zsh@48cadf4 http://www.zsh.org/mla/workers//2017/msg00034.html 58 | autoload -Uz is-at-least 59 | if is-at-least 5.4; then 60 | typeset -g zsh_highlight__pat_static_bug=false 61 | else 62 | typeset -g zsh_highlight__pat_static_bug=true 63 | fi 64 | 65 | # Array declaring active highlighters names. 66 | typeset -ga ZSH_HIGHLIGHT_HIGHLIGHTERS 67 | 68 | # Update ZLE buffer syntax highlighting. 69 | # 70 | # Invokes each highlighter that needs updating. 71 | # This function is supposed to be called whenever the ZLE state changes. 72 | _zsh_highlight() 73 | { 74 | # Store the previous command return code to restore it whatever happens. 75 | local ret=$? 76 | 77 | # Remove all highlighting in isearch, so that only the underlining done by zsh itself remains. 78 | # For details see FAQ entry 'Why does syntax highlighting not work while searching history?'. 79 | # This disables highlighting during isearch (for reasons explained in README.md) unless zsh is new enough 80 | # and doesn't have the pattern matching bug 81 | if [[ $WIDGET == zle-isearch-update ]] && { $zsh_highlight__pat_static_bug || ! (( $+ISEARCHMATCH_ACTIVE )) }; then 82 | region_highlight=() 83 | return $ret 84 | fi 85 | 86 | # Before we 'emulate -L', save the user's options 87 | local -A zsyh_user_options 88 | if zmodload -e zsh/parameter; then 89 | zsyh_user_options=("${(@kv)options}") 90 | else 91 | local canonical_options onoff option raw_options 92 | raw_options=(${(f)"$(emulate -R zsh; set -o)"}) 93 | canonical_options=(${${${(M)raw_options:#*off}%% *}#no} ${${(M)raw_options:#*on}%% *}) 94 | for option in $canonical_options; do 95 | [[ -o $option ]] 96 | # This variable cannot be eliminated c.f. workers/42101. 97 | onoff=${${=:-off on}[2-$?]} 98 | zsyh_user_options+=($option $onoff) 99 | done 100 | fi 101 | typeset -r zsyh_user_options 102 | 103 | emulate -L zsh 104 | setopt localoptions warncreateglobal nobashrematch 105 | local REPLY # don't leak $REPLY into global scope 106 | 107 | # Do not highlight if there are more than 300 chars in the buffer. It's most 108 | # likely a pasted command or a huge list of files in that case.. 109 | [[ -n ${ZSH_HIGHLIGHT_MAXLENGTH:-} ]] && [[ $#BUFFER -gt $ZSH_HIGHLIGHT_MAXLENGTH ]] && return $ret 110 | 111 | # Do not highlight if there are pending inputs (copy/paste). 112 | [[ $PENDING -gt 0 ]] && return $ret 113 | 114 | # Reset region highlight to build it from scratch 115 | typeset -ga region_highlight 116 | region_highlight=(); 117 | 118 | { 119 | local cache_place 120 | local -a region_highlight_copy 121 | 122 | # Select which highlighters in ZSH_HIGHLIGHT_HIGHLIGHTERS need to be invoked. 123 | local highlighter; for highlighter in $ZSH_HIGHLIGHT_HIGHLIGHTERS; do 124 | 125 | # eval cache place for current highlighter and prepare it 126 | cache_place="_zsh_highlight__highlighter_${highlighter}_cache" 127 | typeset -ga ${cache_place} 128 | 129 | # If highlighter needs to be invoked 130 | if ! type "_zsh_highlight_highlighter_${highlighter}_predicate" >&/dev/null; then 131 | echo "zsh-syntax-highlighting: warning: disabling the ${(qq)highlighter} highlighter as it has not been loaded" >&2 132 | # TODO: use ${(b)} rather than ${(q)} if supported 133 | ZSH_HIGHLIGHT_HIGHLIGHTERS=( ${ZSH_HIGHLIGHT_HIGHLIGHTERS:#${highlighter}} ) 134 | elif "_zsh_highlight_highlighter_${highlighter}_predicate"; then 135 | 136 | # save a copy, and cleanup region_highlight 137 | region_highlight_copy=("${region_highlight[@]}") 138 | region_highlight=() 139 | 140 | # Execute highlighter and save result 141 | { 142 | "_zsh_highlight_highlighter_${highlighter}_paint" 143 | } always { 144 | : ${(AP)cache_place::="${region_highlight[@]}"} 145 | } 146 | 147 | # Restore saved region_highlight 148 | region_highlight=("${region_highlight_copy[@]}") 149 | 150 | fi 151 | 152 | # Use value form cache if any cached 153 | region_highlight+=("${(@P)cache_place}") 154 | 155 | done 156 | 157 | # Re-apply zle_highlight settings 158 | 159 | # region 160 | () { 161 | (( REGION_ACTIVE )) || return 162 | integer min max 163 | if (( MARK > CURSOR )) ; then 164 | min=$CURSOR max=$MARK 165 | else 166 | min=$MARK max=$CURSOR 167 | fi 168 | if (( REGION_ACTIVE == 1 )); then 169 | [[ $KEYMAP = vicmd ]] && (( max++ )) 170 | elif (( REGION_ACTIVE == 2 )); then 171 | local needle=$'\n' 172 | # CURSOR and MARK are 0 indexed between letters like region_highlight 173 | # Do not include the newline in the highlight 174 | (( min = ${BUFFER[(Ib:min:)$needle]} )) 175 | (( max = ${BUFFER[(ib:max:)$needle]} - 1 )) 176 | fi 177 | _zsh_highlight_apply_zle_highlight region standout "$min" "$max" 178 | } 179 | 180 | # yank / paste (zsh-5.1.1 and newer) 181 | (( $+YANK_ACTIVE )) && (( YANK_ACTIVE )) && _zsh_highlight_apply_zle_highlight paste standout "$YANK_START" "$YANK_END" 182 | 183 | # isearch 184 | (( $+ISEARCHMATCH_ACTIVE )) && (( ISEARCHMATCH_ACTIVE )) && _zsh_highlight_apply_zle_highlight isearch underline "$ISEARCHMATCH_START" "$ISEARCHMATCH_END" 185 | 186 | # suffix 187 | (( $+SUFFIX_ACTIVE )) && (( SUFFIX_ACTIVE )) && _zsh_highlight_apply_zle_highlight suffix bold "$SUFFIX_START" "$SUFFIX_END" 188 | 189 | 190 | return $ret 191 | 192 | 193 | } always { 194 | typeset -g _ZSH_HIGHLIGHT_PRIOR_BUFFER="$BUFFER" 195 | typeset -gi _ZSH_HIGHLIGHT_PRIOR_CURSOR=$CURSOR 196 | } 197 | } 198 | 199 | # Apply highlighting based on entries in the zle_highlight array. 200 | # This function takes four arguments: 201 | # 1. The exact entry (no patterns) in the zle_highlight array: 202 | # region, paste, isearch, or suffix 203 | # 2. The default highlighting that should be applied if the entry is unset 204 | # 3. and 4. Two integer values describing the beginning and end of the 205 | # range. The order does not matter. 206 | _zsh_highlight_apply_zle_highlight() { 207 | local entry="$1" default="$2" 208 | integer first="$3" second="$4" 209 | 210 | # read the relevant entry from zle_highlight 211 | # 212 | # ### In zsh≥5.0.8 we'd use ${(b)entry}, but we support older zsh's, so we don't 213 | # ### add (b). The only effect is on the failure mode for callers that violate 214 | # ### the precondition. 215 | local region="${zle_highlight[(r)${entry}:*]-}" 216 | 217 | if [[ -z "$region" ]]; then 218 | # entry not specified at all, use default value 219 | region=$default 220 | else 221 | # strip prefix 222 | region="${region#${entry}:}" 223 | 224 | # no highlighting when set to the empty string or to 'none' 225 | if [[ -z "$region" ]] || [[ "$region" == none ]]; then 226 | return 227 | fi 228 | fi 229 | 230 | integer start end 231 | if (( first < second )); then 232 | start=$first end=$second 233 | else 234 | start=$second end=$first 235 | fi 236 | region_highlight+=("$start $end $region") 237 | } 238 | 239 | 240 | # ------------------------------------------------------------------------------------------------- 241 | # API/utility functions for highlighters 242 | # ------------------------------------------------------------------------------------------------- 243 | 244 | # Array used by highlighters to declare user overridable styles. 245 | typeset -gA ZSH_HIGHLIGHT_STYLES 246 | 247 | # Whether the command line buffer has been modified or not. 248 | # 249 | # Returns 0 if the buffer has changed since _zsh_highlight was last called. 250 | _zsh_highlight_buffer_modified() 251 | { 252 | [[ "${_ZSH_HIGHLIGHT_PRIOR_BUFFER:-}" != "$BUFFER" ]] 253 | } 254 | 255 | # Whether the cursor has moved or not. 256 | # 257 | # Returns 0 if the cursor has moved since _zsh_highlight was last called. 258 | _zsh_highlight_cursor_moved() 259 | { 260 | [[ -n $CURSOR ]] && [[ -n ${_ZSH_HIGHLIGHT_PRIOR_CURSOR-} ]] && (($_ZSH_HIGHLIGHT_PRIOR_CURSOR != $CURSOR)) 261 | } 262 | 263 | # Add a highlight defined by ZSH_HIGHLIGHT_STYLES. 264 | # 265 | # Should be used by all highlighters aside from 'pattern' (cf. ZSH_HIGHLIGHT_PATTERN). 266 | # Overwritten in tests/test-highlighting.zsh when testing. 267 | _zsh_highlight_add_highlight() 268 | { 269 | local -i start end 270 | local highlight 271 | start=$1 272 | end=$2 273 | shift 2 274 | for highlight; do 275 | if (( $+ZSH_HIGHLIGHT_STYLES[$highlight] )); then 276 | region_highlight+=("$start $end $ZSH_HIGHLIGHT_STYLES[$highlight]") 277 | break 278 | fi 279 | done 280 | } 281 | 282 | # ------------------------------------------------------------------------------------------------- 283 | # Setup functions 284 | # ------------------------------------------------------------------------------------------------- 285 | 286 | # Helper for _zsh_highlight_bind_widgets 287 | # $1 is name of widget to call 288 | _zsh_highlight_call_widget() 289 | { 290 | builtin zle "$@" && 291 | _zsh_highlight 292 | } 293 | 294 | # Rebind all ZLE widgets to make them invoke _zsh_highlights. 295 | _zsh_highlight_bind_widgets() 296 | { 297 | setopt localoptions noksharrays 298 | typeset -F SECONDS 299 | local prefix=orig-s$SECONDS-r$RANDOM # unique each time, in case we're sourced more than once 300 | 301 | # Load ZSH module zsh/zleparameter, needed to override user defined widgets. 302 | zmodload zsh/zleparameter 2>/dev/null || { 303 | print -r -- >&2 'zsh-syntax-highlighting: failed loading zsh/zleparameter.' 304 | return 1 305 | } 306 | 307 | # Override ZLE widgets to make them invoke _zsh_highlight. 308 | local -U widgets_to_bind 309 | widgets_to_bind=(${${(k)widgets}:#(.*|run-help|which-command|beep|set-local-history|yank|yank-pop)}) 310 | 311 | # Always wrap special zle-line-finish widget. This is needed to decide if the 312 | # current line ends and special highlighting logic needs to be applied. 313 | # E.g. remove cursor imprint, don't highlight partial paths, ... 314 | widgets_to_bind+=(zle-line-finish) 315 | 316 | # Always wrap special zle-isearch-update widget to be notified of updates in isearch. 317 | # This is needed because we need to disable highlighting in that case. 318 | widgets_to_bind+=(zle-isearch-update) 319 | 320 | local cur_widget 321 | for cur_widget in $widgets_to_bind; do 322 | case ${widgets[$cur_widget]:-""} in 323 | 324 | # Already rebound event: do nothing. 325 | user:_zsh_highlight_widget_*);; 326 | 327 | # The "eval"'s are required to make $cur_widget a closure: the value of the parameter at function 328 | # definition time is used. 329 | # 330 | # We can't use ${0/_zsh_highlight_widget_} because these widgets are always invoked with 331 | # NO_function_argzero, regardless of the option's setting here. 332 | 333 | # User defined widget: override and rebind old one with prefix "orig-". 334 | user:*) zle -N $prefix-$cur_widget ${widgets[$cur_widget]#*:} 335 | eval "_zsh_highlight_widget_${(q)prefix}-${(q)cur_widget}() { _zsh_highlight_call_widget ${(q)prefix}-${(q)cur_widget} -- \"\$@\" }" 336 | zle -N $cur_widget _zsh_highlight_widget_$prefix-$cur_widget;; 337 | 338 | # Completion widget: override and rebind old one with prefix "orig-". 339 | completion:*) zle -C $prefix-$cur_widget ${${(s.:.)widgets[$cur_widget]}[2,3]} 340 | eval "_zsh_highlight_widget_${(q)prefix}-${(q)cur_widget}() { _zsh_highlight_call_widget ${(q)prefix}-${(q)cur_widget} -- \"\$@\" }" 341 | zle -N $cur_widget _zsh_highlight_widget_$prefix-$cur_widget;; 342 | 343 | # Builtin widget: override and make it call the builtin ".widget". 344 | builtin) eval "_zsh_highlight_widget_${(q)prefix}-${(q)cur_widget}() { _zsh_highlight_call_widget .${(q)cur_widget} -- \"\$@\" }" 345 | zle -N $cur_widget _zsh_highlight_widget_$prefix-$cur_widget;; 346 | 347 | # Incomplete or nonexistent widget: Bind to z-sy-h directly. 348 | *) 349 | if [[ $cur_widget == zle-* ]] && (( ! ${+widgets[$cur_widget]} )); then 350 | _zsh_highlight_widget_${cur_widget}() { :; _zsh_highlight } 351 | zle -N $cur_widget _zsh_highlight_widget_$cur_widget 352 | else 353 | # Default: unhandled case. 354 | print -r -- >&2 "zsh-syntax-highlighting: unhandled ZLE widget ${(qq)cur_widget}" 355 | print -r -- >&2 "zsh-syntax-highlighting: (This is sometimes caused by doing \`bindkey ${(q-)cur_widget}\` without creating the ${(qq)cur_widget} widget with \`zle -N\` or \`zle -C\`.)" 356 | fi 357 | esac 358 | done 359 | } 360 | 361 | # Load highlighters from directory. 362 | # 363 | # Arguments: 364 | # 1) Path to the highlighters directory. 365 | _zsh_highlight_load_highlighters() 366 | { 367 | setopt localoptions noksharrays bareglobqual 368 | 369 | # Check the directory exists. 370 | [[ -d "$1" ]] || { 371 | print -r -- >&2 "zsh-syntax-highlighting: highlighters directory ${(qq)1} not found." 372 | return 1 373 | } 374 | 375 | # Load highlighters from highlighters directory and check they define required functions. 376 | local highlighter highlighter_dir 377 | for highlighter_dir ($1/*/(/)); do 378 | highlighter="${highlighter_dir:t}" 379 | [[ -f "$highlighter_dir${highlighter}-highlighter.zsh" ]] && 380 | . "$highlighter_dir${highlighter}-highlighter.zsh" 381 | if type "_zsh_highlight_highlighter_${highlighter}_paint" &> /dev/null && 382 | type "_zsh_highlight_highlighter_${highlighter}_predicate" &> /dev/null; 383 | then 384 | # New (0.5.0) function names 385 | elif type "_zsh_highlight_${highlighter}_highlighter" &> /dev/null && 386 | type "_zsh_highlight_${highlighter}_highlighter_predicate" &> /dev/null; 387 | then 388 | # Old (0.4.x) function names 389 | if false; then 390 | # TODO: only show this warning for plugin authors/maintainers, not for end users 391 | print -r -- >&2 "zsh-syntax-highlighting: warning: ${(qq)highlighter} highlighter uses deprecated entry point names; please ask its maintainer to update it: https://github.com/zsh-users/zsh-syntax-highlighting/issues/329" 392 | fi 393 | # Make it work. 394 | eval "_zsh_highlight_highlighter_${(q)highlighter}_paint() { _zsh_highlight_${(q)highlighter}_highlighter \"\$@\" }" 395 | eval "_zsh_highlight_highlighter_${(q)highlighter}_predicate() { _zsh_highlight_${(q)highlighter}_highlighter_predicate \"\$@\" }" 396 | else 397 | print -r -- >&2 "zsh-syntax-highlighting: ${(qq)highlighter} highlighter should define both required functions '_zsh_highlight_highlighter_${highlighter}_paint' and '_zsh_highlight_highlighter_${highlighter}_predicate' in ${(qq):-"$highlighter_dir${highlighter}-highlighter.zsh"}." 398 | fi 399 | done 400 | } 401 | 402 | 403 | # ------------------------------------------------------------------------------------------------- 404 | # Setup 405 | # ------------------------------------------------------------------------------------------------- 406 | 407 | # Try binding widgets. 408 | _zsh_highlight_bind_widgets || { 409 | print -r -- >&2 'zsh-syntax-highlighting: failed binding ZLE widgets, exiting.' 410 | return 1 411 | } 412 | 413 | # Resolve highlighters directory location. 414 | _zsh_highlight_load_highlighters "${ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR:-${${0:A}:h}/highlighters}" || { 415 | print -r -- >&2 'zsh-syntax-highlighting: failed loading highlighters, exiting.' 416 | return 1 417 | } 418 | 419 | # Reset scratch variables when commandline is done. 420 | _zsh_highlight_preexec_hook() 421 | { 422 | typeset -g _ZSH_HIGHLIGHT_PRIOR_BUFFER= 423 | typeset -gi _ZSH_HIGHLIGHT_PRIOR_CURSOR= 424 | } 425 | autoload -Uz add-zsh-hook 426 | add-zsh-hook preexec _zsh_highlight_preexec_hook 2>/dev/null || { 427 | print -r -- >&2 'zsh-syntax-highlighting: failed loading add-zsh-hook.' 428 | } 429 | 430 | # Load zsh/parameter module if available 431 | zmodload zsh/parameter 2>/dev/null || true 432 | 433 | # Initialize the array of active highlighters if needed. 434 | [[ $#ZSH_HIGHLIGHT_HIGHLIGHTERS -eq 0 ]] && ZSH_HIGHLIGHT_HIGHLIGHTERS=(main) 435 | 436 | if (( $+X_ZSH_HIGHLIGHT_DIRS_BLACKLIST )); then 437 | print >&2 'zsh-syntax-highlighting: X_ZSH_HIGHLIGHT_DIRS_BLACKLIST is deprecated. Please use ZSH_HIGHLIGHT_DIRS_BLACKLIST.' 438 | ZSH_HIGHLIGHT_DIRS_BLACKLIST=($X_ZSH_HIGHLIGHT_DIRS_BLACKLIST) 439 | unset X_ZSH_HIGHLIGHT_DIRS_BLACKLIST 440 | fi 441 | 442 | # Restore the aliases we unned 443 | eval "$zsh_highlight__aliases" 444 | builtin unset zsh_highlight__aliases 445 | 446 | # Set $?. 447 | true 448 | -------------------------------------------------------------------------------- /.config/neofetch/config.conf: -------------------------------------------------------------------------------- 1 | # See this wiki page for more info: 2 | # https://github.com/dylanaraps/neofetch/wiki/Customizing-Info 3 | print_info() { 4 | # info title 5 | # info underline 6 | 7 | info "os" distro 8 | # info "Host" model 9 | # info "Kernel" kernel 10 | info "pkgs" packages 11 | info "up" uptime 12 | # info "Shell" shell 13 | # info "Resolution" resolution 14 | info "de" de 15 | # info "WM" wm 16 | # info "WM Theme" wm_theme 17 | # info "Theme" theme 18 | # info "Icons" icons 19 | info "term" term 20 | # info "Terminal Font" term_font 21 | info underline 22 | info "CPU" cpu 23 | info "GPU" gpu 24 | info "RAM" memory 25 | 26 | # info "GPU Driver" gpu_driver # Linux/macOS only 27 | # info "CPU Usage" cpu_usage 28 | # info "Disk" disk 29 | # info "Battery" battery 30 | # info "Font" font 31 | # info "Song" song 32 | # [[ "$player" ]] && prin "Music Player" "$player" 33 | # info "Local IP" local_ip 34 | # info "Public IP" public_ip 35 | # info "Users" users 36 | # info "Locale" locale # This only works on glibc systems. 37 | 38 | # info cols 39 | } 40 | 41 | # Title 42 | 43 | 44 | # Hide/Show Fully qualified domain name. 45 | # 46 | # Default: 'off' 47 | # Values: 'on', 'off' 48 | # Flag: --title_fqdn 49 | title_fqdn="off" 50 | 51 | 52 | # Kernel 53 | 54 | 55 | # Shorten the output of the kernel function. 56 | # 57 | # Default: 'on' 58 | # Values: 'on', 'off' 59 | # Flag: --kernel_shorthand 60 | # Supports: Everything except *BSDs (except PacBSD and PC-BSD) 61 | # 62 | # Example: 63 | # on: '4.8.9-1-ARCH' 64 | # off: 'Linux 4.8.9-1-ARCH' 65 | kernel_shorthand="on" 66 | 67 | 68 | # Distro 69 | 70 | 71 | # Shorten the output of the distro function 72 | # 73 | # Default: 'off' 74 | # Values: 'on', 'tiny', 'off' 75 | # Flag: --distro_shorthand 76 | # Supports: Everything except Windows and Haiku 77 | distro_shorthand="on" 78 | 79 | # Show/Hide OS Architecture. 80 | # Show 'x86_64', 'x86' and etc in 'Distro:' output. 81 | # 82 | # Default: 'on' 83 | # Values: 'on', 'off' 84 | # Flag: --os_arch 85 | # 86 | # Example: 87 | # on: 'Arch Linux x86_64' 88 | # off: 'Arch Linux' 89 | os_arch="on" 90 | 91 | 92 | # Uptime 93 | 94 | 95 | # Shorten the output of the uptime function 96 | # 97 | # Default: 'on' 98 | # Values: 'on', 'tiny', 'off' 99 | # Flag: --uptime_shorthand 100 | # 101 | # Example: 102 | # on: '2 days, 10 hours, 3 mins' 103 | # tiny: '2d 10h 3m' 104 | # off: '2 days, 10 hours, 3 minutes' 105 | uptime_shorthand="tiny" 106 | 107 | 108 | # Memory 109 | 110 | 111 | # Show memory pecentage in output. 112 | # 113 | # Default: 'off' 114 | # Values: 'on', 'off' 115 | # Flag: --memory_percent 116 | # 117 | # Example: 118 | # on: '1801MiB / 7881MiB (22%)' 119 | # off: '1801MiB / 7881MiB' 120 | memory_percent="off" 121 | 122 | # Change memory output unit. 123 | # 124 | # Default: 'mib' 125 | # Values: 'kib', 'mib', 'gib' 126 | # Flag: --memory_unit 127 | # 128 | # Example: 129 | # kib '1020928KiB / 7117824KiB' 130 | # mib '1042MiB / 6951MiB' 131 | # gib: ' 0.98GiB / 6.79GiB' 132 | memory_unit="gib" 133 | 134 | 135 | # Packages 136 | 137 | 138 | # Show/Hide Package Manager names. 139 | # 140 | # Default: 'tiny' 141 | # Values: 'on', 'tiny' 'off' 142 | # Flag: --package_managers 143 | # 144 | # Example: 145 | # on: '998 (pacman), 8 (flatpak), 4 (snap)' 146 | # tiny: '908 (pacman, flatpak, snap)' 147 | # off: '908' 148 | package_managers="off" 149 | 150 | 151 | # Shell 152 | 153 | 154 | # Show the path to $SHELL 155 | # 156 | # Default: 'off' 157 | # Values: 'on', 'off' 158 | # Flag: --shell_path 159 | # 160 | # Example: 161 | # on: '/bin/bash' 162 | # off: 'bash' 163 | shell_path="off" 164 | 165 | # Show $SHELL version 166 | # 167 | # Default: 'on' 168 | # Values: 'on', 'off' 169 | # Flag: --shell_version 170 | # 171 | # Example: 172 | # on: 'bash 4.4.5' 173 | # off: 'bash' 174 | shell_version="on" 175 | 176 | 177 | # CPU 178 | 179 | 180 | # CPU speed type 181 | # 182 | # Default: 'bios_limit' 183 | # Values: 'scaling_cur_freq', 'scaling_min_freq', 'scaling_max_freq', 'bios_limit'. 184 | # Flag: --speed_type 185 | # Supports: Linux with 'cpufreq' 186 | # NOTE: Any file in '/sys/devices/system/cpu/cpu0/cpufreq' can be used as a value. 187 | speed_type="bios_limit" 188 | 189 | # CPU speed shorthand 190 | # 191 | # Default: 'off' 192 | # Values: 'on', 'off'. 193 | # Flag: --speed_shorthand 194 | # NOTE: This flag is not supported in systems with CPU speed less than 1 GHz 195 | # 196 | # Example: 197 | # on: 'i7-6500U (4) @ 3.1GHz' 198 | # off: 'i7-6500U (4) @ 3.100GHz' 199 | speed_shorthand="on" 200 | 201 | # Enable/Disable CPU brand in output. 202 | # 203 | # Default: 'on' 204 | # Values: 'on', 'off' 205 | # Flag: --cpu_brand 206 | # 207 | # Example: 208 | # on: 'Intel i7-6500U' 209 | # off: 'i7-6500U (4)' 210 | cpu_brand="off" 211 | 212 | # CPU Speed 213 | # Hide/Show CPU speed. 214 | # 215 | # Default: 'on' 216 | # Values: 'on', 'off' 217 | # Flag: --cpu_speed 218 | # 219 | # Example: 220 | # on: 'Intel i7-6500U (4) @ 3.1GHz' 221 | # off: 'Intel i7-6500U (4)' 222 | cpu_speed="off" 223 | 224 | # CPU Cores 225 | # Display CPU cores in output 226 | # 227 | # Default: 'logical' 228 | # Values: 'logical', 'physical', 'off' 229 | # Flag: --cpu_cores 230 | # Support: 'physical' doesn't work on BSD. 231 | # 232 | # Example: 233 | # logical: 'Intel i7-6500U (4) @ 3.1GHz' (All virtual cores) 234 | # physical: 'Intel i7-6500U (2) @ 3.1GHz' (All physical cores) 235 | # off: 'Intel i7-6500U @ 3.1GHz' 236 | cpu_cores="off" 237 | 238 | # CPU Temperature 239 | # Hide/Show CPU temperature. 240 | # Note the temperature is added to the regular CPU function. 241 | # 242 | # Default: 'off' 243 | # Values: 'C', 'F', 'off' 244 | # Flag: --cpu_temp 245 | # Supports: Linux, BSD 246 | # NOTE: For FreeBSD and NetBSD-based systems, you'll need to enable 247 | # coretemp kernel module. This only supports newer Intel processors. 248 | # 249 | # Example: 250 | # C: 'Intel i7-6500U (4) @ 3.1GHz [27.2°C]' 251 | # F: 'Intel i7-6500U (4) @ 3.1GHz [82.0°F]' 252 | # off: 'Intel i7-6500U (4) @ 3.1GHz' 253 | cpu_temp="off" 254 | 255 | 256 | # GPU 257 | 258 | 259 | # Enable/Disable GPU Brand 260 | # 261 | # Default: 'on' 262 | # Values: 'on', 'off' 263 | # Flag: --gpu_brand 264 | # 265 | # Example: 266 | # on: 'AMD HD 7950' 267 | # off: 'HD 7950' 268 | gpu_brand="off" 269 | 270 | # Which GPU to display 271 | # 272 | # Default: 'all' 273 | # Values: 'all', 'dedicated', 'integrated' 274 | # Flag: --gpu_type 275 | # Supports: Linux 276 | # 277 | # Example: 278 | # all: 279 | # GPU1: AMD HD 7950 280 | # GPU2: Intel Integrated Graphics 281 | # 282 | # dedicated: 283 | # GPU1: AMD HD 7950 284 | # 285 | # integrated: 286 | # GPU1: Intel Integrated Graphics 287 | gpu_type="all" 288 | 289 | 290 | # Resolution 291 | 292 | 293 | # Display refresh rate next to each monitor 294 | # Default: 'off' 295 | # Values: 'on', 'off' 296 | # Flag: --refresh_rate 297 | # Supports: Doesn't work on Windows. 298 | # 299 | # Example: 300 | # on: '1920x1080 @ 60Hz' 301 | # off: '1920x1080' 302 | refresh_rate="off" 303 | 304 | 305 | # Gtk Theme / Icons / Font 306 | 307 | 308 | # Shorten output of GTK Theme / Icons / Font 309 | # 310 | # Default: 'off' 311 | # Values: 'on', 'off' 312 | # Flag: --gtk_shorthand 313 | # 314 | # Example: 315 | # on: 'Numix, Adwaita' 316 | # off: 'Numix [GTK2], Adwaita [GTK3]' 317 | gtk_shorthand="off" 318 | 319 | 320 | # Enable/Disable gtk2 Theme / Icons / Font 321 | # 322 | # Default: 'on' 323 | # Values: 'on', 'off' 324 | # Flag: --gtk2 325 | # 326 | # Example: 327 | # on: 'Numix [GTK2], Adwaita [GTK3]' 328 | # off: 'Adwaita [GTK3]' 329 | gtk2="on" 330 | 331 | # Enable/Disable gtk3 Theme / Icons / Font 332 | # 333 | # Default: 'on' 334 | # Values: 'on', 'off' 335 | # Flag: --gtk3 336 | # 337 | # Example: 338 | # on: 'Numix [GTK2], Adwaita [GTK3]' 339 | # off: 'Numix [GTK2]' 340 | gtk3="on" 341 | 342 | 343 | # IP Address 344 | 345 | 346 | # Website to ping for the public IP 347 | # 348 | # Default: 'http://ident.me' 349 | # Values: 'url' 350 | # Flag: --ip_host 351 | public_ip_host="http://ident.me" 352 | 353 | # Public IP timeout. 354 | # 355 | # Default: '2' 356 | # Values: 'int' 357 | # Flag: --ip_timeout 358 | public_ip_timeout=2 359 | 360 | 361 | # Desktop Environment 362 | 363 | 364 | # Show Desktop Environment version 365 | # 366 | # Default: 'on' 367 | # Values: 'on', 'off' 368 | # Flag: --de_version 369 | de_version="on" 370 | 371 | 372 | # Disk 373 | 374 | 375 | # Which disks to display. 376 | # The values can be any /dev/sdXX, mount point or directory. 377 | # NOTE: By default we only show the disk info for '/'. 378 | # 379 | # Default: '/' 380 | # Values: '/', '/dev/sdXX', '/path/to/drive'. 381 | # Flag: --disk_show 382 | # 383 | # Example: 384 | # disk_show=('/' '/dev/sdb1'): 385 | # 'Disk (/): 74G / 118G (66%)' 386 | # 'Disk (/mnt/Videos): 823G / 893G (93%)' 387 | # 388 | # disk_show=('/'): 389 | # 'Disk (/): 74G / 118G (66%)' 390 | # 391 | disk_show=('/') 392 | 393 | # Disk subtitle. 394 | # What to append to the Disk subtitle. 395 | # 396 | # Default: 'mount' 397 | # Values: 'mount', 'name', 'dir', 'none' 398 | # Flag: --disk_subtitle 399 | # 400 | # Example: 401 | # name: 'Disk (/dev/sda1): 74G / 118G (66%)' 402 | # 'Disk (/dev/sdb2): 74G / 118G (66%)' 403 | # 404 | # mount: 'Disk (/): 74G / 118G (66%)' 405 | # 'Disk (/mnt/Local Disk): 74G / 118G (66%)' 406 | # 'Disk (/mnt/Videos): 74G / 118G (66%)' 407 | # 408 | # dir: 'Disk (/): 74G / 118G (66%)' 409 | # 'Disk (Local Disk): 74G / 118G (66%)' 410 | # 'Disk (Videos): 74G / 118G (66%)' 411 | # 412 | # none: 'Disk: 74G / 118G (66%)' 413 | # 'Disk: 74G / 118G (66%)' 414 | # 'Disk: 74G / 118G (66%)' 415 | disk_subtitle="mount" 416 | 417 | # Disk percent. 418 | # Show/Hide disk percent. 419 | # 420 | # Default: 'on' 421 | # Values: 'on', 'off' 422 | # Flag: --disk_percent 423 | # 424 | # Example: 425 | # on: 'Disk (/): 74G / 118G (66%)' 426 | # off: 'Disk (/): 74G / 118G' 427 | disk_percent="on" 428 | 429 | 430 | # Song 431 | 432 | 433 | # Manually specify a music player. 434 | # 435 | # Default: 'auto' 436 | # Values: 'auto', 'player-name' 437 | # Flag: --music_player 438 | # 439 | # Available values for 'player-name': 440 | # 441 | # amarok 442 | # audacious 443 | # banshee 444 | # bluemindo 445 | # clementine 446 | # cmus 447 | # deadbeef 448 | # deepin-music 449 | # dragon 450 | # elisa 451 | # exaile 452 | # gnome-music 453 | # gmusicbrowser 454 | # gogglesmm 455 | # guayadeque 456 | # io.elementary.music 457 | # iTunes 458 | # juk 459 | # lollypop 460 | # mocp 461 | # mopidy 462 | # mpd 463 | # muine 464 | # netease-cloud-music 465 | # olivia 466 | # playerctl 467 | # pogo 468 | # pragha 469 | # qmmp 470 | # quodlibet 471 | # rhythmbox 472 | # sayonara 473 | # smplayer 474 | # spotify 475 | # strawberry 476 | # tauonmb 477 | # tomahawk 478 | # vlc 479 | # xmms2d 480 | # xnoise 481 | # yarock 482 | music_player="auto" 483 | 484 | # Format to display song information. 485 | # 486 | # Default: '%artist% - %album% - %title%' 487 | # Values: '%artist%', '%album%', '%title%' 488 | # Flag: --song_format 489 | # 490 | # Example: 491 | # default: 'Song: Jet - Get Born - Sgt Major' 492 | song_format="%artist% - %album% - %title%" 493 | 494 | # Print the Artist, Album and Title on separate lines 495 | # 496 | # Default: 'off' 497 | # Values: 'on', 'off' 498 | # Flag: --song_shorthand 499 | # 500 | # Example: 501 | # on: 'Artist: The Fratellis' 502 | # 'Album: Costello Music' 503 | # 'Song: Chelsea Dagger' 504 | # 505 | # off: 'Song: The Fratellis - Costello Music - Chelsea Dagger' 506 | song_shorthand="off" 507 | 508 | # 'mpc' arguments (specify a host, password etc). 509 | # 510 | # Default: '' 511 | # Example: mpc_args=(-h HOST -P PASSWORD) 512 | mpc_args=() 513 | 514 | 515 | # Text Colors 516 | 517 | 518 | # Text Colors 519 | # 520 | # Default: 'distro' 521 | # Values: 'distro', 'num' 'num' 'num' 'num' 'num' 'num' 522 | # Flag: --colors 523 | # 524 | # Each number represents a different part of the text in 525 | # this order: 'title', '@', 'underline', 'subtitle', 'colon', 'info' 526 | # 527 | # Example: 528 | # colors=(distro) - Text is colored based on Distro colors. 529 | # colors=(4 6 1 8 8 6) - Text is colored in the order above. 530 | colors=(3 3 3 9 1 7) 531 | 532 | 533 | # Text Options 534 | 535 | 536 | # Toggle bold text 537 | # 538 | # Default: 'on' 539 | # Values: 'on', 'off' 540 | # Flag: --bold 541 | bold="on" 542 | 543 | # Enable/Disable Underline 544 | # 545 | # Default: 'on' 546 | # Values: 'on', 'off' 547 | # Flag: --underline 548 | underline_enabled="on" 549 | 550 | # Underline character 551 | # 552 | # Default: '-' 553 | # Values: 'string' 554 | # Flag: --underline_char 555 | underline_char="" 556 | 557 | 558 | # Info Separator 559 | # Replace the default separator with the specified string. 560 | # 561 | # Default: '' 562 | # Flag: --separator 563 | # 564 | # Example: 565 | # separator="->": 'Shell-> bash' 566 | # separator=" =": 'WM = dwm' 567 | separator="\t·" 568 | 569 | # Color Blocks 570 | 571 | 572 | # Color block range 573 | # The range of colors to print. 574 | # 575 | # Default: '0', '15' 576 | # Values: 'num' 577 | # Flag: --block_range 578 | # 579 | # Example: 580 | # 581 | # Display colors 0-7 in the blocks. (8 colors) 582 | # neofetch --block_range 0 7 583 | # 584 | # Display colors 0-15 in the blocks. (16 colors) 585 | # neofetch --block_range 0 15 586 | block_range=(0 15) 587 | 588 | # Toggle color blocks 589 | # 590 | # Default: 'on' 591 | # Values: 'on', 'off' 592 | # Flag: --color_blocks 593 | color_blocks="on" 594 | 595 | # Color block width in spaces 596 | # 597 | # Default: '3' 598 | # Values: 'num' 599 | # Flag: --block_width 600 | block_width=3 601 | 602 | # Color block height in lines 603 | # 604 | # Default: '1' 605 | # Values: 'num' 606 | # Flag: --block_height 607 | block_height=1 608 | 609 | # Color Alignment 610 | # 611 | # Default: 'auto' 612 | # Values: 'auto', 'num' 613 | # Flag: --col_offset 614 | # 615 | # Number specifies how far from the left side of the terminal (in spaces) to 616 | # begin printing the columns, in case you want to e.g. center them under your 617 | # text. 618 | # Example: 619 | # col_offset="auto" - Default behavior of neofetch 620 | # col_offset=7 - Leave 7 spaces then print the colors 621 | col_offset="auto" 622 | 623 | # Progress Bars 624 | 625 | 626 | # Bar characters 627 | # 628 | # Default: '-', '=' 629 | # Values: 'string', 'string' 630 | # Flag: --bar_char 631 | # 632 | # Example: 633 | # neofetch --bar_char 'elapsed' 'total' 634 | # neofetch --bar_char '-' '=' 635 | bar_char_elapsed="-" 636 | bar_char_total="=" 637 | 638 | # Toggle Bar border 639 | # 640 | # Default: 'on' 641 | # Values: 'on', 'off' 642 | # Flag: --bar_border 643 | bar_border="on" 644 | 645 | # Progress bar length in spaces 646 | # Number of chars long to make the progress bars. 647 | # 648 | # Default: '15' 649 | # Values: 'num' 650 | # Flag: --bar_length 651 | bar_length=15 652 | 653 | # Progress bar colors 654 | # When set to distro, uses your distro's logo colors. 655 | # 656 | # Default: 'distro', 'distro' 657 | # Values: 'distro', 'num' 658 | # Flag: --bar_colors 659 | # 660 | # Example: 661 | # neofetch --bar_colors 3 4 662 | # neofetch --bar_colors distro 5 663 | bar_color_elapsed="distro" 664 | bar_color_total="distro" 665 | 666 | 667 | # Info display 668 | # Display a bar with the info. 669 | # 670 | # Default: 'off' 671 | # Values: 'bar', 'infobar', 'barinfo', 'off' 672 | # Flags: --cpu_display 673 | # --memory_display 674 | # --battery_display 675 | # --disk_display 676 | # 677 | # Example: 678 | # bar: '[---=======]' 679 | # infobar: 'info [---=======]' 680 | # barinfo: '[---=======] info' 681 | # off: 'info' 682 | cpu_display="off" 683 | memory_display="off" 684 | battery_display="off" 685 | disk_display="off" 686 | 687 | 688 | # Backend Settings 689 | 690 | 691 | # Image backend. 692 | # 693 | # Default: 'ascii' 694 | # Values: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2', 'off', 695 | # 'pot', 'termpix', 'pixterm', 'tycat', 'w3m', 'kitty' 696 | # Flag: --backend 697 | image_backend="ascii" 698 | 699 | # Image Source 700 | # 701 | # Which image or ascii file to display. 702 | # 703 | # Default: 'auto' 704 | # Values: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/' 705 | # 'command output (neofetch --ascii "$(fortune | cowsay -W 30)")' 706 | # Flag: --source 707 | # 708 | # NOTE: 'auto' will pick the best image source for whatever image backend is used. 709 | # In ascii mode, distro ascii art will be used and in an image mode, your 710 | # wallpaper will be used. 711 | image_source=$HOME/Documents/plain-text/cup-ascii 712 | 713 | 714 | # Ascii Options 715 | 716 | 717 | # Ascii distro 718 | # Which distro's ascii art to display. 719 | # 720 | # Default: 'auto' 721 | # Values: 'auto', 'distro_name' 722 | # Flag: --ascii_distro 723 | # NOTE: AIX, Alpine, Anarchy, Android, Antergos, antiX, "AOSC OS", 724 | # "AOSC OS/Retro", Apricity, ArcoLinux, ArchBox, ARCHlabs, 725 | # ArchStrike, XFerience, ArchMerge, Arch, Artix, Arya, Bedrock, 726 | # Bitrig, BlackArch, BLAG, BlankOn, BlueLight, bonsai, BSD, 727 | # BunsenLabs, Calculate, Carbs, CentOS, Chakra, ChaletOS, 728 | # Chapeau, Chrom*, Cleanjaro, ClearOS, Clear_Linux, Clover, 729 | # Condres, Container_Linux, CRUX, Cucumber, Debian, Deepin, 730 | # DesaOS, Devuan, DracOS, DarkOs, DragonFly, Drauger, Elementary, 731 | # EndeavourOS, Endless, EuroLinux, Exherbo, Fedora, Feren, FreeBSD, 732 | # FreeMiNT, Frugalware, Funtoo, GalliumOS, Garuda, Gentoo, Pentoo, 733 | # gNewSense, GNOME, GNU, GoboLinux, Grombyang, Guix, Haiku, Huayra, 734 | # Hyperbola, janus, Kali, KaOS, KDE_neon, Kibojoe, Kogaion, 735 | # Korora, KSLinux, Kubuntu, LEDE, LFS, Linux_Lite, 736 | # LMDE, Lubuntu, Lunar, macos, Mageia, MagpieOS, Mandriva, 737 | # Manjaro, Maui, Mer, Minix, LinuxMint, MX_Linux, Namib, 738 | # Neptune, NetBSD, Netrunner, Nitrux, NixOS, Nurunner, 739 | # NuTyX, OBRevenge, OpenBSD, openEuler, OpenIndiana, openmamba, 740 | # OpenMandriva, OpenStage, OpenWrt, osmc, Oracle, OS Elbrus, PacBSD, 741 | # Parabola, Pardus, Parrot, Parsix, TrueOS, PCLinuxOS, Peppermint, 742 | # popos, Porteus, PostMarketOS, Proxmox, Puppy, PureOS, Qubes, Radix, 743 | # Raspbian, Reborn_OS, Redstar, Redcore, Redhat, Refracted_Devuan, 744 | # Regata, Rosa, sabotage, Sabayon, Sailfish, SalentOS, Scientific, 745 | # Septor, SereneLinux, SharkLinux, Siduction, Slackware, SliTaz, 746 | # SmartOS, Solus, Source_Mage, Sparky, Star, SteamOS, SunOS, 747 | # openSUSE_Leap, openSUSE_Tumbleweed, openSUSE, SwagArch, Tails, 748 | # Trisquel, Ubuntu-Budgie, Ubuntu-GNOME, Ubuntu-MATE, Ubuntu-Studio, 749 | # Ubuntu, Venom, Void, Obarun, windows10, Windows7, Xubuntu, Zorin, 750 | # and IRIX have ascii logos 751 | # NOTE: Arch, Ubuntu, Redhat, and Dragonfly have 'old' logo variants. 752 | # Use '{distro name}_old' to use the old logos. 753 | # NOTE: Ubuntu has flavor variants. 754 | # Change this to Lubuntu, Kubuntu, Xubuntu, Ubuntu-GNOME, 755 | # Ubuntu-Studio, Ubuntu-Mate or Ubuntu-Budgie to use the flavors. 756 | # NOTE: Arcolinux, Dragonfly, Fedora, Alpine, Arch, Ubuntu, 757 | # CRUX, Debian, Gentoo, FreeBSD, Mac, NixOS, OpenBSD, android, 758 | # Antrix, CentOS, Cleanjaro, ElementaryOS, GUIX, Hyperbola, 759 | # Manjaro, MXLinux, NetBSD, Parabola, POP_OS, PureOS, 760 | # Slackware, SunOS, LinuxLite, OpenSUSE, Raspbian, 761 | # postmarketOS, and Void have a smaller logo variant. 762 | # Use '{distro name}_small' to use the small variants. 763 | ascii_distro="alt" 764 | 765 | # Ascii Colors 766 | # 767 | # Default: 'distro' 768 | # Values: 'distro', 'num' 'num' 'num' 'num' 'num' 'num' 769 | # Flag: --ascii_colors 770 | # 771 | # Example: 772 | # ascii_colors=(distro) - Ascii is colored based on Distro colors. 773 | # ascii_colors=(4 6 1 8 8 6) - Ascii is colored using these colors. 774 | ascii_colors=(distro) 775 | 776 | # Bold ascii logo 777 | # Whether or not to bold the ascii logo. 778 | # 779 | # Default: 'on' 780 | # Values: 'on', 'off' 781 | # Flag: --ascii_bold 782 | ascii_bold="on" 783 | 784 | 785 | # Image Options 786 | 787 | 788 | # Image loop 789 | # Setting this to on will make neofetch redraw the image constantly until 790 | # Ctrl+C is pressed. This fixes display issues in some terminal emulators. 791 | # 792 | # Default: 'off' 793 | # Values: 'on', 'off' 794 | # Flag: --loop 795 | image_loop="off" 796 | 797 | # Thumbnail directory 798 | # 799 | # Default: '~/.cache/thumbnails/neofetch' 800 | # Values: 'dir' 801 | thumbnail_dir="${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch" 802 | 803 | # Crop mode 804 | # 805 | # Default: 'normal' 806 | # Values: 'normal', 'fit', 'fill' 807 | # Flag: --crop_mode 808 | # 809 | # See this wiki page to learn about the fit and fill options. 810 | # https://github.com/dylanaraps/neofetch/wiki/What-is-Waifu-Crop%3F 811 | crop_mode="normal" 812 | 813 | # Crop offset 814 | # Note: Only affects 'normal' crop mode. 815 | # 816 | # Default: 'center' 817 | # Values: 'northwest', 'north', 'northeast', 'west', 'center' 818 | # 'east', 'southwest', 'south', 'southeast' 819 | # Flag: --crop_offset 820 | crop_offset="center" 821 | 822 | # Image size 823 | # The image is half the terminal width by default. 824 | # 825 | # Default: 'auto' 826 | # Values: 'auto', '00px', '00%', 'none' 827 | # Flags: --image_size 828 | # --size 829 | image_size="auto" 830 | 831 | # Gap between image and text 832 | # 833 | # Default: '3' 834 | # Values: 'num', '-num' 835 | # Flag: --gap 836 | gap=6 837 | 838 | # Image offsets 839 | # Only works with the w3m backend. 840 | # 841 | # Default: '0' 842 | # Values: 'px' 843 | # Flags: --xoffset 844 | # --yoffset 845 | yoffset=0 846 | xoffset=0 847 | 848 | # Image background color 849 | # Only works with the w3m backend. 850 | # 851 | # Default: '' 852 | # Values: 'color', 'blue' 853 | # Flag: --bg_color 854 | background_color= 855 | 856 | 857 | # Misc Options 858 | 859 | # Stdout mode 860 | # Turn off all colors and disables image backend (ASCII/Image). 861 | # Useful for piping into another command. 862 | # Default: 'off' 863 | # Values: 'on', 'off' 864 | stdout="off" -------------------------------------------------------------------------------- /.local/share/zsh/substring-search/zsh-history-substring-search.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | ############################################################################## 3 | # 4 | # Copyright (c) 2009 Peter Stephenson 5 | # Copyright (c) 2011 Guido van Steen 6 | # Copyright (c) 2011 Suraj N. Kurapati 7 | # Copyright (c) 2011 Sorin Ionescu 8 | # Copyright (c) 2011 Vincent Guerci 9 | # Copyright (c) 2016 Geza Lore 10 | # Copyright (c) 2017 Bengt Brodersen 11 | # All rights reserved. 12 | # 13 | # Redistribution and use in source and binary forms, with or without 14 | # modification, are permitted provided that the following conditions are met: 15 | # 16 | # * Redistributions of source code must retain the above copyright 17 | # notice, this list of conditions and the following disclaimer. 18 | # 19 | # * Redistributions in binary form must reproduce the above 20 | # copyright notice, this list of conditions and the following 21 | # disclaimer in the documentation and/or other materials provided 22 | # with the distribution. 23 | # 24 | # * Neither the name of the FIZSH nor the names of its contributors 25 | # may be used to endorse or promote products derived from this 26 | # software without specific prior written permission. 27 | # 28 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 29 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 32 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 33 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 34 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 35 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 36 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 37 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | # POSSIBILITY OF SUCH DAMAGE. 39 | # 40 | ############################################################################## 41 | 42 | #----------------------------------------------------------------------------- 43 | # declare global configuration variables 44 | #----------------------------------------------------------------------------- 45 | 46 | : ${HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=black,fg=green'} 47 | : ${HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=black,fg=red'} 48 | : ${HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'} 49 | : ${HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=''} 50 | : ${HISTORY_SUBSTRING_SEARCH_FUZZY=''} 51 | : ${HISTORY_SUBSTRING_SEARCH_PREFIXED=''} 52 | 53 | #----------------------------------------------------------------------------- 54 | # declare internal global variables 55 | #----------------------------------------------------------------------------- 56 | 57 | typeset -g BUFFER MATCH MBEGIN MEND CURSOR 58 | typeset -g _history_substring_search_refresh_display 59 | typeset -g _history_substring_search_query_highlight 60 | typeset -g _history_substring_search_result 61 | typeset -g _history_substring_search_query 62 | typeset -g -a _history_substring_search_query_parts 63 | typeset -g -a _history_substring_search_raw_matches 64 | typeset -g -i _history_substring_search_raw_match_index 65 | typeset -g -a _history_substring_search_matches 66 | typeset -g -i _history_substring_search_match_index 67 | typeset -g -A _history_substring_search_unique_filter 68 | 69 | #----------------------------------------------------------------------------- 70 | # the main ZLE widgets 71 | #----------------------------------------------------------------------------- 72 | 73 | history-substring-search-up() { 74 | _history-substring-search-begin 75 | 76 | _history-substring-search-up-history || 77 | _history-substring-search-up-buffer || 78 | _history-substring-search-up-search 79 | 80 | _history-substring-search-end 81 | } 82 | 83 | history-substring-search-down() { 84 | _history-substring-search-begin 85 | 86 | _history-substring-search-down-history || 87 | _history-substring-search-down-buffer || 88 | _history-substring-search-down-search 89 | 90 | _history-substring-search-end 91 | } 92 | 93 | zle -N history-substring-search-up 94 | zle -N history-substring-search-down 95 | 96 | #----------------------------------------------------------------------------- 97 | # implementation details 98 | #----------------------------------------------------------------------------- 99 | 100 | zmodload -F zsh/parameter 101 | 102 | # 103 | # We have to "override" some keys and widgets if the 104 | # zsh-syntax-highlighting plugin has not been loaded: 105 | # 106 | # https://github.com/nicoulaj/zsh-syntax-highlighting 107 | # 108 | if [[ $+functions[_zsh_highlight] -eq 0 ]]; then 109 | # 110 | # Dummy implementation of _zsh_highlight() that 111 | # simply removes any existing highlights when the 112 | # user inserts printable characters into $BUFFER. 113 | # 114 | _zsh_highlight() { 115 | if [[ $KEYS == [[:print:]] ]]; then 116 | region_highlight=() 117 | fi 118 | } 119 | 120 | # 121 | # The following snippet was taken from the zsh-syntax-highlighting project: 122 | # 123 | # https://github.com/zsh-users/zsh-syntax-highlighting/blob/56b134f5d62ae3d4e66c7f52bd0cc2595f9b305b/zsh-syntax-highlighting.zsh#L126-161 124 | # 125 | # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors 126 | # All rights reserved. 127 | # 128 | # Redistribution and use in source and binary forms, with or without 129 | # modification, are permitted provided that the following conditions are 130 | # met: 131 | # 132 | # * Redistributions of source code must retain the above copyright 133 | # notice, this list of conditions and the following disclaimer. 134 | # 135 | # * Redistributions in binary form must reproduce the above copyright 136 | # notice, this list of conditions and the following disclaimer in the 137 | # documentation and/or other materials provided with the distribution. 138 | # 139 | # * Neither the name of the zsh-syntax-highlighting contributors nor the 140 | # names of its contributors may be used to endorse or promote products 141 | # derived from this software without specific prior written permission. 142 | # 143 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 144 | # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 145 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 146 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 147 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 148 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 149 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 150 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 151 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 152 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 153 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 154 | # 155 | #--------------8<-------------------8<-------------------8<----------------- 156 | # Rebind all ZLE widgets to make them invoke _zsh_highlights. 157 | _zsh_highlight_bind_widgets() 158 | { 159 | # Load ZSH module zsh/zleparameter, needed to override user defined widgets. 160 | zmodload zsh/zleparameter 2>/dev/null || { 161 | echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter.' >&2 162 | return 1 163 | } 164 | 165 | # Override ZLE widgets to make them invoke _zsh_highlight. 166 | local cur_widget 167 | for cur_widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|run-help|which-command|beep|yank*)}; do 168 | case $widgets[$cur_widget] in 169 | 170 | # Already rebound event: do nothing. 171 | user:$cur_widget|user:_zsh_highlight_widget_*);; 172 | 173 | # User defined widget: override and rebind old one with prefix "orig-". 174 | user:*) eval "zle -N orig-$cur_widget ${widgets[$cur_widget]#*:}; \ 175 | _zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget -- \"\$@\" && _zsh_highlight }; \ 176 | zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; 177 | 178 | # Completion widget: override and rebind old one with prefix "orig-". 179 | completion:*) eval "zle -C orig-$cur_widget ${${widgets[$cur_widget]#*:}/:/ }; \ 180 | _zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget -- \"\$@\" && _zsh_highlight }; \ 181 | zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; 182 | 183 | # Builtin widget: override and make it call the builtin ".widget". 184 | builtin) eval "_zsh_highlight_widget_$cur_widget() { builtin zle .$cur_widget -- \"\$@\" && _zsh_highlight }; \ 185 | zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; 186 | 187 | # Default: unhandled case. 188 | *) echo "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;; 189 | esac 190 | done 191 | } 192 | #-------------->8------------------->8------------------->8----------------- 193 | 194 | _zsh_highlight_bind_widgets 195 | fi 196 | 197 | _history-substring-search-begin() { 198 | setopt localoptions extendedglob 199 | 200 | _history_substring_search_refresh_display= 201 | _history_substring_search_query_highlight= 202 | 203 | # 204 | # If the buffer is the same as the previously displayed history substring 205 | # search result, then just keep stepping through the match list. Otherwise 206 | # start a new search. 207 | # 208 | if [[ -n $BUFFER && $BUFFER == ${_history_substring_search_result:-} ]]; then 209 | return; 210 | fi 211 | 212 | # 213 | # Clear the previous result. 214 | # 215 | _history_substring_search_result='' 216 | 217 | if [[ -z $BUFFER ]]; then 218 | # 219 | # If the buffer is empty, we will just act like up-history/down-history 220 | # in ZSH, so we do not need to actually search the history. This should 221 | # speed things up a little. 222 | # 223 | _history_substring_search_query= 224 | _history_substring_search_query_parts=() 225 | _history_substring_search_raw_matches=() 226 | 227 | else 228 | # 229 | # For the purpose of highlighting we keep a copy of the original 230 | # query string. 231 | # 232 | _history_substring_search_query=$BUFFER 233 | 234 | # 235 | # compose search pattern 236 | # 237 | if [[ -n $HISTORY_SUBSTRING_SEARCH_FUZZY ]]; then 238 | # 239 | # `=` split string in arguments 240 | # 241 | _history_substring_search_query_parts=(${=_history_substring_search_query}) 242 | else 243 | _history_substring_search_query_parts=(${==_history_substring_search_query}) 244 | fi 245 | 246 | # 247 | # Escape and join query parts with wildcard character '*' as seperator 248 | # `(j:CHAR:)` join array to string with CHAR as seperator 249 | # 250 | local search_pattern="${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*" 251 | 252 | # 253 | # Support anchoring history search to the beginning of the command 254 | # 255 | if [[ -z $HISTORY_SUBSTRING_SEARCH_PREFIXED ]]; then 256 | search_pattern="*${search_pattern}" 257 | fi 258 | 259 | # 260 | # Find all occurrences of the search pattern in the history file. 261 | # 262 | # (k) returns the "keys" (history index numbers) instead of the values 263 | # (R) returns values in reverse older, so the index of the youngest 264 | # matching history entry is at the head of the list. 265 | # 266 | _history_substring_search_raw_matches=(${(k)history[(R)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)${search_pattern}]}) 267 | fi 268 | 269 | # 270 | # In order to stay as responsive as possible, we will process the raw 271 | # matches lazily (when the user requests the next match) to choose items 272 | # that need to be displayed to the user. 273 | # _history_substring_search_raw_match_index holds the index of the last 274 | # unprocessed entry in _history_substring_search_raw_matches. Any items 275 | # that need to be displayed will be added to 276 | # _history_substring_search_matches. 277 | # 278 | # We use an associative array (_history_substring_search_unique_filter) as 279 | # a 'set' data structure to ensure uniqueness of the results if desired. 280 | # If an entry (key) is in the set (non-empty value), then we have already 281 | # added that entry to _history_substring_search_matches. 282 | # 283 | _history_substring_search_raw_match_index=0 284 | _history_substring_search_matches=() 285 | _history_substring_search_unique_filter=() 286 | 287 | # 288 | # If $_history_substring_search_match_index is equal to 289 | # $#_history_substring_search_matches + 1, this indicates that we 290 | # are beyond the end of $_history_substring_search_matches and that we 291 | # have also processed all entries in 292 | # _history_substring_search_raw_matches. 293 | # 294 | # If $#_history_substring_search_match_index is equal to 0, this indicates 295 | # that we are beyond the beginning of $_history_substring_search_matches. 296 | # 297 | # If we have initially pressed "up" we have to initialize 298 | # $_history_substring_search_match_index to 0 so that it will be 299 | # incremented to 1. 300 | # 301 | # If we have initially pressed "down" we have to initialize 302 | # $_history_substring_search_match_index to 1 so that it will be 303 | # decremented to 0. 304 | # 305 | if [[ $WIDGET == history-substring-search-down ]]; then 306 | _history_substring_search_match_index=1 307 | else 308 | _history_substring_search_match_index=0 309 | fi 310 | } 311 | 312 | _history-substring-search-end() { 313 | setopt localoptions extendedglob 314 | 315 | _history_substring_search_result=$BUFFER 316 | 317 | # the search was successful so display the result properly by clearing away 318 | # existing highlights and moving the cursor to the end of the result buffer 319 | if [[ $_history_substring_search_refresh_display -eq 1 ]]; then 320 | region_highlight=() 321 | CURSOR=${#BUFFER} 322 | fi 323 | 324 | # highlight command line using zsh-syntax-highlighting 325 | _zsh_highlight 326 | 327 | # highlight the search query inside the command line 328 | if [[ -n $_history_substring_search_query_highlight ]]; then 329 | # highlight first matching query parts 330 | local highlight_start_index=0 331 | local highlight_end_index=0 332 | local query_part 333 | for query_part in $_history_substring_search_query_parts; do 334 | local escaped_query_part=${query_part//(#m)[\][()|\\*?#<>~^]/\\$MATCH} 335 | # (i) get index of pattern 336 | local query_part_match_index="${${BUFFER:$highlight_start_index}[(i)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)${escaped_query_part}]}" 337 | if [[ $query_part_match_index -le ${#BUFFER:$highlight_start_index} ]]; then 338 | highlight_start_index=$(( $highlight_start_index + $query_part_match_index )) 339 | highlight_end_index=$(( $highlight_start_index + ${#query_part} )) 340 | region_highlight+=("$(($highlight_start_index - 1)) $(($highlight_end_index - 1)) $_history_substring_search_query_highlight") 341 | fi 342 | done 343 | fi 344 | 345 | # For debugging purposes: 346 | # zle -R "mn: "$_history_substring_search_match_index" m#: "${#_history_substring_search_matches} 347 | # read -k -t 200 && zle -U $REPLY 348 | 349 | # Exit successfully from the history-substring-search-* widgets. 350 | return 0 351 | } 352 | 353 | _history-substring-search-up-buffer() { 354 | # 355 | # Check if the UP arrow was pressed to move the cursor within a multi-line 356 | # buffer. This amounts to three tests: 357 | # 358 | # 1. $#buflines -gt 1. 359 | # 360 | # 2. $CURSOR -ne $#BUFFER. 361 | # 362 | # 3. Check if we are on the first line of the current multi-line buffer. 363 | # If so, pressing UP would amount to leaving the multi-line buffer. 364 | # 365 | # We check this by adding an extra "x" to $LBUFFER, which makes 366 | # sure that xlbuflines is always equal to the number of lines 367 | # until $CURSOR (including the line with the cursor on it). 368 | # 369 | local buflines XLBUFFER xlbuflines 370 | buflines=(${(f)BUFFER}) 371 | XLBUFFER=$LBUFFER"x" 372 | xlbuflines=(${(f)XLBUFFER}) 373 | 374 | if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xlbuflines -ne 1 ]]; then 375 | zle up-line-or-history 376 | return 0 377 | fi 378 | 379 | return 1 380 | } 381 | 382 | _history-substring-search-down-buffer() { 383 | # 384 | # Check if the DOWN arrow was pressed to move the cursor within a multi-line 385 | # buffer. This amounts to three tests: 386 | # 387 | # 1. $#buflines -gt 1. 388 | # 389 | # 2. $CURSOR -ne $#BUFFER. 390 | # 391 | # 3. Check if we are on the last line of the current multi-line buffer. 392 | # If so, pressing DOWN would amount to leaving the multi-line buffer. 393 | # 394 | # We check this by adding an extra "x" to $RBUFFER, which makes 395 | # sure that xrbuflines is always equal to the number of lines 396 | # from $CURSOR (including the line with the cursor on it). 397 | # 398 | local buflines XRBUFFER xrbuflines 399 | buflines=(${(f)BUFFER}) 400 | XRBUFFER="x"$RBUFFER 401 | xrbuflines=(${(f)XRBUFFER}) 402 | 403 | if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xrbuflines -ne 1 ]]; then 404 | zle down-line-or-history 405 | return 0 406 | fi 407 | 408 | return 1 409 | } 410 | 411 | _history-substring-search-up-history() { 412 | # 413 | # Behave like up in ZSH, except clear the $BUFFER 414 | # when beginning of history is reached like in Fish. 415 | # 416 | if [[ -z $_history_substring_search_query ]]; then 417 | 418 | # we have reached the absolute top of history 419 | if [[ $HISTNO -eq 1 ]]; then 420 | BUFFER= 421 | 422 | # going up from somewhere below the top of history 423 | else 424 | zle up-line-or-history 425 | fi 426 | 427 | return 0 428 | fi 429 | 430 | return 1 431 | } 432 | 433 | _history-substring-search-down-history() { 434 | # 435 | # Behave like down-history in ZSH, except clear the 436 | # $BUFFER when end of history is reached like in Fish. 437 | # 438 | if [[ -z $_history_substring_search_query ]]; then 439 | 440 | # going down from the absolute top of history 441 | if [[ $HISTNO -eq 1 && -z $BUFFER ]]; then 442 | BUFFER=${history[1]} 443 | _history_substring_search_refresh_display=1 444 | 445 | # going down from somewhere above the bottom of history 446 | else 447 | zle down-line-or-history 448 | fi 449 | 450 | return 0 451 | fi 452 | 453 | return 1 454 | } 455 | 456 | _history_substring_search_process_raw_matches() { 457 | # 458 | # Process more outstanding raw matches and append any matches that need to 459 | # be displayed to the user to _history_substring_search_matches. 460 | # Return whether there were any more results appended. 461 | # 462 | 463 | # 464 | # While we have more raw matches. Process them to see if there are any more 465 | # matches that need to be displayed to the user. 466 | # 467 | while [[ $_history_substring_search_raw_match_index -lt $#_history_substring_search_raw_matches ]]; do 468 | # 469 | # Move on to the next raw entry and get its history index. 470 | # 471 | _history_substring_search_raw_match_index+=1 472 | local index=${_history_substring_search_raw_matches[$_history_substring_search_raw_match_index]} 473 | 474 | # 475 | # If HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE is set to a non-empty value, 476 | # then ensure that only unique matches are presented to the user. 477 | # When HIST_IGNORE_ALL_DUPS is set, ZSH already ensures a unique history, 478 | # so in this case we do not need to do anything. 479 | # 480 | if [[ ! -o HIST_IGNORE_ALL_DUPS && -n $HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE ]]; then 481 | # 482 | # Get the actual history entry at the new index, and check if we have 483 | # already added it to _history_substring_search_matches. 484 | # 485 | local entry=${history[$index]} 486 | 487 | if [[ -z ${_history_substring_search_unique_filter[$entry]} ]]; then 488 | # 489 | # This is a new unique entry. Add it to the filter and append the 490 | # index to _history_substring_search_matches. 491 | # 492 | _history_substring_search_unique_filter[$entry]=1 493 | _history_substring_search_matches+=($index) 494 | 495 | # 496 | # Indicate that we did find a match. 497 | # 498 | return 0 499 | fi 500 | 501 | else 502 | # 503 | # Just append the new history index to the processed matches. 504 | # 505 | _history_substring_search_matches+=($index) 506 | 507 | # 508 | # Indicate that we did find a match. 509 | # 510 | return 0 511 | fi 512 | 513 | done 514 | 515 | # 516 | # We are beyond the end of the list of raw matches. Indicate that no 517 | # more matches are available. 518 | # 519 | return 1 520 | } 521 | 522 | _history-substring-search-has-next() { 523 | # 524 | # Predicate function that returns whether any more older matches are 525 | # available. 526 | # 527 | 528 | if [[ $_history_substring_search_match_index -lt $#_history_substring_search_matches ]]; then 529 | # 530 | # We did not reach the end of the processed list, so we do have further 531 | # matches. 532 | # 533 | return 0 534 | 535 | else 536 | # 537 | # We are at the end of the processed list. Try to process further 538 | # unprocessed matches. _history_substring_search_process_raw_matches 539 | # returns whether any more matches were available, so just return 540 | # that result. 541 | # 542 | _history_substring_search_process_raw_matches 543 | return $? 544 | fi 545 | } 546 | 547 | _history-substring-search-has-prev() { 548 | # 549 | # Predicate function that returns whether any more younger matches are 550 | # available. 551 | # 552 | 553 | if [[ $_history_substring_search_match_index -gt 1 ]]; then 554 | # 555 | # We did not reach the beginning of the processed list, so we do have 556 | # further matches. 557 | # 558 | return 0 559 | 560 | else 561 | # 562 | # We are at the beginning of the processed list. We do not have any more 563 | # matches. 564 | # 565 | return 1 566 | fi 567 | } 568 | 569 | _history-substring-search-found() { 570 | # 571 | # A match is available. The index of the match is held in 572 | # $_history_substring_search_match_index 573 | # 574 | # 1. Make $BUFFER equal to the matching history entry. 575 | # 576 | # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND 577 | # to highlight the current buffer. 578 | # 579 | BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]] 580 | _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND 581 | } 582 | 583 | _history-substring-search-not-found() { 584 | # 585 | # No more matches are available. 586 | # 587 | # 1. Make $BUFFER equal to $_history_substring_search_query so the user can 588 | # revise it and search again. 589 | # 590 | # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND 591 | # to highlight the current buffer. 592 | # 593 | BUFFER=$_history_substring_search_query 594 | _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND 595 | } 596 | 597 | _history-substring-search-up-search() { 598 | _history_substring_search_refresh_display=1 599 | 600 | # 601 | # Select history entry during history-substring-down-search: 602 | # 603 | # The following variables have been initialized in 604 | # _history-substring-search-up/down-search(): 605 | # 606 | # $_history_substring_search_matches is the current list of matches that 607 | # need to be displayed to the user. 608 | # $_history_substring_search_match_index is the index of the current match 609 | # that is being displayed to the user. 610 | # 611 | # The range of values that $_history_substring_search_match_index can take 612 | # is: [0, $#_history_substring_search_matches + 1]. A value of 0 613 | # indicates that we are beyond the beginning of 614 | # $_history_substring_search_matches. A value of 615 | # $#_history_substring_search_matches + 1 indicates that we are beyond 616 | # the end of $_history_substring_search_matches and that we have also 617 | # processed all entries in _history_substring_search_raw_matches. 618 | # 619 | # If $_history_substring_search_match_index equals 620 | # $#_history_substring_search_matches and 621 | # $_history_substring_search_raw_match_index is not greater than 622 | # $#_history_substring_search_raw_matches, then we need to further process 623 | # $_history_substring_search_raw_matches to see if there are any more 624 | # entries that need to be displayed to the user. 625 | # 626 | # In _history-substring-search-up-search() the initial value of 627 | # $_history_substring_search_match_index is 0. This value is set in 628 | # _history-substring-search-begin(). _history-substring-search-up-search() 629 | # will initially increment it to 1. 630 | # 631 | 632 | if [[ $_history_substring_search_match_index -gt $#_history_substring_search_matches ]]; then 633 | # 634 | # We are beyond the end of $_history_substring_search_matches. This 635 | # can only happen if we have also exhausted the unprocessed matches in 636 | # _history_substring_search_raw_matches. 637 | # 638 | # 1. Update display to indicate search not found. 639 | # 640 | _history-substring-search-not-found 641 | return 642 | fi 643 | 644 | if _history-substring-search-has-next; then 645 | # 646 | # We do have older matches. 647 | # 648 | # 1. Move index to point to the next match. 649 | # 2. Update display to indicate search found. 650 | # 651 | _history_substring_search_match_index+=1 652 | _history-substring-search-found 653 | 654 | else 655 | # 656 | # We do not have older matches. 657 | # 658 | # 1. Move the index beyond the end of 659 | # _history_substring_search_matches. 660 | # 2. Update display to indicate search not found. 661 | # 662 | _history_substring_search_match_index+=1 663 | _history-substring-search-not-found 664 | fi 665 | 666 | # 667 | # When HIST_FIND_NO_DUPS is set, meaning that only unique command lines from 668 | # history should be matched, make sure the new and old results are different. 669 | # 670 | # However, if the HIST_IGNORE_ALL_DUPS shell option, or 671 | # HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE is set, then we already have a 672 | # unique history, so in this case we do not need to do anything. 673 | # 674 | if [[ -o HIST_IGNORE_ALL_DUPS || -n $HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE ]]; then 675 | return 676 | fi 677 | 678 | if [[ -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then 679 | # 680 | # Repeat the current search so that a different (unique) match is found. 681 | # 682 | _history-substring-search-up-search 683 | fi 684 | } 685 | 686 | _history-substring-search-down-search() { 687 | _history_substring_search_refresh_display=1 688 | 689 | # 690 | # Select history entry during history-substring-down-search: 691 | # 692 | # The following variables have been initialized in 693 | # _history-substring-search-up/down-search(): 694 | # 695 | # $_history_substring_search_matches is the current list of matches that 696 | # need to be displayed to the user. 697 | # $_history_substring_search_match_index is the index of the current match 698 | # that is being displayed to the user. 699 | # 700 | # The range of values that $_history_substring_search_match_index can take 701 | # is: [0, $#_history_substring_search_matches + 1]. A value of 0 702 | # indicates that we are beyond the beginning of 703 | # $_history_substring_search_matches. A value of 704 | # $#_history_substring_search_matches + 1 indicates that we are beyond 705 | # the end of $_history_substring_search_matches and that we have also 706 | # processed all entries in _history_substring_search_raw_matches. 707 | # 708 | # In _history-substring-search-down-search() the initial value of 709 | # $_history_substring_search_match_index is 1. This value is set in 710 | # _history-substring-search-begin(). _history-substring-search-down-search() 711 | # will initially decrement it to 0. 712 | # 713 | 714 | if [[ $_history_substring_search_match_index -lt 1 ]]; then 715 | # 716 | # We are beyond the beginning of $_history_substring_search_matches. 717 | # 718 | # 1. Update display to indicate search not found. 719 | # 720 | _history-substring-search-not-found 721 | return 722 | fi 723 | 724 | if _history-substring-search-has-prev; then 725 | # 726 | # We do have younger matches. 727 | # 728 | # 1. Move index to point to the previous match. 729 | # 2. Update display to indicate search found. 730 | # 731 | _history_substring_search_match_index+=-1 732 | _history-substring-search-found 733 | 734 | else 735 | # 736 | # We do not have younger matches. 737 | # 738 | # 1. Move the index beyond the beginning of 739 | # _history_substring_search_matches. 740 | # 2. Update display to indicate search not found. 741 | # 742 | _history_substring_search_match_index+=-1 743 | _history-substring-search-not-found 744 | fi 745 | 746 | # 747 | # When HIST_FIND_NO_DUPS is set, meaning that only unique command lines from 748 | # history should be matched, make sure the new and old results are different. 749 | # 750 | # However, if the HIST_IGNORE_ALL_DUPS shell option, or 751 | # HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE is set, then we already have a 752 | # unique history, so in this case we do not need to do anything. 753 | # 754 | if [[ -o HIST_IGNORE_ALL_DUPS || -n $HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE ]]; then 755 | return 756 | fi 757 | 758 | if [[ -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then 759 | # 760 | # Repeat the current search so that a different (unique) match is found. 761 | # 762 | _history-substring-search-down-search 763 | fi 764 | } 765 | 766 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 767 | # vim: ft=zsh sw=2 ts=2 et 768 | -------------------------------------------------------------------------------- /.local/share/zsh/zsh-auto-notify/LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | 3 | Version 3, 29 June 2007 4 | 5 | Copyright © 2007 Free Software Foundation, Inc. 6 | 7 | Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The GNU General Public License is a free, copyleft license for software and other kinds of works. 12 | 13 | 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. 14 | 15 | 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. 16 | 17 | 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. 18 | 19 | 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. 20 | 21 | 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. 22 | 23 | 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. 24 | 25 | 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. 26 | 27 | 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. 28 | 29 | The precise terms and conditions for copying, distribution and modification follow. 30 | 31 | TERMS AND CONDITIONS 32 | 33 | 0. Definitions. 34 | 35 | “This License” refers to version 3 of the GNU General Public License. 36 | 37 | “Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. 38 | 39 | “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. 40 | 41 | 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. 42 | 43 | A “covered work” means either the unmodified Program or a work based on the Program. 44 | 45 | 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. 46 | 47 | 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. 48 | 49 | 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. 50 | 51 | 1. Source Code. 52 | 53 | 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. 54 | 55 | 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. 56 | 57 | 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. 58 | 59 | 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. 60 | 61 | The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. 62 | 63 | The Corresponding Source for a work in source code form is that same work. 64 | 65 | 2. Basic Permissions. 66 | 67 | 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. 68 | 69 | 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. 70 | 71 | Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 72 | 73 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 74 | 75 | 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. 76 | 77 | 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. 78 | 79 | 4. Conveying Verbatim Copies. 80 | 81 | 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. 82 | 83 | 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. 84 | 85 | 5. Conveying Modified Source Versions. 86 | 87 | 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: 88 | 89 | a) The work must carry prominent notices stating that you modified it, and giving a relevant date. 90 | 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”. 91 | 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. 92 | 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. 93 | 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. 94 | 95 | 6. Conveying Non-Source Forms. 96 | 97 | 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: 98 | 99 | 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. 100 | 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. 101 | 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. 102 | 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. 103 | 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. 104 | 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. 105 | 106 | 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. 107 | 108 | “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. 109 | 110 | 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). 111 | 112 | 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. 113 | 114 | 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. 115 | 116 | 7. Additional Terms. 117 | 118 | “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. 119 | 120 | 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. 121 | 122 | 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: 123 | 124 | a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or 125 | 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 126 | 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 127 | d) Limiting the use for publicity purposes of names of licensors or authors of the material; or 128 | e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or 129 | 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. 130 | 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. 131 | 132 | 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. 133 | 134 | 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. 135 | 136 | 8. Termination. 137 | 138 | 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). 139 | 140 | 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. 141 | 142 | 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. 143 | 144 | 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. 145 | 146 | 9. Acceptance Not Required for Having Copies. 147 | 148 | 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. 149 | 150 | 10. Automatic Licensing of Downstream Recipients. 151 | 152 | 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. 153 | 154 | 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. 155 | 156 | 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. 157 | 158 | 11. Patents. 159 | 160 | 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”. 161 | 162 | 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. 163 | 164 | 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. 165 | 166 | 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. 167 | 168 | 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. 169 | 170 | 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. 171 | 172 | 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. 173 | 174 | 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. 175 | 176 | 12. No Surrender of Others' Freedom. 177 | 178 | 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. 179 | 180 | 13. Use with the GNU Affero General Public License. 181 | 182 | 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. 183 | 184 | 14. Revised Versions of this License. 185 | 186 | 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. 187 | 188 | 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. 189 | 190 | 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. 191 | 192 | 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. 193 | 194 | 15. Disclaimer of Warranty. 195 | 196 | 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. 197 | 198 | 16. Limitation of Liability. 199 | 200 | 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. 201 | 202 | 17. Interpretation of Sections 15 and 16. 203 | 204 | 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. 205 | 206 | END OF TERMS AND CONDITIONS 207 | 208 | How to Apply These Terms to Your New Programs 209 | 210 | If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. 211 | 212 | To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. 213 | 214 | 215 | Copyright (C) 216 | 217 | This program is free software: you can redistribute it and/or modify 218 | it under the terms of the GNU General Public License as published by 219 | the Free Software Foundation, either version 3 of the License, or 220 | (at your option) any later version. 221 | 222 | This program is distributed in the hope that it will be useful, 223 | but WITHOUT ANY WARRANTY; without even the implied warranty of 224 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 225 | GNU General Public License for more details. 226 | 227 | You should have received a copy of the GNU General Public License 228 | along with this program. If not, see . 229 | Also add information on how to contact you by electronic and paper mail. 230 | 231 | If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: 232 | 233 | Copyright (C) 234 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 235 | This is free software, and you are welcome to redistribute it 236 | under certain conditions; type `show c' for details. 237 | The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”. 238 | 239 | You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . 240 | 241 | The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . 242 | --------------------------------------------------------------------------------