From a51c62aa252e7c4c54466038ff5808bc9d7742a0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 13 Jan 2018 13:10:25 +0200 Subject: [PATCH 001/713] Initial commit --- LICENSE | 21 +++++++++++++++++++++ README.md | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 LICENSE create mode 100644 README.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e70c16f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Dmytro Meleshko + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..1b803c0 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# dotfiles +My dotfiles for Mac OS X & Ubuntu From b7a2066f415dcb47e510627770b89335a5636538 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 23 Feb 2018 11:38:24 +0200 Subject: [PATCH 002/713] initial commit --- aliases.zsh | 3 +++ exports.zsh | 14 ++++++++++++++ functions.zsh | 17 +++++++++++++++++ oh-my-zsh.zsh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ path.zsh | 25 +++++++++++++++++++++++++ zlogin | 1 + zshrc | 39 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 147 insertions(+) create mode 100644 aliases.zsh create mode 100644 exports.zsh create mode 100644 functions.zsh create mode 100644 oh-my-zsh.zsh create mode 100644 path.zsh create mode 100755 zlogin create mode 100755 zshrc diff --git a/aliases.zsh b/aliases.zsh new file mode 100644 index 0000000..10628ba --- /dev/null +++ b/aliases.zsh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +alias find="noglob find" diff --git a/exports.zsh b/exports.zsh new file mode 100644 index 0000000..5fcd4e1 --- /dev/null +++ b/exports.zsh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +export LANG="en_US.UTF-8" +export LC_ALL="$LANG" + +if [[ -n $SSH_CONNECTION ]]; then + export EDITOR="rmate" +else + export EDITOR="code" +fi + +export CLICOLOR=1 + +export SDKMAN_DIR="$HOME/.sdkman" diff --git a/functions.zsh b/functions.zsh new file mode 100644 index 0000000..ccb48c1 --- /dev/null +++ b/functions.zsh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +is_linux() { + [[ $OSTYPE == linux* ]] +} + +is_macos() { + [[ $OSTYPE == darwin* ]] +} + +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + +source_if_exists() { + [[ -f $1 ]] && source "$1" +} diff --git a/oh-my-zsh.zsh b/oh-my-zsh.zsh new file mode 100644 index 0000000..7020f34 --- /dev/null +++ b/oh-my-zsh.zsh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +find_oh_my_zsh() { + for prefix in "$HOME/." "/usr/share/" "/usr/local/share/"; do + local zsh_dir="${prefix}oh-my-zsh" + if [[ -d "$zsh_dir" ]]; then + export ZSH="$zsh_dir" + break + fi + done +} + +configure_oh_my_zsh() { + # see https://github.com/robbyrussell/oh-my-zsh/wiki/Themes + export ZSH_THEME="agnoster" + + # use hyphen-insensitive completion (makes `_` and `-` interchangeable) + export HYPHEN_INSENSITIVE="true" + + # enable command auto-correction + export ENABLE_CORRECTION="true" + + # display red dots while waiting for completion + export COMPLETION_WAITING_DOTS="true" + + # disable marking untracked files under VCS as dirty (this makes repository + # status check for large repositories faster) + export DISABLE_UNTRACKED_FILES_DIRTY="true" + + # command execution time stamp shown in the history + export HIST_STAMPS="mm/dd/yyyy" + + # https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins + plugins=( + git + common-aliases + extract + zsh-syntax-highlighting + ) + + if is_linux; then + plugins+=(command-not-found) + fi +} + +find_oh_my_zsh +configure_oh_my_zsh +source "$ZSH/oh-my-zsh.sh" diff --git a/path.zsh b/path.zsh new file mode 100644 index 0000000..a1e6ba8 --- /dev/null +++ b/path.zsh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +prepend() { eval "export $1=\"$2:\$$1\""; } +append() { eval "export $1=\"\$$1:$2\""; } + +# user binaries +append PATH "$HOME/bin" +append PATH "$HOME/.local/bin" +# global Yarn packages +append PATH "$HOME/.config/yarn/global/node_modules/.bin" + +if is_macos; then + # GNU sed + prepend PATH "/usr/local/opt/gnu-tar/libexec/gnubin" + prepend MANPATH "/usr/local/opt/gnu-tar/libexec/gnuman" + # GNU tar + prepend PATH "/usr/local/opt/gnu-sed/libexec/gnubin" + prepend MANPATH "/usr/local/opt/gnu-sed/libexec/gnuman" + # GNU coreutils + prepend PATH "/usr/local/opt/coreutils/libexec/gnubin" + prepend MANPATH "/usr/local/opt/coreutils/libexec/gnuman" + # Haskell packages + append PATH "$HOME/Library/Haskell/bin" +fi + diff --git a/zlogin b/zlogin new file mode 100755 index 0000000..f1f641a --- /dev/null +++ b/zlogin @@ -0,0 +1 @@ +#!/usr/bin/env bash diff --git a/zshrc b/zshrc new file mode 100755 index 0000000..c5038e5 --- /dev/null +++ b/zshrc @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +find_dotfiles_dir() { + local readlink + # readlink=$(which greadlink || which readlink) + local script_path"=${(%):-%x}" + + if [[ -n "$script_path" && -x "$readlink" ]]; then + script_path=$($readlink -f "$script_path") + DOTFILES_DIR=$(dirname "$script_path") + else + for prefix in "$HOME/" "$HOME/." "/usr/share/" "/usr/local/share/"; do + local dotfiles_dir="${prefix}dotfiles" + if [[ -d "$dotfiles_dir" ]]; then + DOTFILES_DIR="$dotfiles_dir" + break + fi + done + fi + + if [[ -d $DOTFILES_DIR ]]; then + export DOTFILES_DIR + else + echo "dotfiles directory not found" + fi +} + +find_dotfiles_dir + +for script in "$DOTFILES_DIR"/{functions,path,exports,aliases,oh-my-zsh}.zsh; do + source "$script" +done + +# rbenv +command_exists rbenv && eval "$(rbenv init -)" +# sdkman +source_if_exists "$SDKMAN_DIR/bin/sdkman-init.sh" +# Yarn completion +source_if_exists "/usr/local/lib/node_modules/yarn-completions/node_modules/tabtab/.completions/yarn.zsh" From 69343ebdd754410eea48ee7062ea1c7a660e6e90 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 23 Feb 2018 19:15:26 +0200 Subject: [PATCH 003/713] rewrite zshrc to use `realpath` instead of `readlink -f` --- zshrc | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/zshrc b/zshrc index c5038e5..0177962 100755 --- a/zshrc +++ b/zshrc @@ -1,28 +1,16 @@ #!/usr/bin/env bash find_dotfiles_dir() { - local readlink - # readlink=$(which greadlink || which readlink) - local script_path"=${(%):-%x}" + export DOTFILES_DIR - if [[ -n "$script_path" && -x "$readlink" ]]; then - script_path=$($readlink -f "$script_path") - DOTFILES_DIR=$(dirname "$script_path") - else - for prefix in "$HOME/" "$HOME/." "/usr/share/" "/usr/local/share/"; do - local dotfiles_dir="${prefix}dotfiles" - if [[ -d "$dotfiles_dir" ]]; then - DOTFILES_DIR="$dotfiles_dir" - break - fi - done - fi + for prefix in "$HOME/." "/usr/share/" "/usr/local/share/"; do + DOTFILES_DIR="${prefix}dotfiles" + [[ -d "$DOTFILES_DIR" ]] && return + done - if [[ -d $DOTFILES_DIR ]]; then - export DOTFILES_DIR - else - echo "dotfiles directory not found" - fi + local script_path + script_path=$(realpath "${(%):-%x}") + DOTFILES_DIR=$(dirname "$script_path") } find_dotfiles_dir From aa3ec64f44e26af5f9f6201a480a377aedaf1b32 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 24 Feb 2018 10:53:58 +0200 Subject: [PATCH 004/713] add installer --- install.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..18ff9ee --- /dev/null +++ b/install.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +for script in {zhsrc,zlogin}.zsh; do + ln -sv "$script" ".$script" +done From 4fb9c62e0e0c27643ce5e58d0d5b7038b127e651 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 24 Feb 2018 10:56:02 +0200 Subject: [PATCH 005/713] add DEFAULT_USER --- exports.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/exports.zsh b/exports.zsh index 5fcd4e1..85701cf 100644 --- a/exports.zsh +++ b/exports.zsh @@ -2,6 +2,7 @@ export LANG="en_US.UTF-8" export LC_ALL="$LANG" +export DEFAULT_USER=dmitmel if [[ -n $SSH_CONNECTION ]]; then export EDITOR="rmate" From 6111dcbf18d932d7896356e08abcb12aa5e0c483 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 9 Mar 2018 09:45:40 +0200 Subject: [PATCH 006/713] add '$' alias --- aliases.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aliases.zsh b/aliases.zsh index 10628ba..39698bf 100644 --- a/aliases.zsh +++ b/aliases.zsh @@ -1,3 +1,5 @@ #!/usr/bin/env bash +alias '$'='' + alias find="noglob find" From 3abc66033ee81574a5ee32491662b1085d017ad9 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 10 Jun 2018 22:28:54 +0300 Subject: [PATCH 007/713] add Rust --- aliases.zsh | 2 ++ path.zsh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/aliases.zsh b/aliases.zsh index 39698bf..4a4bcdc 100644 --- a/aliases.zsh +++ b/aliases.zsh @@ -3,3 +3,5 @@ alias '$'='' alias find="noglob find" + +alias rustfmt="rustfmt --force" diff --git a/path.zsh b/path.zsh index a1e6ba8..098b472 100644 --- a/path.zsh +++ b/path.zsh @@ -6,6 +6,8 @@ append() { eval "export $1=\"\$$1:$2\""; } # user binaries append PATH "$HOME/bin" append PATH "$HOME/.local/bin" +# Rust binaries +prepend PATH="$HOME/.cargo/bin:$PATH" # global Yarn packages append PATH "$HOME/.config/yarn/global/node_modules/.bin" From 85dbf8efe6a506d2030d8404cafdae72233c50a7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 15 Jun 2018 16:42:09 +0300 Subject: [PATCH 008/713] update README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1b803c0..974ef3a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # dotfiles -My dotfiles for Mac OS X & Ubuntu + +My dotfiles for Mac OS X, Ubuntu and Raspbian. From 682ae85d812153c5421da49b889eb36b795b133a Mon Sep 17 00:00:00 2001 From: dmitmel Date: Fri, 15 Jun 2018 16:43:04 +0300 Subject: [PATCH 009/713] update shebangs --- aliases.zsh | 2 +- exports.zsh | 2 +- functions.zsh | 2 +- oh-my-zsh.zsh | 2 +- path.zsh | 2 +- zlogin | 2 +- zshrc | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/aliases.zsh b/aliases.zsh index 4a4bcdc..b0e4697 100644 --- a/aliases.zsh +++ b/aliases.zsh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env zsh alias '$'='' diff --git a/exports.zsh b/exports.zsh index 85701cf..db0c619 100644 --- a/exports.zsh +++ b/exports.zsh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env zsh export LANG="en_US.UTF-8" export LC_ALL="$LANG" diff --git a/functions.zsh b/functions.zsh index ccb48c1..4ca0833 100644 --- a/functions.zsh +++ b/functions.zsh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env zsh is_linux() { [[ $OSTYPE == linux* ]] diff --git a/oh-my-zsh.zsh b/oh-my-zsh.zsh index 7020f34..a85c306 100644 --- a/oh-my-zsh.zsh +++ b/oh-my-zsh.zsh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env zsh find_oh_my_zsh() { for prefix in "$HOME/." "/usr/share/" "/usr/local/share/"; do diff --git a/path.zsh b/path.zsh index 098b472..1d044b6 100644 --- a/path.zsh +++ b/path.zsh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env zsh prepend() { eval "export $1=\"$2:\$$1\""; } append() { eval "export $1=\"\$$1:$2\""; } diff --git a/zlogin b/zlogin index f1f641a..8441a36 100755 --- a/zlogin +++ b/zlogin @@ -1 +1 @@ -#!/usr/bin/env bash +#!/usr/bin/env zsh diff --git a/zshrc b/zshrc index 0177962..86f158c 100755 --- a/zshrc +++ b/zshrc @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env zsh find_dotfiles_dir() { export DOTFILES_DIR From 93efc97f149a55cd1003d38d3f387442f935469b Mon Sep 17 00:00:00 2001 From: dmitmel Date: Fri, 15 Jun 2018 16:50:24 +0300 Subject: [PATCH 010/713] add lazy-loading of setup scripts for commands that aren't used very often --- functions.zsh | 14 ++++++++++++++ zshrc | 9 +++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/functions.zsh b/functions.zsh index 4ca0833..f05ecf7 100644 --- a/functions.zsh +++ b/functions.zsh @@ -15,3 +15,17 @@ command_exists() { source_if_exists() { [[ -f $1 ]] && source "$1" } + +run_before() { + local command="$1" + local init_command="$2" + + eval "$(cat < Date: Fri, 15 Jun 2018 17:02:45 +0300 Subject: [PATCH 011/713] add support for dircolors --- oh-my-zsh.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/oh-my-zsh.zsh b/oh-my-zsh.zsh index a85c306..9d64e9f 100644 --- a/oh-my-zsh.zsh +++ b/oh-my-zsh.zsh @@ -43,6 +43,14 @@ configure_oh_my_zsh() { fi } +configure_zsh() { + [[ -f ~/.dircolors ]] && eval "$(dircolors ~/.dircolors)" + [[ -z "$LS_COLORS" ]] && eval "$(dircolors -b)" + + zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}" +} + find_oh_my_zsh configure_oh_my_zsh source "$ZSH/oh-my-zsh.sh" +configure_zsh From 1e18c0ca1278ff8b6abecefdc6afced4808c45c0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 27 Jun 2018 20:04:46 +0300 Subject: [PATCH 012/713] fix username on Android --- exports.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/exports.zsh b/exports.zsh index db0c619..52f3815 100644 --- a/exports.zsh +++ b/exports.zsh @@ -2,6 +2,10 @@ export LANG="en_US.UTF-8" export LC_ALL="$LANG" + +if [[ -z $USER && -n $USERNAME ]]; then + export USER="$USERNAME" +fi export DEFAULT_USER=dmitmel if [[ -n $SSH_CONNECTION ]]; then From 1eb63983053c94e9f2d3f07c1e55e4cbd5ca30fa Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 27 Jun 2018 20:05:18 +0300 Subject: [PATCH 013/713] fix Cargo path --- path.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/path.zsh b/path.zsh index 1d044b6..0a1e47c 100644 --- a/path.zsh +++ b/path.zsh @@ -7,7 +7,7 @@ append() { eval "export $1=\"\$$1:$2\""; } append PATH "$HOME/bin" append PATH "$HOME/.local/bin" # Rust binaries -prepend PATH="$HOME/.cargo/bin:$PATH" +prepend PATH "$HOME/.cargo/bin:$PATH" # global Yarn packages append PATH "$HOME/.config/yarn/global/node_modules/.bin" From 03496920d06db41836f1ff82714d74876f151298 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 3 Jul 2018 11:55:11 +0300 Subject: [PATCH 014/713] delete unnecessary rustfmt alias --- aliases.zsh | 2 -- 1 file changed, 2 deletions(-) diff --git a/aliases.zsh b/aliases.zsh index b0e4697..eacb8b4 100644 --- a/aliases.zsh +++ b/aliases.zsh @@ -3,5 +3,3 @@ alias '$'='' alias find="noglob find" - -alias rustfmt="rustfmt --force" From 58ac67c492db8fe66d0aebbc073d37c55cf8ef62 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 3 Jul 2018 11:57:03 +0300 Subject: [PATCH 015/713] change EDITOR variable --- exports.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exports.zsh b/exports.zsh index 52f3815..c0a114c 100644 --- a/exports.zsh +++ b/exports.zsh @@ -11,7 +11,7 @@ export DEFAULT_USER=dmitmel if [[ -n $SSH_CONNECTION ]]; then export EDITOR="rmate" else - export EDITOR="code" + export EDITOR="code --wait" fi export CLICOLOR=1 From 27d0185cf1c4c1b7da8897f5447ff88d132efe5a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 4 Jul 2018 23:55:45 +0300 Subject: [PATCH 016/713] fix quotes --- exports.zsh | 8 ++++---- functions.zsh | 6 +++--- zshrc | 5 ++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/exports.zsh b/exports.zsh index c0a114c..47468a6 100644 --- a/exports.zsh +++ b/exports.zsh @@ -3,17 +3,17 @@ export LANG="en_US.UTF-8" export LC_ALL="$LANG" -if [[ -z $USER && -n $USERNAME ]]; then +if [[ -z "$USER" && -n "$USERNAME" ]]; then export USER="$USERNAME" fi -export DEFAULT_USER=dmitmel +export DEFAULT_USER="dmitmel" -if [[ -n $SSH_CONNECTION ]]; then +if [[ -n "$SSH_CONNECTION" ]]; then export EDITOR="rmate" else export EDITOR="code --wait" fi -export CLICOLOR=1 +export CLICOLOR="1" export SDKMAN_DIR="$HOME/.sdkman" diff --git a/functions.zsh b/functions.zsh index f05ecf7..6c1b257 100644 --- a/functions.zsh +++ b/functions.zsh @@ -1,11 +1,11 @@ #!/usr/bin/env zsh is_linux() { - [[ $OSTYPE == linux* ]] + [[ "$OSTYPE" == linux* ]] } is_macos() { - [[ $OSTYPE == darwin* ]] + [[ "$OSTYPE" == darwin* ]] } command_exists() { @@ -13,7 +13,7 @@ command_exists() { } source_if_exists() { - [[ -f $1 ]] && source "$1" + [[ -f "$1" ]] && source "$1" } run_before() { diff --git a/zshrc b/zshrc index e25ca43..790c80a 100755 --- a/zshrc +++ b/zshrc @@ -8,9 +8,8 @@ find_dotfiles_dir() { [[ -d "$DOTFILES_DIR" ]] && return done - local script_path - script_path=$(realpath "${(%):-%x}") - DOTFILES_DIR=$(dirname "$script_path") + local script_path="$(realpath "${(%):-%x}")" + DOTFILES_DIR="$(dirname "$script_path")" } find_dotfiles_dir From c10ba15ff2f6c0eac45ae0c929fe318e251b5062 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 4 Jul 2018 23:56:09 +0300 Subject: [PATCH 017/713] add basic command palette widget --- oh-my-zsh.zsh | 2 +- widgets.zsh | 23 +++++++++++++++++++++++ zshrc | 5 +++-- 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 widgets.zsh diff --git a/oh-my-zsh.zsh b/oh-my-zsh.zsh index 9d64e9f..9579567 100644 --- a/oh-my-zsh.zsh +++ b/oh-my-zsh.zsh @@ -35,7 +35,7 @@ configure_oh_my_zsh() { git common-aliases extract - zsh-syntax-highlighting + # zsh-syntax-highlighting ) if is_linux; then diff --git a/widgets.zsh b/widgets.zsh new file mode 100644 index 0000000..62f875a --- /dev/null +++ b/widgets.zsh @@ -0,0 +1,23 @@ +#!/usr/bin/env zsh + +_command_palette_widgets=() + +for widget_name widget_info in ${(kv)widgets}; do + [[ "$widget_name" == .* ]] && continue + [[ "$widget_info" == completion:* ]] && continue + _command_palette_widgets+=($widget_name) +done + +_command-palette() { + local widget_name="$(echo "${(@j:\n:)_command_palette_widgets}" | peco)" + if [[ -n "$widget_name" ]]; then + python -c " +import fcntl, termios +with open('$TTY') as tty: + for char in '\x1bx$widget_name\n': + fcntl.ioctl(tty, termios.TIOCSTI, char) +" + fi +} +zle -N command-palette _command-palette +bindkey "^[P" command-palette diff --git a/zshrc b/zshrc index 790c80a..d31b59b 100755 --- a/zshrc +++ b/zshrc @@ -14,10 +14,11 @@ find_dotfiles_dir() { find_dotfiles_dir -for script in "$DOTFILES_DIR"/{functions,path,exports,aliases,oh-my-zsh}.zsh; do - source "$script" +for script in functions path exports aliases oh-my-zsh widgets; do + source "${DOTFILES_DIR}/${script}.zsh" done +source_if_exists "$ZSH/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh" run_before rbenv 'eval "$(rbenv init -)"' run_before sdk 'source_if_exists "$SDKMAN_DIR/bin/sdkman-init.sh"' run_before yarn 'source_if_exists "$(yarn global dir)/node_modules/tabtab/.completions/yarn.zsh"' From bc4f313983d50e0e6d77a72b093236dbcb7c8938 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 4 Jul 2018 23:59:32 +0300 Subject: [PATCH 018/713] move config files to the 'lib' directory --- aliases.zsh => lib/aliases.zsh | 0 exports.zsh => lib/exports.zsh | 0 functions.zsh => lib/functions.zsh | 0 oh-my-zsh.zsh => lib/oh-my-zsh.zsh | 0 path.zsh => lib/path.zsh | 0 widgets.zsh => lib/widgets.zsh | 0 zshrc | 2 +- 7 files changed, 1 insertion(+), 1 deletion(-) rename aliases.zsh => lib/aliases.zsh (100%) rename exports.zsh => lib/exports.zsh (100%) rename functions.zsh => lib/functions.zsh (100%) rename oh-my-zsh.zsh => lib/oh-my-zsh.zsh (100%) rename path.zsh => lib/path.zsh (100%) rename widgets.zsh => lib/widgets.zsh (100%) diff --git a/aliases.zsh b/lib/aliases.zsh similarity index 100% rename from aliases.zsh rename to lib/aliases.zsh diff --git a/exports.zsh b/lib/exports.zsh similarity index 100% rename from exports.zsh rename to lib/exports.zsh diff --git a/functions.zsh b/lib/functions.zsh similarity index 100% rename from functions.zsh rename to lib/functions.zsh diff --git a/oh-my-zsh.zsh b/lib/oh-my-zsh.zsh similarity index 100% rename from oh-my-zsh.zsh rename to lib/oh-my-zsh.zsh diff --git a/path.zsh b/lib/path.zsh similarity index 100% rename from path.zsh rename to lib/path.zsh diff --git a/widgets.zsh b/lib/widgets.zsh similarity index 100% rename from widgets.zsh rename to lib/widgets.zsh diff --git a/zshrc b/zshrc index d31b59b..1986a35 100755 --- a/zshrc +++ b/zshrc @@ -15,7 +15,7 @@ find_dotfiles_dir() { find_dotfiles_dir for script in functions path exports aliases oh-my-zsh widgets; do - source "${DOTFILES_DIR}/${script}.zsh" + source "${DOTFILES_DIR}/lib/${script}.zsh" done source_if_exists "$ZSH/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh" From 3b08d735a4043ba6793820924b474f1bd549aa57 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 5 Jul 2018 18:50:12 +0300 Subject: [PATCH 019/713] show keybindings in command palette --- lib/widgets.zsh | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/lib/widgets.zsh b/lib/widgets.zsh index 62f875a..1eaa9d2 100644 --- a/lib/widgets.zsh +++ b/lib/widgets.zsh @@ -1,20 +1,49 @@ #!/usr/bin/env zsh -_command_palette_widgets=() - +typeset -A widgets_list for widget_name widget_info in ${(kv)widgets}; do [[ "$widget_name" == .* ]] && continue [[ "$widget_info" == completion:* ]] && continue - _command_palette_widgets+=($widget_name) + widgets_list[$widget_name]="none" done +for line in "${(@f)$(bindkey)}"; do + eval "line_parts=($line)" + widget_key="$line_parts[1]" + widget_name="$line_parts[2]" + widget_keys="$widgets_list[$widget_name]" + + if [[ -z "$widget_keys" ]]; then + continue + else + case "$widget_keys" in + none) widget_keys="keys:" ;; + keys:*) widget_keys+=" " ;; + esac + widgets_list[$widget_name]="$widget_keys{$widget_key}" + fi +done + +widgets_str="" +for widget_name widget_keys in ${(kv)widgets_list}; do + widgets_str+="$widget_name" + if [[ "$widget_keys" == keys:* ]]; then + widgets_str+=" ${widget_keys#keys:}" + fi + widgets_str+=$'\n' +done +widgets_str="${widgets_str%$'\n'}" + +unset widget_{name,info,key,keys} + _command-palette() { - local widget_name="$(echo "${(@j:\n:)_command_palette_widgets}" | peco)" - if [[ -n "$widget_name" ]]; then + local widget="$(echo "$widgets_str" | peco)" + if [[ -n "$widget" ]]; then + widget="${widget%%$' '*}" python -c " import fcntl, termios with open('$TTY') as tty: - for char in '\x1bx$widget_name\n': + for char in '\x1bx${widget}\n': fcntl.ioctl(tty, termios.TIOCSTI, char) " fi From dcbce5a72cdb4335f168722042235f4848b2e1d0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 5 Jul 2018 20:03:07 +0300 Subject: [PATCH 020/713] document command palette code --- lib/widgets.zsh | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/lib/widgets.zsh b/lib/widgets.zsh index 1eaa9d2..aeea9f9 100644 --- a/lib/widgets.zsh +++ b/lib/widgets.zsh @@ -1,18 +1,30 @@ #!/usr/bin/env zsh +# define an associative array for widgets with their corresponding keybindings typeset -A widgets_list +# get all widgets ('widgets' -> http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fzleparameter-Module) for widget_name widget_info in ${(kv)widgets}; do + # ignore built-in widgets starting with a dot because ZSH defines them both + # with and without the dot [[ "$widget_name" == .* ]] && continue + # ignore completion widgets [[ "$widget_info" == completion:* ]] && continue + # by default, widgets don't have keybindings widgets_list[$widget_name]="none" done +# get keybindings for widgets (one widget can have multiple keybindings) + +# iterate over existing keybindings (the 'f' flag splits output of the command +# by the '\n' char) for line in "${(@f)$(bindkey)}"; do + # parse line a string of command-line arguments (eval is required here!) eval "line_parts=($line)" + # array indexes in ZSH start from 1 (o_O) widget_key="$line_parts[1]" widget_name="$line_parts[2]" - widget_keys="$widgets_list[$widget_name]" + widget_keys="$widgets_list[$widget_name]" if [[ -z "$widget_keys" ]]; then continue else @@ -24,29 +36,44 @@ for line in "${(@f)$(bindkey)}"; do fi done +# convert list of widgets into a string widgets_str="" for widget_name widget_keys in ${(kv)widgets_list}; do widgets_str+="$widget_name" if [[ "$widget_keys" == keys:* ]]; then + # remove the 'keys:' prefix widgets_str+=" ${widget_keys#keys:}" fi widgets_str+=$'\n' done +# remove the trailing newline from the string widgets_str="${widgets_str%$'\n'}" unset widget_{name,info,key,keys} +# command palette allows you to search for widgets _command-palette() { + # widget is selected with 'peco', a 'Simplistic interactive filtering tool' local widget="$(echo "$widgets_str" | peco)" if [[ -n "$widget" ]]; then + # parse widget name by cutting the selected string to the first space (which + # may contain keybindings) widget="${widget%%$' '*}" + # HACK: This small Python script is used to send simluated keystrokes to the + # currentl TTY. It first executes the 'execute-named-cmd' widget, then + # enters the widget name and finally types the 'Enter' key. (Python + # was chosen because it supports required functionallity out of the box). + # NOTE! This script may not work on all platforms (especially, on Windows)!!! python -c " import fcntl, termios with open('$TTY') as tty: + # ('\x1b' is the 'escape' char) for char in '\x1bx${widget}\n': + # 'ioctl' is a syscall that can send special commands to file descriptors. + # 'TIOCSTI' is one of these commands and can be used to simulate keypresses. fcntl.ioctl(tty, termios.TIOCSTI, char) " fi } zle -N command-palette _command-palette -bindkey "^[P" command-palette +bindkey "^[P" command-palette # Esc-Shift-P or Alt-Shift-P From 41f1fbb855dbde9a51c63c428313931d57238c6a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 8 Aug 2018 08:53:46 +0300 Subject: [PATCH 021/713] fix PATH duplication --- lib/path.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/path.zsh b/lib/path.zsh index 0a1e47c..b2c0ba7 100644 --- a/lib/path.zsh +++ b/lib/path.zsh @@ -7,7 +7,7 @@ append() { eval "export $1=\"\$$1:$2\""; } append PATH "$HOME/bin" append PATH "$HOME/.local/bin" # Rust binaries -prepend PATH "$HOME/.cargo/bin:$PATH" +prepend PATH "$HOME/.cargo/bin" # global Yarn packages append PATH "$HOME/.config/yarn/global/node_modules/.bin" From 0fdcac0dc7abe4a15419de38deda351a6eca93c5 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 8 Aug 2018 11:35:35 +0300 Subject: [PATCH 022/713] add welcome script --- welcome/logos/android | 18 ++++ welcome/logos/mac | 17 +++ welcome/logos/raspbian | 18 ++++ welcome/logos/ubuntu | 20 ++++ welcome/main.py | 235 +++++++++++++++++++++++++++++++++++++++++ zlogin | 1 - zshrc | 4 +- 7 files changed, 311 insertions(+), 2 deletions(-) create mode 100644 welcome/logos/android create mode 100644 welcome/logos/mac create mode 100644 welcome/logos/raspbian create mode 100644 welcome/logos/ubuntu create mode 100644 welcome/main.py delete mode 100755 zlogin diff --git a/welcome/logos/android b/welcome/logos/android new file mode 100644 index 0000000..d3cfa25 --- /dev/null +++ b/welcome/logos/android @@ -0,0 +1,18 @@ +{2} -o o- +{2} +hydNNNNdyh+ +{2} +mMMMMMMMMMMMMm+ +{2} `dMM{7}m:{2}NMMMMMMN{7}:m{2}MMd` +{2} hMMMMMMMMMMMMMMMMMMh +{2} .. yyyyyyyyyyyyyyyyyyyy .. +{2}.mMMm`MMMMMMMMMMMMMMMMMMMM`mMMm. +{2}:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM: +{2}:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM: +{2}:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM: +{2}:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM: +{2}-MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM- +{2} +yy+ MMMMMMMMMMMMMMMMMMMM +yy+ +{2} mMMMMMMMMMMMMMMMMMMm +{2} `/++MMMMh++hMMMM++/` +{2} MMMMo oMMMM +{2} MMMMo oMMMM +{2} oNMm- -mMNs diff --git a/welcome/logos/mac b/welcome/logos/mac new file mode 100644 index 0000000..be635af --- /dev/null +++ b/welcome/logos/mac @@ -0,0 +1,17 @@ +{2} 'c. +{2} ,xNMM. +{2} .OMMMMo +{2} OMMM0, +{2} .;loddo:' loolloddol;. +{2} cKMMMMMMMMMMNWMMMMMMMMMM0: +{3} .KMMMMMMMMMMMMMMMMMMMMMMMWd. +{3} XMMMMMMMMMMMMMMMMMMMMMMMX. +{1};MMMMMMMMMMMMMMMMMMMMMMMM: +{1}:MMMMMMMMMMMMMMMMMMMMMMMM: +{1}.MMMMMMMMMMMMMMMMMMMMMMMMX. +{1} kMMMMMMMMMMMMMMMMMMMMMMMMWd. +{5} .XMMMMMMMMMMMMMMMMMMMMMMMMMMk +{5} .XMMMMMMMMMMMMMMMMMMMMMMMMK. +{4} kMMMMMMMMMMMMMMMMMMMMMMd +{4} ;KMMMMMMMWXXWMMMMMMMk. +{4} .cooc,. .,coo:. diff --git a/welcome/logos/raspbian b/welcome/logos/raspbian new file mode 100644 index 0000000..c8e3d61 --- /dev/null +++ b/welcome/logos/raspbian @@ -0,0 +1,18 @@ +{2} .',;:cc;,'. .,;::c:,,. +{2} ,ooolcloooo: 'oooooccloo: +{2} .looooc;;:ol :oc;;:ooooo' +{2} ;oooooo: ,ooooooc. +{2} .,:;'. .;:;'. +{1} .dQ. .d0Q0Q0. '0Q. +{1} .0Q0' 'Q0Q0Q' 'Q0Q. +{1} '' .odo. .odo. '' +{1} . .0Q0Q0Q' .0Q0Q0Q. . +{1} ,0Q .0Q0Q0Q0Q 'Q0Q0Q0b. 0Q. +{1} :Q0 Q0Q0Q0Q 'Q0Q0Q0 Q0' +{1} '0 '0Q0' .0Q0. '0' 'Q' +{1} .oo. .0Q0Q0. .oo. +{1} 'Q0Q0. '0Q0Q0Q0. .Q0Q0b +{1} 'Q0Q0. '0Q0Q0' .d0Q0Q' +{1} 'Q0Q' .. '0Q.' +{1} .0Q0Q0Q. +{1} '0Q0Q' diff --git a/welcome/logos/ubuntu b/welcome/logos/ubuntu new file mode 100644 index 0000000..d8f1651 --- /dev/null +++ b/welcome/logos/ubuntu @@ -0,0 +1,20 @@ +{1} .-/+oossssoo+/-. +{1} `:+ssssssssssssssssss+:` +{1} -+ssssssssssssssssssyyssss+- +{1} .ossssssssssssssssss{7}dMMMNy{1}sssso. +{1} /sssssssssss{7}hdmmNNmmyNMMMMh{1}ssssss/ +{1} +sssssssss{7}hm{1}yd{7}MMMMMMMNddddy{1}ssssssss+ +{1} /ssssssss{7}hNMMM{1}yh{7}hyyyyhmNMMMNh{1}ssssssss/ +{1}.ssssssss{7}dMMMNh{1}ssssssssss{7}hNMMMd{1}ssssssss. +{1}+ssss{7}hhhyNMMNy{1}ssssssssssss{7}yNMMMy{1}sssssss+ +{1}oss{7}yNMMMNyMMh{1}ssssssssssssss{7}hmmmh{1}ssssssso +{1}oss{7}yNMMMNyMMh{1}sssssssssssssshmmmh{1}ssssssso +{1}+ssss{7}hhhyNMMNy{1}ssssssssssss{7}yNMMMy{1}sssssss+ +{1}.ssssssss{7}dMMMNh{1}ssssssssss{7}hNMMMd{1}ssssssss. +{1} /ssssssss{7}hNMMM{1}yh{7}hyyyyhdNMMMNh{1}ssssssss/ +{1} +sssssssss{7}dm{1}yd{7}MMMMMMMMddddy{1}ssssssss+ +{1} /sssssssssss{7}hdmNNNNmyNMMMMh{1}ssssss/ +{1} .ossssssssssssssssss{7}dMMMNy{1}sssso. +{1} -+sssssssssssssssss{7}yyy{1}ssss+- +{1} `:+ssssssssssssssssss+:` +{1} .-/+oossssoo+/-. diff --git a/welcome/main.py b/welcome/main.py new file mode 100644 index 0000000..8c789a4 --- /dev/null +++ b/welcome/main.py @@ -0,0 +1,235 @@ +import os +import platform +import socket +from datetime import datetime, timedelta +import re +from getpass import getuser +from colorama import Fore, Back, Style, ansi +import psutil + +COLORS = [ansi.code_to_chars(30 + color_index) for color_index in range(0, 8)] + + +def colored(string, *colors): + return ''.join(colors + (string, Style.RESET_ALL)) + + +def bright_colored(string, *colors): + return ''.join(colors + (Style.BRIGHT, string, Style.RESET_ALL)) + + +def format_timedelta(timedelta): + result = [] + + days = timedelta.days + mm, ss = divmod(timedelta.seconds, 60) + hh, mm = divmod(mm, 60) + + def plural(n): + return n, 's' if abs(n) != 1 else '' + + if days > 0: + result.append('%d day%s' % plural(days)) + if hh > 0 or len(result) > 0: + result.append('%d hour%s' % plural(hh)) + if mm > 0 or len(result) > 0: + result.append('%d min%s' % plural(mm)) + if len(result) <= 1: + result.append('%d sec%s' % plural(ss)) + + return ', '.join(result) + + +def humanize_bytes(bytes): + units = ['B', 'kB', 'MB', 'GB'] + + factor = 1 + for unit in units: + next_factor = factor << 10 + if bytes < next_factor: + break + factor = next_factor + + return '%.2f %s' % (float(bytes) / factor, unit) + + +def colorize_percent(percent, warning, critical, inverse=False): + COLORS = [Fore.GREEN, Fore.YELLOW, Fore.RED] + + color_index = 0 if percent < warning else 1 if percent < critical else 2 + if inverse: + color_index = 2 - color_index + + return colored('%.2f%%' % percent, COLORS[color_index]) + + +def get_hostname(): + hostname = socket.gethostname() + local_ip = socket.gethostbyname(hostname) + return hostname, local_ip + + +def uptime(): + return datetime.now() - datetime.fromtimestamp(psutil.boot_time()) + + +def users(): + users = {} + + for user in psutil.users(): + name = user.name + terminal = user.terminal + if name in users: + users[name].append(terminal) + else: + users[name] = [terminal] + + result = [] + + for name in users: + terminals = users[name] + + colored_name = bright_colored(name, Fore.BLUE) + colored_terminals = [ + colored(term, Style.BRIGHT, Fore.BLACK) for term in terminals + ] + + terminals_str = ', '.join(colored_terminals) + if len(colored_terminals) > 1: + terminals_str = '(%s)' % terminals_str + result.append(colored_name + '@' + terminals_str) + + return ', '.join(result) + + +def shell(): + return os.environ['SHELL'] + + +def cpu_usage(): + percent = psutil.cpu_percent() + + return colorize_percent(percent, warning=60, critical=80) + + +def memory(): + memory = psutil.virtual_memory() + return (humanize_bytes(memory.used), humanize_bytes(memory.total), + colorize_percent(memory.percent, warning=60, critical=80)) + + +def disks(): + result = [] + for disk in psutil.disk_partitions(all=False): + if psutil.WINDOWS and ('cdrom' in disk.opts or disk.fstype == ''): + # skip cd-rom drives with no disk in it on Windows; they may raise ENOENT, + # pop-up a Windows GUI error for a non-ready partition or just hang + continue + + usage = psutil.disk_usage(disk.mountpoint) + result.append((disk.mountpoint, humanize_bytes(usage.used), + humanize_bytes(usage.total), + colorize_percent(usage.percent, warning=70, critical=85))) + return result + + +def battery(): + battery = psutil.sensors_battery() + percent = battery.percent + + if battery.power_plugged: + status = 'charging' if percent < 100 else 'fully charged' + else: + status = '%s left' % format_timedelta(timedelta(seconds=battery.secsleft)) + + return colorize_percent( + percent, critical=10, warning=20, inverse=True), status + + +def get_distro_info(): + if psutil.WINDOWS: + return 'windows', platform.system(), platform.release(), '' + elif psutil.LINUX: + import distro + return distro.id(), distro.name(), distro.version(), distro.codename() + elif psutil.OSX: + from plistlib import readPlist + sw_vers = readPlist('/System/Library/CoreServices/SystemVersion.plist') + return 'mac', sw_vers['ProductName'], sw_vers['ProductVersion'], '' + else: + raise NotImplementedError('unsupported OS') + + +def get_system_info(): + info_lines = [] + + def info(name, value, *format_args): + line = colored(name + ':', Style.BRIGHT, Fore.YELLOW) + ' ' + value + if len(format_args) > 0: + line = line % format_args + info_lines.append(line) + + username = getuser() + hostname, local_ip = get_hostname() + + info_lines.append( + bright_colored(username, Fore.BLUE) + '@' + + bright_colored(hostname, Fore.RED)) + info_lines.append('') + + distro_id, distro_name, distro_version, distro_codename = get_distro_info() + info('OS', ' '.join([distro_name, distro_version, distro_codename])) + + logo_path = os.path.join(os.path.dirname(__file__), 'logos', distro_id) + with open(logo_path) as logo_file: + logo_lines = logo_file.read().splitlines() + + info('Kernel', '%s %s', platform.system(), platform.release()) + + info('Uptime', format_timedelta(uptime())) + info('Users', users()) + info('Shell', shell()) + info('IP address', local_ip) + + info_lines.append('') + + info('CPU Usage', '%s', cpu_usage()) + info('Memory', '%s / %s (%s)', *memory()) + + for disk_info in disks(): + info('Disk (%s)', '%s / %s (%s)', *disk_info) + + if hasattr(psutil, 'sensors_battery'): + info('Battery', '%s (%s)', *battery()) + + return logo_lines, info_lines + + +print('') + +logo_lines, info_lines = get_system_info() +logo_line_widths = [len(re.sub(r'{\d}', '', line)) for line in logo_lines] +logo_width = max(logo_line_widths) + +for line_index in range(0, max(len(logo_lines), len(info_lines))): + line = '' + + logo_line_width = 0 + + if line_index < len(logo_lines): + logo_line = logo_lines[line_index] + logo_line_width = logo_line_widths[line_index] + + line += Style.BRIGHT + line += logo_line.format(*COLORS) + line += Style.RESET_ALL + + line += ' ' * (logo_width - logo_line_width + 3) + + if line_index < len(info_lines): + info_line = info_lines[line_index] + line += info_line + + print(line) + +print('') diff --git a/zlogin b/zlogin deleted file mode 100755 index 8441a36..0000000 --- a/zlogin +++ /dev/null @@ -1 +0,0 @@ -#!/usr/bin/env zsh diff --git a/zshrc b/zshrc index 1986a35..9fc810e 100755 --- a/zshrc +++ b/zshrc @@ -15,10 +15,12 @@ find_dotfiles_dir() { find_dotfiles_dir for script in functions path exports aliases oh-my-zsh widgets; do - source "${DOTFILES_DIR}/lib/${script}.zsh" + source "$DOTFILES_DIR/lib/$script.zsh" done source_if_exists "$ZSH/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh" run_before rbenv 'eval "$(rbenv init -)"' run_before sdk 'source_if_exists "$SDKMAN_DIR/bin/sdkman-init.sh"' run_before yarn 'source_if_exists "$(yarn global dir)/node_modules/tabtab/.completions/yarn.zsh"' + +python "$DOTFILES_DIR/welcome/main.py" From 202f5afc3fc58256fab2d9f6bac305450e0a12b1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 8 Aug 2018 11:39:04 +0300 Subject: [PATCH 023/713] [welcome] fix crash on missing battery --- welcome/main.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/welcome/main.py b/welcome/main.py index 8c789a4..43a834b 100644 --- a/welcome/main.py +++ b/welcome/main.py @@ -134,7 +134,18 @@ def disks(): def battery(): - battery = psutil.sensors_battery() + if not hasattr(psutil, 'sensors_battery'): + return None + + try: + battery = psutil.sensors_battery() + except Exception as e: + print(e) + return None + + if battery is None: + return None + percent = battery.percent if battery.power_plugged: @@ -199,8 +210,9 @@ def get_system_info(): for disk_info in disks(): info('Disk (%s)', '%s / %s (%s)', *disk_info) - if hasattr(psutil, 'sensors_battery'): - info('Battery', '%s (%s)', *battery()) + battery_info = battery() + if battery_info is not None: + info('Battery', '%s (%s)', *battery_info) return logo_lines, info_lines From 9eb971416ade761b085d354c0f31d3b33df50c47 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 8 Aug 2018 12:08:22 +0300 Subject: [PATCH 024/713] [welcome] add android support --- welcome/main.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/welcome/main.py b/welcome/main.py index 43a834b..0220328 100644 --- a/welcome/main.py +++ b/welcome/main.py @@ -157,16 +157,24 @@ def battery(): percent, critical=10, warning=20, inverse=True), status +def is_android(): + return os.path.isdir('/system/app') and os.path.isdir('/system/priv-app') + + def get_distro_info(): if psutil.WINDOWS: return 'windows', platform.system(), platform.release(), '' - elif psutil.LINUX: - import distro - return distro.id(), distro.name(), distro.version(), distro.codename() elif psutil.OSX: from plistlib import readPlist sw_vers = readPlist('/System/Library/CoreServices/SystemVersion.plist') return 'mac', sw_vers['ProductName'], sw_vers['ProductVersion'], '' + elif is_android(): + from subprocess import check_output + android_version = check_output(['getprop', 'ro.build.version.release']) + return 'android', 'Android', android_version.decode().strip(), '' + elif psutil.LINUX: + import distro + return distro.id(), distro.name(), distro.version(), distro.codename() else: raise NotImplementedError('unsupported OS') From 1607eaca4fd45123d8fb504898fdf83b4c5ce49e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 8 Aug 2018 12:44:35 +0300 Subject: [PATCH 025/713] [welcome] refactor 'is empty' checks --- welcome/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/welcome/main.py b/welcome/main.py index 0220328..0790178 100644 --- a/welcome/main.py +++ b/welcome/main.py @@ -30,9 +30,9 @@ def format_timedelta(timedelta): if days > 0: result.append('%d day%s' % plural(days)) - if hh > 0 or len(result) > 0: + if hh > 0 or result: result.append('%d hour%s' % plural(hh)) - if mm > 0 or len(result) > 0: + if mm > 0 or result: result.append('%d min%s' % plural(mm)) if len(result) <= 1: result.append('%d sec%s' % plural(ss)) @@ -184,7 +184,7 @@ def get_system_info(): def info(name, value, *format_args): line = colored(name + ':', Style.BRIGHT, Fore.YELLOW) + ' ' + value - if len(format_args) > 0: + if format_args: line = line % format_args info_lines.append(line) From 5698aa29a08eaec6aa12cbf72f6ca758ccc4c639 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 8 Aug 2018 12:46:32 +0300 Subject: [PATCH 026/713] [welcome] add users check --- welcome/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/welcome/main.py b/welcome/main.py index 0790178..32d4964 100644 --- a/welcome/main.py +++ b/welcome/main.py @@ -206,8 +206,13 @@ def get_system_info(): info('Kernel', '%s %s', platform.system(), platform.release()) info('Uptime', format_timedelta(uptime())) - info('Users', users()) + + users_info = users() + if users_info: + info('Users', users_info) + info('Shell', shell()) + info('IP address', local_ip) info_lines.append('') From 3b2f56fa65a2396fa5b90ec66b7aa2a27c74d038 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 8 Aug 2018 21:16:26 +0300 Subject: [PATCH 027/713] [welcome] format with black --- welcome/main.py | 315 +++++++++++++++++++++++++----------------------- 1 file changed, 163 insertions(+), 152 deletions(-) diff --git a/welcome/main.py b/welcome/main.py index 32d4964..971cddc 100644 --- a/welcome/main.py +++ b/welcome/main.py @@ -11,250 +11,261 @@ COLORS = [ansi.code_to_chars(30 + color_index) for color_index in range(0, 8)] def colored(string, *colors): - return ''.join(colors + (string, Style.RESET_ALL)) + return "".join(colors + (string, Style.RESET_ALL)) def bright_colored(string, *colors): - return ''.join(colors + (Style.BRIGHT, string, Style.RESET_ALL)) + return "".join(colors + (Style.BRIGHT, string, Style.RESET_ALL)) def format_timedelta(timedelta): - result = [] + result = [] - days = timedelta.days - mm, ss = divmod(timedelta.seconds, 60) - hh, mm = divmod(mm, 60) + days = timedelta.days + mm, ss = divmod(timedelta.seconds, 60) + hh, mm = divmod(mm, 60) - def plural(n): - return n, 's' if abs(n) != 1 else '' + def plural(n): + return n, "s" if abs(n) != 1 else "" - if days > 0: - result.append('%d day%s' % plural(days)) - if hh > 0 or result: - result.append('%d hour%s' % plural(hh)) - if mm > 0 or result: - result.append('%d min%s' % plural(mm)) - if len(result) <= 1: - result.append('%d sec%s' % plural(ss)) + if days > 0: + result.append("%d day%s" % plural(days)) + if hh > 0 or result: + result.append("%d hour%s" % plural(hh)) + if mm > 0 or result: + result.append("%d min%s" % plural(mm)) + if len(result) <= 1: + result.append("%d sec%s" % plural(ss)) - return ', '.join(result) + return ", ".join(result) def humanize_bytes(bytes): - units = ['B', 'kB', 'MB', 'GB'] + units = ["B", "kB", "MB", "GB"] - factor = 1 - for unit in units: - next_factor = factor << 10 - if bytes < next_factor: - break - factor = next_factor + factor = 1 + for unit in units: + next_factor = factor << 10 + if bytes < next_factor: + break + factor = next_factor - return '%.2f %s' % (float(bytes) / factor, unit) + return "%.2f %s" % (float(bytes) / factor, unit) def colorize_percent(percent, warning, critical, inverse=False): - COLORS = [Fore.GREEN, Fore.YELLOW, Fore.RED] + COLORS = [Fore.GREEN, Fore.YELLOW, Fore.RED] - color_index = 0 if percent < warning else 1 if percent < critical else 2 - if inverse: - color_index = 2 - color_index + color_index = 0 if percent < warning else 1 if percent < critical else 2 + if inverse: + color_index = 2 - color_index - return colored('%.2f%%' % percent, COLORS[color_index]) + return colored("%.2f%%" % percent, COLORS[color_index]) def get_hostname(): - hostname = socket.gethostname() - local_ip = socket.gethostbyname(hostname) - return hostname, local_ip + hostname = socket.gethostname() + local_ip = socket.gethostbyname(hostname) + return hostname, local_ip def uptime(): - return datetime.now() - datetime.fromtimestamp(psutil.boot_time()) + return datetime.now() - datetime.fromtimestamp(psutil.boot_time()) def users(): - users = {} + users = {} - for user in psutil.users(): - name = user.name - terminal = user.terminal - if name in users: - users[name].append(terminal) - else: - users[name] = [terminal] + for user in psutil.users(): + name = user.name + terminal = user.terminal + if name in users: + users[name].append(terminal) + else: + users[name] = [terminal] - result = [] + result = [] - for name in users: - terminals = users[name] + for name in users: + terminals = users[name] - colored_name = bright_colored(name, Fore.BLUE) - colored_terminals = [ - colored(term, Style.BRIGHT, Fore.BLACK) for term in terminals - ] + colored_name = bright_colored(name, Fore.BLUE) + colored_terminals = [ + colored(term, Style.BRIGHT, Fore.BLACK) for term in terminals + ] - terminals_str = ', '.join(colored_terminals) - if len(colored_terminals) > 1: - terminals_str = '(%s)' % terminals_str - result.append(colored_name + '@' + terminals_str) + terminals_str = ", ".join(colored_terminals) + if len(colored_terminals) > 1: + terminals_str = "(%s)" % terminals_str + result.append(colored_name + "@" + terminals_str) - return ', '.join(result) + return ", ".join(result) def shell(): - return os.environ['SHELL'] + return os.environ["SHELL"] def cpu_usage(): - percent = psutil.cpu_percent() + percent = psutil.cpu_percent() - return colorize_percent(percent, warning=60, critical=80) + return colorize_percent(percent, warning=60, critical=80) def memory(): - memory = psutil.virtual_memory() - return (humanize_bytes(memory.used), humanize_bytes(memory.total), - colorize_percent(memory.percent, warning=60, critical=80)) + memory = psutil.virtual_memory() + return ( + humanize_bytes(memory.used), + humanize_bytes(memory.total), + colorize_percent(memory.percent, warning=60, critical=80), + ) def disks(): - result = [] - for disk in psutil.disk_partitions(all=False): - if psutil.WINDOWS and ('cdrom' in disk.opts or disk.fstype == ''): - # skip cd-rom drives with no disk in it on Windows; they may raise ENOENT, - # pop-up a Windows GUI error for a non-ready partition or just hang - continue + result = [] + for disk in psutil.disk_partitions(all=False): + if psutil.WINDOWS and ("cdrom" in disk.opts or disk.fstype == ""): + # skip cd-rom drives with no disk in it on Windows; they may raise ENOENT, + # pop-up a Windows GUI error for a non-ready partition or just hang + continue - usage = psutil.disk_usage(disk.mountpoint) - result.append((disk.mountpoint, humanize_bytes(usage.used), - humanize_bytes(usage.total), - colorize_percent(usage.percent, warning=70, critical=85))) - return result + usage = psutil.disk_usage(disk.mountpoint) + result.append( + ( + disk.mountpoint, + humanize_bytes(usage.used), + humanize_bytes(usage.total), + colorize_percent(usage.percent, warning=70, critical=85), + ) + ) + return result def battery(): - if not hasattr(psutil, 'sensors_battery'): - return None + if not hasattr(psutil, "sensors_battery"): + return None - try: - battery = psutil.sensors_battery() - except Exception as e: - print(e) - return None + try: + battery = psutil.sensors_battery() + except Exception as e: + print(e) + return None - if battery is None: - return None + if battery is None: + return None - percent = battery.percent + percent = battery.percent - if battery.power_plugged: - status = 'charging' if percent < 100 else 'fully charged' - else: - status = '%s left' % format_timedelta(timedelta(seconds=battery.secsleft)) + if battery.power_plugged: + status = "charging" if percent < 100 else "fully charged" + else: + status = "%s left" % format_timedelta(timedelta(seconds=battery.secsleft)) - return colorize_percent( - percent, critical=10, warning=20, inverse=True), status + return colorize_percent(percent, critical=10, warning=20, inverse=True), status def is_android(): - return os.path.isdir('/system/app') and os.path.isdir('/system/priv-app') + return os.path.isdir("/system/app") and os.path.isdir("/system/priv-app") def get_distro_info(): - if psutil.WINDOWS: - return 'windows', platform.system(), platform.release(), '' - elif psutil.OSX: - from plistlib import readPlist - sw_vers = readPlist('/System/Library/CoreServices/SystemVersion.plist') - return 'mac', sw_vers['ProductName'], sw_vers['ProductVersion'], '' - elif is_android(): - from subprocess import check_output - android_version = check_output(['getprop', 'ro.build.version.release']) - return 'android', 'Android', android_version.decode().strip(), '' - elif psutil.LINUX: - import distro - return distro.id(), distro.name(), distro.version(), distro.codename() - else: - raise NotImplementedError('unsupported OS') + if psutil.WINDOWS: + return "windows", platform.system(), platform.release(), "" + elif psutil.OSX: + from plistlib import readPlist + + sw_vers = readPlist("/System/Library/CoreServices/SystemVersion.plist") + return "mac", sw_vers["ProductName"], sw_vers["ProductVersion"], "" + elif is_android(): + from subprocess import check_output + + android_version = check_output(["getprop", "ro.build.version.release"]) + return "android", "Android", android_version.decode().strip(), "" + elif psutil.LINUX: + import distro + + return distro.id(), distro.name(), distro.version(), distro.codename() + else: + raise NotImplementedError("unsupported OS") def get_system_info(): - info_lines = [] + info_lines = [] - def info(name, value, *format_args): - line = colored(name + ':', Style.BRIGHT, Fore.YELLOW) + ' ' + value - if format_args: - line = line % format_args - info_lines.append(line) + def info(name, value, *format_args): + line = colored(name + ":", Style.BRIGHT, Fore.YELLOW) + " " + value + if format_args: + line = line % format_args + info_lines.append(line) - username = getuser() - hostname, local_ip = get_hostname() + username = getuser() + hostname, local_ip = get_hostname() - info_lines.append( - bright_colored(username, Fore.BLUE) + '@' + - bright_colored(hostname, Fore.RED)) - info_lines.append('') + info_lines.append( + bright_colored(username, Fore.BLUE) + "@" + bright_colored(hostname, Fore.RED) + ) + info_lines.append("") - distro_id, distro_name, distro_version, distro_codename = get_distro_info() - info('OS', ' '.join([distro_name, distro_version, distro_codename])) + distro_id, distro_name, distro_version, distro_codename = get_distro_info() + info("OS", " ".join([distro_name, distro_version, distro_codename])) - logo_path = os.path.join(os.path.dirname(__file__), 'logos', distro_id) - with open(logo_path) as logo_file: - logo_lines = logo_file.read().splitlines() + logo_path = os.path.join(os.path.dirname(__file__), "logos", distro_id) + with open(logo_path) as logo_file: + logo_lines = logo_file.read().splitlines() - info('Kernel', '%s %s', platform.system(), platform.release()) + info("Kernel", "%s %s", platform.system(), platform.release()) - info('Uptime', format_timedelta(uptime())) + info("Uptime", format_timedelta(uptime())) - users_info = users() - if users_info: - info('Users', users_info) + users_info = users() + if users_info: + info("Users", users_info) - info('Shell', shell()) + info("Shell", shell()) - info('IP address', local_ip) + info("IP address", local_ip) - info_lines.append('') + info_lines.append("") - info('CPU Usage', '%s', cpu_usage()) - info('Memory', '%s / %s (%s)', *memory()) + info("CPU Usage", "%s", cpu_usage()) + info("Memory", "%s / %s (%s)", *memory()) - for disk_info in disks(): - info('Disk (%s)', '%s / %s (%s)', *disk_info) + for disk_info in disks(): + info("Disk (%s)", "%s / %s (%s)", *disk_info) - battery_info = battery() - if battery_info is not None: - info('Battery', '%s (%s)', *battery_info) + battery_info = battery() + if battery_info is not None: + info("Battery", "%s (%s)", *battery_info) - return logo_lines, info_lines + return logo_lines, info_lines -print('') +print("") logo_lines, info_lines = get_system_info() -logo_line_widths = [len(re.sub(r'{\d}', '', line)) for line in logo_lines] +logo_line_widths = [len(re.sub(r"{\d}", "", line)) for line in logo_lines] logo_width = max(logo_line_widths) for line_index in range(0, max(len(logo_lines), len(info_lines))): - line = '' + line = "" - logo_line_width = 0 + logo_line_width = 0 - if line_index < len(logo_lines): - logo_line = logo_lines[line_index] - logo_line_width = logo_line_widths[line_index] + if line_index < len(logo_lines): + logo_line = logo_lines[line_index] + logo_line_width = logo_line_widths[line_index] - line += Style.BRIGHT - line += logo_line.format(*COLORS) - line += Style.RESET_ALL + line += Style.BRIGHT + line += logo_line.format(*COLORS) + line += Style.RESET_ALL - line += ' ' * (logo_width - logo_line_width + 3) + line += " " * (logo_width - logo_line_width + 3) - if line_index < len(info_lines): - info_line = info_lines[line_index] - line += info_line + if line_index < len(info_lines): + info_line = info_lines[line_index] + line += info_line - print(line) + print(line) + +print("") -print('') From 190c04cb4b366ea518eeb807026c017aa9962f20 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 8 Aug 2018 23:08:05 +0300 Subject: [PATCH 028/713] [welcome] apply flake8's hints --- welcome/main.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/welcome/main.py b/welcome/main.py index 971cddc..f4192a5 100644 --- a/welcome/main.py +++ b/welcome/main.py @@ -1,11 +1,12 @@ import os import platform +import re import socket from datetime import datetime, timedelta -import re from getpass import getuser -from colorama import Fore, Back, Style, ansi + import psutil +from colorama import Fore, Style, ansi COLORS = [ansi.code_to_chars(30 + color_index) for color_index in range(0, 8)] @@ -44,13 +45,13 @@ def humanize_bytes(bytes): units = ["B", "kB", "MB", "GB"] factor = 1 - for unit in units: + for _unit in units: next_factor = factor << 10 if bytes < next_factor: break factor = next_factor - return "%.2f %s" % (float(bytes) / factor, unit) + return "%.2f %s" % (float(bytes) / factor, _unit) def colorize_percent(percent, warning, critical, inverse=False): @@ -125,8 +126,9 @@ def disks(): result = [] for disk in psutil.disk_partitions(all=False): if psutil.WINDOWS and ("cdrom" in disk.opts or disk.fstype == ""): - # skip cd-rom drives with no disk in it on Windows; they may raise ENOENT, - # pop-up a Windows GUI error for a non-ready partition or just hang + # skip cd-rom drives with no disk in it on Windows; they may raise + # ENOENT, pop-up a Windows GUI error for a non-ready partition or + # just hang continue usage = psutil.disk_usage(disk.mountpoint) @@ -185,8 +187,8 @@ def get_distro_info(): import distro return distro.id(), distro.name(), distro.version(), distro.codename() - else: - raise NotImplementedError("unsupported OS") + + raise NotImplementedError("unsupported OS") def get_system_info(): @@ -268,4 +270,3 @@ for line_index in range(0, max(len(logo_lines), len(info_lines))): print(line) print("") - From 82b6f6b5fd68d6c05fc535e6d166f9031b8f0fc7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 9 Aug 2018 13:35:09 +0300 Subject: [PATCH 029/713] [welcome] split into multiple modules --- welcome/.gitignore | 1 + welcome/colors.py | 21 ++++ welcome/humanize.py | 33 ++++++ welcome/main.py | 243 +---------------------------------------- welcome/system_info.py | 186 +++++++++++++++++++++++++++++++ 5 files changed, 243 insertions(+), 241 deletions(-) create mode 100644 welcome/.gitignore create mode 100644 welcome/colors.py create mode 100644 welcome/humanize.py create mode 100644 welcome/system_info.py diff --git a/welcome/.gitignore b/welcome/.gitignore new file mode 100644 index 0000000..0d20b64 --- /dev/null +++ b/welcome/.gitignore @@ -0,0 +1 @@ +*.pyc diff --git a/welcome/colors.py b/welcome/colors.py new file mode 100644 index 0000000..b32d782 --- /dev/null +++ b/welcome/colors.py @@ -0,0 +1,21 @@ +from colorama import Fore, Style, ansi + +COLORS = [ansi.code_to_chars(30 + color_index) for color_index in range(0, 8)] + + +def colored(string, *colors): + return "".join(colors + (string, Style.RESET_ALL)) + + +def bright_colored(string, *colors): + return "".join(colors + (Style.BRIGHT, string, Style.RESET_ALL)) + + +def colorize_percent(percent, warning, critical, inverse=False): + COLORS = [Fore.GREEN, Fore.YELLOW, Fore.RED] + + color_index = 0 if percent < warning else 1 if percent < critical else 2 + if inverse: + color_index = 2 - color_index + + return colored("%.2f%%" % percent, COLORS[color_index]) diff --git a/welcome/humanize.py b/welcome/humanize.py new file mode 100644 index 0000000..7c5ae8d --- /dev/null +++ b/welcome/humanize.py @@ -0,0 +1,33 @@ +def humanize_timedelta(timedelta): + result = [] + + days = timedelta.days + mm, ss = divmod(timedelta.seconds, 60) + hh, mm = divmod(mm, 60) + + def plural(n): + return n, "s" if abs(n) != 1 else "" + + if days > 0: + result.append("%d day%s" % plural(days)) + if hh > 0 or result: + result.append("%d hour%s" % plural(hh)) + if mm > 0 or result: + result.append("%d min%s" % plural(mm)) + if len(result) <= 1: + result.append("%d sec%s" % plural(ss)) + + return ", ".join(result) + + +def humanize_bytes(bytes): + units = ["B", "kB", "MB", "GB"] + + factor = 1 + for _unit in units: + next_factor = factor << 10 + if bytes < next_factor: + break + factor = next_factor + + return "%.2f %s" % (float(bytes) / factor, _unit) diff --git a/welcome/main.py b/welcome/main.py index f4192a5..c9ff6e0 100644 --- a/welcome/main.py +++ b/welcome/main.py @@ -1,246 +1,7 @@ -import os -import platform import re -import socket -from datetime import datetime, timedelta -from getpass import getuser - -import psutil -from colorama import Fore, Style, ansi - -COLORS = [ansi.code_to_chars(30 + color_index) for color_index in range(0, 8)] - - -def colored(string, *colors): - return "".join(colors + (string, Style.RESET_ALL)) - - -def bright_colored(string, *colors): - return "".join(colors + (Style.BRIGHT, string, Style.RESET_ALL)) - - -def format_timedelta(timedelta): - result = [] - - days = timedelta.days - mm, ss = divmod(timedelta.seconds, 60) - hh, mm = divmod(mm, 60) - - def plural(n): - return n, "s" if abs(n) != 1 else "" - - if days > 0: - result.append("%d day%s" % plural(days)) - if hh > 0 or result: - result.append("%d hour%s" % plural(hh)) - if mm > 0 or result: - result.append("%d min%s" % plural(mm)) - if len(result) <= 1: - result.append("%d sec%s" % plural(ss)) - - return ", ".join(result) - - -def humanize_bytes(bytes): - units = ["B", "kB", "MB", "GB"] - - factor = 1 - for _unit in units: - next_factor = factor << 10 - if bytes < next_factor: - break - factor = next_factor - - return "%.2f %s" % (float(bytes) / factor, _unit) - - -def colorize_percent(percent, warning, critical, inverse=False): - COLORS = [Fore.GREEN, Fore.YELLOW, Fore.RED] - - color_index = 0 if percent < warning else 1 if percent < critical else 2 - if inverse: - color_index = 2 - color_index - - return colored("%.2f%%" % percent, COLORS[color_index]) - - -def get_hostname(): - hostname = socket.gethostname() - local_ip = socket.gethostbyname(hostname) - return hostname, local_ip - - -def uptime(): - return datetime.now() - datetime.fromtimestamp(psutil.boot_time()) - - -def users(): - users = {} - - for user in psutil.users(): - name = user.name - terminal = user.terminal - if name in users: - users[name].append(terminal) - else: - users[name] = [terminal] - - result = [] - - for name in users: - terminals = users[name] - - colored_name = bright_colored(name, Fore.BLUE) - colored_terminals = [ - colored(term, Style.BRIGHT, Fore.BLACK) for term in terminals - ] - - terminals_str = ", ".join(colored_terminals) - if len(colored_terminals) > 1: - terminals_str = "(%s)" % terminals_str - result.append(colored_name + "@" + terminals_str) - - return ", ".join(result) - - -def shell(): - return os.environ["SHELL"] - - -def cpu_usage(): - percent = psutil.cpu_percent() - - return colorize_percent(percent, warning=60, critical=80) - - -def memory(): - memory = psutil.virtual_memory() - return ( - humanize_bytes(memory.used), - humanize_bytes(memory.total), - colorize_percent(memory.percent, warning=60, critical=80), - ) - - -def disks(): - result = [] - for disk in psutil.disk_partitions(all=False): - if psutil.WINDOWS and ("cdrom" in disk.opts or disk.fstype == ""): - # skip cd-rom drives with no disk in it on Windows; they may raise - # ENOENT, pop-up a Windows GUI error for a non-ready partition or - # just hang - continue - - usage = psutil.disk_usage(disk.mountpoint) - result.append( - ( - disk.mountpoint, - humanize_bytes(usage.used), - humanize_bytes(usage.total), - colorize_percent(usage.percent, warning=70, critical=85), - ) - ) - return result - - -def battery(): - if not hasattr(psutil, "sensors_battery"): - return None - - try: - battery = psutil.sensors_battery() - except Exception as e: - print(e) - return None - - if battery is None: - return None - - percent = battery.percent - - if battery.power_plugged: - status = "charging" if percent < 100 else "fully charged" - else: - status = "%s left" % format_timedelta(timedelta(seconds=battery.secsleft)) - - return colorize_percent(percent, critical=10, warning=20, inverse=True), status - - -def is_android(): - return os.path.isdir("/system/app") and os.path.isdir("/system/priv-app") - - -def get_distro_info(): - if psutil.WINDOWS: - return "windows", platform.system(), platform.release(), "" - elif psutil.OSX: - from plistlib import readPlist - - sw_vers = readPlist("/System/Library/CoreServices/SystemVersion.plist") - return "mac", sw_vers["ProductName"], sw_vers["ProductVersion"], "" - elif is_android(): - from subprocess import check_output - - android_version = check_output(["getprop", "ro.build.version.release"]) - return "android", "Android", android_version.decode().strip(), "" - elif psutil.LINUX: - import distro - - return distro.id(), distro.name(), distro.version(), distro.codename() - - raise NotImplementedError("unsupported OS") - - -def get_system_info(): - info_lines = [] - - def info(name, value, *format_args): - line = colored(name + ":", Style.BRIGHT, Fore.YELLOW) + " " + value - if format_args: - line = line % format_args - info_lines.append(line) - - username = getuser() - hostname, local_ip = get_hostname() - - info_lines.append( - bright_colored(username, Fore.BLUE) + "@" + bright_colored(hostname, Fore.RED) - ) - info_lines.append("") - - distro_id, distro_name, distro_version, distro_codename = get_distro_info() - info("OS", " ".join([distro_name, distro_version, distro_codename])) - - logo_path = os.path.join(os.path.dirname(__file__), "logos", distro_id) - with open(logo_path) as logo_file: - logo_lines = logo_file.read().splitlines() - - info("Kernel", "%s %s", platform.system(), platform.release()) - - info("Uptime", format_timedelta(uptime())) - - users_info = users() - if users_info: - info("Users", users_info) - - info("Shell", shell()) - - info("IP address", local_ip) - - info_lines.append("") - - info("CPU Usage", "%s", cpu_usage()) - info("Memory", "%s / %s (%s)", *memory()) - - for disk_info in disks(): - info("Disk (%s)", "%s / %s (%s)", *disk_info) - - battery_info = battery() - if battery_info is not None: - info("Battery", "%s (%s)", *battery_info) - - return logo_lines, info_lines +from colors import Style, COLORS +from system_info import get_system_info print("") diff --git a/welcome/system_info.py b/welcome/system_info.py new file mode 100644 index 0000000..771199d --- /dev/null +++ b/welcome/system_info.py @@ -0,0 +1,186 @@ +import os +import platform +import socket +from datetime import datetime, timedelta +from getpass import getuser + +import psutil + +from colors import Fore, Style, bright_colored, colored, colorize_percent +from humanize import humanize_bytes, humanize_timedelta + + +def get_system_info(): + info_lines = [] + + def info(name, value, *format_args): + line = colored(name + ":", Style.BRIGHT, Fore.YELLOW) + " " + value + if format_args: + line = line % format_args + info_lines.append(line) + + username = getuser() + hostname, local_ip = _get_hostname() + + info_lines.append( + bright_colored(username, Fore.BLUE) + "@" + bright_colored(hostname, Fore.RED) + ) + info_lines.append("") + + distro_id, distro_name, distro_version, distro_codename = _get_distro_info() + info("OS", " ".join([distro_name, distro_version, distro_codename])) + + logo_path = os.path.join(os.path.dirname(__file__), "logos", distro_id) + with open(logo_path) as logo_file: + logo_lines = logo_file.read().splitlines() + + info("Kernel", "%s %s", platform.system(), platform.release()) + + info("Uptime", humanize_timedelta(_get_uptime())) + + users_info = _get_users() + if users_info: + info("Users", users_info) + + info("Shell", _get_shell()) + + info("IP address", local_ip) + + info_lines.append("") + + info("CPU Usage", "%s", _get_cpu_usage()) + info("Memory", "%s / %s (%s)", *_get_memory()) + + for disk_info in _get_disks(): + info("Disk (%s)", "%s / %s (%s)", *disk_info) + + battery_info = _get_battery() + if battery_info is not None: + info("Battery", "%s (%s)", *battery_info) + + return logo_lines, info_lines + + +def _get_hostname(): + hostname = socket.gethostname() + local_ip = socket.gethostbyname(hostname) + return hostname, local_ip + + +def _get_uptime(): + return datetime.now() - datetime.fromtimestamp(psutil.boot_time()) + + +def _get_users(): + users = {} + + for user in psutil.users(): + name = user.name + terminal = user.terminal + if name in users: + users[name].append(terminal) + else: + users[name] = [terminal] + + result = [] + + for name in users: + terminals = users[name] + + colored_name = bright_colored(name, Fore.BLUE) + colored_terminals = [ + colored(term, Style.BRIGHT, Fore.BLACK) for term in terminals + ] + + terminals_str = ", ".join(colored_terminals) + if len(colored_terminals) > 1: + terminals_str = "(%s)" % terminals_str + result.append(colored_name + "@" + terminals_str) + + return ", ".join(result) + + +def _get_shell(): + return os.environ["SHELL"] + + +def _get_cpu_usage(): + percent = psutil.cpu_percent() + + return colorize_percent(percent, warning=60, critical=80) + + +def _get_memory(): + memory = psutil.virtual_memory() + return ( + humanize_bytes(memory.used), + humanize_bytes(memory.total), + colorize_percent(memory.percent, warning=60, critical=80), + ) + + +def _get_disks(): + result = [] + for disk in psutil.disk_partitions(all=False): + if psutil.WINDOWS and ("cdrom" in disk.opts or disk.fstype == ""): + # skip cd-rom drives with no disk in it on Windows; they may raise + # ENOENT, pop-up a Windows GUI error for a non-ready partition or + # just hang + continue + + usage = psutil.disk_usage(disk.mountpoint) + result.append( + ( + disk.mountpoint, + humanize_bytes(usage.used), + humanize_bytes(usage.total), + colorize_percent(usage.percent, warning=70, critical=85), + ) + ) + return result + + +def _get_battery(): + if not hasattr(psutil, "sensors_battery"): + return None + + try: + battery = psutil.sensors_battery() + except Exception as e: + print(e) + return None + + if battery is None: + return None + + percent = battery.percent + if battery.power_plugged: + status = "charging" if percent < 100 else "fully charged" + else: + status = "%s left" % humanize_timedelta(timedelta(seconds=battery.secsleft)) + return colorize_percent(percent, critical=10, warning=20, inverse=True), status + + +def _get_distro_info(): + if psutil.WINDOWS: + return "windows", platform.system(), platform.release(), "" + elif psutil.OSX: + from plistlib import readPlist + + sw_vers = readPlist("/System/Library/CoreServices/SystemVersion.plist") + return "mac", sw_vers["ProductName"], sw_vers["ProductVersion"], "" + elif _is_android(): + from subprocess import check_output + + android_version = check_output(["getprop", "ro.build.version.release"]) + return "android", "Android", android_version.decode().strip(), "" + elif psutil.LINUX: + import distro + + return distro.id(), distro.name(), distro.version(), distro.codename() + + raise NotImplementedError("unsupported OS") + + +def _is_android(): + return os.path.isdir("/system/app") and os.path.isdir("/system/priv-app") From 09df7e7e391b1415b1c92b2318e0489a9df0a05d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 22 Aug 2018 22:39:20 +0200 Subject: [PATCH 030/713] [welcome] add debian logo --- welcome/logos/debian | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 welcome/logos/debian diff --git a/welcome/logos/debian b/welcome/logos/debian new file mode 100644 index 0000000..45f2dc2 --- /dev/null +++ b/welcome/logos/debian @@ -0,0 +1,17 @@ +{7} _,met$$$$$gg. +{7} ,g$$$$$$$$$$$$$$$P. +{7} ,g$$P" """Y$$.". +{7} ,$$P' `$$$. +{7}',$$P ,ggs. `$$b: +{7}`d$$' ,$P"' {1}.{7} $$$ +{7} $$P d$' {1},{7} $$P +{7} $$: $$. {1}-{7} ,d$$' +{7} $$; Y$b._ _,d$P' +{7} Y$$. {1}`.{7}`"Y$$$$P"' +{7} `$$b {1}"-.__ +{7} `Y$$ +{7} `Y$$. +{7} `$$b. +{7} `Y$$b. +{7} `"Y$b._ +{7} `""" From 0d5c7c6e07e7963954bee5fd1a21664bfae954a8 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 23 Aug 2018 11:40:09 +0200 Subject: [PATCH 031/713] change installation method --- install.sh | 18 +++++++++++++++--- lib/oh-my-zsh.zsh | 13 ++----------- zshrc | 32 ++++++++++++-------------------- 3 files changed, 29 insertions(+), 34 deletions(-) mode change 100644 => 100755 install.sh diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index 18ff9ee..97beb18 --- a/install.sh +++ b/install.sh @@ -1,5 +1,17 @@ #!/usr/bin/env bash -for script in {zhsrc,zlogin}.zsh; do - ln -sv "$script" ".$script" -done +ZSHRC=~/.zshrc +ZSHRC_BACKUP=~/.zshrc.pre-dmitmel-dotfiles + +if [[ -f $ZSHRC ]]; then + echo "Backing up $ZSHRC to $ZSHRC_BACKUP" + mv $ZSHRC $ZSHRC_BACKUP +fi + +cat > $ZSHRC <&2 + [[ -z "$OH_MY_ZSH_PATH" ]] && echo "please, set OH_MY_ZSH_PATH to the path to your Oh My Zsh directory" >&2 +fi From d7810496d89c24d6684cc0cc831db2904e3e1578 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 23 Aug 2018 14:41:13 +0200 Subject: [PATCH 032/713] use git submodules --- .gitmodules | 6 ++++++ install.sh | 1 - lib/oh-my-zsh.zsh | 2 +- oh-my-zsh | 1 + zsh-syntax-highlighting | 1 + zshrc | 7 +++---- 6 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 .gitmodules create mode 160000 oh-my-zsh create mode 160000 zsh-syntax-highlighting diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..464ce90 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "oh-my-zsh"] + path = oh-my-zsh + url = https://github.com/robbyrussell/oh-my-zsh.git +[submodule "zsh-syntax-highlighting"] + path = zsh-syntax-highlighting + url = https://github.com/zsh-users/zsh-syntax-highlighting.git diff --git a/install.sh b/install.sh index 97beb18..b35b8c6 100755 --- a/install.sh +++ b/install.sh @@ -12,6 +12,5 @@ cat > $ZSHRC <&2 - [[ -z "$OH_MY_ZSH_PATH" ]] && echo "please, set OH_MY_ZSH_PATH to the path to your Oh My Zsh directory" >&2 + echo "please, set DOTFILES_PATH to the path to your dotfiles directory" >&2 fi From cd4bc055611f18ee45ccc37ebd7958e9cabc2ad6 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 23 Aug 2018 19:25:14 +0200 Subject: [PATCH 033/713] move theming to lib/theme.zsh --- lib/oh-my-zsh.zsh | 8 -------- lib/theme.zsh | 15 +++++++++++++++ zshrc | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 lib/theme.zsh diff --git a/lib/oh-my-zsh.zsh b/lib/oh-my-zsh.zsh index bd27727..626b6b4 100644 --- a/lib/oh-my-zsh.zsh +++ b/lib/oh-my-zsh.zsh @@ -35,13 +35,5 @@ configure_oh_my_zsh() { fi } -configure_zsh() { - [[ -f ~/.dircolors ]] && eval "$(dircolors ~/.dircolors)" - [[ -z "$LS_COLORS" ]] && eval "$(dircolors -b)" - - zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}" -} - configure_oh_my_zsh source "$ZSH/oh-my-zsh.sh" -configure_zsh diff --git a/lib/theme.zsh b/lib/theme.zsh new file mode 100644 index 0000000..0887d7d --- /dev/null +++ b/lib/theme.zsh @@ -0,0 +1,15 @@ +#!/usr/bin/env zsh + +configure_syntax_highlighting() { + source "$DOTFILES_PATH/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh" +} + +configure_dircolors() { + [[ -f ~/.dircolors ]] && eval "$(dircolors ~/.dircolors)" + [[ -z "$LS_COLORS" ]] && eval "$(dircolors -b)" + + zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}" +} + +configure_syntax_highlighting +configure_dircolors diff --git a/zshrc b/zshrc index b960573..4284208 100755 --- a/zshrc +++ b/zshrc @@ -1,7 +1,7 @@ #!/usr/bin/env zsh if [[ -n "$DOTFILES_PATH" ]]; then - for script in functions path exports aliases oh-my-zsh widgets; do + for script in functions path exports aliases oh-my-zsh widgets theme; do source "$DOTFILES_PATH/lib/$script.zsh" done From e2e9e96e3a3723eb7ab4beef69420429796f102c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 23 Aug 2018 19:31:56 +0200 Subject: [PATCH 034/713] add custom configuration overrides --- .gitignore | 1 + zshrc | 1 + 2 files changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5efbffc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/custom diff --git a/zshrc b/zshrc index 4284208..ad44632 100755 --- a/zshrc +++ b/zshrc @@ -3,6 +3,7 @@ if [[ -n "$DOTFILES_PATH" ]]; then for script in functions path exports aliases oh-my-zsh widgets theme; do source "$DOTFILES_PATH/lib/$script.zsh" + source_if_exists "$DOTFILES_PATH/custom/$script.zsh" done source "$DOTFILES_PATH/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh" From 2c73d5ced90a26a4101c545fb152c3be376f540e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 23 Aug 2018 19:35:40 +0200 Subject: [PATCH 035/713] add upgrade script --- upgrade.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 upgrade.sh diff --git a/upgrade.sh b/upgrade.sh new file mode 100755 index 0000000..473ff76 --- /dev/null +++ b/upgrade.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +git pull --rebase --stat origin master +git submodule update --init --recursive --remote From f0b9378593dc485aa17953353162d78e69a0e5fc Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 23 Aug 2018 22:46:00 +0200 Subject: [PATCH 036/713] fix username on Android --- lib/exports.zsh | 6 +++++- lib/functions.zsh | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/exports.zsh b/lib/exports.zsh index 47468a6..61dadad 100644 --- a/lib/exports.zsh +++ b/lib/exports.zsh @@ -6,7 +6,11 @@ export LC_ALL="$LANG" if [[ -z "$USER" && -n "$USERNAME" ]]; then export USER="$USERNAME" fi -export DEFAULT_USER="dmitmel" +if is_android; then + export DEFAULT_USER="$USER" +else + export DEFAULT_USER="dmitmel" +fi if [[ -n "$SSH_CONNECTION" ]]; then export EDITOR="rmate" diff --git a/lib/functions.zsh b/lib/functions.zsh index 6c1b257..838b0c6 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -8,6 +8,10 @@ is_macos() { [[ "$OSTYPE" == darwin* ]] } +is_android() { + [[ "$OSTYPE" == linux-android ]] +} + command_exists() { command -v "$1" >/dev/null 2>&1 } From 37caf7a892bd6958adc3e08aa9b85cb81d4af96a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 28 Aug 2018 19:57:23 +0300 Subject: [PATCH 037/713] update oh-my-zsh --- oh-my-zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oh-my-zsh b/oh-my-zsh index abca62a..caa9365 160000 --- a/oh-my-zsh +++ b/oh-my-zsh @@ -1 +1 @@ -Subproject commit abca62add1a6d0ac34e697beac8682076d5c1dd7 +Subproject commit caa936593a6945cfcf21ca3f65acdd249586db13 From 174f3df0ec5e7295cc566bf62bce365478b6ab79 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 28 Aug 2018 19:57:54 +0300 Subject: [PATCH 038/713] add Hammerspoon config --- hammerspoon/init.lua | 1 + 1 file changed, 1 insertion(+) create mode 100644 hammerspoon/init.lua diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua new file mode 100644 index 0000000..b6d838b --- /dev/null +++ b/hammerspoon/init.lua @@ -0,0 +1 @@ +hs.notify.show("Hammerspoon", "", "Hammespoon config loaded") From 1ed0a3756f50e41e85761f40429e60d6240fa463 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 28 Aug 2018 19:58:16 +0300 Subject: [PATCH 039/713] [hammerspoon] add terminal palette --- hammerspoon/TerminalPalette.lua | 116 ++++++++++++++++++++++++++++++++ hammerspoon/init.lua | 2 + 2 files changed, 118 insertions(+) create mode 100644 hammerspoon/TerminalPalette.lua diff --git a/hammerspoon/TerminalPalette.lua b/hammerspoon/TerminalPalette.lua new file mode 100644 index 0000000..5df7d89 --- /dev/null +++ b/hammerspoon/TerminalPalette.lua @@ -0,0 +1,116 @@ +items = { + { text = "clear screen", keys = {{"ctrl","L"}} }, + { text = "insert mode", keys = {{"ctrl","X"},{"ctrl","O"}} }, + { text = "undo", keys = {{"ctrl","shift", "-"}} }, + -- { text = "redo", keys = {{"alt","X"},{"r"},{"e"},{"d"},{"o"},{"return"}} }, + + { text = "open command in editor", keys = {{"ctrl","X"},{"ctrl","E"}} }, + { text = "push input", keys = {{"ctrl","Q"}} }, + { text = "pop input", keys = {{"alt","G"}} }, + { text = "run buffer and reuse", keys = {{"alt","G"}} }, + + { text = "execute ZLE widget", keys = {{"alt","X"}} }, + { text = "cancel ZLE widget", keys = {{"ctrl","G"}} }, + + { text = "display help for current command", keys = {{"alt","H"}} }, + { text = "locate current command", keys = {{"alt","shift","?"}} }, + + { text = "go to the buffer start", keys = {{"alt","shift","."}} }, + { text = "go to the buffer end", keys = {{"alt","shift",","}} }, + { text = "go to the line start", keys = {{"ctrl","A"}} }, + { text = "go to the line end", keys = {{"ctrl","E"}} }, + { text = "move one word backward", keys = {{"alt","B"}} }, + { text = "move one word forward", keys = {{"alt","F"}} }, + { text = "go to the matching bracket", keys = {{"ctrl","X"},{"ctrl","B"}} }, + + { text = "find in previous commands", keys = {{"ctrl","R"}} }, + { text = "find in following commands", keys = {{"ctrl","S"}} }, + + { text = "select", keys = {{"ctrl","shift","2"}} }, + { text = "cut word", keys = {{"alt","D"}} }, + { text = "go to selection start/end", keys = {{"ctrl","X"},{"ctrl","X"}} }, + { text = "cut selected text", keys = {{"alt","W"}} }, + { text = "quote selected text", keys = {{"alt","shift","'"}} }, + { text = "paste copied text", keys = {{"ctrl","Y"}} }, + + { text = "clear buffer", keys = {{"ctrl","X"},{"ctrl","K"}} }, + { text = "delete line", keys = {{"ctrl","U"}} }, + { text = "delete word", keys = {{"ctrl","W"}} }, + + { text = "join lines", keys = {{"ctrl","X"},{"ctrl","J"}} }, + + { text = "tmux: send Ctrl+B", keys = {{"ctrl","B"},{"ctrl","B"}} }, + { text = "tmux: command prompt", keys = {{"ctrl","B"},{"shift",";"}} }, + + { text = "tmux: rename current session", keys = {{"ctrl","B"},{"shift","4"}} }, + { text = "tmux: detach", keys = {{"ctrl","B"},{"d"}} }, + { text = "tmux: sessions", keys = {{"ctrl","B"},{"s"}} }, + { text = "tmux: next session", keys = {{"ctrl","B"},{")"}} }, + { text = "tmux: previous session", keys = {{"ctrl","B"},{"("}} }, + { text = "tmux: last session", keys = {{"ctrl","B"},{"shift","l"}} }, + + { text = "tmux: create window", keys = {{"ctrl","B"},{"c"}} }, + { text = "tmux: switch to window", keys = {{"ctrl","B"}}, message = "press a number key (0-9)" }, + { text = "tmux: rename current window", keys = {{"ctrl","B"},{","}} }, + { text = "tmux: kill current window", keys = {{"ctrl","B"},{"shift","7"}} }, + { text = "tmux: windows", keys = {{"ctrl","B"},{"w"}} }, + { text = "tmux: next window", keys = {{"ctrl","B"},{"n"}} }, + { text = "tmux: previous window", keys = {{"ctrl","B"},{"p"}} }, + { text = "tmux: last window", keys = {{"ctrl","B"},{"l"}} }, + { text = "tmux: find window", keys = {{"ctrl","B"},{"f"}} }, + + { text = "tmux: split vertically", keys = {{"ctrl","B"},{"shift","'"}} }, + { text = "tmux: split horizontally", keys = {{"ctrl","B"},{"shift","5"}} }, + { text = "tmux: switch to pane in a direction", keys = {{"ctrl","B"}}, message = "press an arrow key" }, + { text = "tmux: kill current pane", keys = {{"ctrl","B"},{"x"}} }, + { text = "tmux: next pane", keys = {{"ctrl","B"},{"o"}} }, + { text = "tmux: last pane", keys = {{"ctrl","B"},{";"}} }, + { text = "tmux: toggle pane zoom", keys = {{"ctrl","B"},{"z"}} }, + { text = "tmux: change pane layout", keys = {{"ctrl","B"},{"space"}} }, + { text = "tmux: move pane to a new window", keys = {{"ctrl","B"},{"shift","1"}} }, + + { text = "tmux: copy mode", keys = {{"ctrl","B"},{"["}} }, + { text = "tmux: paste", keys = {{"ctrl","B"},{"]"}} }, +} + +chooser = hs.chooser.new(function(item) + if item then + if item.message then hs.alert(item.message) end + for _, key_combo in ipairs(item.keys) do + hs.eventtap.keyStroke(key_combo.mods, key_combo.key) + end + end +end) + +chooser:choices( + hs.fnutils.imap(items, function(item) + subText = table.concat(hs.fnutils.imap(item.keys, function(key_combo) + return table.concat(hs.fnutils.imap(key_combo, function(key_stroke) + return hs.utf8.registeredKeys[key_stroke] or key_stroke + end)) + end), " ") + + keys = hs.fnutils.imap(item.keys, function(key_combo) + mods = {} + for i = 1, #key_combo - 1 do mods[i] = key_combo[i] end + key = key_combo[#key_combo] + return { mods = mods, key = key } + end) + + return { + text = item.text, + subText = subText, + keys = keys, + message = item.message + } + end) +) + +chooser:rows(9) + +hs.hotkey.bind({"cmd", "shift"}, "a", function() + app = hs.application.frontmostApplication() + if app:name():lower():match("term") then + chooser:show() + end +end) diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua index b6d838b..47dce16 100644 --- a/hammerspoon/init.lua +++ b/hammerspoon/init.lua @@ -1 +1,3 @@ +require "TerminalPalette" + hs.notify.show("Hammerspoon", "", "Hammespoon config loaded") From 33f03d7d9123a1c97cc1e78f94e46f7e7a19b247 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 28 Aug 2018 19:58:52 +0300 Subject: [PATCH 040/713] [hammerspoon] add cheatsheet (disabled) --- hammerspoon/cheatsheet.lua | 8 ++++++++ hammerspoon/init.lua | 1 + 2 files changed, 9 insertions(+) create mode 100644 hammerspoon/cheatsheet.lua diff --git a/hammerspoon/cheatsheet.lua b/hammerspoon/cheatsheet.lua new file mode 100644 index 0000000..5c6f37b --- /dev/null +++ b/hammerspoon/cheatsheet.lua @@ -0,0 +1,8 @@ +hs.loadSpoon("KSheet") + +modal = hs.hotkey.modal.new({"cmd", "alt", "ctrl"}, "c") + +function modal:entered() spoon.KSheet:show() end +function modal:exited() spoon.KSheet:hide() end + +modal:bind('', 'escape', function() modal:exit() end) diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua index 47dce16..a00336d 100644 --- a/hammerspoon/init.lua +++ b/hammerspoon/init.lua @@ -1,3 +1,4 @@ require "TerminalPalette" +-- require "cheatsheet" hs.notify.show("Hammerspoon", "", "Hammespoon config loaded") From dca985c3d9cb8890c8040868da566b73b3cfeb31 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 9 Sep 2018 14:36:36 +0300 Subject: [PATCH 041/713] replace zsh-syntax-highlighting with fast-syntax-highlighting --- .gitignore | 1 + .gitmodules | 6 ++-- fast-syntax-highlighting | 1 + lib/my-syntax-theme.ini | 75 ++++++++++++++++++++++++++++++++++++++++ lib/oh-my-zsh.zsh | 1 - lib/theme.zsh | 4 ++- oh-my-zsh | 2 +- zsh-syntax-highlighting | 1 - zshrc | 2 -- 9 files changed, 84 insertions(+), 9 deletions(-) create mode 160000 fast-syntax-highlighting create mode 100644 lib/my-syntax-theme.ini delete mode 160000 zsh-syntax-highlighting diff --git a/.gitignore b/.gitignore index 5efbffc..6660576 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /custom +/cache diff --git a/.gitmodules b/.gitmodules index 464ce90..f26f5db 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "oh-my-zsh"] path = oh-my-zsh url = https://github.com/robbyrussell/oh-my-zsh.git -[submodule "zsh-syntax-highlighting"] - path = zsh-syntax-highlighting - url = https://github.com/zsh-users/zsh-syntax-highlighting.git +[submodule "fast-syntax-highlighting"] + path = fast-syntax-highlighting + url = https://github.com/zdharma/fast-syntax-highlighting.git diff --git a/fast-syntax-highlighting b/fast-syntax-highlighting new file mode 160000 index 0000000..7b8ab36 --- /dev/null +++ b/fast-syntax-highlighting @@ -0,0 +1 @@ +Subproject commit 7b8ab36f88ee4625e1eb858e8538d78a0c1d1519 diff --git a/lib/my-syntax-theme.ini b/lib/my-syntax-theme.ini new file mode 100644 index 0000000..533f021 --- /dev/null +++ b/lib/my-syntax-theme.ini @@ -0,0 +1,75 @@ +[base] +default = none +unknown-token = red,bold +commandseparator = none +redirection = none +here-string-tri = yellow +here-string-word = bg:blue +exec-descriptor = yellow,bold +comment = white +correct-subtle = bg:blue +incorrect-subtle = red +subtle-bg = bg:blue +secondary = + +[command-point] +reserved-word = yellow +subcommand = yellow +alias = green +suffix-alias = green +global-alias = bg:blue +builtin = green +function = green +command = green +precommand = green +hashed-command = green + +[paths] +path = none +pathseparator = +path-to-dir = none,underline +globbing = blue,bold + +[brackets] +paired-bracket = bg:blue +bracket-level-1 = green,bold +bracket-level-2 = yellow,bold +bracket-level-3 = cyan,bold + +[arguments] +single-hyphen-option = cyan +double-hyphen-option = cyan +back-quoted-argument = none +single-quoted-argument = yellow +double-quoted-argument = yellow +dollar-quoted-argument = yellow + +[in-string] +; backslash in $'...' +back-dollar-quoted-argument = cyan +; backslash or $... in "..." +back-or-dollar-double-quoted-argument = cyan + +[other] +variable = 113 +assign = none +assign-array-bracket = green +history-expansion = blue,bold + +[math] +mathvar = blue,bold +mathnum = blue +matherr = red + +[for-loop] +forvar = none +fornum = blue +; operator +foroper = yellow +; separator +forsep = yellow,bold + +[case] +case-input = green +case-parentheses = yellow +case-condition = bg:blue diff --git a/lib/oh-my-zsh.zsh b/lib/oh-my-zsh.zsh index 626b6b4..67ffe31 100644 --- a/lib/oh-my-zsh.zsh +++ b/lib/oh-my-zsh.zsh @@ -27,7 +27,6 @@ configure_oh_my_zsh() { git common-aliases extract - # zsh-syntax-highlighting ) if is_linux; then diff --git a/lib/theme.zsh b/lib/theme.zsh index 0887d7d..a999611 100644 --- a/lib/theme.zsh +++ b/lib/theme.zsh @@ -1,7 +1,9 @@ #!/usr/bin/env zsh configure_syntax_highlighting() { - source "$DOTFILES_PATH/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh" + # set directory for compiled theme files + FAST_WORK_DIR="$DOTFILES_PATH/cache" + source "$DOTFILES_PATH/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh" } configure_dircolors() { diff --git a/oh-my-zsh b/oh-my-zsh index caa9365..86542dc 160000 --- a/oh-my-zsh +++ b/oh-my-zsh @@ -1 +1 @@ -Subproject commit caa936593a6945cfcf21ca3f65acdd249586db13 +Subproject commit 86542dcd8627d0e9a4b1acd8c01a9cdae4697698 diff --git a/zsh-syntax-highlighting b/zsh-syntax-highlighting deleted file mode 160000 index db6cac3..0000000 --- a/zsh-syntax-highlighting +++ /dev/null @@ -1 +0,0 @@ -Subproject commit db6cac391bee957c20ff3175b2f03c4817253e60 diff --git a/zshrc b/zshrc index ad44632..2fe55f1 100755 --- a/zshrc +++ b/zshrc @@ -6,8 +6,6 @@ if [[ -n "$DOTFILES_PATH" ]]; then source_if_exists "$DOTFILES_PATH/custom/$script.zsh" done - source "$DOTFILES_PATH/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh" - run_before rbenv 'eval "$(rbenv init -)"' run_before sdk 'source_if_exists "$SDKMAN_DIR/bin/sdkman-init.sh"' run_before yarn 'source_if_exists "$(yarn global dir)/node_modules/tabtab/.completions/yarn.zsh"' From 290c396c5ca3e4f7001ae9ccbc48cacb8bb82550 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 9 Sep 2018 15:15:20 +0300 Subject: [PATCH 042/713] add rust completions --- completions/_rust | 215 +++++++++ completions/_rustup | 1070 +++++++++++++++++++++++++++++++++++++++++++ lib/path.zsh | 36 +- 3 files changed, 1305 insertions(+), 16 deletions(-) create mode 100644 completions/_rust create mode 100644 completions/_rustup diff --git a/completions/_rust b/completions/_rust new file mode 100644 index 0000000..404f622 --- /dev/null +++ b/completions/_rust @@ -0,0 +1,215 @@ +#compdef rustc + +local -a _rustc_opts_switches _rustc_opts_lint _rustc_opts_debug + +typeset -A opt_args + +_rustc_debuginfo_levels=( + "0[no debug info]" + "1[line-tables only (for stacktraces and breakpoints)]" + "2[full debug info with variable and type information (same as -g)]" +) + +_rustc_crate_types=( + 'bin' + 'lib' + 'rlib' + 'dylib' + 'staticlib' +) + +_rustc_emit_types=( + 'asm' + 'llvm-bc' + 'llvm-ir' + 'obj' + 'link' + 'dep-info' +) +_rustc_pretty_types=( + 'normal[un-annotated source]' + 'expanded[crates expanded]' + 'typed[crates expanded, with type annotations]' + 'identified[fully parenthesized, AST nodes and blocks with IDs]' + 'flowgraph[graphviz formatted flowgraph for node]:NODEID:' +) +_rustc_color_types=( + 'auto[colorize, if output goes to a tty (default)]' + 'always[always colorize output]' + 'never[never colorize output]' +) +_rustc_info_types=( + 'crate-name[Output the crate name and exit]' + 'file-names[Output the file(s) that would be written if compilation continued and exited]' + 'sysroot[Output the sysroot and exit]' +) + +_rustc_opts_vals=( + --crate-name='[Specify the name of the crate being built]' + --crate-type='[Comma separated list of types of crates for the compiler to emit]:TYPES:_values -s "," "Crate types" "$_rustc_crate_types[@]"' + --emit='[Comma separated list of types of output for the compiler to emit]:TYPES:_values -s "," "Emit Targets" "$_rustc_emit_types[@]"' + --cfg='[Configure the compilation environment]:SPEC:' + --out-dir='[Write output to compiler-chosen filename in . Ignored if -o is specified. (default the current directory)]:DIR:_files -/' + -o'[Write output to . Ignored if more than one --emit is specified.]:FILENAME:_files' + --pretty='[Pretty-print the input instead of compiling]::TYPE:_values "TYPES" "$_rustc_pretty_types[@]"' + -L'[Add a directory to the library search path]:DIR:_files -/' + --target='[Target triple cpu-manufacturer-kernel\[-os\] to compile]:TRIPLE:' + --color='[Configure coloring of output]:CONF:_values "COLORS" "$_rustc_color_types[@]"' + {-v,--version}'[Print version info and exit]::VERBOSE:(verbose)' + --explain='[Provide a detailed explanation of an error message]:OPT:' + --extern'[Specify where an external rust library is located]:ARG:' + --print='[Comma separated list of compiler information to print on stdout]:TYPES:_values -s "," "Compiler Information" "$_rustc_info_types[@]"' +) + +_rustc_opts_switches=( + -g'[Equivalent to -C debuginfo=2]' + {-h,--help}'[Display the help message]' + {-V,--verbose}'[use verbose output]' + -O'[Equivalent to -C opt-level=2]' + --test'[Build a test harness]' +) + + +_rustc_opts_link=( + 'static[Path to the library to link statically]:PATH:_files -/' + 'dylib[Path to the library to link dynamically]:PATH:_files -/' + 'framework[Path to the library to link as a framework]:PATH:_files -/' +) + +_rustc_opts_codegen=( + 'ar[Path to the archive utility to use when assembling archives.]:BIN:_path_files' + 'linker[Path to the linker utility to use when linking libraries, executables, and objects.]:BIN:_path_files' + 'link-args[A space-separated list of extra arguments to pass to the linker when the linker is invoked.]:ARGS:' + 'lto[Perform LLVM link-time optimizations]' + 'target-cpu[Selects a target processor. If the value is "help", then a list of available CPUs is printed.]:CPU:' + 'target-feature[A space-separated list of features to enable or disable for the target. A preceding "+" enables a feature while a preceding "-" disables it. Available features can be discovered through target-cpu=help.]:FEATURE:' + 'passes[A space-separated list of extra LLVM passes to run. A value of "list" will cause rustc to print all known passes and exit. The passes specified are appended at the end of the normal pass manager.]:LIST:' + 'llvm-args[A space-separated list of arguments to pass through to LLVM.]:ARGS:' + 'save-temps[If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated throughout compilation in the output directory.]' + 'rpath[If specified, then the rpath value for dynamic libraries will be set in either dynamic library or executable outputs.]' + 'no-prepopulate-passes[Suppresses pre-population of the LLVM pass manager that is run over the module.]' + 'no-vectorize-loops[Suppresses running the loop vectorization LLVM pass, regardless of optimization level.]' + 'no-vectorize-slp[Suppresses running the LLVM SLP vectorization pass, regardless of optimization level.]' + 'soft-float[Generates software floating point library calls instead of hardware instructions.]' + 'prefer-dynamic[Prefers dynamic linking to static linking.]' + "no-integrated-as[Force usage of an external assembler rather than LLVM's integrated one.]" + 'no-redzone[disable the use of the redzone]' + 'relocation-model[The relocation model to use. (default: pic)]:MODEL:(pic static dynamic-no-pic)' + 'code-model[choose the code model to use (llc -code-model for details)]:MODEL:' + 'metadata[metadata to mangle symbol names with]:VAL:' + 'extra-filenames[extra data to put in each output filename]:VAL:' + 'codegen-units[divide crate into N units to optimize in parallel]:N:' + 'remark[print remarks for these optimization passes (space separated, or "all")]:TYPE:' + 'debuginfo[debug info emission level, 0 = no debug info, 1 = line tables only, 2 = full debug info with variable and type information]:LEVEL:_values "Debug Levels" "$_rustc_debuginfo_levels[@]"' + 'opt-level[Optimize with possible levels 0-3]:LEVEL:(0 1 2 3)' + 'help[Show all codegen options]' +) + +_rustc_opts_lint=( + 'help[Show a list of all lints]' + 'box-pointers[(default: allow) use of owned (Box type) heap memory]' + 'experimental[(default: allow) detects use of #\[experimental\] items]' + 'fat-ptr-transmutes[(default: allow) detects transmutes of fat pointers]' + 'missing-docs[(default: allow) detects missing documentation for public members]' + 'unsafe-blocks[(default: allow) usage of an "unsafe" block]' + 'unstable[(default: allow) detects use of #\[unstable\] items (incl. items with no stability attribute)]' + 'unused-extern-crates[(default: allow) extern crates that are never used]' + 'unused-import-braces[(default: allow) unnecessary braces around an imported item]' + 'unused-qualifications[(default: allow) detects unnecessarily qualified names]' + 'unused-results[(default: allow) unused result of an expression in a statement]' + 'unused-typecasts[(default: allow) detects unnecessary type casts that can be removed]' + 'variant-size-differences[(default: allow) detects enums with widely varying variant sizes]' + 'dead-code[(default: warn) detect unused, unexported items]' + 'deprecated[(default: warn) detects use of #\[deprecated\] items]' + 'improper-ctypes[(default: warn) proper use of libc types in foreign modules]' + 'missing-copy-implementations[(default: warn) detects potentially-forgotten implementations of "Copy"]' + 'non-camel-case-types[(default: warn) types, variants, traits and type parameters should have camel case names]' + 'non-shorthand-field-patterns[(default: warn) using "Struct { x: x }" instead of "Struct { x }"]' + 'non-snake-case[(default: warn) methods, functions, lifetime parameters and modules should have snake case names]' + 'non-upper-case-globals[(default: warn) static constants should have uppercase identifiers]' + 'overflowing-literals[(default: warn) literal out of range for its type]' + 'path-statements[(default: warn) path statements with no effect]' + 'raw-pointer-deriving[(default: warn) uses of #\[derive\] with raw pointers are rarely correct]' + 'unknown-lints[(default: warn) unrecognized lint attribute]' + 'unreachable-code[(default: warn) detects unreachable code paths]' + 'unsigned-negation[(default: warn) using an unary minus operator on unsigned type]' + 'unused-allocation[(default: warn) detects unnecessary allocations that can be eliminated]' + 'unused-assignments[(default: warn) detect assignments that will never be read]' + 'unused-attributes[(default: warn) detects attributes that were not used by the compiler]' + 'unused-comparisons[(default: warn) comparisons made useless by limits of the types involved]' + 'unused-imports[(default: warn) imports that are never used]' + 'unused-must-use[(default: warn) unused result of a type flagged as must_use]' + "unused-mut[(default: warn) detect mut variables which don't need to be mutable]" + 'unused-parens[(default: warn) "if", "match", "while" and "return" do not need parentheses]' + 'unused-unsafe[(default: warn) unnecessary use of an "unsafe" block]' + 'unused-variables[(default: warn) detect variables which are not used in any way]' + 'warnings[(default: warn) mass-change the level for lints which produce warnings]' + 'while-true[(default: warn) suggest using "loop { }" instead of "while true { }"]' + "exceeding-bitshifts[(default: deny) shift exceeds the type's number of bits]" + 'unknown-crate-types[(default: deny) unknown crate type found in #\[crate_type\] directive]' + 'unknown-features[(default: deny) unknown features found in crate-level #\[feature\] directives]' + 'bad-style[non-camel-case-types, non-snake-case, non-upper-case-globals]' + 'unused[unused-imports, unused-variables, unused-assignments, dead-code, unused-mut, unreachable-code, unused-must-use, unused-unsafe, path-statements]' +) + +_rustc_opts_debug=( + 'verbose[in general, enable more debug printouts]' + 'time-passes[measure time of each rustc pass]' + 'count-llvm-insns[count where LLVM instrs originate]' + 'time-llvm-passes[measure time of each LLVM pass]' + 'trans-stats[gather trans statistics]' + 'asm-comments[generate comments into the assembly (may change behavior)]' + 'no-verify[skip LLVM verification]' + 'borrowck-stats[gather borrowck statistics]' + 'no-landing-pads[omit landing pads for unwinding]' + 'debug-llvm[enable debug output from LLVM]' + 'show-span[show spans for compiler debugging]' + 'count-type-sizes[count the sizes of aggregate types]' + 'meta-stats[gather metadata statistics]' + 'print-link-args[Print the arguments passed to the linker]' + 'gc[Garbage collect shared data (experimental)]' + 'print-llvm-passes[Prints the llvm optimization passes being run]' + 'ast-json[Print the AST as JSON and halt]' + 'ast-json-noexpand[Print the pre-expansion AST as JSON and halt]' + 'ls[List the symbols defined by a library crate]' + 'save-analysis[Write syntax and type analysis information in addition to normal output]' + 'flowgraph-print-loans[Include loan analysis data in --pretty flowgraph output]' + 'flowgraph-print-moves[Include move analysis data in --pretty flowgraph output]' + 'flowgraph-print-assigns[Include assignment analysis data in --pretty flowgraph output]' + 'flowgraph-print-all[Include all dataflow analysis data in --pretty flowgraph output]' + 'print-regiion-graph[Prints region inference graph. Use with RUST_REGION_GRAPH=help for more info]' + 'parse-only[Parse only; do not compile, assemble, or link]' + 'no-trans[Run all passes except translation; no output]' + 'no-analysis[Parse and expand the source, but run no analysis]' + 'unstable-options[Adds unstable command line options to rustc interface]' + 'print-enum-sizes[Print the size of enums and their variants]' +) + +_rustc_opts_fun_lint(){ + _values -s , 'options' \ + "$_rustc_opts_lint[@]" +} + +_rustc_opts_fun_debug(){ + _values 'options' "$_rustc_opts_debug[@]" +} + +_rustc_opts_fun_codegen(){ + _values 'options' "$_rustc_opts_codegen[@]" +} + +_rustc_opts_fun_link(){ + _values 'options' "$_rustc_opts_link[@]" +} + +_arguments -s : \ + '(-W --warn)'{-W,--warn=}'[Set lint warnings]:lint options:_rustc_opts_fun_lint' \ + '(-A --allow)'{-A,--allow=}'[Set lint allowed]:lint options:_rustc_opts_fun_lint' \ + '(-D --deny)'{-D,--deny=}'[Set lint denied]:lint options:_rustc_opts_fun_lint' \ + '(-F --forbid)'{-F,--forbid=}'[Set lint forbidden]:lint options:_rustc_opts_fun_lint' \ + '*-Z[Set internal debugging options]:debug options:_rustc_opts_fun_debug' \ + '(-C --codegen)'{-C,--codegen}'[Set internal Codegen options]:codegen options:_rustc_opts_fun_codegen' \ + '*-l[Link the generated crates to the specified native library NAME. the optional KIND can be one of, static, dylib, or framework. If omitted, dylib is assumed.]:ARG:_rustc_opts_fun_link' \ + "$_rustc_opts_switches[@]" \ + "$_rustc_opts_vals[@]" \ + '::files:_files -g "*.rs"' diff --git a/completions/_rustup b/completions/_rustup new file mode 100644 index 0000000..4a84ba9 --- /dev/null +++ b/completions/_rustup @@ -0,0 +1,1070 @@ +#compdef rustup + +autoload -U is-at-least + +_rustup() { + typeset -A opt_args + typeset -a _arguments_options + local ret=1 + + if is-at-least 5.2; then + _arguments_options=(-s -S -C) + else + _arguments_options=(-s -C) + fi + + local context curcontext="$curcontext" state line + _arguments "${_arguments_options[@]}" \ +'-v[Enable verbose output]' \ +'--verbose[Enable verbose output]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup_commands" \ +"*::: :->rustup" \ +&& ret=0 + case $state in + (rustup) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-command-$line[1]:" + case $line[1] in + (show) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__show_commands" \ +"*::: :->show" \ +&& ret=0 +case $state in + (show) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-show-command-$line[1]:" + case $line[1] in + (active-toolchain) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(install) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(uninstall) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(update) +_arguments "${_arguments_options[@]}" \ +'--no-self-update[Don'\''t perform self update when running the `rustup` command]' \ +'--force[Force an update, even if some components are missing]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(default) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(toolchain) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__toolchain_commands" \ +"*::: :->toolchain" \ +&& ret=0 +case $state in + (toolchain) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-toolchain-command-$line[1]:" + case $line[1] in + (list) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(update) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(add) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(install) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(remove) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(uninstall) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(link) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +':path:_files' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(target) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__target_commands" \ +"*::: :->target" \ +&& ret=0 +case $state in + (target) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-target-command-$line[1]:" + case $line[1] in + (list) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(install) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':target:_files' \ +&& ret=0 +;; +(add) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':target:_files' \ +&& ret=0 +;; +(uninstall) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':target:_files' \ +&& ret=0 +;; +(remove) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':target:_files' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(component) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__component_commands" \ +"*::: :->component" \ +&& ret=0 +case $state in + (component) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-component-command-$line[1]:" + case $line[1] in + (list) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(add) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'--target=[]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':component:_files' \ +&& ret=0 +;; +(remove) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'--target=[]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':component:_files' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(override) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__override_commands" \ +"*::: :->override" \ +&& ret=0 +case $state in + (override) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-override-command-$line[1]:" + case $line[1] in + (list) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(add) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(set) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(remove) +_arguments "${_arguments_options[@]}" \ +'--path=[Path to the directory]' \ +'--nonexistent[Remove override toolchain for all nonexistent directories]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(unset) +_arguments "${_arguments_options[@]}" \ +'--path=[Path to the directory]' \ +'--nonexistent[Remove override toolchain for all nonexistent directories]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(run) +_arguments "${_arguments_options[@]}" \ +'--install[Install the requested toolchain if needed]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +':command:_files' \ +&& ret=0 +;; +(which) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':command:_files' \ +&& ret=0 +;; +(docs) +_arguments "${_arguments_options[@]}" \ +'--path[Only print the path to the documentation]' \ +'--book[The Rust Programming Language book]' \ +'--std[Standard library API documentation]' \ +'--reference[The Rust Reference]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(doc) +_arguments "${_arguments_options[@]}" \ +'--path[Only print the path to the documentation]' \ +'--book[The Rust Programming Language book]' \ +'--std[Standard library API documentation]' \ +'--reference[The Rust Reference]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(man) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':command:_files' \ +&& ret=0 +;; +(self) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__self_commands" \ +"*::: :->self" \ +&& ret=0 +case $state in + (self) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-self-command-$line[1]:" + case $line[1] in + (update) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(uninstall) +_arguments "${_arguments_options[@]}" \ +'-y[]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(upgrade-data) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(telemetry) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__telemetry_commands" \ +"*::: :->telemetry" \ +&& ret=0 +case $state in + (telemetry) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-telemetry-command-$line[1]:" + case $line[1] in + (enable) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(disable) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(analyze) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(set) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__set_commands" \ +"*::: :->set" \ +&& ret=0 +case $state in + (set) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-set-command-$line[1]:" + case $line[1] in + (default-host) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':host_triple:_files' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(completions) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::shell:(zsh bash fish powershell elvish)' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +} + +(( $+functions[_rustup_commands] )) || +_rustup_commands() { + local commands; commands=( + "show:Show the active and installed toolchains" \ +"install:Update Rust toolchains" \ +"uninstall:Uninstall Rust toolchains" \ +"update:Update Rust toolchains and rustup" \ +"default:Set the default toolchain" \ +"toolchain:Modify or query the installed toolchains" \ +"target:Modify a toolchain's supported targets" \ +"component:Modify a toolchain's installed components" \ +"override:Modify directory toolchain overrides" \ +"run:Run a command with an environment configured for a given toolchain" \ +"which:Display which binary will be run for a given command" \ +"doc:Open the documentation for the current toolchain" \ +"man:View the man page for a given command" \ +"self:Modify the rustup installation" \ +"telemetry:rustup telemetry commands" \ +"set:Alter rustup settings" \ +"completions:Generate completion scripts for your shell" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup commands' commands "$@" +} +(( $+functions[_rustup__show__active-toolchain_commands] )) || +_rustup__show__active-toolchain_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup show active-toolchain commands' commands "$@" +} +(( $+functions[_rustup__add_commands] )) || +_rustup__add_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup add commands' commands "$@" +} +(( $+functions[_rustup__component__add_commands] )) || +_rustup__component__add_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup component add commands' commands "$@" +} +(( $+functions[_rustup__override__add_commands] )) || +_rustup__override__add_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override add commands' commands "$@" +} +(( $+functions[_rustup__target__add_commands] )) || +_rustup__target__add_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target add commands' commands "$@" +} +(( $+functions[_rustup__toolchain__add_commands] )) || +_rustup__toolchain__add_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain add commands' commands "$@" +} +(( $+functions[_rustup__telemetry__analyze_commands] )) || +_rustup__telemetry__analyze_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup telemetry analyze commands' commands "$@" +} +(( $+functions[_rustup__completions_commands] )) || +_rustup__completions_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup completions commands' commands "$@" +} +(( $+functions[_rustup__component_commands] )) || +_rustup__component_commands() { + local commands; commands=( + "list:List installed and available components" \ +"add:Add a component to a Rust toolchain" \ +"remove:Remove a component from a Rust toolchain" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup component commands' commands "$@" +} +(( $+functions[_rustup__default_commands] )) || +_rustup__default_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup default commands' commands "$@" +} +(( $+functions[_rustup__set__default-host_commands] )) || +_rustup__set__default-host_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup set default-host commands' commands "$@" +} +(( $+functions[_rustup__telemetry__disable_commands] )) || +_rustup__telemetry__disable_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup telemetry disable commands' commands "$@" +} +(( $+functions[_rustup__doc_commands] )) || +_rustup__doc_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup doc commands' commands "$@" +} +(( $+functions[_docs_commands] )) || +_docs_commands() { + local commands; commands=( + + ) + _describe -t commands 'docs commands' commands "$@" +} +(( $+functions[_rustup__docs_commands] )) || +_rustup__docs_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup docs commands' commands "$@" +} +(( $+functions[_rustup__telemetry__enable_commands] )) || +_rustup__telemetry__enable_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup telemetry enable commands' commands "$@" +} +(( $+functions[_rustup__component__help_commands] )) || +_rustup__component__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup component help commands' commands "$@" +} +(( $+functions[_rustup__help_commands] )) || +_rustup__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup help commands' commands "$@" +} +(( $+functions[_rustup__override__help_commands] )) || +_rustup__override__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override help commands' commands "$@" +} +(( $+functions[_rustup__self__help_commands] )) || +_rustup__self__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup self help commands' commands "$@" +} +(( $+functions[_rustup__set__help_commands] )) || +_rustup__set__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup set help commands' commands "$@" +} +(( $+functions[_rustup__show__help_commands] )) || +_rustup__show__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup show help commands' commands "$@" +} +(( $+functions[_rustup__target__help_commands] )) || +_rustup__target__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target help commands' commands "$@" +} +(( $+functions[_rustup__telemetry__help_commands] )) || +_rustup__telemetry__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup telemetry help commands' commands "$@" +} +(( $+functions[_rustup__toolchain__help_commands] )) || +_rustup__toolchain__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain help commands' commands "$@" +} +(( $+functions[_rustup__install_commands] )) || +_rustup__install_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup install commands' commands "$@" +} +(( $+functions[_rustup__target__install_commands] )) || +_rustup__target__install_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target install commands' commands "$@" +} +(( $+functions[_rustup__toolchain__install_commands] )) || +_rustup__toolchain__install_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain install commands' commands "$@" +} +(( $+functions[_rustup__toolchain__link_commands] )) || +_rustup__toolchain__link_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain link commands' commands "$@" +} +(( $+functions[_rustup__component__list_commands] )) || +_rustup__component__list_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup component list commands' commands "$@" +} +(( $+functions[_rustup__override__list_commands] )) || +_rustup__override__list_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override list commands' commands "$@" +} +(( $+functions[_rustup__target__list_commands] )) || +_rustup__target__list_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target list commands' commands "$@" +} +(( $+functions[_rustup__toolchain__list_commands] )) || +_rustup__toolchain__list_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain list commands' commands "$@" +} +(( $+functions[_rustup__man_commands] )) || +_rustup__man_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup man commands' commands "$@" +} +(( $+functions[_rustup__override_commands] )) || +_rustup__override_commands() { + local commands; commands=( + "list:List directory toolchain overrides" \ +"set:Set the override toolchain for a directory" \ +"unset:Remove the override toolchain for a directory" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup override commands' commands "$@" +} +(( $+functions[_rustup__component__remove_commands] )) || +_rustup__component__remove_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup component remove commands' commands "$@" +} +(( $+functions[_rustup__override__remove_commands] )) || +_rustup__override__remove_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override remove commands' commands "$@" +} +(( $+functions[_rustup__remove_commands] )) || +_rustup__remove_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup remove commands' commands "$@" +} +(( $+functions[_rustup__target__remove_commands] )) || +_rustup__target__remove_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target remove commands' commands "$@" +} +(( $+functions[_rustup__toolchain__remove_commands] )) || +_rustup__toolchain__remove_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain remove commands' commands "$@" +} +(( $+functions[_rustup__run_commands] )) || +_rustup__run_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup run commands' commands "$@" +} +(( $+functions[_rustup__self_commands] )) || +_rustup__self_commands() { + local commands; commands=( + "update:Download and install updates to rustup" \ +"uninstall:Uninstall rustup." \ +"upgrade-data:Upgrade the internal data format." \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup self commands' commands "$@" +} +(( $+functions[_rustup__override__set_commands] )) || +_rustup__override__set_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override set commands' commands "$@" +} +(( $+functions[_rustup__set_commands] )) || +_rustup__set_commands() { + local commands; commands=( + "default-host:The triple used to identify toolchains when not specified" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup set commands' commands "$@" +} +(( $+functions[_rustup__show_commands] )) || +_rustup__show_commands() { + local commands; commands=( + "active-toolchain:Show the active toolchain" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup show commands' commands "$@" +} +(( $+functions[_rustup__target_commands] )) || +_rustup__target_commands() { + local commands; commands=( + "list:List installed and available targets" \ +"add:Add a target to a Rust toolchain" \ +"remove:Remove a target from a Rust toolchain" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup target commands' commands "$@" +} +(( $+functions[_rustup__telemetry_commands] )) || +_rustup__telemetry_commands() { + local commands; commands=( + "enable:Enable rustup telemetry" \ +"disable:Disable rustup telemetry" \ +"analyze:Analyze stored telemetry" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup telemetry commands' commands "$@" +} +(( $+functions[_rustup__toolchain_commands] )) || +_rustup__toolchain_commands() { + local commands; commands=( + "list:List installed toolchains" \ +"install:Install or update a given toolchain" \ +"uninstall:Uninstall a toolchain" \ +"link:Create a custom toolchain by symlinking to a directory" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup toolchain commands' commands "$@" +} +(( $+functions[_rustup__self__uninstall_commands] )) || +_rustup__self__uninstall_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup self uninstall commands' commands "$@" +} +(( $+functions[_rustup__target__uninstall_commands] )) || +_rustup__target__uninstall_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target uninstall commands' commands "$@" +} +(( $+functions[_rustup__toolchain__uninstall_commands] )) || +_rustup__toolchain__uninstall_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain uninstall commands' commands "$@" +} +(( $+functions[_rustup__uninstall_commands] )) || +_rustup__uninstall_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup uninstall commands' commands "$@" +} +(( $+functions[_rustup__override__unset_commands] )) || +_rustup__override__unset_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override unset commands' commands "$@" +} +(( $+functions[_rustup__self__update_commands] )) || +_rustup__self__update_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup self update commands' commands "$@" +} +(( $+functions[_rustup__toolchain__update_commands] )) || +_rustup__toolchain__update_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain update commands' commands "$@" +} +(( $+functions[_rustup__update_commands] )) || +_rustup__update_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup update commands' commands "$@" +} +(( $+functions[_rustup__self__upgrade-data_commands] )) || +_rustup__self__upgrade-data_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup self upgrade-data commands' commands "$@" +} +(( $+functions[_rustup__which_commands] )) || +_rustup__which_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup which commands' commands "$@" +} + +_rustup "$@" \ No newline at end of file diff --git a/lib/path.zsh b/lib/path.zsh index b2c0ba7..2c742d6 100644 --- a/lib/path.zsh +++ b/lib/path.zsh @@ -1,27 +1,31 @@ #!/usr/bin/env zsh -prepend() { eval "export $1=\"$2:\$$1\""; } -append() { eval "export $1=\"\$$1:$2\""; } +arr_push() { eval "export $1=\"$2:\$$1\""; } # user binaries -append PATH "$HOME/bin" -append PATH "$HOME/.local/bin" +arr_push PATH "$HOME/bin" +arr_push PATH "$HOME/.local/bin" # Rust binaries -prepend PATH "$HOME/.cargo/bin" +arr_push PATH "$HOME/.cargo/bin" # global Yarn packages -append PATH "$HOME/.config/yarn/global/node_modules/.bin" +arr_push PATH "$HOME/.config/yarn/global/node_modules/.bin" if is_macos; then - # GNU sed - prepend PATH "/usr/local/opt/gnu-tar/libexec/gnubin" - prepend MANPATH "/usr/local/opt/gnu-tar/libexec/gnuman" - # GNU tar - prepend PATH "/usr/local/opt/gnu-sed/libexec/gnubin" - prepend MANPATH "/usr/local/opt/gnu-sed/libexec/gnuman" - # GNU coreutils - prepend PATH "/usr/local/opt/coreutils/libexec/gnubin" - prepend MANPATH "/usr/local/opt/coreutils/libexec/gnuman" # Haskell packages - append PATH "$HOME/Library/Haskell/bin" + arr_push PATH "$HOME/Library/Haskell/bin" + + # GNU sed + arr_push PATH "/usr/local/opt/gnu-tar/libexec/gnubin" + arr_push MANPATH "/usr/local/opt/gnu-tar/libexec/gnuman" + # GNU tar + arr_push PATH "/usr/local/opt/gnu-sed/libexec/gnubin" + arr_push MANPATH "/usr/local/opt/gnu-sed/libexec/gnuman" + # GNU coreutils + arr_push PATH "/usr/local/opt/coreutils/libexec/gnubin" + arr_push MANPATH "/usr/local/opt/coreutils/libexec/gnuman" fi +arr_push FPATH "$DOTFILES_PATH/completions" +command_exists rustc && arr_push FPATH "$(rustc --print sysroot)/share/zsh/site-functions" + +unset arr_push From 1761866e289b41a210b1c2e6db2a9a90f81a43f0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 9 Sep 2018 15:17:15 +0300 Subject: [PATCH 043/713] upgrade dependencies --- fast-syntax-highlighting | 2 +- oh-my-zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fast-syntax-highlighting b/fast-syntax-highlighting index 7b8ab36..79ecce8 160000 --- a/fast-syntax-highlighting +++ b/fast-syntax-highlighting @@ -1 +1 @@ -Subproject commit 7b8ab36f88ee4625e1eb858e8538d78a0c1d1519 +Subproject commit 79ecce89f0e6a8ef36b582e41c8ade5a3e959f11 diff --git a/oh-my-zsh b/oh-my-zsh index 86542dc..08a2808 160000 --- a/oh-my-zsh +++ b/oh-my-zsh @@ -1 +1 @@ -Subproject commit 86542dcd8627d0e9a4b1acd8c01a9cdae4697698 +Subproject commit 08a280863661dd44aad20d494187d9c4ba12fac9 From 944005a485c3f42ef87712d3b1bebf16f4324225 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 20 Sep 2018 19:08:38 +0300 Subject: [PATCH 044/713] move aliases after oh-my-zsh --- zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zshrc b/zshrc index 2fe55f1..5284492 100755 --- a/zshrc +++ b/zshrc @@ -1,7 +1,7 @@ #!/usr/bin/env zsh if [[ -n "$DOTFILES_PATH" ]]; then - for script in functions path exports aliases oh-my-zsh widgets theme; do + for script in functions path exports oh-my-zsh aliases widgets theme; do source "$DOTFILES_PATH/lib/$script.zsh" source_if_exists "$DOTFILES_PATH/custom/$script.zsh" done From 3928db6f42db712c17a5a666602307c5f667b5a2 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 20 Sep 2018 19:08:59 +0300 Subject: [PATCH 045/713] upgrade oh-my-zsh --- oh-my-zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oh-my-zsh b/oh-my-zsh index 08a2808..918a78c 160000 --- a/oh-my-zsh +++ b/oh-my-zsh @@ -1 +1 @@ -Subproject commit 08a280863661dd44aad20d494187d9c4ba12fac9 +Subproject commit 918a78cfdb92b9301168cb9d62d8ddbbdfd907f6 From db5bd6f8108aeb19feefe78701e2e656f0e531e6 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 7 Oct 2018 16:03:36 +0300 Subject: [PATCH 046/713] remove Yarn completion --- zshrc | 1 - 1 file changed, 1 deletion(-) diff --git a/zshrc b/zshrc index 5284492..944c970 100755 --- a/zshrc +++ b/zshrc @@ -8,7 +8,6 @@ if [[ -n "$DOTFILES_PATH" ]]; then run_before rbenv 'eval "$(rbenv init -)"' run_before sdk 'source_if_exists "$SDKMAN_DIR/bin/sdkman-init.sh"' - run_before yarn 'source_if_exists "$(yarn global dir)/node_modules/tabtab/.completions/yarn.zsh"' python "$DOTFILES_PATH/welcome/main.py" else From d9c4e0083a8d2fb60885be203d9270b284144a6f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 7 Oct 2018 16:07:45 +0300 Subject: [PATCH 047/713] upgrade submodules --- fast-syntax-highlighting | 2 +- oh-my-zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fast-syntax-highlighting b/fast-syntax-highlighting index 79ecce8..d04fbe5 160000 --- a/fast-syntax-highlighting +++ b/fast-syntax-highlighting @@ -1 +1 @@ -Subproject commit 79ecce89f0e6a8ef36b582e41c8ade5a3e959f11 +Subproject commit d04fbe58d36cc8ecd7264d79d4afe86df6b2b5bf diff --git a/oh-my-zsh b/oh-my-zsh index 918a78c..a0c1eb3 160000 --- a/oh-my-zsh +++ b/oh-my-zsh @@ -1 +1 @@ -Subproject commit 918a78cfdb92b9301168cb9d62d8ddbbdfd907f6 +Subproject commit a0c1eb32306734085ed26e2447f1050768b95d24 From bcc88aac6eb561151450efc13a7838d142fbe447 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 11 Oct 2018 23:38:05 +0300 Subject: [PATCH 048/713] add paths to Rust's man pages --- lib/path.zsh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/path.zsh b/lib/path.zsh index 2c742d6..1f9c054 100644 --- a/lib/path.zsh +++ b/lib/path.zsh @@ -26,6 +26,13 @@ if is_macos; then fi arr_push FPATH "$DOTFILES_PATH/completions" -command_exists rustc && arr_push FPATH "$(rustc --print sysroot)/share/zsh/site-functions" + +# Rust +if command_exists rustc; then + rust_sysroot="$(rustc --print sysroot)" + arr_push FPATH "${rust_sysroot}/share/zsh/site-functions" + arr_push MANPATH "${rust_sysroot}/share/man" + unset rust_sysroot +fi unset arr_push From 4530e2983f462cb168894f012991975d9244b9ad Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 11 Oct 2018 23:38:53 +0300 Subject: [PATCH 049/713] upgrade dependencies --- fast-syntax-highlighting | 2 +- oh-my-zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fast-syntax-highlighting b/fast-syntax-highlighting index d04fbe5..e8adbaa 160000 --- a/fast-syntax-highlighting +++ b/fast-syntax-highlighting @@ -1 +1 @@ -Subproject commit d04fbe58d36cc8ecd7264d79d4afe86df6b2b5bf +Subproject commit e8adbaa65e9a807f453571d232353141ada8bb35 diff --git a/oh-my-zsh b/oh-my-zsh index a0c1eb3..6fecbf6 160000 --- a/oh-my-zsh +++ b/oh-my-zsh @@ -1 +1 @@ -Subproject commit a0c1eb32306734085ed26e2447f1050768b95d24 +Subproject commit 6fecbf6ad5fc6e78dcfd89227cf8b12305b1f8bc From 55d7ce2c71f4ec2f22f479a1b00916a56178361e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 12 Oct 2018 07:34:27 +0300 Subject: [PATCH 050/713] add path to libraries installed with Homebrew --- lib/path.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/path.zsh b/lib/path.zsh index 1f9c054..4619d81 100644 --- a/lib/path.zsh +++ b/lib/path.zsh @@ -10,6 +10,9 @@ arr_push PATH "$HOME/.cargo/bin" # global Yarn packages arr_push PATH "$HOME/.config/yarn/global/node_modules/.bin" +# path to libraries installed with Homebrew +arr_push LIBRARY_PATH "/usr/local/lib" + if is_macos; then # Haskell packages arr_push PATH "$HOME/Library/Haskell/bin" From 5eaae4bcd237c48b5ebdeb1c5584a2ad98a6dd3c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 15 Oct 2018 10:00:05 +0300 Subject: [PATCH 051/713] fix tmux splits in the terminal palette --- hammerspoon/TerminalPalette.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hammerspoon/TerminalPalette.lua b/hammerspoon/TerminalPalette.lua index 5df7d89..c797175 100644 --- a/hammerspoon/TerminalPalette.lua +++ b/hammerspoon/TerminalPalette.lua @@ -59,8 +59,8 @@ items = { { text = "tmux: last window", keys = {{"ctrl","B"},{"l"}} }, { text = "tmux: find window", keys = {{"ctrl","B"},{"f"}} }, - { text = "tmux: split vertically", keys = {{"ctrl","B"},{"shift","'"}} }, - { text = "tmux: split horizontally", keys = {{"ctrl","B"},{"shift","5"}} }, + { text = "tmux: split horizontally", keys = {{"ctrl","B"},{"shift","'"}} }, + { text = "tmux: split vertically", keys = {{"ctrl","B"},{"shift","5"}} }, { text = "tmux: switch to pane in a direction", keys = {{"ctrl","B"}}, message = "press an arrow key" }, { text = "tmux: kill current pane", keys = {{"ctrl","B"},{"x"}} }, { text = "tmux: next pane", keys = {{"ctrl","B"},{"o"}} }, From a507119ab036be973896be1f3998e644cd986de2 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 9 Nov 2018 21:28:28 +0200 Subject: [PATCH 052/713] use different zsh startup files --- install.sh | 20 +++++++++++--------- zlogin | 5 +++++ zshenv | 10 ++++++++++ zshrc | 6 +----- 4 files changed, 27 insertions(+), 14 deletions(-) create mode 100644 zlogin create mode 100644 zshenv diff --git a/install.sh b/install.sh index b35b8c6..9535d1b 100755 --- a/install.sh +++ b/install.sh @@ -1,16 +1,18 @@ #!/usr/bin/env bash -ZSHRC=~/.zshrc -ZSHRC_BACKUP=~/.zshrc.pre-dmitmel-dotfiles +for zsh_file_name in z{shenv,shrc,login}; do + zsh_file="${HOME}/.${zsh_file_name}" -if [[ -f $ZSHRC ]]; then - echo "Backing up $ZSHRC to $ZSHRC_BACKUP" - mv $ZSHRC $ZSHRC_BACKUP -fi + if [[ -f "$zsh_file" ]]; then + zsh_file_backup="${zsh_file}.dmitmel-dotfiles-backup" + echo "Backing up $zsh_file to $zsh_file_backup" + mv -vi "$zsh_file" "$zsh_file_backup" + fi -cat > $ZSHRC < "$zsh_file" <&2 +fi diff --git a/zshrc b/zshrc index 944c970..4ee333a 100755 --- a/zshrc +++ b/zshrc @@ -1,15 +1,11 @@ #!/usr/bin/env zsh if [[ -n "$DOTFILES_PATH" ]]; then - for script in functions path exports oh-my-zsh aliases widgets theme; do + for script in oh-my-zsh aliases widgets theme; do source "$DOTFILES_PATH/lib/$script.zsh" source_if_exists "$DOTFILES_PATH/custom/$script.zsh" done run_before rbenv 'eval "$(rbenv init -)"' run_before sdk 'source_if_exists "$SDKMAN_DIR/bin/sdkman-init.sh"' - - python "$DOTFILES_PATH/welcome/main.py" -else - echo "please, set DOTFILES_PATH to the path to your dotfiles directory" >&2 fi From a523ed910dedc61cf709be1970dbebfa7ce737aa Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 9 Nov 2018 21:32:21 +0200 Subject: [PATCH 053/713] upgrade dependencies --- fast-syntax-highlighting | 2 +- oh-my-zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fast-syntax-highlighting b/fast-syntax-highlighting index e8adbaa..8ac992d 160000 --- a/fast-syntax-highlighting +++ b/fast-syntax-highlighting @@ -1 +1 @@ -Subproject commit e8adbaa65e9a807f453571d232353141ada8bb35 +Subproject commit 8ac992d99c5da68fe729cb6fb365622d36c9e957 diff --git a/oh-my-zsh b/oh-my-zsh index 6fecbf6..05b6170 160000 --- a/oh-my-zsh +++ b/oh-my-zsh @@ -1 +1 @@ -Subproject commit 6fecbf6ad5fc6e78dcfd89227cf8b12305b1f8bc +Subproject commit 05b617066ba5a37ef0c533385efd6e232a387b8f From 6fcb6b0750b4f9c97f1c929a5565afbee77672de Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 10 Nov 2018 16:51:47 +0200 Subject: [PATCH 054/713] automatically get DOTFILES_PATH --- install.sh | 3 +-- zlogin | 6 +++--- zshenv | 14 ++++++-------- zshrc | 16 ++++++++-------- 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/install.sh b/install.sh index 9535d1b..97c1a9e 100755 --- a/install.sh +++ b/install.sh @@ -12,7 +12,6 @@ for zsh_file_name in z{shenv,shrc,login}; do cat > "$zsh_file" <&2 -fi +DOTFILES_PATH="${0:h}" + +for script in functions path exports; do + source "$DOTFILES_PATH/lib/$script.zsh" + source_if_exists "$DOTFILES_PATH/custom/$script.zsh" +done diff --git a/zshrc b/zshrc index 4ee333a..745964a 100755 --- a/zshrc +++ b/zshrc @@ -1,11 +1,11 @@ #!/usr/bin/env zsh -if [[ -n "$DOTFILES_PATH" ]]; then - for script in oh-my-zsh aliases widgets theme; do - source "$DOTFILES_PATH/lib/$script.zsh" - source_if_exists "$DOTFILES_PATH/custom/$script.zsh" - done +DOTFILES_PATH="${0:h}" - run_before rbenv 'eval "$(rbenv init -)"' - run_before sdk 'source_if_exists "$SDKMAN_DIR/bin/sdkman-init.sh"' -fi +for script in oh-my-zsh aliases widgets theme; do + source "$DOTFILES_PATH/lib/$script.zsh" + source_if_exists "$DOTFILES_PATH/custom/$script.zsh" +done + +run_before rbenv 'eval "$(rbenv init -)"' +run_before sdk 'source_if_exists "$SDKMAN_DIR/bin/sdkman-init.sh"' From 901fd66a30b999caf052a3c1c10e5691588343ed Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 10 Nov 2018 16:55:37 +0200 Subject: [PATCH 055/713] use zgen --- .gitmodules | 9 +++----- fast-syntax-highlighting | 1 - lib/oh-my-zsh.zsh | 38 ---------------------------------- lib/theme.zsh | 7 ------- lib/zgen.zsh | 44 ++++++++++++++++++++++++++++++++++++++++ oh-my-zsh | 1 - zgen | 1 + zshrc | 2 +- 8 files changed, 49 insertions(+), 54 deletions(-) delete mode 160000 fast-syntax-highlighting delete mode 100644 lib/oh-my-zsh.zsh create mode 100644 lib/zgen.zsh delete mode 160000 oh-my-zsh create mode 160000 zgen diff --git a/.gitmodules b/.gitmodules index f26f5db..696b396 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "oh-my-zsh"] - path = oh-my-zsh - url = https://github.com/robbyrussell/oh-my-zsh.git -[submodule "fast-syntax-highlighting"] - path = fast-syntax-highlighting - url = https://github.com/zdharma/fast-syntax-highlighting.git +[submodule "zgen"] + path = zgen + url = https://github.com/tarjoilija/zgen.git diff --git a/fast-syntax-highlighting b/fast-syntax-highlighting deleted file mode 160000 index 8ac992d..0000000 --- a/fast-syntax-highlighting +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8ac992d99c5da68fe729cb6fb365622d36c9e957 diff --git a/lib/oh-my-zsh.zsh b/lib/oh-my-zsh.zsh deleted file mode 100644 index 67ffe31..0000000 --- a/lib/oh-my-zsh.zsh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env zsh - -configure_oh_my_zsh() { - export ZSH="$DOTFILES_PATH/oh-my-zsh" - - # see https://github.com/robbyrussell/oh-my-zsh/wiki/Themes - export ZSH_THEME="agnoster" - - # use hyphen-insensitive completion (makes `_` and `-` interchangeable) - export HYPHEN_INSENSITIVE="true" - - # enable command auto-correction - export ENABLE_CORRECTION="true" - - # display red dots while waiting for completion - export COMPLETION_WAITING_DOTS="true" - - # disable marking untracked files under VCS as dirty (this makes repository - # status check for large repositories faster) - export DISABLE_UNTRACKED_FILES_DIRTY="true" - - # command execution time stamp shown in the history - export HIST_STAMPS="mm/dd/yyyy" - - # https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins - plugins=( - git - common-aliases - extract - ) - - if is_linux; then - plugins+=(command-not-found) - fi -} - -configure_oh_my_zsh -source "$ZSH/oh-my-zsh.sh" diff --git a/lib/theme.zsh b/lib/theme.zsh index a999611..63996b6 100644 --- a/lib/theme.zsh +++ b/lib/theme.zsh @@ -1,11 +1,5 @@ #!/usr/bin/env zsh -configure_syntax_highlighting() { - # set directory for compiled theme files - FAST_WORK_DIR="$DOTFILES_PATH/cache" - source "$DOTFILES_PATH/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh" -} - configure_dircolors() { [[ -f ~/.dircolors ]] && eval "$(dircolors ~/.dircolors)" [[ -z "$LS_COLORS" ]] && eval "$(dircolors -b)" @@ -13,5 +7,4 @@ configure_dircolors() { zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}" } -configure_syntax_highlighting configure_dircolors diff --git a/lib/zgen.zsh b/lib/zgen.zsh new file mode 100644 index 0000000..c728813 --- /dev/null +++ b/lib/zgen.zsh @@ -0,0 +1,44 @@ +#!/usr/bin/env zsh + +configure_oh_my_zsh() { + # use hyphen-insensitive completion (makes `_` and `-` interchangeable) + HYPHEN_INSENSITIVE="true" + + # enable command auto-correction + ENABLE_CORRECTION="true" + + # display red dots while waiting for completion + COMPLETION_WAITING_DOTS="true" + + # disable marking untracked files under VCS as dirty (this makes repository + # status check for large repositories faster) + DISABLE_UNTRACKED_FILES_DIRTY="true" + + # command execution time stamp shown in the history + HIST_STAMPS="mm/dd/yyyy" +} + +configure_syntax_highlighting() { + FAST_WORK_DIR="$DOTFILES_PATH/cache" +} + +configure_oh_my_zsh +configure_syntax_highlighting + +source "$DOTFILES_PATH/zgen/zgen.zsh" + +if ! zgen saved; then + zgen oh-my-zsh + + zgen oh-my-zsh plugins/git + zgen oh-my-zsh plugins/common-aliases + zgen oh-my-zsh plugins/extract + zgen oh-my-zsh plugins/fasd + is_linux && zgen oh-my-zsh plugins/command-not-found + + zgen load zdharma/fast-syntax-highlighting + + zgen oh-my-zsh themes/agnoster + + zgen save +fi diff --git a/oh-my-zsh b/oh-my-zsh deleted file mode 160000 index 05b6170..0000000 --- a/oh-my-zsh +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 05b617066ba5a37ef0c533385efd6e232a387b8f diff --git a/zgen b/zgen new file mode 160000 index 0000000..0b669d2 --- /dev/null +++ b/zgen @@ -0,0 +1 @@ +Subproject commit 0b669d2d0dcf788b4c81a7a30b4fa41dfbf7d1a7 diff --git a/zshrc b/zshrc index 745964a..97cfbf3 100755 --- a/zshrc +++ b/zshrc @@ -2,7 +2,7 @@ DOTFILES_PATH="${0:h}" -for script in oh-my-zsh aliases widgets theme; do +for script in zgen aliases widgets theme; do source "$DOTFILES_PATH/lib/$script.zsh" source_if_exists "$DOTFILES_PATH/custom/$script.zsh" done From d797a5937583275abba93de9116f0b6f952d0509 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 10 Nov 2018 22:03:34 +0200 Subject: [PATCH 056/713] rename run_before to lazy_load --- lib/functions.zsh | 2 +- zshrc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index 838b0c6..b1a61f0 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -20,7 +20,7 @@ source_if_exists() { [[ -f "$1" ]] && source "$1" } -run_before() { +lazy_load() { local command="$1" local init_command="$2" diff --git a/zshrc b/zshrc index 97cfbf3..bb4662a 100755 --- a/zshrc +++ b/zshrc @@ -7,5 +7,5 @@ for script in zgen aliases widgets theme; do source_if_exists "$DOTFILES_PATH/custom/$script.zsh" done -run_before rbenv 'eval "$(rbenv init -)"' -run_before sdk 'source_if_exists "$SDKMAN_DIR/bin/sdkman-init.sh"' +lazy_load rbenv 'eval "$(rbenv init -)"' +lazy_load sdk 'source_if_exists "$SDKMAN_DIR/bin/sdkman-init.sh"' From 32b874f07cca12243585b9543fad0cd2a7ba8798 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 13 Nov 2018 08:05:03 +0200 Subject: [PATCH 057/713] refactor path.zsh --- install.sh | 6 ++--- lib/path.zsh | 76 +++++++++++++++++++++++++++++++--------------------- zshenv | 8 ------ zshrc | 2 +- 4 files changed, 49 insertions(+), 43 deletions(-) delete mode 100644 zshenv diff --git a/install.sh b/install.sh index 97c1a9e..6780614 100755 --- a/install.sh +++ b/install.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash -for zsh_file_name in z{shenv,shrc,login}; do - zsh_file="${HOME}/.${zsh_file_name}" +for zsh_file_name in zshrc zlogin; do + zsh_file="$HOME/.$zsh_file_name" if [[ -f "$zsh_file" ]]; then - zsh_file_backup="${zsh_file}.dmitmel-dotfiles-backup" + zsh_file_backup="$zsh_file.dmitmel-dotfiles-backup" echo "Backing up $zsh_file to $zsh_file_backup" mv -vi "$zsh_file" "$zsh_file_backup" fi diff --git a/lib/path.zsh b/lib/path.zsh index 4619d81..a9319c0 100644 --- a/lib/path.zsh +++ b/lib/path.zsh @@ -1,41 +1,55 @@ #!/usr/bin/env zsh -arr_push() { eval "export $1=\"$2:\$$1\""; } - -# user binaries -arr_push PATH "$HOME/bin" -arr_push PATH "$HOME/.local/bin" -# Rust binaries -arr_push PATH "$HOME/.cargo/bin" -# global Yarn packages -arr_push PATH "$HOME/.config/yarn/global/node_modules/.bin" - -# path to libraries installed with Homebrew -arr_push LIBRARY_PATH "/usr/local/lib" +# make these variables unique (-U) arrays (-a) +typeset -aU fpath manpath path if is_macos; then - # Haskell packages - arr_push PATH "$HOME/Library/Haskell/bin" + path=( + ~/Library/Python/bin + ~/Library/Haskell/bin + /usr/local/opt/file-formula/bin # file + /usr/local/opt/gnu-sed/libexec/gnubin # GNU sed + /usr/local/opt/gnu-tar/libexec/gnubin # GNU tar + /usr/local/opt/unzip/bin # GNU unzip + /usr/local/opt/openssl/bin # openssl + /usr/local/opt/gnu-getopt/bin # getopt + /usr/local/opt/findutils/libexec/gnubin # GNU findutils + /usr/local/opt/binutils/bin # GNU binutils + /usr/local/opt/coreutils/libexec/gnubin # GNU coreutils + "${path[@]}" + ) - # GNU sed - arr_push PATH "/usr/local/opt/gnu-tar/libexec/gnubin" - arr_push MANPATH "/usr/local/opt/gnu-tar/libexec/gnuman" - # GNU tar - arr_push PATH "/usr/local/opt/gnu-sed/libexec/gnubin" - arr_push MANPATH "/usr/local/opt/gnu-sed/libexec/gnuman" - # GNU coreutils - arr_push PATH "/usr/local/opt/coreutils/libexec/gnubin" - arr_push MANPATH "/usr/local/opt/coreutils/libexec/gnuman" + manpath=( + /usr/local/opt/file-formula/share/man # file + /usr/local/opt/gnu-sed/libexec/gnuman # GNU sed + /usr/local/opt/gnu-tar/libexec/gnuman # GNU tar + /usr/local/opt/unzip/share/man # GNU unzip + /usr/local/opt/openssl/share/man # openssl + /usr/local/opt/gnu-getopt/share/man # getopt + /usr/local/opt/findutils/libexec/gnuman # GNU findutils + /usr/local/opt/binutils/share/man # GNU binutils + /usr/local/opt/coreutils/libexec/gnuman # GNU coreutils + "${manpath[@]}" + ) fi -arr_push FPATH "$DOTFILES_PATH/completions" +# add user binaries +path=(~/bin ~/.local/bin "${path[@]}") -# Rust -if command_exists rustc; then - rust_sysroot="$(rustc --print sysroot)" - arr_push FPATH "${rust_sysroot}/share/zsh/site-functions" - arr_push MANPATH "${rust_sysroot}/share/man" - unset rust_sysroot +# add my completions +fpath=("$DOTFILES_PATH/completions" "${fpath[@]}") + +# check for Rust installed via rustup +rust_sysroot="$(~/.cargo/bin/rustc --print sysroot)" +if [[ "$?" == 0 ]]; then + # add paths to the current Rust toolchain + path=(~/.cargo/bin "${path[@]}") + fpath=("$rust_sysroot/share/zsh/site-functions" "${fpath[@]}") + manpath=("$rust_sysroot/share/man" "${manpath[@]}") fi +unset rust_sysroot -unset arr_push +# add colon after MANPATH so that it doesn't overwrite system MANPATH +MANPATH="$MANPATH:" + +export PATH MANPATH diff --git a/zshenv b/zshenv deleted file mode 100644 index 3be8b37..0000000 --- a/zshenv +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env zsh - -DOTFILES_PATH="${0:h}" - -for script in functions path exports; do - source "$DOTFILES_PATH/lib/$script.zsh" - source_if_exists "$DOTFILES_PATH/custom/$script.zsh" -done diff --git a/zshrc b/zshrc index bb4662a..62d6874 100755 --- a/zshrc +++ b/zshrc @@ -2,7 +2,7 @@ DOTFILES_PATH="${0:h}" -for script in zgen aliases widgets theme; do +for script in functions path exports zgen aliases widgets theme; do source "$DOTFILES_PATH/lib/$script.zsh" source_if_exists "$DOTFILES_PATH/custom/$script.zsh" done From 5ad129199949c93f831ef2892ba9eafe31f53f2b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 13 Nov 2018 08:05:10 +0200 Subject: [PATCH 058/713] fix typos in widgets.zsh --- lib/widgets.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/widgets.zsh b/lib/widgets.zsh index aeea9f9..3d1ff09 100644 --- a/lib/widgets.zsh +++ b/lib/widgets.zsh @@ -60,10 +60,10 @@ _command-palette() { # may contain keybindings) widget="${widget%%$' '*}" # HACK: This small Python script is used to send simluated keystrokes to the - # currentl TTY. It first executes the 'execute-named-cmd' widget, then - # enters the widget name and finally types the 'Enter' key. (Python - # was chosen because it supports required functionallity out of the box). - # NOTE! This script may not work on all platforms (especially, on Windows)!!! + # current TTY. It first executes the 'execute-named-cmd' widget, then + # sends the widget name and finally types the 'Enter' key. (Python was + # chosen because it supports required functionallity out of the box). + # NOTE! This script may not work on all platforms (especially on Windows)!!! python -c " import fcntl, termios with open('$TTY') as tty: From e49d51cd601964d258dff8c84d0e46a148c7332e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 13 Nov 2018 23:59:41 +0200 Subject: [PATCH 059/713] use better code style in path.zsh --- lib/path.zsh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/path.zsh b/lib/path.zsh index a9319c0..d587435 100644 --- a/lib/path.zsh +++ b/lib/path.zsh @@ -40,8 +40,7 @@ path=(~/bin ~/.local/bin "${path[@]}") fpath=("$DOTFILES_PATH/completions" "${fpath[@]}") # check for Rust installed via rustup -rust_sysroot="$(~/.cargo/bin/rustc --print sysroot)" -if [[ "$?" == 0 ]]; then +if rust_sysroot="$(~/.cargo/bin/rustc --print sysroot)"; then # add paths to the current Rust toolchain path=(~/.cargo/bin "${path[@]}") fpath=("$rust_sysroot/share/zsh/site-functions" "${fpath[@]}") From 2ce5f1d5a57f94fc4baa9b9f6a4bcb999f4ad5ee Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 15 Nov 2018 17:08:23 +0200 Subject: [PATCH 060/713] add aliases --- lib/aliases.zsh | 40 +++++++++++++++++++++++++++++++++++++++- lib/zgen.zsh | 1 - 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index eacb8b4..088cd44 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -1,5 +1,43 @@ #!/usr/bin/env zsh +# This alias removes leading dollar sign. Useful when copying code from Stackoverflow alias '$'='' -alias find="noglob find" +alias grep='grep --color=auto' + +# exa is a modern replacement for ls - https://the.exa.website/ +if command_exists exa; then + alias ls="exa --classify --group-directories-first" + alias lsa="${aliases[ls]} --all" + alias l="${aliases[ls]} --long --header --binary --group" + alias la="${aliases[l]} --all" + alias tree="exa -T" +else + alias ls="ls --classify --group-directories-first --color=auto" + alias lsa="${aliases[ls]} --almost-all" + alias l="${aliases[ls]} -l --human-readable" + alias la="${aliases[l]} --almost-all" +fi + +# fd is a simple, fast and user-friendly alternative to find - https://github.com/sharkdp/fd +if command_exists fd; then + alias fda="fd --hidden --no-ignore" +else + alias fd="find -iname" + alias fda="${aliases[fd]}" +fi + +# git with hub +command_exists hub && alias git="hub" + +# make these utils more verbose +alias cp='cp -iv' +alias mv='mv -iv' +alias rm='rm -iv' +alias rmdir='rmdir -v' +alias chmod='chmod -v' +alias chown='chown -v' + +# print file sizes in human readable format +alias du='du -h' +alias df='df -h' diff --git a/lib/zgen.zsh b/lib/zgen.zsh index c728813..af4ead2 100644 --- a/lib/zgen.zsh +++ b/lib/zgen.zsh @@ -31,7 +31,6 @@ if ! zgen saved; then zgen oh-my-zsh zgen oh-my-zsh plugins/git - zgen oh-my-zsh plugins/common-aliases zgen oh-my-zsh plugins/extract zgen oh-my-zsh plugins/fasd is_linux && zgen oh-my-zsh plugins/command-not-found From 3514fbb8cb7ec3a5605b44db729f43e43464850b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 21 Nov 2018 15:52:11 +0200 Subject: [PATCH 061/713] use official agnoster theme --- lib/zgen.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/zgen.zsh b/lib/zgen.zsh index af4ead2..556697a 100644 --- a/lib/zgen.zsh +++ b/lib/zgen.zsh @@ -37,7 +37,12 @@ if ! zgen saved; then zgen load zdharma/fast-syntax-highlighting - zgen oh-my-zsh themes/agnoster + # official agnoster theme is much faster than one bundled with OMZ and has + # more features + zgen load agnoster/agnoster-zsh-theme agnoster zgen save fi + +# fix prompt theme +PLUSMINUS="$PLUSMINUS " From e740e1aa404f65c8d930d4650d384cabe352b208 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 28 Nov 2018 21:00:09 +0200 Subject: [PATCH 062/713] add support for Go --- lib/path.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/path.zsh b/lib/path.zsh index d587435..99a3047 100644 --- a/lib/path.zsh +++ b/lib/path.zsh @@ -33,6 +33,10 @@ if is_macos; then ) fi +# add Go binaries +export GOPATH="$HOME/.go" +path=("$GOPATH/bin" "${path[@]}") + # add user binaries path=(~/bin ~/.local/bin "${path[@]}") From ed96623fb642247d91c9bb32eafef5efad253f1c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 2 Dec 2018 12:06:15 +0200 Subject: [PATCH 063/713] fix "file not found" errors when Rust is not installed --- lib/path.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/path.zsh b/lib/path.zsh index 99a3047..202ddc3 100644 --- a/lib/path.zsh +++ b/lib/path.zsh @@ -44,7 +44,7 @@ path=(~/bin ~/.local/bin "${path[@]}") fpath=("$DOTFILES_PATH/completions" "${fpath[@]}") # check for Rust installed via rustup -if rust_sysroot="$(~/.cargo/bin/rustc --print sysroot)"; then +if rust_sysroot="$(~/.cargo/bin/rustc --print sysroot 2> /dev/null)"; then # add paths to the current Rust toolchain path=(~/.cargo/bin "${path[@]}") fpath=("$rust_sysroot/share/zsh/site-functions" "${fpath[@]}") From f0af4e3261eca227c57e53db555b08e43915b175 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 2 Dec 2018 17:19:28 +0200 Subject: [PATCH 064/713] tweak colors in welcome script --- welcome/main.py | 2 ++ welcome/system_info.py | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) mode change 100644 => 100755 welcome/main.py diff --git a/welcome/main.py b/welcome/main.py old mode 100644 new mode 100755 index c9ff6e0..160f359 --- a/welcome/main.py +++ b/welcome/main.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + import re from colors import Style, COLORS diff --git a/welcome/system_info.py b/welcome/system_info.py index 771199d..ce2993d 100644 --- a/welcome/system_info.py +++ b/welcome/system_info.py @@ -14,7 +14,7 @@ def get_system_info(): info_lines = [] def info(name, value, *format_args): - line = colored(name + ":", Style.BRIGHT, Fore.YELLOW) + " " + value + line = bright_colored(name + ":", Fore.YELLOW) + " " + value if format_args: line = line % format_args info_lines.append(line) @@ -88,9 +88,7 @@ def _get_users(): terminals = users[name] colored_name = bright_colored(name, Fore.BLUE) - colored_terminals = [ - colored(term, Style.BRIGHT, Fore.BLACK) for term in terminals - ] + colored_terminals = [colored(term, Style.DIM, Fore.WHITE) for term in terminals] terminals_str = ", ".join(colored_terminals) if len(colored_terminals) > 1: From 60d1f73cd740e748f50962466c39dbe2ee5a638f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 3 Dec 2018 10:27:28 +0200 Subject: [PATCH 065/713] disable OMZ auto updates --- lib/zgen.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/zgen.zsh b/lib/zgen.zsh index 556697a..62751a7 100644 --- a/lib/zgen.zsh +++ b/lib/zgen.zsh @@ -1,6 +1,9 @@ #!/usr/bin/env zsh configure_oh_my_zsh() { + # disable automatic updates because OMZ is managed by zgen + DISABLE_AUTO_UPDATE="true" + # use hyphen-insensitive completion (makes `_` and `-` interchangeable) HYPHEN_INSENSITIVE="true" From 7084c305d3382942d65b9033f2fb0f1d06f86d31 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 3 Dec 2018 10:31:41 +0200 Subject: [PATCH 066/713] update upgrade.sh script --- upgrade.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/upgrade.sh b/upgrade.sh index 473ff76..bfaad00 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -1,4 +1,10 @@ -#!/usr/bin/env bash +#!/usr/bin/env zsh + +DOTFILES_PATH="${0:h}" +cd "$DOTFILES_PATH" || exit 1 git pull --rebase --stat origin master git submodule update --init --recursive --remote + +source "./zgen/zgen.zsh" +zgen update From ddf9b3445b15c25eee9aeab0b619f74b3c7c8cf3 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 23 Dec 2018 00:36:10 +0200 Subject: [PATCH 067/713] update upgrade script --- upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upgrade.sh b/upgrade.sh index bfaad00..161e634 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -4,7 +4,7 @@ DOTFILES_PATH="${0:h}" cd "$DOTFILES_PATH" || exit 1 git pull --rebase --stat origin master -git submodule update --init --recursive --remote +git submodule update --init --recursive --remote --progress source "./zgen/zgen.zsh" zgen update From 153edbf30f3889a871cda78f0c97c5dca3432b13 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 2 Jan 2019 01:38:15 +0200 Subject: [PATCH 068/713] move welcome script to zshrc --- install.sh | 2 +- zlogin | 5 ----- zshrc | 2 ++ 3 files changed, 3 insertions(+), 6 deletions(-) delete mode 100644 zlogin diff --git a/install.sh b/install.sh index 6780614..7113248 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -for zsh_file_name in zshrc zlogin; do +for zsh_file_name in zshrc; do zsh_file="$HOME/.$zsh_file_name" if [[ -f "$zsh_file" ]]; then diff --git a/zlogin b/zlogin deleted file mode 100644 index 78c703f..0000000 --- a/zlogin +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env zsh - -DOTFILES_PATH="${0:h}" - -python "$DOTFILES_PATH/welcome/main.py" diff --git a/zshrc b/zshrc index 62d6874..7ef0d10 100755 --- a/zshrc +++ b/zshrc @@ -9,3 +9,5 @@ done lazy_load rbenv 'eval "$(rbenv init -)"' lazy_load sdk 'source_if_exists "$SDKMAN_DIR/bin/sdkman-init.sh"' + +python "$DOTFILES_PATH/welcome/main.py" From 827f1715bc844dca772211d21c86edeb87c8a7b0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 5 Jan 2019 00:00:27 +0200 Subject: [PATCH 069/713] initialize rbenv by default --- zshrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zshrc b/zshrc index 7ef0d10..0230d2f 100755 --- a/zshrc +++ b/zshrc @@ -7,7 +7,10 @@ for script in functions path exports zgen aliases widgets theme; do source_if_exists "$DOTFILES_PATH/custom/$script.zsh" done -lazy_load rbenv 'eval "$(rbenv init -)"' lazy_load sdk 'source_if_exists "$SDKMAN_DIR/bin/sdkman-init.sh"' +if command_exists rbenv; then + eval "$(rbenv init -)" +fi + python "$DOTFILES_PATH/welcome/main.py" From d60c8374945c2b8596ac94cc4a1a08aac254c289 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 5 Jan 2019 13:07:28 +0200 Subject: [PATCH 070/713] remove sdkman --- lib/exports.zsh | 1 - zshrc | 2 -- 2 files changed, 3 deletions(-) diff --git a/lib/exports.zsh b/lib/exports.zsh index 61dadad..08d91ac 100644 --- a/lib/exports.zsh +++ b/lib/exports.zsh @@ -20,4 +20,3 @@ fi export CLICOLOR="1" -export SDKMAN_DIR="$HOME/.sdkman" diff --git a/zshrc b/zshrc index 0230d2f..696dab4 100755 --- a/zshrc +++ b/zshrc @@ -7,8 +7,6 @@ for script in functions path exports zgen aliases widgets theme; do source_if_exists "$DOTFILES_PATH/custom/$script.zsh" done -lazy_load sdk 'source_if_exists "$SDKMAN_DIR/bin/sdkman-init.sh"' - if command_exists rbenv; then eval "$(rbenv init -)" fi From 76db45d0c2113a6f900200c373e6fa5eca4db898 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 9 Jan 2019 18:55:19 +0200 Subject: [PATCH 071/713] refactor functions.zsh --- lib/functions.zsh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index b1a61f0..c43df16 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -24,12 +24,9 @@ lazy_load() { local command="$1" local init_command="$2" - eval "$(cat < Date: Sun, 13 Jan 2019 15:49:08 +0200 Subject: [PATCH 072/713] patch prompt a bit --- lib/theme.zsh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/theme.zsh b/lib/theme.zsh index 63996b6..aaf01c9 100644 --- a/lib/theme.zsh +++ b/lib/theme.zsh @@ -8,3 +8,9 @@ configure_dircolors() { } configure_dircolors + +# This ugly hack is required only for the agnoster theme which I use. I'm +# probably going to switch to another theme because it is so damn slow +autoload -Uz add-zsh-hook +_patch-prompt() { PROMPT="$PROMPT"$'\n%{%F{247}%}\u03bb>%{%b%f%} '; } +add-zsh-hook precmd _patch-prompt From 6cee360185cdcb69bbd2954110279bc43bf2ce5c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 13 Jan 2019 16:13:59 +0200 Subject: [PATCH 073/713] use fzf instead of peco --- lib/widgets.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/widgets.zsh b/lib/widgets.zsh index 3d1ff09..b196c45 100644 --- a/lib/widgets.zsh +++ b/lib/widgets.zsh @@ -53,8 +53,8 @@ unset widget_{name,info,key,keys} # command palette allows you to search for widgets _command-palette() { - # widget is selected with 'peco', a 'Simplistic interactive filtering tool' - local widget="$(echo "$widgets_str" | peco)" + # widget is selected with a fuzzy finder + local widget="$(echo "$widgets_str" | fzf)" if [[ -n "$widget" ]]; then # parse widget name by cutting the selected string to the first space (which # may contain keybindings) From 35b801d6b9c04203ff50e259897ed1b1b222b625 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 13 Jan 2019 16:15:55 +0200 Subject: [PATCH 074/713] use bold color in prompt --- lib/theme.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/theme.zsh b/lib/theme.zsh index aaf01c9..54f87b5 100644 --- a/lib/theme.zsh +++ b/lib/theme.zsh @@ -12,5 +12,5 @@ configure_dircolors # This ugly hack is required only for the agnoster theme which I use. I'm # probably going to switch to another theme because it is so damn slow autoload -Uz add-zsh-hook -_patch-prompt() { PROMPT="$PROMPT"$'\n%{%F{247}%}\u03bb>%{%b%f%} '; } +_patch-prompt() { PROMPT="$PROMPT"$'\n%{%B%}\u03bb>%{%b%} '; } add-zsh-hook precmd _patch-prompt From a0c4f91ed1a1ac5b07c36256919811b422642729 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 13 Jan 2019 16:16:37 +0200 Subject: [PATCH 075/713] disable OMZ auto-update prompt while upgrading --- upgrade.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/upgrade.sh b/upgrade.sh index 161e634..3ff29cb 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -6,5 +6,6 @@ cd "$DOTFILES_PATH" || exit 1 git pull --rebase --stat origin master git submodule update --init --recursive --remote --progress +DISABLE_AUTO_UPDATE=true source "./zgen/zgen.zsh" zgen update From 699f12bb1d65c36fdea9fd602d4dd9209bca4549 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 17 Jan 2019 07:58:51 +0200 Subject: [PATCH 076/713] change prompt from agnoster to spaceship --- lib/theme.zsh | 6 ------ lib/zgen.zsh | 41 +++++++++++++++++++++++++++++++++++------ 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/lib/theme.zsh b/lib/theme.zsh index 54f87b5..63996b6 100644 --- a/lib/theme.zsh +++ b/lib/theme.zsh @@ -8,9 +8,3 @@ configure_dircolors() { } configure_dircolors - -# This ugly hack is required only for the agnoster theme which I use. I'm -# probably going to switch to another theme because it is so damn slow -autoload -Uz add-zsh-hook -_patch-prompt() { PROMPT="$PROMPT"$'\n%{%B%}\u03bb>%{%b%} '; } -add-zsh-hook precmd _patch-prompt diff --git a/lib/zgen.zsh b/lib/zgen.zsh index 62751a7..15c294e 100644 --- a/lib/zgen.zsh +++ b/lib/zgen.zsh @@ -25,8 +25,42 @@ configure_syntax_highlighting() { FAST_WORK_DIR="$DOTFILES_PATH/cache" } +configure_prompt() { + SPACESHIP_PROMPT_ADD_NEWLINE=false + + SPACESHIP_PROMPT_ORDER=( + user + host + dir + git + # hg + exec_time + line_sep + # vi_mode + jobs + exit_code + char + ) + + SPACESHIP_CHAR_SYMBOL="$ " + SPACESHIP_CHAR_SYMBOL_ROOT="# " + SPACESHIP_CHAR_SYMBOL_SECONDARY="> " + SPACESHIP_GIT_STATUS_DELETED="\u2718 " + SPACESHIP_HG_STATUS_DELETED="\u2718 " + SPACESHIP_EXIT_CODE_SYMBOL="\u2718 " + SPACESHIP_JOBS_SYMBOL="\u2726 " + + SPACESHIP_USER_SHOW=always + + SPACESHIP_DIR_TRUNC=0 + SPACESHIP_DIR_TRUNC_REPO=false + + SPACESHIP_EXIT_CODE_SHOW=true +} + configure_oh_my_zsh configure_syntax_highlighting +configure_prompt source "$DOTFILES_PATH/zgen/zgen.zsh" @@ -40,12 +74,7 @@ if ! zgen saved; then zgen load zdharma/fast-syntax-highlighting - # official agnoster theme is much faster than one bundled with OMZ and has - # more features - zgen load agnoster/agnoster-zsh-theme agnoster + zgen load denysdovhan/spaceship-prompt spaceship zgen save fi - -# fix prompt theme -PLUSMINUS="$PLUSMINUS " From 3edacb8d37c03b55d4449232942f046645b7a0ea Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 17 Jan 2019 08:07:39 +0200 Subject: [PATCH 077/713] remove DEFALT_USER env variable --- lib/exports.zsh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/exports.zsh b/lib/exports.zsh index 08d91ac..cd38942 100644 --- a/lib/exports.zsh +++ b/lib/exports.zsh @@ -6,11 +6,6 @@ export LC_ALL="$LANG" if [[ -z "$USER" && -n "$USERNAME" ]]; then export USER="$USERNAME" fi -if is_android; then - export DEFAULT_USER="$USER" -else - export DEFAULT_USER="dmitmel" -fi if [[ -n "$SSH_CONNECTION" ]]; then export EDITOR="rmate" From 51bb000d6ad148ab331efe94bfd254370f5415c4 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 20 Jan 2019 18:32:23 +0200 Subject: [PATCH 078/713] replace command palette with a snippet palette --- lib/palette.zsh | 107 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/widgets.zsh | 79 ----------------------------------- zshrc | 2 +- 3 files changed, 108 insertions(+), 80 deletions(-) create mode 100644 lib/palette.zsh delete mode 100644 lib/widgets.zsh diff --git a/lib/palette.zsh b/lib/palette.zsh new file mode 100644 index 0000000..d29acd5 --- /dev/null +++ b/lib/palette.zsh @@ -0,0 +1,107 @@ +#!/usr/bin/env zsh + +# This file contains a ZLE widget called 'palette' that lets you select a +# command snippet and fill in its placeholders. It uses "TLDR pages" as the +# snippet database, so the widget will download them on the first invocation. +# Or, you can also create a symlink to a local cache of a "TLDR pages" client, +# e.g. for tealdeer (which is what I use): +# +# ln -sv ~/.cache/tealdeer/tldr-master/pages $ZSH_CACHE_DIR/tldr-pages +# +# Usage: +# 1. press Alt+Shift+P (or Esc+Shift+P) +# 2. select snippet in the fuzzy finder (fzf) +# 3. Press Alt+Shift+P again, this time it'll take you to the first placeholder +# 4. Enter some text +# 5. Repeat steps 3 and 4 until there're no placeholders left +# +# Requirements/Dependencies: +# 1. AWK (any implementation will probably work) for parsing "TLDR pages" +# 2. the FZF fuzzy finder +# 3. Tar (any implementation will probably work) and Curl for downloading +# "TLDR pages" + +PALETTE_TLDR_PAGES_DIR="$ZSH_CACHE_DIR/tldr-pages" + +# strings which are used to mark placeholders (please don't modify) +PALETTE_PLACEHOLDER_START="{{" +PALETTE_PLACEHOLDER_END="}}" + +# a string which is used to separate snippet from its description in the +# fuzzy-finder +PALETTE_SNIPPET_COMMENT=" ## " + +# Main function of the widget +_palette_widget() { + # download "TLDR pages" if we don't have them + if [[ ! -d "$PALETTE_TLDR_PAGES_DIR" ]]; then + echo + _palette_download_tldr_pages + echo + fi + + # try to fill in a placeholder if there're any, otherwise pick a snippet + if ! _palette_fill_in_placeholder; then + local selected + if selected="$(_palette_parse_tldr_pages | fzf --ansi --cycle --height 50% --reverse)" + then + # paste selected snippet without its description + zle -U "${selected%%$PALETTE_SNIPPET_COMMENT*}" + fi + fi + + # immediately redraw + zle redisplay +} + +# This function deletes the first placeholder from the buffer and places the +# cursor at the beginning of that placeholder. If there're no placeholders in +# the buffer, it exits with exit code 1. +_palette_fill_in_placeholder() { + # NOTE!!! indexes in ZSH arrays start at one! + local start_index="${BUFFER[(i)$PALETTE_PLACEHOLDER_START]}" + (( start_index == 0 || start_index > ${#BUFFER} )) && return 1 + local end_index="${BUFFER[(i)$PALETTE_PLACEHOLDER_END]}" + # the CURSOR variable is zero-based while ZSH arrays are one-based + (( CURSOR = start_index - 1 )) + BUFFER="${BUFFER[1,start_index-1]}${BUFFER[end_index+2,${#BUFFER}]}" +} + +# This function parses "TLDR pages" for snippets using AWK. Fortunately, all +# "TLDR pages" files are use the same Markdown-like syntax so they're very easy +# to parse. +_palette_parse_tldr_pages() { + # I chose to use AWK here because it was designed specifically for text + # processing and includes all basic utilities that I need here. + awk ' + # when we find a "description" line... + match($0, /^- (.+):$/, match_groups) { + # ...get actual description from it... + description = match_groups[1] + # ...then skip any lines that are not actual commands, while saving RegEx + # match groups... + while (!match($0, /^`(.+)`$/, match_groups)) getline + # ...after that we can get the command... + command = match_groups[1] + # ...and finally, we print command and description, separated by + # PALETTE_SNIPPET_COMMENT, and with some colors! + printf "%s\x1b[90m'"$PALETTE_SNIPPET_COMMENT"'%s\x1b[0m\n", command, description + } + ' "$PALETTE_TLDR_PAGES_DIR"/**/*.md +} + +# This function downloads the "TLDR pages" +_palette_download_tldr_pages() { + mkdir -pv "$PALETTE_TLDR_PAGES_DIR" + echo "Downloading tldr pages..." + + if curl -Lf https://github.com/tldr-pages/tldr/archive/master.tar.gz | + tar -C "$PALETTE_TLDR_PAGES_DIR" --gzip --strip-components 2 --extract tldr-master/pages + then + echo "Done!" + fi +} + +# finally, bind the widget to Alt+Shift+P (or Esc+Shift+P) +zle -N _palette_widget +bindkey "^[P" _palette_widget diff --git a/lib/widgets.zsh b/lib/widgets.zsh deleted file mode 100644 index b196c45..0000000 --- a/lib/widgets.zsh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env zsh - -# define an associative array for widgets with their corresponding keybindings -typeset -A widgets_list -# get all widgets ('widgets' -> http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fzleparameter-Module) -for widget_name widget_info in ${(kv)widgets}; do - # ignore built-in widgets starting with a dot because ZSH defines them both - # with and without the dot - [[ "$widget_name" == .* ]] && continue - # ignore completion widgets - [[ "$widget_info" == completion:* ]] && continue - # by default, widgets don't have keybindings - widgets_list[$widget_name]="none" -done - -# get keybindings for widgets (one widget can have multiple keybindings) - -# iterate over existing keybindings (the 'f' flag splits output of the command -# by the '\n' char) -for line in "${(@f)$(bindkey)}"; do - # parse line a string of command-line arguments (eval is required here!) - eval "line_parts=($line)" - # array indexes in ZSH start from 1 (o_O) - widget_key="$line_parts[1]" - widget_name="$line_parts[2]" - - widget_keys="$widgets_list[$widget_name]" - if [[ -z "$widget_keys" ]]; then - continue - else - case "$widget_keys" in - none) widget_keys="keys:" ;; - keys:*) widget_keys+=" " ;; - esac - widgets_list[$widget_name]="$widget_keys{$widget_key}" - fi -done - -# convert list of widgets into a string -widgets_str="" -for widget_name widget_keys in ${(kv)widgets_list}; do - widgets_str+="$widget_name" - if [[ "$widget_keys" == keys:* ]]; then - # remove the 'keys:' prefix - widgets_str+=" ${widget_keys#keys:}" - fi - widgets_str+=$'\n' -done -# remove the trailing newline from the string -widgets_str="${widgets_str%$'\n'}" - -unset widget_{name,info,key,keys} - -# command palette allows you to search for widgets -_command-palette() { - # widget is selected with a fuzzy finder - local widget="$(echo "$widgets_str" | fzf)" - if [[ -n "$widget" ]]; then - # parse widget name by cutting the selected string to the first space (which - # may contain keybindings) - widget="${widget%%$' '*}" - # HACK: This small Python script is used to send simluated keystrokes to the - # current TTY. It first executes the 'execute-named-cmd' widget, then - # sends the widget name and finally types the 'Enter' key. (Python was - # chosen because it supports required functionallity out of the box). - # NOTE! This script may not work on all platforms (especially on Windows)!!! - python -c " -import fcntl, termios -with open('$TTY') as tty: - # ('\x1b' is the 'escape' char) - for char in '\x1bx${widget}\n': - # 'ioctl' is a syscall that can send special commands to file descriptors. - # 'TIOCSTI' is one of these commands and can be used to simulate keypresses. - fcntl.ioctl(tty, termios.TIOCSTI, char) -" - fi -} -zle -N command-palette _command-palette -bindkey "^[P" command-palette # Esc-Shift-P or Alt-Shift-P diff --git a/zshrc b/zshrc index 696dab4..d4c4016 100755 --- a/zshrc +++ b/zshrc @@ -2,7 +2,7 @@ DOTFILES_PATH="${0:h}" -for script in functions path exports zgen aliases widgets theme; do +for script in functions path exports zgen aliases palette theme; do source "$DOTFILES_PATH/lib/$script.zsh" source_if_exists "$DOTFILES_PATH/custom/$script.zsh" done From fa2cca9c44e03b843fef05dcfb554b20f0676dee Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 29 Jan 2019 12:45:24 +0200 Subject: [PATCH 079/713] fix python paths on mac --- lib/path.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/path.zsh b/lib/path.zsh index 202ddc3..7ced141 100644 --- a/lib/path.zsh +++ b/lib/path.zsh @@ -5,7 +5,7 @@ typeset -aU fpath manpath path if is_macos; then path=( - ~/Library/Python/bin + ~/Library/Python/*/bin ~/Library/Haskell/bin /usr/local/opt/file-formula/bin # file /usr/local/opt/gnu-sed/libexec/gnubin # GNU sed From 90b09e17378731ccc3155c1e7270a1d4d4088735 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 30 Jan 2019 16:52:01 +0200 Subject: [PATCH 080/713] remove unneeded program paths --- lib/path.zsh | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/path.zsh b/lib/path.zsh index 7ced141..e2348cd 100644 --- a/lib/path.zsh +++ b/lib/path.zsh @@ -6,9 +6,7 @@ typeset -aU fpath manpath path if is_macos; then path=( ~/Library/Python/*/bin - ~/Library/Haskell/bin /usr/local/opt/file-formula/bin # file - /usr/local/opt/gnu-sed/libexec/gnubin # GNU sed /usr/local/opt/gnu-tar/libexec/gnubin # GNU tar /usr/local/opt/unzip/bin # GNU unzip /usr/local/opt/openssl/bin # openssl @@ -21,7 +19,6 @@ if is_macos; then manpath=( /usr/local/opt/file-formula/share/man # file - /usr/local/opt/gnu-sed/libexec/gnuman # GNU sed /usr/local/opt/gnu-tar/libexec/gnuman # GNU tar /usr/local/opt/unzip/share/man # GNU unzip /usr/local/opt/openssl/share/man # openssl From c4b4c33e583ddb816b861c3bd3cca6c4df22e040 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 2 Feb 2019 13:12:31 +0200 Subject: [PATCH 081/713] add paths to Homebrew-installed ruby on Mac --- lib/path.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/path.zsh b/lib/path.zsh index e2348cd..3101182 100644 --- a/lib/path.zsh +++ b/lib/path.zsh @@ -6,6 +6,7 @@ typeset -aU fpath manpath path if is_macos; then path=( ~/Library/Python/*/bin + /usr/local/opt/ruby/bin /usr/local/opt/file-formula/bin # file /usr/local/opt/gnu-tar/libexec/gnubin # GNU tar /usr/local/opt/unzip/bin # GNU unzip @@ -18,6 +19,7 @@ if is_macos; then ) manpath=( + /usr/local/opt/ruby/share/man /usr/local/opt/file-formula/share/man # file /usr/local/opt/gnu-tar/libexec/gnuman # GNU tar /usr/local/opt/unzip/share/man # GNU unzip @@ -42,7 +44,7 @@ fpath=("$DOTFILES_PATH/completions" "${fpath[@]}") # check for Rust installed via rustup if rust_sysroot="$(~/.cargo/bin/rustc --print sysroot 2> /dev/null)"; then - # add paths to the current Rust toolchain + # add paths of the current Rust toolchain path=(~/.cargo/bin "${path[@]}") fpath=("$rust_sysroot/share/zsh/site-functions" "${fpath[@]}") manpath=("$rust_sysroot/share/man" "${manpath[@]}") From 9147a4b236b689ab5fe3557cd5a168bdda10f5a0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 2 Feb 2019 18:53:42 +0200 Subject: [PATCH 082/713] remove path to binutils --- lib/path.zsh | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/path.zsh b/lib/path.zsh index 3101182..a0ef8a1 100644 --- a/lib/path.zsh +++ b/lib/path.zsh @@ -13,7 +13,6 @@ if is_macos; then /usr/local/opt/openssl/bin # openssl /usr/local/opt/gnu-getopt/bin # getopt /usr/local/opt/findutils/libexec/gnubin # GNU findutils - /usr/local/opt/binutils/bin # GNU binutils /usr/local/opt/coreutils/libexec/gnubin # GNU coreutils "${path[@]}" ) @@ -26,7 +25,6 @@ if is_macos; then /usr/local/opt/openssl/share/man # openssl /usr/local/opt/gnu-getopt/share/man # getopt /usr/local/opt/findutils/libexec/gnuman # GNU findutils - /usr/local/opt/binutils/share/man # GNU binutils /usr/local/opt/coreutils/libexec/gnuman # GNU coreutils "${manpath[@]}" ) From 1c4d4d52d51ef7f2da1b27cdb3a46c30279b7abc Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 8 Mar 2019 20:10:30 +0200 Subject: [PATCH 083/713] move welcome script to a function --- lib/functions.zsh | 4 ++++ zshrc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index c43df16..552b064 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -30,3 +30,7 @@ lazy_load() { $command \$@ }" } + +welcome() { + python "$DOTFILES_PATH/welcome/main.py" +} diff --git a/zshrc b/zshrc index d4c4016..91ab90b 100755 --- a/zshrc +++ b/zshrc @@ -11,4 +11,4 @@ if command_exists rbenv; then eval "$(rbenv init -)" fi -python "$DOTFILES_PATH/welcome/main.py" +welcome From 4088de0f21951f612a3821a7019bb6d79f0e6cb7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 21 Apr 2019 14:42:15 +0300 Subject: [PATCH 084/713] finally, after 3 months of intense Vimscript programming and Vim-fu learning, I've finished my Neovim config --- .gitignore | 1 + install.sh | 17 -- install.zsh | 29 +++ lib/exports.zsh | 11 +- nvim/ginit.vim | 8 + nvim/init.vim | 9 + nvim/lib/colorscheme.vim | 354 ++++++++++++++++++++++++++++++ nvim/lib/completion.vim | 72 ++++++ nvim/lib/editing.vim | 160 ++++++++++++++ nvim/lib/files.vim | 136 ++++++++++++ nvim/lib/git.vim | 12 + nvim/lib/interface.vim | 166 ++++++++++++++ nvim/lib/languages/c.vim | 19 ++ nvim/lib/languages/css.vim | 2 + nvim/lib/languages/haskell.vim | 12 + nvim/lib/languages/html.vim | 2 + nvim/lib/languages/javascript.vim | 12 + nvim/lib/languages/json.vim | 7 + nvim/lib/languages/markdown.vim | 9 + nvim/lib/languages/python.vim | 19 ++ nvim/lib/languages/rust.vim | 9 + nvim/lib/languages/text.vim | 4 + nvim/lib/languages/yaml.vim | 1 + nvim/lib/plugins.vim | 116 ++++++++++ nvim/lib/terminal.vim | 6 + welcome/.gitignore | 1 - welcome/main.py | 2 +- 27 files changed, 1171 insertions(+), 25 deletions(-) delete mode 100755 install.sh create mode 100755 install.zsh create mode 100644 nvim/ginit.vim create mode 100644 nvim/init.vim create mode 100644 nvim/lib/colorscheme.vim create mode 100644 nvim/lib/completion.vim create mode 100644 nvim/lib/editing.vim create mode 100644 nvim/lib/files.vim create mode 100644 nvim/lib/git.vim create mode 100644 nvim/lib/interface.vim create mode 100644 nvim/lib/languages/c.vim create mode 100644 nvim/lib/languages/css.vim create mode 100644 nvim/lib/languages/haskell.vim create mode 100644 nvim/lib/languages/html.vim create mode 100644 nvim/lib/languages/javascript.vim create mode 100644 nvim/lib/languages/json.vim create mode 100644 nvim/lib/languages/markdown.vim create mode 100644 nvim/lib/languages/python.vim create mode 100644 nvim/lib/languages/rust.vim create mode 100644 nvim/lib/languages/text.vim create mode 100644 nvim/lib/languages/yaml.vim create mode 100644 nvim/lib/plugins.vim create mode 100644 nvim/lib/terminal.vim delete mode 100644 welcome/.gitignore diff --git a/.gitignore b/.gitignore index 6660576..f505b48 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /custom /cache +*.pyc diff --git a/install.sh b/install.sh deleted file mode 100755 index 7113248..0000000 --- a/install.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -for zsh_file_name in zshrc; do - zsh_file="$HOME/.$zsh_file_name" - - if [[ -f "$zsh_file" ]]; then - zsh_file_backup="$zsh_file.dmitmel-dotfiles-backup" - echo "Backing up $zsh_file to $zsh_file_backup" - mv -vi "$zsh_file" "$zsh_file_backup" - fi - - cat > "$zsh_file" < "$dest" +} + +# ZSH +for zsh_file_name in zshrc; do + install_dotfile "$HOME/.$zsh_file_name" <:p:h') + +for s:name in ['plugins', 'editing', 'interface', 'colorscheme', 'files', 'completion', 'terminal', 'git'] + execute 'source' fnameescape(s:my_config_dir.'/lib/'.s:name.'.vim') +endfor + +for s:path in globpath(s:my_config_dir.'/lib/languages', '*', 0, 1) + execute 'source' fnameescape(s:path) +endfor diff --git a/nvim/lib/colorscheme.vim b/nvim/lib/colorscheme.vim new file mode 100644 index 0000000..1cbb2e2 --- /dev/null +++ b/nvim/lib/colorscheme.vim @@ -0,0 +1,354 @@ +set termguicolors + +" modified version of base16-vim (https://github.com/chriskempson/base16-vim) +" by Chris Kempson (http://chriskempson.com) + +" Color definitions {{{ + + " Eighties scheme by Chris Kempson (http://chriskempson.com) + let s:colors = [ + \ {'gui': '#2d2d2d', 'cterm': '00'}, + \ {'gui': '#393939', 'cterm': '10'}, + \ {'gui': '#515151', 'cterm': '11'}, + \ {'gui': '#747369', 'cterm': '08'}, + \ {'gui': '#a09f93', 'cterm': '12'}, + \ {'gui': '#d3d0c8', 'cterm': '07'}, + \ {'gui': '#e8e6df', 'cterm': '13'}, + \ {'gui': '#f2f0ec', 'cterm': '15'}, + \ {'gui': '#f2777a', 'cterm': '01'}, + \ {'gui': '#f99157', 'cterm': '09'}, + \ {'gui': '#ffcc66', 'cterm': '03'}, + \ {'gui': '#99cc99', 'cterm': '02'}, + \ {'gui': '#66cccc', 'cterm': '06'}, + \ {'gui': '#6699cc', 'cterm': '04'}, + \ {'gui': '#cc99cc', 'cterm': '05'}, + \ {'gui': '#d27b53', 'cterm': '14'} + \ ] + +" }}} + +" Neovim terminal colors {{{ + let s:i = 0 + for s:color in [0x0, 0x8, 0xB, 0xA, 0xD, 0xE, 0xC, 0x5, 0x3, 0x8, 0xB, 0xA, 0xD, 0xE, 0xC, 0x7] + let g:terminal_color_{s:i} = s:colors[s:color].gui + let s:i += 1 + endfor + unlet s:i + + let g:terminal_color_background = g:terminal_color_0 + let g:terminal_color_foreground = g:terminal_color_5 +" }}} + +" Theme setup {{{ + hi clear + syntax reset + let g:colors_name = "base16-eighties" +" }}} + +" Highlighting function {{{ + function s:is_number(value) + return type(a:value) == v:t_number + endfunction + + function s:hi(group, fg, bg, attr, guisp) + let l:args = '' + if a:fg isnot '' + let l:fg = s:is_number(a:fg) ? s:colors[a:fg] : {'gui': a:fg, 'cterm': a:fg} + let l:args .= ' guifg=' . l:fg.gui . ' ctermfg=' . l:fg.cterm + endif + if a:bg isnot '' + let l:bg = s:is_number(a:bg) ? s:colors[a:bg] : {'gui': a:bg, 'cterm': a:bg} + let l:args .= ' guibg=' . l:bg.gui . ' ctermbg=' . l:bg.cterm + endif + if a:attr isnot '' + let l:args .= ' gui=' . a:attr . ' cterm=' . a:attr + endif + if a:guisp isnot '' + let l:guisp = s:is_number(a:guisp) ? s:colors[a:guisp].gui : a:guisp + let l:args .= ' guisp=' . l:guisp + endif + exec 'hi' a:group l:args + endfunction +" }}} + +" General syntax highlighting {{{ + + call s:hi('Normal', 0x5, 0x0, '', '') + call s:hi('Italic', 0xE, '', 'italic', '') + call s:hi('Bold', 0xA, '', 'bold', '') + call s:hi('Underlined', 0x8, '', 'underline', '') + call s:hi('Title', 0xD, '', '', '') + hi! link Directory Title + call s:hi('Conceal', 0xC, 'NONE', '', '') + call s:hi('NonText', 0x3, '', '', '') + hi! link SpecialKey NonText + call s:hi('MatchParen', 'fg', 0x3, '', '') + + call s:hi('Keyword', 0xE, '', '', '') + hi! link Statement Keyword + hi! link Repeat Keyword + hi! link StorageClass Keyword + hi! link Exception Keyword + hi! link Structure Keyword + hi! link Conditional Keyword + call s:hi('Constant', 0x9, '', '', '') + call s:hi('Boolean', 0x9, '', '', '') + call s:hi('Float', 0x9, '', '', '') + call s:hi('Number', 0x9, '', '', '') + call s:hi('String', 0xB, '', '', '') + hi! link Character String + hi! link Quote String + call s:hi('Comment', 0x3, '', '', '') + hi! link SpecialComment Comment + call s:hi('Todo', 'bg', 0xA, 'bold', '') + call s:hi('Function', 0xD, '', '', '') + call s:hi('Identifier', 0x8, '', '', '') + hi! link Variable Identifier + call s:hi('Include', 0xF, '', '', '') + call s:hi('PreProc', 0xA, '', '', '') + call s:hi('Label', 0xA, '', '', '') + hi! link Operator NONE + hi! link Delimiter NONE + call s:hi('Special', 0xC, '', '', '') + call s:hi('Tag', 0xA, '', '', '') + call s:hi('Type', 0xA, '', 'none', '') + hi! link Typedef Type + +" }}} + +" User interface {{{ + + call s:hi('Error', 'bg', 0x8, '', '') + call s:hi('ErrorMsg', 0x8, 'NONE', '', '') + call s:hi('WarningMsg', 0x9, 'NONE', '', '') + call s:hi('TooLong', 0x8, '', '', '') + call s:hi('Debug', 0x8, '', '', '') + hi! link ALEError Error + hi! link ALEErrorSign ALEError + hi! link ALEStyleErrorSign ALEErrorSign + hi! link ALEVirtualTextError ALEError + hi! link ALEVirtualTextStyleError ALEVirtualTextError + hi! link ALEWarning Todo + hi! link ALEWarningSign ALEWarning + hi! link ALEStyleWarningSign ALEWarningSign + hi! link ALEVirtualTextWarning ALEWarning + hi! link ALEVirtualTextStyleWarning ALEVirtualTextWarning + hi! link ALEInfo ALEWarning + hi! link ALEInfoSign ALEWarningSign + hi! link ALEVirtualTextInfo ALEVirtualTextWarning + hi! link ALESignColumnWithErrors ALEError + hi! link CocErrorSign ALEErrorSign + hi! link CocWarningSign ALEWarningSign + hi! link CocInfoSign ALEInfoSign + hi! link CocHintSign ALEInfoSign + + call s:hi('FoldColumn', 0xC, 0x1, '', '') + call s:hi('Folded', 0x3, 0x1, '', '') + + call s:hi('IncSearch', 0x1, 0x9, 'none', '') + call s:hi('Search', 0x1, 0xA, '', '') + hi! link Substitute Search + + call s:hi('ModeMsg', 0xB, '', '', '') + call s:hi('Question', 0xB, '', '', '') + hi! link MoreMsg Question + call s:hi('Visual', '', 0x2, '', '') + call s:hi('WildMenu', 0x1, 'fg', '', '') + + call s:hi('CursorLine', '', 0x1, '', '') + hi! link CursorColumn CursorLine + call s:hi('ColorColumn', '', 0x1, '', '') + call s:hi('LineNr', 0x3, 0x1, '', '') + call s:hi('CursorLineNr', 0x4, 0x1, '', '') + call s:hi('QuickFixLine', '', 0x2, '', '') + + call s:hi('SignColumn', 0x3, 0x1, '', '') + call s:hi('StatusLine', 0x4, 0x1, 'none', '') + call s:hi('StatusLineNC', 0x3, 0x1, '', '') + call s:hi('VertSplit', 0x2, 0x2, '', '') + call s:hi('TabLine', 0x3, 0x1, '', '') + call s:hi('TabLineFill', 0x3, 0x1, '', '') + call s:hi('TabLineSel', 0xB, 0x1, '', '') + + call s:hi('PMenu', 'fg', 0x1, '', '') + call s:hi('PMenuSel', 0x1, 'fg', '', '') + +" }}} + +" Diff {{{ + " diff mode + call s:hi('DiffAdd', 0xB, 0x1, '', '') + call s:hi('DiffDelete', 0x8, 0x1, '', '') + call s:hi('DiffText', 0xE, 0x1, '', '') + call s:hi('DiffChange', 0x3, 0x1, '', '') + " diff file + call s:hi('diffAdded', 0xB, '', '', '') + call s:hi('diffRemoved', 0x8, '', '', '') + call s:hi('diffChanged', 0xE, '', '', '') + hi! link diffNewFile diffAdded + hi! link diffFile diffRemoved + hi! link diffIndexLine Bold + hi! link diffLine Title + hi! link diffSubname Include +" }}} + +" XML {{{ + call s:hi('xmlTagName', 0x8, '', '', '') + call s:hi('xmlAttrib', 0x9, '', '', '') + hi! link xmlTag NONE + hi! link xmlEndTag xmlTag +" }}} + +" Git {{{ + hi! link gitCommitOverflow TooLong + hi! link gitCommitSummary String + hi! link gitCommitComment Comment + hi! link gitcommitUntracked Comment + hi! link gitcommitDiscarded Comment + hi! link gitcommitSelected Comment + hi! link gitcommitHeader Keyword + call s:hi('gitcommitSelectedType', 0xD, '', '', '') + call s:hi('gitcommitUnmergedType', 0xD, '', '', '') + call s:hi('gitcommitDiscardedType', 0xD, '', '', '') + hi! link gitcommitBranch Function + call s:hi('gitcommitUntrackedFile', 0xA, '', 'bold', '') + call s:hi('gitcommitUnmergedFile', 0x8, '', 'bold', '') + call s:hi('gitcommitDiscardedFile', 0x8, '', 'bold', '') + call s:hi('gitcommitSelectedFile', 0xB, '', 'bold', '') + + hi! link GitGutterAdd DiffAdd + hi! link GitGutterDelete DiffDelete + hi! link GitGutterChange DiffText + hi! link GitGutterChangeDelete GitGutterDelete + hi! link SignifySignAdd DiffAdd + hi! link SignifySignChange DiffText + hi! link SignifySignDelete DiffDelete +" }}} + +" Vim scripts {{{ + hi! link vimUserFunc vimFuncName + hi! link vimBracket vimMapModKey + hi! link vimFunction vimFuncName + hi! link vimParenSep Delimiter + hi! link vimSep Delimiter + hi! link vimVar Variable + hi! link vimFuncVar Variable +" }}} + +" C {{{ + hi! link cOperator Special +" }}} + +" C# {{{ + call s:hi('csClass', 0xA, '', '', '') + call s:hi('csAttribute', 0xA, '', '', '') + call s:hi('csModifier', 0xE, '', '', '') + hi! link csType Type + call s:hi('csUnspecifiedStatement', 0xD, '', '', '') + call s:hi('csContextualStatement', 0xE, '', '', '') + call s:hi('csNewDecleration', 0x8, '', '', '') +" }}} + +" Rust {{{ + hi! link rustEnumVariant rustType + hi! link rustSelf Variable + hi! link rustSigil rustOperator + hi! link rustMacroVariable Variable +" }}} + +" HTML {{{ + hi! link htmlBold Bold + hi! link htmlItalic Italic + hi! link htmlTag xmlTag + hi! link htmlTagName xmlTagName + hi! link htmlSpecialTagName xmlTagName + hi! link htmlEndTag xmlEndTag + hi! link htmlArg xmlAttrib +" }}} + +" CSS {{{ + hi! link cssBraces Delimiter + hi! link cssTagName htmlTagName + hi! link cssPseudoClassId Special + hi! link cssClassName Type + hi! link cssClassNameDot cssClassName + hi! link cssAtRule Keyword + hi! link cssProp Identifier + hi! link cssVendor Special + hi! link cssNoise Delimiter + hi! link cssAttr String + hi! link cssAttrComma Delimiter + hi! link cssAttrRegion cssAttr +" }}} + +" JavaScript {{{ + hi! link javaScriptBraces Delimiter + hi! link jsOperator Operator + hi! link jsThis Variable + hi! link jsSuper jsThis + hi! link jsClassDefinition Type + hi! link jsFunction Keyword + hi! link jsArrowFunction jsFunction + hi! link jsFuncName jsFuncCall + hi! link jsClassFuncName jsFuncCall + hi! link jsClassMethodType jsFunction + hi! link jsRegexpString Special + hi! link jsGlobalObjects Type + hi! link jsGlobalNodeObjects Type + hi! link jsExceptions Type + hi! link jsBuiltins jsFuncName + hi! link jsNull Constant + hi! link jsUndefined Constant + hi! link jsOperatorKeyword Keyword + hi! link jsObjectKey Identifier +" }}} + +" Markdown {{{ + hi! link mkdHeading Title +" }}} + +" Mail {{{ + call s:hi('mailQuoted1', 0x8, '', '', '') + call s:hi('mailQuoted2', 0x9, '', '', '') + call s:hi('mailQuoted3', 0xA, '', '', '') + call s:hi('mailQuoted4', 0xB, '', '', '') + call s:hi('mailQuoted5', 0xD, '', '', '') + call s:hi('mailQuoted6', 0xE, '', '', '') + hi! link mailURL Underlined + hi! link mailEmail Underlined +" }}} + +" Python {{{ + hi! link pythonBuiltinType Type + hi! link pythonBuiltinObj pythonFunction + hi! link pythonClassVar Variable +" }}} + +" Ruby {{{ + hi! link rubyPseudoVariable Variable + hi! link rubyClassName Type + hi! link rubyAttribute rubyFunction + hi! link rubyConstant Constant + call s:hi('rubyInterpolationDelimiter', 0xF, '', '', '') + hi! link rubySymbol String + hi! link rubyStringDelimiter rubyString + hi! link rubyRegexp Special + hi! link rubyRegexpDelimiter rubyRegexp +" }}} + +" Lua {{{ + hi! link luaFuncCall Function + hi! link luaBraces Delimiter +" }}} + +" Zsh {{{ + hi! link zshFunction Function + hi! link zshVariable Variable +" }}} + +" Spelling {{{ + call s:hi('SpellBad', '', '', 'undercurl', 0x8) + call s:hi('SpellLocal', '', '', 'undercurl', 0xC) + call s:hi('SpellCap', '', '', 'undercurl', 0xD) + call s:hi('SpellRare', '', '', 'undercurl', 0xE) +" }}} diff --git a/nvim/lib/completion.vim b/nvim/lib/completion.vim new file mode 100644 index 0000000..891a01f --- /dev/null +++ b/nvim/lib/completion.vim @@ -0,0 +1,72 @@ +" pop-up (completion) menu mappings {{{ + imap pumvisible() ? "\" : "\delimitMateCR" + imap pumvisible() ? "\" : "\" + imap pumvisible() ? "\" : "\" + imap pumvisible() ? "\" : "\" +" }}} + +" coc.nvim {{{ + " list of filetypes (that are added in language-specific scripts) for which + " coc mappings are enabled + let g:coc_filetypes = [] + + function IsCocEnabled() + return index(g:coc_filetypes, &filetype) >= 0 + endfunction + + augroup vimrc-coc + autocmd! + autocmd FileType * if IsCocEnabled() + \|let &l:formatexpr = "CocAction('formatSelected')" + \|let &l:keywordprg = ":call CocAction('doHover')" + \|endif + autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') + augroup end + + " mappings {{{ + let g:coc_snippet_next = '' + let g:coc_snippet_prev = '' + + inoremap coc#refresh() + + nmap [c (coc-diagnostic-prev) + nmap ]c (coc-diagnostic-next) + + nmap jd (coc-definition) + nmap jt (coc-type-definition) + nmap ji (coc-implementation) + nmap jr (coc-references) + nmap (coc-rename) + nmap (coc-codeaction) + vmap (coc-codeaction-selected) + " nmap qf (coc-fix-current) + + nnoremap l :CocList + nnoremap d :CocList --auto-preview diagnostics + nnoremap c :CocList commands + nnoremap o :CocList --auto-preview outline + nnoremap s :CocList --interactive symbols + nnoremap h :CocPrev + nnoremap k :CocPrev + nnoremap l :CocNext + nnoremap j :CocNext + nnoremap p :CocListResume + " }}} + + " CocFormat {{{ + function s:CocFormat(range, line1, line2) abort + if a:range == 0 + call CocAction('format') + else + call cursor(a:line1, 1) + normal! V + call cursor(a:line2, 1) + call CocAction('formatSelected', 'V') + endif + endfunction + command! -nargs=0 -range -bar CocFormat call s:CocFormat(, , ) + " }}} + + call coc#add_extension('coc-snippets') + call coc#config('diagnostic', { 'virtualText': v:true, 'enableMessage': 'jump' }) +" }}} diff --git a/nvim/lib/editing.vim b/nvim/lib/editing.vim new file mode 100644 index 0000000..652a942 --- /dev/null +++ b/nvim/lib/editing.vim @@ -0,0 +1,160 @@ +" is comma +let mapleader = ',' + +" allow moving cursor just after the last chraracter of the line +set virtualedit=onemore + +set foldmethod=marker + + +" Indentination {{{ + + function SetIndent(expandtab, shiftwidth) + let &l:expandtab = a:expandtab + let &l:shiftwidth = str2nr(a:shiftwidth) + let &l:tabstop = &shiftwidth + let &l:softtabstop = &shiftwidth + endfunction + command -nargs=1 Indent call SetIndent(1, ) + command -nargs=1 IndentTabs call SetIndent(0, ) + + " use 2 spaces for indentination + set expandtab shiftwidth=2 tabstop=2 softtabstop=2 + " round indents to multiple of shiftwidth when using shift (< and >) commands + set shiftround + + let g:indentLine_char = "\u2502" + let g:indentLine_first_char = g:indentLine_char + let g:indentLine_showFirstIndentLevel = 1 + let g:indentLine_fileTypeExclude = ['text', 'help', 'tutor'] + +" }}} + + +" Invisible characters {{{ + set list + let &listchars = "tab:\u2192 ,extends:>,precedes:<,eol:\u00ac,trail:\u00b7" + let &showbreak = '>' +" }}} + + +" Cursor and Scrolling {{{ + + set number + set relativenumber + set cursorline + + " remember cursor position + augroup vimrc-editing-remember-cursor-position + autocmd! + autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exec "normal! g`\"" | endif + augroup END + +" }}} + + +" Wrapping {{{ + set nowrap + set colorcolumn=80,100,120 +" }}} + + +" Mappings {{{ + + " arguably one of the most useful mappings + nnoremap empty(&buftype) ? ":w\" : "\" + + " stay in the Visual mode when using shift commands + xnoremap < >gv + + " 2 mappings for quick prototyping: duplicate this line and comment it out + nmap ] m'yygccp`'j + nmap [ m'yygccP`'k + + command! -nargs=+ -complete=command PutOutput execute 'put =execute(' . escape(string(), '|"') . ')' + + " Clipboard {{{ + " ,c is easier to type than "+ because it doesn't require pressing Shift + noremap c "+ + " these 3 mappings are equivalent to Ctrl+C, Ctrl+V, and Ctrl+X in GUI + " editors (hence the names) + " noremap cc "+y + " noremap cv "+gP + " noremap cV "+gp + " noremap cx "+d + " }}} + +" }}} + + +" Search {{{ + + " ignore case if the pattern doesn't contain uppercase characters (use '\C' + " anywhere in pattern to override these two settings) + set ignorecase smartcase + + nnoremap \ :nohlsearch + + let g:indexed_search_center = 1 + + " search inside a visual selection + vnoremap / /\%>=line("'<")-1l\%<=line("'>")+1l + vnoremap ? ?\%>=line("'<")-1l\%<=line("'>")+1l + + " * and # in the Visual mode will search the selected text + function! s:VisualStarSearch(search_cmd) + let l:tmp = @" + normal! gvy + let @/ = '\V' . substitute(escape(@", a:search_cmd . '\'), '\n', '\\n', 'g') + let @" = l:tmp + endfunction + " HACK: my mappings are added on VimEnter to override mappings from the + " vim-indexed-search plugin + augroup vimrc-editing-visual-star-search + autocmd! + autocmd VimEnter * + \ xmap * :call VisualStarSearch('/')n + \|xmap # :call VisualStarSearch('?')N + augroup END + +" }}} + + +" Replace {{{ + + " show the effects of the :substitute command incrementally, as you type + " (works similar to 'incsearch') + set inccommand=nosplit + + " quick insertion of the substitution command + nnoremap gs :%s///g + xnoremap gs :s///g + nnoremap gss :%s///g + xnoremap gss :s///g + +" }}} + + +" Formatting {{{ + + " don't insert a comment after hitting 'o' or 'O' in the Normal mode + augroup vimrc-editing-formatting + autocmd! + autocmd FileType * set formatoptions-=o + augroup END + +" }}} + + +" plugins {{{ + let g:delimitMate_expand_space = 1 + let g:delimitMate_expand_cr = 1 + + let g:pencil#wrapModeDefault = 'soft' + let g:pencil#conceallevel = 0 + let g:pencil#cursorwrap = 0 + + xmap ga (LiveEasyAlign) + nmap ga (LiveEasyAlign) +" }}} diff --git a/nvim/lib/files.vim b/nvim/lib/files.vim new file mode 100644 index 0000000..829af98 --- /dev/null +++ b/nvim/lib/files.vim @@ -0,0 +1,136 @@ +" order of EOL detection +set fileformats=unix,dos,mac + +set wildignore+=.git,.svn,.hg,.DS_Store,*~ + +" ripgrep (rg) {{{ + if executable('rg') + let s:rg_cmd = "rg --hidden --follow" + let s:rg_ignore = split(&wildignore, ',') + [ + \ 'node_modules', 'target', 'build', 'dist', '.stack-work' + \ ] + let s:rg_cmd .= " --glob '!{'" . shellescape(join(s:rg_ignore, ',')) . "'}'" + + let &grepprg = s:rg_cmd . ' --vimgrep' + let $FZF_DEFAULT_COMMAND = s:rg_cmd . ' --files' + command! -bang -nargs=* Rg call fzf#vim#grep(s:rg_cmd . ' --column --line-number --no-heading --fixed-strings --smart-case --color always ' . shellescape(), 1, 0) + command! -bang -nargs=* Find Rg + endif +" }}} + + +" Netrw {{{ + " disable most of the Netrw functionality (because I use Ranger) except its + " helper functions (which I use in my dotfiles) + let g:loaded_netrwPlugin = 1 + " re-add Netrw's gx mappings since we've disabled them + nnoremap gx :call netrw#BrowseX(expand(''),netrw#CheckIfRemote()) + vnoremap gx :call netrw#BrowseXVis() +" }}} + + +" Ranger {{{ + let g:ranger_replace_netrw = 1 + let g:ranger_map_keys = 0 + nnoremap o :Ranger + " ranger.vim relies on the Bclose.vim plugin, but I use Bbye.vim, so this + " command is here just for compatitabilty + command! -bang -complete=buffer -nargs=? Bclose Bdelete +" }}} + + +" Commands {{{ + + " DiffWithSaved {{{ + " Compare current buffer with the actual (saved) file on disk + function s:DiffWithSaved() + let l:filetype = &filetype + diffthis + vnew | read # | normal! ggdd + diffthis + setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile readonly nomodifiable + let &filetype = l:filetype + endfunction + command DiffWithSaved call s:DiffWithSaved() + " }}} + + " Reveal {{{ + " Reveal file in the system file explorer + function s:Reveal(path) + if has('macunix') + " only macOS has functionality to really 'reveal' a file, that is, to open + " its parent directory in Finder and select this file + call system('open -R ' . fnamemodify(a:path, ':S')) + else + " for other systems let's not reinvent the bicycle, instead we open file's + " parent directory using netrw's builtin function (don't worry, netrw is + " always bundled with Nvim) + call s:Open(a:path) + endif + endfunction + command Reveal call s:Reveal(expand('%')) + " }}} + + " Open {{{ + " opens file with a system program + function s:Open(path) + " HACK: 2nd parameter of this function is called 'remote', it tells + " whether to open a remote (1) or local (0) file. However, it doesn't work + " as expected in this context, because it uses the 'gf' command if it's + " opening a local file (because this function was designed to be called + " from the 'gx' command). BUT, because this function only compares the + " value of the 'remote' parameter to 1, I can pass any other value, which + " will tell it to open a local file and ALSO this will ignore an + " if-statement which contains the 'gf' command. + call netrw#BrowseX(a:path, 2) + endfunction + command Open call s:Open(expand('%')) + " }}} + +" }}} + + +" on save (BufWritePre) {{{ + + " create directory {{{ + " Creates the parent directory of the file if it doesn't exist + function s:CreateDirOnSave() + " is the filename of the buffer where the autocommand is executed + let l:file = expand('') + " check if this is a regular file and its path is not a URL + if empty(&buftype) && l:file !~# '\v^\w+://' + let l:dir = fnamemodify(l:file, ':h') + if !isdirectory(l:dir) | call mkdir(l:dir, 'p') | endif + endif + endfunction + " }}} + + " fix whitespace {{{ + function s:FixWhitespaceOnSave() + let l:pos = getpos('.') + " remove trailing whitespace + %s/\s\+$//e + " remove trailing newlines + %s/\($\n\s*\)\+\%$//e + call setpos('.', l:pos) + endfunction + " }}} + + function s:OnSave() + call s:FixWhitespaceOnSave() + if IsCocEnabled() | silent CocFormat | endif + call s:CreateDirOnSave() + endfunction + augroup vimrc-on-save + autocmd! + autocmd BufWritePre * call s:OnSave() + augroup END + +" }}} + + +" CtrlSF {{{ + nmap / CtrlSFPrompt + nmap * CtrlSFCwordPath + xmap * CtrlSFVwordPath +" }}} diff --git a/nvim/lib/git.vim b/nvim/lib/git.vim new file mode 100644 index 0000000..df59ecd --- /dev/null +++ b/nvim/lib/git.vim @@ -0,0 +1,12 @@ +" mappings {{{ + let g:gitgutter_map_keys = 0 + nnoremap gg :G + nnoremap g :Git + nnoremap gs :Gstatus + nnoremap gd :Gdiff + nnoremap gb :Gblame + nnoremap gw :Gbrowse + nnoremap gc :Gcommit % + nnoremap gl :Glog + nnoremap gp :Gpush +" }}} diff --git a/nvim/lib/interface.vim b/nvim/lib/interface.vim new file mode 100644 index 0000000..9df10bd --- /dev/null +++ b/nvim/lib/interface.vim @@ -0,0 +1,166 @@ +" configure behaviour of wildmenu when I press in the Vim command prompt +" 1. on the 1st , complete the longest common prefix +" 2. on the 2nd , list all available completions and open wildmenu +" this basically emulates Tab-completion behaviour in Zsh +set wildmode=list:longest,list:full + +" always show the sign column +set signcolumn=yes + +" enable bell everywhere +set belloff= + +" title {{{ +set title +let &titlestring = '%F%{&modified ? g:airline_symbols.modified : ""} (nvim)' +" }}} + +" Yes, I occasionally use mouse. Sometimes it is handy for switching windows/buffers +set mouse=a +" pops up a context menu +" extends a visual selection +set mousemodel=popup + +" Maybe someday I'll use a Neovim GUI +if has('guifont') + let &guifont = 'Ubuntu Mono derivative Powerline:h14' +endif + + +" Buffers {{{ + + set hidden + + " open diffs in vertical splits by default + set diffopt+=vertical + + " buffer navigation {{{ + noremap :bnext + noremap :bprev + noremap gb :buffer # + " }}} + + " ask for confirmation when closing unsaved buffers + set confirm + + " Bbye with confirmation, or fancy buffer closer {{{ + function s:CloseBuffer(cmd) abort + let l:cmd = a:cmd + if &modified + let l:answer = confirm("Save changes?", "&Yes\n&No\n&Cancel") + if l:answer is 1 " Yes + write + elseif l:answer is 2 " No + let l:cmd .= '!' + else " Cancel/Other + return + endif + endif + execute l:cmd + endfunction + " }}} + + " closing buffers {{{ + nnoremap :call CloseBuffer('Bdelete') + nnoremap :quit call CloseBuffer('Bdelete') + " }}} + +" }}} + + +" Windows {{{ + + " window navigation {{{ + noremap j + noremap k + noremap l + noremap h + " }}} + + " switch to previous window + noremap p + + " don't automatically make all windows the same size + set noequalalways + + " splitting {{{ + noremap h :split + noremap v :vsplit + " }}} + + " closing windows {{{ + nnoremap :quit + " }}} + +" }}} + + +" Airline (statusline) {{{ + + let g:airline_symbols = { + \ 'readonly': 'RO', + \ 'whitespace': "\u21e5 ", + \ 'linenr': '', + \ 'maxlinenr': ' ', + \ 'branch': '', + \ 'notexists': " [?]", + \ } + + let g:airline#extensions#branch#enabled = 1 + let g:airline#extensions#tabline#enabled = 1 + let g:airline#extensions#ale#enabled = 1 + + call airline#parts#define_function('coc#status', 'coc#status') + + function StatusLine_filesize() + let l:bytes = getfsize(expand('%')) + if l:bytes < 0 | return '' | endif + + let l:factor = 1 + for l:unit in ['B', 'K', 'M', 'G'] + let l:next_factor = l:factor * 1024 + if l:bytes < l:next_factor + let l:number_str = printf('%.2f', (l:bytes * 1.0) / l:factor) + " remove trailing zeros + let l:number_str = substitute(l:number_str, '\v\.?0+$', '', '') + return l:number_str . l:unit + endif + let l:factor = l:next_factor + endfor + endfunction + call airline#parts#define_function('filesize', 'StatusLine_filesize') + + function s:airline_section_prepend(section, items) + let g:airline_section_{a:section} = airline#section#create_right(a:items + ['']) . g:airline_section_{a:section} + endfunction + function s:airline_section_append(section, items) + let g:airline_section_{a:section} = g:airline_section_{a:section} . airline#section#create_left([''] + a:items) + endfunction + function s:tweak_airline() + call s:airline_section_prepend('x', ['coc#status']) + call s:airline_section_append('y', ['filesize']) + call s:airline_section_prepend('error', ['coc_error_count']) + call s:airline_section_prepend('warning', ['coc_warning_count']) + endfunction + augroup vimrc-interface-airline + autocmd! + autocmd user AirlineAfterInit call s:tweak_airline() + augroup END + +" }}} + + +" FZF {{{ + nnoremap :Helptags + nnoremap f :Files + nnoremap b :Buffers +" }}} + + +" quickfix/location list {{{ + nmap [q (qf_qf_previous) + nmap ]q (qf_qf_next) + nmap [l (qf_loc_previous) + nmap ]l (qf_loc_next) + let g:qf_mapping_ack_style = 1 +" }}} diff --git a/nvim/lib/languages/c.vim b/nvim/lib/languages/c.vim new file mode 100644 index 0000000..50d02bc --- /dev/null +++ b/nvim/lib/languages/c.vim @@ -0,0 +1,19 @@ +let s:filetypes = ['c', 'cpp', 'objc', 'objcpp'] +let g:coc_filetypes += s:filetypes + +call coc#config('languageserver.ccls', { +\ 'filetypes': s:filetypes, +\ 'command': 'ccls', +\ 'rootPatterns': ['.ccls', 'compile_commands.json', '.vim/', '.git/', '.hg/'], +\ 'initializationOptions': { +\ 'cache': { +\ 'directory': '/tmp/ccls', +\ }, +\ }, +\ }) + +" call coc#config('languageserver.clangd', { +" \ 'filetypes': s:filetypes, +" \ 'command': 'clangd', +" \ 'rootPatterns': ['compile_flags.txt', 'compile_commands.json', '.vim/', '.git/', '.hg/'], +" \ }) diff --git a/nvim/lib/languages/css.vim b/nvim/lib/languages/css.vim new file mode 100644 index 0000000..ed36b79 --- /dev/null +++ b/nvim/lib/languages/css.vim @@ -0,0 +1,2 @@ +call coc#add_extension('coc-css') +let g:coc_filetypes += ['css'] diff --git a/nvim/lib/languages/haskell.vim b/nvim/lib/languages/haskell.vim new file mode 100644 index 0000000..6d11c2b --- /dev/null +++ b/nvim/lib/languages/haskell.vim @@ -0,0 +1,12 @@ +let s:filetypes = ['haskell', 'lhaskell', 'chaskell'] +let g:coc_filetypes += s:filetypes +call coc#config('languageserver.haskell', { +\ 'filetypes': s:filetypes, +\ 'command': 'hie-wrapper', +\ 'rootPatterns': ['.stack.yaml', 'cabal.config', 'package.yaml'], +\ 'initializationOptions': {}, +\ }) + +let g:haskell_conceal = 0 +let g:haskell_conceal_enumerations = 0 +let g:haskell_multiline_strings = 1 diff --git a/nvim/lib/languages/html.vim b/nvim/lib/languages/html.vim new file mode 100644 index 0000000..612be25 --- /dev/null +++ b/nvim/lib/languages/html.vim @@ -0,0 +1,2 @@ +call coc#add_extension('coc-html', 'coc-emmet') +let g:coc_filetypes += ['html'] diff --git a/nvim/lib/languages/javascript.vim b/nvim/lib/languages/javascript.vim new file mode 100644 index 0000000..7b9497e --- /dev/null +++ b/nvim/lib/languages/javascript.vim @@ -0,0 +1,12 @@ +call coc#add_extension('coc-tsserver', 'coc-eslint', 'coc-prettier') +let g:coc_filetypes += ['javascript', 'javascript.jsx', 'typescript', 'typescript.jsx'] +call coc#config('eslint', { +\ 'filetypes': ['javascript', 'javascriptreact', 'typescript', 'typescriptreact'], +\ 'autoFixOnSave': v:true, +\ }) +call coc#config('prettier', { +\ 'singleQuote': v:true, +\ 'trailingComma': 'all', +\ 'jsxBracketSameLine': v:true, +\ 'eslintIntegration': v:true, +\ }) diff --git a/nvim/lib/languages/json.vim b/nvim/lib/languages/json.vim new file mode 100644 index 0000000..a9d8047 --- /dev/null +++ b/nvim/lib/languages/json.vim @@ -0,0 +1,7 @@ +call coc#add_extension('coc-json') +let g:coc_filetypes += ['json'] + +augroup vimrc-languages-json + autocmd! + autocmd FileType json syntax match Comment +\/\/.\+$+ +augroup END diff --git a/nvim/lib/languages/markdown.vim b/nvim/lib/languages/markdown.vim new file mode 100644 index 0000000..a27e1f9 --- /dev/null +++ b/nvim/lib/languages/markdown.vim @@ -0,0 +1,9 @@ +let g:coc_filetypes += ['markdown'] + +let g:vim_markdown_conceal = 0 +let g:vim_markdown_conceal_code_blocks = 0 + +augroup vimrc-languages-markdown + autocmd! + autocmd FileType markdown call pencil#init() +augroup END diff --git a/nvim/lib/languages/python.vim b/nvim/lib/languages/python.vim new file mode 100644 index 0000000..4727edd --- /dev/null +++ b/nvim/lib/languages/python.vim @@ -0,0 +1,19 @@ +call coc#add_extension('coc-python') +let g:coc_filetypes += ['python'] +call coc#config('pyls.plugins.pycodestyle.ignore', ['E501']) +call coc#config('python', { +\ 'autocomplete': { 'showAdvancedMembers': v:false }, +\ 'formatting': { 'provider': 'black' }, +\ 'linting': { +\ 'pylintEnabled': v:false, +\ 'flake8Enabled': v:true, +\ 'flake8Args': ['--ignore', 'E501'], +\ }, +\ }) + +augroup vimrc-language-python + autocmd! + autocmd FileType python Indent 4 +augroup END + +let g:python_highlight_all = 1 diff --git a/nvim/lib/languages/rust.vim b/nvim/lib/languages/rust.vim new file mode 100644 index 0000000..fda8d42 --- /dev/null +++ b/nvim/lib/languages/rust.vim @@ -0,0 +1,9 @@ +call coc#add_extension('coc-rls') +let g:coc_filetypes += ['rust'] +call coc#config('rust', { 'clippy_preference': 'on' }) + +let g:rust_recommended_style = 0 + +augroup vimrc-rust + autocmd FileType rust setlocal matchpairs-=<:> +augroup END diff --git a/nvim/lib/languages/text.vim b/nvim/lib/languages/text.vim new file mode 100644 index 0000000..6329b94 --- /dev/null +++ b/nvim/lib/languages/text.vim @@ -0,0 +1,4 @@ +augroup vimrc-languages-text + autocmd! + autocmd FileType text call pencil#init() +augroup END diff --git a/nvim/lib/languages/yaml.vim b/nvim/lib/languages/yaml.vim new file mode 100644 index 0000000..3c48b35 --- /dev/null +++ b/nvim/lib/languages/yaml.vim @@ -0,0 +1 @@ +let g:coc_filetypes += ['yaml'] diff --git a/nvim/lib/plugins.vim b/nvim/lib/plugins.vim new file mode 100644 index 0000000..6f43a83 --- /dev/null +++ b/nvim/lib/plugins.vim @@ -0,0 +1,116 @@ +let s:dein_plugins_dir = expand('~/.cache/dein') +let s:dein_dir = s:dein_plugins_dir . '/repos/github.com/Shougo/dein.vim' + +if !isdirectory(s:dein_dir) + echo 'Installing Dein...' + call system('git clone https://github.com/Shougo/dein.vim ' . shellescape(s:dein_dir)) +endif + +let &runtimepath .= ',' . s:dein_dir + +if dein#load_state(s:dein_plugins_dir) + call dein#begin(s:dein_plugins_dir) + + command! -nargs=+ -bar Plugin call dein#add() + + " Let dein manage itself + Plugin s:dein_dir + + " Files {{{ + Plugin 'tpope/vim-eunuch' + Plugin 'francoiscabrol/ranger.vim' + " }}} + + " Editing {{{ + Plugin 'easymotion/vim-easymotion' + Plugin 'junegunn/vim-easy-align' + Plugin 'Raimondi/delimitMate' + Plugin 'tpope/vim-repeat' + Plugin 'tpope/vim-commentary' + Plugin 'tpope/vim-surround' + Plugin 'Yggdroot/indentLine' + Plugin 'henrik/vim-indexed-search' + Plugin 'andymass/vim-matchup' + Plugin 'tommcdo/vim-exchange' + Plugin 'inkarkat/vim-ingo-library' " required by LineJuggler + Plugin 'inkarkat/vim-LineJuggler', { 'rev': 'stable' } + Plugin 'reedes/vim-pencil' + " }}} + + " Text objects {{{ + Plugin 'kana/vim-textobj-user' + Plugin 'kana/vim-textobj-entire' + Plugin 'kana/vim-textobj-line' + Plugin 'kana/vim-textobj-indent' + " Plugin 'kana/vim-textobj-fold' + " }}} + + " UI {{{ + Plugin 'moll/vim-bbye' + Plugin 'gerw/vim-HiLinkTrace' + Plugin 'vim-airline/vim-airline' + Plugin 'vim-airline/vim-airline-themes' + Plugin 'wincent/terminus' + Plugin 'tpope/vim-obsession' + Plugin 'romainl/vim-qf' + Plugin 'dyng/ctrlsf.vim' + " }}} + + " Git {{{ + Plugin 'tpope/vim-fugitive' + Plugin 'tpope/vim-rhubarb' + Plugin 'airblade/vim-gitgutter' + " }}} + + " FZF {{{ + Plugin 'junegunn/fzf', { 'build': './install --bin' } + Plugin 'junegunn/fzf.vim' + " }}} + + " Programming {{{ + Plugin 'sheerun/vim-polyglot' + Plugin 'neoclide/coc.nvim', { 'build': 'yarn install' } + Plugin 'dag/vim2hs' + " }}} + + delcommand Plugin + + call dein#end() + call dein#save_state() +endif + +" enable full plugin support +filetype plugin indent on +syntax enable + +" Automatically install/clean plugins (because I'm a programmer) {{{ + + " the following two lines were copied directly from dein's source code + let s:dein_cache_dir = get(g:, 'dein#cache_directory', g:dein#_base_path) + let s:dein_state_file = s:dein_cache_dir . '/state_' . g:dein#_progname . '.vim' + + let s:current_file = expand('') + + " gettftime() returns the last modification time of a given file + let s:plugins_file_changed = getftime(s:current_file) > getftime(s:dein_state_file) + if s:plugins_file_changed + echo "plugins.vim was changed, clearing Dein state..." + call dein#clear_state() + + let s:unused_plugins = dein#check_clean() + if !empty(s:unused_plugins) + echo "Cleaning up unused plugins..." + for s:plugin in s:unused_plugins + echo "deleting" s:plugin + call delete(s:plugin, 'rf') + endfor + endif + endif + + if dein#check_install() || s:plugins_file_changed + echo "Installing plugins..." + call dein#install() + echo + endif + +" }}} diff --git a/nvim/lib/terminal.vim b/nvim/lib/terminal.vim new file mode 100644 index 0000000..cfc808c --- /dev/null +++ b/nvim/lib/terminal.vim @@ -0,0 +1,6 @@ +nnoremap t :terminal + +augroup vimrc-terminal + autocmd! + autocmd TermOpen * set nocursorline | IndentLinesDisable +augroup END diff --git a/welcome/.gitignore b/welcome/.gitignore deleted file mode 100644 index 0d20b64..0000000 --- a/welcome/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.pyc diff --git a/welcome/main.py b/welcome/main.py index 160f359..58da219 100755 --- a/welcome/main.py +++ b/welcome/main.py @@ -2,7 +2,7 @@ import re -from colors import Style, COLORS +from colors import COLORS, Style from system_info import get_system_info print("") From 76758e8cdc3a8e5878ce7c75f6ca996973b620b5 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 22 Apr 2019 13:03:25 +0300 Subject: [PATCH 085/713] [nvim] replace vmap mappings with xmap --- nvim/lib/editing.vim | 4 ++-- nvim/lib/files.vim | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nvim/lib/editing.vim b/nvim/lib/editing.vim index 652a942..cc3d1f2 100644 --- a/nvim/lib/editing.vim +++ b/nvim/lib/editing.vim @@ -99,8 +99,8 @@ set foldmethod=marker let g:indexed_search_center = 1 " search inside a visual selection - vnoremap / /\%>=line("'<")-1l\%<=line("'>")+1l - vnoremap ? ?\%>=line("'<")-1l\%<=line("'>")+1l + xnoremap / /\%>=line("'<")-1l\%<=line("'>")+1l + xnoremap ? ?\%>=line("'<")-1l\%<=line("'>")+1l " * and # in the Visual mode will search the selected text function! s:VisualStarSearch(search_cmd) diff --git a/nvim/lib/files.vim b/nvim/lib/files.vim index 829af98..df493ca 100644 --- a/nvim/lib/files.vim +++ b/nvim/lib/files.vim @@ -25,7 +25,7 @@ set wildignore+=.git,.svn,.hg,.DS_Store,*~ let g:loaded_netrwPlugin = 1 " re-add Netrw's gx mappings since we've disabled them nnoremap gx :call netrw#BrowseX(expand(''),netrw#CheckIfRemote()) - vnoremap gx :call netrw#BrowseXVis() + xnoremap gx :call netrw#BrowseXVis() " }}} From 5f22915211ef4bc3a348ec7917d316ee8097667c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 22 Apr 2019 13:06:38 +0300 Subject: [PATCH 086/713] [zsh] rename 'lib' to 'zsh' --- {lib => zsh}/aliases.zsh | 0 {lib => zsh}/exports.zsh | 0 {lib => zsh}/functions.zsh | 0 {lib => zsh}/my-syntax-theme.ini | 0 {lib => zsh}/palette.zsh | 0 {lib => zsh}/path.zsh | 0 {lib => zsh}/theme.zsh | 0 {lib => zsh}/zgen.zsh | 0 zshrc | 2 +- 9 files changed, 1 insertion(+), 1 deletion(-) rename {lib => zsh}/aliases.zsh (100%) rename {lib => zsh}/exports.zsh (100%) rename {lib => zsh}/functions.zsh (100%) rename {lib => zsh}/my-syntax-theme.ini (100%) rename {lib => zsh}/palette.zsh (100%) rename {lib => zsh}/path.zsh (100%) rename {lib => zsh}/theme.zsh (100%) rename {lib => zsh}/zgen.zsh (100%) diff --git a/lib/aliases.zsh b/zsh/aliases.zsh similarity index 100% rename from lib/aliases.zsh rename to zsh/aliases.zsh diff --git a/lib/exports.zsh b/zsh/exports.zsh similarity index 100% rename from lib/exports.zsh rename to zsh/exports.zsh diff --git a/lib/functions.zsh b/zsh/functions.zsh similarity index 100% rename from lib/functions.zsh rename to zsh/functions.zsh diff --git a/lib/my-syntax-theme.ini b/zsh/my-syntax-theme.ini similarity index 100% rename from lib/my-syntax-theme.ini rename to zsh/my-syntax-theme.ini diff --git a/lib/palette.zsh b/zsh/palette.zsh similarity index 100% rename from lib/palette.zsh rename to zsh/palette.zsh diff --git a/lib/path.zsh b/zsh/path.zsh similarity index 100% rename from lib/path.zsh rename to zsh/path.zsh diff --git a/lib/theme.zsh b/zsh/theme.zsh similarity index 100% rename from lib/theme.zsh rename to zsh/theme.zsh diff --git a/lib/zgen.zsh b/zsh/zgen.zsh similarity index 100% rename from lib/zgen.zsh rename to zsh/zgen.zsh diff --git a/zshrc b/zshrc index 91ab90b..e56c467 100755 --- a/zshrc +++ b/zshrc @@ -3,7 +3,7 @@ DOTFILES_PATH="${0:h}" for script in functions path exports zgen aliases palette theme; do - source "$DOTFILES_PATH/lib/$script.zsh" + source "$DOTFILES_PATH/zsh/$script.zsh" source_if_exists "$DOTFILES_PATH/custom/$script.zsh" done From 33e4ffe2cc73726d88d25685557edbc548431596 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 22 Apr 2019 18:07:02 +0300 Subject: [PATCH 087/713] move everything zsh-related to zsh/ directory --- .gitignore | 5 +++-- .gitmodules | 2 +- install.zsh | 2 +- {completions => zsh/completions}/_rust | 0 {completions => zsh/completions}/_rustup | 0 zsh/functions.zsh | 2 +- zsh/path.zsh | 2 +- {welcome => zsh/welcome}/colors.py | 0 {welcome => zsh/welcome}/humanize.py | 0 {welcome => zsh/welcome}/logos/android | 0 {welcome => zsh/welcome}/logos/debian | 0 {welcome => zsh/welcome}/logos/mac | 0 {welcome => zsh/welcome}/logos/raspbian | 0 {welcome => zsh/welcome}/logos/ubuntu | 0 {welcome => zsh/welcome}/main.py | 0 {welcome => zsh/welcome}/system_info.py | 0 zgen => zsh/zgen | 0 zsh/zgen.zsh | 4 ++-- zshrc => zsh/zshrc | 6 +++--- 19 files changed, 12 insertions(+), 11 deletions(-) rename {completions => zsh/completions}/_rust (100%) rename {completions => zsh/completions}/_rustup (100%) rename {welcome => zsh/welcome}/colors.py (100%) rename {welcome => zsh/welcome}/humanize.py (100%) rename {welcome => zsh/welcome}/logos/android (100%) rename {welcome => zsh/welcome}/logos/debian (100%) rename {welcome => zsh/welcome}/logos/mac (100%) rename {welcome => zsh/welcome}/logos/raspbian (100%) rename {welcome => zsh/welcome}/logos/ubuntu (100%) rename {welcome => zsh/welcome}/main.py (100%) rename {welcome => zsh/welcome}/system_info.py (100%) rename zgen => zsh/zgen (100%) rename zshrc => zsh/zshrc (57%) diff --git a/.gitignore b/.gitignore index f505b48..dc73578 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ -/custom -/cache +/zsh/custom +/zsh/cache +!/zsh/cache/.gitkeep *.pyc diff --git a/.gitmodules b/.gitmodules index 696b396..3658adb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "zgen"] - path = zgen + path = zsh/zgen url = https://github.com/tarjoilija/zgen.git diff --git a/install.zsh b/install.zsh index e3df929..35f2d3f 100755 --- a/install.zsh +++ b/install.zsh @@ -15,7 +15,7 @@ install_dotfile() { for zsh_file_name in zshrc; do install_dotfile "$HOME/.$zsh_file_name" < Date: Mon, 22 Apr 2019 21:15:29 +0300 Subject: [PATCH 088/713] [nvim] use `is#` instead of `is` for comparisons --- nvim/lib/editing.vim | 2 +- nvim/lib/interface.vim | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nvim/lib/editing.vim b/nvim/lib/editing.vim index cc3d1f2..0761180 100644 --- a/nvim/lib/editing.vim +++ b/nvim/lib/editing.vim @@ -62,7 +62,7 @@ set foldmethod=marker " Mappings {{{ " arguably one of the most useful mappings - nnoremap empty(&buftype) ? ":w\" : "\" + nnoremap &buftype is# '' ? ":w\" : "\" " stay in the Visual mode when using shift commands xnoremap < Date: Mon, 22 Apr 2019 21:47:07 +0300 Subject: [PATCH 089/713] [nvim] fix 'cursorline' in terminal --- nvim/lib/terminal.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lib/terminal.vim b/nvim/lib/terminal.vim index cfc808c..3faca85 100644 --- a/nvim/lib/terminal.vim +++ b/nvim/lib/terminal.vim @@ -2,5 +2,5 @@ nnoremap t :terminal augroup vimrc-terminal autocmd! - autocmd TermOpen * set nocursorline | IndentLinesDisable + autocmd TermOpen * setl nocursorline | IndentLinesDisable augroup END From 636ca786f264ab49eaf81b2666dd065df105fe31 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 22 Apr 2019 22:54:45 +0300 Subject: [PATCH 090/713] [nvim] add option to ignore auto-formatting with coc for specific filetypes --- nvim/lib/files.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nvim/lib/files.vim b/nvim/lib/files.vim index df493ca..d83d496 100644 --- a/nvim/lib/files.vim +++ b/nvim/lib/files.vim @@ -116,9 +116,18 @@ set wildignore+=.git,.svn,.hg,.DS_Store,*~ endfunction " }}} + " auto-format with Coc.nvim {{{ + let g:coc_format_on_save_ignore = [] + function s:FormatOnSave() + if index(g:coc_format_on_save_ignore, &filetype) < 0 && IsCocEnabled() + silent CocFormat + endif + endfunction + " }}} + function s:OnSave() call s:FixWhitespaceOnSave() - if IsCocEnabled() | silent CocFormat | endif + call s:FormatOnSave() call s:CreateDirOnSave() endfunction augroup vimrc-on-save From 8543a17b1135f08c173335e461552b28e6599132 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 22 Apr 2019 23:16:43 +0300 Subject: [PATCH 091/713] [nvim] change "Go to..." mappings --- nvim/lib/completion.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nvim/lib/completion.vim b/nvim/lib/completion.vim index 891a01f..9716729 100644 --- a/nvim/lib/completion.vim +++ b/nvim/lib/completion.vim @@ -32,10 +32,10 @@ nmap [c (coc-diagnostic-prev) nmap ]c (coc-diagnostic-next) - nmap jd (coc-definition) - nmap jt (coc-type-definition) - nmap ji (coc-implementation) - nmap jr (coc-references) + nmap gd (coc-definition) + nmap gt (coc-type-definition) + nmap gi (coc-implementation) + nmap gr (coc-references) nmap (coc-rename) nmap (coc-codeaction) vmap (coc-codeaction-selected) From a838ded382738e08cddfdb5b8f8bae4f58b922f9 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 22 Apr 2019 23:34:11 +0300 Subject: [PATCH 092/713] [hammerspoon] remove cheatsheet script completely --- hammerspoon/cheatsheet.lua | 8 -------- hammerspoon/init.lua | 1 - 2 files changed, 9 deletions(-) delete mode 100644 hammerspoon/cheatsheet.lua diff --git a/hammerspoon/cheatsheet.lua b/hammerspoon/cheatsheet.lua deleted file mode 100644 index 5c6f37b..0000000 --- a/hammerspoon/cheatsheet.lua +++ /dev/null @@ -1,8 +0,0 @@ -hs.loadSpoon("KSheet") - -modal = hs.hotkey.modal.new({"cmd", "alt", "ctrl"}, "c") - -function modal:entered() spoon.KSheet:show() end -function modal:exited() spoon.KSheet:hide() end - -modal:bind('', 'escape', function() modal:exit() end) diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua index a00336d..47dce16 100644 --- a/hammerspoon/init.lua +++ b/hammerspoon/init.lua @@ -1,4 +1,3 @@ require "TerminalPalette" --- require "cheatsheet" hs.notify.show("Hammerspoon", "", "Hammespoon config loaded") From 05a31ea2b515e2cbfeb154858c0ef54d572724cd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 22 Apr 2019 23:46:04 +0300 Subject: [PATCH 093/713] [nvim] change :w to :update in the mapping --- nvim/lib/editing.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lib/editing.vim b/nvim/lib/editing.vim index 0761180..4a62a46 100644 --- a/nvim/lib/editing.vim +++ b/nvim/lib/editing.vim @@ -62,7 +62,7 @@ set foldmethod=marker " Mappings {{{ " arguably one of the most useful mappings - nnoremap &buftype is# '' ? ":w\" : "\" + nnoremap &buftype is# '' ? ":update\" : "\" " stay in the Visual mode when using shift commands xnoremap < Date: Tue, 23 Apr 2019 00:12:30 +0300 Subject: [PATCH 094/713] [nvim] add surround.vim customization --- nvim/lib/editing.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nvim/lib/editing.vim b/nvim/lib/editing.vim index 4a62a46..488f453 100644 --- a/nvim/lib/editing.vim +++ b/nvim/lib/editing.vim @@ -151,6 +151,8 @@ set foldmethod=marker let g:delimitMate_expand_space = 1 let g:delimitMate_expand_cr = 1 + let g:surround_{char2nr('*')} = "**\r**" + let g:pencil#wrapModeDefault = 'soft' let g:pencil#conceallevel = 0 let g:pencil#cursorwrap = 0 From 7eb2fd3b1e2bfd697acdbf26060d702c1f96a2f7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 23 Apr 2019 21:38:53 +0300 Subject: [PATCH 095/713] [zsh] rename some files --- zsh/{exports.zsh => env.zsh} | 0 zsh/{zgen.zsh => plugins.zsh} | 0 zsh/zshrc | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename zsh/{exports.zsh => env.zsh} (100%) rename zsh/{zgen.zsh => plugins.zsh} (100%) diff --git a/zsh/exports.zsh b/zsh/env.zsh similarity index 100% rename from zsh/exports.zsh rename to zsh/env.zsh diff --git a/zsh/zgen.zsh b/zsh/plugins.zsh similarity index 100% rename from zsh/zgen.zsh rename to zsh/plugins.zsh diff --git a/zsh/zshrc b/zsh/zshrc index d2ca401..68b5373 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -2,7 +2,7 @@ ZSH_DOTFILES="${0:h}" -for script in functions path exports zgen aliases palette theme; do +for script in functions path env plugins aliases palette theme; do source "$ZSH_DOTFILES/$script.zsh" source_if_exists "$ZSH_DOTFILES/custom/$script.zsh" done From 4ed36c8bb67d73523c6de2a2a180467ce89acd9a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 23 Apr 2019 21:42:49 +0300 Subject: [PATCH 096/713] fix upgrade script --- upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upgrade.sh b/upgrade.sh index 3ff29cb..2b75214 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -7,5 +7,5 @@ git pull --rebase --stat origin master git submodule update --init --recursive --remote --progress DISABLE_AUTO_UPDATE=true -source "./zgen/zgen.zsh" +source "$DOTFILES_PATH/zsh/zgen/zgen.zsh" zgen update From 7606f81737c4e5aff581a4041d25b433ad6d5195 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 23 Apr 2019 21:45:09 +0300 Subject: [PATCH 097/713] [zsh] fix cache directory in gitignore --- .gitignore | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index dc73578..04ff90a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,10 @@ /zsh/custom /zsh/cache -!/zsh/cache/.gitkeep *.pyc + +/ansible/hosts +/ansible/*.retry + +/smth +/.vscode +/hammerspoon/Spoons From da3a784600d2f5699b759a75e4892fc981d6f865 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 24 Apr 2019 10:37:40 +0300 Subject: [PATCH 098/713] fix upgrade script again --- upgrade.sh => upgrade.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename upgrade.sh => upgrade.zsh (83%) diff --git a/upgrade.sh b/upgrade.zsh similarity index 83% rename from upgrade.sh rename to upgrade.zsh index 2b75214..6cbbfec 100755 --- a/upgrade.sh +++ b/upgrade.zsh @@ -7,5 +7,5 @@ git pull --rebase --stat origin master git submodule update --init --recursive --remote --progress DISABLE_AUTO_UPDATE=true -source "$DOTFILES_PATH/zsh/zgen/zgen.zsh" +source "zsh/zgen/zgen.zsh" zgen update From 9816ec63ee48252aa3cd792716f20fb86d765e1e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 1 May 2019 16:33:22 +0300 Subject: [PATCH 099/713] [zsh] re-arrange prompt items --- zsh/plugins.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index de0168f..d8a42a3 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -35,10 +35,10 @@ configure_prompt() { git # hg exec_time - line_sep # vi_mode jobs exit_code + line_sep char ) From 5b309c193bda5fa8271fe2434c37beb4ef4a83bb Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 1 May 2019 16:33:39 +0300 Subject: [PATCH 100/713] [zsh] allow aliases to work with sudo --- zsh/aliases.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 088cd44..9580bb9 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,7 +1,9 @@ #!/usr/bin/env zsh -# This alias removes leading dollar sign. Useful when copying code from Stackoverflow +# this alias removes leading dollar sign (useful when copying code from Stackoverflow) alias '$'='' +# this alias allows aliases to work with sudo +alias sudo='sudo ' alias grep='grep --color=auto' From 5c3fef652cc7fabe1f1054f28086187d90e27050 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 1 May 2019 16:35:36 +0300 Subject: [PATCH 101/713] [zsh] remove fd emulation --- zsh/aliases.zsh | 3 --- 1 file changed, 3 deletions(-) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 9580bb9..9d9f36a 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -24,9 +24,6 @@ fi # fd is a simple, fast and user-friendly alternative to find - https://github.com/sharkdp/fd if command_exists fd; then alias fda="fd --hidden --no-ignore" -else - alias fd="find -iname" - alias fda="${aliases[fd]}" fi # git with hub From d09430d0c2299c5e7579633a130df9e81f2e4c0c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 1 May 2019 17:32:44 +0300 Subject: [PATCH 102/713] [nvim] remove ALE highlights --- nvim/lib/colorscheme.vim | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/nvim/lib/colorscheme.vim b/nvim/lib/colorscheme.vim index 1cbb2e2..eec3d24 100644 --- a/nvim/lib/colorscheme.vim +++ b/nvim/lib/colorscheme.vim @@ -118,29 +118,15 @@ set termguicolors " User interface {{{ - call s:hi('Error', 'bg', 0x8, '', '') - call s:hi('ErrorMsg', 0x8, 'NONE', '', '') - call s:hi('WarningMsg', 0x9, 'NONE', '', '') - call s:hi('TooLong', 0x8, '', '', '') - call s:hi('Debug', 0x8, '', '', '') - hi! link ALEError Error - hi! link ALEErrorSign ALEError - hi! link ALEStyleErrorSign ALEErrorSign - hi! link ALEVirtualTextError ALEError - hi! link ALEVirtualTextStyleError ALEVirtualTextError - hi! link ALEWarning Todo - hi! link ALEWarningSign ALEWarning - hi! link ALEStyleWarningSign ALEWarningSign - hi! link ALEVirtualTextWarning ALEWarning - hi! link ALEVirtualTextStyleWarning ALEVirtualTextWarning - hi! link ALEInfo ALEWarning - hi! link ALEInfoSign ALEWarningSign - hi! link ALEVirtualTextInfo ALEVirtualTextWarning - hi! link ALESignColumnWithErrors ALEError - hi! link CocErrorSign ALEErrorSign - hi! link CocWarningSign ALEWarningSign - hi! link CocInfoSign ALEInfoSign - hi! link CocHintSign ALEInfoSign + call s:hi('Error', 'bg', 0x8, '', '') + call s:hi('ErrorMsg', 0x8, 'NONE', '', '') + call s:hi('WarningMsg', 0x9, 'NONE', '', '') + call s:hi('TooLong', 0x8, '', '', '') + call s:hi('Debug', 0x8, '', '', '') + hi! link CocErrorSign Error + call s:hi('CocWarningSign', 'bg', 0xA, '', '') + call s:hi('CocInfoSign', 'bg', 0xD, '', '') + hi! link CocHintSign CocInfoSign call s:hi('FoldColumn', 0xC, 0x1, '', '') call s:hi('Folded', 0x3, 0x1, '', '') From 531e1071bd86b971db889669ff108194dae67087 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 1 May 2019 17:40:25 +0300 Subject: [PATCH 103/713] [nvim] replace : with most mappings to commands --- nvim/lib/completion.vim | 20 ++++++++++---------- nvim/lib/editing.vim | 2 +- nvim/lib/files.vim | 4 ++-- nvim/lib/git.vim | 2 +- nvim/lib/interface.vim | 24 ++++++++++-------------- nvim/lib/terminal.vim | 2 -- zsh/path.zsh | 13 +++++-------- 7 files changed, 29 insertions(+), 38 deletions(-) diff --git a/nvim/lib/completion.vim b/nvim/lib/completion.vim index 9716729..bfaeedf 100644 --- a/nvim/lib/completion.vim +++ b/nvim/lib/completion.vim @@ -41,16 +41,16 @@ vmap (coc-codeaction-selected) " nmap qf (coc-fix-current) - nnoremap l :CocList - nnoremap d :CocList --auto-preview diagnostics - nnoremap c :CocList commands - nnoremap o :CocList --auto-preview outline - nnoremap s :CocList --interactive symbols - nnoremap h :CocPrev - nnoremap k :CocPrev - nnoremap l :CocNext - nnoremap j :CocNext - nnoremap p :CocListResume + nnoremap l CocList + nnoremap d CocList --auto-preview diagnostics + nnoremap c CocList commands + nnoremap o CocList --auto-preview outline + nnoremap s CocList --interactive symbols + nnoremap h CocPrev + nnoremap k CocPrev + nnoremap l CocNext + nnoremap j CocNext + nnoremap p CocListResume " }}} " CocFormat {{{ diff --git a/nvim/lib/editing.vim b/nvim/lib/editing.vim index 488f453..f819f8b 100644 --- a/nvim/lib/editing.vim +++ b/nvim/lib/editing.vim @@ -94,7 +94,7 @@ set foldmethod=marker " anywhere in pattern to override these two settings) set ignorecase smartcase - nnoremap \ :nohlsearch + nnoremap \ nohlsearch let g:indexed_search_center = 1 diff --git a/nvim/lib/files.vim b/nvim/lib/files.vim index d83d496..3be8713 100644 --- a/nvim/lib/files.vim +++ b/nvim/lib/files.vim @@ -24,7 +24,7 @@ set wildignore+=.git,.svn,.hg,.DS_Store,*~ " helper functions (which I use in my dotfiles) let g:loaded_netrwPlugin = 1 " re-add Netrw's gx mappings since we've disabled them - nnoremap gx :call netrw#BrowseX(expand(''),netrw#CheckIfRemote()) + nnoremap gx call netrw#BrowseX(expand(''),netrw#CheckIfRemote()) xnoremap gx :call netrw#BrowseXVis() " }}} @@ -32,7 +32,7 @@ set wildignore+=.git,.svn,.hg,.DS_Store,*~ " Ranger {{{ let g:ranger_replace_netrw = 1 let g:ranger_map_keys = 0 - nnoremap o :Ranger + nnoremap o Ranger " ranger.vim relies on the Bclose.vim plugin, but I use Bbye.vim, so this " command is here just for compatitabilty command! -bang -complete=buffer -nargs=? Bclose Bdelete diff --git a/nvim/lib/git.vim b/nvim/lib/git.vim index df59ecd..8f2626b 100644 --- a/nvim/lib/git.vim +++ b/nvim/lib/git.vim @@ -1,7 +1,7 @@ " mappings {{{ let g:gitgutter_map_keys = 0 nnoremap gg :G - nnoremap g :Git + nnoremap g :Git nnoremap gs :Gstatus nnoremap gd :Gdiff nnoremap gb :Gblame diff --git a/nvim/lib/interface.vim b/nvim/lib/interface.vim index d9cfab5..d7f0c5e 100644 --- a/nvim/lib/interface.vim +++ b/nvim/lib/interface.vim @@ -35,9 +35,9 @@ endif set diffopt+=vertical " buffer navigation {{{ - noremap :bnext - noremap :bprev - noremap gb :buffer # + noremap bnext + noremap bprev + noremap gb buffer# " }}} " ask for confirmation when closing unsaved buffers @@ -61,8 +61,8 @@ endif " }}} " closing buffers {{{ - nnoremap :call CloseBuffer('Bdelete') - nnoremap :quit call CloseBuffer('Bdelete') + nnoremap call CloseBuffer('Bdelete') + nnoremap quit call CloseBuffer('Bdelete') " }}} " }}} @@ -83,13 +83,8 @@ endif " don't automatically make all windows the same size set noequalalways - " splitting {{{ - noremap h :split - noremap v :vsplit - " }}} - " closing windows {{{ - nnoremap :quit + nnoremap quit " }}} " }}} @@ -151,9 +146,10 @@ endif " FZF {{{ - nnoremap :Helptags - nnoremap f :Files - nnoremap b :Buffers + noremap Helptags + inoremap Helptags + nnoremap f Files + nnoremap b Buffers " }}} diff --git a/nvim/lib/terminal.vim b/nvim/lib/terminal.vim index 3faca85..4942478 100644 --- a/nvim/lib/terminal.vim +++ b/nvim/lib/terminal.vim @@ -1,5 +1,3 @@ -nnoremap t :terminal - augroup vimrc-terminal autocmd! autocmd TermOpen * setl nocursorline | IndentLinesDisable diff --git a/zsh/path.zsh b/zsh/path.zsh index ffa8e7e..81fc7ec 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -1,7 +1,7 @@ #!/usr/bin/env zsh # make these variables unique (-U) arrays (-a) -typeset -aU fpath manpath path +typeset -aU fpath manpath path ldflags cppflags if is_macos; then path=( @@ -14,20 +14,17 @@ if is_macos; then /usr/local/opt/gnu-getopt/bin # getopt /usr/local/opt/findutils/libexec/gnubin # GNU findutils /usr/local/opt/coreutils/libexec/gnubin # GNU coreutils + /usr/local/opt/curl/bin # curl "${path[@]}" ) manpath=( - /usr/local/opt/ruby/share/man - /usr/local/opt/file-formula/share/man # file - /usr/local/opt/gnu-tar/libexec/gnuman # GNU tar - /usr/local/opt/unzip/share/man # GNU unzip - /usr/local/opt/openssl/share/man # openssl - /usr/local/opt/gnu-getopt/share/man # getopt /usr/local/opt/findutils/libexec/gnuman # GNU findutils - /usr/local/opt/coreutils/libexec/gnuman # GNU coreutils "${manpath[@]}" ) + + export LDFLAGS="-L/usr/local/opt/ruby/lib" + export CPPFLAGS="-I/usr/local/opt/ruby/include" fi # add Go binaries From f31ddce6a8994cb3800dccfce8202aa1eb04f290 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 6 May 2019 01:51:47 +0300 Subject: [PATCH 104/713] [nvim] use base16-shell by default --- nvim/lib/colorscheme.vim | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/nvim/lib/colorscheme.vim b/nvim/lib/colorscheme.vim index eec3d24..3dc282e 100644 --- a/nvim/lib/colorscheme.vim +++ b/nvim/lib/colorscheme.vim @@ -1,28 +1,36 @@ -set termguicolors - " modified version of base16-vim (https://github.com/chriskempson/base16-vim) " by Chris Kempson (http://chriskempson.com) +let s:base16_theme_name = 'eighties' + " Color definitions {{{ + let g:base16_shell_path = get(g:, 'base16_shell_path', expand('~/.config/base16-shell')) + let s:base16_shell_script = g:base16_shell_path . '/scripts/base16-' . s:base16_theme_name . '.sh' + if filereadable(s:base16_shell_script) + " call system(shellescape(s:base16_shell_script)) + else + set termguicolors + endif + " Eighties scheme by Chris Kempson (http://chriskempson.com) let s:colors = [ \ {'gui': '#2d2d2d', 'cterm': '00'}, - \ {'gui': '#393939', 'cterm': '10'}, - \ {'gui': '#515151', 'cterm': '11'}, + \ {'gui': '#393939', 'cterm': '18'}, + \ {'gui': '#515151', 'cterm': '19'}, \ {'gui': '#747369', 'cterm': '08'}, - \ {'gui': '#a09f93', 'cterm': '12'}, + \ {'gui': '#a09f93', 'cterm': '20'}, \ {'gui': '#d3d0c8', 'cterm': '07'}, - \ {'gui': '#e8e6df', 'cterm': '13'}, + \ {'gui': '#e8e6df', 'cterm': '21'}, \ {'gui': '#f2f0ec', 'cterm': '15'}, \ {'gui': '#f2777a', 'cterm': '01'}, - \ {'gui': '#f99157', 'cterm': '09'}, + \ {'gui': '#f99157', 'cterm': '16'}, \ {'gui': '#ffcc66', 'cterm': '03'}, \ {'gui': '#99cc99', 'cterm': '02'}, \ {'gui': '#66cccc', 'cterm': '06'}, \ {'gui': '#6699cc', 'cterm': '04'}, \ {'gui': '#cc99cc', 'cterm': '05'}, - \ {'gui': '#d27b53', 'cterm': '14'} + \ {'gui': '#d27b53', 'cterm': '17'} \ ] " }}} @@ -42,7 +50,7 @@ set termguicolors " Theme setup {{{ hi clear syntax reset - let g:colors_name = "base16-eighties" + let g:colors_name = 'base16-' . s:base16_theme_name " }}} " Highlighting function {{{ @@ -102,7 +110,7 @@ set termguicolors hi! link SpecialComment Comment call s:hi('Todo', 'bg', 0xA, 'bold', '') call s:hi('Function', 0xD, '', '', '') - call s:hi('Identifier', 0x8, '', '', '') + call s:hi('Identifier', 0x8, '', 'none', '') hi! link Variable Identifier call s:hi('Include', 0xF, '', '', '') call s:hi('PreProc', 0xA, '', '', '') @@ -141,7 +149,7 @@ set termguicolors call s:hi('Visual', '', 0x2, '', '') call s:hi('WildMenu', 0x1, 'fg', '', '') - call s:hi('CursorLine', '', 0x1, '', '') + call s:hi('CursorLine', '', 0x1, 'none', '') hi! link CursorColumn CursorLine call s:hi('ColorColumn', '', 0x1, '', '') call s:hi('LineNr', 0x3, 0x1, '', '') From 577ffbe0d7e83de23762289b733bd99beec20cf4 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 6 May 2019 02:24:22 +0300 Subject: [PATCH 105/713] [zsh] add base16-shell --- zsh/zshrc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index 68b5373..099e3d7 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -7,8 +7,10 @@ for script in functions path env plugins aliases palette theme; do source_if_exists "$ZSH_DOTFILES/custom/$script.zsh" done -if command_exists rbenv; then - eval "$(rbenv init -)" -fi +command_exists rbenv && eval "$(rbenv init -)" + +BASE16_SHELL="$HOME/.config/base16-shell/" +BASE16_SHELL_profile_helper="$BASE16_SHELL/profile_helper.sh" +[[ -n "$PS1" && -r "$BASE16_SHELL_profile_helper" ]] && eval "$("$BASE16_SHELL_profile_helper")" welcome From 83106d42fb20adde83bd6d186ee1226f9b9079e3 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 6 May 2019 02:29:01 +0300 Subject: [PATCH 106/713] [zsh] add base16-shell as a plugin --- nvim/lib/colorscheme.vim | 2 +- zsh/plugins.zsh | 2 ++ zsh/zshrc | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/nvim/lib/colorscheme.vim b/nvim/lib/colorscheme.vim index 3dc282e..83c8af6 100644 --- a/nvim/lib/colorscheme.vim +++ b/nvim/lib/colorscheme.vim @@ -5,7 +5,7 @@ let s:base16_theme_name = 'eighties' " Color definitions {{{ - let g:base16_shell_path = get(g:, 'base16_shell_path', expand('~/.config/base16-shell')) + let g:base16_shell_path = get(g:, 'base16_shell_path', expand('~/.zgen/chriskempson/base16-shell-master')) let s:base16_shell_script = g:base16_shell_path . '/scripts/base16-' . s:base16_theme_name . '.sh' if filereadable(s:base16_shell_script) " call system(shellescape(s:base16_shell_script)) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index d8a42a3..b086ff5 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -76,5 +76,7 @@ if ! zgen saved; then zgen load denysdovhan/spaceship-prompt spaceship + zgen load chriskempson/base16-shell + zgen save fi diff --git a/zsh/zshrc b/zsh/zshrc index 099e3d7..34b5317 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -9,7 +9,7 @@ done command_exists rbenv && eval "$(rbenv init -)" -BASE16_SHELL="$HOME/.config/base16-shell/" +BASE16_SHELL="$HOME/.zgen/chriskempson/base16-shell-master" BASE16_SHELL_profile_helper="$BASE16_SHELL/profile_helper.sh" [[ -n "$PS1" && -r "$BASE16_SHELL_profile_helper" ]] && eval "$("$BASE16_SHELL_profile_helper")" From d0c5031842bcb4a6e8e36ae0aaee1c9b53f7e0b0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 6 May 2019 02:32:58 +0300 Subject: [PATCH 107/713] [nvim] fix base16-shell loading --- nvim/lib/colorscheme.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lib/colorscheme.vim b/nvim/lib/colorscheme.vim index 83c8af6..9d907cb 100644 --- a/nvim/lib/colorscheme.vim +++ b/nvim/lib/colorscheme.vim @@ -7,7 +7,7 @@ let s:base16_theme_name = 'eighties' let g:base16_shell_path = get(g:, 'base16_shell_path', expand('~/.zgen/chriskempson/base16-shell-master')) let s:base16_shell_script = g:base16_shell_path . '/scripts/base16-' . s:base16_theme_name . '.sh' - if filereadable(s:base16_shell_script) + if filereadable(s:base16_shell_script) && !&termguicolors " call system(shellescape(s:base16_shell_script)) else set termguicolors From b70d8de16b49d6de2434e5d9d1b0f95c1f8ef83c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 8 May 2019 10:58:36 +0300 Subject: [PATCH 108/713] [nvim] fix close buffer with --- nvim/lib/interface.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lib/interface.vim b/nvim/lib/interface.vim index d7f0c5e..dd58a35 100644 --- a/nvim/lib/interface.vim +++ b/nvim/lib/interface.vim @@ -62,7 +62,7 @@ endif " closing buffers {{{ nnoremap call CloseBuffer('Bdelete') - nnoremap quit call CloseBuffer('Bdelete') + nnoremap call CloseBuffer('Bdelete') quit " }}} " }}} From 4536b766e780d2b9a2a39ed8e21d110050b433a0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 9 May 2019 18:24:34 +0300 Subject: [PATCH 109/713] [nvim] coc in statusline --- nvim/lib/interface.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nvim/lib/interface.vim b/nvim/lib/interface.vim index dd58a35..d6436a2 100644 --- a/nvim/lib/interface.vim +++ b/nvim/lib/interface.vim @@ -105,7 +105,9 @@ endif let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#ale#enabled = 1 - call airline#parts#define_function('coc#status', 'coc#status') + if exists("*coc#status") + call airline#parts#define_function('coc#status', 'coc#status') + endif function StatusLine_filesize() let l:bytes = getfsize(expand('%')) From 4200729432feeebc4f24ebdd765bdc2b305b2684 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 9 May 2019 18:24:53 +0300 Subject: [PATCH 110/713] [zsh/welcome] add Linux Mint logo --- zsh/welcome/logos/linuxmint | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 zsh/welcome/logos/linuxmint diff --git a/zsh/welcome/logos/linuxmint b/zsh/welcome/logos/linuxmint new file mode 100644 index 0000000..da2c729 --- /dev/null +++ b/zsh/welcome/logos/linuxmint @@ -0,0 +1,16 @@ +{2} MMMMMMMMMMMMMMMMMMMMMMMMMmds+. +{2} MMm----::-://////////////oymNMd+` +{2} MMd {7}/++ {2}-sNMd: +{2} MMNso/` {7}dMM `.::-. .-::.` {2}.hMN: +{2} ddddMMh {7}dMM :hNMNMNhNMNMNh: {2}`NMm +{2} NMm {7}dMM .NMN/-+MMM+-/NMN` {2}dMM +{2} NMm {7}dMM -MMm `MMM dMM. {2}dMM +{2} NMm {7}dMM -MMm `MMM dMM. {2}dMM +{2} NMm {7}dMM .mmd `mmm yMM. {2}dMM +{2} NMm {7}dMM` ..` ... ydm. {2}dMM +{2} hMM- {7}+MMd/-------...-:sdds {2}dMM +{2} -NMm- {7}:hNMNNNmdddddddddy/` {2}dMM +{2} -dMNs-{7}``-::::-------.`` {2}dMM +{2} `/dMNmy+/:-------------:/yMMM +{2} ./ydNMMMMMMMMMMMMMMMMMMMMM +{2} .MMMMMMMMMMMMMMMMMMM From a6241e3cd46f37715cd0033f3df154eaa12261fc Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 9 May 2019 18:58:25 +0300 Subject: [PATCH 111/713] [zsh] add zsh deprecation notice --- zsh/aliases.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 9d9f36a..5e0bf21 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -40,3 +40,5 @@ alias chown='chown -v' # print file sizes in human readable format alias du='du -h' alias df='df -h' + +alias apt-get="echo -e \"use 'apt' instead of 'apt-get'\nif you really want to use 'apt-get', type '"'\\\\'"apt-get'\" #" From 8c5e2ca4b4933acd49b25b8c7d6dfcd580871b62 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 9 May 2019 19:25:41 +0300 Subject: [PATCH 112/713] [nvim] enable termguicolors if base16-shell is not loaded --- nvim/lib/colorscheme.vim | 8 +++----- zsh/zshrc | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/nvim/lib/colorscheme.vim b/nvim/lib/colorscheme.vim index 9d907cb..43a64e1 100644 --- a/nvim/lib/colorscheme.vim +++ b/nvim/lib/colorscheme.vim @@ -5,12 +5,10 @@ let s:base16_theme_name = 'eighties' " Color definitions {{{ - let g:base16_shell_path = get(g:, 'base16_shell_path', expand('~/.zgen/chriskempson/base16-shell-master')) - let s:base16_shell_script = g:base16_shell_path . '/scripts/base16-' . s:base16_theme_name . '.sh' - if filereadable(s:base16_shell_script) && !&termguicolors - " call system(shellescape(s:base16_shell_script)) - else + if empty($BASE16_SHELL) || !filereadable($BASE16_SHELL . '/scripts/base16-' . s:base16_theme_name . '.sh') || &termguicolors set termguicolors + else + " call system(shellescape(s:base16_shell_script)) endif " Eighties scheme by Chris Kempson (http://chriskempson.com) diff --git a/zsh/zshrc b/zsh/zshrc index 34b5317..132db7a 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -9,7 +9,7 @@ done command_exists rbenv && eval "$(rbenv init -)" -BASE16_SHELL="$HOME/.zgen/chriskempson/base16-shell-master" +export BASE16_SHELL="$HOME/.zgen/chriskempson/base16-shell-master" BASE16_SHELL_profile_helper="$BASE16_SHELL/profile_helper.sh" [[ -n "$PS1" && -r "$BASE16_SHELL_profile_helper" ]] && eval "$("$BASE16_SHELL_profile_helper")" From 2e49567620b39f4e46bc3b9403341f35ef6a97b2 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 11 May 2019 14:54:20 +0300 Subject: [PATCH 113/713] [zsh] add CFLAGS, LDFLAGS and PKG_CONFIG_PATH support for keg-only homebrew formulas --- zsh/path.zsh | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/zsh/path.zsh b/zsh/path.zsh index 81fc7ec..dc4bdd5 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -1,7 +1,13 @@ #!/usr/bin/env zsh -# make these variables unique (-U) arrays (-a) -typeset -aU fpath manpath path ldflags cppflags +# tie these env variables to zsh arrays +typeset -T LDFLAGS ldflags ' ' +typeset -T CPPFLAGS cppflags ' ' +typeset -T PKG_CONFIG_PATH pkg_config_path ':' + +# keep only unique values in these arrays +typeset -U path fpath manpath ldflags cppflags pkg_config_path +export -U PATH FPATH MANPATH LDFLAGS CPPFLAGS PKG_CONFIG_PATH if is_macos; then path=( @@ -23,8 +29,14 @@ if is_macos; then "${manpath[@]}" ) - export LDFLAGS="-L/usr/local/opt/ruby/lib" - export CPPFLAGS="-I/usr/local/opt/ruby/include" + for formula in ruby openssl curl; do + formula_path="/usr/local/opt/$formula" + if [[ -d "$formula_path" ]]; then + ldflags+=( -L"$formula_path"/lib ) + cppflags+=( -L"$formula_path"/include ) + pkg_config_path+=( "$formula_path"/lib/pkgconfig ) + fi + done fi # add Go binaries @@ -32,21 +44,21 @@ export GOPATH="$HOME/.go" path=("$GOPATH/bin" "${path[@]}") # add user binaries -path=(~/bin ~/.local/bin "${path[@]}") +path=(~/.local/bin "${path[@]}") -# add my completions +# add my binaries and completions +path=("$ZSH_DOTFILES/bin" "${path[@]}") fpath=("$ZSH_DOTFILES/completions" "${fpath[@]}") # check for Rust installed via rustup -if rust_sysroot="$(~/.cargo/bin/rustc --print sysroot 2> /dev/null)"; then - # add paths of the current Rust toolchain +rustc=~/.cargo/bin/rustc +if [[ -f "$rustc" && -x "$rustc" ]] && rust_sysroot="$("$rustc" --print sysroot)"; then + # add paths of the default Rust toolchain path=(~/.cargo/bin "${path[@]}") fpath=("$rust_sysroot/share/zsh/site-functions" "${fpath[@]}") manpath=("$rust_sysroot/share/man" "${manpath[@]}") fi -unset rust_sysroot +unset rustc rust_sysroot # add colon after MANPATH so that it doesn't overwrite system MANPATH MANPATH="$MANPATH:" - -export PATH MANPATH From e816e428cf10c8275dd481c7ee513568243c0ddb Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 11 May 2019 15:39:26 +0300 Subject: [PATCH 114/713] add Git config --- gitconfig | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 gitconfig diff --git a/gitconfig b/gitconfig new file mode 100644 index 0000000..8768182 --- /dev/null +++ b/gitconfig @@ -0,0 +1,29 @@ +[color] + ui = true + +[log] + abbrevCommit = true + decorate = true +[format] + pretty = %C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset) + +[core] + pager = diff-so-fancy | less --tabs=4 -RFX + +[color "diff-highlight"] + oldNormal = red bold + oldHighlight = red bold 52 + newNormal = green bold + newHighlight = green bold 22 +[color "diff"] + meta = yellow + frag = magenta bold + commit = yellow bold + old = red bold + new = green bold + whitespace = red reverse + +[alias] + tree = log --all --graph + unstage = reset HEAD + discard = checkout From e15ee17a58cd55f4826da151cba9afdb45ef3328 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 12 May 2019 15:25:12 +0300 Subject: [PATCH 115/713] [nvim] fix --- nvim/lib/interface.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lib/interface.vim b/nvim/lib/interface.vim index d6436a2..debf7ef 100644 --- a/nvim/lib/interface.vim +++ b/nvim/lib/interface.vim @@ -62,7 +62,7 @@ endif " closing buffers {{{ nnoremap call CloseBuffer('Bdelete') - nnoremap call CloseBuffer('Bdelete') quit + nnoremap call CloseBuffer('Bdelete')quit " }}} " }}} From 343a51db0bb1492a9e322132982699995c6c09bd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 12 May 2019 15:25:56 +0300 Subject: [PATCH 116/713] [git] fix config --- gitconfig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gitconfig b/gitconfig index 8768182..0060f46 100644 --- a/gitconfig +++ b/gitconfig @@ -1,6 +1,9 @@ [color] ui = true +[pull] + rebase = true + [log] abbrevCommit = true decorate = true @@ -8,7 +11,7 @@ pretty = %C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset) [core] - pager = diff-so-fancy | less --tabs=4 -RFX + pager = diff-so-fancy | less --tabs=4 --RAW-CONTROL-CHARS [color "diff-highlight"] oldNormal = red bold From 3e272ffaaf3c386e05817a7f08d16e8cf7c4ee5c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 14 May 2019 17:48:38 +0300 Subject: [PATCH 117/713] [nvim] fix coc in the statusline --- nvim/lib/interface.vim | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/nvim/lib/interface.vim b/nvim/lib/interface.vim index debf7ef..95049b9 100644 --- a/nvim/lib/interface.vim +++ b/nvim/lib/interface.vim @@ -105,9 +105,7 @@ endif let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#ale#enabled = 1 - if exists("*coc#status") - call airline#parts#define_function('coc#status', 'coc#status') - endif + call airline#parts#define_function('coc#status', 'coc#status') function StatusLine_filesize() let l:bytes = getfsize(expand('%')) @@ -134,10 +132,16 @@ endif let g:airline_section_{a:section} = g:airline_section_{a:section} . airline#section#create_left([''] + a:items) endfunction function s:tweak_airline() - call s:airline_section_prepend('x', ['coc#status']) + if exists('*coc#status') + call s:airline_section_prepend('x', ['coc#status']) + endif call s:airline_section_append('y', ['filesize']) - call s:airline_section_prepend('error', ['coc_error_count']) - call s:airline_section_prepend('warning', ['coc_warning_count']) + if exists('*airline#extensions#coc#get_error') + call s:airline_section_prepend('error', ['coc_error_count']) + endif + if exists('*airline#extensions#coc#get_warning') + call s:airline_section_prepend('warning', ['coc_warning_count']) + endif endfunction augroup vimrc-interface-airline autocmd! From d2dd0cb301d75e538f6fb957b84afe3731970e42 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 14 May 2019 18:45:14 +0300 Subject: [PATCH 118/713] [nvim] use vim-plug instead of dein --- nvim/lib/plugins.vim | 186 ++++++++++++++++++------------------------- 1 file changed, 76 insertions(+), 110 deletions(-) diff --git a/nvim/lib/plugins.vim b/nvim/lib/plugins.vim index 6f43a83..f18ec8f 100644 --- a/nvim/lib/plugins.vim +++ b/nvim/lib/plugins.vim @@ -1,116 +1,82 @@ -let s:dein_plugins_dir = expand('~/.cache/dein') -let s:dein_dir = s:dein_plugins_dir . '/repos/github.com/Shougo/dein.vim' +let s:vim_config_dir = expand('~/.config/nvim') +let s:vim_plug_script = s:vim_config_dir . '/autoload/plug.vim' +let s:vim_plug_home = s:vim_config_dir . '/plugged' -if !isdirectory(s:dein_dir) - echo 'Installing Dein...' - call system('git clone https://github.com/Shougo/dein.vim ' . shellescape(s:dein_dir)) +let s:just_installed_vim_plug = 0 +if !filereadable(s:vim_plug_script) + exe '!curl -fL https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim --create-dirs -o' shellescape(s:vim_plug_script) + autocmd VimEnter * PlugInstall --sync endif -let &runtimepath .= ',' . s:dein_dir +call plug#begin(s:vim_config_dir . '/plugged') -if dein#load_state(s:dein_plugins_dir) - call dein#begin(s:dein_plugins_dir) - - command! -nargs=+ -bar Plugin call dein#add() - - " Let dein manage itself - Plugin s:dein_dir - - " Files {{{ - Plugin 'tpope/vim-eunuch' - Plugin 'francoiscabrol/ranger.vim' - " }}} - - " Editing {{{ - Plugin 'easymotion/vim-easymotion' - Plugin 'junegunn/vim-easy-align' - Plugin 'Raimondi/delimitMate' - Plugin 'tpope/vim-repeat' - Plugin 'tpope/vim-commentary' - Plugin 'tpope/vim-surround' - Plugin 'Yggdroot/indentLine' - Plugin 'henrik/vim-indexed-search' - Plugin 'andymass/vim-matchup' - Plugin 'tommcdo/vim-exchange' - Plugin 'inkarkat/vim-ingo-library' " required by LineJuggler - Plugin 'inkarkat/vim-LineJuggler', { 'rev': 'stable' } - Plugin 'reedes/vim-pencil' - " }}} - - " Text objects {{{ - Plugin 'kana/vim-textobj-user' - Plugin 'kana/vim-textobj-entire' - Plugin 'kana/vim-textobj-line' - Plugin 'kana/vim-textobj-indent' - " Plugin 'kana/vim-textobj-fold' - " }}} - - " UI {{{ - Plugin 'moll/vim-bbye' - Plugin 'gerw/vim-HiLinkTrace' - Plugin 'vim-airline/vim-airline' - Plugin 'vim-airline/vim-airline-themes' - Plugin 'wincent/terminus' - Plugin 'tpope/vim-obsession' - Plugin 'romainl/vim-qf' - Plugin 'dyng/ctrlsf.vim' - " }}} - - " Git {{{ - Plugin 'tpope/vim-fugitive' - Plugin 'tpope/vim-rhubarb' - Plugin 'airblade/vim-gitgutter' - " }}} - - " FZF {{{ - Plugin 'junegunn/fzf', { 'build': './install --bin' } - Plugin 'junegunn/fzf.vim' - " }}} - - " Programming {{{ - Plugin 'sheerun/vim-polyglot' - Plugin 'neoclide/coc.nvim', { 'build': 'yarn install' } - Plugin 'dag/vim2hs' - " }}} - - delcommand Plugin - - call dein#end() - call dein#save_state() -endif - -" enable full plugin support -filetype plugin indent on -syntax enable - -" Automatically install/clean plugins (because I'm a programmer) {{{ - - " the following two lines were copied directly from dein's source code - let s:dein_cache_dir = get(g:, 'dein#cache_directory', g:dein#_base_path) - let s:dein_state_file = s:dein_cache_dir . '/state_' . g:dein#_progname . '.vim' - - let s:current_file = expand('') - - " gettftime() returns the last modification time of a given file - let s:plugins_file_changed = getftime(s:current_file) > getftime(s:dein_state_file) - if s:plugins_file_changed - echo "plugins.vim was changed, clearing Dein state..." - call dein#clear_state() - - let s:unused_plugins = dein#check_clean() - if !empty(s:unused_plugins) - echo "Cleaning up unused plugins..." - for s:plugin in s:unused_plugins - echo "deleting" s:plugin - call delete(s:plugin, 'rf') - endfor - endif - endif - - if dein#check_install() || s:plugins_file_changed - echo "Installing plugins..." - call dein#install() - echo - endif +Plug 'junegunn/vim-plug' +" Files {{{ + Plug 'tpope/vim-eunuch' + Plug 'francoiscabrol/ranger.vim' " }}} + +" Editing {{{ + Plug 'easymotion/vim-easymotion' + Plug 'junegunn/vim-easy-align' + Plug 'Raimondi/delimitMate' + Plug 'tpope/vim-repeat' + Plug 'tpope/vim-commentary' + Plug 'tpope/vim-surround' + Plug 'Yggdroot/indentLine' + Plug 'henrik/vim-indexed-search' + Plug 'andymass/vim-matchup' + Plug 'tommcdo/vim-exchange' + Plug 'inkarkat/vim-ingo-library' " required by LineJuggler + Plug 'inkarkat/vim-LineJuggler', { 'branch': 'stable' } + Plug 'reedes/vim-pencil' +" }}} + +" Text objects {{{ + Plug 'kana/vim-textobj-user' + Plug 'kana/vim-textobj-entire' + Plug 'kana/vim-textobj-line' + Plug 'kana/vim-textobj-indent' + " Plug 'kana/vim-textobj-fold' +" }}} + +" UI {{{ + Plug 'moll/vim-bbye' + Plug 'gerw/vim-HiLinkTrace' + Plug 'vim-airline/vim-airline' + Plug 'vim-airline/vim-airline-themes' + Plug 'wincent/terminus' + Plug 'tpope/vim-obsession' + Plug 'romainl/vim-qf' + Plug 'dyng/ctrlsf.vim' +" }}} + +" Git {{{ + Plug 'tpope/vim-fugitive' + Plug 'tpope/vim-rhubarb' + Plug 'airblade/vim-gitgutter' +" }}} + +" FZF {{{ + Plug 'junegunn/fzf', { 'do': './install --bin' } + Plug 'junegunn/fzf.vim' +" }}} + +" Programming {{{ + Plug 'sheerun/vim-polyglot' + Plug 'neoclide/coc.nvim', { 'do': 'yarn install' } + Plug 'dag/vim2hs' +" }}} + +call plug#end() + +" " Automatically install/clean plugins (because I'm a programmer) {{{ + augroup vimrc-plugins + autocmd! + autocmd VimEnter * + \ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) + \| PlugInstall --sync | q + \| endif + augroup END +" " }}} From a4eede589b22ba85e61224c1ca13c05c3ce5520e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 18 May 2019 11:23:30 +0300 Subject: [PATCH 119/713] [nvim] use :write instead of :update --- nvim/lib/editing.vim | 3 --- nvim/lib/files.vim | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/nvim/lib/editing.vim b/nvim/lib/editing.vim index f819f8b..a44d01b 100644 --- a/nvim/lib/editing.vim +++ b/nvim/lib/editing.vim @@ -61,9 +61,6 @@ set foldmethod=marker " Mappings {{{ - " arguably one of the most useful mappings - nnoremap &buftype is# '' ? ":update\" : "\" - " stay in the Visual mode when using shift commands xnoremap < >gv diff --git a/nvim/lib/files.vim b/nvim/lib/files.vim index 3be8713..63d5bbf 100644 --- a/nvim/lib/files.vim +++ b/nvim/lib/files.vim @@ -3,6 +3,10 @@ set fileformats=unix,dos,mac set wildignore+=.git,.svn,.hg,.DS_Store,*~ +" arguably one of the most useful mappings +nnoremap &buftype is# '' ? ":write\" : "\" + + " ripgrep (rg) {{{ if executable('rg') let s:rg_cmd = "rg --hidden --follow" From a93107eb91c8d1619ae1e2ce62c985731226db18 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 18 May 2019 19:24:52 +0300 Subject: [PATCH 120/713] [nvim] fix terminal cursorline --- nvim/lib/terminal.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nvim/lib/terminal.vim b/nvim/lib/terminal.vim index 4942478..233f576 100644 --- a/nvim/lib/terminal.vim +++ b/nvim/lib/terminal.vim @@ -1,4 +1,5 @@ augroup vimrc-terminal autocmd! - autocmd TermOpen * setl nocursorline | IndentLinesDisable + autocmd TermOpen * setlocal nocursorline | IndentLinesDisable + autocmd TermClose * setlocal cursorline augroup END From 25f78fedd349a3d11072e0477f63e630a7fa9c72 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 18 May 2019 19:50:19 +0300 Subject: [PATCH 121/713] [welcome] use Python 3 --- zsh/welcome/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/welcome/main.py b/zsh/welcome/main.py index 58da219..40e9c42 100755 --- a/zsh/welcome/main.py +++ b/zsh/welcome/main.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import re From f46e58fd3a5fd6a03256fd7c42e6f7659f315c84 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 20 May 2019 08:39:00 +0300 Subject: [PATCH 122/713] [zsh] add alias for listing cd directories --- zsh/aliases.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 5e0bf21..73c7c8d 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -5,6 +5,8 @@ alias '$'='' # this alias allows aliases to work with sudo alias sudo='sudo ' +alias cdd='dirs -v' + alias grep='grep --color=auto' # exa is a modern replacement for ls - https://the.exa.website/ @@ -20,6 +22,7 @@ else alias l="${aliases[ls]} -l --human-readable" alias la="${aliases[l]} --almost-all" fi +unalias ll # remove this Oh-My-Zsh alias # fd is a simple, fast and user-friendly alternative to find - https://github.com/sharkdp/fd if command_exists fd; then From 4fb5bc69ffb749874119e91ba59807cfe0b78ee7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 21 May 2019 00:30:50 +0300 Subject: [PATCH 123/713] fix installation script --- install.zsh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/install.zsh b/install.zsh index 35f2d3f..11b5305 100755 --- a/install.zsh +++ b/install.zsh @@ -2,28 +2,25 @@ install_dotfile() { local dest="$1" + local contents="$2" if [[ -f "$dest" ]]; then mv -vi "$dest" "$dest.dmitmel-dotfiles-backup" fi mkdir -p "${dest:h}" - cat > "$dest" + echo "$contents" > "$dest" } # ZSH for zsh_file_name in zshrc; do - install_dotfile "$HOME/.$zsh_file_name" < Date: Wed, 22 May 2019 17:11:02 +0300 Subject: [PATCH 124/713] fix installation script --- install.zsh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/install.zsh b/install.zsh index 11b5305..dab7a5d 100755 --- a/install.zsh +++ b/install.zsh @@ -1,5 +1,7 @@ #!/usr/bin/env zsh +DOTFILES_PATH="${0:a:h}" + install_dotfile() { local dest="$1" local contents="$2" @@ -14,13 +16,11 @@ install_dotfile() { # ZSH for zsh_file_name in zshrc; do - install_dotfile "$HOME/.$zsh_file_name" ' -#!/usr/bin/env zsh -source "$PWD/zsh/$zsh_file_name" -' + zsh_file_path="$DOTFILES_PATH/zsh/$zsh_file_name" + install_dotfile "$HOME/.$zsh_file_name" "source ${(q)zsh_file_path}" done -unset zsh_file_name +unset zsh_file_name zsh_file_path # Neovim -install_dotfile ~/.config/nvim/init.vim 'source $PWD/nvim/init.vim' -install_dotfile ~/.config/nvim/ginit.vim 'source $PWD/nvim/ginit.vim' +install_dotfile ~/.config/nvim/init.vim "source $DOTFILES_PATH/nvim/init.vim" +install_dotfile ~/.config/nvim/ginit.vim "source $DOTFILES_PATH/nvim/ginit.vim" From ca7630a7d303a414f789e205e0c023bf1742851a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 25 May 2019 19:06:21 +0300 Subject: [PATCH 125/713] [welcome] add Manjaro logo --- zsh/welcome/logos/manjaro | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 zsh/welcome/logos/manjaro diff --git a/zsh/welcome/logos/manjaro b/zsh/welcome/logos/manjaro new file mode 100644 index 0000000..1e0715e --- /dev/null +++ b/zsh/welcome/logos/manjaro @@ -0,0 +1,14 @@ +{2}################## ######## +{2}################## ######## +{2}################## ######## +{2}################## ######## +{2}######## ######## +{2}######## ######## ######## +{2}######## ######## ######## +{2}######## ######## ######## +{2}######## ######## ######## +{2}######## ######## ######## +{2}######## ######## ######## +{2}######## ######## ######## +{2}######## ######## ######## +{2}######## ######## ######## From 2caaa42759245e1f54ed2f66ee6e25ad2b22cc14 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 26 May 2019 01:31:54 +0300 Subject: [PATCH 126/713] update description --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 974ef3a..556b9dd 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # dotfiles -My dotfiles for Mac OS X, Ubuntu and Raspbian. +My dotfiles for macOS, Ubuntu, Linux Mint, Manjaro and Raspbian From ef5f4042e1f7a40c0201f3d1c50d44ece5626e37 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 26 May 2019 12:02:42 +0300 Subject: [PATCH 127/713] [zsh] remove Oh-My-Zsh correction aliases --- zsh/aliases.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 73c7c8d..0d23670 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,5 +1,10 @@ #!/usr/bin/env zsh +# remove Oh-My-Zsh correction aliases +for cmd in cp ebuild gist heroku hpodder man mkdir mv mysql sudo; do + unalias $cmd +done + # this alias removes leading dollar sign (useful when copying code from Stackoverflow) alias '$'='' # this alias allows aliases to work with sudo From 97afe65b38018d2872841273557e0eeb049d1286 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 29 May 2019 11:36:37 +0300 Subject: [PATCH 128/713] [zsh] add alias with human readable file sizes for free --- zsh/aliases.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 0d23670..3c6416b 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -48,5 +48,6 @@ alias chown='chown -v' # print file sizes in human readable format alias du='du -h' alias df='df -h' +alias free='free -h' alias apt-get="echo -e \"use 'apt' instead of 'apt-get'\nif you really want to use 'apt-get', type '"'\\\\'"apt-get'\" #" From 7b95e10995dd3497385b8f019e23cfdad9264d97 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 2 Jun 2019 15:11:40 +0300 Subject: [PATCH 129/713] add kitty --- hammerspoon/TerminalPalette.lua | 3 +- install.zsh | 18 +- kitty.conf | 895 ++++++++++++++++++++++++++++++++ 3 files changed, 909 insertions(+), 7 deletions(-) create mode 100644 kitty.conf diff --git a/hammerspoon/TerminalPalette.lua b/hammerspoon/TerminalPalette.lua index c797175..2f327d4 100644 --- a/hammerspoon/TerminalPalette.lua +++ b/hammerspoon/TerminalPalette.lua @@ -110,7 +110,8 @@ chooser:rows(9) hs.hotkey.bind({"cmd", "shift"}, "a", function() app = hs.application.frontmostApplication() - if app:name():lower():match("term") then + app_name = app:name():lower() + if app_name:match("term") or app_name:match("kitty") then chooser:show() end end) diff --git a/install.zsh b/install.zsh index dab7a5d..60d9fdf 100755 --- a/install.zsh +++ b/install.zsh @@ -15,12 +15,18 @@ install_dotfile() { } # ZSH -for zsh_file_name in zshrc; do - zsh_file_path="$DOTFILES_PATH/zsh/$zsh_file_name" - install_dotfile "$HOME/.$zsh_file_name" "source ${(q)zsh_file_path}" +for file_name in zshrc; do + file_path="$DOTFILES_PATH/zsh/$file_name" + install_dotfile "$HOME/.$file_name" "source ${(q)file_path}" done -unset zsh_file_name zsh_file_path # Neovim -install_dotfile ~/.config/nvim/init.vim "source $DOTFILES_PATH/nvim/init.vim" -install_dotfile ~/.config/nvim/ginit.vim "source $DOTFILES_PATH/nvim/ginit.vim" +for file_name in {init,ginit}.vim; do + file_path="$DOTFILES_PATH/nvim/$file_name" + install_dotfile "$HOME/.config/nvim/$file_name" "source ${(q)file_path}" +done + +# Kitty +file_name=kitty.conf +file_path="$DOTFILES_PATH/$file_name" +install_dotfile "$HOME/.config/kitty/$file_name" "include ${(q)file_path}" diff --git a/kitty.conf b/kitty.conf new file mode 100644 index 0000000..2cbb415 --- /dev/null +++ b/kitty.conf @@ -0,0 +1,895 @@ +# vim:fileencoding=utf-8:ft=conf:foldmethod=marker + +#: Fonts {{{ + +#: kitty has very powerful font management. You can configure +#: individual font faces and even specify special fonts for particular +#: characters. + +font_family Ubuntu Mono derivative Powerline +# bold_font auto +# italic_font auto +# bold_italic_font auto + +#: You can specify different fonts for the bold/italic/bold-italic +#: variants. By default they are derived automatically, by the OSes +#: font system. Setting them manually is useful for font families that +#: have many weight variants like Book, Medium, Thick, etc. For +#: example:: + +#: font_family Operator Mono Book +#: bold_font Operator Mono Medium +#: italic_font Operator Mono Book Italic +#: bold_italic_font Operator Mono Medium Italic + +font_size 14.0 + +#: Font size (in pts) + +# adjust_line_height 0 +# adjust_column_width 0 + +#: Change the size of each character cell kitty renders. You can use +#: either numbers, which are interpreted as pixels or percentages +#: (number followed by %), which are interpreted as percentages of the +#: unmodified values. You can use negative pixels or percentages less +#: than 100% to reduce sizes (but this might cause rendering +#: artifacts). + +# symbol_map U+E0A0-U+E0A2,U+E0B0-U+E0B3 PowerlineSymbols + +#: Map the specified unicode codepoints to a particular font. Useful +#: if you need special rendering for some symbols, such as for +#: Powerline. Avoids the need for patched fonts. Each unicode code +#: point is specified in the form U+. You +#: can specify multiple code points, separated by commas and ranges +#: separated by hyphens. symbol_map itself can be specified multiple +#: times. Syntax is:: + +#: symbol_map codepoints Font Family Name + +# box_drawing_scale 0.001, 1, 1.5, 2 + +#: Change the sizes of the lines used for the box drawing unicode +#: characters These values are in pts. They will be scaled by the +#: monitor DPI to arrive at a pixel value. There must be four values +#: corresponding to thin, normal, thick, and very thick lines. + +#: }}} + +#: Cursor customization {{{ + +cursor #d3d0c8 + +#: Default cursor color + +cursor_text_color #2d2d2d + +#: Choose the color of text under the cursor. If you want it rendered +#: with the background color of the cell underneath instead, use the +#: special keyword: background + +# cursor_shape block + +#: The cursor shape can be one of (block, beam, underline) + +cursor_blink_interval 0 +cursor_stop_blinking_after 0 + +#: The interval (in seconds) at which to blink the cursor. Set to zero +#: to disable blinking. Note that numbers smaller than repaint_delay +#: will be limited to repaint_delay. Stop blinking cursor after the +#: specified number of seconds of keyboard inactivity. Set to zero to +#: never stop blinking. + +#: }}} + +#: Scrollback {{{ + +# scrollback_lines 2000 + +#: Number of lines of history to keep in memory for scrolling back. +#: Memory is allocated on demand. Negative numbers are (effectively) +#: infinite scrollback. Note that using very large scrollback is not +#: recommended a it can slow down resizing of the terminal and also +#: use large amounts of RAM. + +# scrollback_pager less --chop-long-lines --RAW-CONTROL-CHARS +INPUT_LINE_NUMBER + +#: Program with which to view scrollback in a new window. The +#: scrollback buffer is passed as STDIN to this program. If you change +#: it, make sure the program you use can handle ANSI escape sequences +#: for colors and text formatting. INPUT_LINE_NUMBER in the command +#: line above will be replaced by an integer representing which line +#: should be at the top of the screen. + +# wheel_scroll_multiplier 5.0 + +#: Modify the amount scrolled by the mouse wheel. Note this is only +#: used for low precision scrolling devices, not for high precision +#: scrolling on platforms such as macOS and Wayland. Use negative +#: numbers to change scroll direction. + +#: }}} + +#: Mouse {{{ + +url_color #6699cc +url_style double + +#: The color and style for highlighting URLs on mouse-over. url_style +#: can be one of: none, single, double, curly + +# open_url_modifiers kitty_mod + +#: The modifier keys to press when clicking with the mouse on URLs to +#: open the URL + +# open_url_with default + +#: The program with which to open URLs that are clicked on. The +#: special value default means to use the operating system's default +#: URL handler. + +# copy_on_select no + +#: Copy to clipboard on select. With this enabled, simply selecting +#: text with the mouse will cause the text to be copied to clipboard. +#: Useful on platforms such as macOS/Wayland that do not have the +#: concept of primary selections. Note that this is a security risk, +#: as all programs, including websites open in your browser can read +#: the contents of the clipboard. + +# rectangle_select_modifiers ctrl+alt + +#: The modifiers to use rectangular selection (i.e. to select text in +#: a rectangular block with the mouse) + +# select_by_word_characters :@-./_~?&=%+# + +#: Characters considered part of a word when double clicking. In +#: addition to these characters any character that is marked as an +#: alpha-numeric character in the unicode database will be matched. + +# click_interval 0.5 + +#: The interval between successive clicks to detect double/triple +#: clicks (in seconds) + +mouse_hide_wait 3.0 + +#: Hide mouse cursor after the specified number of seconds of the +#: mouse not being used. Set to zero to disable mouse cursor hiding. + +focus_follows_mouse no + +#: Set the active window to the window under the mouse when moving the +#: mouse around + +#: }}} + +#: Performance tuning {{{ + +# repaint_delay 10 + +#: Delay (in milliseconds) between screen updates. Decreasing it, +#: increases frames-per-second (FPS) at the cost of more CPU usage. +#: The default value yields ~100 FPS which is more than sufficient for +#: most uses. Note that to actually achieve 100 FPS you have to either +#: set sync_to_monitor to no or use a monitor with a high refresh +#: rate. + +# input_delay 3 + +#: Delay (in milliseconds) before input from the program running in +#: the terminal is processed. Note that decreasing it will increase +#: responsiveness, but also increase CPU usage and might cause flicker +#: in full screen programs that redraw the entire screen on each loop, +#: because kitty is so fast that partial screen updates will be drawn. + +sync_to_monitor yes + +#: Sync screen updates to the refresh rate of the monitor. This +#: prevents tearing (https://en.wikipedia.org/wiki/Screen_tearing) +#: when scrolling. However, it limits the rendering speed to the +#: refresh rate of your monitor. With a very high speed mouse/high +#: keyboard repeat rate, you may notice some slight input latency. If +#: so, set this to no. + +#: }}} + +#: Terminal bell {{{ + +# enable_audio_bell yes + +#: Enable/disable the audio bell. Useful in environments that require +#: silence. + +# visual_bell_duration 0.0 + +#: Visual bell duration. Flash the screen when a bell occurs for the +#: specified number of seconds. Set to zero to disable. + +window_alert_on_bell yes + +#: Request window attention on bell. Makes the dock icon bounce on +#: macOS or the taskbar flash on linux. + +bell_on_tab yes + +#: Show a bell symbol on the tab if a bell occurs in one of the +#: windows in the tab and the window is not the currently focused +#: window + +#: }}} + +#: Window layout {{{ + +# remember_window_size yes +# initial_window_width 640 +# initial_window_height 400 + +#: If enabled, the window size will be remembered so that new +#: instances of kitty will have the same size as the previous +#: instance. If disabled, the window will initially have size +#: configured by initial_window_width/height, in pixels. You can use a +#: suffix of "c" on the width/height values to have them interpreted +#: as number of cells instead of pixels. + +# enabled_layouts * + +#: The enabled window layouts. A comma separated list of layout names. +#: The special value all means all layouts. The first listed layout +#: will be used as the startup layout. For a list of available +#: layouts, see the +#: https://sw.kovidgoyal.net/kitty/index.html#layouts. + +# window_resize_step_cells 2 +# window_resize_step_lines 2 + +#: The step size (in units of cell width/cell height) to use when +#: resizing windows. The cells value is used for horizontal resizing +#: and the lines value for vertical resizing. + +# window_border_width 1.0 + +#: The width (in pts) of window borders. Will be rounded to the +#: nearest number of pixels based on screen resolution. Note that +#: borders are displayed only when more than one window is visible. +#: They are meant to separate multiple windows. + +# draw_minimal_borders no + +#: Draw only the minimum borders needed. This means that only the +#: minimum needed borders for inactive windows are drawn. That is only +#: the borders that separate the inactive window from a neighbor. Note +#: that setting a non-zero window margin overrides this and causes all +#: borders to be drawn. + +window_margin_width 0.5 + +#: The window margin (in pts) (blank area outside the border) + +# single_window_margin_width -1000.0 + +#: The window margin (in pts) to use when only a single window is +#: visible. Negative values will cause the value of +#: window_margin_width to be used instead. + +window_padding_width 2.0 + +#: The window padding (in pts) (blank area between the text and the +#: window border) + +active_border_color #99cc99 + +#: The color for the border of the active window + +inactive_border_color #747369 + +#: The color for the border of inactive windows + +bell_border_color #f2777a + +#: The color for the border of inactive windows in which a bell has +#: occurred + +inactive_text_alpha 0.5 + +#: Fade the text in inactive windows by the specified amount (a number +#: between zero and one, with zero being fully faded). + +#: }}} + +#: Tab bar {{{ + +tab_bar_edge top + +#: Which edge to show the tab bar on, top or bottom + +# tab_bar_margin_width 0.0 + +#: The margin to the left and right of the tab bar (in pts) + +tab_bar_style separator + +#: The tab bar style, can be one of: fade or separator. In the fade +#: style, each tab's edges fade into the background color, in the +#: separator style, tabs are separated by a configurable separator. + +# tab_fade 0.25 0.5 0.75 1 + +#: Control how each tab fades into the background when using fade for +#: the tab_bar_style. Each number is an alpha (between zero and one) +#: that controls how much the corresponding cell fades into the +#: background, with zero being no fade and one being full fade. You +#: can change the number of cells used by adding/removing entries to +#: this list. + +tab_separator " │ " + +#: The separator between tabs in the tab bar when using separator as +#: the tab_bar_style. + +# active_tab_foreground #000 +# active_tab_background #eee +active_tab_font_style bold +# inactive_tab_foreground #444 +# inactive_tab_background #999 +inactive_tab_font_style italic + +#: Tab bar colors and styles + +#: }}} + +#: Color scheme {{{ + +foreground #d3d0c8 +background #2d2d2d + +#: The foreground and background colors + +# background_opacity 1.0 +# dynamic_background_opacity no + +#: The opacity of the background. A number between 0 and 1, where 1 is +#: opaque and 0 is fully transparent. This will only work if +#: supported by the OS (for instance, when using a compositor under +#: X11). Note that it only sets the default background color's +#: opacity. This is so that things like the status bar in vim, +#: powerline prompts, etc. still look good. But it means that if you +#: use a color theme with a background color in your editor, it will +#: not be rendered as transparent. Instead you should change the +#: default background color in your kitty config and not use a +#: background color in the editor color scheme. Or use the escape +#: codes to set the terminals default colors in a shell script to +#: launch your editor. Be aware that using a value less than 1.0 is a +#: (possibly significant) performance hit. If you want to dynamically +#: change transparency of windows set dynamic_background_opacity to +#: yes (this is off by default as it has a performance cost) + +# dim_opacity 0.75 + +#: How much to dim text that has the DIM/FAINT attribute set. One +#: means no dimming and zero means fully dimmed (i.e. invisible). + +selection_foreground #d3d0c8 +selection_background #515151 + +#: The foreground and background for text selected with the mouse + + +#: The 16 terminal colors. There are 8 basic colors, each color has a +#: dull and bright version. You can also set the remaining colors from +#: the 256 color table as color16 to color255. + +color0 #2d2d2d +color8 #747369 + +#: black + +color1 #f2777a +color9 #f2777a + +#: red + +color2 #99cc99 +color10 #99cc99 + +#: green + +color3 #ffcc66 +color11 #ffcc66 + +#: yellow + +color4 #6699cc +color12 #6699cc + +#: blue + +color5 #cc99cc +color13 #cc99cc + +#: magenta + +color6 #66cccc +color14 #66cccc + +#: cyan + +color7 #d3d0c8 +color15 #f2f0ec + +#: white + +#: }}} + +#: Advanced {{{ + +shell zsh --login + +#: The shell program to execute. The default value of . means to use +#: whatever shell is set as the default shell for the current user. +#: Note that on macOS if you change this, you might need to add +#: --login to ensure that the shell starts in interactive mode and +#: reads its startup rc files. + +editor /usr/local/bin/nvim + +#: The console editor to use when editing the kitty config file or +#: similar tasks. A value of . means to use the environment variable +#: EDITOR. Note that this environment variable has to be set not just +#: in your shell startup scripts but system-wide, otherwise kitty will +#: not see it. + +# close_on_child_death no + +#: Close the window when the child process (shell) exits. If no (the +#: default), the terminal will remain open when the child exits as +#: long as there are still processes outputting to the terminal (for +#: example disowned or backgrounded processes). If yes, the window +#: will close as soon as the child process exits. Note that setting it +#: to yes means that any background processes still using the terminal +#: can fail silently because their stdout/stderr/stdin no longer work. + +# allow_remote_control no + +#: Allow other programs to control kitty. If you turn this on other +#: programs can control all aspects of kitty, including sending text +#: to kitty windows, opening new windows, closing windows, reading the +#: content of windows, etc. Note that this even works over ssh +#: connections. + +# env + +#: Specify environment variables to set in all child processes. Note +#: that environment variables are expanded recursively, so if you +#: use:: + +#: env MYVAR1=a +#: env MYVAR2=${MYVAR}/${HOME}/b + +#: The value of MYVAR2 will be a//b. + +# startup_session none + +#: Path to a session file to use for all kitty instances. Can be +#: overridden by using the kitty --session command line option for +#: individual instances. See +#: https://sw.kovidgoyal.net/kitty/index.html#sessions in the kitty +#: documentation for details. Note that relative paths are interpreted +#: with respect to the kitty config directory. Environment variables +#: in the path are expanded. + +# clipboard_control write-clipboard write-primary + +#: Allow programs running in kitty to read and write from the +#: clipboard. You can control exactly which actions are allowed. The +#: set of possible actions is: write-clipboard read-clipboard write- +#: primary read-primary The default is to allow writing to the +#: clipboard and primary selection. Note that enabling the read +#: functionality is a security risk as it means that any program, even +#: one running on a remote server via SSH can read your clipboard. + +# term xterm-kitty +term xterm-256color + +#: The value of the TERM environment variable to set. Changing this +#: can break many terminal programs, only change it if you know what +#: you are doing, not because you read some advice on Stack Overflow +#: to change it. The TERM variable if used by various programs to get +#: information about the capabilities and behavior of the terminal. If +#: you change it, depending on what programs you run, and how +#: different the terminal you are changing it to is, various things +#: from key-presses, to colors, to various advanced features may not +#: work. + +#: }}} + +#: OS specific tweaks {{{ + +# macos_titlebar_color system + +#: Change the color of the kitty window's titlebar on macOS. A value +#: of system means to use the default system color, a value of +#: background means to use the background color of the currently +#: active window and finally you can use an arbitrary color, such as +#: #12af59 or red. WARNING: This option works by using a hack, as +#: there is no proper Cocoa API for it. It sets the background color +#: of the entire window and makes the titlebar transparent. As such it +#: is incompatible with background_opacity. If you want to use both, +#: you are probably better off just hiding the titlebar with +#: macos_hide_titlebar. + +# macos_hide_titlebar no + +#: Hide the kitty window's title bar on macOS. + +# x11_hide_window_decorations no + +#: Hide the window decorations (title bar and window borders) on X11 +#: and Wayland. Whether this works and exactly what effect it has +#: depends on the window manager, as it is the job of the window +#: manager/compositor to draw window decorations. + +macos_option_as_alt yes + +#: Use the option key as an alt key. With this set to no, kitty will +#: use the macOS native Option+Key = unicode character behavior. This +#: will break any Alt+key keyboard shortcuts in your terminal +#: programs, but you can use the macOS unicode input technique. + +# macos_hide_from_tasks no + +#: Hide the kitty window from running tasks (Option+Tab) on macOS. + +# macos_quit_when_last_window_closed no + +#: Have kitty quit when all the top-level windows are closed. By +#: default, kitty will stay running, even with no open windows, as is +#: the expected behavior on macOS. + +# macos_window_resizable yes + +#: Disable this if you want kitty top-level (OS) windows to not be +#: resizable on macOS. + +# macos_thicken_font 0 + +#: Draw an extra border around the font with the given width, to +#: increase legibility at small font sizes. For example, a value of +#: 0.75 will result in rendering that looks similar to sub-pixel +#: antialiasing at common font sizes. + +# macos_traditional_fullscreen no + +#: Use the traditional full-screen transition, that is faster, but +#: less pretty. + +macos_custom_beam_cursor yes + +#: Enable/disable custom mouse cursor for macOS that is easier to see +#: on both light and dark backgrounds. WARNING: this might make your +#: mouse cursor invisible on dual GPU machines. + +#: }}} + +#: Keyboard shortcuts {{{ + +#: For a list of key names, see: GLFW keys +#: . The name to use +#: is the part after the GLFW_KEY_ prefix. For a list of modifier +#: names, see: GLFW mods +#: + +#: On Linux you can also use XKB key names to bind keys that are not +#: supported by GLFW. See XKB keys +#: +#: for a list of key names. The name to use is the part after the XKB_KEY_ +#: prefix. Note that you should only use an XKB key name for keys that are not +#: present in the list of GLFW keys. + +#: Finally, you can use raw system key codes to map keys. To see the +#: system key code for a key, start kitty with the kitty --debug- +#: keyboard option. Then kitty will output some debug text for every +#: key event. In that text look for ``native_code`` the value of that +#: becomes the key name in the shortcut. For example: + +#: .. code-block:: none + +#: on_key_input: glfw key: 65 native_code: 0x61 action: PRESS mods: 0x0 text: 'a' + +#: Here, the key name for the A key is 0x61 and you can use it with:: + +#: map ctrl+0x61 something + +#: to map ctrl+a to something. + +#: You can use the special action no_op to unmap a keyboard shortcut +#: that is assigned in the default configuration. + +#: You can combine multiple actions to be triggered by a single +#: shortcut, using the syntax below:: + +#: map key combine action1 action2 action3 ... + +#: For example:: + +#: map kitty_mod+e combine : new_window : next_layout + +#: this will create a new window and switch to the next available +#: layout + +#: You can use multi-key shortcuts using the syntax shown below:: + +#: map key1>key2>key3 action + +#: For example:: + +#: map ctrl+f>2 set_font_size 20 + +# kitty_mod ctrl+shift + +#: The value of kitty_mod is used as the modifier for all default +#: shortcuts, you can change it in your kitty.conf to change the +#: modifiers for all the default shortcuts. + +# clear_all_shortcuts no + +#: You can have kitty remove all shortcut definition seen up to this +#: point. Useful, for instance, to remove the default shortcuts. + +#: Clipboard {{{ + +# map cmd+c copy_to_clipboard +# map kitty_mod+c copy_to_clipboard +# map cmd+v paste_from_clipboard +# map kitty_mod+v paste_from_clipboard +# map kitty_mod+s paste_from_selection +# map shift+insert paste_from_selection +# map kitty_mod+o pass_selection_to_program + +#: You can also pass the contents of the current selection to any +#: program using pass_selection_to_program. By default, the system's +#: open program is used, but you can specify your own, for example:: + +#: map kitty_mod+o pass_selection_to_program firefox + +#: You can pass the current selection to a terminal program running in +#: a new kitty window, by using the @selection placeholder:: + +#: map kitty_mod+y new_window less @selection + +#: }}} + +#: Scrolling {{{ + +# map kitty_mod+up scroll_line_up +# map kitty_mod+k scroll_line_up +# map kitty_mod+down scroll_line_down +# map kitty_mod+j scroll_line_down +# map kitty_mod+page_up scroll_page_up +# map kitty_mod+page_down scroll_page_down +# map kitty_mod+home scroll_home +# map kitty_mod+end scroll_end +# map kitty_mod+h show_scrollback + +#: You can pipe the contents of the current screen + history buffer as +#: STDIN to an arbitrary program using the ``pipe`` function. For +#: example, the following opens the scrollback buffer in less in an +#: overlay window:: + +#: map f1 pipe @ansi overlay less +G -R + +#: Placeholders available are: @text (which is plain text) and @ansi +#: (which includes text styling escape codes). For only the current +#: screen, use @screen or @ansi_screen. For the secondary screen, use +#: @alternate and @ansi_alternate. The secondary screen is the screen +#: not currently displayed. For example if you run a fullscreen +#: terminal application, the secondary screen will be the screen you +#: return to when quitting the application. You can also use ``none`` +#: for no STDIN input. + +#: To open in a new window, tab or new OS window, use ``window``, +#: ``tab``, or ``os_window`` respectively. You can also use ``none`` +#: in which case the data will be piped into the program without +#: creating any windows, useful if the program is a GUI program that +#: creates its own windows. + +#: }}} + +#: Window management {{{ + +# map kitty_mod+enter new_window + +#: You can open a new window running an arbitrary program, for +#: example:: + +#: map kitty_mod+y new_window mutt + +#: You can open a new window with the current working directory set to +#: the working directory of the current window using:: + +#: map ctrl+alt+enter new_window_with_cwd + +#: You can open a new window that is allowed to control kitty via the +#: kitty remote control facility by prefixing the command line with @. +#: Any programs running in that window will be allowed to control +#: kitty. For example:: + +#: map ctrl+enter new_window @ some_program + +# map cmd+n new_os_window +# map kitty_mod+n new_os_window +# map kitty_mod+w close_window +# map kitty_mod+] next_window +# map kitty_mod+[ previous_window +# map kitty_mod+f move_window_forward +# map kitty_mod+b move_window_backward +# map kitty_mod+` move_window_to_top +# map kitty_mod+r start_resizing_window +# map kitty_mod+1 first_window +# map kitty_mod+2 second_window +# map kitty_mod+3 third_window +# map kitty_mod+4 fourth_window +# map kitty_mod+5 fifth_window +# map kitty_mod+6 sixth_window +# map kitty_mod+7 seventh_window +# map kitty_mod+8 eighth_window +# map kitty_mod+9 ninth_window +# map kitty_mod+0 tenth_window +#: }}} + +#: Tab management {{{ + +# map ctrl+tab next_tab +# map kitty_mod+right next_tab +# map ctrl+shift+tab previous_tab +# map kitty_mod+left previous_tab +# map kitty_mod+t new_tab +# map kitty_mod+q close_tab +# map kitty_mod+. move_tab_forward +# map kitty_mod+, move_tab_backward +# map kitty_mod+alt+t set_tab_title + +#: You can also create shortcuts to go to specific tabs, with 1 being +#: the first tab:: + +#: map ctrl+alt+1 goto_tab 1 +#: map ctrl+alt+2 goto_tab 2 + +#: Just as with new_window above, you can also pass the name of +#: arbitrary commands to run when using new_tab and use +#: new_tab_with_cwd. Finally, if you want the new tab to open next to +#: the current tab rather than at the end of the tabs list, use:: + +#: map ctrl+t new_tab !neighbor [optional cmd to run] +#: }}} + +#: Layout management {{{ + +# map kitty_mod+l next_layout + +#: You can also create shortcuts to switch to specific layouts:: + +#: map ctrl+alt+t goto_layout tall +#: map ctrl+alt+s goto_layout stack + +#: Similarly, to switch back to the previous layout:: + +#: map ctrl+alt+p last_used_layout +#: }}} + +#: Font sizes {{{ + +#: You can change the font size for all top-level kitty windows at a +#: time or only the current one. + +# map kitty_mod+equal change_font_size all +2.0 +# map kitty_mod+minus change_font_size all -2.0 +# map kitty_mod+backspace change_font_size all 0 + +#: To setup shortcuts for specific font sizes:: + +#: map kitty_mod+f6 change_font_size all 10.0 + +#: To setup shortcuts to change only the current window's font size:: + +#: map kitty_mod+f6 change_font_size current 10.0 +#: }}} + +#: Select and act on visible text {{{ + +#: Use the hints kitten to select text and either pass it to an +#: external program or insert it into the terminal or copy it to the +#: clipboard. + +# map kitty_mod+e kitten hints + +#: Open a currently visible URL using the keyboard. The program used +#: to open the URL is specified in open_url_with. + +# map kitty_mod+p>f kitten hints --type path --program - + +#: Select a path/filename and insert it into the terminal. Useful, for +#: instance to run git commands on a filename output from a previous +#: git command. + +# map kitty_mod+p>shift+f kitten hints --type path + +#: Select a path/filename and open it with the default open program. + +# map kitty_mod+p>l kitten hints --type line --program - + +#: Select a line of text and insert it into the terminal. Use for the +#: output of things like: ls -1 + +# map kitty_mod+p>w kitten hints --type word --program - + +#: Select words and insert into terminal. + +# map kitty_mod+p>h kitten hints --type hash --program - + +#: Select something that looks like a hash and insert it into the +#: terminal. Useful with git, which uses sha1 hashes to identify +#: commits + + +#: The hints kitten has many more modes of operation that you can map +#: to different shortcuts. For a full description see kittens/hints. +#: }}} + +#: Miscellaneous {{{ + +# map kitty_mod+f11 toggle_fullscreen +# map kitty_mod+u kitten unicode_input +# map kitty_mod+f2 edit_config_file +# map kitty_mod+escape kitty_shell window + +#: Open the kitty shell in a new window/tab/overlay/os_window to +#: control kitty using commands. + +# map kitty_mod+a>m set_background_opacity +0.1 +# map kitty_mod+a>l set_background_opacity -0.1 +# map kitty_mod+a>1 set_background_opacity 1 +# map kitty_mod+a>d set_background_opacity default +# map kitty_mod+delete clear_terminal reset active + +#: You can create shortcuts to clear/reset the terminal. For example:: + +#: map kitty_mod+f9 clear_terminal reset active +#: map kitty_mod+f10 clear_terminal clear active +#: map kitty_mod+f11 clear_terminal scrollback active + +#: These will reset screen/clear screen/clear screen+scrollback +#: respectively. If you want to operate on all windows instead of just +#: the current one, use all instead of :italic`active`. + + +#: You can tell kitty to send arbitrary (UTF-8) encoded text to the +#: client program when pressing specified shortcut keys. For example:: + +#: map ctrl+alt+a send_text all Special text + +#: This will send "Special text" when you press the ctrl+alt+a key +#: combination. The text to be sent is a python string literal so you +#: can use escapes like \x1b to send control codes or \u21fb to send +#: unicode characters (or you can just input the unicode characters +#: directly as UTF-8 text). The first argument to send_text is the +#: keyboard modes in which to activate the shortcut. The possible +#: values are normal or application or kitty or a comma separated +#: combination of them. The special keyword all means all modes. The +#: modes normal and application refer to the DECCKM cursor key mode +#: for terminals, and kitty refers to the special kitty extended +#: keyboard protocol. + +#: Another example, that outputs a word and then moves the cursor to +#: the start of the line (same as pressing the Home key):: + +#: map ctrl+alt+a send_text normal Word\x1b[H +#: map ctrl+alt+a send_text application Word\x1bOH + +#: }}} + +# }}} From 540aa9aa9da1c9d367d940df45687d0bb7151914 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 2 Jun 2019 17:05:50 +0300 Subject: [PATCH 130/713] [kitty] tweak shell and editor --- kitty.conf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kitty.conf b/kitty.conf index 2cbb415..679cb9a 100644 --- a/kitty.conf +++ b/kitty.conf @@ -427,7 +427,8 @@ color15 #f2f0ec #: Advanced {{{ -shell zsh --login +# shell sh -c 'exec login -f -p $USER' +# shell zsh --login #: The shell program to execute. The default value of . means to use #: whatever shell is set as the default shell for the current user. @@ -435,7 +436,7 @@ shell zsh --login #: --login to ensure that the shell starts in interactive mode and #: reads its startup rc files. -editor /usr/local/bin/nvim +# editor . #: The console editor to use when editing the kitty config file or #: similar tasks. A value of . means to use the environment variable From 5bce862d863e916523215cc9bbb2c8bb7c2a5645 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 2 Jun 2019 22:47:01 +0300 Subject: [PATCH 131/713] [kitty] add keybindings for switching tabs easily --- kitty.conf | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kitty.conf b/kitty.conf index 679cb9a..a7c30df 100644 --- a/kitty.conf +++ b/kitty.conf @@ -754,6 +754,17 @@ macos_custom_beam_cursor yes # map kitty_mod+, move_tab_backward # map kitty_mod+alt+t set_tab_title +map kitty_mod+1 goto_tab 1 +map kitty_mod+2 goto_tab 2 +map kitty_mod+3 goto_tab 3 +map kitty_mod+4 goto_tab 4 +map kitty_mod+5 goto_tab 5 +map kitty_mod+6 goto_tab 6 +map kitty_mod+7 goto_tab 7 +map kitty_mod+8 goto_tab 8 +map kitty_mod+9 goto_tab 9 +map kitty_mod+0 goto_tab 10 + #: You can also create shortcuts to go to specific tabs, with 1 being #: the first tab:: From 1bb21839bee0e5dc046756538a28302a0e9cc3ed Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 9 Jun 2019 19:04:17 +0300 Subject: [PATCH 132/713] add kitty patcher --- install.zsh | 2 +- kitty/.gitignore | 1 + kitty/install.sh | 63 ++++++++++++++++++++++++++++++++++ kitty.conf => kitty/kitty.conf | 2 ++ kitty/patches/tab_title.patch | 57 ++++++++++++++++++++++++++++++ 5 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 kitty/.gitignore create mode 100755 kitty/install.sh rename kitty.conf => kitty/kitty.conf (99%) create mode 100644 kitty/patches/tab_title.patch diff --git a/install.zsh b/install.zsh index 60d9fdf..529880c 100755 --- a/install.zsh +++ b/install.zsh @@ -28,5 +28,5 @@ done # Kitty file_name=kitty.conf -file_path="$DOTFILES_PATH/$file_name" +file_path="$DOTFILES_PATH/kitty/$file_name" install_dotfile "$HOME/.config/kitty/$file_name" "include ${(q)file_path}" diff --git a/kitty/.gitignore b/kitty/.gitignore new file mode 100644 index 0000000..a57582c --- /dev/null +++ b/kitty/.gitignore @@ -0,0 +1 @@ +/src diff --git a/kitty/install.sh b/kitty/install.sh new file mode 100755 index 0000000..93622a2 --- /dev/null +++ b/kitty/install.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +set -e +shopt -s nullglob + +cd "$(dirname "$0")" + +ansi_reset="$(tput sgr0)" +ansi_bold="$(tput bold)" +ansi_rev="$(tput rev)" +log() { + echo >&2 "${ansi_bold}${ansi_rev}[$0]${ansi_reset}" "$@" +} + +mkdir -p src +cd src + +log "fetching release information" +eval "$( + curl --show-error --fail https://api.github.com/repos/kovidgoyal/kitty/releases/latest | + jq --raw-output ' + "release_version=" + (.name | sub("^version "; "") | @sh) + "\n" + ( + .assets | map(select(.label == "Source code")) | first | + "release_src_filename=" + (.name | @sh) + "\n" + + "release_src_url=" + (.browser_download_url | @sh) + ) + ' +)" +if [ -z "$release_version" ]; then + log "couldn't parse response from GitHub API" + exit 1 +fi +log "the latest version is $release_version" + +if [ ! -f "$release_src_filename" ]; then + log "downloading $release_src_filename from $release_src_url" + curl --show-error --fail --location "$release_src_url" -o "$release_src_filename" +else + log "$release_src_filename had already downloaded" +fi + +release_src_dir="${release_src_filename%.tar.xz}" +if [ -d "$release_src_dir" ]; then + log "clearing previous source code directory" + rm -r "$release_src_dir" +fi + +log "unpacking source code archive to src/$release_src_dir" +tar --xz -xf "$release_src_filename" +cd "$release_src_dir" + +log "patching" +for patch in ../../patches/*.patch; do + log "applying patch $patch" + patch --unified --strip 0 < "$patch" +done + +log "compiling" +case "$OSTYPE" in + darwin*) make app ;; + linux*) python3 setup.py linux-package ;; + *) log "error: compilation on $OSTYPE is not supported"; exit 1 ;; +esac diff --git a/kitty.conf b/kitty/kitty.conf similarity index 99% rename from kitty.conf rename to kitty/kitty.conf index a7c30df..666d1d9 100644 --- a/kitty.conf +++ b/kitty/kitty.conf @@ -331,6 +331,8 @@ tab_separator " │ " #: The separator between tabs in the tab bar when using separator as #: the tab_bar_style. +tab_bar_min_tabs 1 + # active_tab_foreground #000 # active_tab_background #eee active_tab_font_style bold diff --git a/kitty/patches/tab_title.patch b/kitty/patches/tab_title.patch new file mode 100644 index 0000000..6efa78f --- /dev/null +++ b/kitty/patches/tab_title.patch @@ -0,0 +1,57 @@ +--- kitty/tab_bar.py 2019-06-09 11:10:02.000000000 +0300 ++++ kitty/tab_bar.py 2019-06-09 17:50:11.605996845 +0300 +@@ -25,7 +25,7 @@ + return (x << 8) | 2 + + +-def draw_title(draw_data, screen, tab, index): ++def draw_title(draw_data, screen, tab, index, max_title_text_length): + if tab.needs_attention and draw_data.bell_on_tab: + fg = screen.cursor.fg + screen.cursor.fg = draw_data.bell_fg +@@ -38,19 +38,20 @@ + draw_title.template_failure_reported = True + log_error('Invalid tab title template: "{}" with error: {}'.format(draw_data.title_template, e)) + title = tab.title ++ extra = len(title) - max_title_text_length ++ if extra > 0: ++ title = '…' + title[1 + extra:] + screen.draw(title) ++ return extra + + + def draw_tab_with_separator(draw_data, screen, tab, before, max_title_length, index): + if draw_data.leading_spaces: + screen.draw(' ' * draw_data.leading_spaces) +- draw_title(draw_data, screen, tab, index) ++ max_title_text_length = max_title_length - draw_data.leading_spaces - draw_data.trailing_spaces ++ draw_title(draw_data, screen, tab, index, max_title_text_length) + trailing_spaces = min(max_title_length - 1, draw_data.trailing_spaces) + max_title_length -= trailing_spaces +- extra = screen.cursor.x - before - max_title_length +- if extra > 0: +- screen.cursor.x -= extra + 1 +- screen.draw('…') + if trailing_spaces: + screen.draw(' ' * trailing_spaces) + end = screen.cursor.x +@@ -66,15 +67,12 @@ + for bg in fade_colors: + screen.cursor.bg = bg + screen.draw(' ') +- draw_title(draw_data, screen, tab, index) +- extra = screen.cursor.x - before - max_title_length ++ max_title_text_length = max_title_length - len(fade_colors) * 2 ++ extra = draw_title(draw_data, screen, tab, index, max_title_text_length) + if extra > 0: + screen.cursor.x = before +- draw_title(draw_data, screen, tab, index) +- extra = screen.cursor.x - before - max_title_length +- if extra > 0: +- screen.cursor.x -= extra + 1 +- screen.draw('…') ++ max_title_text_length = max_title_length ++ extra = draw_title(draw_data, screen, tab, index, max_title_text_length) + for bg in reversed(fade_colors): + if extra >= 0: + break From edf166391bfbcfd85baf7b5fde366a54d13439b2 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 15 Jun 2019 16:39:07 +0300 Subject: [PATCH 133/713] [zsh] add colordiff alternative --- zsh/aliases.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 3c6416b..859cce5 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -14,6 +14,10 @@ alias cdd='dirs -v' alias grep='grep --color=auto' +if ! command_exists colordiff; then + alias colordiff='diff --color' +fi + # exa is a modern replacement for ls - https://the.exa.website/ if command_exists exa; then alias ls="exa --classify --group-directories-first" From 3de164b9d1ae8c5d8686b583d4ee665eb7ca552c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 21 Jun 2019 02:27:47 +0300 Subject: [PATCH 134/713] [nvim] add IDE mode switch --- nvim/init.vim | 2 ++ nvim/lib/completion.vim | 7 +++++++ nvim/lib/files.vim | 2 +- nvim/lib/languages/c.vim | 2 ++ nvim/lib/languages/css.vim | 2 ++ nvim/lib/languages/haskell.vim | 10 ++++++---- nvim/lib/languages/html.vim | 2 ++ nvim/lib/languages/javascript.vim | 6 ++++++ nvim/lib/languages/json.vim | 8 +++++--- nvim/lib/languages/markdown.vim | 6 ++++-- nvim/lib/languages/python.vim | 16 +++++++++------- nvim/lib/languages/rust.vim | 10 ++++++---- nvim/lib/languages/text.vim | 2 ++ nvim/lib/languages/yaml.vim | 2 ++ nvim/lib/plugins.vim | 18 +++++++++++------- 15 files changed, 67 insertions(+), 28 deletions(-) diff --git a/nvim/init.vim b/nvim/init.vim index 1d52894..2a549bb 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,5 +1,7 @@ let s:my_config_dir = expand(':p:h') +let g:vim_ide = get(g:, 'vim_ide', 0) + for s:name in ['plugins', 'editing', 'interface', 'colorscheme', 'files', 'completion', 'terminal', 'git'] execute 'source' fnameescape(s:my_config_dir.'/lib/'.s:name.'.vim') endfor diff --git a/nvim/lib/completion.vim b/nvim/lib/completion.vim index bfaeedf..8b1b668 100644 --- a/nvim/lib/completion.vim +++ b/nvim/lib/completion.vim @@ -5,6 +5,13 @@ imap pumvisible() ? "\" : "\" " }}} +if !g:vim_ide + function IsCocEnabled() + return 0 + endfunction + finish +endif + " coc.nvim {{{ " list of filetypes (that are added in language-specific scripts) for which " coc mappings are enabled diff --git a/nvim/lib/files.vim b/nvim/lib/files.vim index 63d5bbf..25cc782 100644 --- a/nvim/lib/files.vim +++ b/nvim/lib/files.vim @@ -123,7 +123,7 @@ nnoremap &buftype is# '' ? ":write\" : "\" " auto-format with Coc.nvim {{{ let g:coc_format_on_save_ignore = [] function s:FormatOnSave() - if index(g:coc_format_on_save_ignore, &filetype) < 0 && IsCocEnabled() + if IsCocEnabled() && index(g:coc_format_on_save_ignore, &filetype) < 0 silent CocFormat endif endfunction diff --git a/nvim/lib/languages/c.vim b/nvim/lib/languages/c.vim index 50d02bc..1652882 100644 --- a/nvim/lib/languages/c.vim +++ b/nvim/lib/languages/c.vim @@ -1,3 +1,5 @@ +if !g:vim_ide | finish | endif + let s:filetypes = ['c', 'cpp', 'objc', 'objcpp'] let g:coc_filetypes += s:filetypes diff --git a/nvim/lib/languages/css.vim b/nvim/lib/languages/css.vim index ed36b79..12bbfe5 100644 --- a/nvim/lib/languages/css.vim +++ b/nvim/lib/languages/css.vim @@ -1,2 +1,4 @@ +if !g:vim_ide | finish | endif + call coc#add_extension('coc-css') let g:coc_filetypes += ['css'] diff --git a/nvim/lib/languages/haskell.vim b/nvim/lib/languages/haskell.vim index 6d11c2b..5fbfe33 100644 --- a/nvim/lib/languages/haskell.vim +++ b/nvim/lib/languages/haskell.vim @@ -1,3 +1,9 @@ +let g:haskell_conceal = 0 +let g:haskell_conceal_enumerations = 0 +let g:haskell_multiline_strings = 1 + +if !g:vim_ide | finish | endif + let s:filetypes = ['haskell', 'lhaskell', 'chaskell'] let g:coc_filetypes += s:filetypes call coc#config('languageserver.haskell', { @@ -6,7 +12,3 @@ call coc#config('languageserver.haskell', { \ 'rootPatterns': ['.stack.yaml', 'cabal.config', 'package.yaml'], \ 'initializationOptions': {}, \ }) - -let g:haskell_conceal = 0 -let g:haskell_conceal_enumerations = 0 -let g:haskell_multiline_strings = 1 diff --git a/nvim/lib/languages/html.vim b/nvim/lib/languages/html.vim index 612be25..c6bbf8b 100644 --- a/nvim/lib/languages/html.vim +++ b/nvim/lib/languages/html.vim @@ -1,2 +1,4 @@ +if !g:vim_ide | finish | endif + call coc#add_extension('coc-html', 'coc-emmet') let g:coc_filetypes += ['html'] diff --git a/nvim/lib/languages/javascript.vim b/nvim/lib/languages/javascript.vim index 7b9497e..d44f7d8 100644 --- a/nvim/lib/languages/javascript.vim +++ b/nvim/lib/languages/javascript.vim @@ -1,3 +1,9 @@ +augroup vimrc-javascript + autocmd FileType javascript setlocal matchpairs-=<:> +augroup END + +if !g:vim_ide | finish | endif + call coc#add_extension('coc-tsserver', 'coc-eslint', 'coc-prettier') let g:coc_filetypes += ['javascript', 'javascript.jsx', 'typescript', 'typescript.jsx'] call coc#config('eslint', { diff --git a/nvim/lib/languages/json.vim b/nvim/lib/languages/json.vim index a9d8047..1221f66 100644 --- a/nvim/lib/languages/json.vim +++ b/nvim/lib/languages/json.vim @@ -1,7 +1,9 @@ -call coc#add_extension('coc-json') -let g:coc_filetypes += ['json'] - augroup vimrc-languages-json autocmd! autocmd FileType json syntax match Comment +\/\/.\+$+ augroup END + +if !g:vim_ide | finish | endif + +call coc#add_extension('coc-json') +let g:coc_filetypes += ['json'] diff --git a/nvim/lib/languages/markdown.vim b/nvim/lib/languages/markdown.vim index a27e1f9..83878f6 100644 --- a/nvim/lib/languages/markdown.vim +++ b/nvim/lib/languages/markdown.vim @@ -1,5 +1,3 @@ -let g:coc_filetypes += ['markdown'] - let g:vim_markdown_conceal = 0 let g:vim_markdown_conceal_code_blocks = 0 @@ -7,3 +5,7 @@ augroup vimrc-languages-markdown autocmd! autocmd FileType markdown call pencil#init() augroup END + +if !g:vim_ide | finish | endif + +let g:coc_filetypes += ['markdown'] diff --git a/nvim/lib/languages/python.vim b/nvim/lib/languages/python.vim index 4727edd..059f625 100644 --- a/nvim/lib/languages/python.vim +++ b/nvim/lib/languages/python.vim @@ -1,3 +1,12 @@ +augroup vimrc-language-python + autocmd! + autocmd FileType python Indent 4 +augroup END + +let g:python_highlight_all = 1 + +if !g:vim_ide | finish | endif + call coc#add_extension('coc-python') let g:coc_filetypes += ['python'] call coc#config('pyls.plugins.pycodestyle.ignore', ['E501']) @@ -10,10 +19,3 @@ call coc#config('python', { \ 'flake8Args': ['--ignore', 'E501'], \ }, \ }) - -augroup vimrc-language-python - autocmd! - autocmd FileType python Indent 4 -augroup END - -let g:python_highlight_all = 1 diff --git a/nvim/lib/languages/rust.vim b/nvim/lib/languages/rust.vim index fda8d42..8fd67c4 100644 --- a/nvim/lib/languages/rust.vim +++ b/nvim/lib/languages/rust.vim @@ -1,9 +1,11 @@ -call coc#add_extension('coc-rls') -let g:coc_filetypes += ['rust'] -call coc#config('rust', { 'clippy_preference': 'on' }) - let g:rust_recommended_style = 0 augroup vimrc-rust autocmd FileType rust setlocal matchpairs-=<:> augroup END + +if !g:vim_ide | finish | endif + +call coc#add_extension('coc-rls') +let g:coc_filetypes += ['rust'] +call coc#config('rust', { 'clippy_preference': 'on' }) diff --git a/nvim/lib/languages/text.vim b/nvim/lib/languages/text.vim index 6329b94..416f56b 100644 --- a/nvim/lib/languages/text.vim +++ b/nvim/lib/languages/text.vim @@ -2,3 +2,5 @@ augroup vimrc-languages-text autocmd! autocmd FileType text call pencil#init() augroup END + +if !g:vim_ide | finish | endif diff --git a/nvim/lib/languages/yaml.vim b/nvim/lib/languages/yaml.vim index 3c48b35..657a70a 100644 --- a/nvim/lib/languages/yaml.vim +++ b/nvim/lib/languages/yaml.vim @@ -1 +1,3 @@ +if !g:vim_ide | finish | endif + let g:coc_filetypes += ['yaml'] diff --git a/nvim/lib/plugins.vim b/nvim/lib/plugins.vim index f18ec8f..e0538a4 100644 --- a/nvim/lib/plugins.vim +++ b/nvim/lib/plugins.vim @@ -14,7 +14,9 @@ Plug 'junegunn/vim-plug' " Files {{{ Plug 'tpope/vim-eunuch' - Plug 'francoiscabrol/ranger.vim' + if g:vim_ide + Plug 'francoiscabrol/ranger.vim' + endif " }}} " Editing {{{ @@ -27,7 +29,7 @@ Plug 'junegunn/vim-plug' Plug 'Yggdroot/indentLine' Plug 'henrik/vim-indexed-search' Plug 'andymass/vim-matchup' - Plug 'tommcdo/vim-exchange' + " Plug 'tommcdo/vim-exchange' Plug 'inkarkat/vim-ingo-library' " required by LineJuggler Plug 'inkarkat/vim-LineJuggler', { 'branch': 'stable' } Plug 'reedes/vim-pencil' @@ -38,7 +40,6 @@ Plug 'junegunn/vim-plug' Plug 'kana/vim-textobj-entire' Plug 'kana/vim-textobj-line' Plug 'kana/vim-textobj-indent' - " Plug 'kana/vim-textobj-fold' " }}} " UI {{{ @@ -46,10 +47,11 @@ Plug 'junegunn/vim-plug' Plug 'gerw/vim-HiLinkTrace' Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' - Plug 'wincent/terminus' Plug 'tpope/vim-obsession' Plug 'romainl/vim-qf' - Plug 'dyng/ctrlsf.vim' + if g:vim_ide + Plug 'dyng/ctrlsf.vim' + endif " }}} " Git {{{ @@ -65,8 +67,10 @@ Plug 'junegunn/vim-plug' " Programming {{{ Plug 'sheerun/vim-polyglot' - Plug 'neoclide/coc.nvim', { 'do': 'yarn install' } - Plug 'dag/vim2hs' + if g:vim_ide + Plug 'neoclide/coc.nvim', { 'do': 'yarn install' } + Plug 'dag/vim2hs' + endif " }}} call plug#end() From 19c9f665191088ac144432d08aa68cf812a1d676 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 21 Jun 2019 02:28:22 +0300 Subject: [PATCH 135/713] [nvim] adjust title --- nvim/lib/interface.vim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nvim/lib/interface.vim b/nvim/lib/interface.vim index 95049b9..3a4d832 100644 --- a/nvim/lib/interface.vim +++ b/nvim/lib/interface.vim @@ -12,7 +12,9 @@ set belloff= " title {{{ set title -let &titlestring = '%F%{&modified ? g:airline_symbols.modified : ""} (nvim)' +let s:username = $USER +let s:hostname = substitute(hostname(), '\v^([^.]*).*$', '\1', '') " get hostname up to the first '.' +let &titlestring = $USER . '@' . s:hostname . ': %F%{&modified ? g:airline_symbols.modified : ""} (nvim)' " }}} " Yes, I occasionally use mouse. Sometimes it is handy for switching windows/buffers @@ -132,9 +134,9 @@ endif let g:airline_section_{a:section} = g:airline_section_{a:section} . airline#section#create_left([''] + a:items) endfunction function s:tweak_airline() - if exists('*coc#status') - call s:airline_section_prepend('x', ['coc#status']) - endif + " if exists('*coc#status') + " call s:airline_section_prepend('x', ['coc#status']) + " endif call s:airline_section_append('y', ['filesize']) if exists('*airline#extensions#coc#get_error') call s:airline_section_prepend('error', ['coc_error_count']) From 45809040d2134c56e8216c6cb83bbe9373840bd1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 21 Jun 2019 14:55:49 +0300 Subject: [PATCH 136/713] [nvim] add an optional argument for the Open command --- nvim/lib/files.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nvim/lib/files.vim b/nvim/lib/files.vim index 25cc782..a37be01 100644 --- a/nvim/lib/files.vim +++ b/nvim/lib/files.vim @@ -76,7 +76,7 @@ nnoremap &buftype is# '' ? ":write\" : "\" " }}} " Open {{{ - " opens file with a system program + " opens file or URL with a system program function s:Open(path) " HACK: 2nd parameter of this function is called 'remote', it tells " whether to open a remote (1) or local (0) file. However, it doesn't work @@ -88,7 +88,7 @@ nnoremap &buftype is# '' ? ":write\" : "\" " if-statement which contains the 'gf' command. call netrw#BrowseX(a:path, 2) endfunction - command Open call s:Open(expand('%')) + command -nargs=* -complete=file Open call s:Open(empty() ? expand('%') : ) " }}} " }}} From d7d3fb6b08b94ce987d196325a2e5dccc4aecb49 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 21 Jun 2019 16:47:15 +0300 Subject: [PATCH 137/713] [kitty] increase window margin --- kitty/kitty.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kitty/kitty.conf b/kitty/kitty.conf index 666d1d9..2ad21a5 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -266,7 +266,7 @@ bell_on_tab yes #: that setting a non-zero window margin overrides this and causes all #: borders to be drawn. -window_margin_width 0.5 +window_margin_width 1.0 #: The window margin (in pts) (blank area outside the border) From ff92a1ab7af416d26692581bbd5b5fc1a8cb8220 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 27 Jun 2019 14:14:18 +0300 Subject: [PATCH 138/713] [zsh] reinvent the wheel yet again by creating a plugin manager --- zsh/plugins.zsh | 79 +++++--- zsh/zplg.zsh | 492 ++++++++++++++++++++++++++++++++++++++++++++++++ zsh/zshrc | 1 - 3 files changed, 541 insertions(+), 31 deletions(-) create mode 100644 zsh/zplg.zsh diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index b086ff5..1523b78 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -1,31 +1,54 @@ #!/usr/bin/env zsh -configure_oh_my_zsh() { - # disable automatic updates because OMZ is managed by zgen - DISABLE_AUTO_UPDATE="true" +# https://github.com/zdharma/zplugin/blob/master/doc/mod-install.sh +# https://github.com/zdharma/zplugin/blob/master/zmodules/Src/Makefile.in +# https://github.com/zsh-users/zsh/blob/master/Etc/zsh-development-guide + +source "$ZSH_DOTFILES/zplg.zsh" + +plugin completions 'zsh-users/zsh-completions' + +# Oh-My-Zsh {{{ + + # initialize the completion system + autoload -Uz compinit && compinit -C + + ZSH_CACHE_DIR="$ZSH_DOTFILES/cache" + + # disable automatic updates because OMZ is managed by my plugin manager + DISABLE_AUTO_UPDATE=true # use hyphen-insensitive completion (makes `_` and `-` interchangeable) - HYPHEN_INSENSITIVE="true" + HYPHEN_INSENSITIVE=true # enable command auto-correction - ENABLE_CORRECTION="true" + ENABLE_CORRECTION=true # display red dots while waiting for completion - COMPLETION_WAITING_DOTS="true" + COMPLETION_WAITING_DOTS=true # disable marking untracked files under VCS as dirty (this makes repository - # status check for large repositories faster) - DISABLE_UNTRACKED_FILES_DIRTY="true" + # status check for large repositories much faster) + DISABLE_UNTRACKED_FILES_DIRTY=true # command execution time stamp shown in the history - HIST_STAMPS="mm/dd/yyyy" -} + HIST_STAMPS=dd.mm.yyyy -configure_syntax_highlighting() { - FAST_WORK_DIR="$ZSH_DOTFILES/cache" -} + omz_plugins=(git extract fasd) + + plugin oh-my-zsh 'robbyrussell/oh-my-zsh' \ + load='lib/*.zsh' load='plugins/'${^omz_plugins}'/*.plugin.zsh' \ + ignore='lib/(compfix|diagnostics).zsh' \ + before_load='ZSH="$plugin_dir"' \ + after_load='plugin-cfg-path fpath prepend completions functions' \ + after_load='plugin-cfg-path fpath prepend plugins/'${^omz_plugins} + + unset omz_plugins + +# }}} + +# spaceship prompt {{{ -configure_prompt() { SPACESHIP_PROMPT_ADD_NEWLINE=false SPACESHIP_PROMPT_ORDER=( @@ -56,27 +79,23 @@ configure_prompt() { SPACESHIP_DIR_TRUNC_REPO=false SPACESHIP_EXIT_CODE_SHOW=true -} -configure_oh_my_zsh -configure_syntax_highlighting -configure_prompt + plugin spaceship-prompt 'denysdovhan/spaceship-prompt' -source "$ZSH_DOTFILES/zgen/zgen.zsh" +# }}} -if ! zgen saved; then - zgen oh-my-zsh +plugin fzf 'junegunn/fzf' build='./install --bin' \ + after_load='plugin-cfg-path path prepend bin' \ + after_load='plugin-cfg-path manpath prepend man' - zgen oh-my-zsh plugins/git - zgen oh-my-zsh plugins/extract - zgen oh-my-zsh plugins/fasd - is_linux && zgen oh-my-zsh plugins/command-not-found +plugin alias-tips 'djui/alias-tips' - zgen load zdharma/fast-syntax-highlighting +plugin ssh 'zpm-zsh/ssh' - zgen load denysdovhan/spaceship-prompt spaceship +plugin base16-shell 'chriskempson/base16-shell' \ + after_load='export BASE16_SHELL="$plugin_dir"' - zgen load chriskempson/base16-shell +autoload -Uz compinit && compinit -C - zgen save -fi +FAST_WORK_DIR="$ZSH_CACHE_DIR" +plugin fast-syntax-highlighting 'zdharma/fast-syntax-highlighting' diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh new file mode 100644 index 0000000..a9d936c --- /dev/null +++ b/zsh/zplg.zsh @@ -0,0 +1,492 @@ +# This... is my DIY plugin manager for Zsh. "Why did I reinvent the wheel yet +# again and created my own plugin manager?" you might ask. Well, some of them +# are too slow (antigen, zplug), some are too complicated (antigen-hs, zplugin) +# and some are too simple (zgen, antibody). So, I decided to go into into my +# cave for a couple of weeks and now, I proudly present to you MY ZSH PLUGIN +# MANAGER (ZPLG for short). It is very fast even without caching (that's why it +# isn't implemented), has the most essential features and is not bloated. The +# code is rather complex at the first glance because of two reasons: +# +# 1. The syntax of the shell language, to put it simply, utter trash designed +# 40 (!!!) years ago. +# 2. The shell language, especially when it comes to Zsh, is rather slow, so I +# had to use as less abstractions as possible. +# +# But, read my comments and they'll guide you through this jungle of shell +# script mess. + +# Also: +# +# 1. This script is compatitable with SH_WORD_SPLIT (if you for whatever reason +# want to enable this), so I use "@" everywhere. This expansion modifier +# means "put all elements of the array in separate quotes". +# 2. I often use the following snippet to exit functions on errors: +# eval "$some_user_command_that_might_fail" || return "$?" +# I do this instead of `setopt localoptions errexit` because some plugins +# may not be compatitable with ERREXIT. + + +_ZPLG_SCRIPT_PATH="${(%):-%N}" + + +# $ZPLG_HOME is a directory where all your plugins are downloaded, it also +# might contain in the future some kind of state/lock/database files. It is +# recommended to change it before `source`-ing this script for compatitability +# with future versions. +if [[ -z "$ZPLG_HOME" ]]; then + ZPLG_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/zplg" +fi + +# Directory in which plugins are stored. It is separate from $ZPLG_HOME for +# compatitability with future versions. +_ZPLG_PLUGINS_DIR="$ZPLG_HOME/plugins" + +# basic logging {{{ + + _ZPLG_ANSI_BOLD="$(tput bold)" + _ZPLG_ANSI_RED="$(tput setaf 1)" + _ZPLG_ANSI_GREEN="$(tput setaf 2)" + _ZPLG_ANSI_BLUE="$(tput setaf 4)" + _ZPLG_ANSI_RESET="$(tput sgr0)" + + _zplg_log() { + print >&2 "${_ZPLG_ANSI_BLUE}${_ZPLG_ANSI_BOLD}[zplg]${_ZPLG_ANSI_RESET} $@" + } + + _zplg_debug() { + if [[ -n "$ZPLG_DEBUG" ]]; then + _zplg_log "${_ZPLG_ANSI_GREEN}debug:${_ZPLG_ANSI_RESET} $@" + fi + } + + _zplg_error() { + # try to find the place outside of the script that caused this error + local external_caller + local i; for (( i=1; i<=${#funcfiletrace}; i++ )); do + # $funcfiletrace contains file paths and line numbers + if [[ "${funcfiletrace[$i]}" != "$_ZPLG_SCRIPT_PATH"* ]]; then + # $functrace contains "ugly" call sites, the line numbers are + # relative to the beginning of a function/file here. I use it here + # only for consistency with the shell, TODO might change this in the + # future. + _zplg_log "${_ZPLG_ANSI_RED}error:${_ZPLG_ANSI_RESET} ${functrace[$i]}: $@" + return 1 + fi + done + + # if for whatever reason we couldn't find the caller, simply print the + # error without it + _zplg_log "${_ZPLG_ANSI_RED}error:${_ZPLG_ANSI_RESET} $@" + return 1 + } + +# }}} + +# These variables contain essential information about the currently loaded +# plugins. When I say "essential" I mean "required for upgrading, +# reinstallating and uninstalling plugins", so options for configuring loading +# behavior are not stored here. +# +# $ZPLG_LOADED_PLUGINS is an array of plugin IDs, other variables are +# associative arrays that have IDs as their keys. It is implemented this way +# because you can't put associative arrays (or any other alternative to +# "objects") into another associative array. +typeset -a ZPLG_LOADED_PLUGINS +typeset -A ZPLG_LOADED_PLUGIN_URLS ZPLG_LOADED_PLUGIN_SOURCES ZPLG_LOADED_PLUGIN_BUILD_CMDS + +# Takes name of a variable with an array (array is passed by variable name +# because this reduces boilerplate) and runs every command in it, exits +# immediately with an error code if any command fails. This snippet was +# extracted in a function because it's often used to run plugin loading hooks +# (before_load/after_load) or build commands. +_zplg_run_commands() { + local var_name="$1" + # (P) modifier lets you access the variable dynamically by its name stored in + # another variable + local cmd; for cmd in "${(@P)var_name}"; do + eval "$cmd" || return "$?" + done +} + +# Expands a glob pattern with the NULL_GLOB flag from the first argument and +# puts all matched filenames into a variable from the second argument because +# shell functions can't return arrays. This function is needed to simplify +# handling of user-provided glob expressions because I can use LOCAL_OPTIONS +# inside a function which reverts NULL_GLOB to its previous value as soon as +# the function returns. +_zplg_expand_pattern() { + setopt localoptions nullglob + local pattern="$1" out_var_name="$2" + # ${~var_name} turns on globbing for this expansion, note lack of quotes: as + # it turns out glob expansions are automatically quoted by design, and when + # you explicitly write "${~pattern}" it is basically the same as "$pattern" + eval "$out_var_name=(\${~pattern})" +} + +# Wrapper around `source` for simpler profiling and debugging. You can override +# this function to change plugin loading strategy +_zplg_load() { + local script_path="$1" + source "$script_path" +} + +# plugin sources {{{ +# See documentation of the `plugin` function for description. + + _zplg_source_url_download() { + local plugin_url="$1" plugin_dir="$2" + wget --timestamping --directory-prefix "$plugin_dir" -- "$plugin_url" + } + + _zplg_source_url_upgrade() { + _zplg_source_url_download "$@" + } + + _zplg_source_git_download() { + local plugin_url="$1" plugin_dir="$2" + git clone --depth=1 --recurse-submodules -- "$plugin_url" "$plugin_dir" + } + + _zplg_source_git_upgrade() { + local plugin_url="$1" plugin_dir="$2" + ( cd "$plugin_dir" && git pull && git submodule update --init --recursive ) + } + + _zplg_source_github_download() { + local plugin_url="$1" plugin_dir="$2" + _zplg_source_git_download "https://github.com/$plugin_url.git" "$plugin_dir" + } + + _zplg_source_github_upgrade() { + local plugin_url="$1" plugin_dir="$2" + _zplg_source_git_upgrade "https://github.com/$plugin_url.git" "$plugin_dir" + } + +# }}} + +# The main part of my plugin manager. This function does two things: it +# downloads a plugin if necessary and loads it into the shell. Usage is very +# simple: +# +# plugin option_a=value_a option_b=value_b ... +# +# +# identifier of the plugin, alphanumeric, may contain underscores, +# hyphens and periods, mustn't start with a period. +# +# +# I guess this is self-descreptive. +# +# Some options can be repeated (marked with a plus). Available options: +# +# from +# Sets plugin source. Sources are where the plugin will be downloaded from. +# Currently supported sources are: +# * git - clones a repository +# * github - clones a repository from GitHub +# * url - simply downloads a file +# Custom sources can easily be defined. Just create two functions: +# `_zplg_source_${name}_download` and `_zplg_source_${name}_upgrade`. Both +# functions take two arguments: plugin URL and plugin directory. Download +# function must, well, download a plugin from the given URL into the given +# directory, ugrade one, obviously, upgrades plugin inside of the given +# directory. Please note that neither of these functions is executed INSIDE +# of the plugin directory. +# +# build (+) +# Command which builds/compiles the plugin, executed INSIDE of $plugin_dir +# (i.e. cd $plugin_dir) once after downloading. Plugin directory can be +# accessed through the $plugin_dir variable. +# +# before_load (+) and after_load (+) +# Execute commands before and after loading of the plugin, useful when you +# need to read plugin directory which is available through the $plugin_dir +# variable. +# +# load (+) and ignore (+) +# Globs which tell what files should be sourced (load) or ignored (ignore). +# If glob expands to nothing (NULL_GLOB), nothing is loaded. +# +# Neat trick when using options: if you want to assign values using an array, +# write it like this: option=${^array}. That way `option=` is prepended to +# each value of `array`. +# +# For examples see my dotfiles: https://github.com/dmitmel/dotfiles/blob/master/zsh/plugins.zsh +# You may ask me why did I choose to merge loading and downloading behavior +# into one function. Well, first of all plugin manager itself becomes much +# simpler. Second: it allows you to load plugins from any part of zshrc (which +# is useful for me because my dotfiles are used by my friends, and they too +# want customization) and even in an active shell. +# +# Oh, and I had to optimize this function, so it is very long because I merged +# everything into one code block. I hope (this is also a message for my future +# self) that you'll be able to read this code, I tried to comment everything. +plugin() { + + # parse basic arguments {{{ + + if (( $# < 2 )); then + _zplg_error "usage: $0 [option...]" + return 1 + fi + + local plugin_id="$1" + local plugin_url="$2" + if [[ ! "$plugin_id" =~ '^[a-zA-Z0-9_\-][a-zA-Z0-9._\-]*$' ]]; then + _zplg_error "invalid plugin ID" + return 1 + fi + if [[ -z "$plugin_url" ]]; then + _zplg_error "invalid plugin URL" + return 1 + fi + + # Don't even try to continue if the plugin has already been loaded. This is + # not or problem. Plugin manager loads plugins and shouldn't bother + # unloading them. + if _zplg_is_plugin_loaded "$plugin_id"; then + _zplg_error "plugin $plugin_id has already been loaded" + return 1 + fi + + # }}} + + # parse options {{{ + + local plugin_from="github" + local -a plugin_build plugin_before_load plugin_after_load plugin_load plugin_ignore + + local option key value; shift 2; for option in "$@"; do + # globs are faster than regular expressions + if [[ "$option" != *?=?* ]]; then + _zplg_error "options must have the following format: =" + return 1 + fi + + # split 'option' at the first occurence of '=' + key="${option%%=*}" value="${option#*=}" + case "$key" in + from) + eval "plugin_$key=\"\$value\"" ;; + build|before_load|after_load|load|ignore) + eval "plugin_$key+=(\"\$value\")" ;; + *) + _zplg_error "unknown option: $key" + return 1 ;; + esac + done; unset option key value + + # }}} + + if (( ${#plugin_load} == 0 )); then + # default loading patterns: + # - *.plugin.zsh for most plugins and Oh-My-Zsh ones + # - *.zsh-theme for most themes and Oh-My-Zsh ones + # - init.zsh for Prezto plugins + # ([1]) means "expand only to the first match" + plugin_load=("(*.plugin.zsh|*.zsh-theme|init.zsh)([1])") + fi + + # download plugin {{{ + + local plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" + # simple check whether the plugin directory exists is enough for me + if [[ ! -d "$plugin_dir" ]]; then + _zplg_log "downloading $plugin_id" + _zplg_source_"$plugin_from"_download "$plugin_url" "$plugin_dir" || return "$?" + + if (( ${#plugin_build} > 0 )); then + _zplg_log "building $plugin_id" + ( cd "$plugin_dir" && _zplg_run_commands plugin_build ) || return "$?" + fi + fi + + # }}} + + # load plugin {{{ + + _zplg_run_commands plugin_before_load || return "$?" + + local load_pattern ignore_pattern script_path; local -a script_paths + for load_pattern in "${plugin_load[@]}"; do + _zplg_expand_pattern "$plugin_dir/$load_pattern" script_paths + for script_path in "${script_paths[@]}"; do + for ignore_pattern in "${plugin_ignore[@]}"; do + if [[ "$script_path" == "$plugin_dir/"${~ignore_pattern} ]]; then + # continue outer loop + continue 2 + fi + done + _zplg_debug "sourcing $script_path" + _zplg_load "$script_path" || return "$?" + done + done; unset load_pattern ignore_pattern script_path + + _zplg_run_commands plugin_after_load || return "$?" + + # plugin has finally been loaded, we can add it to $ZPLG_LOADED_PLUGINS + ZPLG_LOADED_PLUGINS+=("$plugin_id") + ZPLG_LOADED_PLUGIN_URLS[$plugin_id]="$plugin_url" + ZPLG_LOADED_PLUGIN_SOURCES[$plugin_id]="$plugin_from" + + # HORRIBLE HACK: because you can't store arrays as values in associative + # arrays, I simply quote every element with the (@q) modifier, then join + # quoted ones into a string and put this "encoded" string into the + # associative array. Terrible idea? Maybe. Does it work? YES!!! + if (( ${#plugin_build} > 0 )); then + # extra ${...} is needed to turn array into a string by joining it with + # spaces + ZPLG_LOADED_PLUGIN_BUILD_CMDS[$plugin_id]="${${(@q)plugin_build}}" + unset plugin_build_quoted + fi + + # }}} + +} + +# helper functions for plugin configuration {{{ + + # Simplifies modification of path variables (path/fpath/manpath etc) in + # after_load and before_load hooks. + plugin-cfg-path() { + if (( $# < 2 )); then + _zplg_error "usage: $0 prepend|append " + return 1 + fi + + if [[ -z "$plugin_dir" ]]; then + _zplg_error "this function is intended to be used in after_load or before_load hooks" + return 1 + fi + + local var_name="$1" operator="$2"; shift 2; local values=("$@") + + if [[ "$var_name" != *path || "${(Pt)var_name}" != array* ]]; then + _zplg_error "unknown path variable $var_name" + return 1 + fi + + case "$operator" in + prepend) eval "$var_name=(\"\$plugin_dir/\"\${^values} \${$var_name[@]})" ;; + append) eval "$var_name=(\${$var_name[@]} \"\$plugin_dir/\"\${^values})" ;; + *) _zplg_error "unknown $0 operator $operator" + esac + } + +# }}} + +# Exits with success code 0 if the plugin is loaded, otherwise exits with error +# code 1. To be used in `if` statements. +_zplg_is_plugin_loaded() { + local plugin_id="$1" + # (ie) are subscript flags: + # - i returns index of the value (reverse subscripting) in the square + # brackets (subscript) + # - e disables patterns matching, so plain string matching is used instead + # unlike normal programming languages, if the value is not found an index + # greater than the length of the array is returned + (( ${ZPLG_LOADED_PLUGINS[(ie)$plugin_id]} <= ${#ZPLG_LOADED_PLUGINS} )) +} + +# Here are some useful commands for managing plugins. I chose to make them +# functions because: +# 1. automatic completion +# 2. automatic correction + +# Prints IDs of all loaded plugins. +plugin-list() { + # (F) modifier joins an array with newlines + print "${(F)ZPLG_LOADED_PLUGINS}" +} + +# Upgrades all plugins if no arguments are given, otherwise upgrades plugins by +# their IDs. +plugin-upgrade() { + local plugin_ids_var + if (( $# > 0 )); then + plugin_ids_var="@" + else + plugin_ids_var="ZPLG_LOADED_PLUGINS" + fi + + local plugin_id plugin_url plugin_from plugin_dir; local -a plugin_build + # for description of the (P) modifier see _zplg_run_commands + for plugin_id in "${(@P)plugin_ids_var}"; do + if ! _zplg_is_plugin_loaded "$plugin_id"; then + _zplg_error "unknown plugin $plugin_id" + return 1 + fi + + plugin_url="${ZPLG_LOADED_PLUGIN_URLS[$plugin_id]}" + plugin_from="${ZPLG_LOADED_PLUGIN_SOURCES[$plugin_id]}" + plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" + + _zplg_log "upgrading $plugin_id" + _zplg_source_"$plugin_from"_upgrade "$plugin_url" "$plugin_dir" || return "$?" + + if (( ${+ZPLG_LOADED_PLUGIN_BUILD_CMDS[$plugin_id]} )); then + # TERRIBLE HACK continued: this monstrosity is used to "decode" build + # commands. See ending of the `plugin` function for "encoding" procedure. + # First, I get encoded string. Then with the (z) modifier I split it into + # array taking into account quoting. Then with the (Q) modifier I unquote + # every value. + plugin_build=("${(@Q)${(z)${ZPLG_LOADED_PLUGIN_BUILD_CMDS[$plugin_id]}}}") + _zplg_log "building $plugin_id" + ( cd "$plugin_dir" && _zplg_run_commands plugin_build ) || return "$?" + fi + done +} + +# Reinstall plugins by IDs. +plugin-reinstall() { + if (( $# == 0 )); then + _zplg_error "usage: $0 " + return 1 + fi + + local plugin_id plugin_url plugin_from plugin_dir; local -a plugin_build + for plugin_id in "$@"; do + if ! _zplg_is_plugin_loaded "$plugin_id"; then + _zplg_error "unknown plugin $plugin_id" + return 1 + fi + + plugin_url="${ZPLG_LOADED_PLUGIN_URLS[$plugin_id]}" + plugin_from="${ZPLG_LOADED_PLUGIN_SOURCES[$plugin_id]}" + plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" + + _zplg_log "removing $plugin_id" + rm -rf "$plugin_dir" + + _zplg_log "downloading $plugin_id" + _zplg_source_"$plugin_from"_download "$plugin_url" "$plugin_dir" || return "$?" + + if (( ${+ZPLG_LOADED_PLUGIN_BUILD_CMDS[$plugin_id]} )); then + # for description of this terrible hack see the ending of the + # `plugin-upgrade` function + plugin_build=("${(@Q)${(z)${ZPLG_LOADED_PLUGIN_BUILD_CMDS[$plugin_id]}}}") + _zplg_log "building $plugin_id" + ( cd "$plugin_dir" && _zplg_run_commands plugin_build ) || return "$?" + fi + done +} + +# Clears directories of plugins by their IDs. +plugin-purge() { + if (( $# == 0 )); then + _zplg_error "usage: $0 " + return 1 + fi + + for plugin_id in "$@"; do + if ! _zplg_is_plugin_loaded "$plugin_id"; then + _zplg_error "unknown plugin $plugin_id" + return 1 + fi + + local plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" + + _zplg_log "removing $plugin_id" + rm -rf "$plugin_dir" + done +} diff --git a/zsh/zshrc b/zsh/zshrc index 132db7a..150427d 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -9,7 +9,6 @@ done command_exists rbenv && eval "$(rbenv init -)" -export BASE16_SHELL="$HOME/.zgen/chriskempson/base16-shell-master" BASE16_SHELL_profile_helper="$BASE16_SHELL/profile_helper.sh" [[ -n "$PS1" && -r "$BASE16_SHELL_profile_helper" ]] && eval "$("$BASE16_SHELL_profile_helper")" From 443b75f60992fe3386abd1398f1f91f7190ea2f1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 27 Jun 2019 15:33:00 +0300 Subject: [PATCH 139/713] [zsh] fix manpath --- zsh/path.zsh | 3 --- zsh/zshrc | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zsh/path.zsh b/zsh/path.zsh index dc4bdd5..56628cd 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -59,6 +59,3 @@ if [[ -f "$rustc" && -x "$rustc" ]] && rust_sysroot="$("$rustc" --print sysroot) manpath=("$rust_sysroot/share/man" "${manpath[@]}") fi unset rustc rust_sysroot - -# add colon after MANPATH so that it doesn't overwrite system MANPATH -MANPATH="$MANPATH:" diff --git a/zsh/zshrc b/zsh/zshrc index 150427d..2dfd016 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -7,6 +7,9 @@ for script in functions path env plugins aliases palette theme; do source_if_exists "$ZSH_DOTFILES/custom/$script.zsh" done +# add colon after MANPATH so that it doesn't overwrite system MANPATH +MANPATH="$MANPATH:" + command_exists rbenv && eval "$(rbenv init -)" BASE16_SHELL_profile_helper="$BASE16_SHELL/profile_helper.sh" From d6bca713926ccf8655004210a74c72e16a0487b5 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 27 Jun 2019 15:36:35 +0300 Subject: [PATCH 140/713] [kitty] change URL style --- kitty/kitty.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kitty/kitty.conf b/kitty/kitty.conf index 2ad21a5..d2dcc6a 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -115,7 +115,7 @@ cursor_stop_blinking_after 0 #: Mouse {{{ url_color #6699cc -url_style double +url_style single #: The color and style for highlighting URLs on mouse-over. url_style #: can be one of: none, single, double, curly From a3e88edfbf03960375026673281148caeb1469af Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 28 Jun 2019 01:23:34 +0300 Subject: [PATCH 141/713] [nvim] fix coc statusline --- nvim/lib/interface.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nvim/lib/interface.vim b/nvim/lib/interface.vim index 3a4d832..c78cf26 100644 --- a/nvim/lib/interface.vim +++ b/nvim/lib/interface.vim @@ -107,6 +107,8 @@ endif let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#ale#enabled = 1 + let g:coc_status_error_sign = 'E:' + let g:coc_status_warning_sign = 'W:' call airline#parts#define_function('coc#status', 'coc#status') function StatusLine_filesize() @@ -134,9 +136,9 @@ endif let g:airline_section_{a:section} = g:airline_section_{a:section} . airline#section#create_left([''] + a:items) endfunction function s:tweak_airline() - " if exists('*coc#status') - " call s:airline_section_prepend('x', ['coc#status']) - " endif + if exists('*coc#status') + call s:airline_section_prepend('x', ['coc#status']) + endif call s:airline_section_append('y', ['filesize']) if exists('*airline#extensions#coc#get_error') call s:airline_section_prepend('error', ['coc_error_count']) From 7eeb9e41d2e5dc717fa01504c2a2fe4525bc4625 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 28 Jun 2019 01:28:22 +0300 Subject: [PATCH 142/713] [nvim] change warning/error signs --- nvim/lib/completion.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nvim/lib/completion.vim b/nvim/lib/completion.vim index 8b1b668..900ae31 100644 --- a/nvim/lib/completion.vim +++ b/nvim/lib/completion.vim @@ -75,5 +75,10 @@ endif " }}} call coc#add_extension('coc-snippets') - call coc#config('diagnostic', { 'virtualText': v:true, 'enableMessage': 'jump' }) + call coc#config('diagnostic', { + \ 'virtualText': v:true, + \ 'enableMessage': 'jump', + \ 'errorSign': 'XX', + \ 'warningSign': '!!', + \ }) " }}} From 4cac7ade717869a37a6a37c6018b817c0876d2c5 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 28 Jun 2019 10:19:25 +0300 Subject: [PATCH 143/713] [zsh] remove zgen --- .gitmodules | 3 --- zsh/zgen | 1 - 2 files changed, 4 deletions(-) delete mode 100644 .gitmodules delete mode 160000 zsh/zgen diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 3658adb..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "zgen"] - path = zsh/zgen - url = https://github.com/tarjoilija/zgen.git diff --git a/zsh/zgen b/zsh/zgen deleted file mode 160000 index 0b669d2..0000000 --- a/zsh/zgen +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0b669d2d0dcf788b4c81a7a30b4fa41dfbf7d1a7 From 8d5df71057e7f81133af3217f0fd07737385594b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 28 Jun 2019 11:53:06 +0300 Subject: [PATCH 144/713] [nvim] get rid of duplicate error/warning counters --- nvim/lib/interface.vim | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/nvim/lib/interface.vim b/nvim/lib/interface.vim index c78cf26..34ddd70 100644 --- a/nvim/lib/interface.vim +++ b/nvim/lib/interface.vim @@ -105,7 +105,7 @@ endif let g:airline#extensions#branch#enabled = 1 let g:airline#extensions#tabline#enabled = 1 - let g:airline#extensions#ale#enabled = 1 + let g:airline#extensions#coc#enabled = 1 let g:coc_status_error_sign = 'E:' let g:coc_status_warning_sign = 'W:' @@ -140,12 +140,6 @@ endif call s:airline_section_prepend('x', ['coc#status']) endif call s:airline_section_append('y', ['filesize']) - if exists('*airline#extensions#coc#get_error') - call s:airline_section_prepend('error', ['coc_error_count']) - endif - if exists('*airline#extensions#coc#get_warning') - call s:airline_section_prepend('warning', ['coc_warning_count']) - endif endfunction augroup vimrc-interface-airline autocmd! From aeee5f485fe8b0aafd537b868a825bc00121a535 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 6 Jul 2019 00:19:55 +0300 Subject: [PATCH 145/713] fix upgrade script --- upgrade.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/upgrade.zsh b/upgrade.zsh index 6cbbfec..13874a4 100755 --- a/upgrade.zsh +++ b/upgrade.zsh @@ -1,11 +1,11 @@ #!/usr/bin/env zsh -DOTFILES_PATH="${0:h}" +DOTFILES_PATH="${0:a:h}" cd "$DOTFILES_PATH" || exit 1 +ZSH_DOTFILES="$DOTFILES_PATH/zsh" git pull --rebase --stat origin master git submodule update --init --recursive --remote --progress -DISABLE_AUTO_UPDATE=true -source "zsh/zgen/zgen.zsh" -zgen update +source "$ZSH_DOTFILES/plugins.zsh" +plugin-upgrade From 415e169fa2801959165e2c43291a9b771e8bd37b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 11 Jul 2019 09:36:31 +0300 Subject: [PATCH 146/713] [nvim] open Helptags menu only in normal mode --- nvim/lib/interface.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nvim/lib/interface.vim b/nvim/lib/interface.vim index 34ddd70..db3ced7 100644 --- a/nvim/lib/interface.vim +++ b/nvim/lib/interface.vim @@ -150,8 +150,7 @@ endif " FZF {{{ - noremap Helptags - inoremap Helptags + nnoremap Helptags nnoremap f Files nnoremap b Buffers " }}} From b8e20818397a6c127b701ef4c1e2dc78b7ee3df7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 13 Jul 2019 21:35:34 +0300 Subject: [PATCH 147/713] [zsh] write custom prompt instead of spaceship-prompt --- zsh/plugins.zsh | 39 ----------------------------------- zsh/theme.zsh | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 39 deletions(-) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index 1523b78..1b83534 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -47,43 +47,6 @@ plugin completions 'zsh-users/zsh-completions' # }}} -# spaceship prompt {{{ - - SPACESHIP_PROMPT_ADD_NEWLINE=false - - SPACESHIP_PROMPT_ORDER=( - user - host - dir - git - # hg - exec_time - # vi_mode - jobs - exit_code - line_sep - char - ) - - SPACESHIP_CHAR_SYMBOL="$ " - SPACESHIP_CHAR_SYMBOL_ROOT="# " - SPACESHIP_CHAR_SYMBOL_SECONDARY="> " - SPACESHIP_GIT_STATUS_DELETED="\u2718 " - SPACESHIP_HG_STATUS_DELETED="\u2718 " - SPACESHIP_EXIT_CODE_SYMBOL="\u2718 " - SPACESHIP_JOBS_SYMBOL="\u2726 " - - SPACESHIP_USER_SHOW=always - - SPACESHIP_DIR_TRUNC=0 - SPACESHIP_DIR_TRUNC_REPO=false - - SPACESHIP_EXIT_CODE_SHOW=true - - plugin spaceship-prompt 'denysdovhan/spaceship-prompt' - -# }}} - plugin fzf 'junegunn/fzf' build='./install --bin' \ after_load='plugin-cfg-path path prepend bin' \ after_load='plugin-cfg-path manpath prepend man' @@ -95,7 +58,5 @@ plugin ssh 'zpm-zsh/ssh' plugin base16-shell 'chriskempson/base16-shell' \ after_load='export BASE16_SHELL="$plugin_dir"' -autoload -Uz compinit && compinit -C - FAST_WORK_DIR="$ZSH_CACHE_DIR" plugin fast-syntax-highlighting 'zdharma/fast-syntax-highlighting' diff --git a/zsh/theme.zsh b/zsh/theme.zsh index 63996b6..0b519e1 100644 --- a/zsh/theme.zsh +++ b/zsh/theme.zsh @@ -7,4 +7,59 @@ configure_dircolors() { zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}" } +prompt_preexec_hook() { + typeset -g -i _PROMPT_EXEC_START_TIME + _PROMPT_EXEC_START_TIME="$(date +%s.%N)" +} + +prompt_precmd_hook() { + if [[ -v _PROMPT_EXEC_START_TIME ]]; then + local -F stop_time duration + stop_time="$(date +%s.%N)" + duration="$((stop_time - _PROMPT_EXEC_START_TIME))" + unset _PROMPT_EXEC_START_TIME + + if (( duration > 1 )); then + local -i t="$duration" d h m s + typeset -g _PROMPT_EXEC_TIME="" + d="$((t/60/60/24))" + h="$((t/60/60%24))" + m="$((t/60%60))" + s="$((t%60))" + (( d > 0 )) && _PROMPT_EXEC_TIME+="${d}d" + (( h > 0 )) && _PROMPT_EXEC_TIME+="${h}h" + (( m > 0 )) && _PROMPT_EXEC_TIME+="${m}m" + _PROMPT_EXEC_TIME+="${s}s" + else + unset _PROMPT_EXEC_TIME + fi + fi +} + +setup_prompt() { + setopt nopromptbang promptcr promptsp promptpercent promptsubst + + if [[ "$(date +%N)" != "N" ]]; then + preexec_functions+=(prompt_preexec_hook) + precmd_functions+=(prompt_precmd_hook) + else + echo "Please, install GNU coreutils to get command execution time in the prompt" + fi + + PROMPT='%F{8}┌─%f%B' + PROMPT+='%F{%(!.red.yellow)}%n%f' + PROMPT+=' at %F{${SSH_CONNECTION:+blue}${SSH_CONNECTION:-green}}%m%f' + PROMPT+=' in %F{cyan}%~%f' + PROMPT+=' ' + PROMPT+='${_PROMPT_EXEC_TIME:+" %F{yellow}$_PROMPT_EXEC_TIME%f"}' + PROMPT+='%(?.. %F{red}EXIT:%?%f)' + PROMPT+='%1(j. %F{blue}JOBS:%j%f.)' + PROMPT+=$'\n' + PROMPT+='%b%F{8}└─%f' + PROMPT+='%F{%(?.green.red)}%(!.#.\$)%f ' + + PROMPT2=' %_> ' +} + configure_dircolors +setup_prompt From 1f39fc8cff95e726618f6eb449dcc192e63ee90c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 20 Jul 2019 09:59:29 +0300 Subject: [PATCH 148/713] [zsh] get rid of tput dependency in zplg.zsh --- zsh/zplg.zsh | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh index a9d936c..1a90aea 100644 --- a/zsh/zplg.zsh +++ b/zsh/zplg.zsh @@ -43,19 +43,13 @@ _ZPLG_PLUGINS_DIR="$ZPLG_HOME/plugins" # basic logging {{{ - _ZPLG_ANSI_BOLD="$(tput bold)" - _ZPLG_ANSI_RED="$(tput setaf 1)" - _ZPLG_ANSI_GREEN="$(tput setaf 2)" - _ZPLG_ANSI_BLUE="$(tput setaf 4)" - _ZPLG_ANSI_RESET="$(tput sgr0)" - _zplg_log() { - print >&2 "${_ZPLG_ANSI_BLUE}${_ZPLG_ANSI_BOLD}[zplg]${_ZPLG_ANSI_RESET} $@" + print >&2 "${fg_bold[blue]}[zplg]${reset_color} $@" } _zplg_debug() { if [[ -n "$ZPLG_DEBUG" ]]; then - _zplg_log "${_ZPLG_ANSI_GREEN}debug:${_ZPLG_ANSI_RESET} $@" + _zplg_log "${fg[green]}debug:${reset_color} $@" fi } @@ -69,14 +63,14 @@ _ZPLG_PLUGINS_DIR="$ZPLG_HOME/plugins" # relative to the beginning of a function/file here. I use it here # only for consistency with the shell, TODO might change this in the # future. - _zplg_log "${_ZPLG_ANSI_RED}error:${_ZPLG_ANSI_RESET} ${functrace[$i]}: $@" + _zplg_log "${fg[red]}error:${reset_color} ${functrace[$i]}: $@" return 1 fi done # if for whatever reason we couldn't find the caller, simply print the # error without it - _zplg_log "${_ZPLG_ANSI_RED}error:${_ZPLG_ANSI_RESET} $@" + _zplg_log "${fg[red]}error:${reset_color} $@" return 1 } From 6fd9eecf6a175dda1200da9c3ea521b41b653957 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 21 Jul 2019 00:09:32 +0300 Subject: [PATCH 149/713] [zsh] remove forced locale settings --- zsh/env.zsh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/zsh/env.zsh b/zsh/env.zsh index 8ff658c..c951abf 100644 --- a/zsh/env.zsh +++ b/zsh/env.zsh @@ -1,11 +1,6 @@ #!/usr/bin/env zsh -export LANG="en_US.UTF-8" -export LC_ALL="$LANG" - -if [[ -z "$USER" && -n "$USERNAME" ]]; then - export USER="$USERNAME" -fi +export USER="${USER:-$USERNAME}" # find editor export EDITOR="nvim" From 003dffcb3b3345d9a0d272e9c1a6b15bd235f7e0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 27 Jul 2019 23:51:34 +0300 Subject: [PATCH 150/713] [zsh] fix dependencies of zplg --- zsh/zplg.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh index 1a90aea..beaf854 100644 --- a/zsh/zplg.zsh +++ b/zsh/zplg.zsh @@ -28,6 +28,10 @@ _ZPLG_SCRIPT_PATH="${(%):-%N}" +# load dependencies {{{ + autoload -Uz colors && colors +# }}} + # $ZPLG_HOME is a directory where all your plugins are downloaded, it also # might contain in the future some kind of state/lock/database files. It is From 10697a46b20f749a8f4799f35354c751df624c67 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 27 Jul 2019 23:55:20 +0300 Subject: [PATCH 151/713] [zsh] add Arch Linux logo --- zsh/welcome/logos/arch | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 zsh/welcome/logos/arch diff --git a/zsh/welcome/logos/arch b/zsh/welcome/logos/arch new file mode 100644 index 0000000..bbdcda0 --- /dev/null +++ b/zsh/welcome/logos/arch @@ -0,0 +1,19 @@ +{4} -` +{4} .o+` +{4} `ooo/ +{4} `+oooo: +{4} `+oooooo: +{4} -+oooooo+: +{4} `/:-:++oooo+: +{4} `/++++/+++++++: +{4} `/++++++++++++++: +{4} `/+++ooooooooooooo/` +{4} ./ooosssso++osssssso+` +{4} .oossssso-````/ossssss+` +{4} -osssssso. :ssssssso. +{4} :osssssss/ osssso+++. +{4} /ossssssss/ +ssssooo/- +{4} `/ossssso+/:- -:/+osssso+- +{4} `+sso+:-` `.-/+oso: +{4} `++:. `-/+/ +{4} .` `/ From 1360c159129eb3a6da1d5645ab8f34eaac5ba999 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 28 Jul 2019 00:21:42 +0300 Subject: [PATCH 152/713] [zsh] fix fzf plugin on systems with no predefined $MANPATH --- zsh/zshrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index 2dfd016..48bc82c 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -2,14 +2,14 @@ ZSH_DOTFILES="${0:h}" +# add colon after MANPATH so that it doesn't overwrite system MANPATH +export MANPATH="$MANPATH:" + for script in functions path env plugins aliases palette theme; do source "$ZSH_DOTFILES/$script.zsh" source_if_exists "$ZSH_DOTFILES/custom/$script.zsh" done -# add colon after MANPATH so that it doesn't overwrite system MANPATH -MANPATH="$MANPATH:" - command_exists rbenv && eval "$(rbenv init -)" BASE16_SHELL_profile_helper="$BASE16_SHELL/profile_helper.sh" From 5b84eb36668dc90ca3466f463f83cbe9eec9c5a7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 28 Jul 2019 15:00:01 +0300 Subject: [PATCH 153/713] [kitty] remove font_size setting --- kitty/kitty.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kitty/kitty.conf b/kitty/kitty.conf index d2dcc6a..bc34301 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -22,7 +22,7 @@ font_family Ubuntu Mono derivative Powerline #: italic_font Operator Mono Book Italic #: bold_italic_font Operator Mono Medium Italic -font_size 14.0 +# font_size 14.0 #: Font size (in pts) From 9edfa470dd412b8a315e884012dffd9dfbc22a6c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 28 Jul 2019 17:17:30 +0300 Subject: [PATCH 154/713] [zsh] revert unnecessary manpath fix --- zsh/zshrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index 48bc82c..2dfd016 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -2,14 +2,14 @@ ZSH_DOTFILES="${0:h}" -# add colon after MANPATH so that it doesn't overwrite system MANPATH -export MANPATH="$MANPATH:" - for script in functions path env plugins aliases palette theme; do source "$ZSH_DOTFILES/$script.zsh" source_if_exists "$ZSH_DOTFILES/custom/$script.zsh" done +# add colon after MANPATH so that it doesn't overwrite system MANPATH +MANPATH="$MANPATH:" + command_exists rbenv && eval "$(rbenv init -)" BASE16_SHELL_profile_helper="$BASE16_SHELL/profile_helper.sh" From b4e9430b76540d5b6a7b4e01d9513db34971f5e7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 29 Jul 2019 15:30:37 +0300 Subject: [PATCH 155/713] [zsh] change PROMPT2 offset --- zsh/theme.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/theme.zsh b/zsh/theme.zsh index 0b519e1..c8c0800 100644 --- a/zsh/theme.zsh +++ b/zsh/theme.zsh @@ -58,7 +58,7 @@ setup_prompt() { PROMPT+='%b%F{8}└─%f' PROMPT+='%F{%(?.green.red)}%(!.#.\$)%f ' - PROMPT2=' %_> ' + PROMPT2=' %_> ' } configure_dircolors From 5318cbd00c9784c7bca02a82caff204d48e2aefa Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 31 Jul 2019 22:43:35 +0300 Subject: [PATCH 156/713] [zsh] make ln more verbose --- zsh/aliases.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 859cce5..bed3ce8 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -48,6 +48,7 @@ alias rm='rm -iv' alias rmdir='rmdir -v' alias chmod='chmod -v' alias chown='chown -v' +alias ln='ln -iv' # print file sizes in human readable format alias du='du -h' From b2415bfe4da2a44614669caae345bab07ec1ebd5 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 1 Aug 2019 10:06:05 +0300 Subject: [PATCH 157/713] [zsh] remove links from plugins.zsh --- zsh/plugins.zsh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index 1b83534..81fac8e 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -1,9 +1,5 @@ #!/usr/bin/env zsh -# https://github.com/zdharma/zplugin/blob/master/doc/mod-install.sh -# https://github.com/zdharma/zplugin/blob/master/zmodules/Src/Makefile.in -# https://github.com/zsh-users/zsh/blob/master/Etc/zsh-development-guide - source "$ZSH_DOTFILES/zplg.zsh" plugin completions 'zsh-users/zsh-completions' From 2d7b5b32905b22089711549f2b255640a0a121c6 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 1 Aug 2019 10:27:45 +0300 Subject: [PATCH 158/713] [zsh] update documentation of ZPLG --- zsh/zplg.zsh | 195 +++++++++++++++++++++++++++------------------------ 1 file changed, 103 insertions(+), 92 deletions(-) diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh index beaf854..f7fe8f0 100644 --- a/zsh/zplg.zsh +++ b/zsh/zplg.zsh @@ -35,12 +35,17 @@ _ZPLG_SCRIPT_PATH="${(%):-%N}" # $ZPLG_HOME is a directory where all your plugins are downloaded, it also # might contain in the future some kind of state/lock/database files. It is -# recommended to change it before `source`-ing this script for compatitability -# with future versions. +# recommended to change it before `source`-ing this script because you may end +# up with a broken plugin directory. if [[ -z "$ZPLG_HOME" ]]; then ZPLG_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/zplg" fi +# Default plugin source, see the `plugin` function for description. +if [[ -z "$ZPLG_DEFAULT_SOURCE" ]]; then + ZPLG_DEFAULT_SOURCE="github" +fi + # Directory in which plugins are stored. It is separate from $ZPLG_HOME for # compatitability with future versions. _ZPLG_PLUGINS_DIR="$ZPLG_HOME/plugins" @@ -117,7 +122,8 @@ _zplg_expand_pattern() { local pattern="$1" out_var_name="$2" # ${~var_name} turns on globbing for this expansion, note lack of quotes: as # it turns out glob expansions are automatically quoted by design, and when - # you explicitly write "${~pattern}" it is basically the same as "$pattern" + # you explicitly write `"${~pattern}"` it is basically the same as + # `"$pattern"` eval "$out_var_name=(\${~pattern})" } @@ -189,7 +195,7 @@ _zplg_load() { # function must, well, download a plugin from the given URL into the given # directory, ugrade one, obviously, upgrades plugin inside of the given # directory. Please note that neither of these functions is executed INSIDE -# of the plugin directory. +# of the plugin directory (i.e. current working directory is not changed). # # build (+) # Command which builds/compiles the plugin, executed INSIDE of $plugin_dir @@ -207,7 +213,7 @@ _zplg_load() { # # Neat trick when using options: if you want to assign values using an array, # write it like this: option=${^array}. That way `option=` is prepended to -# each value of `array`. +# each element of `array`. # # For examples see my dotfiles: https://github.com/dmitmel/dotfiles/blob/master/zsh/plugins.zsh # You may ask me why did I choose to merge loading and downloading behavior @@ -251,7 +257,7 @@ plugin() { # parse options {{{ - local plugin_from="github" + local plugin_from="$ZPLG_DEFAULT_SOURCE" local -a plugin_build plugin_before_load plugin_after_load plugin_load plugin_ignore local option key value; shift 2; for option in "$@"; do @@ -386,105 +392,110 @@ _zplg_is_plugin_loaded() { (( ${ZPLG_LOADED_PLUGINS[(ie)$plugin_id]} <= ${#ZPLG_LOADED_PLUGINS} )) } -# Here are some useful commands for managing plugins. I chose to make them -# functions because: -# 1. automatic completion -# 2. automatic correction +# Useful commands for managing plugins {{{ -# Prints IDs of all loaded plugins. -plugin-list() { - # (F) modifier joins an array with newlines - print "${(F)ZPLG_LOADED_PLUGINS}" -} + # I chose to make each of these commands as a separate function because: + # 1. automatic completion + # 2. automatic correction + # 3. hyphen is a single keystroke, just like space, so `zplg-list` is not + # hard to type fast. -# Upgrades all plugins if no arguments are given, otherwise upgrades plugins by -# their IDs. -plugin-upgrade() { - local plugin_ids_var - if (( $# > 0 )); then - plugin_ids_var="@" - else - plugin_ids_var="ZPLG_LOADED_PLUGINS" - fi + # Prints IDs of all loaded plugins. + zplg-list() { + # (F) modifier joins an array with newlines + print "${(F)ZPLG_LOADED_PLUGINS}" + } - local plugin_id plugin_url plugin_from plugin_dir; local -a plugin_build - # for description of the (P) modifier see _zplg_run_commands - for plugin_id in "${(@P)plugin_ids_var}"; do - if ! _zplg_is_plugin_loaded "$plugin_id"; then - _zplg_error "unknown plugin $plugin_id" + # Upgrades all plugins if no arguments are given, otherwise upgrades plugins by + # their IDs. + zplg-upgrade() { + local plugin_ids_var + if (( $# > 0 )); then + plugin_ids_var="@" + else + plugin_ids_var="ZPLG_LOADED_PLUGINS" + fi + + local plugin_id plugin_url plugin_from plugin_dir; local -a plugin_build + # for description of the (P) modifier see `_zplg_run_commands` + for plugin_id in "${(@P)plugin_ids_var}"; do + if ! _zplg_is_plugin_loaded "$plugin_id"; then + _zplg_error "unknown plugin $plugin_id" + return 1 + fi + + plugin_url="${ZPLG_LOADED_PLUGIN_URLS[$plugin_id]}" + plugin_from="${ZPLG_LOADED_PLUGIN_SOURCES[$plugin_id]}" + plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" + + _zplg_log "upgrading $plugin_id" + _zplg_source_"$plugin_from"_upgrade "$plugin_url" "$plugin_dir" || return "$?" + + if (( ${+ZPLG_LOADED_PLUGIN_BUILD_CMDS[$plugin_id]} )); then + # TERRIBLE HACK continued: this monstrosity is used to "decode" build + # commands. See ending of the `plugin` function for "encoding" procedure. + # First, I get encoded string. Then with the (z) modifier I split it into + # array taking into account quoting. Then with the (Q) modifier I unquote + # every value. + plugin_build=("${(@Q)${(z)${ZPLG_LOADED_PLUGIN_BUILD_CMDS[$plugin_id]}}}") + _zplg_log "building $plugin_id" + ( cd "$plugin_dir" && _zplg_run_commands plugin_build ) || return "$?" + fi + done + } + + # Reinstall plugins by IDs. + zplg-reinstall() { + if (( $# == 0 )); then + _zplg_error "usage: $0 " return 1 fi - plugin_url="${ZPLG_LOADED_PLUGIN_URLS[$plugin_id]}" - plugin_from="${ZPLG_LOADED_PLUGIN_SOURCES[$plugin_id]}" - plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" + local plugin_id plugin_url plugin_from plugin_dir; local -a plugin_build + for plugin_id in "$@"; do + if ! _zplg_is_plugin_loaded "$plugin_id"; then + _zplg_error "unknown plugin $plugin_id" + return 1 + fi - _zplg_log "upgrading $plugin_id" - _zplg_source_"$plugin_from"_upgrade "$plugin_url" "$plugin_dir" || return "$?" + plugin_url="${ZPLG_LOADED_PLUGIN_URLS[$plugin_id]}" + plugin_from="${ZPLG_LOADED_PLUGIN_SOURCES[$plugin_id]}" + plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" - if (( ${+ZPLG_LOADED_PLUGIN_BUILD_CMDS[$plugin_id]} )); then - # TERRIBLE HACK continued: this monstrosity is used to "decode" build - # commands. See ending of the `plugin` function for "encoding" procedure. - # First, I get encoded string. Then with the (z) modifier I split it into - # array taking into account quoting. Then with the (Q) modifier I unquote - # every value. - plugin_build=("${(@Q)${(z)${ZPLG_LOADED_PLUGIN_BUILD_CMDS[$plugin_id]}}}") - _zplg_log "building $plugin_id" - ( cd "$plugin_dir" && _zplg_run_commands plugin_build ) || return "$?" - fi - done -} + _zplg_log "removing $plugin_id" + rm -rf "$plugin_dir" -# Reinstall plugins by IDs. -plugin-reinstall() { - if (( $# == 0 )); then - _zplg_error "usage: $0 " - return 1 - fi + _zplg_log "downloading $plugin_id" + _zplg_source_"$plugin_from"_download "$plugin_url" "$plugin_dir" || return "$?" - local plugin_id plugin_url plugin_from plugin_dir; local -a plugin_build - for plugin_id in "$@"; do - if ! _zplg_is_plugin_loaded "$plugin_id"; then - _zplg_error "unknown plugin $plugin_id" + if (( ${+ZPLG_LOADED_PLUGIN_BUILD_CMDS[$plugin_id]} )); then + # for description of this terrible hack see the ending of the + # `zplg-upgrade` function + plugin_build=("${(@Q)${(z)${ZPLG_LOADED_PLUGIN_BUILD_CMDS[$plugin_id]}}}") + _zplg_log "building $plugin_id" + ( cd "$plugin_dir" && _zplg_run_commands plugin_build ) || return "$?" + fi + done + } + + # Clears directories of plugins by their IDs. + zplg-purge() { + if (( $# == 0 )); then + _zplg_error "usage: $0 " return 1 fi - plugin_url="${ZPLG_LOADED_PLUGIN_URLS[$plugin_id]}" - plugin_from="${ZPLG_LOADED_PLUGIN_SOURCES[$plugin_id]}" - plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" + for plugin_id in "$@"; do + if ! _zplg_is_plugin_loaded "$plugin_id"; then + _zplg_error "unknown plugin $plugin_id" + return 1 + fi - _zplg_log "removing $plugin_id" - rm -rf "$plugin_dir" + local plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" - _zplg_log "downloading $plugin_id" - _zplg_source_"$plugin_from"_download "$plugin_url" "$plugin_dir" || return "$?" + _zplg_log "removing $plugin_id" + rm -rf "$plugin_dir" + done + } - if (( ${+ZPLG_LOADED_PLUGIN_BUILD_CMDS[$plugin_id]} )); then - # for description of this terrible hack see the ending of the - # `plugin-upgrade` function - plugin_build=("${(@Q)${(z)${ZPLG_LOADED_PLUGIN_BUILD_CMDS[$plugin_id]}}}") - _zplg_log "building $plugin_id" - ( cd "$plugin_dir" && _zplg_run_commands plugin_build ) || return "$?" - fi - done -} - -# Clears directories of plugins by their IDs. -plugin-purge() { - if (( $# == 0 )); then - _zplg_error "usage: $0 " - return 1 - fi - - for plugin_id in "$@"; do - if ! _zplg_is_plugin_loaded "$plugin_id"; then - _zplg_error "unknown plugin $plugin_id" - return 1 - fi - - local plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" - - _zplg_log "removing $plugin_id" - rm -rf "$plugin_dir" - done -} +# }}} From 08255396c901649d19a6e37f35eaee24668f527b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 2 Aug 2019 16:13:50 +0300 Subject: [PATCH 159/713] [nvim] fix quotes highlighting in /bin/sh scripts --- nvim/lib/colorscheme.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nvim/lib/colorscheme.vim b/nvim/lib/colorscheme.vim index 43a64e1..2a6bc7f 100644 --- a/nvim/lib/colorscheme.vim +++ b/nvim/lib/colorscheme.vim @@ -333,7 +333,8 @@ let s:base16_theme_name = 'eighties' hi! link luaBraces Delimiter " }}} -" Zsh {{{ +" Shell {{{ + hi! link shQuote String hi! link zshFunction Function hi! link zshVariable Variable " }}} From 87bba3cc25ed6a722db1830b32b481c98f21ba8b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 2 Aug 2019 16:15:29 +0300 Subject: [PATCH 160/713] [kitty] change installation script a bit --- kitty/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kitty/install.sh b/kitty/install.sh index 93622a2..d49af24 100755 --- a/kitty/install.sh +++ b/kitty/install.sh @@ -36,7 +36,7 @@ if [ ! -f "$release_src_filename" ]; then log "downloading $release_src_filename from $release_src_url" curl --show-error --fail --location "$release_src_url" -o "$release_src_filename" else - log "$release_src_filename had already downloaded" + log "$release_src_filename has already been downloaded" fi release_src_dir="${release_src_filename%.tar.xz}" @@ -51,7 +51,7 @@ cd "$release_src_dir" log "patching" for patch in ../../patches/*.patch; do - log "applying patch $patch" + log "applying $(basename "$patch")" patch --unified --strip 0 < "$patch" done From 08b3030594394cc3ab099db408bf625950767dda Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 4 Aug 2019 11:42:18 +0300 Subject: [PATCH 161/713] [zsh] drop GNU coreutils dependency for prompt --- zsh/theme.zsh | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/zsh/theme.zsh b/zsh/theme.zsh index c8c0800..2d22f77 100644 --- a/zsh/theme.zsh +++ b/zsh/theme.zsh @@ -8,15 +8,12 @@ configure_dircolors() { } prompt_preexec_hook() { - typeset -g -i _PROMPT_EXEC_START_TIME - _PROMPT_EXEC_START_TIME="$(date +%s.%N)" + typeset -gF _PROMPT_EXEC_START_TIME="$EPOCHREALTIME" } prompt_precmd_hook() { if [[ -v _PROMPT_EXEC_START_TIME ]]; then - local -F stop_time duration - stop_time="$(date +%s.%N)" - duration="$((stop_time - _PROMPT_EXEC_START_TIME))" + local -F duration="$((EPOCHREALTIME - _PROMPT_EXEC_START_TIME))" unset _PROMPT_EXEC_START_TIME if (( duration > 1 )); then @@ -39,12 +36,9 @@ prompt_precmd_hook() { setup_prompt() { setopt nopromptbang promptcr promptsp promptpercent promptsubst - if [[ "$(date +%N)" != "N" ]]; then - preexec_functions+=(prompt_preexec_hook) - precmd_functions+=(prompt_precmd_hook) - else - echo "Please, install GNU coreutils to get command execution time in the prompt" - fi + zmodload zsh/datetime + preexec_functions+=(prompt_preexec_hook) + precmd_functions+=(prompt_precmd_hook) PROMPT='%F{8}┌─%f%B' PROMPT+='%F{%(!.red.yellow)}%n%f' From d59880383b2e888416cadbd91c2be7d1c618a54f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 4 Aug 2019 20:21:37 +0300 Subject: [PATCH 162/713] fix upgrade script --- upgrade.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upgrade.zsh b/upgrade.zsh index 13874a4..d3cf67c 100755 --- a/upgrade.zsh +++ b/upgrade.zsh @@ -8,4 +8,4 @@ git pull --rebase --stat origin master git submodule update --init --recursive --remote --progress source "$ZSH_DOTFILES/plugins.zsh" -plugin-upgrade +zplg-upgrade From 0ed35542334a10100724343d14bb4bb2976eefad Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 4 Aug 2019 20:22:07 +0300 Subject: [PATCH 163/713] [zsh] rewrite hooks with add-zsh-hook --- zsh/theme.zsh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zsh/theme.zsh b/zsh/theme.zsh index 2d22f77..f2958ee 100644 --- a/zsh/theme.zsh +++ b/zsh/theme.zsh @@ -37,8 +37,9 @@ setup_prompt() { setopt nopromptbang promptcr promptsp promptpercent promptsubst zmodload zsh/datetime - preexec_functions+=(prompt_preexec_hook) - precmd_functions+=(prompt_precmd_hook) + autoload -Uz add-zsh-hook + add-zsh-hook preexec prompt_preexec_hook + add-zsh-hook precmd prompt_precmd_hook PROMPT='%F{8}┌─%f%B' PROMPT+='%F{%(!.red.yellow)}%n%f' From 96b69c03356c7eee1554e0897c7bbde92dedec63 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 6 Aug 2019 15:20:57 +0300 Subject: [PATCH 164/713] [zsh] add Git branch to prompt --- zsh/theme.zsh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/zsh/theme.zsh b/zsh/theme.zsh index f2958ee..f33c3ee 100644 --- a/zsh/theme.zsh +++ b/zsh/theme.zsh @@ -7,6 +7,10 @@ configure_dircolors() { zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}" } +prompt_escape() { + echo "${@//'%'/%%}" +} + prompt_preexec_hook() { typeset -gF _PROMPT_EXEC_START_TIME="$EPOCHREALTIME" } @@ -33,6 +37,22 @@ prompt_precmd_hook() { fi } +prompt_vcs_info() { + if [[ $(command git rev-parse --is-inside-work-tree) != true ]]; then + return + fi + + local branch="(no branches)" line + git branch | while IFS= read -r line; do + if [[ "$line" == "* "* ]]; then + branch="${line#\* }" + break + fi + done + + print -n ' %F{blue}git:(%F{magenta}'"$(prompt_escape "$branch")"'%F{blue})%f' +} + setup_prompt() { setopt nopromptbang promptcr promptsp promptpercent promptsubst @@ -45,8 +65,9 @@ setup_prompt() { PROMPT+='%F{%(!.red.yellow)}%n%f' PROMPT+=' at %F{${SSH_CONNECTION:+blue}${SSH_CONNECTION:-green}}%m%f' PROMPT+=' in %F{cyan}%~%f' + PROMPT+='$(prompt_vcs_info 2>/dev/null)' PROMPT+=' ' - PROMPT+='${_PROMPT_EXEC_TIME:+" %F{yellow}$_PROMPT_EXEC_TIME%f"}' + PROMPT+='${_PROMPT_EXEC_TIME:+" %F{yellow}$(prompt_escape "$_PROMPT_EXEC_TIME")%f"}' PROMPT+='%(?.. %F{red}EXIT:%?%f)' PROMPT+='%1(j. %F{blue}JOBS:%j%f.)' PROMPT+=$'\n' From fa7290f9a9dd40729e6864de01858cb346e6a6ca Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 19 Aug 2019 12:22:37 +0300 Subject: [PATCH 165/713] [zsh] make mkdir verbose --- zsh/aliases.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index bed3ce8..c55ca47 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -49,6 +49,7 @@ alias rmdir='rmdir -v' alias chmod='chmod -v' alias chown='chown -v' alias ln='ln -iv' +alias mkdir='mkdir -v' # print file sizes in human readable format alias du='du -h' From 41fdc52950202e183163eadc746e991d25c9d36c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 20 Aug 2019 21:55:57 +0300 Subject: [PATCH 166/713] [git] turn off custom commit format --- gitconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gitconfig b/gitconfig index 0060f46..35cffee 100644 --- a/gitconfig +++ b/gitconfig @@ -6,9 +6,9 @@ [log] abbrevCommit = true - decorate = true -[format] - pretty = %C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset) + ; decorate = true +; [format] + ; pretty = %C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset) [core] pager = diff-so-fancy | less --tabs=4 --RAW-CONTROL-CHARS From a420aafa79f7a9ac1e8e5c72a03c0834f4b47d1c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 21 Aug 2019 12:47:17 +0300 Subject: [PATCH 167/713] [nvim] add man to ignored filetypes of IndentLine --- nvim/lib/editing.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lib/editing.vim b/nvim/lib/editing.vim index a44d01b..021f59e 100644 --- a/nvim/lib/editing.vim +++ b/nvim/lib/editing.vim @@ -26,7 +26,7 @@ set foldmethod=marker let g:indentLine_char = "\u2502" let g:indentLine_first_char = g:indentLine_char let g:indentLine_showFirstIndentLevel = 1 - let g:indentLine_fileTypeExclude = ['text', 'help', 'tutor'] + let g:indentLine_fileTypeExclude = ['text', 'help', 'tutor', 'man'] " }}} From e477df7a159e2886c6a28d737ef30f645baa48fc Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 24 Aug 2019 17:30:45 +0300 Subject: [PATCH 168/713] [git] add global gitignore --- gitconfig => git/gitconfig | 0 git/gitignore_global | 1 + 2 files changed, 1 insertion(+) rename gitconfig => git/gitconfig (100%) create mode 100644 git/gitignore_global diff --git a/gitconfig b/git/gitconfig similarity index 100% rename from gitconfig rename to git/gitconfig diff --git a/git/gitignore_global b/git/gitignore_global new file mode 100644 index 0000000..d992b6f --- /dev/null +++ b/git/gitignore_global @@ -0,0 +1 @@ +Session.vim From 2325f94e1b74d49bc68271bb1ca2df02aeba2eae Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 24 Aug 2019 19:05:09 +0300 Subject: [PATCH 169/713] create automatic colorscheme generator --- colorschemes/_theme.py | 54 ++++++ colorschemes/build.sh | 20 +++ colorschemes/iterm.py | 52 ++++++ colorschemes/kitty.py | 16 ++ colorschemes/nvim.py | 19 ++ colorschemes/out/iterm.itermcolors | 270 +++++++++++++++++++++++++++++ colorschemes/out/kitty.conf | 26 +++ colorschemes/out/nvim.vim | 36 ++++ colorschemes/out/termux.properties | 19 ++ colorschemes/termux.py | 14 ++ kitty/kitty.conf | 56 +++--- nvim/init.vim | 6 +- nvim/lib/colorscheme.vim | 24 +-- 13 files changed, 561 insertions(+), 51 deletions(-) create mode 100644 colorschemes/_theme.py create mode 100755 colorschemes/build.sh create mode 100755 colorschemes/iterm.py create mode 100755 colorschemes/kitty.py create mode 100755 colorschemes/nvim.py create mode 100644 colorschemes/out/iterm.itermcolors create mode 100644 colorschemes/out/kitty.conf create mode 100644 colorschemes/out/nvim.vim create mode 100644 colorschemes/out/termux.properties create mode 100755 colorschemes/termux.py diff --git a/colorschemes/_theme.py b/colorschemes/_theme.py new file mode 100644 index 0000000..7e9dfcb --- /dev/null +++ b/colorschemes/_theme.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python + +# base16-eighties by Chris Kempson (http://chriskempson.com) +base16_colors = [ + "#2d2d2d", # 0 + "#393939", # 1 + "#515151", # 2 + "#747369", # 3 + "#a09f93", # 4 + "#d3d0c8", # 5 + "#e8e6df", # 6 + "#f2f0ec", # 7 + "#f2777a", # 8 + "#f99157", # 9 + "#ffcc66", # a + "#99cc99", # b + "#66cccc", # c + "#6699cc", # d + "#cc99cc", # e + "#d27b53", # f +] + +bg = base16_colors[0x0] +fg = base16_colors[0x5] + +cursor_bg = fg +cursor_fg = bg + +selection_bg = base16_colors[0x2] +selection_fg = fg + +ansi_colors = [ + base16_colors[i] + for i in [ + 0x0, + 0x8, + 0xB, + 0xA, + 0xD, + 0xE, + 0xC, + 0x5, + 0x3, + 0x8, + 0xB, + 0xA, + 0xD, + 0xE, + 0xC, + 0x7, + ] +] + +link_color = ansi_colors[12] diff --git a/colorschemes/build.sh b/colorschemes/build.sh new file mode 100755 index 0000000..2b5891a --- /dev/null +++ b/colorschemes/build.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "${BASH_SOURCE[0]}")" + +mkdir -p out + +declare -A apps=( + [nvim]=vim + [iterm]=itermcolors + [kitty]=conf + [termux]=properties +) + +for app in "${!apps[@]}"; do + output_file="$app.${apps[$app]}" + echo "$output_file" + ./"$app".py > ./out/"$output_file" +done diff --git a/colorschemes/iterm.py b/colorschemes/iterm.py new file mode 100755 index 0000000..4931105 --- /dev/null +++ b/colorschemes/iterm.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python + +import _theme as theme + +print( + """\ + + + +\ +""" +) + + +def print_color(key_name, color): + r, g, b = [float(int(color[2 * i + 1 : 2 * i + 3], 16)) / 255 for i in range(3)] + print( + """\ + {} Color + + Color Space + sRGB + Red Component + {} + Green Component + {} + Blue Component + {} + \ +""".format( + key_name, r, g, b + ) + ) + + +print_color("Background", theme.bg) +print_color("Foreground", theme.fg) +print_color("Bold", theme.fg) +print_color("Cursor", theme.cursor_bg) +print_color("Cursor Text", theme.cursor_fg) +print_color("Selection Color", theme.selection_bg) +print_color("Selected Text Color", theme.selection_fg) +for index, color in enumerate(theme.ansi_colors): + print_color("Ansi " + str(index), color) +print_color("Link", theme.link_color) + +print( + """\ + +\ +""" +) diff --git a/colorschemes/kitty.py b/colorschemes/kitty.py new file mode 100755 index 0000000..7740588 --- /dev/null +++ b/colorschemes/kitty.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import _theme as theme + +print("background", theme.bg) +print("foreground", theme.fg) +print("cursor", theme.cursor_bg) +print("cursor_text_color", theme.cursor_fg) +print("selection_background", theme.selection_bg) +print("selection_foreground", theme.selection_fg) +for index, color in enumerate(theme.ansi_colors): + print("color" + str(index), color) +print("url_color", theme.link_color) +print("active_border_color", theme.ansi_colors[2]) +print("inactive_border_color", theme.ansi_colors[8]) +print("bell_border_color", theme.ansi_colors[1]) diff --git a/colorschemes/nvim.py b/colorschemes/nvim.py new file mode 100755 index 0000000..c7a6155 --- /dev/null +++ b/colorschemes/nvim.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +import _theme as theme + +print("let colorscheme_base16_colors = [") +gui_to_cterm_mapping = [0, 18, 19, 8, 20, 7, 21, 15, 1, 16, 3, 2, 6, 4, 5, 17] +for colors_pair in zip(theme.base16_colors, gui_to_cterm_mapping): + print("\\ {{'gui': '{}', 'cterm': '{:>02}'}},".format(*colors_pair)) +print("\\ ]") + + +def print_terminal_color(key_name, color): + print("let terminal_color_{} = '{}'".format(key_name, color)) + + +print_terminal_color("background", theme.bg) +print_terminal_color("foreground", theme.fg) +for index, color in enumerate(theme.ansi_colors): + print_terminal_color(str(index), color) diff --git a/colorschemes/out/iterm.itermcolors b/colorschemes/out/iterm.itermcolors new file mode 100644 index 0000000..1d03f1c --- /dev/null +++ b/colorschemes/out/iterm.itermcolors @@ -0,0 +1,270 @@ + + + + + Background Color + + Color Space + sRGB + Red Component + 0.17647058823529413 + Green Component + 0.17647058823529413 + Blue Component + 0.17647058823529413 + + Foreground Color + + Color Space + sRGB + Red Component + 0.8274509803921568 + Green Component + 0.8156862745098039 + Blue Component + 0.7843137254901961 + + Bold Color + + Color Space + sRGB + Red Component + 0.8274509803921568 + Green Component + 0.8156862745098039 + Blue Component + 0.7843137254901961 + + Cursor Color + + Color Space + sRGB + Red Component + 0.8274509803921568 + Green Component + 0.8156862745098039 + Blue Component + 0.7843137254901961 + + Cursor Text Color + + Color Space + sRGB + Red Component + 0.17647058823529413 + Green Component + 0.17647058823529413 + Blue Component + 0.17647058823529413 + + Selection Color Color + + Color Space + sRGB + Red Component + 0.3176470588235294 + Green Component + 0.3176470588235294 + Blue Component + 0.3176470588235294 + + Selected Text Color Color + + Color Space + sRGB + Red Component + 0.8274509803921568 + Green Component + 0.8156862745098039 + Blue Component + 0.7843137254901961 + + Ansi 0 Color + + Color Space + sRGB + Red Component + 0.17647058823529413 + Green Component + 0.17647058823529413 + Blue Component + 0.17647058823529413 + + Ansi 1 Color + + Color Space + sRGB + Red Component + 0.9490196078431372 + Green Component + 0.4666666666666667 + Blue Component + 0.47843137254901963 + + Ansi 2 Color + + Color Space + sRGB + Red Component + 0.6 + Green Component + 0.8 + Blue Component + 0.6 + + Ansi 3 Color + + Color Space + sRGB + Red Component + 1.0 + Green Component + 0.8 + Blue Component + 0.4 + + Ansi 4 Color + + Color Space + sRGB + Red Component + 0.4 + Green Component + 0.6 + Blue Component + 0.8 + + Ansi 5 Color + + Color Space + sRGB + Red Component + 0.8 + Green Component + 0.6 + Blue Component + 0.8 + + Ansi 6 Color + + Color Space + sRGB + Red Component + 0.4 + Green Component + 0.8 + Blue Component + 0.8 + + Ansi 7 Color + + Color Space + sRGB + Red Component + 0.8274509803921568 + Green Component + 0.8156862745098039 + Blue Component + 0.7843137254901961 + + Ansi 8 Color + + Color Space + sRGB + Red Component + 0.4549019607843137 + Green Component + 0.45098039215686275 + Blue Component + 0.4117647058823529 + + Ansi 9 Color + + Color Space + sRGB + Red Component + 0.9490196078431372 + Green Component + 0.4666666666666667 + Blue Component + 0.47843137254901963 + + Ansi 10 Color + + Color Space + sRGB + Red Component + 0.6 + Green Component + 0.8 + Blue Component + 0.6 + + Ansi 11 Color + + Color Space + sRGB + Red Component + 1.0 + Green Component + 0.8 + Blue Component + 0.4 + + Ansi 12 Color + + Color Space + sRGB + Red Component + 0.4 + Green Component + 0.6 + Blue Component + 0.8 + + Ansi 13 Color + + Color Space + sRGB + Red Component + 0.8 + Green Component + 0.6 + Blue Component + 0.8 + + Ansi 14 Color + + Color Space + sRGB + Red Component + 0.4 + Green Component + 0.8 + Blue Component + 0.8 + + Ansi 15 Color + + Color Space + sRGB + Red Component + 0.9490196078431372 + Green Component + 0.9411764705882353 + Blue Component + 0.9254901960784314 + + Link Color + + Color Space + sRGB + Red Component + 0.4 + Green Component + 0.6 + Blue Component + 0.8 + + + diff --git a/colorschemes/out/kitty.conf b/colorschemes/out/kitty.conf new file mode 100644 index 0000000..8db5b80 --- /dev/null +++ b/colorschemes/out/kitty.conf @@ -0,0 +1,26 @@ +background #2d2d2d +foreground #d3d0c8 +cursor #d3d0c8 +cursor_text_color #2d2d2d +selection_background #515151 +selection_foreground #d3d0c8 +color0 #2d2d2d +color1 #f2777a +color2 #99cc99 +color3 #ffcc66 +color4 #6699cc +color5 #cc99cc +color6 #66cccc +color7 #d3d0c8 +color8 #747369 +color9 #f2777a +color10 #99cc99 +color11 #ffcc66 +color12 #6699cc +color13 #cc99cc +color14 #66cccc +color15 #f2f0ec +url_color #6699cc +active_border_color #99cc99 +inactive_border_color #747369 +bell_border_color #f2777a diff --git a/colorschemes/out/nvim.vim b/colorschemes/out/nvim.vim new file mode 100644 index 0000000..a7b1240 --- /dev/null +++ b/colorschemes/out/nvim.vim @@ -0,0 +1,36 @@ +let colorscheme_base16_colors = [ +\ {'gui': '#2d2d2d', 'cterm': '00'}, +\ {'gui': '#393939', 'cterm': '18'}, +\ {'gui': '#515151', 'cterm': '19'}, +\ {'gui': '#747369', 'cterm': '08'}, +\ {'gui': '#a09f93', 'cterm': '20'}, +\ {'gui': '#d3d0c8', 'cterm': '07'}, +\ {'gui': '#e8e6df', 'cterm': '21'}, +\ {'gui': '#f2f0ec', 'cterm': '15'}, +\ {'gui': '#f2777a', 'cterm': '01'}, +\ {'gui': '#f99157', 'cterm': '16'}, +\ {'gui': '#ffcc66', 'cterm': '03'}, +\ {'gui': '#99cc99', 'cterm': '02'}, +\ {'gui': '#66cccc', 'cterm': '06'}, +\ {'gui': '#6699cc', 'cterm': '04'}, +\ {'gui': '#cc99cc', 'cterm': '05'}, +\ {'gui': '#d27b53', 'cterm': '17'}, +\ ] +let terminal_color_background = '#2d2d2d' +let terminal_color_foreground = '#d3d0c8' +let terminal_color_0 = '#2d2d2d' +let terminal_color_1 = '#f2777a' +let terminal_color_2 = '#99cc99' +let terminal_color_3 = '#ffcc66' +let terminal_color_4 = '#6699cc' +let terminal_color_5 = '#cc99cc' +let terminal_color_6 = '#66cccc' +let terminal_color_7 = '#d3d0c8' +let terminal_color_8 = '#747369' +let terminal_color_9 = '#f2777a' +let terminal_color_10 = '#99cc99' +let terminal_color_11 = '#ffcc66' +let terminal_color_12 = '#6699cc' +let terminal_color_13 = '#cc99cc' +let terminal_color_14 = '#66cccc' +let terminal_color_15 = '#f2f0ec' diff --git a/colorschemes/out/termux.properties b/colorschemes/out/termux.properties new file mode 100644 index 0000000..70f5a30 --- /dev/null +++ b/colorschemes/out/termux.properties @@ -0,0 +1,19 @@ +background=#2d2d2d +foreground=#d3d0c8 +cursor=#d3d0c8 +color0=#2d2d2d +color1=#f2777a +color2=#99cc99 +color3=#ffcc66 +color4=#6699cc +color5=#cc99cc +color6=#66cccc +color7=#d3d0c8 +color8=#747369 +color9=#f2777a +color10=#99cc99 +color11=#ffcc66 +color12=#6699cc +color13=#cc99cc +color14=#66cccc +color15=#f2f0ec diff --git a/colorschemes/termux.py b/colorschemes/termux.py new file mode 100755 index 0000000..337cc4c --- /dev/null +++ b/colorschemes/termux.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +import _theme as theme + + +def print_color(key_name, color): + print("{}={}".format(key_name, color)) + + +print_color("background", theme.bg) +print_color("foreground", theme.fg) +print_color("cursor", theme.cursor_bg) +for index, color in enumerate(theme.ansi_colors): + print_color("color" + str(index), color) diff --git a/kitty/kitty.conf b/kitty/kitty.conf index bc34301..30b075e 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -1,4 +1,4 @@ -# vim:fileencoding=utf-8:ft=conf:foldmethod=marker +include ../colorschemes/out/kitty.conf #: Fonts {{{ @@ -6,7 +6,7 @@ #: individual font faces and even specify special fonts for particular #: characters. -font_family Ubuntu Mono derivative Powerline +# font_family monospace # bold_font auto # italic_font auto # bold_italic_font auto @@ -59,11 +59,11 @@ font_family Ubuntu Mono derivative Powerline #: Cursor customization {{{ -cursor #d3d0c8 +# cursor #cccccc #: Default cursor color -cursor_text_color #2d2d2d +# cursor_text_color #111111 #: Choose the color of text under the cursor. If you want it rendered #: with the background color of the cell underneath instead, use the @@ -114,7 +114,7 @@ cursor_stop_blinking_after 0 #: Mouse {{{ -url_color #6699cc +# url_color #0087bd url_style single #: The color and style for highlighting URLs on mouse-over. url_style @@ -281,15 +281,15 @@ window_padding_width 2.0 #: The window padding (in pts) (blank area between the text and the #: window border) -active_border_color #99cc99 +# active_border_color #00ff00 #: The color for the border of the active window -inactive_border_color #747369 +# inactive_border_color #cccccc #: The color for the border of inactive windows -bell_border_color #f2777a +# bell_border_color #ff5a00 #: The color for the border of inactive windows in which a bell has #: occurred @@ -346,8 +346,8 @@ inactive_tab_font_style italic #: Color scheme {{{ -foreground #d3d0c8 -background #2d2d2d +# foreground #dddddd +# background #000000 #: The foreground and background colors @@ -375,8 +375,8 @@ background #2d2d2d #: How much to dim text that has the DIM/FAINT attribute set. One #: means no dimming and zero means fully dimmed (i.e. invisible). -selection_foreground #d3d0c8 -selection_background #515151 +# selection_foreground #000000 +# selection_background #fffacd #: The foreground and background for text selected with the mouse @@ -385,43 +385,43 @@ selection_background #515151 #: dull and bright version. You can also set the remaining colors from #: the 256 color table as color16 to color255. -color0 #2d2d2d -color8 #747369 +# color0 #000000 +# color8 #767676 #: black -color1 #f2777a -color9 #f2777a +# color1 #cc0403 +# color9 #f2201f #: red -color2 #99cc99 -color10 #99cc99 +# color2 #19cb00 +# color10 #23fd00 #: green -color3 #ffcc66 -color11 #ffcc66 +# color3 #cecb00 +# color11 #fffd00 #: yellow -color4 #6699cc -color12 #6699cc +# color4 #0d73cc +# color12 #1a8fff #: blue -color5 #cc99cc -color13 #cc99cc +# color5 #cb1ed1 +# color13 #fd28ff #: magenta -color6 #66cccc -color14 #66cccc +# color6 #0dcdcd +# color14 #14ffff #: cyan -color7 #d3d0c8 -color15 #f2f0ec +# color7 #dddddd +# color15 #ffffff #: white diff --git a/nvim/init.vim b/nvim/init.vim index 2a549bb..47384cb 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,11 +1,11 @@ -let s:my_config_dir = expand(':p:h') +let g:nvim_dotfiles_dir = expand(':p:h') let g:vim_ide = get(g:, 'vim_ide', 0) for s:name in ['plugins', 'editing', 'interface', 'colorscheme', 'files', 'completion', 'terminal', 'git'] - execute 'source' fnameescape(s:my_config_dir.'/lib/'.s:name.'.vim') + execute 'source' fnameescape(g:nvim_dotfiles_dir.'/lib/'.s:name.'.vim') endfor -for s:path in globpath(s:my_config_dir.'/lib/languages', '*', 0, 1) +for s:path in globpath(g:nvim_dotfiles_dir.'/lib/languages', '*', 0, 1) execute 'source' fnameescape(s:path) endfor diff --git a/nvim/lib/colorscheme.vim b/nvim/lib/colorscheme.vim index 2a6bc7f..09dde0b 100644 --- a/nvim/lib/colorscheme.vim +++ b/nvim/lib/colorscheme.vim @@ -5,31 +5,15 @@ let s:base16_theme_name = 'eighties' " Color definitions {{{ - if empty($BASE16_SHELL) || !filereadable($BASE16_SHELL . '/scripts/base16-' . s:base16_theme_name . '.sh') || &termguicolors + if empty($BASE16_SHELL) || !filereadable($BASE16_SHELL.'/scripts/base16-'.s:base16_theme_name.'.sh') || &termguicolors set termguicolors else " call system(shellescape(s:base16_shell_script)) endif - " Eighties scheme by Chris Kempson (http://chriskempson.com) - let s:colors = [ - \ {'gui': '#2d2d2d', 'cterm': '00'}, - \ {'gui': '#393939', 'cterm': '18'}, - \ {'gui': '#515151', 'cterm': '19'}, - \ {'gui': '#747369', 'cterm': '08'}, - \ {'gui': '#a09f93', 'cterm': '20'}, - \ {'gui': '#d3d0c8', 'cterm': '07'}, - \ {'gui': '#e8e6df', 'cterm': '21'}, - \ {'gui': '#f2f0ec', 'cterm': '15'}, - \ {'gui': '#f2777a', 'cterm': '01'}, - \ {'gui': '#f99157', 'cterm': '16'}, - \ {'gui': '#ffcc66', 'cterm': '03'}, - \ {'gui': '#99cc99', 'cterm': '02'}, - \ {'gui': '#66cccc', 'cterm': '06'}, - \ {'gui': '#6699cc', 'cterm': '04'}, - \ {'gui': '#cc99cc', 'cterm': '05'}, - \ {'gui': '#d27b53', 'cterm': '17'} - \ ] + execute 'source' fnameescape(g:nvim_dotfiles_dir.'/../colorschemes/out/nvim.vim') + let s:colors = g:colorscheme_base16_colors + unlet g:colorscheme_base16_colors " }}} From 54455cbd00b77f339c48c917d08ad6b748a218a9 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 25 Aug 2019 10:54:43 +0300 Subject: [PATCH 170/713] add tmux config --- install.zsh | 8 +++++++- tmux/tmux.conf | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tmux/tmux.conf diff --git a/install.zsh b/install.zsh index 529880c..7968da3 100755 --- a/install.zsh +++ b/install.zsh @@ -10,7 +10,8 @@ install_dotfile() { mv -vi "$dest" "$dest.dmitmel-dotfiles-backup" fi - mkdir -p "${dest:h}" + mkdir -pv "${dest:h}" + echo "installing dotfile '$dest'" echo "$contents" > "$dest" } @@ -30,3 +31,8 @@ done file_name=kitty.conf file_path="$DOTFILES_PATH/kitty/$file_name" install_dotfile "$HOME/.config/kitty/$file_name" "include ${(q)file_path}" + +# tmux +file_name=tmux.conf +file_path="$DOTFILES_PATH/tmux/$file_name" +install_dotfile "$HOME/.$file_name" "source-file ${(q)file_path}" diff --git a/tmux/tmux.conf b/tmux/tmux.conf new file mode 100644 index 0000000..dadf25b --- /dev/null +++ b/tmux/tmux.conf @@ -0,0 +1 @@ +set -g default-terminal "tmux-256color" From 92c335b627580c266f3e36468f244037293c7c2c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 25 Aug 2019 11:34:11 +0300 Subject: [PATCH 171/713] [colorschemes] add name --- colorschemes/_theme.py | 2 ++ colorschemes/nvim.py | 4 +++- colorschemes/out/nvim.vim | 4 +++- nvim/lib/colorscheme.vim | 16 ++++++++-------- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/colorschemes/_theme.py b/colorschemes/_theme.py index 7e9dfcb..c9660bc 100644 --- a/colorschemes/_theme.py +++ b/colorschemes/_theme.py @@ -1,6 +1,8 @@ #!/usr/bin/env python # base16-eighties by Chris Kempson (http://chriskempson.com) +base16_name = "eighties" +name = "base16-" + base16_name base16_colors = [ "#2d2d2d", # 0 "#393939", # 1 diff --git a/colorschemes/nvim.py b/colorschemes/nvim.py index c7a6155..700c3d3 100755 --- a/colorschemes/nvim.py +++ b/colorschemes/nvim.py @@ -2,7 +2,9 @@ import _theme as theme -print("let colorscheme_base16_colors = [") +print("let my_colorscheme_name = '{}'".format(theme.name)) +print("let my_colorscheme_base16_name = '{}'".format(theme.base16_name)) +print("let my_colorscheme_base16_colors = [") gui_to_cterm_mapping = [0, 18, 19, 8, 20, 7, 21, 15, 1, 16, 3, 2, 6, 4, 5, 17] for colors_pair in zip(theme.base16_colors, gui_to_cterm_mapping): print("\\ {{'gui': '{}', 'cterm': '{:>02}'}},".format(*colors_pair)) diff --git a/colorschemes/out/nvim.vim b/colorschemes/out/nvim.vim index a7b1240..b1fe373 100644 --- a/colorschemes/out/nvim.vim +++ b/colorschemes/out/nvim.vim @@ -1,4 +1,6 @@ -let colorscheme_base16_colors = [ +let my_colorscheme_name = 'base16-eighties' +let my_colorscheme_base16_name = 'eighties' +let my_colorscheme_base16_colors = [ \ {'gui': '#2d2d2d', 'cterm': '00'}, \ {'gui': '#393939', 'cterm': '18'}, \ {'gui': '#515151', 'cterm': '19'}, diff --git a/nvim/lib/colorscheme.vim b/nvim/lib/colorscheme.vim index 09dde0b..aeefbd9 100644 --- a/nvim/lib/colorscheme.vim +++ b/nvim/lib/colorscheme.vim @@ -1,20 +1,20 @@ " modified version of base16-vim (https://github.com/chriskempson/base16-vim) " by Chris Kempson (http://chriskempson.com) -let s:base16_theme_name = 'eighties' - " Color definitions {{{ + execute 'source' fnameescape(g:nvim_dotfiles_dir.'/../colorschemes/out/nvim.vim') + let s:colors = g:my_colorscheme_base16_colors + let s:theme_name = g:my_colorscheme_name + let s:base16_theme_name = g:my_colorscheme_base16_name + unlet g:my_colorscheme_name g:my_colorscheme_base16_name g:my_colorscheme_base16_colors + if empty($BASE16_SHELL) || !filereadable($BASE16_SHELL.'/scripts/base16-'.s:base16_theme_name.'.sh') || &termguicolors set termguicolors else - " call system(shellescape(s:base16_shell_script)) + " call system(shellescape($BASE16_SHELL.'/scripts/base16-'.s:base16_theme_name.'.sh')) endif - execute 'source' fnameescape(g:nvim_dotfiles_dir.'/../colorschemes/out/nvim.vim') - let s:colors = g:colorscheme_base16_colors - unlet g:colorscheme_base16_colors - " }}} " Neovim terminal colors {{{ @@ -32,7 +32,7 @@ let s:base16_theme_name = 'eighties' " Theme setup {{{ hi clear syntax reset - let g:colors_name = 'base16-' . s:base16_theme_name + let g:colors_name = s:theme_name " }}} " Highlighting function {{{ From cc5dec6bdc19567afb9a8532b395ef39dbca0481 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 25 Aug 2019 17:15:59 +0300 Subject: [PATCH 172/713] [zsh] add colortest script --- zsh/bin/colortest | 2 + zsh/bin/colortest.awk | 110 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100755 zsh/bin/colortest create mode 100644 zsh/bin/colortest.awk diff --git a/zsh/bin/colortest b/zsh/bin/colortest new file mode 100755 index 0000000..5252675 --- /dev/null +++ b/zsh/bin/colortest @@ -0,0 +1,2 @@ +#!/bin/sh +exec awk -f "$(dirname "$0")/colortest.awk" diff --git a/zsh/bin/colortest.awk b/zsh/bin/colortest.awk new file mode 100644 index 0000000..7ea8fa4 --- /dev/null +++ b/zsh/bin/colortest.awk @@ -0,0 +1,110 @@ +#!/usr/bin/awk -f + +BEGIN { + print ""; + test_standard_colors(); + print ""; + test_base16_colorscheme(); + print ""; + test_6x6x6_cube(); + print ""; + test_grayscale(); + print ""; + test_true_color(); + print ""; +} + +function print_color(color) { + printf "\033[48;5;%sm \033[0m", color +} + +function test_standard_colors() { + print "16 standard colors:"; + for (color = 0; color < 16; color += 1) print_color(color); + print ""; +} + +function test_base16_colorscheme() { + print "base16 colorscheme:"; + split("0 18 19 8 20 7 21 15 1 16 3 2 6 4 5 17", colors, " "); + for (i = 1; i <= length(colors); i++) print_color(colors[i]); + print ""; +} + +function test_6x6x6_cube() { + print "6x6x6 cube (216 colors):"; + block_grid_w = 3; + block_grid_h = 2; + for (block_y = 0; block_y < block_grid_h; block_y++) { + for (row = 0; row < 6; row++) { + for (block_x = 0; block_x < block_grid_w; block_x++) { + for (col = 0; col < 6; col++) { + print_color(16 + col + 6*row + 6*6*block_x + block_grid_w*6*6*block_y); + } + } + print ""; + } + } +} + +function test_grayscale() { + print "grayscale from black to white in 24 steps:"; + for (color = 0; color < 24; color += 1) { + print_color(16 + 6*6*6 + color) + } + print ""; +} + +function test_true_color() { + print "24-bit true color test:" + colors_count = 360; + for (h = 0; h < colors_count; h++) { + hsv_to_rgb(h / colors_count, 1, 1, rgb); + for (i = 0; i < 3; i++) rgb[i] = int(rgb[i] * 255); + r = rgb[0]; + g = rgb[1]; + b = rgb[2]; + printf "\033[48;2;%d;%d;%dm", r,g,b; + printf " \033[0m"; + } + print ""; +} + +function hsv_to_rgb(h, s, v, rgb) { + if (s == 0) { + rgb[0] = rgb[1] = rgb[2] = v; + } else { + h *= 6; + i = int(h); + f = h - i; + p = v * (1 - s); + q = v * (1 - s * f); + t = v * (1 - s * (1 - f)); + + if (i == 0) { + rgb[0] = v; + rgb[1] = t; + rgb[2] = p; + } else if (i == 1) { + rgb[0] = q; + rgb[1] = v; + rgb[2] = p; + } else if (i == 2) { + rgb[0] = p; + rgb[1] = v; + rgb[2] = t; + } else if (i == 3) { + rgb[0] = p; + rgb[1] = q; + rgb[2] = v; + } else if (i == 4) { + rgb[0] = t; + rgb[1] = p; + rgb[2] = v; + } else if (i == 5) { + rgb[0] = v; + rgb[1] = p; + rgb[2] = q; + } + } +} From c020e75725250258ce0489ecf8d78295ec03bed5 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 25 Aug 2019 21:45:10 +0300 Subject: [PATCH 173/713] [zsh] diff colors by default --- zsh/aliases.zsh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index c55ca47..a1f8046 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -13,10 +13,7 @@ alias sudo='sudo ' alias cdd='dirs -v' alias grep='grep --color=auto' - -if ! command_exists colordiff; then - alias colordiff='diff --color' -fi +alias diff='diff --color=auto' # exa is a modern replacement for ls - https://the.exa.website/ if command_exists exa; then @@ -24,7 +21,7 @@ if command_exists exa; then alias lsa="${aliases[ls]} --all" alias l="${aliases[ls]} --long --header --binary --group" alias la="${aliases[l]} --all" - alias tree="exa -T" + alias tree="${aliases[ls]} --tree" else alias ls="ls --classify --group-directories-first --color=auto" alias lsa="${aliases[ls]} --almost-all" From 13b6ba6bd4cbaab769e92557173be1d11652f636 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 26 Aug 2019 02:02:27 +0300 Subject: [PATCH 174/713] [nvim] improve AWK syntax highlighting --- nvim/lib/colorscheme.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nvim/lib/colorscheme.vim b/nvim/lib/colorscheme.vim index aeefbd9..2377b23 100644 --- a/nvim/lib/colorscheme.vim +++ b/nvim/lib/colorscheme.vim @@ -151,6 +151,18 @@ " }}} +" AWK {{{ + hi! link awkArrayElement Number + hi! link awkBoolLogic Operator + hi! link awkComma Delimiter + hi! link awkExpression Operator + hi! link awkFieldVars awkVariables + hi! link awkOperator Operator + hi! link awkPatterns Label + hi! link awkSemicolon Delimiter + hi! link awkVariables Variable +" }}} + " Diff {{{ " diff mode call s:hi('DiffAdd', 0xB, 0x1, '', '') From cc7ab02507d53b9022a39d671e5e52940497c4fe Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 26 Aug 2019 02:03:17 +0300 Subject: [PATCH 175/713] [nvim] change EasyAlign binding to ga --- nvim/lib/editing.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nvim/lib/editing.vim b/nvim/lib/editing.vim index 021f59e..83d758c 100644 --- a/nvim/lib/editing.vim +++ b/nvim/lib/editing.vim @@ -154,6 +154,6 @@ set foldmethod=marker let g:pencil#conceallevel = 0 let g:pencil#cursorwrap = 0 - xmap ga (LiveEasyAlign) - nmap ga (LiveEasyAlign) + xmap ga (LiveEasyAlign) + nmap ga (LiveEasyAlign) " }}} From 6b14d6c4be7797e616ba385b74fed9dba841dfa9 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 26 Aug 2019 14:54:06 +0300 Subject: [PATCH 176/713] [colorschemes] force Python 3 --- colorschemes/_theme.py | 2 +- colorschemes/iterm.py | 2 +- colorschemes/kitty.py | 7 ++++++- colorschemes/nvim.py | 2 +- colorschemes/termux.py | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/colorschemes/_theme.py b/colorschemes/_theme.py index c9660bc..f58af99 100644 --- a/colorschemes/_theme.py +++ b/colorschemes/_theme.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # base16-eighties by Chris Kempson (http://chriskempson.com) base16_name = "eighties" diff --git a/colorschemes/iterm.py b/colorschemes/iterm.py index 4931105..392d183 100755 --- a/colorschemes/iterm.py +++ b/colorschemes/iterm.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import _theme as theme diff --git a/colorschemes/kitty.py b/colorschemes/kitty.py index 7740588..e20011c 100755 --- a/colorschemes/kitty.py +++ b/colorschemes/kitty.py @@ -1,7 +1,12 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import _theme as theme + +def print_color(key_name, color): + print("{} {}".format(key_name, color)) + + print("background", theme.bg) print("foreground", theme.fg) print("cursor", theme.cursor_bg) diff --git a/colorschemes/nvim.py b/colorschemes/nvim.py index 700c3d3..d322bd4 100755 --- a/colorschemes/nvim.py +++ b/colorschemes/nvim.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import _theme as theme diff --git a/colorschemes/termux.py b/colorschemes/termux.py index 337cc4c..ddcb3b4 100755 --- a/colorschemes/termux.py +++ b/colorschemes/termux.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import _theme as theme From f2d12e2ebe184a6a0e9b1bb1151afa2c1c0219f7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 26 Aug 2019 15:29:52 +0300 Subject: [PATCH 177/713] [zsh] add colortest2 script --- zsh/bin/colortest | 7 +++++- zsh/bin/colortest.awk | 32 +++++++++------------------ zsh/bin/colortest2 | 9 ++++++++ zsh/bin/colortest2.awk | 50 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 23 deletions(-) create mode 100755 zsh/bin/colortest2 create mode 100644 zsh/bin/colortest2.awk diff --git a/zsh/bin/colortest b/zsh/bin/colortest index 5252675..a433d53 100755 --- a/zsh/bin/colortest +++ b/zsh/bin/colortest @@ -1,2 +1,7 @@ #!/bin/sh -exec awk -f "$(dirname "$0")/colortest.awk" + +set -e + +script_dir="$(dirname "$0")" + +exec awk -f "${script_dir}/colortest.awk" diff --git a/zsh/bin/colortest.awk b/zsh/bin/colortest.awk index 7ea8fa4..cf66228 100644 --- a/zsh/bin/colortest.awk +++ b/zsh/bin/colortest.awk @@ -59,7 +59,7 @@ function test_true_color() { print "24-bit true color test:" colors_count = 360; for (h = 0; h < colors_count; h++) { - hsv_to_rgb(h / colors_count, 1, 1, rgb); + hsv2rgb(h / colors_count, 1, 1, rgb); for (i = 0; i < 3; i++) rgb[i] = int(rgb[i] * 255); r = rgb[0]; g = rgb[1]; @@ -70,9 +70,9 @@ function test_true_color() { print ""; } -function hsv_to_rgb(h, s, v, rgb) { +function hsv2rgb(h, s, v, rgb) { if (s == 0) { - rgb[0] = rgb[1] = rgb[2] = v; + r = g = b = v; } else { h *= 6; i = int(h); @@ -80,31 +80,19 @@ function hsv_to_rgb(h, s, v, rgb) { p = v * (1 - s); q = v * (1 - s * f); t = v * (1 - s * (1 - f)); - if (i == 0) { - rgb[0] = v; - rgb[1] = t; - rgb[2] = p; + r = v; g = t; b = p; } else if (i == 1) { - rgb[0] = q; - rgb[1] = v; - rgb[2] = p; + r = q; g = v; b = p; } else if (i == 2) { - rgb[0] = p; - rgb[1] = v; - rgb[2] = t; + r = p; g = v; b = t; } else if (i == 3) { - rgb[0] = p; - rgb[1] = q; - rgb[2] = v; + r = p; g = q; b = v; } else if (i == 4) { - rgb[0] = t; - rgb[1] = p; - rgb[2] = v; + r = t; g = p; b = v; } else if (i == 5) { - rgb[0] = v; - rgb[1] = p; - rgb[2] = q; + r = v; g = p; b = q; } } + rgb[0] = r; rgb[1] = g; rgb[2] = b; } diff --git a/zsh/bin/colortest2 b/zsh/bin/colortest2 new file mode 100755 index 0000000..e48db93 --- /dev/null +++ b/zsh/bin/colortest2 @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +script_dir="$(dirname "$0")" +cols="$(tput cols)" +lines="$(tput lines)" + +exec awk -v WIDTH="$((cols/2))" -v HEIGHT="$lines" -f "${script_dir}/colortest2.awk" diff --git a/zsh/bin/colortest2.awk b/zsh/bin/colortest2.awk new file mode 100644 index 0000000..7b53976 --- /dev/null +++ b/zsh/bin/colortest2.awk @@ -0,0 +1,50 @@ +#!/usr/bin/awk -f + +BEGIN { + pi = atan2(0, -1); + test_true_color(); +} + +function test_true_color() { + for (y = 0; y < HEIGHT; y++) { + for (x = 0; x < WIDTH; x++) { + angle = pi - atan2(x + 0.5 - WIDTH/2, y + 0.5 - HEIGHT/2); + hsv2rgb(angle / (2*pi), 1, 1, rgb); + + for (i = 0; i < 3; i++) rgb[i] = int(rgb[i] * 255); + r = rgb[0]; + g = rgb[1]; + b = rgb[2]; + printf "\033[48;2;%d;%d;%dm", r,g,b; + printf " \033[0m"; + } + print ""; + } +} + +function hsv2rgb(h, s, v, rgb) { + if (s == 0) { + r = g = b = v; + } else { + h *= 6; + i = int(h); + f = h - i; + p = v * (1 - s); + q = v * (1 - s * f); + t = v * (1 - s * (1 - f)); + if (i == 0) { + r = v; g = t; b = p; + } else if (i == 1) { + r = q; g = v; b = p; + } else if (i == 2) { + r = p; g = v; b = t; + } else if (i == 3) { + r = p; g = q; b = v; + } else if (i == 4) { + r = t; g = p; b = v; + } else if (i == 5) { + r = v; g = p; b = q; + } + } + rgb[0] = r; rgb[1] = g; rgb[2] = b; +} From c55c9af57838bbf0f3bc6cc8334c6e27277519cd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 26 Aug 2019 21:30:03 +0300 Subject: [PATCH 178/713] [kitty] add audio_bell patch --- kitty/patches/audio_bell.patch | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 kitty/patches/audio_bell.patch diff --git a/kitty/patches/audio_bell.patch b/kitty/patches/audio_bell.patch new file mode 100644 index 0000000..ebdc8ab --- /dev/null +++ b/kitty/patches/audio_bell.patch @@ -0,0 +1,16 @@ +--- kitty/glfw.c 2019-07-29 07:15:02.000000000 +0300 ++++ kitty/glfw.c 2019-08-01 23:38:47.259980678 +0300 +@@ -842,13 +842,9 @@ + double now = monotonic(); + if (now - last_bell_at <= 0.1) return; + last_bell_at = now; +-#ifdef __APPLE__ + if (w->handle) { + glfwWindowBell(w->handle); + } +-#else +- play_canberra_sound("bell", "kitty bell"); +-#endif + } + + static PyObject* From 1f97d82654626e49b2434b283991515da548d041 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 26 Aug 2019 22:42:07 +0300 Subject: [PATCH 179/713] [zsh] improve compdump handling when initializing the completion system --- zsh/plugins.zsh | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index 81fac8e..5eea920 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -4,10 +4,33 @@ source "$ZSH_DOTFILES/zplg.zsh" plugin completions 'zsh-users/zsh-completions' -# Oh-My-Zsh {{{ +run_compinit() { + autoload -U compinit - # initialize the completion system - autoload -Uz compinit && compinit -C + local match run_compdump=1 + # glob qualifiers description: + # N turn on NULL_GLOB for this expansion + # . match only plain files + # m-1 check if the file was modified today + # see "Filename Generation" in zshexpn(1) + for match in $HOME/.zcompdump(N.m-1); do + run_compdump= + break + done + + if [[ -n "$run_compdump" ]]; then + # -D flag turns off compdump loading + compinit -D + compdump + else + # -C flag disables some checks performed by compinit - they are not needed + # because we already have a fresh compdump + compinit -C + fi +} +run_compinit + +# Oh-My-Zsh {{{ ZSH_CACHE_DIR="$ZSH_DOTFILES/cache" From 897133454389dfc60a4d8b2e23e8df5bad66fd21 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 26 Aug 2019 22:45:11 +0300 Subject: [PATCH 180/713] [zsh] skip plugin loading in upgrade.sh --- upgrade.zsh | 1 + zsh/zplg.zsh | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/upgrade.zsh b/upgrade.zsh index d3cf67c..3f4b7be 100755 --- a/upgrade.zsh +++ b/upgrade.zsh @@ -7,5 +7,6 @@ ZSH_DOTFILES="$DOTFILES_PATH/zsh" git pull --rebase --stat origin master git submodule update --init --recursive --remote --progress +ZPLG_SKIP_LOADING=1 source "$ZSH_DOTFILES/plugins.zsh" zplg-upgrade diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh index f7fe8f0..6359214 100644 --- a/zsh/zplg.zsh +++ b/zsh/zplg.zsh @@ -322,7 +322,9 @@ plugin() { fi done _zplg_debug "sourcing $script_path" - _zplg_load "$script_path" || return "$?" + if [[ -z "$ZPLG_SKIP_LOADING" ]]; then + _zplg_load "$script_path" || return "$?" + fi done done; unset load_pattern ignore_pattern script_path From 487733b264b1c74dd575828e9b46ea098b03f2ce Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 26 Aug 2019 22:48:48 +0300 Subject: [PATCH 181/713] [zsh] add some comments in plugins.zsh --- zsh/plugins.zsh | 50 ++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index 5eea920..918b6b3 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -4,31 +4,35 @@ source "$ZSH_DOTFILES/zplg.zsh" plugin completions 'zsh-users/zsh-completions' -run_compinit() { - autoload -U compinit +# compinit {{{ + # note that completion system must be initialized after zsh-completions and + # before oh-my-zsh + run_compinit() { + autoload -U compinit - local match run_compdump=1 - # glob qualifiers description: - # N turn on NULL_GLOB for this expansion - # . match only plain files - # m-1 check if the file was modified today - # see "Filename Generation" in zshexpn(1) - for match in $HOME/.zcompdump(N.m-1); do - run_compdump= - break - done + local match run_compdump=1 + # glob qualifiers description: + # N turn on NULL_GLOB for this expansion + # . match only plain files + # m-1 check if the file was modified today + # see "Filename Generation" in zshexpn(1) + for match in $HOME/.zcompdump(N.m-1); do + run_compdump= + break + done - if [[ -n "$run_compdump" ]]; then - # -D flag turns off compdump loading - compinit -D - compdump - else - # -C flag disables some checks performed by compinit - they are not needed - # because we already have a fresh compdump - compinit -C - fi -} -run_compinit + if [[ -n "$run_compdump" ]]; then + # -D flag turns off compdump loading + compinit -D + compdump + else + # -C flag disables some checks performed by compinit - they are not needed + # because we already have a fresh compdump + compinit -C + fi + } + run_compinit +# }}} # Oh-My-Zsh {{{ From 5750c11ce6f6b66c11ec7ce501e1975c1145b8e6 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 27 Aug 2019 12:07:51 +0300 Subject: [PATCH 182/713] [zsh] change cache directory --- .gitignore | 7 ------- zsh/plugins.zsh | 7 +++++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 04ff90a..c3c28ef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,3 @@ /zsh/custom -/zsh/cache *.pyc - -/ansible/hosts -/ansible/*.retry - -/smth -/.vscode /hammerspoon/Spoons diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index 918b6b3..0ab3939 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -1,5 +1,10 @@ #!/usr/bin/env zsh +ZSH_CACHE_DIR="$HOME/.cache/dotfiles" +if [[ ! -d "$ZSH_CACHE_DIR" ]]; then + mkdir -pv "$ZSH_CACHE_DIR" +fi + source "$ZSH_DOTFILES/zplg.zsh" plugin completions 'zsh-users/zsh-completions' @@ -36,8 +41,6 @@ plugin completions 'zsh-users/zsh-completions' # Oh-My-Zsh {{{ - ZSH_CACHE_DIR="$ZSH_DOTFILES/cache" - # disable automatic updates because OMZ is managed by my plugin manager DISABLE_AUTO_UPDATE=true From 88a549bea3687cd5ea3cdeff219e8fed15027c2f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 27 Aug 2019 16:18:23 +0300 Subject: [PATCH 183/713] [zsh] add READNULLCMD --- zsh/env.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zsh/env.zsh b/zsh/env.zsh index c951abf..f07bf0d 100644 --- a/zsh/env.zsh +++ b/zsh/env.zsh @@ -8,4 +8,6 @@ export VISUAL="$EDITOR" alias edit="$EDITOR" alias e="$EDITOR" -export CLICOLOR="1" +export CLICOLOR=1 + +READNULLCMD=cat From 71f4f96c3c8e0bc3238907ca6df22d20cd267a48 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 28 Aug 2019 10:46:52 +0300 Subject: [PATCH 184/713] [zsh] add open command for Linux --- zsh/functions.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index a1319bc..977ca4f 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -34,3 +34,7 @@ lazy_load() { welcome() { python "$ZSH_DOTFILES/welcome/main.py" } + +if is_linux && command_exists xdg-open; then + open() { nohup xdg-open "$@" &> /dev/null; } +fi From f971182e3ac3b8296dfd0bae0b42bbbf0a0c93bf Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 28 Aug 2019 10:51:30 +0300 Subject: [PATCH 185/713] [zsh] extend open to android --- zsh/functions.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 977ca4f..2d70658 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -35,6 +35,8 @@ welcome() { python "$ZSH_DOTFILES/welcome/main.py" } -if is_linux && command_exists xdg-open; then +if is_android; then + alias open='termux-open' +elif is_linux && command_exists xdg-open; then open() { nohup xdg-open "$@" &> /dev/null; } fi From 5bed0d64639a24593986dc5f41ba1fee6b81780a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 28 Aug 2019 18:59:36 +0300 Subject: [PATCH 186/713] update README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 556b9dd..c1a6dd1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# dotfiles +# .dotfiles -My dotfiles for macOS, Ubuntu, Linux Mint, Manjaro and Raspbian +My dotfiles for macOS, Arch Linux, Raspbian and Android (Termux). From 74e5fd2e54832ab6f0c570d3adbe147ecb94d005 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 30 Aug 2019 13:10:16 +0300 Subject: [PATCH 187/713] [zsh] add insert-text-face script --- zsh/bin/insert-text-face | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 zsh/bin/insert-text-face diff --git a/zsh/bin/insert-text-face b/zsh/bin/insert-text-face new file mode 100755 index 0000000..8ce42d5 --- /dev/null +++ b/zsh/bin/insert-text-face @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +declare -A faces=( + ["shrug face"]=$'\xc2\xaf\\_(\xe3\x83\x84)_/\xc2\xaf' + ["lenny face"]=$'( \xcd\xa1\xc2\xb0 \xcd\x9c\xca\x96 \xcd\xa1\xc2\xb0)' + ["table flip"]=$'(\xe3\x83\x8e\xe0\xb2\xa0\xe7\x9b\x8a\xe0\xb2\xa0)\xe3\x83\x8e\xe5\xbd\xa1\xe2\x94\xbb\xe2\x94\x81\xe2\x94\xbb' +) + +if IFS=$'\n' face_name="$(echo -e "${!faces[*]}" | rofi -dmenu)"; then + face="${faces[$face_name]}" + xsel --clipboard --input <<< "$face" + notify-send --icon=utilities-terminal --expire-time=2500 "$0" "$face_name copied to clipboard" +fi From e5877a77fd6a848c761ab3394efe8c66dc024df5 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 30 Aug 2019 13:13:04 +0300 Subject: [PATCH 188/713] move scripts from zsh/bin to scripts --- {zsh/bin => scripts}/colortest | 0 {zsh/bin => scripts}/colortest.awk | 0 {zsh/bin => scripts}/colortest2 | 0 {zsh/bin => scripts}/colortest2.awk | 0 {zsh/bin => scripts}/insert-text-face | 0 zsh/functions.zsh | 2 +- zsh/path.zsh | 2 +- 7 files changed, 2 insertions(+), 2 deletions(-) rename {zsh/bin => scripts}/colortest (100%) rename {zsh/bin => scripts}/colortest.awk (100%) rename {zsh/bin => scripts}/colortest2 (100%) rename {zsh/bin => scripts}/colortest2.awk (100%) rename {zsh/bin => scripts}/insert-text-face (100%) diff --git a/zsh/bin/colortest b/scripts/colortest similarity index 100% rename from zsh/bin/colortest rename to scripts/colortest diff --git a/zsh/bin/colortest.awk b/scripts/colortest.awk similarity index 100% rename from zsh/bin/colortest.awk rename to scripts/colortest.awk diff --git a/zsh/bin/colortest2 b/scripts/colortest2 similarity index 100% rename from zsh/bin/colortest2 rename to scripts/colortest2 diff --git a/zsh/bin/colortest2.awk b/scripts/colortest2.awk similarity index 100% rename from zsh/bin/colortest2.awk rename to scripts/colortest2.awk diff --git a/zsh/bin/insert-text-face b/scripts/insert-text-face similarity index 100% rename from zsh/bin/insert-text-face rename to scripts/insert-text-face diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 2d70658..8ffd490 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -13,7 +13,7 @@ is_android() { } command_exists() { - command -v "$1" >/dev/null 2>&1 + command -v "$1" &>/dev/null } source_if_exists() { diff --git a/zsh/path.zsh b/zsh/path.zsh index 56628cd..0f7de56 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -47,7 +47,7 @@ path=("$GOPATH/bin" "${path[@]}") path=(~/.local/bin "${path[@]}") # add my binaries and completions -path=("$ZSH_DOTFILES/bin" "${path[@]}") +path=("$ZSH_DOTFILES/../scripts" "${path[@]}") fpath=("$ZSH_DOTFILES/completions" "${fpath[@]}") # check for Rust installed via rustup From c32debefef6670e09f2d439b13b64e784d4d9c80 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 30 Aug 2019 21:53:16 +0300 Subject: [PATCH 189/713] [colorschemes] kitty.py Python2 compatibility --- colorschemes/kitty.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/colorschemes/kitty.py b/colorschemes/kitty.py index e20011c..dc405ee 100755 --- a/colorschemes/kitty.py +++ b/colorschemes/kitty.py @@ -7,15 +7,15 @@ def print_color(key_name, color): print("{} {}".format(key_name, color)) -print("background", theme.bg) -print("foreground", theme.fg) -print("cursor", theme.cursor_bg) -print("cursor_text_color", theme.cursor_fg) -print("selection_background", theme.selection_bg) -print("selection_foreground", theme.selection_fg) +print_color("background", theme.bg) +print_color("foreground", theme.fg) +print_color("cursor", theme.cursor_bg) +print_color("cursor_text_color", theme.cursor_fg) +print_color("selection_background", theme.selection_bg) +print_color("selection_foreground", theme.selection_fg) for index, color in enumerate(theme.ansi_colors): - print("color" + str(index), color) -print("url_color", theme.link_color) -print("active_border_color", theme.ansi_colors[2]) -print("inactive_border_color", theme.ansi_colors[8]) -print("bell_border_color", theme.ansi_colors[1]) + print_color("color" + str(index), color) +print_color("url_color", theme.link_color) +print_color("active_border_color", theme.ansi_colors[2]) +print_color("inactive_border_color", theme.ansi_colors[8]) +print_color("bell_border_color", theme.ansi_colors[1]) From 094947c1ad0c60d61d52991fef20661c08e79241 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 3 Sep 2019 19:57:30 +0300 Subject: [PATCH 190/713] [zsh] update my syntax theme --- zsh/functions.zsh | 4 ++++ zsh/my-syntax-theme.ini | 27 ++++++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 8ffd490..3e7849c 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -40,3 +40,7 @@ if is_android; then elif is_linux && command_exists xdg-open; then open() { nohup xdg-open "$@" &> /dev/null; } fi + +set-my-syntax-theme() { + fast-theme "$ZSH_DOTFILES/my-syntax-theme.ini" +} diff --git a/zsh/my-syntax-theme.ini b/zsh/my-syntax-theme.ini index 533f021..102f303 100644 --- a/zsh/my-syntax-theme.ini +++ b/zsh/my-syntax-theme.ini @@ -1,37 +1,46 @@ +; default theme, also embedded in the source of fast-syntax-highlighting + [base] default = none unknown-token = red,bold commandseparator = none redirection = none -here-string-tri = yellow -here-string-word = bg:blue +here-string-tri = none +here-string-text = 18 +here-string-var = cyan,bg:18 exec-descriptor = yellow,bold comment = white -correct-subtle = bg:blue +correct-subtle = 12 incorrect-subtle = red -subtle-bg = bg:blue +subtle-separator = green +subtle-bg = bg:18 secondary = +; recursive-base = [command-point] reserved-word = yellow subcommand = yellow alias = green suffix-alias = green -global-alias = bg:blue +global-alias = black,bg:blue builtin = green function = green command = green precommand = green hashed-command = green +single-sq-bracket = green +double-sq-bracket = green +double-paren = yellow [paths] path = none pathseparator = path-to-dir = none,underline globbing = blue,bold +globbing-ext = 13 [brackets] -paired-bracket = bg:blue +paired-bracket = black,bg:blue bracket-level-1 = green,bold bracket-level-2 = yellow,bold bracket-level-3 = cyan,bold @@ -58,12 +67,12 @@ history-expansion = blue,bold [math] mathvar = blue,bold -mathnum = blue +mathnum = magenta matherr = red [for-loop] forvar = none -fornum = blue +fornum = magenta ; operator foroper = yellow ; separator @@ -72,4 +81,4 @@ forsep = yellow,bold [case] case-input = green case-parentheses = yellow -case-condition = bg:blue +case-condition = black,bg:blue From 8cd4c6f752ee290343f2484a26c1bf49d0771213 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 3 Sep 2019 21:49:08 +0300 Subject: [PATCH 191/713] [zsh] change theme --- zsh/my-syntax-theme.ini | 96 +++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 51 deletions(-) diff --git a/zsh/my-syntax-theme.ini b/zsh/my-syntax-theme.ini index 102f303..55a5ed6 100644 --- a/zsh/my-syntax-theme.ini +++ b/zsh/my-syntax-theme.ini @@ -1,84 +1,78 @@ -; default theme, also embedded in the source of fast-syntax-highlighting +; syntax theme for fast-syntax-highlighting based on my Neovim colorscheme for sh and zsh [base] default = none -unknown-token = red,bold +unknown-token = 1,standout commandseparator = none redirection = none here-string-tri = none -here-string-text = 18 -here-string-var = cyan,bg:18 -exec-descriptor = yellow,bold -comment = white -correct-subtle = 12 -incorrect-subtle = red -subtle-separator = green +here-string-text = 2 +here-string-var = cyan +exec-descriptor = 1 +comment = 8 +correct-subtle = 3 +incorrect-subtle = 1,standout +subtle-separator = 7 subtle-bg = bg:18 secondary = -; recursive-base = +recursive-base = none [command-point] -reserved-word = yellow -subcommand = yellow -alias = green -suffix-alias = green -global-alias = black,bg:blue -builtin = green -function = green -command = green -precommand = green -hashed-command = green -single-sq-bracket = green -double-sq-bracket = green -double-paren = yellow +reserved-word = 5 +subcommand = 4 +alias = 4 +suffix-alias = 4 +global-alias = 4,standout +builtin = 5 +function = 4 +command = 4 +precommand = 4 +hashed-command = 4 +single-sq-bracket = none +double-sq-bracket = none +double-paren = none [paths] path = none -pathseparator = -path-to-dir = none,underline -globbing = blue,bold +pathseparator = none +globbing = 6 globbing-ext = 13 [brackets] -paired-bracket = black,bg:blue -bracket-level-1 = green,bold -bracket-level-2 = yellow,bold -bracket-level-3 = cyan,bold +paired-bracket = bg:8 +bracket-level-1 = 7 +bracket-level-2 = 7 +bracket-level-3 = 7 [arguments] -single-hyphen-option = cyan -double-hyphen-option = cyan -back-quoted-argument = none -single-quoted-argument = yellow -double-quoted-argument = yellow -dollar-quoted-argument = yellow +single-hyphen-option = 16 +double-hyphen-option = 16 +back-quoted-argument = 17 +single-quoted-argument = 2 +double-quoted-argument = 2 +dollar-quoted-argument = 2 [in-string] ; backslash in $'...' -back-dollar-quoted-argument = cyan +back-dollar-quoted-argument = 6 ; backslash or $... in "..." -back-or-dollar-double-quoted-argument = cyan +back-or-dollar-double-quoted-argument = 6 [other] -variable = 113 +variable = 1 assign = none -assign-array-bracket = green -history-expansion = blue,bold +assign-array-bracket = none +history-expansion = 6,bold [math] -mathvar = blue,bold -mathnum = magenta -matherr = red +mathnum = 16 [for-loop] -forvar = none -fornum = magenta ; operator -foroper = yellow +foroper = none ; separator -forsep = yellow,bold +forsep = none [case] -case-input = green -case-parentheses = yellow -case-condition = black,bg:blue +case-input = 2 +case-condition = none From 2c5edc2072c8686897d988dbb5676ccd20aa9c56 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 4 Sep 2019 19:22:58 +0300 Subject: [PATCH 192/713] [scripts/copy-text-face.sh] remove extra newline --- scripts/{insert-text-face => copy-text-face.sh} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename scripts/{insert-text-face => copy-text-face.sh} (91%) diff --git a/scripts/insert-text-face b/scripts/copy-text-face.sh similarity index 91% rename from scripts/insert-text-face rename to scripts/copy-text-face.sh index 8ce42d5..1d20dd5 100755 --- a/scripts/insert-text-face +++ b/scripts/copy-text-face.sh @@ -8,6 +8,6 @@ declare -A faces=( if IFS=$'\n' face_name="$(echo -e "${!faces[*]}" | rofi -dmenu)"; then face="${faces[$face_name]}" - xsel --clipboard --input <<< "$face" + echo -n "$face" | xsel --clipboard --input notify-send --icon=utilities-terminal --expire-time=2500 "$0" "$face_name copied to clipboard" fi From 5182a6f1de7bb5f149c7c6a8d9b2b67e52555cc9 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 6 Sep 2019 00:23:48 +0300 Subject: [PATCH 193/713] [zsh] minor change to set-my-syntax-theme --- zsh/functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 3e7849c..c8933ae 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -42,5 +42,5 @@ elif is_linux && command_exists xdg-open; then fi set-my-syntax-theme() { - fast-theme "$ZSH_DOTFILES/my-syntax-theme.ini" + fast-theme "$ZSH_DOTFILES/my-syntax-theme.ini" "$@" } From bdfdba8e887f502cb4d878366d576cd59e5cff96 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 6 Sep 2019 00:37:09 +0300 Subject: [PATCH 194/713] [nvim] move colorscheme to a file in runtimepath --- colorschemes/nvim.py | 6 ++--- colorschemes/out/nvim.vim | 6 ++--- .../colorscheme.vim => colors/dotfiles.vim} | 23 +++---------------- nvim/init.vim | 6 ++++- 4 files changed, 14 insertions(+), 27 deletions(-) rename nvim/{lib/colorscheme.vim => colors/dotfiles.vim} (92%) diff --git a/colorschemes/nvim.py b/colorschemes/nvim.py index d322bd4..6414fbf 100755 --- a/colorschemes/nvim.py +++ b/colorschemes/nvim.py @@ -2,9 +2,9 @@ import _theme as theme -print("let my_colorscheme_name = '{}'".format(theme.name)) -print("let my_colorscheme_base16_name = '{}'".format(theme.base16_name)) -print("let my_colorscheme_base16_colors = [") +print("let dotfiles_colorscheme_name = '{}'".format(theme.name)) +print("let dotfiles_colorscheme_base16_name = '{}'".format(theme.base16_name)) +print("let dotfiles_colorscheme_base16_colors = [") gui_to_cterm_mapping = [0, 18, 19, 8, 20, 7, 21, 15, 1, 16, 3, 2, 6, 4, 5, 17] for colors_pair in zip(theme.base16_colors, gui_to_cterm_mapping): print("\\ {{'gui': '{}', 'cterm': '{:>02}'}},".format(*colors_pair)) diff --git a/colorschemes/out/nvim.vim b/colorschemes/out/nvim.vim index b1fe373..32d8f6f 100644 --- a/colorschemes/out/nvim.vim +++ b/colorschemes/out/nvim.vim @@ -1,6 +1,6 @@ -let my_colorscheme_name = 'base16-eighties' -let my_colorscheme_base16_name = 'eighties' -let my_colorscheme_base16_colors = [ +let dotfiles_colorscheme_name = 'base16-eighties' +let dotfiles_colorscheme_base16_name = 'eighties' +let dotfiles_colorscheme_base16_colors = [ \ {'gui': '#2d2d2d', 'cterm': '00'}, \ {'gui': '#393939', 'cterm': '18'}, \ {'gui': '#515151', 'cterm': '19'}, diff --git a/nvim/lib/colorscheme.vim b/nvim/colors/dotfiles.vim similarity index 92% rename from nvim/lib/colorscheme.vim rename to nvim/colors/dotfiles.vim index 2377b23..a5cdb5c 100644 --- a/nvim/lib/colorscheme.vim +++ b/nvim/colors/dotfiles.vim @@ -4,35 +4,17 @@ " Color definitions {{{ execute 'source' fnameescape(g:nvim_dotfiles_dir.'/../colorschemes/out/nvim.vim') - let s:colors = g:my_colorscheme_base16_colors - let s:theme_name = g:my_colorscheme_name - let s:base16_theme_name = g:my_colorscheme_base16_name - unlet g:my_colorscheme_name g:my_colorscheme_base16_name g:my_colorscheme_base16_colors - if empty($BASE16_SHELL) || !filereadable($BASE16_SHELL.'/scripts/base16-'.s:base16_theme_name.'.sh') || &termguicolors + if empty($BASE16_SHELL) || !filereadable($BASE16_SHELL.'/scripts/base16-'.g:dotfiles_colorscheme_base16_name.'.sh') || &termguicolors set termguicolors - else - " call system(shellescape($BASE16_SHELL.'/scripts/base16-'.s:base16_theme_name.'.sh')) endif " }}} -" Neovim terminal colors {{{ - let s:i = 0 - for s:color in [0x0, 0x8, 0xB, 0xA, 0xD, 0xE, 0xC, 0x5, 0x3, 0x8, 0xB, 0xA, 0xD, 0xE, 0xC, 0x7] - let g:terminal_color_{s:i} = s:colors[s:color].gui - let s:i += 1 - endfor - unlet s:i - - let g:terminal_color_background = g:terminal_color_0 - let g:terminal_color_foreground = g:terminal_color_5 -" }}} - " Theme setup {{{ hi clear syntax reset - let g:colors_name = s:theme_name + let g:colors_name = g:dotfiles_colorscheme_name " }}} " Highlighting function {{{ @@ -40,6 +22,7 @@ return type(a:value) == v:t_number endfunction + let s:colors = g:dotfiles_colorscheme_base16_colors function s:hi(group, fg, bg, attr, guisp) let l:args = '' if a:fg isnot '' diff --git a/nvim/init.vim b/nvim/init.vim index 47384cb..24239f8 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -2,10 +2,14 @@ let g:nvim_dotfiles_dir = expand(':p:h') let g:vim_ide = get(g:, 'vim_ide', 0) -for s:name in ['plugins', 'editing', 'interface', 'colorscheme', 'files', 'completion', 'terminal', 'git'] +let &runtimepath = g:nvim_dotfiles_dir.','.&runtimepath + +for s:name in ['plugins', 'editing', 'interface', 'files', 'completion', 'terminal', 'git'] execute 'source' fnameescape(g:nvim_dotfiles_dir.'/lib/'.s:name.'.vim') endfor +colorscheme dotfiles + for s:path in globpath(g:nvim_dotfiles_dir.'/lib/languages', '*', 0, 1) execute 'source' fnameescape(s:path) endfor From 857276d35ed986ce4258cd3e1767932213f8de36 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 6 Sep 2019 01:03:52 +0300 Subject: [PATCH 195/713] [nvim] remove airline-themes and use a custom theme instead --- nvim/autoload/airline/themes/dotfiles.vim | 43 +++++++++++++++++++++++ nvim/lib/interface.vim | 2 ++ nvim/lib/plugins.vim | 1 - 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 nvim/autoload/airline/themes/dotfiles.vim diff --git a/nvim/autoload/airline/themes/dotfiles.vim b/nvim/autoload/airline/themes/dotfiles.vim new file mode 100644 index 0000000..752d247 --- /dev/null +++ b/nvim/autoload/airline/themes/dotfiles.vim @@ -0,0 +1,43 @@ +let s:palette = {} + +let s:colors = g:dotfiles_colorscheme_base16_colors +function! s:base16_color(fg, bg) + let l:fg = s:colors[a:fg] + let l:bg = s:colors[a:bg] + return [l:fg.gui, l:bg.gui, l:fg.cterm, l:bg.cterm] +endfunction + +let s:section_a = s:base16_color(0x1, 0xB) +let s:section_b = s:base16_color(0x6, 0x2) +let s:section_c = s:base16_color(0x9, 0x1) +let s:palette.normal = airline#themes#generate_color_map( +\ s:section_a, +\ s:section_b, +\ s:section_c) + +let s:section_a_overrides = { +\ 'insert' : s:base16_color(0x1, 0xD), +\ 'replace': s:base16_color(0x1, 0x8), +\ 'visual' : s:base16_color(0x1, 0xE), +\ } +for [s:mode, s:color] in items(s:section_a_overrides) + let s:palette[s:mode] = { 'airline_a': s:color, 'airline_z': s:color } +endfor + +let s:section_inactive = s:base16_color(0x5, 0x1) +let s:palette.inactive = airline#themes#generate_color_map( +\ s:section_inactive, +\ s:section_inactive, +\ s:section_inactive) + +if get(g:, 'loaded_ctrlp', 0) + let s:ctrlp_dark = s:base16_color(0x7, 0x2) + let s:ctrlp_light = s:base16_color(0x7, 0x4) + let s:ctrlp_white = s:base16_color(0x5, 0x1) + ['bold'] + let s:palette.ctrlp = airline#extensions#ctrlp#generate_color_map( + \ s:ctrlp_dark, + \ s:ctrlp_light, + \ s:ctrlp_white) +endif + +let airline#themes#dotfiles#palette = s:palette diff --git a/nvim/lib/interface.vim b/nvim/lib/interface.vim index db3ced7..6afbe45 100644 --- a/nvim/lib/interface.vim +++ b/nvim/lib/interface.vim @@ -94,6 +94,8 @@ endif " Airline (statusline) {{{ + let g:airline_theme = 'dotfiles' + let g:airline_symbols = { \ 'readonly': 'RO', \ 'whitespace': "\u21e5 ", diff --git a/nvim/lib/plugins.vim b/nvim/lib/plugins.vim index e0538a4..c79336e 100644 --- a/nvim/lib/plugins.vim +++ b/nvim/lib/plugins.vim @@ -46,7 +46,6 @@ Plug 'junegunn/vim-plug' Plug 'moll/vim-bbye' Plug 'gerw/vim-HiLinkTrace' Plug 'vim-airline/vim-airline' - Plug 'vim-airline/vim-airline-themes' Plug 'tpope/vim-obsession' Plug 'romainl/vim-qf' if g:vim_ide From cb24d6653f71d882f62f2f07f7075ee26234298a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 7 Sep 2019 14:40:03 +0300 Subject: [PATCH 196/713] [zsh] remove dircolors --- zsh/theme.zsh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/zsh/theme.zsh b/zsh/theme.zsh index f33c3ee..6b8d592 100644 --- a/zsh/theme.zsh +++ b/zsh/theme.zsh @@ -1,12 +1,5 @@ #!/usr/bin/env zsh -configure_dircolors() { - [[ -f ~/.dircolors ]] && eval "$(dircolors ~/.dircolors)" - [[ -z "$LS_COLORS" ]] && eval "$(dircolors -b)" - - zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}" -} - prompt_escape() { echo "${@//'%'/%%}" } @@ -77,5 +70,4 @@ setup_prompt() { PROMPT2=' %_> ' } -configure_dircolors setup_prompt From 3c8dd0f9f26c3f4a641bad53062cb925fde8ce5e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 7 Sep 2019 15:07:04 +0300 Subject: [PATCH 197/713] [zsh] add comments for prompt implementation --- zsh/prompt.zsh | 126 +++++++++++++++++++++++++++++++++++++++++++++++++ zsh/theme.zsh | 73 ---------------------------- zsh/zshrc | 4 +- 3 files changed, 129 insertions(+), 74 deletions(-) create mode 100644 zsh/prompt.zsh delete mode 100644 zsh/theme.zsh diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh new file mode 100644 index 0000000..4781185 --- /dev/null +++ b/zsh/prompt.zsh @@ -0,0 +1,126 @@ +#!/usr/bin/env zsh + +# Escapes `%` in all arguments by replacing it with `%%`. Escaping is needed so +# that untrusted input (e.g. git branch names) doesn't affect prompt rendering. +prompt_escape() { + echo "${@//'%'/%%}" +} + +prompt_preexec_hook() { + # record command start time + # $EPOCHREALTIME returns a float representing system time in seconds (see + # docs for zsh/datetime module) and is much faster than `date +%s.%N` because + # it doesn't involve starting a process + typeset -gF _PROMPT_EXEC_START_TIME="$EPOCHREALTIME" +} + +prompt_precmd_hook() { + if [[ -v _PROMPT_EXEC_START_TIME ]]; then + local -F duration="$((EPOCHREALTIME - _PROMPT_EXEC_START_TIME))" + unset _PROMPT_EXEC_START_TIME + + if (( duration > 1 )); then + local -i t="$duration" d h m s + typeset -g _PROMPT_EXEC_TIME="" + d="$((t/60/60/24))" + h="$((t/60/60%24))" + m="$((t/60%60))" + s="$((t%60))" + (( d > 0 )) && _PROMPT_EXEC_TIME+="${d}d" + (( h > 0 )) && _PROMPT_EXEC_TIME+="${h}h" + (( m > 0 )) && _PROMPT_EXEC_TIME+="${m}m" + _PROMPT_EXEC_TIME+="${s}s" + else + unset _PROMPT_EXEC_TIME + fi + fi +} + +prompt_vcs_info() { + if [[ "$(command git rev-parse --is-inside-work-tree)" != true ]]; then + return + fi + + local branch="(no branches)" line + git branch | while IFS= read -r line; do + # find a line which starts with `* `, it contains the current branch name + if [[ "$line" == "* "* ]]; then + # remove the `* ` prefix + branch="${line#\* }" + break + fi + done + + print -n ' %F{blue}git:(%F{magenta}'"$(prompt_escape "$branch")"'%F{blue})%f' +} + +# configure prompt expansion +# nopromptbang +# `!` should not be treated specially, use `%!` instead. +# promptcr and promptsp +# print a character (`%` for normal users, `#` for root) and a newline in +# order to preserve output that may be covered by the prompt. See +# zshoptions(1) for more details. +# promptpercent +# enable normal prompt expansion sequences which begin with a `%`. +# promptsubst +# enable parameter/command/arithmetic expansion/substitution in the prompt. +setopt nopromptbang promptcr promptsp promptpercent promptsubst + +zmodload zsh/datetime +autoload -Uz add-zsh-hook +add-zsh-hook preexec prompt_preexec_hook +add-zsh-hook precmd prompt_precmd_hook + +# Construct the prompt. See EXPANSION OF PROMPT SEQUENCES in zshmisc(1) for +# the list and descriptions of the expansion sequences. + +# Start the prompt with gray (ANSI color 8 is "bright black" or "gray") +# box drawing characters, also enable bold font for the rest of it. This +# makes the prompt easily distinguishable from command output. +PROMPT='%F{8}┌─%f%B' + +# username +PROMPT+='%F{%(!.red.yellow)}%n%f' + +# hostname +PROMPT+=' at %F{' +if [[ -v SSH_CONNECTION ]]; then + PROMPT+='blue' +else + PROMPT+='green' +fi +PROMPT+='}%m%f' + +# working directory +PROMPT+=' in %F{cyan}%~%f' + +# VCS info +PROMPT+='$(prompt_vcs_info 2>/dev/null)' + +PROMPT+=' ' + +# command execution time +PROMPT+='${_PROMPT_EXEC_TIME:+" %F{yellow}$(prompt_escape "$_PROMPT_EXEC_TIME")%f"}' + +# exit code of the previous command +PROMPT+='%(?.. %F{red}EXIT:%?%f)' + +# number of currently running background jobs +PROMPT+='%1(j. %F{blue}JOBS:%j%f.)' + +# A while ago I decided to start using a multiline prompt because: +# a) all commands I type are visually aligned +# b) I can type pretty long commands without text wrapping in small terminal +# windows (e.g. in Termux on my phone) +PROMPT+=$'\n' + +# see prompt beginning +PROMPT+='%b%F{8}└─%f' + +# the last character +PROMPT+='%F{%(?.green.red)}%(!.#.\$)%f ' + +# PROMPT2 is used when you type an unfinished command. Spaces are needed for +# alignment with normal PROMPT. +PROMPT2=' %_> ' diff --git a/zsh/theme.zsh b/zsh/theme.zsh deleted file mode 100644 index 6b8d592..0000000 --- a/zsh/theme.zsh +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env zsh - -prompt_escape() { - echo "${@//'%'/%%}" -} - -prompt_preexec_hook() { - typeset -gF _PROMPT_EXEC_START_TIME="$EPOCHREALTIME" -} - -prompt_precmd_hook() { - if [[ -v _PROMPT_EXEC_START_TIME ]]; then - local -F duration="$((EPOCHREALTIME - _PROMPT_EXEC_START_TIME))" - unset _PROMPT_EXEC_START_TIME - - if (( duration > 1 )); then - local -i t="$duration" d h m s - typeset -g _PROMPT_EXEC_TIME="" - d="$((t/60/60/24))" - h="$((t/60/60%24))" - m="$((t/60%60))" - s="$((t%60))" - (( d > 0 )) && _PROMPT_EXEC_TIME+="${d}d" - (( h > 0 )) && _PROMPT_EXEC_TIME+="${h}h" - (( m > 0 )) && _PROMPT_EXEC_TIME+="${m}m" - _PROMPT_EXEC_TIME+="${s}s" - else - unset _PROMPT_EXEC_TIME - fi - fi -} - -prompt_vcs_info() { - if [[ $(command git rev-parse --is-inside-work-tree) != true ]]; then - return - fi - - local branch="(no branches)" line - git branch | while IFS= read -r line; do - if [[ "$line" == "* "* ]]; then - branch="${line#\* }" - break - fi - done - - print -n ' %F{blue}git:(%F{magenta}'"$(prompt_escape "$branch")"'%F{blue})%f' -} - -setup_prompt() { - setopt nopromptbang promptcr promptsp promptpercent promptsubst - - zmodload zsh/datetime - autoload -Uz add-zsh-hook - add-zsh-hook preexec prompt_preexec_hook - add-zsh-hook precmd prompt_precmd_hook - - PROMPT='%F{8}┌─%f%B' - PROMPT+='%F{%(!.red.yellow)}%n%f' - PROMPT+=' at %F{${SSH_CONNECTION:+blue}${SSH_CONNECTION:-green}}%m%f' - PROMPT+=' in %F{cyan}%~%f' - PROMPT+='$(prompt_vcs_info 2>/dev/null)' - PROMPT+=' ' - PROMPT+='${_PROMPT_EXEC_TIME:+" %F{yellow}$(prompt_escape "$_PROMPT_EXEC_TIME")%f"}' - PROMPT+='%(?.. %F{red}EXIT:%?%f)' - PROMPT+='%1(j. %F{blue}JOBS:%j%f.)' - PROMPT+=$'\n' - PROMPT+='%b%F{8}└─%f' - PROMPT+='%F{%(?.green.red)}%(!.#.\$)%f ' - - PROMPT2=' %_> ' -} - -setup_prompt diff --git a/zsh/zshrc b/zsh/zshrc index 2dfd016..d936557 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -2,7 +2,7 @@ ZSH_DOTFILES="${0:h}" -for script in functions path env plugins aliases palette theme; do +for script in functions path env plugins aliases palette prompt; do source "$ZSH_DOTFILES/$script.zsh" source_if_exists "$ZSH_DOTFILES/custom/$script.zsh" done @@ -15,4 +15,6 @@ command_exists rbenv && eval "$(rbenv init -)" BASE16_SHELL_profile_helper="$BASE16_SHELL/profile_helper.sh" [[ -n "$PS1" && -r "$BASE16_SHELL_profile_helper" ]] && eval "$("$BASE16_SHELL_profile_helper")" +setopt noclobber + welcome From d184233b6761132c1f5f006a7fa6d04408506cbd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 8 Sep 2019 15:47:38 +0300 Subject: [PATCH 198/713] [zsh] add history search with fzf --- zsh/palette.zsh | 2 +- zsh/zle.zsh | 22 ++++++++++++++++++++++ zsh/zshrc | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 zsh/zle.zsh diff --git a/zsh/palette.zsh b/zsh/palette.zsh index d29acd5..5d5f2a6 100644 --- a/zsh/palette.zsh +++ b/zsh/palette.zsh @@ -43,7 +43,7 @@ _palette_widget() { # try to fill in a placeholder if there're any, otherwise pick a snippet if ! _palette_fill_in_placeholder; then local selected - if selected="$(_palette_parse_tldr_pages | fzf --ansi --cycle --height 50% --reverse)" + if selected="$(_palette_parse_tldr_pages | fzf --height 40% --reverse --ansi)" then # paste selected snippet without its description zle -U "${selected%%$PALETTE_SNIPPET_COMMENT*}" diff --git a/zsh/zle.zsh b/zsh/zle.zsh new file mode 100644 index 0000000..dccf4a1 --- /dev/null +++ b/zsh/zle.zsh @@ -0,0 +1,22 @@ +#!/usr/bin/env zsh + +if command_exists fzf; then + # taken from https://github.com/junegunn/fzf/blob/master/shell/key-bindings.zsh + fzf-history-widget() { + setopt localoptions pipefail + local selected + selected=( + $(fc -rl 1 | + fzf --height=40% --reverse --nth=2.. --tiebreak=index --query="$LBUFFER") + ) + local fzf_ret="$?" + if (( ${#selected} )); then + zle vi-fetch-history -n "${selected[1]}" + fi + zle reset-prompt + return "$fzf_ret" + } + + zle -N fzf-history-widget + bindkey '^[r' fzf-history-widget +fi diff --git a/zsh/zshrc b/zsh/zshrc index d936557..842f895 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -2,7 +2,7 @@ ZSH_DOTFILES="${0:h}" -for script in functions path env plugins aliases palette prompt; do +for script in functions path env plugins aliases zle palette prompt; do source "$ZSH_DOTFILES/$script.zsh" source_if_exists "$ZSH_DOTFILES/custom/$script.zsh" done From b526fa385db9b456b5929bd693470bd566f454a1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 8 Sep 2019 15:48:00 +0300 Subject: [PATCH 199/713] [zsh] disable syntax highlighting in the Linux console (tty) --- zsh/plugins.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index 0ab3939..db7fbae 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -85,4 +85,6 @@ plugin base16-shell 'chriskempson/base16-shell' \ after_load='export BASE16_SHELL="$plugin_dir"' FAST_WORK_DIR="$ZSH_CACHE_DIR" -plugin fast-syntax-highlighting 'zdharma/fast-syntax-highlighting' +if [[ "$TERM" != "linux" ]]; then + plugin fast-syntax-highlighting 'zdharma/fast-syntax-highlighting' +fi From cd3fe953295cbcec86d6f76e18717c3e16c42b44 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 8 Sep 2019 16:01:19 +0300 Subject: [PATCH 200/713] [zsh] merge palette.zsh into zle.zsh --- zsh/palette.zsh | 107 ------------------------------------------- zsh/zle.zsh | 117 +++++++++++++++++++++++++++++++++++++++++++++--- zsh/zshrc | 2 +- 3 files changed, 113 insertions(+), 113 deletions(-) delete mode 100644 zsh/palette.zsh diff --git a/zsh/palette.zsh b/zsh/palette.zsh deleted file mode 100644 index 5d5f2a6..0000000 --- a/zsh/palette.zsh +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env zsh - -# This file contains a ZLE widget called 'palette' that lets you select a -# command snippet and fill in its placeholders. It uses "TLDR pages" as the -# snippet database, so the widget will download them on the first invocation. -# Or, you can also create a symlink to a local cache of a "TLDR pages" client, -# e.g. for tealdeer (which is what I use): -# -# ln -sv ~/.cache/tealdeer/tldr-master/pages $ZSH_CACHE_DIR/tldr-pages -# -# Usage: -# 1. press Alt+Shift+P (or Esc+Shift+P) -# 2. select snippet in the fuzzy finder (fzf) -# 3. Press Alt+Shift+P again, this time it'll take you to the first placeholder -# 4. Enter some text -# 5. Repeat steps 3 and 4 until there're no placeholders left -# -# Requirements/Dependencies: -# 1. AWK (any implementation will probably work) for parsing "TLDR pages" -# 2. the FZF fuzzy finder -# 3. Tar (any implementation will probably work) and Curl for downloading -# "TLDR pages" - -PALETTE_TLDR_PAGES_DIR="$ZSH_CACHE_DIR/tldr-pages" - -# strings which are used to mark placeholders (please don't modify) -PALETTE_PLACEHOLDER_START="{{" -PALETTE_PLACEHOLDER_END="}}" - -# a string which is used to separate snippet from its description in the -# fuzzy-finder -PALETTE_SNIPPET_COMMENT=" ## " - -# Main function of the widget -_palette_widget() { - # download "TLDR pages" if we don't have them - if [[ ! -d "$PALETTE_TLDR_PAGES_DIR" ]]; then - echo - _palette_download_tldr_pages - echo - fi - - # try to fill in a placeholder if there're any, otherwise pick a snippet - if ! _palette_fill_in_placeholder; then - local selected - if selected="$(_palette_parse_tldr_pages | fzf --height 40% --reverse --ansi)" - then - # paste selected snippet without its description - zle -U "${selected%%$PALETTE_SNIPPET_COMMENT*}" - fi - fi - - # immediately redraw - zle redisplay -} - -# This function deletes the first placeholder from the buffer and places the -# cursor at the beginning of that placeholder. If there're no placeholders in -# the buffer, it exits with exit code 1. -_palette_fill_in_placeholder() { - # NOTE!!! indexes in ZSH arrays start at one! - local start_index="${BUFFER[(i)$PALETTE_PLACEHOLDER_START]}" - (( start_index == 0 || start_index > ${#BUFFER} )) && return 1 - local end_index="${BUFFER[(i)$PALETTE_PLACEHOLDER_END]}" - # the CURSOR variable is zero-based while ZSH arrays are one-based - (( CURSOR = start_index - 1 )) - BUFFER="${BUFFER[1,start_index-1]}${BUFFER[end_index+2,${#BUFFER}]}" -} - -# This function parses "TLDR pages" for snippets using AWK. Fortunately, all -# "TLDR pages" files are use the same Markdown-like syntax so they're very easy -# to parse. -_palette_parse_tldr_pages() { - # I chose to use AWK here because it was designed specifically for text - # processing and includes all basic utilities that I need here. - awk ' - # when we find a "description" line... - match($0, /^- (.+):$/, match_groups) { - # ...get actual description from it... - description = match_groups[1] - # ...then skip any lines that are not actual commands, while saving RegEx - # match groups... - while (!match($0, /^`(.+)`$/, match_groups)) getline - # ...after that we can get the command... - command = match_groups[1] - # ...and finally, we print command and description, separated by - # PALETTE_SNIPPET_COMMENT, and with some colors! - printf "%s\x1b[90m'"$PALETTE_SNIPPET_COMMENT"'%s\x1b[0m\n", command, description - } - ' "$PALETTE_TLDR_PAGES_DIR"/**/*.md -} - -# This function downloads the "TLDR pages" -_palette_download_tldr_pages() { - mkdir -pv "$PALETTE_TLDR_PAGES_DIR" - echo "Downloading tldr pages..." - - if curl -Lf https://github.com/tldr-pages/tldr/archive/master.tar.gz | - tar -C "$PALETTE_TLDR_PAGES_DIR" --gzip --strip-components 2 --extract tldr-master/pages - then - echo "Done!" - fi -} - -# finally, bind the widget to Alt+Shift+P (or Esc+Shift+P) -zle -N _palette_widget -bindkey "^[P" _palette_widget diff --git a/zsh/zle.zsh b/zsh/zle.zsh index dccf4a1..3e16c46 100644 --- a/zsh/zle.zsh +++ b/zsh/zle.zsh @@ -1,8 +1,8 @@ #!/usr/bin/env zsh -if command_exists fzf; then +# _fzf_history_widget {{{ # taken from https://github.com/junegunn/fzf/blob/master/shell/key-bindings.zsh - fzf-history-widget() { + _fzf_history_widget() { setopt localoptions pipefail local selected selected=( @@ -17,6 +17,113 @@ if command_exists fzf; then return "$fzf_ret" } - zle -N fzf-history-widget - bindkey '^[r' fzf-history-widget -fi + zle -N _fzf_history_widget + bindkey '^[r' _fzf_history_widget +# }}} + +# palette {{{ + # This widget lets you select a command snippet and fill in its placeholders. + # It uses "TLDR pages" as the snippet database, so the widget will download + # them on the first invocation. Or, you can also create a symlink to a local + # cache of a "TLDR pages" client, e.g. for tealdeer (which is what I use): + # + # ln -sv ~/.cache/tealdeer/tldr-master/pages $ZSH_CACHE_DIR/tldr-pages + # + # Usage: + # 1. press Alt+Shift+P (or Esc+Shift+P) + # 2. select snippet in the fuzzy finder (fzf) + # 3. Press Alt+Shift+P again, this time it'll take you to the first placeholder + # 4. Enter some text + # 5. Repeat steps 3 and 4 until there're no placeholders left + # + # Requirements/Dependencies: + # 1. AWK (any implementation will probably work) for parsing "TLDR pages" + # 2. the FZF fuzzy finder + # 3. Tar (any implementation will probably work) and Curl for downloading + # "TLDR pages" + + PALETTE_TLDR_PAGES_DIR="$ZSH_CACHE_DIR/tldr-pages" + + # strings which are used to mark placeholders (please don't modify) + PALETTE_PLACEHOLDER_START="{{" + PALETTE_PLACEHOLDER_END="}}" + + # a string which is used to separate snippet from its description in the + # fuzzy-finder + PALETTE_SNIPPET_COMMENT=" ## " + + # Main function of the widget + _palette_widget() { + # download "TLDR pages" if we don't have them + if [[ ! -d "$PALETTE_TLDR_PAGES_DIR" ]]; then + echo + _palette_download_tldr_pages + echo + fi + + # try to fill in a placeholder if there're any, otherwise pick a snippet + if ! _palette_fill_in_placeholder; then + local selected + if selected="$(_palette_parse_tldr_pages | fzf --height 40% --reverse --ansi)" + then + # paste selected snippet without its description + zle -U "${selected%%$PALETTE_SNIPPET_COMMENT*}" + fi + fi + + # immediately redraw + zle redisplay + } + + # This function deletes the first placeholder from the buffer and places the + # cursor at the beginning of that placeholder. If there're no placeholders in + # the buffer, it exits with exit code 1. + _palette_fill_in_placeholder() { + # NOTE!!! indexes in ZSH arrays start at one! + local start_index="${BUFFER[(i)$PALETTE_PLACEHOLDER_START]}" + (( start_index == 0 || start_index > ${#BUFFER} )) && return 1 + local end_index="${BUFFER[(i)$PALETTE_PLACEHOLDER_END]}" + # the CURSOR variable is zero-based while ZSH arrays are one-based + (( CURSOR = start_index - 1 )) + BUFFER="${BUFFER[1,start_index-1]}${BUFFER[end_index+2,${#BUFFER}]}" + } + + # This function parses "TLDR pages" for snippets using AWK. Fortunately, all + # "TLDR pages" files are use the same Markdown-like syntax so they're very easy + # to parse. + _palette_parse_tldr_pages() { + # I chose to use AWK here because it was designed specifically for text + # processing and includes all basic utilities that I need here. + awk ' + # when we find a "description" line... + match($0, /^- (.+):$/, match_groups) { + # ...get actual description from it... + description = match_groups[1] + # ...then skip any lines that are not actual commands, while saving RegEx + # match groups... + while (!match($0, /^`(.+)`$/, match_groups)) getline + # ...after that we can get the command... + command = match_groups[1] + # ...and finally, we print command and description, separated by + # PALETTE_SNIPPET_COMMENT, and with some colors! + printf "%s\x1b[90m'"$PALETTE_SNIPPET_COMMENT"'%s\x1b[0m\n", command, description + } + ' "$PALETTE_TLDR_PAGES_DIR"/**/*.md + } + + # This function downloads the "TLDR pages" + _palette_download_tldr_pages() { + mkdir -pv "$PALETTE_TLDR_PAGES_DIR" + echo "Downloading tldr pages..." + + if curl -Lf https://github.com/tldr-pages/tldr/archive/master.tar.gz | + tar -C "$PALETTE_TLDR_PAGES_DIR" --gzip --strip-components 2 --extract tldr-master/pages + then + echo "Done!" + fi + } + + # finally, bind the widget to Alt+Shift+P (or Esc+Shift+P) + zle -N _palette_widget + bindkey "^[P" _palette_widget +# }}} diff --git a/zsh/zshrc b/zsh/zshrc index 842f895..46e306a 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -2,7 +2,7 @@ ZSH_DOTFILES="${0:h}" -for script in functions path env plugins aliases zle palette prompt; do +for script in functions path env plugins aliases zle prompt; do source "$ZSH_DOTFILES/$script.zsh" source_if_exists "$ZSH_DOTFILES/custom/$script.zsh" done From 8fb79293c8e1fae95f415894f71950bed2617049 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 11 Sep 2019 18:08:00 +0300 Subject: [PATCH 201/713] [zsh] add zstyle config file --- zsh/env.zsh | 4 ++++ zsh/plugins.zsh | 4 ++++ zsh/zshrc | 2 +- zsh/zstyle.zsh | 3 +++ 4 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 zsh/zstyle.zsh diff --git a/zsh/env.zsh b/zsh/env.zsh index f07bf0d..6511883 100644 --- a/zsh/env.zsh +++ b/zsh/env.zsh @@ -11,3 +11,7 @@ alias e="$EDITOR" export CLICOLOR=1 READNULLCMD=cat + +if [[ -z "$LS_COLORS" ]] && command_exists dircolors; then + eval "$(dircolors --bourne-shell)" +fi diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index db7fbae..41ed323 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -60,6 +60,10 @@ plugin completions 'zsh-users/zsh-completions' # command execution time stamp shown in the history HIST_STAMPS=dd.mm.yyyy + # ls colors are handled by my dotfiles, so disable that part of OMZ to avoid + # wasting time + DISABLE_LS_COLORS=true + omz_plugins=(git extract fasd) plugin oh-my-zsh 'robbyrussell/oh-my-zsh' \ diff --git a/zsh/zshrc b/zsh/zshrc index 46e306a..7c48747 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -2,7 +2,7 @@ ZSH_DOTFILES="${0:h}" -for script in functions path env plugins aliases zle prompt; do +for script in functions path env plugins aliases zstyle zle prompt; do source "$ZSH_DOTFILES/$script.zsh" source_if_exists "$ZSH_DOTFILES/custom/$script.zsh" done diff --git a/zsh/zstyle.zsh b/zsh/zstyle.zsh new file mode 100644 index 0000000..5d905d9 --- /dev/null +++ b/zsh/zstyle.zsh @@ -0,0 +1,3 @@ +if [[ -n "$LS_COLORS" ]]; then + zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}" +fi From b667b316395d9fbe0619dcc0fd4f5d69601c715a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 14 Sep 2019 22:39:13 +0300 Subject: [PATCH 202/713] [colorschemes] add more colors to the ansi_colors array --- colorschemes/_theme.py | 23 +++-------------------- colorschemes/iterm.py | 2 +- colorschemes/kitty.py | 2 +- colorschemes/nvim.py | 4 ++-- colorschemes/termux.py | 2 +- 5 files changed, 8 insertions(+), 25 deletions(-) diff --git a/colorschemes/_theme.py b/colorschemes/_theme.py index f58af99..ed7df33 100644 --- a/colorschemes/_theme.py +++ b/colorschemes/_theme.py @@ -32,25 +32,8 @@ selection_bg = base16_colors[0x2] selection_fg = fg ansi_colors = [ - base16_colors[i] - for i in [ - 0x0, - 0x8, - 0xB, - 0xA, - 0xD, - 0xE, - 0xC, - 0x5, - 0x3, - 0x8, - 0xB, - 0xA, - 0xD, - 0xE, - 0xC, - 0x7, - ] + base16_colors[int(i, 16)] + for i in "0 8 B A D E C 5 3 8 B A D E C 7 9 F 1 2 4 6".split() ] -link_color = ansi_colors[12] +link_color = ansi_colors[0xC] diff --git a/colorschemes/iterm.py b/colorschemes/iterm.py index 392d183..5594ff5 100755 --- a/colorschemes/iterm.py +++ b/colorschemes/iterm.py @@ -40,7 +40,7 @@ print_color("Cursor", theme.cursor_bg) print_color("Cursor Text", theme.cursor_fg) print_color("Selection Color", theme.selection_bg) print_color("Selected Text Color", theme.selection_fg) -for index, color in enumerate(theme.ansi_colors): +for index, color in enumerate(theme.ansi_colors[:16]): print_color("Ansi " + str(index), color) print_color("Link", theme.link_color) diff --git a/colorschemes/kitty.py b/colorschemes/kitty.py index dc405ee..9af9bb6 100755 --- a/colorschemes/kitty.py +++ b/colorschemes/kitty.py @@ -13,7 +13,7 @@ print_color("cursor", theme.cursor_bg) print_color("cursor_text_color", theme.cursor_fg) print_color("selection_background", theme.selection_bg) print_color("selection_foreground", theme.selection_fg) -for index, color in enumerate(theme.ansi_colors): +for index, color in enumerate(theme.ansi_colors[:16]): print_color("color" + str(index), color) print_color("url_color", theme.link_color) print_color("active_border_color", theme.ansi_colors[2]) diff --git a/colorschemes/nvim.py b/colorschemes/nvim.py index 6414fbf..bba2493 100755 --- a/colorschemes/nvim.py +++ b/colorschemes/nvim.py @@ -6,7 +6,7 @@ print("let dotfiles_colorscheme_name = '{}'".format(theme.name)) print("let dotfiles_colorscheme_base16_name = '{}'".format(theme.base16_name)) print("let dotfiles_colorscheme_base16_colors = [") gui_to_cterm_mapping = [0, 18, 19, 8, 20, 7, 21, 15, 1, 16, 3, 2, 6, 4, 5, 17] -for colors_pair in zip(theme.base16_colors, gui_to_cterm_mapping): +for colors_pair in zip(theme.base16_colors[:16], gui_to_cterm_mapping): print("\\ {{'gui': '{}', 'cterm': '{:>02}'}},".format(*colors_pair)) print("\\ ]") @@ -17,5 +17,5 @@ def print_terminal_color(key_name, color): print_terminal_color("background", theme.bg) print_terminal_color("foreground", theme.fg) -for index, color in enumerate(theme.ansi_colors): +for index, color in enumerate(theme.ansi_colors[:16]): print_terminal_color(str(index), color) diff --git a/colorschemes/termux.py b/colorschemes/termux.py index ddcb3b4..164df7a 100755 --- a/colorschemes/termux.py +++ b/colorschemes/termux.py @@ -10,5 +10,5 @@ def print_color(key_name, color): print_color("background", theme.bg) print_color("foreground", theme.fg) print_color("cursor", theme.cursor_bg) -for index, color in enumerate(theme.ansi_colors): +for index, color in enumerate(theme.ansi_colors[:16]): print_color("color" + str(index), color) From 12e4fd22ad33b284cdf891894150fa5942a7ac19 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 15 Sep 2019 11:37:52 +0300 Subject: [PATCH 203/713] [zsh] remove parens from git status in the prompt --- zsh/prompt.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index 4781185..39d7182 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -51,7 +51,7 @@ prompt_vcs_info() { fi done - print -n ' %F{blue}git:(%F{magenta}'"$(prompt_escape "$branch")"'%F{blue})%f' + print -n ' %F{blue}git:%F{magenta}'"$(prompt_escape "$branch")"'%F{blue}%f' } # configure prompt expansion From 0e201ba4eaed1c37927d56a55e99ccbbcf69036c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 15 Sep 2019 20:02:00 +0300 Subject: [PATCH 204/713] [zsh] replace base16-shell with a custom colorscheme engine --- colorschemes/build.sh | 3 +- colorschemes/out/shell.zsh | 31 +++++++++++++ colorschemes/shell.py | 20 +++++++++ zsh/colorscheme.zsh | 91 ++++++++++++++++++++++++++++++++++++++ zsh/plugins.zsh | 3 -- zsh/zshrc | 5 +-- 6 files changed, 145 insertions(+), 8 deletions(-) create mode 100644 colorschemes/out/shell.zsh create mode 100755 colorschemes/shell.py create mode 100644 zsh/colorscheme.zsh diff --git a/colorschemes/build.sh b/colorschemes/build.sh index 2b5891a..a18bfc4 100755 --- a/colorschemes/build.sh +++ b/colorschemes/build.sh @@ -7,9 +7,10 @@ cd "$(dirname "${BASH_SOURCE[0]}")" mkdir -p out declare -A apps=( - [nvim]=vim [iterm]=itermcolors [kitty]=conf + [nvim]=vim + [shell]=zsh [termux]=properties ) diff --git a/colorschemes/out/shell.zsh b/colorschemes/out/shell.zsh new file mode 100644 index 0000000..d159d23 --- /dev/null +++ b/colorschemes/out/shell.zsh @@ -0,0 +1,31 @@ +colorscheme_bg=2d2d2d +colorscheme_fg=d3d0c8 +colorscheme_cursor_bg=d3d0c8 +colorscheme_cursor_fg=2d2d2d +colorscheme_selection_bg=515151 +colorscheme_selection_fg=d3d0c8 +colorscheme_link_color=6699cc +colorscheme_ansi_colors=( + 2d2d2d + f2777a + 99cc99 + ffcc66 + 6699cc + cc99cc + 66cccc + d3d0c8 + 747369 + f2777a + 99cc99 + ffcc66 + 6699cc + cc99cc + 66cccc + f2f0ec + f99157 + d27b53 + 393939 + 515151 + a09f93 + e8e6df +) diff --git a/colorschemes/shell.py b/colorschemes/shell.py new file mode 100755 index 0000000..96c73af --- /dev/null +++ b/colorschemes/shell.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +import _theme as theme + + +for attr in [ + "bg", + "fg", + "cursor_bg", + "cursor_fg", + "selection_bg", + "selection_fg", + "link_color", +]: + color = getattr(theme, attr) + print("colorscheme_{}={}".format(attr, color[1:])) +print("colorscheme_ansi_colors=(") +for color in theme.ansi_colors: + print(" {}".format(color[1:])) +print(")") diff --git a/zsh/colorscheme.zsh b/zsh/colorscheme.zsh new file mode 100644 index 0000000..73f5275 --- /dev/null +++ b/zsh/colorscheme.zsh @@ -0,0 +1,91 @@ +#!/usr/bin/env bash +# partially based on https://github.com/chriskempson/base16-shell/blob/master/templates/default.mustache + +source "$ZSH_DOTFILES/../colorschemes/out/shell.zsh" + +if [[ -n "$TMUX" ]]; then + # tmux + terminal_wrapper=tmux +elif [[ -n "$STY" ]]; then + # GNU Screen + terminal_wrapper=screen +fi + +if [[ -z "$terminal_wrapper" ]]; then + case "$TERM" in + linux*) terminal="linux" ;; + *) terminal="xterm" ;; + esac + export _COLORSCHEME_TERMINAL="$terminal" +else + terminal="${_COLORSCHEME_TERMINAL:-xterm}" +fi + +# when a terminal wrapper is detected certain control sequences are used to +# send color change control sequences directly to the terminal +case "$terminal_wrapper" in + tmux) + # http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324 + _colorscheme_print_ctrl_seq() { print -n "\ePtmux;\e$1\e\\"; } + ;; + screen) + # GNU screen uses the standard DCS (Device Control String) sequence (see + # console_codes(4) manpage) + _colorscheme_print_ctrl_seq() { print -n "\eP$1\e\\"; } + ;; + *) + _colorscheme_print_ctrl_seq() { print -n "$1"; } + ;; +esac; unset terminal_wrapper + +case "$terminal" in + linux) + _colorscheme_print_osc_seq() {} + _colorscheme_set_attr_to_color() {} + _colorscheme_set_ansi_color() { + # Linux console supports setting only 16 ANSI colors and interestingly + # enough uses only 8 of them + if (( $1 >= 0 && $1 < 16 )); then + _colorscheme_print_ctrl_seq "$(printf "\e]P%X%s" "$1" "$2")" + fi + } + ;; + xterm) + _colorscheme_print_osc_seq() { + _colorscheme_print_ctrl_seq "\e]$1\a"; + } + _colorscheme_set_attr_to_color() { + _colorscheme_print_osc_seq "$1;rgb:${2[1,2]}/${2[3,4]}/${2[5,6]}"; + } + _colorscheme_set_ansi_color() { + _colorscheme_set_attr_to_color "4;$1" "$2"; + } + ;; +esac; unset terminal + +set-my-colorscheme() { + local i; for (( i = 1; i <= ${#colorscheme_ansi_colors}; i++ )); do + _colorscheme_set_ansi_color "$((i-1))" "${colorscheme_ansi_colors[$i]}" + done + + if [[ -n "$ITERM_SESSION_ID" ]]; then + # iTerm2 proprietary escape codes + # https://www.iterm2.com/documentation-escape-codes.html + _colorscheme_print_osc_seq Pg"$colorscheme_fg" + _colorscheme_print_osc_seq Ph"$colorscheme_bg" + _colorscheme_print_osc_seq Pi"$colorscheme_fg" # bold + _colorscheme_print_osc_seq Pj"$colorscheme_selection_bg" + _colorscheme_print_osc_seq Pk"$colorscheme_selection_fg" + _colorscheme_print_osc_seq Pl"$colorscheme_cursor_bg" + _colorscheme_print_osc_seq Pm"$colorscheme_cursor_fg" + else + _colorscheme_set_attr_to_color 10 "$colorscheme_fg" + _colorscheme_set_attr_to_color 11 "$colorscheme_bg" + if [[ "$TERM" = rxvt* ]]; then + # internal window border + _colorscheme_set_attr_to_color 708 "$colorscheme_bg" + fi + fi +} + +set-my-colorscheme diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index 41ed323..cf9adc7 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -85,9 +85,6 @@ plugin alias-tips 'djui/alias-tips' plugin ssh 'zpm-zsh/ssh' -plugin base16-shell 'chriskempson/base16-shell' \ - after_load='export BASE16_SHELL="$plugin_dir"' - FAST_WORK_DIR="$ZSH_CACHE_DIR" if [[ "$TERM" != "linux" ]]; then plugin fast-syntax-highlighting 'zdharma/fast-syntax-highlighting' diff --git a/zsh/zshrc b/zsh/zshrc index 7c48747..37866e9 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -2,7 +2,7 @@ ZSH_DOTFILES="${0:h}" -for script in functions path env plugins aliases zstyle zle prompt; do +for script in functions path env plugins aliases zstyle zle prompt colorscheme; do source "$ZSH_DOTFILES/$script.zsh" source_if_exists "$ZSH_DOTFILES/custom/$script.zsh" done @@ -12,9 +12,6 @@ MANPATH="$MANPATH:" command_exists rbenv && eval "$(rbenv init -)" -BASE16_SHELL_profile_helper="$BASE16_SHELL/profile_helper.sh" -[[ -n "$PS1" && -r "$BASE16_SHELL_profile_helper" ]] && eval "$("$BASE16_SHELL_profile_helper")" - setopt noclobber welcome From 59fc6fee46f906b643cfa08ce3e4fc3f3af4bccc Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 16 Sep 2019 19:31:07 +0300 Subject: [PATCH 205/713] [zsh] add more error reporting to zplg --- zsh/zplg.zsh | 108 +++++++++++++++++++++++++++------------------------ 1 file changed, 58 insertions(+), 50 deletions(-) diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh index 6359214..d56b2b8 100644 --- a/zsh/zplg.zsh +++ b/zsh/zplg.zsh @@ -229,56 +229,56 @@ plugin() { # parse basic arguments {{{ - if (( $# < 2 )); then - _zplg_error "usage: $0 [option...]" - return 1 - fi + if (( $# < 2 )); then + _zplg_error "usage: $0 [option...]" + return 1 + fi - local plugin_id="$1" - local plugin_url="$2" - if [[ ! "$plugin_id" =~ '^[a-zA-Z0-9_\-][a-zA-Z0-9._\-]*$' ]]; then - _zplg_error "invalid plugin ID" - return 1 - fi - if [[ -z "$plugin_url" ]]; then - _zplg_error "invalid plugin URL" - return 1 - fi + local plugin_id="$1" + local plugin_url="$2" + if [[ ! "$plugin_id" =~ '^[a-zA-Z0-9_\-][a-zA-Z0-9._\-]*$' ]]; then + _zplg_error "invalid plugin ID" + return 1 + fi + if [[ -z "$plugin_url" ]]; then + _zplg_error "invalid plugin URL" + return 1 + fi - # Don't even try to continue if the plugin has already been loaded. This is - # not or problem. Plugin manager loads plugins and shouldn't bother - # unloading them. - if _zplg_is_plugin_loaded "$plugin_id"; then - _zplg_error "plugin $plugin_id has already been loaded" - return 1 - fi + # Don't even try to continue if the plugin has already been loaded. This is + # not or problem. Plugin manager loads plugins and shouldn't bother + # unloading them. + if _zplg_is_plugin_loaded "$plugin_id"; then + _zplg_error "plugin $plugin_id has already been loaded" + return 1 + fi # }}} # parse options {{{ - local plugin_from="$ZPLG_DEFAULT_SOURCE" - local -a plugin_build plugin_before_load plugin_after_load plugin_load plugin_ignore + local plugin_from="$ZPLG_DEFAULT_SOURCE" + local -a plugin_build plugin_before_load plugin_after_load plugin_load plugin_ignore - local option key value; shift 2; for option in "$@"; do - # globs are faster than regular expressions - if [[ "$option" != *?=?* ]]; then - _zplg_error "options must have the following format: =" - return 1 - fi + local option key value; shift 2; for option in "$@"; do + # globs are faster than regular expressions + if [[ "$option" != *?=?* ]]; then + _zplg_error "options must have the following format: =" + return 1 + fi - # split 'option' at the first occurence of '=' - key="${option%%=*}" value="${option#*=}" - case "$key" in - from) - eval "plugin_$key=\"\$value\"" ;; - build|before_load|after_load|load|ignore) - eval "plugin_$key+=(\"\$value\")" ;; - *) - _zplg_error "unknown option: $key" - return 1 ;; - esac - done; unset option key value + # split 'option' at the first occurence of '=' + key="${option%%=*}" value="${option#*=}" + case "$key" in + from) + eval "plugin_$key=\"\$value\"" ;; + build|before_load|after_load|load|ignore) + eval "plugin_$key+=(\"\$value\")" ;; + *) + _zplg_error "unknown option: $key" + return 1 ;; + esac + done; unset option key value # }}} @@ -293,22 +293,24 @@ plugin() { # download plugin {{{ - local plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" - # simple check whether the plugin directory exists is enough for me - if [[ ! -d "$plugin_dir" ]]; then - _zplg_log "downloading $plugin_id" - _zplg_source_"$plugin_from"_download "$plugin_url" "$plugin_dir" || return "$?" + local plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" + # simple check whether the plugin directory exists is enough for me + if [[ ! -d "$plugin_dir" ]]; then + _zplg_log "downloading $plugin_id" + _zplg_source_"$plugin_from"_download "$plugin_url" "$plugin_dir" || return "$?" - if (( ${#plugin_build} > 0 )); then - _zplg_log "building $plugin_id" - ( cd "$plugin_dir" && _zplg_run_commands plugin_build ) || return "$?" - fi + if (( ${#plugin_build} > 0 )); then + _zplg_log "building $plugin_id" + ( cd "$plugin_dir" && _zplg_run_commands plugin_build ) || return "$?" fi + fi # }}} # load plugin {{{ + { + _zplg_run_commands plugin_before_load || return "$?" local load_pattern ignore_pattern script_path; local -a script_paths @@ -346,6 +348,12 @@ plugin() { unset plugin_build_quoted fi + } always { + if [[ "$?" != 0 ]]; then + _zplg_error "an error occured while loading $plugin_id" + fi + } + # }}} } From c9858363e6bc80b2529e159a4c25726c10001b31 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 19 Sep 2019 20:10:59 +0300 Subject: [PATCH 206/713] [nvim] update shell colorscheme detection mechanism --- nvim/colors/dotfiles.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index a5cdb5c..025eb6b 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -5,8 +5,8 @@ execute 'source' fnameescape(g:nvim_dotfiles_dir.'/../colorschemes/out/nvim.vim') - if empty($BASE16_SHELL) || !filereadable($BASE16_SHELL.'/scripts/base16-'.g:dotfiles_colorscheme_base16_name.'.sh') || &termguicolors - set termguicolors + if !&termguicolors && exists('$_COLORSCHEME_TERMINAL') + set notermguicolors endif " }}} From 16f0a1cf32ec97355da2e17de1c4bb458431767b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 23 Sep 2019 23:41:28 +0300 Subject: [PATCH 207/713] [zsh] edit welcome script invocation --- zsh/functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index c8933ae..8e47200 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -32,7 +32,7 @@ lazy_load() { } welcome() { - python "$ZSH_DOTFILES/welcome/main.py" + "$ZSH_DOTFILES/welcome/main.py" } if is_android; then From d3442d9beb5d816741a92ce26cf7838833c85444 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 24 Sep 2019 22:34:15 +0300 Subject: [PATCH 208/713] [zsh] FINALLY REMOVE OH-MY-ZSH --- zsh/aliases.zsh | 39 +++++++++++++++++------------- zsh/completion.zsh | 41 +++++++++++++++++++++++++++++++ zsh/env.zsh | 10 ++++---- zsh/functions.zsh | 57 ++++++++++++++++++++++++------------------- zsh/options.zsh | 60 ++++++++++++++++++++++++++++++++++++++++++++++ zsh/path.zsh | 31 +++++++++++++----------- zsh/plugins.zsh | 53 ++++++++++++++++++++-------------------- zsh/prompt.zsh | 4 ++-- zsh/zle.zsh | 23 +++++++++++++++++- zsh/zplg.zsh | 10 ++++---- zsh/zshrc | 7 +++--- zsh/zstyle.zsh | 3 --- 12 files changed, 236 insertions(+), 102 deletions(-) create mode 100644 zsh/completion.zsh create mode 100644 zsh/options.zsh delete mode 100644 zsh/zstyle.zsh diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index a1f8046..69eb869 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,15 +1,12 @@ #!/usr/bin/env zsh -# remove Oh-My-Zsh correction aliases -for cmd in cp ebuild gist heroku hpodder man mkdir mv mysql sudo; do - unalias $cmd -done - # this alias removes leading dollar sign (useful when copying code from Stackoverflow) alias '$'='' # this alias allows aliases to work with sudo alias sudo='sudo ' +alias history='fc -i -l 1' + alias cdd='dirs -v' alias grep='grep --color=auto' @@ -18,17 +15,16 @@ alias diff='diff --color=auto' # exa is a modern replacement for ls - https://the.exa.website/ if command_exists exa; then alias ls="exa --classify --group-directories-first" - alias lsa="${aliases[ls]} --all" - alias l="${aliases[ls]} --long --header --binary --group" - alias la="${aliases[l]} --all" - alias tree="${aliases[ls]} --tree" + alias lsa="ls --all" + alias l="ls --long --header --binary --group" + alias la="l --all" + alias tree="ls --tree" else alias ls="ls --classify --group-directories-first --color=auto" - alias lsa="${aliases[ls]} --almost-all" - alias l="${aliases[ls]} -l --human-readable" - alias la="${aliases[l]} --almost-all" + alias lsa="ls --almost-all" + alias l="ls -l --human-readable" + alias la="l --almost-all" fi -unalias ll # remove this Oh-My-Zsh alias # fd is a simple, fast and user-friendly alternative to find - https://github.com/sharkdp/fd if command_exists fd; then @@ -36,17 +32,28 @@ if command_exists fd; then fi # git with hub -command_exists hub && alias git="hub" +if command_exists hub; then + alias git="hub" +fi # make these utils more verbose alias cp='cp -iv' alias mv='mv -iv' alias rm='rm -iv' -alias rmdir='rmdir -v' +alias rmdir='rmdir -v' rd='rmdir' alias chmod='chmod -v' alias chown='chown -v' alias ln='ln -iv' -alias mkdir='mkdir -v' +alias mkdir='mkdir -v' md='mkdir -p' + +for n in {1..9}; do + alias "$n"="cd +$n" +done; unset n + +alias ...='../..' +alias ....='../../..' +alias .....='../../../..' +alias ......='../../../../..' # print file sizes in human readable format alias du='du -h' diff --git a/zsh/completion.zsh b/zsh/completion.zsh new file mode 100644 index 0000000..548955d --- /dev/null +++ b/zsh/completion.zsh @@ -0,0 +1,41 @@ +# http://zsh.sourceforge.net/Doc/Release/Completion-System.html +# https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/completion.zsh + +# load fancier completion menu which (most notably) supports `list-colors` +zmodload zsh/complist +zstyle ':completion:*' menu select +# show even more completion results +zstyle ':completion:*' verbose yes + +zstyle ':completion::complete:*' use-cache yes +zstyle ':completion::complete:*' cache-path "$ZSH_CACHE_DIR" + +# group completion result based on their categories +zstyle ':completion:*' group-name '' +# format for displaying category names +zstyle ':completion:*:descriptions' format '%F{yellow}[%d]%f' + +# Sometimes zsh completion authors for whatever reason add descriptions for +# option values, but don't do describe the options themselves (e.g. ffmpeg, +# some options for GCC). In such cases description of an option can be inferred +# from the description of its value. That's the purpose of `auto-description`. +zstyle ':completion:*:options' auto-description '%d' + +# case insensitive (all), partial-word and substring completion +zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*' + +zstyle ':completion:*' list-dirs-first yes +# complete . and .. directories +# This is very useful when I just want to quickly look around inside a +# directory without running `ls` +zstyle ':completion:*' special-dirs yes + +if [[ -n "$LS_COLORS" ]]; then + zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}" +fi + +zstyle ':completion:*:processes' command "ps xo pid,user,cmd" +zstyle ':completion:*:processes-names' command "ps xho comm=" +zstyle ':completion:*:processes' force-list always + +zstyle -e ':completion:*:hosts' hosts 'reply=("${(@f)$(awk "match(\$0, /^Host[[:blank:]]*/) { print substr(\$0, RLENGTH+1); }" ~/.ssh/config)}")' diff --git a/zsh/env.zsh b/zsh/env.zsh index 6511883..83a5605 100644 --- a/zsh/env.zsh +++ b/zsh/env.zsh @@ -1,17 +1,19 @@ #!/usr/bin/env zsh -export USER="${USER:-$USERNAME}" - # find editor export EDITOR="nvim" export VISUAL="$EDITOR" alias edit="$EDITOR" alias e="$EDITOR" +export PAGER='less' +export LESS='--RAW-CONTROL-CHARS' + export CLICOLOR=1 -READNULLCMD=cat - +# BSD ls colors +export LSCOLORS="Gxfxcxdxbxegedabagacad" +# GNU ls colors if [[ -z "$LS_COLORS" ]] && command_exists dircolors; then eval "$(dircolors --bourne-shell)" fi diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 8e47200..90dd126 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -1,24 +1,16 @@ #!/usr/bin/env zsh -is_linux() { - [[ "$OSTYPE" == linux* ]] +count() { echo "$#"; } + +mkcd() { + mkdir -p "$@" && cd "${@[-1]}" } -is_macos() { - [[ "$OSTYPE" == darwin* ]] -} +is_linux() { [[ "$OSTYPE" == linux* ]]; } +is_macos() { [[ "$OSTYPE" == darwin* ]]; } +is_android() { [[ "$OSTYPE" == linux-android ]]; } -is_android() { - [[ "$OSTYPE" == linux-android ]] -} - -command_exists() { - command -v "$1" &>/dev/null -} - -source_if_exists() { - [[ -f "$1" ]] && source "$1" -} +command_exists() { command -v "$1" &>/dev/null; } lazy_load() { local command="$1" @@ -31,16 +23,31 @@ lazy_load() { }" } -welcome() { - "$ZSH_DOTFILES/welcome/main.py" -} +welcome() { "$ZSH_DOTFILES/welcome/main.py"; } if is_android; then - alias open='termux-open' -elif is_linux && command_exists xdg-open; then - open() { nohup xdg-open "$@" &> /dev/null; } + open_cmd='termux-open' +elif command_exists xdg-open; then + open_cmd='nohup xdg-open &> /dev/null' +else + open_cmd='print >&2 "open: Platform $OSTYPE is not supported"; return 1' fi +eval "open(){$open_cmd \"\$@\";}" +unset open_cmd -set-my-syntax-theme() { - fast-theme "$ZSH_DOTFILES/my-syntax-theme.ini" "$@" -} +if is_macos; then + copy_cmd='pbcopy' paste_cmd='pbpaste' +elif command_exists xclip; then + copy_cmd='xclip -in -selection clipboard' paste_cmd='xclip -out -selection clipboard' +elif command_exists xsel; then + copy_cmd='xsel --clipboard --input' paste_cmd='xsel --clipboard --output' +elif command_exists termux-clipboard-set && command_exists termux-clipboard-get; then + copy_cmd='termux-clipboard-set' paste_cmd='termux-clipboard-get' +else + error_msg='Platform $OSTYPE is not supported' + copy_cmd='print >&2 "clipcopy: '"$error_msg"'"; return 1' + paste_cmd='print >&2 "clippaste: '"$error_msg"'"; return 1' + unset error_msg +fi +eval "clipcopy(){$copy_cmd;};clippaste(){$paste_cmd;}" +unset copy_cmd paste_cmd diff --git a/zsh/options.zsh b/zsh/options.zsh new file mode 100644 index 0000000..3679194 --- /dev/null +++ b/zsh/options.zsh @@ -0,0 +1,60 @@ +# http://zsh.sourceforge.net/Doc/Release/Options.html#Description-of-Options-1 +# http://zsh.sourceforge.net/Doc/Release/Parameters.html#Parameters-Used-By-The-Shell + +# remove some characters from the standard WORDCHARS +WORDCHARS="${WORDCHARS//[\/=]}" +# disable Ctrl+S and Ctrl+Q (https://unix.stackexchange.com/questions/137842/what-is-the-point-of-ctrl-s) +setopt no_flow_control + +setopt correct_all + +# recognize comments in the prompt +setopt interactive_comments + +setopt extended_glob + +# enable support for multiple redirections in one command +setopt multi_os +# disallow redirection to file (i.e. `>`) if the file already exists, this can +# be overriden by using `>!` or `>|` redirection operators +setopt no_clobber +# command to assume when redirection is used without a command +READNULLCMD=cat + +setopt long_list_jobs + +# if the first word in the command is a directory name, `cd` into it +setopt auto_cd +# automatically push directories onto the stack when doing a `cd`, but remove +# older duplicates (this works like history of a single tab in a web browser) +setopt auto_pushd pushd_ignore_dups + +# do not autoselect the first completion entry +setopt no_menu_complete +# if the cursor is inside a word, use part from the beginning to the cursor as +# prefix and from the cursor to the end as suffix when searching for +# completions (the default behavior is to use the whole word as a substring) +setopt complete_in_word +# setopt always_to_end # does this option affect anything? + +# strangely enough, Zsh doesn't save command history by default +HISTFILE="${HISTFILE:-$HOME/.zsh_history}" +# max number of entries stored in memory +HISTSIZE=50000 +# max number of entries in the HISTFILE +SAVEHIST=10000 +# record timestamps in the history +setopt extended_history +# delete duplicates first when HISTFILE size exceeds HISTSIZE +setopt hist_expire_dups_first +# ignore duplicated history items +setopt hist_ignore_dups +# ignore commands that start with space +setopt hist_ignore_space +# don't run commands with history expansions immediately, instead allow the +# user to preview the expansions and edit the command after expansions in ZLE +setopt hist_verify +# immediately write HISTFILE to disk when a new command is appended +setopt inc_append_history +# synchronize history between active sessions +setopt share_history diff --git a/zsh/path.zsh b/zsh/path.zsh index 0f7de56..f3b0dfd 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -40,22 +40,25 @@ if is_macos; then fi # add Go binaries -export GOPATH="$HOME/.go" +export GOPATH=~/.go path=("$GOPATH/bin" "${path[@]}") -# add user binaries -path=(~/.local/bin "${path[@]}") - -# add my binaries and completions -path=("$ZSH_DOTFILES/../scripts" "${path[@]}") -fpath=("$ZSH_DOTFILES/completions" "${fpath[@]}") - -# check for Rust installed via rustup -rustc=~/.cargo/bin/rustc -if [[ -f "$rustc" && -x "$rustc" ]] && rust_sysroot="$("$rustc" --print sysroot)"; then - # add paths of the default Rust toolchain - path=(~/.cargo/bin "${path[@]}") +# Rust +path=(~/.cargo/bin "${path[@]}") +# check if the Rust toolchain was installed via rustup +if rustup_home="$(rustup show home 2> /dev/null)" && + rust_sysroot="$(rustc --print sysroot 2> /dev/null)" && + [[ -d "$rustup_home" && -d "$rust_sysroot" && "$rust_sysroot" == "$rustup_home"/* ]] +then + # add paths of the selected Rust toolchain fpath=("$rust_sysroot/share/zsh/site-functions" "${fpath[@]}") manpath=("$rust_sysroot/share/man" "${manpath[@]}") fi -unset rustc rust_sysroot +unset rustup_home rust_sysroot + +# add my binaries and completions +path=("${ZSH_DOTFILES:h}/scripts" "${path[@]}") +fpath=("$ZSH_DOTFILES/completions" "${fpath[@]}") + +# add user binaries +path=(~/.local/bin "${path[@]}") diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index cf9adc7..f69dd75 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -12,31 +12,30 @@ plugin completions 'zsh-users/zsh-completions' # compinit {{{ # note that completion system must be initialized after zsh-completions and # before oh-my-zsh - run_compinit() { - autoload -U compinit + autoload -U compinit - local match run_compdump=1 - # glob qualifiers description: - # N turn on NULL_GLOB for this expansion - # . match only plain files - # m-1 check if the file was modified today - # see "Filename Generation" in zshexpn(1) - for match in $HOME/.zcompdump(N.m-1); do - run_compdump= - break - done + run_compdump=1 + # glob qualifiers description: + # N turn on NULL_GLOB for this expansion + # . match only plain files + # m-1 check if the file was modified today + # see "Filename Generation" in zshexpn(1) + for match in $HOME/.zcompdump(N.m-1); do + run_compdump=0 + break + done; unset match - if [[ -n "$run_compdump" ]]; then - # -D flag turns off compdump loading - compinit -D - compdump - else - # -C flag disables some checks performed by compinit - they are not needed - # because we already have a fresh compdump - compinit -C - fi - } - run_compinit + if (( $run_compdump )); then + echo "$0: rebuilding zsh completion dump" + # -D flag turns off compdump loading + compinit -D + compdump + else + # -C flag disables some checks performed by compinit - they are not needed + # because we already have a fresh compdump + compinit -C + fi + unset run_compdump # }}} # Oh-My-Zsh {{{ @@ -64,11 +63,12 @@ plugin completions 'zsh-users/zsh-completions' # wasting time DISABLE_LS_COLORS=true + omz_features=(key-bindings termsupport) omz_plugins=(git extract fasd) plugin oh-my-zsh 'robbyrussell/oh-my-zsh' \ - load='lib/*.zsh' load='plugins/'${^omz_plugins}'/*.plugin.zsh' \ - ignore='lib/(compfix|diagnostics).zsh' \ + load='lib/'${^omz_features}'.zsh' \ + load='plugins/'${^omz_plugins}'/*.plugin.zsh' \ before_load='ZSH="$plugin_dir"' \ after_load='plugin-cfg-path fpath prepend completions functions' \ after_load='plugin-cfg-path fpath prepend plugins/'${^omz_plugins} @@ -83,9 +83,8 @@ plugin fzf 'junegunn/fzf' build='./install --bin' \ plugin alias-tips 'djui/alias-tips' -plugin ssh 'zpm-zsh/ssh' - FAST_WORK_DIR="$ZSH_CACHE_DIR" if [[ "$TERM" != "linux" ]]; then plugin fast-syntax-highlighting 'zdharma/fast-syntax-highlighting' + set-my-syntax-theme() { fast-theme "$ZSH_DOTFILES/my-syntax-theme.ini" "$@"; } fi diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index 39d7182..d0d7a99 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -3,7 +3,7 @@ # Escapes `%` in all arguments by replacing it with `%%`. Escaping is needed so # that untrusted input (e.g. git branch names) doesn't affect prompt rendering. prompt_escape() { - echo "${@//'%'/%%}" + print -n "${@//\%/%%}" } prompt_preexec_hook() { @@ -65,7 +65,7 @@ prompt_vcs_info() { # enable normal prompt expansion sequences which begin with a `%`. # promptsubst # enable parameter/command/arithmetic expansion/substitution in the prompt. -setopt nopromptbang promptcr promptsp promptpercent promptsubst +setopt no_prompt_bang prompt_cr prompt_sp prompt_percent prompt_subst zmodload zsh/datetime autoload -Uz add-zsh-hook diff --git a/zsh/zle.zsh b/zsh/zle.zsh index 3e16c46..e43135f 100644 --- a/zsh/zle.zsh +++ b/zsh/zle.zsh @@ -1,9 +1,13 @@ #!/usr/bin/env zsh +# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html +# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Builtins +# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Standard-Widgets + # _fzf_history_widget {{{ # taken from https://github.com/junegunn/fzf/blob/master/shell/key-bindings.zsh _fzf_history_widget() { - setopt localoptions pipefail + setopt local_options pipe_fail local selected selected=( $(fc -rl 1 | @@ -127,3 +131,20 @@ zle -N _palette_widget bindkey "^[P" _palette_widget # }}} + +# expand-or-complete-with-dots {{{ + expand-or-complete-with-dots() { + local wrap_ctrl_supported + if (( ${+terminfo[rmam]} && ${+terminfo[smam]} )); then + wrap_ctrl_supported=1 + fi + # toggle line-wrapping off and back on again + if [[ -n "$wrap_ctrl_supported" ]]; then echoti rmam; fi + print -Pn "%F{red}...%f" + if [[ -n "$wrap_ctrl_supported" ]]; then echoti smam; fi + zle expand-or-complete + zle redisplay + } + zle -N expand-or-complete-with-dots + bindkey "^I" expand-or-complete-with-dots +# }}} diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh index d56b2b8..7575607 100644 --- a/zsh/zplg.zsh +++ b/zsh/zplg.zsh @@ -1,3 +1,5 @@ +#!/usr/bin/env zsh + # This... is my DIY plugin manager for Zsh. "Why did I reinvent the wheel yet # again and created my own plugin manager?" you might ask. Well, some of them # are too slow (antigen, zplug), some are too complicated (antigen-hs, zplugin) @@ -22,16 +24,12 @@ # means "put all elements of the array in separate quotes". # 2. I often use the following snippet to exit functions on errors: # eval "$some_user_command_that_might_fail" || return "$?" -# I do this instead of `setopt localoptions errexit` because some plugins +# I do this instead of `setopt local_options err_exit` because some plugins # may not be compatitable with ERREXIT. _ZPLG_SCRIPT_PATH="${(%):-%N}" -# load dependencies {{{ - autoload -Uz colors && colors -# }}} - # $ZPLG_HOME is a directory where all your plugins are downloaded, it also # might contain in the future some kind of state/lock/database files. It is @@ -118,7 +116,7 @@ _zplg_run_commands() { # inside a function which reverts NULL_GLOB to its previous value as soon as # the function returns. _zplg_expand_pattern() { - setopt localoptions nullglob + setopt local_options null_glob local pattern="$1" out_var_name="$2" # ${~var_name} turns on globbing for this expansion, note lack of quotes: as # it turns out glob expansions are automatically quoted by design, and when diff --git a/zsh/zshrc b/zsh/zshrc index 37866e9..de93265 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -2,9 +2,10 @@ ZSH_DOTFILES="${0:h}" -for script in functions path env plugins aliases zstyle zle prompt colorscheme; do +autoload -U colors && colors + +for script in functions options path env aliases plugins completion zle prompt colorscheme; do source "$ZSH_DOTFILES/$script.zsh" - source_if_exists "$ZSH_DOTFILES/custom/$script.zsh" done # add colon after MANPATH so that it doesn't overwrite system MANPATH @@ -12,6 +13,4 @@ MANPATH="$MANPATH:" command_exists rbenv && eval "$(rbenv init -)" -setopt noclobber - welcome diff --git a/zsh/zstyle.zsh b/zsh/zstyle.zsh deleted file mode 100644 index 5d905d9..0000000 --- a/zsh/zstyle.zsh +++ /dev/null @@ -1,3 +0,0 @@ -if [[ -n "$LS_COLORS" ]]; then - zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}" -fi From 16b40e19828d7e87b53585410e2c41c271f3f88b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 25 Sep 2019 08:43:01 +0300 Subject: [PATCH 209/713] add some files from /etc --- etc/initcpio/hooks/bootmsg | 5 +++++ etc/initcpio/install/bootmsg | 11 +++++++++++ etc/locale.conf | 13 +++++++++++++ etc/sudoers.d/99_dmitmel_dotfiles | 1 + 4 files changed, 30 insertions(+) create mode 100644 etc/initcpio/hooks/bootmsg create mode 100644 etc/initcpio/install/bootmsg create mode 100644 etc/locale.conf create mode 100644 etc/sudoers.d/99_dmitmel_dotfiles diff --git a/etc/initcpio/hooks/bootmsg b/etc/initcpio/hooks/bootmsg new file mode 100644 index 0000000..fc8ad1e --- /dev/null +++ b/etc/initcpio/hooks/bootmsg @@ -0,0 +1,5 @@ +#!/usr/bin/ash + +run_hook() { + cat /etc/bootmsg +} diff --git a/etc/initcpio/install/bootmsg b/etc/initcpio/install/bootmsg new file mode 100644 index 0000000..170495f --- /dev/null +++ b/etc/initcpio/install/bootmsg @@ -0,0 +1,11 @@ +#!/bin/bash + +build() { + add_file /etc/bootmsg && add_runscript +} + +help() { + cat < Date: Wed, 25 Sep 2019 18:04:32 +0300 Subject: [PATCH 210/713] [zsh] fix hosts completion when ssh config doesn't exist --- zsh/completion.zsh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/zsh/completion.zsh b/zsh/completion.zsh index 548955d..03c1401 100644 --- a/zsh/completion.zsh +++ b/zsh/completion.zsh @@ -38,4 +38,11 @@ zstyle ':completion:*:processes' command "ps xo pid,user,cmd" zstyle ':completion:*:processes-names' command "ps xho comm=" zstyle ':completion:*:processes' force-list always -zstyle -e ':completion:*:hosts' hosts 'reply=("${(@f)$(awk "match(\$0, /^Host[[:blank:]]*/) { print substr(\$0, RLENGTH+1); }" ~/.ssh/config)}")' +_completion_get_hosts() { + print localhost + if [[ -f ~/.ssh/config ]]; then + awk "match(\$0, /^Host[[:blank:]]*/) { print substr(\$0, RLENGTH+1); }" ~/.ssh/config + fi +} +zstyle -e ':completion:*:hosts' hosts 'reply=("${(@f)$(_completion_get_hosts)}") +' From 9e2fe80dde747235998a571ce13cd2df61622f60 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 26 Sep 2019 00:45:33 +0300 Subject: [PATCH 211/713] [zsh] comment out expand-or-complete-with-dots --- zsh/zle.zsh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/zsh/zle.zsh b/zsh/zle.zsh index e43135f..6a981d1 100644 --- a/zsh/zle.zsh +++ b/zsh/zle.zsh @@ -132,19 +132,19 @@ bindkey "^[P" _palette_widget # }}} -# expand-or-complete-with-dots {{{ - expand-or-complete-with-dots() { - local wrap_ctrl_supported - if (( ${+terminfo[rmam]} && ${+terminfo[smam]} )); then - wrap_ctrl_supported=1 - fi - # toggle line-wrapping off and back on again - if [[ -n "$wrap_ctrl_supported" ]]; then echoti rmam; fi - print -Pn "%F{red}...%f" - if [[ -n "$wrap_ctrl_supported" ]]; then echoti smam; fi - zle expand-or-complete - zle redisplay - } - zle -N expand-or-complete-with-dots - bindkey "^I" expand-or-complete-with-dots -# }}} +# # expand-or-complete-with-dots {{{ +# expand-or-complete-with-dots() { +# local wrap_ctrl_supported +# if (( ${+terminfo[rmam]} && ${+terminfo[smam]} )); then +# wrap_ctrl_supported=1 +# fi +# # toggle line-wrapping off and back on again +# if [[ -n "$wrap_ctrl_supported" ]]; then echoti rmam; fi +# print -Pn "%F{red}...%f" +# if [[ -n "$wrap_ctrl_supported" ]]; then echoti smam; fi +# zle expand-or-complete +# zle redisplay +# } +# zle -N expand-or-complete-with-dots +# bindkey "^I" expand-or-complete-with-dots +# # }}} From 207bf799cfce078225710e49ddaa24d9989c0150 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 28 Sep 2019 00:02:23 +0300 Subject: [PATCH 212/713] [nvim] modify mapping to write all files --- nvim/lib/files.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lib/files.vim b/nvim/lib/files.vim index a37be01..5b62535 100644 --- a/nvim/lib/files.vim +++ b/nvim/lib/files.vim @@ -4,7 +4,7 @@ set fileformats=unix,dos,mac set wildignore+=.git,.svn,.hg,.DS_Store,*~ " arguably one of the most useful mappings -nnoremap &buftype is# '' ? ":write\" : "\" +nnoremap &buftype is# '' ? ":writewall\" : "\" " ripgrep (rg) {{{ From fcd8679682492abc6acb5f3f7d200d4552e8505c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 28 Sep 2019 17:36:00 +0300 Subject: [PATCH 213/713] [zsh] add bytecount function --- zsh/functions.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 90dd126..38434e7 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -2,9 +2,9 @@ count() { echo "$#"; } -mkcd() { - mkdir -p "$@" && cd "${@[-1]}" -} +bytecount() { wc -c "$@" | numfmt --to=iec-i; } + +mkcd() { mkdir -p "$@" && cd "${@[-1]}"; } is_linux() { [[ "$OSTYPE" == linux* ]]; } is_macos() { [[ "$OSTYPE" == darwin* ]]; } From e71bdf304fcd890a2b54a8b0bff47cad74725725 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 29 Sep 2019 14:03:29 +0300 Subject: [PATCH 214/713] [nvim] open Git status in a vertical split --- nvim/lib/git.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lib/git.vim b/nvim/lib/git.vim index 8f2626b..66ca1dd 100644 --- a/nvim/lib/git.vim +++ b/nvim/lib/git.vim @@ -2,7 +2,7 @@ let g:gitgutter_map_keys = 0 nnoremap gg :G nnoremap g :Git - nnoremap gs :Gstatus + nnoremap gs :vertical Gstatus nnoremap gd :Gdiff nnoremap gb :Gblame nnoremap gw :Gbrowse From 5444d2b78a1fb93b72f3fd271e172f48e6d5e83f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 3 Oct 2019 23:36:20 +0300 Subject: [PATCH 215/713] [zsh] change string quotes in aliases.zsh --- zsh/aliases.zsh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 69eb869..e29c48d 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -14,26 +14,26 @@ alias diff='diff --color=auto' # exa is a modern replacement for ls - https://the.exa.website/ if command_exists exa; then - alias ls="exa --classify --group-directories-first" - alias lsa="ls --all" - alias l="ls --long --header --binary --group" - alias la="l --all" - alias tree="ls --tree" + alias ls='exa --classify --group-directories-first' + alias lsa='ls --all' + alias l='ls --long --header --binary --group' + alias la='l --all' + alias tree='ls --tree' else - alias ls="ls --classify --group-directories-first --color=auto" - alias lsa="ls --almost-all" - alias l="ls -l --human-readable" - alias la="l --almost-all" + alias ls='ls --classify --group-directories-first --color=auto' + alias lsa='ls --almost-all' + alias l='ls -l --human-readable' + alias la='l --almost-all' fi # fd is a simple, fast and user-friendly alternative to find - https://github.com/sharkdp/fd if command_exists fd; then - alias fda="fd --hidden --no-ignore" + alias fda='fd --hidden --no-ignore' fi # git with hub if command_exists hub; then - alias git="hub" + alias git='hub' fi # make these utils more verbose From 4ed961d434141545115e5c1ece3ad04b291bed57 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 6 Oct 2019 13:23:31 +0300 Subject: [PATCH 216/713] [etc] add mkinitcpio for setting console colors --- colorschemes/build.sh | 1 + colorschemes/out/setvtrgb.txt | 3 +++ colorschemes/setvtrgb.py | 13 +++++++++++++ etc/bootmsg | 29 +++++++++++++++++++++++++++++ etc/initcpio/hooks/consolecolors | 5 +++++ etc/initcpio/install/consolecolors | 11 +++++++++++ 6 files changed, 62 insertions(+) create mode 100644 colorschemes/out/setvtrgb.txt create mode 100755 colorschemes/setvtrgb.py create mode 100644 etc/bootmsg create mode 100644 etc/initcpio/hooks/consolecolors create mode 100644 etc/initcpio/install/consolecolors diff --git a/colorschemes/build.sh b/colorschemes/build.sh index a18bfc4..2c504f8 100755 --- a/colorschemes/build.sh +++ b/colorschemes/build.sh @@ -10,6 +10,7 @@ declare -A apps=( [iterm]=itermcolors [kitty]=conf [nvim]=vim + [setvtrgb]=txt [shell]=zsh [termux]=properties ) diff --git a/colorschemes/out/setvtrgb.txt b/colorschemes/out/setvtrgb.txt new file mode 100644 index 0000000..5886b18 --- /dev/null +++ b/colorschemes/out/setvtrgb.txt @@ -0,0 +1,3 @@ +45,242,153,255,102,204,102,211,116,242,153,255,102,204,102,242 +45,119,204,204,153,153,204,208,115,119,204,204,153,153,204,240 +45,122,153,102,204,204,204,200,105,122,153,102,204,204,204,236 diff --git a/colorschemes/setvtrgb.py b/colorschemes/setvtrgb.py new file mode 100755 index 0000000..366cc56 --- /dev/null +++ b/colorschemes/setvtrgb.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import _theme as theme + +for i in range(3): + print( + ",".join( + [ + str(int(color[2 * i + 1 : 2 * i + 3], 16)) + for color in theme.ansi_colors[:16] + ] + ) + ) diff --git a/etc/bootmsg b/etc/bootmsg new file mode 100644 index 0000000..7c271ca --- /dev/null +++ b/etc/bootmsg @@ -0,0 +1,29 @@ + + + ` + -: + .//: + `////- + `://///. + :///////. + -/////////. `://- ./- .- + `://////////` .///- ./- ` + -:..://///////`  -:::::::-` .--- `--:- `.-----.`` .///-`.....`` ./- ` ` `````` ` + -////:::////////` .//////////:` `////:////..://////////- .//::////////:. ./- .: :-`-:::::::. -:. -: `:. -- + -/////////////////` .---.---////- `/////:-.`:////:--.-:/:` .////:....-////` ./- -/` //:.` `-/. -/. :/` .::` `::` + -//////////++++/////` .:/++++++++++- `////. ./++/` ` .///: -///. ./- -+` `++ /: -/. :/` `-:..:-` + -////++++oooooooooo+++. :hhhhs+/+shdhh/ `yyys` +yyh/ -+++- -+++. -+- :o` .oo +/ :o. /+` .//- + -/+++oooooooooooooooooo+. oddd/ sddd+ .dddd` /dddy` ` :dhh/ +hhh- -o: :o` `oo +/ :o. +o` .++/+. + :+oooooooo+-..-/+oooooooo+. :dddy:``./hddd+ .dddd` `sdddy/-``./yo- :ddd+ oddd: -o: :o` +o +/ :o- .+o` :+:` -+:` + `/ooooooooo:` .+oooooooo+. /hddddddddsyd+ .dddd` `/hdddddddddds`:ddd+ oddd: -o: :o` +o +/ .++-` `.:/+o` `/+- .//. + `/ooooooooo/ .ooooooooo+- `/+ssso/.+o+- `so+: `-/+ssss+/. :ss+- +yso. ./. ./ /: :: .:/++++/-`//` -/` :/ + `/oooooooooo` /oooooo++++- + `+ooooooooooo` :oooooo++/-:. A simple, lightweight GNU/Linux distribution. + .+ooooooooooo+` :+oooooooo+/-` + .+oooooo++/:-.` `..-:/++ooooo+: + .+oo++/-.` `.-:++ooo: + -++/-.` `-:++/` + -++/-.` `-:++/` + .:.` .--  + + diff --git a/etc/initcpio/hooks/consolecolors b/etc/initcpio/hooks/consolecolors new file mode 100644 index 0000000..0956b53 --- /dev/null +++ b/etc/initcpio/hooks/consolecolors @@ -0,0 +1,5 @@ +#!/usr/bin/ash + +run_hook() { + setvtrgb - < /etc/consolecolors +} diff --git a/etc/initcpio/install/consolecolors b/etc/initcpio/install/consolecolors new file mode 100644 index 0000000..7c871c4 --- /dev/null +++ b/etc/initcpio/install/consolecolors @@ -0,0 +1,11 @@ +#!/bin/bash + +build() { + add_file /etc/consolecolors && add_binary /usr/bin/setvtrgb && add_runscript +} + +help() { + cat < Date: Sun, 6 Oct 2019 13:24:46 +0300 Subject: [PATCH 217/713] [zsh] add global Yarn packages to PATH --- zsh/path.zsh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/zsh/path.zsh b/zsh/path.zsh index f3b0dfd..9b096bd 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -9,6 +9,21 @@ typeset -T PKG_CONFIG_PATH pkg_config_path ':' typeset -U path fpath manpath ldflags cppflags pkg_config_path export -U PATH FPATH MANPATH LDFLAGS CPPFLAGS PKG_CONFIG_PATH +path_append() { + local arr_name="$1" value="$2" + if eval "if (( \${${arr_name}[(ie)\$value]} > \${#${arr_name}} ))"; then + eval "${arr_name}+=(\"\$value\")" + eval "${arr_name}=(\"\${${arr_name}[@]}\" \"\$value\")" + fi +} + +path_prepend() { + local arr_name="$1" value="$2" + if eval "if (( \${${arr_name}[(ie)\$value]} > \${#${arr_name}} ))"; then + eval "${arr_name}=(\"\$value\" \"\${${arr_name}[@]}\")" + fi +} + if is_macos; then path=( ~/Library/Python/*/bin @@ -39,7 +54,10 @@ if is_macos; then done fi -# add Go binaries +# Yarn global packages +path=(~/.yarn/bin "${path[@]}") + +# Go export GOPATH=~/.go path=("$GOPATH/bin" "${path[@]}") From 3224d1149681a87922858ee5b7ecf9e03ce3dfc3 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 9 Oct 2019 00:19:53 +0300 Subject: [PATCH 218/713] add a PKGBUILD for installing Arch system files --- system/arch/.gitignore | 3 ++ system/arch/PKGBUILD | 28 +++++++++++++++++++ {etc => system/files/etc}/bootmsg | 0 system/files/etc/consolecolors | 1 + .../files/etc}/initcpio/hooks/bootmsg | 0 .../files/etc}/initcpio/hooks/consolecolors | 0 .../files/etc}/initcpio/install/bootmsg | 0 .../files/etc}/initcpio/install/consolecolors | 0 {etc => system/files/etc}/locale.conf | 0 .../files/etc}/sudoers.d/99_dmitmel_dotfiles | 0 10 files changed, 32 insertions(+) create mode 100644 system/arch/.gitignore create mode 100644 system/arch/PKGBUILD rename {etc => system/files/etc}/bootmsg (100%) create mode 120000 system/files/etc/consolecolors rename {etc => system/files/etc}/initcpio/hooks/bootmsg (100%) rename {etc => system/files/etc}/initcpio/hooks/consolecolors (100%) rename {etc => system/files/etc}/initcpio/install/bootmsg (100%) rename {etc => system/files/etc}/initcpio/install/consolecolors (100%) rename {etc => system/files/etc}/locale.conf (100%) rename {etc => system/files/etc}/sudoers.d/99_dmitmel_dotfiles (100%) diff --git a/system/arch/.gitignore b/system/arch/.gitignore new file mode 100644 index 0000000..43d261a --- /dev/null +++ b/system/arch/.gitignore @@ -0,0 +1,3 @@ +pkg +src +*.pkg.tar.xz diff --git a/system/arch/PKGBUILD b/system/arch/PKGBUILD new file mode 100644 index 0000000..ebe243e --- /dev/null +++ b/system/arch/PKGBUILD @@ -0,0 +1,28 @@ +# Maintainer: Dmytro Meleshko +pkgname=dmitmel-dotfiles +pkgver=0 +pkgrel=1 +pkgdesc="dmitmel's dotfiles" +arch=('any') +url="https://github.com/dmitmel/dotfiles" +license=('MIT') +backup=() + +package() { + cd "$(dirname "${BASH_SOURCE[0]}")/../files" + install -Dm644 ../../LICENSE -t "$pkgdir/usr/share/licenses/$pkgname" + _install_files * +} + +_install_files() { + local path real_path mode; for path in "$@"; do + real_path="$(realpath "$path")" + mode="$(stat --format "%a" "$real_path")" + if [[ -d "$path" ]]; then + install --directory --mode "$mode" "$pkgdir/$path" + _install_files "$path"/* + else + install --mode "$mode" "$real_path" "$pkgdir/$path" + fi + done +} diff --git a/etc/bootmsg b/system/files/etc/bootmsg similarity index 100% rename from etc/bootmsg rename to system/files/etc/bootmsg diff --git a/system/files/etc/consolecolors b/system/files/etc/consolecolors new file mode 120000 index 0000000..88086d3 --- /dev/null +++ b/system/files/etc/consolecolors @@ -0,0 +1 @@ +../../../colorschemes/out/setvtrgb.txt \ No newline at end of file diff --git a/etc/initcpio/hooks/bootmsg b/system/files/etc/initcpio/hooks/bootmsg similarity index 100% rename from etc/initcpio/hooks/bootmsg rename to system/files/etc/initcpio/hooks/bootmsg diff --git a/etc/initcpio/hooks/consolecolors b/system/files/etc/initcpio/hooks/consolecolors similarity index 100% rename from etc/initcpio/hooks/consolecolors rename to system/files/etc/initcpio/hooks/consolecolors diff --git a/etc/initcpio/install/bootmsg b/system/files/etc/initcpio/install/bootmsg similarity index 100% rename from etc/initcpio/install/bootmsg rename to system/files/etc/initcpio/install/bootmsg diff --git a/etc/initcpio/install/consolecolors b/system/files/etc/initcpio/install/consolecolors similarity index 100% rename from etc/initcpio/install/consolecolors rename to system/files/etc/initcpio/install/consolecolors diff --git a/etc/locale.conf b/system/files/etc/locale.conf similarity index 100% rename from etc/locale.conf rename to system/files/etc/locale.conf diff --git a/etc/sudoers.d/99_dmitmel_dotfiles b/system/files/etc/sudoers.d/99_dmitmel_dotfiles similarity index 100% rename from etc/sudoers.d/99_dmitmel_dotfiles rename to system/files/etc/sudoers.d/99_dmitmel_dotfiles From 6f291c8a35220b724fd2ff1d9b3f187db2ebc9cc Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 9 Oct 2019 00:32:05 +0300 Subject: [PATCH 219/713] [system] add (basic) installation script --- system/install.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 system/install.sh diff --git a/system/install.sh b/system/install.sh new file mode 100755 index 0000000..90042e4 --- /dev/null +++ b/system/install.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +set -eu + +distro="$(lsb_release -si)" +case "$distro" in + Arch) + cd arch + makepkg --syncdeps --force --install + ;; + *) + echo >&2 "distro '$distro' is unsupported" + exit 1 + ;; +esac From 882d2088f08c71208b9dcf8340fee47003d1ac30 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 10 Oct 2019 00:41:33 +0300 Subject: [PATCH 220/713] [system] rewrite editor lookup in sudoers --- system/files/etc/sudoers.d/99_dmitmel_dotfiles | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/system/files/etc/sudoers.d/99_dmitmel_dotfiles b/system/files/etc/sudoers.d/99_dmitmel_dotfiles index 4e8569e..161c56b 100644 --- a/system/files/etc/sudoers.d/99_dmitmel_dotfiles +++ b/system/files/etc/sudoers.d/99_dmitmel_dotfiles @@ -1 +1,11 @@ -Defaults pwfeedback, env_editor +# Show asterisks when typing passwords. +Defaults pwfeedback + +# Disable launching arbitrary editors from the EDITOR, VISUAL and SUDO_EDITOR +# variables when using visudo because this is a potential security hole. +Defaults !env_editor +# Whitelist of editors which visudo is allowed to run. +Defaults editor=/usr/bin/nvim:/usr/bin/vim:/usr/bin/nano:/bin/nano +# Pass-through the editor environment variables so that visudo will be able to +# see them. +Defaults env_keep+="EDITOR VISUAL SUDO_EDITOR" From fc5ed3fe784b2c19755441d5e86908f85e0d4074 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 11 Oct 2019 15:45:40 +0300 Subject: [PATCH 221/713] [nvim] add mappings for improving consistency --- nvim/lib/editing.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nvim/lib/editing.vim b/nvim/lib/editing.vim index 83d758c..bd85241 100644 --- a/nvim/lib/editing.vim +++ b/nvim/lib/editing.vim @@ -82,6 +82,11 @@ set foldmethod=marker " noremap cx "+d " }}} + " make the default Vim mappings more consistent + " https://www.reddit.com/r/vim/comments/dgbr9l/mappings_i_would_change_for_more_consistent_vim/ + nnoremap U + nnoremap Y y$ + " }}} From d991810919a7dd0bfc67a7a2e8e68ab9c3ffe82a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 17 Oct 2019 00:32:42 +0300 Subject: [PATCH 222/713] [zsh] remove unneeded OMZ configuration --- zsh/plugins.zsh | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index f69dd75..abdda7f 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -40,29 +40,6 @@ plugin completions 'zsh-users/zsh-completions' # Oh-My-Zsh {{{ - # disable automatic updates because OMZ is managed by my plugin manager - DISABLE_AUTO_UPDATE=true - - # use hyphen-insensitive completion (makes `_` and `-` interchangeable) - HYPHEN_INSENSITIVE=true - - # enable command auto-correction - ENABLE_CORRECTION=true - - # display red dots while waiting for completion - COMPLETION_WAITING_DOTS=true - - # disable marking untracked files under VCS as dirty (this makes repository - # status check for large repositories much faster) - DISABLE_UNTRACKED_FILES_DIRTY=true - - # command execution time stamp shown in the history - HIST_STAMPS=dd.mm.yyyy - - # ls colors are handled by my dotfiles, so disable that part of OMZ to avoid - # wasting time - DISABLE_LS_COLORS=true - omz_features=(key-bindings termsupport) omz_plugins=(git extract fasd) From 7c351c2f229c9b88bc71def21eedeb7643791dbd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 25 Oct 2019 20:50:15 +0300 Subject: [PATCH 223/713] [zsh] add performance timers --- zsh/plugins.zsh | 16 +++++++++++----- zsh/zshrc | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index abdda7f..069b173 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -7,7 +7,13 @@ fi source "$ZSH_DOTFILES/zplg.zsh" -plugin completions 'zsh-users/zsh-completions' +_plugin() { + _perf_timer_start "plugin $1" + plugin "$@" + _perf_timer_stop "plugin $1" +} + +_plugin completions 'zsh-users/zsh-completions' # compinit {{{ # note that completion system must be initialized after zsh-completions and @@ -43,7 +49,7 @@ plugin completions 'zsh-users/zsh-completions' omz_features=(key-bindings termsupport) omz_plugins=(git extract fasd) - plugin oh-my-zsh 'robbyrussell/oh-my-zsh' \ + _plugin oh-my-zsh 'robbyrussell/oh-my-zsh' \ load='lib/'${^omz_features}'.zsh' \ load='plugins/'${^omz_plugins}'/*.plugin.zsh' \ before_load='ZSH="$plugin_dir"' \ @@ -54,14 +60,14 @@ plugin completions 'zsh-users/zsh-completions' # }}} -plugin fzf 'junegunn/fzf' build='./install --bin' \ +_plugin fzf 'junegunn/fzf' build='./install --bin' \ after_load='plugin-cfg-path path prepend bin' \ after_load='plugin-cfg-path manpath prepend man' -plugin alias-tips 'djui/alias-tips' +_plugin alias-tips 'djui/alias-tips' FAST_WORK_DIR="$ZSH_CACHE_DIR" if [[ "$TERM" != "linux" ]]; then - plugin fast-syntax-highlighting 'zdharma/fast-syntax-highlighting' + _plugin fast-syntax-highlighting 'zdharma/fast-syntax-highlighting' set-my-syntax-theme() { fast-theme "$ZSH_DOTFILES/my-syntax-theme.ini" "$@"; } fi diff --git a/zsh/zshrc b/zsh/zshrc index de93265..ea4fd32 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -4,8 +4,39 @@ ZSH_DOTFILES="${0:h}" autoload -U colors && colors +# Performance {{{ + + zmodload zsh/datetime + typeset -A _perf_timers + + _perf_timer_start() { + local name="$1" + if [[ -z "$name" ]]; then + print >&2 "$0: usage: $0 " + return 1 + fi + _perf_timers[$name]="$EPOCHREALTIME" + } + + _perf_timer_stop() { + local name="$1" + if [[ -z "$name" ]]; then + print >&2 "$0: usage: $0 " + return 1 + fi + local stop_time="$EPOCHREALTIME" start_time="${_perf_timers[$name]}" + local -i duration="$(( (stop_time - start_time) * 1000 ))" + print -- "\e[${color[faint]}m==>${reset_color} ${name}: ${duration}ms" + } + +# }}} + +_perf_timer_start "total" + for script in functions options path env aliases plugins completion zle prompt colorscheme; do + _perf_timer_start "$script.zsh" source "$ZSH_DOTFILES/$script.zsh" + _perf_timer_stop "$script.zsh" done # add colon after MANPATH so that it doesn't overwrite system MANPATH @@ -13,4 +44,6 @@ MANPATH="$MANPATH:" command_exists rbenv && eval "$(rbenv init -)" +_perf_timer_stop "total" + welcome From a26517f50c51deee904eb439cdaf7a1364bdd881 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 27 Oct 2019 10:22:03 +0200 Subject: [PATCH 224/713] [zsh] remove useless `unset` from zplg --- zsh/zplg.zsh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh index 7575607..73b343e 100644 --- a/zsh/zplg.zsh +++ b/zsh/zplg.zsh @@ -146,7 +146,7 @@ _zplg_load() { _zplg_source_git_download() { local plugin_url="$1" plugin_dir="$2" - git clone --depth=1 --recurse-submodules -- "$plugin_url" "$plugin_dir" + git clone --recurse-submodules -- "$plugin_url" "$plugin_dir" } _zplg_source_git_upgrade() { @@ -154,6 +154,17 @@ _zplg_load() { ( cd "$plugin_dir" && git pull && git submodule update --init --recursive ) } + # small helper for the git source + plugin-git-checkout-latest-version() { + local latest_tag + git tag --list --sort -version:refname | read -r latest_tag + if (( ${#tags} == 0 )); then + _zplg_error "$0: no tags in the Git repository" + return 1 + fi + # git checkout + } + _zplg_source_github_download() { local plugin_url="$1" plugin_dir="$2" _zplg_source_git_download "https://github.com/$plugin_url.git" "$plugin_dir" @@ -343,7 +354,6 @@ plugin() { # extra ${...} is needed to turn array into a string by joining it with # spaces ZPLG_LOADED_PLUGIN_BUILD_CMDS[$plugin_id]="${${(@q)plugin_build}}" - unset plugin_build_quoted fi } always { From 5e1bd6fa822bdd2dac679533824d907110ec94a0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 27 Oct 2019 10:23:05 +0200 Subject: [PATCH 225/713] [zsh] chmod -x zshrc --- zsh/zshrc | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 zsh/zshrc diff --git a/zsh/zshrc b/zsh/zshrc old mode 100755 new mode 100644 From e036df7c489bde73997d46bd656f5d8edc808e75 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 27 Oct 2019 21:08:19 +0200 Subject: [PATCH 226/713] [welcome] remove "Local IP" --- zsh/welcome/system_info.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/zsh/welcome/system_info.py b/zsh/welcome/system_info.py index ce2993d..5ecd0b8 100644 --- a/zsh/welcome/system_info.py +++ b/zsh/welcome/system_info.py @@ -20,7 +20,8 @@ def get_system_info(): info_lines.append(line) username = getuser() - hostname, local_ip = _get_hostname() + # hostname, local_ip = _get_hostname() + hostname = _get_hostname() info_lines.append( bright_colored(username, Fore.BLUE) + "@" + bright_colored(hostname, Fore.RED) @@ -44,7 +45,7 @@ def get_system_info(): info("Shell", _get_shell()) - info("IP address", local_ip) + # info("IP address", local_ip) info_lines.append("") @@ -63,8 +64,9 @@ def get_system_info(): def _get_hostname(): hostname = socket.gethostname() - local_ip = socket.gethostbyname(hostname) - return hostname, local_ip + # local_ip = socket.gethostbyname(hostname) + # return hostname, local_ip + return hostname def _get_uptime(): From 30c90cdfb60e100fad5cac2be96b7e695fd428dd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 27 Oct 2019 22:34:27 +0200 Subject: [PATCH 227/713] [zsh] add viscd function --- zsh/functions.zsh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 38434e7..b858c13 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -6,6 +6,16 @@ bytecount() { wc -c "$@" | numfmt --to=iec-i; } mkcd() { mkdir -p "$@" && cd "${@[-1]}"; } +viscd() { + local temp_file chosen_dir + temp_file="$(mktemp)" + ranger --choosedir="$temp_file" -- "${@:-$PWD}" + if chosen_dir="$(<"$temp_file")" && [[ -n "$chosen_dir" ]]; then + cd -- "$chosen_dir" + fi + rm -f -- "$temp_file" +} + is_linux() { [[ "$OSTYPE" == linux* ]]; } is_macos() { [[ "$OSTYPE" == darwin* ]]; } is_android() { [[ "$OSTYPE" == linux-android ]]; } From 0f082b90a19179801afd8230074d513166a10fd6 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 29 Oct 2019 00:13:40 +0200 Subject: [PATCH 228/713] [zsh] improve viscd --- zsh/functions.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index b858c13..3c2df69 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -8,9 +8,9 @@ mkcd() { mkdir -p "$@" && cd "${@[-1]}"; } viscd() { local temp_file chosen_dir - temp_file="$(mktemp)" + temp_file="$(mktemp -t ranger_cd.XXXXXXXXXX)" ranger --choosedir="$temp_file" -- "${@:-$PWD}" - if chosen_dir="$(<"$temp_file")" && [[ -n "$chosen_dir" ]]; then + if chosen_dir="$(<"$temp_file")" && [[ -n "$chosen_dir" && "$chosen_dir" != "$PWD" ]]; then cd -- "$chosen_dir" fi rm -f -- "$temp_file" From 8841a89281ee882856e1cd5ee6de5ae56b73033b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 29 Oct 2019 17:23:23 +0200 Subject: [PATCH 229/713] [scripts] add Python calculator --- scripts/pycalc3 | 9 +++++++++ scripts/pycalc_startup.py | 3 +++ 2 files changed, 12 insertions(+) create mode 100755 scripts/pycalc3 create mode 100644 scripts/pycalc_startup.py diff --git a/scripts/pycalc3 b/scripts/pycalc3 new file mode 100755 index 0000000..e5154b7 --- /dev/null +++ b/scripts/pycalc3 @@ -0,0 +1,9 @@ +#!/bin/sh + +for python in bpython python3; do + if python="$(command -v "$python")"; then + break + fi +done +echo "using Python '$python'" +PYTHONSTARTUP="$(dirname "$0")/pycalc_startup.py" "$python" "$@" diff --git a/scripts/pycalc_startup.py b/scripts/pycalc_startup.py new file mode 100644 index 0000000..7cc169b --- /dev/null +++ b/scripts/pycalc_startup.py @@ -0,0 +1,3 @@ +from math import * + +print("loaded Python calculator") From ef379e93c4b66e88f4c3b92f7da2d33d55946f40 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 29 Oct 2019 21:59:15 +0200 Subject: [PATCH 230/713] [python] add BPython config --- python/bpython/config | 2 ++ python/bpython/dmitmel.theme | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 python/bpython/config create mode 100644 python/bpython/dmitmel.theme diff --git a/python/bpython/config b/python/bpython/config new file mode 100644 index 0000000..4d8822d --- /dev/null +++ b/python/bpython/config @@ -0,0 +1,2 @@ +[general] +color_scheme = dmitmel diff --git a/python/bpython/dmitmel.theme b/python/bpython/dmitmel.theme new file mode 100644 index 0000000..d519a5b --- /dev/null +++ b/python/bpython/dmitmel.theme @@ -0,0 +1,29 @@ +# Each letter represents a colour marker: +# k, r, g, y, b, m, c, w, d +# which stands for: +# blacK, Red, Green, Yellow, Blue, Magenta, Cyan, White, Default +# Capital letters represent bold +# Copy to $XDG_CONFIG_HOME/bpython/foo.theme and set "color_scheme = foo" in +# $XDG_CONFIG_HOME/bpython/config ($XDG_CONFIG_HOME defaults to ~/.config) + +[syntax] +keyword = m +name = b +comment = w +string = g +error = R +number = y +operator = w +punctuation = w +token = c +paren = k + +[interface] +# XXX: gnome-terminal appears to be braindead. The cursor will disappear unless +# you set the background colour to "d". +background = d +output = w +main = W +prompt = G +prompt_more = G +right_arrow_suggestion = c From a084fce534662fb403cce3c0e97370ba2c3c4387 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 30 Oct 2019 16:47:17 +0200 Subject: [PATCH 231/713] [welcome] refactor local IPv4 address lookup --- zsh/welcome/system_info.py | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/zsh/welcome/system_info.py b/zsh/welcome/system_info.py index 5ecd0b8..2f39a2e 100644 --- a/zsh/welcome/system_info.py +++ b/zsh/welcome/system_info.py @@ -20,7 +20,6 @@ def get_system_info(): info_lines.append(line) username = getuser() - # hostname, local_ip = _get_hostname() hostname = _get_hostname() info_lines.append( @@ -45,8 +44,6 @@ def get_system_info(): info("Shell", _get_shell()) - # info("IP address", local_ip) - info_lines.append("") info("CPU Usage", "%s", _get_cpu_usage()) @@ -59,13 +56,16 @@ def get_system_info(): if battery_info is not None: info("Battery", "%s (%s)", *battery_info) + info_lines.append("") + + for local_ip_address in _get_local_ipv4_addresses(): + info("Local IPv4 Address (%s)", "%s", *local_ip_address) + return logo_lines, info_lines def _get_hostname(): hostname = socket.gethostname() - # local_ip = socket.gethostbyname(hostname) - # return hostname, local_ip return hostname @@ -121,6 +121,7 @@ def _get_memory(): def _get_disks(): result = [] + for disk in psutil.disk_partitions(all=False): if psutil.WINDOWS and ("cdrom" in disk.opts or disk.fstype == ""): # skip cd-rom drives with no disk in it on Windows; they may raise @@ -137,6 +138,7 @@ def _get_disks(): colorize_percent(usage.percent, warning=70, critical=85), ) ) + return result @@ -161,6 +163,23 @@ def _get_battery(): return colorize_percent(percent, critical=10, warning=20, inverse=True), status +def _get_local_ipv4_addresses(): + result = [] + + for interface, addresses in psutil.net_if_addrs().items(): + for address in addresses: + if address.family != socket.AF_INET: + # allow only IPv4 addresses (skip IPv6 and MAC, for example) + continue + if interface.startswith("lo"): + # skip loopback interfaces + continue + + result.append((interface, address.address)) + + return result + + def _get_distro_info(): if psutil.WINDOWS: return "windows", platform.system(), platform.release(), "" From 8f36c52cd84897476cbed04080ee6f0efc3c1159 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 30 Oct 2019 18:32:43 +0200 Subject: [PATCH 232/713] [zsh] add function `git_current_branch` --- zsh/functions.zsh | 15 +++++++++++++++ zsh/prompt.zsh | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 3c2df69..6475bf4 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -61,3 +61,18 @@ else fi eval "clipcopy(){$copy_cmd;};clippaste(){$paste_cmd;}" unset copy_cmd paste_cmd + +# for compatibility with Oh-My-Zsh plugins +# Source: https://github.com/robbyrussell/oh-my-zsh/blob/5911aea46c71a2bcc6e7c92e5bebebf77b962233/lib/git.zsh#L58-L71 +git_current_branch() { + if [[ "$(command git rev-parse --is-inside-work-tree)" != true ]]; then + return 1 + fi + + local ref + ref="$( + command git symbolic-ref --quiet HEAD 2> /dev/null || + command git rev-parse --short HEAD 2> /dev/null + )" || return + echo "${ref#refs/heads/}" +} diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index d0d7a99..3fba7a8 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -42,7 +42,7 @@ prompt_vcs_info() { fi local branch="(no branches)" line - git branch | while IFS= read -r line; do + command git branch | while IFS= read -r line; do # find a line which starts with `* `, it contains the current branch name if [[ "$line" == "* "* ]]; then # remove the `* ` prefix From 6ebd7f6728712acca740e346917b094a98dd2f29 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 2 Nov 2019 16:44:47 +0200 Subject: [PATCH 233/713] [nvim] modify XML syntax highlighting --- nvim/colors/dotfiles.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 025eb6b..33561d8 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -166,8 +166,10 @@ " XML {{{ call s:hi('xmlTagName', 0x8, '', '', '') call s:hi('xmlAttrib', 0x9, '', '', '') - hi! link xmlTag NONE - hi! link xmlEndTag xmlTag + hi! link xmlTag Delimiter + hi! link xmlEndTag Delimiter + hi! link xmlAttribPunct Delimiter + hi! link xmlProcessingDelim Delimiter " }}} " Git {{{ From c7b24f9ee6a4768e10e6c61aed2fff4435616265 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 3 Nov 2019 13:14:41 +0200 Subject: [PATCH 234/713] [nvim] modify JS syntax highlighting --- nvim/colors/dotfiles.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 33561d8..0b07e0a 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -274,6 +274,7 @@ hi! link jsUndefined Constant hi! link jsOperatorKeyword Keyword hi! link jsObjectKey Identifier + hi! link jsEnvComment Special " }}} " Markdown {{{ From 313be3691a36bceee06f9b388f1fc17cd1c8f156 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 3 Nov 2019 17:01:32 +0200 Subject: [PATCH 235/713] [nvim] add Emmet support in Jinja/Jinja2/Nunjucks templates --- nvim/lib/languages/html.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nvim/lib/languages/html.vim b/nvim/lib/languages/html.vim index c6bbf8b..24c1ca6 100644 --- a/nvim/lib/languages/html.vim +++ b/nvim/lib/languages/html.vim @@ -1,4 +1,6 @@ if !g:vim_ide | finish | endif call coc#add_extension('coc-html', 'coc-emmet') -let g:coc_filetypes += ['html'] +let s:emmet_filetype_mapping = { 'jinja': 'html' } +let g:coc_filetypes += ['html'] + keys(s:emmet_filetype_mapping) +call coc#config('emmet.includeLanguages', s:emmet_filetype_mapping) From b36f2a4d3599bde42ee87d033103e83a1ad5cebd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 8 Nov 2019 00:15:09 +0200 Subject: [PATCH 236/713] [nvim] enable Prettier for SCSS and LESS --- nvim/lib/languages/css.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lib/languages/css.vim b/nvim/lib/languages/css.vim index 12bbfe5..3ae68ad 100644 --- a/nvim/lib/languages/css.vim +++ b/nvim/lib/languages/css.vim @@ -1,4 +1,4 @@ if !g:vim_ide | finish | endif call coc#add_extension('coc-css') -let g:coc_filetypes += ['css'] +let g:coc_filetypes += ['css', 'scss', 'less'] From 3d856b1b3cabbd6fa10be693fb72ee224770a38e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 9 Nov 2019 22:00:23 +0200 Subject: [PATCH 237/713] [nvim] enable coc.nvim for JSON5 --- nvim/lib/languages/javascript.vim | 1 + nvim/lib/languages/json.vim | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/nvim/lib/languages/javascript.vim b/nvim/lib/languages/javascript.vim index d44f7d8..bf69ecb 100644 --- a/nvim/lib/languages/javascript.vim +++ b/nvim/lib/languages/javascript.vim @@ -15,4 +15,5 @@ call coc#config('prettier', { \ 'trailingComma': 'all', \ 'jsxBracketSameLine': v:true, \ 'eslintIntegration': v:true, +\ 'disableSuccessMessage': v:true \ }) diff --git a/nvim/lib/languages/json.vim b/nvim/lib/languages/json.vim index 1221f66..26ca88d 100644 --- a/nvim/lib/languages/json.vim +++ b/nvim/lib/languages/json.vim @@ -6,4 +6,4 @@ augroup END if !g:vim_ide | finish | endif call coc#add_extension('coc-json') -let g:coc_filetypes += ['json'] +let g:coc_filetypes += ['json', 'json5'] From e80379a2e5f10f28e9645ff457c288b6ded694f7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 9 Nov 2019 23:02:18 +0200 Subject: [PATCH 238/713] [nvim] add EditGlob function --- nvim/lib/files.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nvim/lib/files.vim b/nvim/lib/files.vim index 5b62535..dc66d1b 100644 --- a/nvim/lib/files.vim +++ b/nvim/lib/files.vim @@ -91,6 +91,20 @@ nnoremap &buftype is# '' ? ":writewall\" : "\" command -nargs=* -complete=file Open call s:Open(empty() ? expand('%') : ) " }}} + " EditGlob {{{ + " Yes, I know about the existence of :args, however it modifies the + " argument list, so it doesn't play well with Obsession.vim because it + " saves the argument list in the session file. + function s:EditGlob(...) + for l:glob in a:000 + for l:name in glob(l:glob, 0, 1) + execute 'edit' fnameescape(l:name) + endfor + endfor + endfunction + command -nargs=* -complete=file -bar EditGlob call s:EditGlob() + " }}} + " }}} From 85f880db9e3a13c250e15818948f75ce4381894c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 10 Nov 2019 01:09:41 +0200 Subject: [PATCH 239/713] [zsh] performance messages coloring improvements --- zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/zshrc b/zsh/zshrc index ea4fd32..9747d4d 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -26,7 +26,7 @@ autoload -U colors && colors fi local stop_time="$EPOCHREALTIME" start_time="${_perf_timers[$name]}" local -i duration="$(( (stop_time - start_time) * 1000 ))" - print -- "\e[${color[faint]}m==>${reset_color} ${name}: ${duration}ms" + print -- "$(print -P '%F{8}==>%f') ${name}: ${duration}ms" } # }}} From 18ddb83d4b3dccdf2bbdca84db684b7d1dbb351d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 14 Nov 2019 19:40:52 +0200 Subject: [PATCH 240/713] [scripts] add factors function for pycalc --- scripts/pycalc_startup.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/pycalc_startup.py b/scripts/pycalc_startup.py index 7cc169b..c50dfb0 100644 --- a/scripts/pycalc_startup.py +++ b/scripts/pycalc_startup.py @@ -1,3 +1,14 @@ from math import * + +def factors(n): + result = set() + for i in range(1, int(sqrt(n)) + 1): + div, mod = divmod(n, i) + if mod == 0: + result.add(div) + result.add(mod) + return result + + print("loaded Python calculator") From 0c8010448de606127f3bccdabe5ee87a226a1e52 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 16 Nov 2019 15:04:10 +0200 Subject: [PATCH 241/713] [zsh] remove `open` command on macOS --- zsh/functions.zsh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 6475bf4..140f302 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -35,15 +35,17 @@ lazy_load() { welcome() { "$ZSH_DOTFILES/welcome/main.py"; } -if is_android; then - open_cmd='termux-open' -elif command_exists xdg-open; then - open_cmd='nohup xdg-open &> /dev/null' -else - open_cmd='print >&2 "open: Platform $OSTYPE is not supported"; return 1' +if ! is_macos; then + if is_android; then + open_cmd='termux-open' + elif command_exists xdg-open; then + open_cmd='nohup xdg-open &> /dev/null' + else + open_cmd='print >&2 "open: Platform $OSTYPE is not supported"; return 1' + fi + eval "open(){$open_cmd \"\$@\";}" + unset open_cmd fi -eval "open(){$open_cmd \"\$@\";}" -unset open_cmd if is_macos; then copy_cmd='pbcopy' paste_cmd='pbpaste' From 3705c0313ff18f4091ffcc5dd7aadf8017f2e879 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 17 Nov 2019 13:51:11 +0200 Subject: [PATCH 242/713] [nvim] make tabline buffer positions more consistent --- nvim/lib/interface.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvim/lib/interface.vim b/nvim/lib/interface.vim index 6afbe45..7f4d0b6 100644 --- a/nvim/lib/interface.vim +++ b/nvim/lib/interface.vim @@ -109,6 +109,9 @@ endif let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#coc#enabled = 1 + let g:airline#extensions#tabline#left_sep = ' ' + let g:airline#extensions#tabline#left_alt_sep = '' + let g:coc_status_error_sign = 'E:' let g:coc_status_warning_sign = 'W:' call airline#parts#define_function('coc#status', 'coc#status') From 44c50c191335b04febd0fc1462d4e6533dd276c3 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 18 Nov 2019 21:47:13 +0200 Subject: [PATCH 243/713] [nvim] disable ESLint in TypeScript --- nvim/lib/languages/javascript.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lib/languages/javascript.vim b/nvim/lib/languages/javascript.vim index bf69ecb..2c277e1 100644 --- a/nvim/lib/languages/javascript.vim +++ b/nvim/lib/languages/javascript.vim @@ -7,7 +7,7 @@ if !g:vim_ide | finish | endif call coc#add_extension('coc-tsserver', 'coc-eslint', 'coc-prettier') let g:coc_filetypes += ['javascript', 'javascript.jsx', 'typescript', 'typescript.jsx'] call coc#config('eslint', { -\ 'filetypes': ['javascript', 'javascriptreact', 'typescript', 'typescriptreact'], +\ 'filetypes': ['javascript', 'javascriptreact'], \ 'autoFixOnSave': v:true, \ }) call coc#config('prettier', { From 5a41b8229b5b0da2f4895347a3de942b8e7b49e8 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 19 Nov 2019 21:20:46 +0200 Subject: [PATCH 244/713] [nvim] add syntax highlighting links to colorscheme for TypeScript --- nvim/colors/dotfiles.vim | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 0b07e0a..42b0b75 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -65,12 +65,12 @@ hi! link Structure Keyword hi! link Conditional Keyword call s:hi('Constant', 0x9, '', '', '') - call s:hi('Boolean', 0x9, '', '', '') - call s:hi('Float', 0x9, '', '', '') - call s:hi('Number', 0x9, '', '', '') + hi! link Boolean Constant + hi! link Float Constant + hi! link Number Constant call s:hi('String', 0xB, '', '', '') hi! link Character String - hi! link Quote String + hi! link Quote String call s:hi('Comment', 0x3, '', '', '') hi! link SpecialComment Comment call s:hi('Todo', 'bg', 0xA, 'bold', '') @@ -256,7 +256,9 @@ " JavaScript {{{ hi! link javaScriptBraces Delimiter + hi! link jsParens Delimiter hi! link jsOperator Operator + hi! link jsStorageClass StorageClass hi! link jsThis Variable hi! link jsSuper jsThis hi! link jsClassDefinition Type @@ -275,6 +277,36 @@ hi! link jsOperatorKeyword Keyword hi! link jsObjectKey Identifier hi! link jsEnvComment Special + hi! link jsImport Include + hi! link jsExport Include +" }}} + +" TypeScript {{{ + let g:yats_host_keyword = 0 + hi! link typescriptParens jsParens + hi! link typescriptBraces javaScriptBraces + hi! link typescriptOperator jsOperatorKeyword + hi! link typescriptCastKeyword typescriptOperator + hi! link typescriptMappedIn typescriptOperator + hi! link typescriptBinaryOp jsOperator + hi! link typescriptOptionalMark typescriptBinaryOp + hi! link typescriptIdentifier jsThis + hi! link typescriptArrowFunc jsArrowFunction + hi! link typescriptFuncTypeArrow typescriptArrowFunc + hi! link typescriptCall Variable + hi! link typescriptArrowFuncArg typescriptCall + hi! link typescriptFuncType typescriptCall + hi! link typescriptVariable jsStorageClass + hi! link typescriptAmbientDeclaration typescriptVariable + hi! link typescriptVariableDeclaration Variable + hi! link typescriptTypeReference Type + hi! link typescriptTypeParameter typescriptTypeReference + hi! link typescriptConstructSignature Keyword + hi! link typescriptConstructorType typescriptConstructSignature + hi! link typescriptEndColons Delimiter + hi! link typescriptImport jsImport + hi! link typescriptExport jsExport + hi! link typescriptNull jsNull " }}} " Markdown {{{ From 4a357aaf819aa4ba59a610cb13c72c8cf940e9b6 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 21 Nov 2019 21:55:46 +0200 Subject: [PATCH 245/713] [nvim] change default commentstring for C-like languages --- nvim/lib/editing.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nvim/lib/editing.vim b/nvim/lib/editing.vim index bd85241..8ca20ac 100644 --- a/nvim/lib/editing.vim +++ b/nvim/lib/editing.vim @@ -6,6 +6,8 @@ set virtualedit=onemore set foldmethod=marker +set commentstring=//%s + " Indentination {{{ From 6b0b660993cab58af9964a65a419cb4db27efeef Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 22 Nov 2019 17:48:10 +0200 Subject: [PATCH 246/713] [nvim] fix object key highlighting in TypeScript --- nvim/colors/dotfiles.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 42b0b75..a213e20 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -307,6 +307,7 @@ hi! link typescriptImport jsImport hi! link typescriptExport jsExport hi! link typescriptNull jsNull + hi! link typescriptObjectLabel jsObjectKey " }}} " Markdown {{{ From a537c49b892b072521b5934bad5ccb75a59f1f75 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 23 Nov 2019 11:01:23 +0200 Subject: [PATCH 247/713] [nvim] another fix for TypeScript syntax highlighting --- nvim/colors/dotfiles.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index a213e20..246b92c 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -299,6 +299,7 @@ hi! link typescriptVariable jsStorageClass hi! link typescriptAmbientDeclaration typescriptVariable hi! link typescriptVariableDeclaration Variable + hi! link typescriptGlobal typescriptVariableDeclaration hi! link typescriptTypeReference Type hi! link typescriptTypeParameter typescriptTypeReference hi! link typescriptConstructSignature Keyword @@ -308,6 +309,9 @@ hi! link typescriptExport jsExport hi! link typescriptNull jsNull hi! link typescriptObjectLabel jsObjectKey + hi! link typescriptMethodAccessor Keyword + hi! link typescriptClassName jsClassDefinition + hi! link typescriptClassHeritage jsClassDefinition " }}} " Markdown {{{ From fce98716f8a2c6547ea3a3b3fd61615d657e7e41 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 23 Nov 2019 13:57:31 +0200 Subject: [PATCH 248/713] [nvim] remove < and > from matchpairs for TypeScript --- nvim/lib/languages/javascript.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lib/languages/javascript.vim b/nvim/lib/languages/javascript.vim index 2c277e1..9ccfd65 100644 --- a/nvim/lib/languages/javascript.vim +++ b/nvim/lib/languages/javascript.vim @@ -1,5 +1,5 @@ augroup vimrc-javascript - autocmd FileType javascript setlocal matchpairs-=<:> + autocmd FileType javascript,typescript setlocal matchpairs-=<:> augroup END if !g:vim_ide | finish | endif From 95d44a7e04b11bd8275c70e077a849eb6c69eb23 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 24 Nov 2019 11:23:32 +0200 Subject: [PATCH 249/713] [nvim] fix TypeScript syntax highlighting 2 --- nvim/colors/dotfiles.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 246b92c..d802676 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -270,6 +270,7 @@ hi! link jsRegexpString Special hi! link jsGlobalObjects Type hi! link jsGlobalNodeObjects Type + hi! link jsException Exception hi! link jsExceptions Type hi! link jsBuiltins jsFuncName hi! link jsNull Constant @@ -312,6 +313,7 @@ hi! link typescriptMethodAccessor Keyword hi! link typescriptClassName jsClassDefinition hi! link typescriptClassHeritage jsClassDefinition + hi! link typescriptExceptions jsException " }}} " Markdown {{{ From 509f39abaa627cf871bf0ba558e53778542a1679 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 24 Nov 2019 11:55:58 +0200 Subject: [PATCH 250/713] [zsh] add alias for opening current Vim session --- zsh/aliases.zsh | 7 +++++++ zsh/env.zsh | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index e29c48d..9961a7d 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -61,3 +61,10 @@ alias df='df -h' alias free='free -h' alias apt-get="echo -e \"use 'apt' instead of 'apt-get'\nif you really want to use 'apt-get', type '"'\\\\'"apt-get'\" #" + +# editor +alias edit="$EDITOR" +alias e="$EDITOR" +if [[ "$EDITOR" == *vim ]]; then + alias es="e -S" +fi diff --git a/zsh/env.zsh b/zsh/env.zsh index 83a5605..0cbcc3d 100644 --- a/zsh/env.zsh +++ b/zsh/env.zsh @@ -3,8 +3,6 @@ # find editor export EDITOR="nvim" export VISUAL="$EDITOR" -alias edit="$EDITOR" -alias e="$EDITOR" export PAGER='less' export LESS='--RAW-CONTROL-CHARS' From 87c8dc81131c554a422670b140fce838bf2d997b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 26 Nov 2019 20:28:26 +0200 Subject: [PATCH 251/713] [scripts] import fractions in pycalc --- scripts/pycalc_startup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/pycalc_startup.py b/scripts/pycalc_startup.py index c50dfb0..1b65c59 100644 --- a/scripts/pycalc_startup.py +++ b/scripts/pycalc_startup.py @@ -1,4 +1,5 @@ from math import * +from fractions import Fraction def factors(n): From 6a4b9beaca9caff4472b613e21624f0ef674fb5c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 27 Nov 2019 09:32:23 +0200 Subject: [PATCH 252/713] [scripts] fix factors function in pycalc --- scripts/pycalc_startup.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/pycalc_startup.py b/scripts/pycalc_startup.py index 1b65c59..7f97f03 100644 --- a/scripts/pycalc_startup.py +++ b/scripts/pycalc_startup.py @@ -5,10 +5,9 @@ from fractions import Fraction def factors(n): result = set() for i in range(1, int(sqrt(n)) + 1): - div, mod = divmod(n, i) - if mod == 0: - result.add(div) - result.add(mod) + if n % i == 0: + result.add(i) + result.add(n // i) return result From 2b797d15414e92a7e3ff97edbeb713f10987dae1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 30 Nov 2019 11:56:42 +0200 Subject: [PATCH 253/713] [zsh] remove CPPFLAGS and LDFLAGS --- zsh/path.zsh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/zsh/path.zsh b/zsh/path.zsh index 9b096bd..bf180cc 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -1,13 +1,11 @@ #!/usr/bin/env zsh # tie these env variables to zsh arrays -typeset -T LDFLAGS ldflags ' ' -typeset -T CPPFLAGS cppflags ' ' typeset -T PKG_CONFIG_PATH pkg_config_path ':' # keep only unique values in these arrays -typeset -U path fpath manpath ldflags cppflags pkg_config_path -export -U PATH FPATH MANPATH LDFLAGS CPPFLAGS PKG_CONFIG_PATH +typeset -U path fpath manpath pkg_config_path +export -U PATH FPATH MANPATH PKG_CONFIG_PATH path_append() { local arr_name="$1" value="$2" @@ -47,8 +45,6 @@ if is_macos; then for formula in ruby openssl curl; do formula_path="/usr/local/opt/$formula" if [[ -d "$formula_path" ]]; then - ldflags+=( -L"$formula_path"/lib ) - cppflags+=( -L"$formula_path"/include ) pkg_config_path+=( "$formula_path"/lib/pkgconfig ) fi done From 362e169cca1ea5a1981c1ba80f2cbe0fee26e3fe Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 30 Nov 2019 12:10:20 +0200 Subject: [PATCH 254/713] [kitty] update tab_title.patch --- kitty/patches/tab_title.patch | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kitty/patches/tab_title.patch b/kitty/patches/tab_title.patch index 6efa78f..d2c0df9 100644 --- a/kitty/patches/tab_title.patch +++ b/kitty/patches/tab_title.patch @@ -1,9 +1,9 @@ ---- kitty/tab_bar.py 2019-06-09 11:10:02.000000000 +0300 -+++ kitty/tab_bar.py 2019-06-09 17:50:11.605996845 +0300 +--- kitty/tab_bar.py.orig 2019-11-27 06:25:00.000000000 +0200 ++++ kitty/tab_bar.py 2019-11-30 12:07:00.559881682 +0200 @@ -25,7 +25,7 @@ return (x << 8) | 2 - - + + -def draw_title(draw_data, screen, tab, index): +def draw_title(draw_data, screen, tab, index, max_title_text_length): if tab.needs_attention and draw_data.bell_on_tab: @@ -18,9 +18,9 @@ + title = '…' + title[1 + extra:] screen.draw(title) + return extra - - - def draw_tab_with_separator(draw_data, screen, tab, before, max_title_length, index): + + + def draw_tab_with_separator(draw_data, screen, tab, before, max_title_length, index, is_last): if draw_data.leading_spaces: screen.draw(' ' * draw_data.leading_spaces) - draw_title(draw_data, screen, tab, index) From 38452b72b77e763ac4d6b7ec8b859546c5100f94 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 30 Nov 2019 13:00:37 +0200 Subject: [PATCH 255/713] [nvim] don't disable cursorline in terminals because it causes much more trouble than helps --- nvim/lib/interface.vim | 8 ++++++++ nvim/lib/terminal.vim | 5 ----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/nvim/lib/interface.vim b/nvim/lib/interface.vim index 7f4d0b6..b78073d 100644 --- a/nvim/lib/interface.vim +++ b/nvim/lib/interface.vim @@ -168,3 +168,11 @@ endif nmap ]l (qf_loc_next) let g:qf_mapping_ack_style = 1 " }}} + + +" Terminal {{{ + augroup vimrc-terminal + autocmd! + autocmd TermOpen * IndentLinesDisable + augroup END +" }}} diff --git a/nvim/lib/terminal.vim b/nvim/lib/terminal.vim index 233f576..e69de29 100644 --- a/nvim/lib/terminal.vim +++ b/nvim/lib/terminal.vim @@ -1,5 +0,0 @@ -augroup vimrc-terminal - autocmd! - autocmd TermOpen * setlocal nocursorline | IndentLinesDisable - autocmd TermClose * setlocal cursorline -augroup END From 6f3eb3b40ec4c653a0512a858f9c562d492db9f5 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 5 Dec 2019 22:50:38 +0200 Subject: [PATCH 256/713] [scripts] add Markdown to HTML document generator script --- scripts/markdown2htmldoc | 188 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100755 scripts/markdown2htmldoc diff --git a/scripts/markdown2htmldoc b/scripts/markdown2htmldoc new file mode 100755 index 0000000..2cf4902 --- /dev/null +++ b/scripts/markdown2htmldoc @@ -0,0 +1,188 @@ +#!/usr/bin/env ruby + +require "commonmarker" +require "rouge" + +ROUGE_THEME = Rouge::Themes::Pastie +COMMONMARKER_PARSE_OPTIONS = [:DEFAULT, :FOOTNOTES] +COMMONMARKER_RENDER_OPTIONS = [:UNSAFE] +COMMONMARKER_EXTENSIONS = [:tagfilter, :autolink, :table, :strikethrough, :tasklist] + +# parse arguments {{{ + +def get_program_name() + return File.basename($PROGRAM_NAME) +end + +def print_help() + $stderr.print <] [] + +if is not specified, input will be read from stdin +if is not specified, output will be printed to stdout +EOF + exit(true) +end + +def print_error(*args) + $stderr.puts("#{get_program_name()}: error:", *args) + exit(false) +end + +input_file_path = nil +output_file_path = nil + +reading_only_positional_args = false +positional_arg_index = 0 +ARGV.each do |arg| + is_positional = reading_only_positional_args + + if not is_positional + case arg + when "-h", "--help" + print_help() + when "--" + reading_only_positional_args = true + else + if arg.start_with?("-") + print_error("unknown option: #{arg}") + else + is_positional = true + end + end + end + + if is_positional + case positional_arg_index + when 0 then input_file_path = arg + when 1 then output_file_path = arg + else print_error("unexpected argument: #{arg}") + end + positional_arg_index += 1 + end +end + +# }}} + +# parse markdown document {{{ + +if input_file_path.nil?() + markdown = $stdin.read() +else + markdown = IO.read(input_file_path) +end +doc = CommonMarker.render_doc(markdown, COMMONMARKER_PARSE_OPTIONS, COMMONMARKER_EXTENSIONS) + +# }}} + +# add header anchors {{{ + +header_slug_occurences = {} +doc.walk do |node| + if node.type == :header + header_slug = "" + node.walk do |child_node| + if [:text, :html, :html_inline, :code, :code_block, :footnote_reference].include?(child_node.type) + header_slug += child_node.string_content + end + end + + header_slug.downcase!() + header_slug.strip!() + # remove special characters + header_slug.delete!("\u2000-\u206F\u2E00-\u2E7F\\\\'!\"#$%&()*+,./:;<=>?@[]\\^`{|}~’") + # remove emoji + header_slug.delete!("\u{1F600}-\u{1F6FF}") + # remove whitespace + header_slug.gsub!(/\s/, "-") + + # make this slug unique + while header_slug_occurences.key?(header_slug) + occurences = header_slug_occurences[header_slug] + occurences += 1 + header_slug_occurences[header_slug] = occurences + header_slug += "-" + occurences.to_s() + end + header_slug_occurences[header_slug] = 0 + + anchor_node = CommonMarker::Node.new(:inline_html) + anchor_node.string_content = "" + node.prepend_child(anchor_node) + end +end + +# }}} + +# highlight code blocks {{{ + +rouge_formatter = Rouge::Formatters::HTML.new() + +doc.walk do |node| + if node.type == :code_block + language = node.fence_info + if not language.empty?() + source = node.string_content + lexer = Rouge::Lexer.find_fancy(language) || Rouge::Lexers::PlainText.new() + highlighted_code = rouge_formatter.format(lexer.lex(source)) + + new_node = CommonMarker::Node.new(:html) + new_node.string_content = "
#{highlighted_code}
" + node.insert_after(new_node) + node.delete + end + end +end + +# }}} + +# render HTML {{{ + +rendered_html = < + + + + + + + + + +
+#{doc.to_html(COMMONMARKER_RENDER_OPTIONS)} +
+ + +EOF + +if output_file_path.nil?() + $stdout.write(rendered_html) +else + IO.write(output_file_path, rendered_html) +end + +# }}} From 9f1d9f506ee07d745a932db04f055675cfadec6a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 7 Dec 2019 11:18:55 +0200 Subject: [PATCH 257/713] [scripts] move script resources to a separate directory --- {scripts => script-resources}/colortest.awk | 0 {scripts => script-resources}/colortest2.awk | 0 {scripts => script-resources}/pycalc_startup.py | 0 scripts/colortest | 2 +- scripts/colortest2 | 2 +- scripts/pycalc3 | 2 +- 6 files changed, 3 insertions(+), 3 deletions(-) rename {scripts => script-resources}/colortest.awk (100%) rename {scripts => script-resources}/colortest2.awk (100%) rename {scripts => script-resources}/pycalc_startup.py (100%) diff --git a/scripts/colortest.awk b/script-resources/colortest.awk similarity index 100% rename from scripts/colortest.awk rename to script-resources/colortest.awk diff --git a/scripts/colortest2.awk b/script-resources/colortest2.awk similarity index 100% rename from scripts/colortest2.awk rename to script-resources/colortest2.awk diff --git a/scripts/pycalc_startup.py b/script-resources/pycalc_startup.py similarity index 100% rename from scripts/pycalc_startup.py rename to script-resources/pycalc_startup.py diff --git a/scripts/colortest b/scripts/colortest index a433d53..99f0f4b 100755 --- a/scripts/colortest +++ b/scripts/colortest @@ -4,4 +4,4 @@ set -e script_dir="$(dirname "$0")" -exec awk -f "${script_dir}/colortest.awk" +exec awk -f "${script_dir}/../script-resources/colortest.awk" diff --git a/scripts/colortest2 b/scripts/colortest2 index e48db93..9b685c6 100755 --- a/scripts/colortest2 +++ b/scripts/colortest2 @@ -6,4 +6,4 @@ script_dir="$(dirname "$0")" cols="$(tput cols)" lines="$(tput lines)" -exec awk -v WIDTH="$((cols/2))" -v HEIGHT="$lines" -f "${script_dir}/colortest2.awk" +exec awk -v WIDTH="$((cols/2))" -v HEIGHT="$lines" -f "${script_dir}/../script-resources/colortest2.awk" diff --git a/scripts/pycalc3 b/scripts/pycalc3 index e5154b7..20380e8 100755 --- a/scripts/pycalc3 +++ b/scripts/pycalc3 @@ -6,4 +6,4 @@ for python in bpython python3; do fi done echo "using Python '$python'" -PYTHONSTARTUP="$(dirname "$0")/pycalc_startup.py" "$python" "$@" +PYTHONSTARTUP="$(dirname "$0")/../script-resources/pycalc_startup.py" "$python" "$@" From 2114cfc5c725e3111a78b3d91035a4143d9d0be5 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 7 Dec 2019 18:10:32 +0200 Subject: [PATCH 258/713] rewrite markdown2htmldoc to JS --- script-resources/markdown2htmldoc/.gitignore | 1 + script-resources/markdown2htmldoc/main.js | 86 ++ .../markdown-it-header-anchors.js | 39 + .../markdown2htmldoc/package.json | 21 + script-resources/markdown2htmldoc/setup.sh | 3 + script-resources/markdown2htmldoc/yarn.lock | 1101 +++++++++++++++++ scripts/markdown2htmldoc | 189 +-- 7 files changed, 1252 insertions(+), 188 deletions(-) create mode 100644 script-resources/markdown2htmldoc/.gitignore create mode 100755 script-resources/markdown2htmldoc/main.js create mode 100644 script-resources/markdown2htmldoc/markdown-it-header-anchors.js create mode 100644 script-resources/markdown2htmldoc/package.json create mode 100755 script-resources/markdown2htmldoc/setup.sh create mode 100644 script-resources/markdown2htmldoc/yarn.lock mode change 100755 => 120000 scripts/markdown2htmldoc diff --git a/script-resources/markdown2htmldoc/.gitignore b/script-resources/markdown2htmldoc/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/script-resources/markdown2htmldoc/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/script-resources/markdown2htmldoc/main.js b/script-resources/markdown2htmldoc/main.js new file mode 100755 index 0000000..1362206 --- /dev/null +++ b/script-resources/markdown2htmldoc/main.js @@ -0,0 +1,86 @@ +#!/usr/bin/env node + +const fs = require('fs'); +const argparse = require('argparse'); +const markdownIt = require('markdown-it'); +const markdownItTaskCheckbox = require('markdown-it-task-checkbox'); +const markdownItEmoji = require('markdown-it-emoji'); +const markdownItHeaderAnchors = require('./markdown-it-header-anchors'); +const Prism = require('prismjs'); +const loadPrismLanguages = require('prismjs/components/'); + +let parser = new argparse.ArgumentParser(); +parser.addArgument('inputFile', { + nargs: argparse.Const.OPTIONAL, + metavar: 'INPUT_FILE', + help: '(stdin by default)', +}); +parser.addArgument('outputFile', { + nargs: argparse.Const.OPTIONAL, + metavar: 'OUTPUT_FILE', + help: '(stdout by default)', +}); +let args = parser.parseArgs(); + +let md = markdownIt({ + html: true, + linkify: true, + highlight: (str, lang) => { + if (lang.length > 0) { + loadPrismLanguages([lang]); + let h = Prism.highlight(str, Prism.languages[lang], lang); + return h; + } + return str; + }, +}); +md.use(markdownItTaskCheckbox); +md.use(markdownItEmoji); +md.use(markdownItHeaderAnchors); + +let markdownDocument = fs.readFileSync(args.get('inputFile', 0), 'utf-8'); +let renderedMarkdown = md.render(markdownDocument); + +let renderedHtmlDocument = ` + + + + + + + + + + + +
+${renderedMarkdown} +
+ + +`; + +fs.writeFileSync(args.get('outputFile', 1), renderedHtmlDocument, 'utf-8'); diff --git a/script-resources/markdown2htmldoc/markdown-it-header-anchors.js b/script-resources/markdown2htmldoc/markdown-it-header-anchors.js new file mode 100644 index 0000000..d4470d3 --- /dev/null +++ b/script-resources/markdown2htmldoc/markdown-it-header-anchors.js @@ -0,0 +1,39 @@ +const GithubSlugger = require('github-slugger'); + +function markdownItHeaderAnchors(md) { + let slugger = new GithubSlugger(); + + let defaultRender = + md.renderer.rules.heading_open || + ((tokens, idx, options, _env, self) => + self.renderToken(tokens, idx, options)); + + // eslint-disable-next-line camelcase + md.renderer.rules.heading_open = (tokens, idx, opts, env, self) => { + let renderedHeadingOpen = defaultRender(tokens, idx, opts, env, self); + + let innerText = ''; + let headingContentToken = tokens[idx + 1]; + headingContentToken.children.forEach(child => { + switch (child.type) { + case 'html_block': + case 'html_inline': + break; + case 'emoji': + innerText += child.markup; + break; + default: + innerText += child.content; + } + }); + + if (innerText.length > 0) { + let id = slugger.slug(innerText); + renderedHeadingOpen += ``; + } + + return renderedHeadingOpen; + }; +} + +module.exports = markdownItHeaderAnchors; diff --git a/script-resources/markdown2htmldoc/package.json b/script-resources/markdown2htmldoc/package.json new file mode 100644 index 0000000..25f928d --- /dev/null +++ b/script-resources/markdown2htmldoc/package.json @@ -0,0 +1,21 @@ +{ + "private": true, + "dependencies": { + "argparse": "^1.0.10", + "github-slugger": "^1.2.1", + "markdown-it": "*", + "markdown-it-emoji": "*", + "markdown-it-task-checkbox": "*", + "prismjs": "^1.17.1" + }, + "devDependencies": { + "eslint": "*", + "eslint-config-dmitmel": "dmitmel/eslint-config-dmitmel" + }, + "eslintConfig": { + "extends": "eslint-config-dmitmel/presets/node", + "rules": { + "node/shebang": "off" + } + } +} diff --git a/script-resources/markdown2htmldoc/setup.sh b/script-resources/markdown2htmldoc/setup.sh new file mode 100755 index 0000000..074683f --- /dev/null +++ b/script-resources/markdown2htmldoc/setup.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +yarn install --production diff --git a/script-resources/markdown2htmldoc/yarn.lock b/script-resources/markdown2htmldoc/yarn.lock new file mode 100644 index 0000000..08a1c41 --- /dev/null +++ b/script-resources/markdown2htmldoc/yarn.lock @@ -0,0 +1,1101 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d" + integrity sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw== + dependencies: + "@babel/highlight" "^7.0.0" + +"@babel/generator@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.4.tgz#db651e2840ca9aa66f327dcec1dc5f5fa9611369" + integrity sha512-m5qo2WgdOJeyYngKImbkyQrnUN1mPceaG5BV+G0E3gWsa4l/jCSryWJdM2x8OuGAOyh+3d5pVYfZWCiNFtynxg== + dependencies: + "@babel/types" "^7.7.4" + jsesc "^2.5.1" + lodash "^4.17.13" + source-map "^0.5.0" + +"@babel/helper-function-name@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.7.4.tgz#ab6e041e7135d436d8f0a3eca15de5b67a341a2e" + integrity sha512-AnkGIdiBhEuiwdoMnKm7jfPfqItZhgRaZfMg1XX3bS25INOnLPjPG1Ppnajh8eqgt5kPJnfqrRHqFqmjKDZLzQ== + dependencies: + "@babel/helper-get-function-arity" "^7.7.4" + "@babel/template" "^7.7.4" + "@babel/types" "^7.7.4" + +"@babel/helper-get-function-arity@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz#cb46348d2f8808e632f0ab048172130e636005f0" + integrity sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA== + dependencies: + "@babel/types" "^7.7.4" + +"@babel/helper-split-export-declaration@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.4.tgz#57292af60443c4a3622cf74040ddc28e68336fd8" + integrity sha512-guAg1SXFcVr04Guk9eq0S4/rWS++sbmyqosJzVs8+1fH5NI+ZcmkaSkc7dmtAFbHFva6yRJnjW3yAcGxjueDug== + dependencies: + "@babel/types" "^7.7.4" + +"@babel/highlight@^7.0.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.5.0.tgz#56d11312bd9248fa619591d02472be6e8cb32540" + integrity sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ== + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^4.0.0" + +"@babel/parser@^7.0.0", "@babel/parser@^7.7.4": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.5.tgz#cbf45321619ac12d83363fcf9c94bb67fa646d71" + integrity sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig== + +"@babel/template@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.7.4.tgz#428a7d9eecffe27deac0a98e23bf8e3675d2a77b" + integrity sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.7.4" + "@babel/types" "^7.7.4" + +"@babel/traverse@^7.0.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.7.4.tgz#9c1e7c60fb679fe4fcfaa42500833333c2058558" + integrity sha512-P1L58hQyupn8+ezVA2z5KBm4/Zr4lCC8dwKCMYzsa5jFMDMQAzaBNy9W5VjB+KAmBjb40U7a/H6ao+Xo+9saIw== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.7.4" + "@babel/helper-function-name" "^7.7.4" + "@babel/helper-split-export-declaration" "^7.7.4" + "@babel/parser" "^7.7.4" + "@babel/types" "^7.7.4" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.13" + +"@babel/types@^7.0.0", "@babel/types@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.7.4.tgz#516570d539e44ddf308c07569c258ff94fde9193" + integrity sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA== + dependencies: + esutils "^2.0.2" + lodash "^4.17.13" + to-fast-properties "^2.0.0" + +acorn-jsx@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.1.0.tgz#294adb71b57398b0680015f0a38c563ee1db5384" + integrity sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw== + +acorn@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c" + integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ== + +ajv@^6.10.0, ajv@^6.10.2: + version "6.10.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" + integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== + dependencies: + fast-deep-equal "^2.0.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ansi-escapes@^4.2.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.0.tgz#a4ce2b33d6b214b7950d8595c212f12ac9cc569d" + integrity sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg== + dependencies: + type-fest "^0.8.1" + +ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + +ansi-regex@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" + integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== + +ansi-styles@^3.2.0, ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +argparse@^1.0.10, argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +astral-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" + integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== + +babel-eslint@*: + version "10.0.3" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.3.tgz#81a2c669be0f205e19462fed2482d33e4687a88a" + integrity sha512-z3U7eMY6r/3f3/JB9mTsLjyxrv0Yb1zb8PCWCLpguxfCzBIZUwy23R1t/XKewP+8mEN2Ck8Dtr4q20z6ce6SoA== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.0.0" + "@babel/traverse" "^7.0.0" + "@babel/types" "^7.0.0" + eslint-visitor-keys "^1.0.0" + resolve "^1.12.0" + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +chalk@^2.0.0, chalk@^2.1.0, chalk@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chardet@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== + +cli-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" + integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== + dependencies: + restore-cursor "^3.1.0" + +cli-width@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" + integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= + +clipboard@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.4.tgz#836dafd66cf0fea5d71ce5d5b0bf6e958009112d" + integrity sha512-Vw26VSLRpJfBofiVaFb/I8PVfdI1OxKcYShe6fm0sP/DtmiWQNCjhM/okTvdCo0G+lMMm1rMYbk4IK4x1X+kgQ== + dependencies: + good-listener "^1.2.2" + select "^1.1.2" + tiny-emitter "^2.0.0" + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +cross-spawn@^6.0.5: + version "6.0.5" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + +debug@^4.0.1, debug@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" + integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== + dependencies: + ms "^2.1.1" + +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= + +delegate@^3.1.2: + version "3.2.0" + resolved "https://registry.yarnpkg.com/delegate/-/delegate-3.2.0.tgz#b66b71c3158522e8ab5744f720d8ca0c2af59166" + integrity sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw== + +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + +"emoji-regex@>=6.0.0 <=6.1.1": + version "6.1.1" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.1.1.tgz#c6cd0ec1b0642e2a3c67a1137efc5e796da4f88e" + integrity sha1-xs0OwbBkLio8Z6ETfvxeeW2k+I4= + +emoji-regex@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" + integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +entities@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.0.tgz#68d6084cab1b079767540d80e56a39b423e4abf4" + integrity sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw== + +escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +eslint-config-dmitmel@dmitmel/eslint-config-dmitmel: + version "4.1.3" + resolved "https://codeload.github.com/dmitmel/eslint-config-dmitmel/tar.gz/573f3d2ca2d77e20402dd7b96961881bec27fc5b" + dependencies: + eslint-config-prettier "*" + eslint-plugin-prettier "*" + prettier "*" + optionalDependencies: + babel-eslint "*" + eslint-plugin-node "*" + +eslint-config-prettier@*: + version "6.7.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.7.0.tgz#9a876952e12df2b284adbd3440994bf1f39dfbb9" + integrity sha512-FamQVKM3jjUVwhG4hEMnbtsq7xOIDm+SY5iBPfR8gKsJoAB2IQnNF+bk1+8Fy44Nq7PPJaLvkRxILYdJWoguKQ== + dependencies: + get-stdin "^6.0.0" + +eslint-plugin-es@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-es/-/eslint-plugin-es-2.0.0.tgz#0f5f5da5f18aa21989feebe8a73eadefb3432976" + integrity sha512-f6fceVtg27BR02EYnBhgWLFQfK6bN4Ll0nQFrBHOlCsAyxeZkn0NHns5O0YZOPrV1B3ramd6cgFwaoFLcSkwEQ== + dependencies: + eslint-utils "^1.4.2" + regexpp "^3.0.0" + +eslint-plugin-node@*: + version "10.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-10.0.0.tgz#fd1adbc7a300cf7eb6ac55cf4b0b6fc6e577f5a6" + integrity sha512-1CSyM/QCjs6PXaT18+zuAXsjXGIGo5Rw630rSKwokSs2jrYURQc4R5JZpoanNCqwNmepg+0eZ9L7YiRUJb8jiQ== + dependencies: + eslint-plugin-es "^2.0.0" + eslint-utils "^1.4.2" + ignore "^5.1.1" + minimatch "^3.0.4" + resolve "^1.10.1" + semver "^6.1.0" + +eslint-plugin-prettier@*: + version "3.1.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.1.tgz#507b8562410d02a03f0ddc949c616f877852f2ba" + integrity sha512-A+TZuHZ0KU0cnn56/9mfR7/KjUJ9QNVXUhwvRFSR7PGPe0zQR6PTkmyqg1AtUUEOzTqeRsUwyKFh0oVZKVCrtA== + dependencies: + prettier-linter-helpers "^1.0.0" + +eslint-scope@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9" + integrity sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-utils@^1.4.2, eslint-utils@^1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f" + integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q== + dependencies: + eslint-visitor-keys "^1.1.0" + +eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" + integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== + +eslint@*: + version "6.7.2" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.7.2.tgz#c17707ca4ad7b2d8af986a33feba71e18a9fecd1" + integrity sha512-qMlSWJaCSxDFr8fBPvJM9kJwbazrhNcBU3+DszDW1OlEwKBBRWsJc7NJFelvwQpanHCR14cOLD41x8Eqvo3Nng== + dependencies: + "@babel/code-frame" "^7.0.0" + ajv "^6.10.0" + chalk "^2.1.0" + cross-spawn "^6.0.5" + debug "^4.0.1" + doctrine "^3.0.0" + eslint-scope "^5.0.0" + eslint-utils "^1.4.3" + eslint-visitor-keys "^1.1.0" + espree "^6.1.2" + esquery "^1.0.1" + esutils "^2.0.2" + file-entry-cache "^5.0.1" + functional-red-black-tree "^1.0.1" + glob-parent "^5.0.0" + globals "^12.1.0" + ignore "^4.0.6" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + inquirer "^7.0.0" + is-glob "^4.0.0" + js-yaml "^3.13.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.14" + minimatch "^3.0.4" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.3" + progress "^2.0.0" + regexpp "^2.0.1" + semver "^6.1.2" + strip-ansi "^5.2.0" + strip-json-comments "^3.0.1" + table "^5.2.3" + text-table "^0.2.0" + v8-compile-cache "^2.0.3" + +espree@^6.1.2: + version "6.1.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-6.1.2.tgz#6c272650932b4f91c3714e5e7b5f5e2ecf47262d" + integrity sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA== + dependencies: + acorn "^7.1.0" + acorn-jsx "^5.1.0" + eslint-visitor-keys "^1.1.0" + +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +esquery@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" + integrity sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA== + dependencies: + estraverse "^4.0.0" + +esrecurse@^4.1.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" + integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== + dependencies: + estraverse "^4.1.0" + +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +external-editor@^3.0.3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" + integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== + dependencies: + chardet "^0.7.0" + iconv-lite "^0.4.24" + tmp "^0.0.33" + +fast-deep-equal@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" + integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= + +fast-diff@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== + +fast-json-stable-stringify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= + +fast-levenshtein@~2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= + +figures@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-3.1.0.tgz#4b198dd07d8d71530642864af2d45dd9e459c4ec" + integrity sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg== + dependencies: + escape-string-regexp "^1.0.5" + +file-entry-cache@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" + integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== + dependencies: + flat-cache "^2.0.1" + +flat-cache@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" + integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== + dependencies: + flatted "^2.0.0" + rimraf "2.6.3" + write "1.0.3" + +flatted@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" + integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= + +get-stdin@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" + integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== + +github-slugger@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/github-slugger/-/github-slugger-1.2.1.tgz#47e904e70bf2dccd0014748142d31126cfd49508" + integrity sha512-SsZUjg/P03KPzQBt7OxJPasGw6NRO5uOgiZ5RGXVud5iSIZ0eNZeNp5rTwCxtavrRUa/A77j8mePVc5lEvk0KQ== + dependencies: + emoji-regex ">=6.0.0 <=6.1.1" + +glob-parent@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.0.tgz#5f4c1d1e748d30cd73ad2944b3577a81b081e8c2" + integrity sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw== + dependencies: + is-glob "^4.0.1" + +glob@^7.1.3: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^11.1.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== + +globals@^12.1.0: + version "12.3.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-12.3.0.tgz#1e564ee5c4dded2ab098b0f88f24702a3c56be13" + integrity sha512-wAfjdLgFsPZsklLJvOBUBmzYE8/CwhEqSBEMRXA3qxIiNtyqvjYurAtIfDh6chlEPUfmTY3MnZh5Hfh4q0UlIw== + dependencies: + type-fest "^0.8.1" + +good-listener@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/good-listener/-/good-listener-1.2.2.tgz#d53b30cdf9313dffb7dc9a0d477096aa6d145c50" + integrity sha1-1TswzfkxPf+33JoNR3CWqm0UXFA= + dependencies: + delegate "^3.1.2" + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +iconv-lite@^0.4.24: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +ignore@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== + +ignore@^5.1.1: + version "5.1.4" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf" + integrity sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A== + +import-fresh@^3.0.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66" + integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +inquirer@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.0.0.tgz#9e2b032dde77da1db5db804758b8fea3a970519a" + integrity sha512-rSdC7zelHdRQFkWnhsMu2+2SO41mpv2oF2zy4tMhmiLWkcKbOAs87fWAJhVXttKVwhdZvymvnuM95EyEXg2/tQ== + dependencies: + ansi-escapes "^4.2.1" + chalk "^2.4.2" + cli-cursor "^3.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^3.0.0" + lodash "^4.17.15" + mute-stream "0.0.8" + run-async "^2.2.0" + rxjs "^6.4.0" + string-width "^4.1.0" + strip-ansi "^5.1.0" + through "^2.3.6" + +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-glob@^4.0.0, is-glob@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + dependencies: + is-extglob "^2.1.1" + +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-yaml@^3.13.1: + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" + integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +jsesc@^2.5.1: + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= + +levn@^0.3.0, levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +linkify-it@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-2.2.0.tgz#e3b54697e78bf915c70a38acd78fd09e0058b1cf" + integrity sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw== + dependencies: + uc.micro "^1.0.1" + +lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + +markdown-it-emoji@*: + version "1.4.0" + resolved "https://registry.yarnpkg.com/markdown-it-emoji/-/markdown-it-emoji-1.4.0.tgz#9bee0e9a990a963ba96df6980c4fddb05dfb4dcc" + integrity sha1-m+4OmpkKljupbfaYDE/dsF37Tcw= + +markdown-it-task-checkbox@*: + version "1.0.6" + resolved "https://registry.yarnpkg.com/markdown-it-task-checkbox/-/markdown-it-task-checkbox-1.0.6.tgz#9ebd7b6382e99162264605bc580f2ac118be4242" + integrity sha512-7pxkHuvqTOu3iwVGmDPeYjQg+AIS9VQxzyLP9JCg9lBjgPAJXGEkChK6A2iFuj3tS0GV3HG2u5AMNhcQqwxpJw== + +markdown-it@*: + version "10.0.0" + resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-10.0.0.tgz#abfc64f141b1722d663402044e43927f1f50a8dc" + integrity sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg== + dependencies: + argparse "^1.0.7" + entities "~2.0.0" + linkify-it "^2.0.0" + mdurl "^1.0.1" + uc.micro "^1.0.5" + +mdurl@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" + integrity sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4= + +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + dependencies: + brace-expansion "^1.1.7" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= + +mkdirp@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= + dependencies: + minimist "0.0.8" + +ms@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +mute-stream@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" + integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= + +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +onetime@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5" + integrity sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q== + dependencies: + mimic-fn "^2.1.0" + +optionator@^0.8.3: + version "0.8.3" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" + integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.6" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + word-wrap "~1.2.3" + +os-tmpdir@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +path-key@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= + +path-parse@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= + +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@*: + version "1.19.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" + integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== + +prismjs@^1.17.1: + version "1.17.1" + resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.17.1.tgz#e669fcbd4cdd873c35102881c33b14d0d68519be" + integrity sha512-PrEDJAFdUGbOP6xK/UsfkC5ghJsPJviKgnQOoxaDbBjwc8op68Quupwt1DeAFoG8GImPhiKXAvvsH7wDSLsu1Q== + optionalDependencies: + clipboard "^2.0.0" + +progress@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + +punycode@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + +regexpp@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" + integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== + +regexpp@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.0.0.tgz#dd63982ee3300e67b41c1956f850aa680d9d330e" + integrity sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g== + +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + +resolve@^1.10.1, resolve@^1.12.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.13.1.tgz#be0aa4c06acd53083505abb35f4d66932ab35d16" + integrity sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w== + dependencies: + path-parse "^1.0.6" + +restore-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" + integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== + dependencies: + onetime "^5.1.0" + signal-exit "^3.0.2" + +rimraf@2.6.3: + version "2.6.3" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" + integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== + dependencies: + glob "^7.1.3" + +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + integrity sha1-A3GrSuC91yDUFm19/aZP96RFpsA= + dependencies: + is-promise "^2.1.0" + +rxjs@^6.4.0: + version "6.5.3" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.3.tgz#510e26317f4db91a7eb1de77d9dd9ba0a4899a3a" + integrity sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA== + dependencies: + tslib "^1.9.0" + +"safer-buffer@>= 2.1.2 < 3": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +select@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d" + integrity sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0= + +semver@^5.5.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + +semver@^6.1.0, semver@^6.1.2: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= + +signal-exit@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= + +slice-ansi@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" + integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== + dependencies: + ansi-styles "^3.2.0" + astral-regex "^1.0.0" + is-fullwidth-code-point "^2.0.0" + +source-map@^0.5.0: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= + +string-width@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.1.0" + +string-width@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" + integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.0" + +strip-ansi@^5.1.0, strip-ansi@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + +strip-ansi@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== + dependencies: + ansi-regex "^5.0.0" + +strip-json-comments@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" + integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== + +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +table@^5.2.3: + version "5.4.6" + resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" + integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== + dependencies: + ajv "^6.10.2" + lodash "^4.17.14" + slice-ansi "^2.1.0" + string-width "^3.0.0" + +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + +through@^2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= + +tiny-emitter@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz#1d1a56edfc51c43e863cbb5382a72330e3555423" + integrity sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q== + +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== + dependencies: + os-tmpdir "~1.0.2" + +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= + +tslib@^1.9.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" + integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= + dependencies: + prelude-ls "~1.1.2" + +type-fest@^0.8.1: + version "0.8.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" + integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== + +uc.micro@^1.0.1, uc.micro@^1.0.5: + version "1.0.6" + resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" + integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== + +uri-js@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== + dependencies: + punycode "^2.1.0" + +v8-compile-cache@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" + integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g== + +which@^1.2.9: + version "1.3.1" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== + dependencies: + isexe "^2.0.0" + +word-wrap@~1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" + integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +write@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" + integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== + dependencies: + mkdirp "^0.5.1" diff --git a/scripts/markdown2htmldoc b/scripts/markdown2htmldoc deleted file mode 100755 index 2cf4902..0000000 --- a/scripts/markdown2htmldoc +++ /dev/null @@ -1,188 +0,0 @@ -#!/usr/bin/env ruby - -require "commonmarker" -require "rouge" - -ROUGE_THEME = Rouge::Themes::Pastie -COMMONMARKER_PARSE_OPTIONS = [:DEFAULT, :FOOTNOTES] -COMMONMARKER_RENDER_OPTIONS = [:UNSAFE] -COMMONMARKER_EXTENSIONS = [:tagfilter, :autolink, :table, :strikethrough, :tasklist] - -# parse arguments {{{ - -def get_program_name() - return File.basename($PROGRAM_NAME) -end - -def print_help() - $stderr.print <] [] - -if is not specified, input will be read from stdin -if is not specified, output will be printed to stdout -EOF - exit(true) -end - -def print_error(*args) - $stderr.puts("#{get_program_name()}: error:", *args) - exit(false) -end - -input_file_path = nil -output_file_path = nil - -reading_only_positional_args = false -positional_arg_index = 0 -ARGV.each do |arg| - is_positional = reading_only_positional_args - - if not is_positional - case arg - when "-h", "--help" - print_help() - when "--" - reading_only_positional_args = true - else - if arg.start_with?("-") - print_error("unknown option: #{arg}") - else - is_positional = true - end - end - end - - if is_positional - case positional_arg_index - when 0 then input_file_path = arg - when 1 then output_file_path = arg - else print_error("unexpected argument: #{arg}") - end - positional_arg_index += 1 - end -end - -# }}} - -# parse markdown document {{{ - -if input_file_path.nil?() - markdown = $stdin.read() -else - markdown = IO.read(input_file_path) -end -doc = CommonMarker.render_doc(markdown, COMMONMARKER_PARSE_OPTIONS, COMMONMARKER_EXTENSIONS) - -# }}} - -# add header anchors {{{ - -header_slug_occurences = {} -doc.walk do |node| - if node.type == :header - header_slug = "" - node.walk do |child_node| - if [:text, :html, :html_inline, :code, :code_block, :footnote_reference].include?(child_node.type) - header_slug += child_node.string_content - end - end - - header_slug.downcase!() - header_slug.strip!() - # remove special characters - header_slug.delete!("\u2000-\u206F\u2E00-\u2E7F\\\\'!\"#$%&()*+,./:;<=>?@[]\\^`{|}~’") - # remove emoji - header_slug.delete!("\u{1F600}-\u{1F6FF}") - # remove whitespace - header_slug.gsub!(/\s/, "-") - - # make this slug unique - while header_slug_occurences.key?(header_slug) - occurences = header_slug_occurences[header_slug] - occurences += 1 - header_slug_occurences[header_slug] = occurences - header_slug += "-" + occurences.to_s() - end - header_slug_occurences[header_slug] = 0 - - anchor_node = CommonMarker::Node.new(:inline_html) - anchor_node.string_content = "" - node.prepend_child(anchor_node) - end -end - -# }}} - -# highlight code blocks {{{ - -rouge_formatter = Rouge::Formatters::HTML.new() - -doc.walk do |node| - if node.type == :code_block - language = node.fence_info - if not language.empty?() - source = node.string_content - lexer = Rouge::Lexer.find_fancy(language) || Rouge::Lexers::PlainText.new() - highlighted_code = rouge_formatter.format(lexer.lex(source)) - - new_node = CommonMarker::Node.new(:html) - new_node.string_content = "
#{highlighted_code}
" - node.insert_after(new_node) - node.delete - end - end -end - -# }}} - -# render HTML {{{ - -rendered_html = < - - - - - - - - - -
-#{doc.to_html(COMMONMARKER_RENDER_OPTIONS)} -
- - -EOF - -if output_file_path.nil?() - $stdout.write(rendered_html) -else - IO.write(output_file_path, rendered_html) -end - -# }}} diff --git a/scripts/markdown2htmldoc b/scripts/markdown2htmldoc new file mode 120000 index 0000000..3097e26 --- /dev/null +++ b/scripts/markdown2htmldoc @@ -0,0 +1 @@ +../script-resources/markdown2htmldoc/main.js \ No newline at end of file From c7df8535eacfa7682668a9285f3aca70a06e0029 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 9 Dec 2019 19:49:50 +0200 Subject: [PATCH 259/713] [zsh] add aliases for tree listing --- zsh/aliases.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 9961a7d..7238581 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -17,7 +17,9 @@ if command_exists exa; then alias ls='exa --classify --group-directories-first' alias lsa='ls --all' alias l='ls --long --header --binary --group' + alias lt='l --tree' alias la='l --all' + alias lat='la --tree' alias tree='ls --tree' else alias ls='ls --classify --group-directories-first --color=auto' From 97764cfaa70cdaf021f528fa9b65c5a439887c30 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 10 Dec 2019 08:05:33 +0200 Subject: [PATCH 260/713] [scripts] move welcome script to script-resources --- {zsh => script-resources}/welcome/colors.py | 0 {zsh => script-resources}/welcome/humanize.py | 0 {zsh => script-resources}/welcome/logos/android | 0 {zsh => script-resources}/welcome/logos/arch | 0 {zsh => script-resources}/welcome/logos/debian | 0 {zsh => script-resources}/welcome/logos/linuxmint | 0 {zsh => script-resources}/welcome/logos/mac | 0 {zsh => script-resources}/welcome/logos/manjaro | 0 {zsh => script-resources}/welcome/logos/raspbian | 0 {zsh => script-resources}/welcome/logos/ubuntu | 0 {zsh => script-resources}/welcome/main.py | 0 {zsh => script-resources}/welcome/system_info.py | 0 scripts/welcome | 1 + zsh/functions.zsh | 2 -- 14 files changed, 1 insertion(+), 2 deletions(-) rename {zsh => script-resources}/welcome/colors.py (100%) rename {zsh => script-resources}/welcome/humanize.py (100%) rename {zsh => script-resources}/welcome/logos/android (100%) rename {zsh => script-resources}/welcome/logos/arch (100%) rename {zsh => script-resources}/welcome/logos/debian (100%) rename {zsh => script-resources}/welcome/logos/linuxmint (100%) rename {zsh => script-resources}/welcome/logos/mac (100%) rename {zsh => script-resources}/welcome/logos/manjaro (100%) rename {zsh => script-resources}/welcome/logos/raspbian (100%) rename {zsh => script-resources}/welcome/logos/ubuntu (100%) rename {zsh => script-resources}/welcome/main.py (100%) rename {zsh => script-resources}/welcome/system_info.py (100%) create mode 120000 scripts/welcome diff --git a/zsh/welcome/colors.py b/script-resources/welcome/colors.py similarity index 100% rename from zsh/welcome/colors.py rename to script-resources/welcome/colors.py diff --git a/zsh/welcome/humanize.py b/script-resources/welcome/humanize.py similarity index 100% rename from zsh/welcome/humanize.py rename to script-resources/welcome/humanize.py diff --git a/zsh/welcome/logos/android b/script-resources/welcome/logos/android similarity index 100% rename from zsh/welcome/logos/android rename to script-resources/welcome/logos/android diff --git a/zsh/welcome/logos/arch b/script-resources/welcome/logos/arch similarity index 100% rename from zsh/welcome/logos/arch rename to script-resources/welcome/logos/arch diff --git a/zsh/welcome/logos/debian b/script-resources/welcome/logos/debian similarity index 100% rename from zsh/welcome/logos/debian rename to script-resources/welcome/logos/debian diff --git a/zsh/welcome/logos/linuxmint b/script-resources/welcome/logos/linuxmint similarity index 100% rename from zsh/welcome/logos/linuxmint rename to script-resources/welcome/logos/linuxmint diff --git a/zsh/welcome/logos/mac b/script-resources/welcome/logos/mac similarity index 100% rename from zsh/welcome/logos/mac rename to script-resources/welcome/logos/mac diff --git a/zsh/welcome/logos/manjaro b/script-resources/welcome/logos/manjaro similarity index 100% rename from zsh/welcome/logos/manjaro rename to script-resources/welcome/logos/manjaro diff --git a/zsh/welcome/logos/raspbian b/script-resources/welcome/logos/raspbian similarity index 100% rename from zsh/welcome/logos/raspbian rename to script-resources/welcome/logos/raspbian diff --git a/zsh/welcome/logos/ubuntu b/script-resources/welcome/logos/ubuntu similarity index 100% rename from zsh/welcome/logos/ubuntu rename to script-resources/welcome/logos/ubuntu diff --git a/zsh/welcome/main.py b/script-resources/welcome/main.py similarity index 100% rename from zsh/welcome/main.py rename to script-resources/welcome/main.py diff --git a/zsh/welcome/system_info.py b/script-resources/welcome/system_info.py similarity index 100% rename from zsh/welcome/system_info.py rename to script-resources/welcome/system_info.py diff --git a/scripts/welcome b/scripts/welcome new file mode 120000 index 0000000..96ebfe7 --- /dev/null +++ b/scripts/welcome @@ -0,0 +1 @@ +../script-resources/welcome/main.py \ No newline at end of file diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 140f302..8d5f809 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -33,8 +33,6 @@ lazy_load() { }" } -welcome() { "$ZSH_DOTFILES/welcome/main.py"; } - if ! is_macos; then if is_android; then open_cmd='termux-open' From d4e04125a6694ab4dcc99b093fad708b8d68a31f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 11 Dec 2019 23:03:10 +0200 Subject: [PATCH 261/713] [scripts] handle non-existing languages in markdown2htmldoc --- script-resources/markdown2htmldoc/main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/script-resources/markdown2htmldoc/main.js b/script-resources/markdown2htmldoc/main.js index 1362206..46e162b 100755 --- a/script-resources/markdown2htmldoc/main.js +++ b/script-resources/markdown2htmldoc/main.js @@ -28,8 +28,9 @@ let md = markdownIt({ highlight: (str, lang) => { if (lang.length > 0) { loadPrismLanguages([lang]); - let h = Prism.highlight(str, Prism.languages[lang], lang); - return h; + if (Object.prototype.hasOwnProperty.call(Prism.languages, lang)) { + return Prism.highlight(str, Prism.languages[lang], lang); + } } return str; }, From 545770bc9efed6e04a79f4f106a5ab86b9ac12a8 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 15 Dec 2019 20:39:36 +0200 Subject: [PATCH 262/713] [nvim] use the ftplugin mechanism instead of FileType autocommands --- nvim/after/ftplugin/javascript.vim | 2 ++ nvim/after/ftplugin/rust.vim | 3 +++ nvim/after/ftplugin/typescript.vim | 1 + nvim/ftplugin/asm.vim | 1 + nvim/ftplugin/json.vim | 1 + nvim/ftplugin/markdown.vim | 1 + nvim/ftplugin/python.vim | 1 + nvim/ftplugin/text.vim | 1 + nvim/init.vim | 2 +- nvim/lib/languages/javascript.vim | 4 ---- nvim/lib/languages/json.vim | 5 ----- nvim/lib/languages/markdown.vim | 8 -------- nvim/lib/languages/python.vim | 7 ------- nvim/lib/languages/rust.vim | 4 ---- nvim/lib/languages/text.vim | 6 ------ 15 files changed, 12 insertions(+), 35 deletions(-) create mode 100644 nvim/after/ftplugin/javascript.vim create mode 100644 nvim/after/ftplugin/rust.vim create mode 100644 nvim/after/ftplugin/typescript.vim create mode 100644 nvim/ftplugin/asm.vim create mode 100644 nvim/ftplugin/json.vim create mode 100644 nvim/ftplugin/markdown.vim create mode 100644 nvim/ftplugin/python.vim create mode 100644 nvim/ftplugin/text.vim delete mode 100644 nvim/lib/languages/text.vim diff --git a/nvim/after/ftplugin/javascript.vim b/nvim/after/ftplugin/javascript.vim new file mode 100644 index 0000000..aab9c80 --- /dev/null +++ b/nvim/after/ftplugin/javascript.vim @@ -0,0 +1,2 @@ +" verbose set matchpairs? +" setlocal matchpairs-=<:> diff --git a/nvim/after/ftplugin/rust.vim b/nvim/after/ftplugin/rust.vim new file mode 100644 index 0000000..337cd7a --- /dev/null +++ b/nvim/after/ftplugin/rust.vim @@ -0,0 +1,3 @@ +echomsg "did ftplugin" +setlocal matchpairs-=<:> +let b:random_variable = 123 diff --git a/nvim/after/ftplugin/typescript.vim b/nvim/after/ftplugin/typescript.vim new file mode 100644 index 0000000..2d4068f --- /dev/null +++ b/nvim/after/ftplugin/typescript.vim @@ -0,0 +1 @@ +execute 'source' fnameescape(expand(':p:h').'/javascript.vim') diff --git a/nvim/ftplugin/asm.vim b/nvim/ftplugin/asm.vim new file mode 100644 index 0000000..dd3c908 --- /dev/null +++ b/nvim/ftplugin/asm.vim @@ -0,0 +1 @@ +setlocal commentstring=#%s diff --git a/nvim/ftplugin/json.vim b/nvim/ftplugin/json.vim new file mode 100644 index 0000000..2775816 --- /dev/null +++ b/nvim/ftplugin/json.vim @@ -0,0 +1 @@ +syntax match Comment +\/\/.\+$+ diff --git a/nvim/ftplugin/markdown.vim b/nvim/ftplugin/markdown.vim new file mode 100644 index 0000000..d86c38b --- /dev/null +++ b/nvim/ftplugin/markdown.vim @@ -0,0 +1 @@ +execute 'source' fnameescape(expand(':p:h').'/text.vim') diff --git a/nvim/ftplugin/python.vim b/nvim/ftplugin/python.vim new file mode 100644 index 0000000..e10ab03 --- /dev/null +++ b/nvim/ftplugin/python.vim @@ -0,0 +1 @@ +Indent 4 diff --git a/nvim/ftplugin/text.vim b/nvim/ftplugin/text.vim new file mode 100644 index 0000000..1bc3f90 --- /dev/null +++ b/nvim/ftplugin/text.vim @@ -0,0 +1 @@ +call pencil#init() diff --git a/nvim/init.vim b/nvim/init.vim index 24239f8..69f2a5d 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -2,7 +2,7 @@ let g:nvim_dotfiles_dir = expand(':p:h') let g:vim_ide = get(g:, 'vim_ide', 0) -let &runtimepath = g:nvim_dotfiles_dir.','.&runtimepath +let &runtimepath = g:nvim_dotfiles_dir.','.&runtimepath.','.g:nvim_dotfiles_dir.'/after' for s:name in ['plugins', 'editing', 'interface', 'files', 'completion', 'terminal', 'git'] execute 'source' fnameescape(g:nvim_dotfiles_dir.'/lib/'.s:name.'.vim') diff --git a/nvim/lib/languages/javascript.vim b/nvim/lib/languages/javascript.vim index 9ccfd65..34b3c23 100644 --- a/nvim/lib/languages/javascript.vim +++ b/nvim/lib/languages/javascript.vim @@ -1,7 +1,3 @@ -augroup vimrc-javascript - autocmd FileType javascript,typescript setlocal matchpairs-=<:> -augroup END - if !g:vim_ide | finish | endif call coc#add_extension('coc-tsserver', 'coc-eslint', 'coc-prettier') diff --git a/nvim/lib/languages/json.vim b/nvim/lib/languages/json.vim index 26ca88d..e80b1f4 100644 --- a/nvim/lib/languages/json.vim +++ b/nvim/lib/languages/json.vim @@ -1,8 +1,3 @@ -augroup vimrc-languages-json - autocmd! - autocmd FileType json syntax match Comment +\/\/.\+$+ -augroup END - if !g:vim_ide | finish | endif call coc#add_extension('coc-json') diff --git a/nvim/lib/languages/markdown.vim b/nvim/lib/languages/markdown.vim index 83878f6..fa42486 100644 --- a/nvim/lib/languages/markdown.vim +++ b/nvim/lib/languages/markdown.vim @@ -1,11 +1,3 @@ -let g:vim_markdown_conceal = 0 -let g:vim_markdown_conceal_code_blocks = 0 - -augroup vimrc-languages-markdown - autocmd! - autocmd FileType markdown call pencil#init() -augroup END - if !g:vim_ide | finish | endif let g:coc_filetypes += ['markdown'] diff --git a/nvim/lib/languages/python.vim b/nvim/lib/languages/python.vim index 059f625..aac9de9 100644 --- a/nvim/lib/languages/python.vim +++ b/nvim/lib/languages/python.vim @@ -1,10 +1,3 @@ -augroup vimrc-language-python - autocmd! - autocmd FileType python Indent 4 -augroup END - -let g:python_highlight_all = 1 - if !g:vim_ide | finish | endif call coc#add_extension('coc-python') diff --git a/nvim/lib/languages/rust.vim b/nvim/lib/languages/rust.vim index 8fd67c4..5f938b4 100644 --- a/nvim/lib/languages/rust.vim +++ b/nvim/lib/languages/rust.vim @@ -1,9 +1,5 @@ let g:rust_recommended_style = 0 -augroup vimrc-rust - autocmd FileType rust setlocal matchpairs-=<:> -augroup END - if !g:vim_ide | finish | endif call coc#add_extension('coc-rls') diff --git a/nvim/lib/languages/text.vim b/nvim/lib/languages/text.vim deleted file mode 100644 index 416f56b..0000000 --- a/nvim/lib/languages/text.vim +++ /dev/null @@ -1,6 +0,0 @@ -augroup vimrc-languages-text - autocmd! - autocmd FileType text call pencil#init() -augroup END - -if !g:vim_ide | finish | endif From 5ad510c830b799a26d5829f10eba31ffbc45d397 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 15 Dec 2019 22:03:56 +0200 Subject: [PATCH 263/713] [nvim] use wildmenu --- nvim/lib/interface.vim | 6 ------ 1 file changed, 6 deletions(-) diff --git a/nvim/lib/interface.vim b/nvim/lib/interface.vim index b78073d..d5abba5 100644 --- a/nvim/lib/interface.vim +++ b/nvim/lib/interface.vim @@ -1,9 +1,3 @@ -" configure behaviour of wildmenu when I press in the Vim command prompt -" 1. on the 1st , complete the longest common prefix -" 2. on the 2nd , list all available completions and open wildmenu -" this basically emulates Tab-completion behaviour in Zsh -set wildmode=list:longest,list:full - " always show the sign column set signcolumn=yes From f0d108ab4c95aea27e7784ffc24cd43fd3771f08 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 15 Dec 2019 22:17:10 +0200 Subject: [PATCH 264/713] [nvim] put my configs in runtimepath --- nvim/{lib/languages => coc-languages}/c.vim | 2 - nvim/{lib/languages => coc-languages}/css.vim | 2 - .../languages => coc-languages}/haskell.vim | 6 -- .../{lib/languages => coc-languages}/html.vim | 2 - .../javascript.vim | 2 - .../{lib/languages => coc-languages}/json.vim | 2 - .../languages => coc-languages}/markdown.vim | 2 - .../languages => coc-languages}/python.vim | 2 - .../{lib/languages => coc-languages}/rust.vim | 4 - .../{lib/languages => coc-languages}/yaml.vim | 2 - nvim/init.vim | 94 +++++++++++++++++-- nvim/lib/plugins.vim | 85 ----------------- nvim/{lib => plugin}/completion.vim | 9 +- nvim/{lib => plugin}/editing.vim | 10 ++ nvim/{lib => plugin}/files.vim | 0 nvim/{lib => plugin}/git.vim | 0 nvim/{lib => plugin}/interface.vim | 0 nvim/{lib => plugin}/terminal.vim | 0 18 files changed, 103 insertions(+), 121 deletions(-) rename nvim/{lib/languages => coc-languages}/c.vim (94%) rename nvim/{lib/languages => coc-languages}/css.vim (71%) rename nvim/{lib/languages => coc-languages}/haskell.vim (68%) rename nvim/{lib/languages => coc-languages}/html.vim (87%) rename nvim/{lib/languages => coc-languages}/javascript.vim (93%) rename nvim/{lib/languages => coc-languages}/json.vim (70%) rename nvim/{lib/languages => coc-languages}/markdown.vim (52%) rename nvim/{lib/languages => coc-languages}/python.vim (92%) rename nvim/{lib/languages => coc-languages}/rust.vim (64%) rename nvim/{lib/languages => coc-languages}/yaml.vim (50%) delete mode 100644 nvim/lib/plugins.vim rename nvim/{lib => plugin}/completion.vim (91%) rename nvim/{lib => plugin}/editing.vim (95%) rename nvim/{lib => plugin}/files.vim (100%) rename nvim/{lib => plugin}/git.vim (100%) rename nvim/{lib => plugin}/interface.vim (100%) rename nvim/{lib => plugin}/terminal.vim (100%) diff --git a/nvim/lib/languages/c.vim b/nvim/coc-languages/c.vim similarity index 94% rename from nvim/lib/languages/c.vim rename to nvim/coc-languages/c.vim index 1652882..50d02bc 100644 --- a/nvim/lib/languages/c.vim +++ b/nvim/coc-languages/c.vim @@ -1,5 +1,3 @@ -if !g:vim_ide | finish | endif - let s:filetypes = ['c', 'cpp', 'objc', 'objcpp'] let g:coc_filetypes += s:filetypes diff --git a/nvim/lib/languages/css.vim b/nvim/coc-languages/css.vim similarity index 71% rename from nvim/lib/languages/css.vim rename to nvim/coc-languages/css.vim index 3ae68ad..0b322e5 100644 --- a/nvim/lib/languages/css.vim +++ b/nvim/coc-languages/css.vim @@ -1,4 +1,2 @@ -if !g:vim_ide | finish | endif - call coc#add_extension('coc-css') let g:coc_filetypes += ['css', 'scss', 'less'] diff --git a/nvim/lib/languages/haskell.vim b/nvim/coc-languages/haskell.vim similarity index 68% rename from nvim/lib/languages/haskell.vim rename to nvim/coc-languages/haskell.vim index 5fbfe33..fdafd7f 100644 --- a/nvim/lib/languages/haskell.vim +++ b/nvim/coc-languages/haskell.vim @@ -1,9 +1,3 @@ -let g:haskell_conceal = 0 -let g:haskell_conceal_enumerations = 0 -let g:haskell_multiline_strings = 1 - -if !g:vim_ide | finish | endif - let s:filetypes = ['haskell', 'lhaskell', 'chaskell'] let g:coc_filetypes += s:filetypes call coc#config('languageserver.haskell', { diff --git a/nvim/lib/languages/html.vim b/nvim/coc-languages/html.vim similarity index 87% rename from nvim/lib/languages/html.vim rename to nvim/coc-languages/html.vim index 24c1ca6..5880168 100644 --- a/nvim/lib/languages/html.vim +++ b/nvim/coc-languages/html.vim @@ -1,5 +1,3 @@ -if !g:vim_ide | finish | endif - call coc#add_extension('coc-html', 'coc-emmet') let s:emmet_filetype_mapping = { 'jinja': 'html' } let g:coc_filetypes += ['html'] + keys(s:emmet_filetype_mapping) diff --git a/nvim/lib/languages/javascript.vim b/nvim/coc-languages/javascript.vim similarity index 93% rename from nvim/lib/languages/javascript.vim rename to nvim/coc-languages/javascript.vim index 34b3c23..ceed679 100644 --- a/nvim/lib/languages/javascript.vim +++ b/nvim/coc-languages/javascript.vim @@ -1,5 +1,3 @@ -if !g:vim_ide | finish | endif - call coc#add_extension('coc-tsserver', 'coc-eslint', 'coc-prettier') let g:coc_filetypes += ['javascript', 'javascript.jsx', 'typescript', 'typescript.jsx'] call coc#config('eslint', { diff --git a/nvim/lib/languages/json.vim b/nvim/coc-languages/json.vim similarity index 70% rename from nvim/lib/languages/json.vim rename to nvim/coc-languages/json.vim index e80b1f4..277ca25 100644 --- a/nvim/lib/languages/json.vim +++ b/nvim/coc-languages/json.vim @@ -1,4 +1,2 @@ -if !g:vim_ide | finish | endif - call coc#add_extension('coc-json') let g:coc_filetypes += ['json', 'json5'] diff --git a/nvim/lib/languages/markdown.vim b/nvim/coc-languages/markdown.vim similarity index 52% rename from nvim/lib/languages/markdown.vim rename to nvim/coc-languages/markdown.vim index fa42486..7234c40 100644 --- a/nvim/lib/languages/markdown.vim +++ b/nvim/coc-languages/markdown.vim @@ -1,3 +1 @@ -if !g:vim_ide | finish | endif - let g:coc_filetypes += ['markdown'] diff --git a/nvim/lib/languages/python.vim b/nvim/coc-languages/python.vim similarity index 92% rename from nvim/lib/languages/python.vim rename to nvim/coc-languages/python.vim index aac9de9..371e1d9 100644 --- a/nvim/lib/languages/python.vim +++ b/nvim/coc-languages/python.vim @@ -1,5 +1,3 @@ -if !g:vim_ide | finish | endif - call coc#add_extension('coc-python') let g:coc_filetypes += ['python'] call coc#config('pyls.plugins.pycodestyle.ignore', ['E501']) diff --git a/nvim/lib/languages/rust.vim b/nvim/coc-languages/rust.vim similarity index 64% rename from nvim/lib/languages/rust.vim rename to nvim/coc-languages/rust.vim index 5f938b4..b83c6e5 100644 --- a/nvim/lib/languages/rust.vim +++ b/nvim/coc-languages/rust.vim @@ -1,7 +1,3 @@ -let g:rust_recommended_style = 0 - -if !g:vim_ide | finish | endif - call coc#add_extension('coc-rls') let g:coc_filetypes += ['rust'] call coc#config('rust', { 'clippy_preference': 'on' }) diff --git a/nvim/lib/languages/yaml.vim b/nvim/coc-languages/yaml.vim similarity index 50% rename from nvim/lib/languages/yaml.vim rename to nvim/coc-languages/yaml.vim index 657a70a..3c48b35 100644 --- a/nvim/lib/languages/yaml.vim +++ b/nvim/coc-languages/yaml.vim @@ -1,3 +1 @@ -if !g:vim_ide | finish | endif - let g:coc_filetypes += ['yaml'] diff --git a/nvim/init.vim b/nvim/init.vim index 69f2a5d..1c9bf26 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -4,12 +4,92 @@ let g:vim_ide = get(g:, 'vim_ide', 0) let &runtimepath = g:nvim_dotfiles_dir.','.&runtimepath.','.g:nvim_dotfiles_dir.'/after' -for s:name in ['plugins', 'editing', 'interface', 'files', 'completion', 'terminal', 'git'] - execute 'source' fnameescape(g:nvim_dotfiles_dir.'/lib/'.s:name.'.vim') -endfor + +let s:vim_config_dir = expand('~/.config/nvim') +let s:vim_plug_script = s:vim_config_dir . '/autoload/plug.vim' +let s:vim_plug_home = s:vim_config_dir . '/plugged' + +let s:just_installed_vim_plug = 0 +if !filereadable(s:vim_plug_script) + execute '!curl -fL https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim --create-dirs -o' shellescape(s:vim_plug_script) + autocmd VimEnter * PlugInstall --sync +endif + +call plug#begin(s:vim_config_dir . '/plugged') + +Plug 'junegunn/vim-plug' + +" Files {{{ + Plug 'tpope/vim-eunuch' + if g:vim_ide + Plug 'francoiscabrol/ranger.vim' + endif +" }}} + +" Editing {{{ + Plug 'easymotion/vim-easymotion' + Plug 'junegunn/vim-easy-align' + Plug 'Raimondi/delimitMate' + Plug 'tpope/vim-repeat' + Plug 'tpope/vim-commentary' + Plug 'tpope/vim-surround' + Plug 'Yggdroot/indentLine' + Plug 'henrik/vim-indexed-search' + Plug 'andymass/vim-matchup' + " Plug 'tommcdo/vim-exchange' + Plug 'inkarkat/vim-ingo-library' " required by LineJuggler + Plug 'inkarkat/vim-LineJuggler', { 'branch': 'stable' } + Plug 'reedes/vim-pencil' +" }}} + +" Text objects {{{ + Plug 'kana/vim-textobj-user' + Plug 'kana/vim-textobj-entire' + Plug 'kana/vim-textobj-line' + Plug 'kana/vim-textobj-indent' +" }}} + +" UI {{{ + Plug 'moll/vim-bbye' + Plug 'gerw/vim-HiLinkTrace' + Plug 'vim-airline/vim-airline' + Plug 'tpope/vim-obsession' + Plug 'romainl/vim-qf' + if g:vim_ide + Plug 'dyng/ctrlsf.vim' + endif +" }}} + +" Git {{{ + Plug 'tpope/vim-fugitive' + Plug 'tpope/vim-rhubarb' + Plug 'airblade/vim-gitgutter' +" }}} + +" FZF {{{ + Plug 'junegunn/fzf', { 'do': './install --bin' } + Plug 'junegunn/fzf.vim' +" }}} + +" Programming {{{ + Plug 'sheerun/vim-polyglot' + if g:vim_ide + Plug 'neoclide/coc.nvim', { 'do': 'yarn install' } + Plug 'dag/vim2hs' + endif +" }}} + +call plug#end() + +" Automatically install/clean plugins (because I'm a programmer) {{{ + augroup vimrc-plugins + autocmd! + autocmd VimEnter * + \ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) + \| PlugInstall --sync | q + \| endif + augroup END +" }}} + colorscheme dotfiles - -for s:path in globpath(g:nvim_dotfiles_dir.'/lib/languages', '*', 0, 1) - execute 'source' fnameescape(s:path) -endfor diff --git a/nvim/lib/plugins.vim b/nvim/lib/plugins.vim deleted file mode 100644 index c79336e..0000000 --- a/nvim/lib/plugins.vim +++ /dev/null @@ -1,85 +0,0 @@ -let s:vim_config_dir = expand('~/.config/nvim') -let s:vim_plug_script = s:vim_config_dir . '/autoload/plug.vim' -let s:vim_plug_home = s:vim_config_dir . '/plugged' - -let s:just_installed_vim_plug = 0 -if !filereadable(s:vim_plug_script) - exe '!curl -fL https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim --create-dirs -o' shellescape(s:vim_plug_script) - autocmd VimEnter * PlugInstall --sync -endif - -call plug#begin(s:vim_config_dir . '/plugged') - -Plug 'junegunn/vim-plug' - -" Files {{{ - Plug 'tpope/vim-eunuch' - if g:vim_ide - Plug 'francoiscabrol/ranger.vim' - endif -" }}} - -" Editing {{{ - Plug 'easymotion/vim-easymotion' - Plug 'junegunn/vim-easy-align' - Plug 'Raimondi/delimitMate' - Plug 'tpope/vim-repeat' - Plug 'tpope/vim-commentary' - Plug 'tpope/vim-surround' - Plug 'Yggdroot/indentLine' - Plug 'henrik/vim-indexed-search' - Plug 'andymass/vim-matchup' - " Plug 'tommcdo/vim-exchange' - Plug 'inkarkat/vim-ingo-library' " required by LineJuggler - Plug 'inkarkat/vim-LineJuggler', { 'branch': 'stable' } - Plug 'reedes/vim-pencil' -" }}} - -" Text objects {{{ - Plug 'kana/vim-textobj-user' - Plug 'kana/vim-textobj-entire' - Plug 'kana/vim-textobj-line' - Plug 'kana/vim-textobj-indent' -" }}} - -" UI {{{ - Plug 'moll/vim-bbye' - Plug 'gerw/vim-HiLinkTrace' - Plug 'vim-airline/vim-airline' - Plug 'tpope/vim-obsession' - Plug 'romainl/vim-qf' - if g:vim_ide - Plug 'dyng/ctrlsf.vim' - endif -" }}} - -" Git {{{ - Plug 'tpope/vim-fugitive' - Plug 'tpope/vim-rhubarb' - Plug 'airblade/vim-gitgutter' -" }}} - -" FZF {{{ - Plug 'junegunn/fzf', { 'do': './install --bin' } - Plug 'junegunn/fzf.vim' -" }}} - -" Programming {{{ - Plug 'sheerun/vim-polyglot' - if g:vim_ide - Plug 'neoclide/coc.nvim', { 'do': 'yarn install' } - Plug 'dag/vim2hs' - endif -" }}} - -call plug#end() - -" " Automatically install/clean plugins (because I'm a programmer) {{{ - augroup vimrc-plugins - autocmd! - autocmd VimEnter * - \ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) - \| PlugInstall --sync | q - \| endif - augroup END -" " }}} diff --git a/nvim/lib/completion.vim b/nvim/plugin/completion.vim similarity index 91% rename from nvim/lib/completion.vim rename to nvim/plugin/completion.vim index 900ae31..1656f9a 100644 --- a/nvim/lib/completion.vim +++ b/nvim/plugin/completion.vim @@ -1,7 +1,7 @@ " pop-up (completion) menu mappings {{{ - imap pumvisible() ? "\" : "\delimitMateCR" - imap pumvisible() ? "\" : "\" - imap pumvisible() ? "\" : "\" + imap pumvisible() ? "\" : "\delimitMateCR" + imap pumvisible() ? "\" : "\" + imap pumvisible() ? "\" : "\" imap pumvisible() ? "\" : "\" " }}} @@ -81,4 +81,7 @@ endif \ 'errorSign': 'XX', \ 'warningSign': '!!', \ }) + + runtime! coc-languages/*.vim + " }}} diff --git a/nvim/lib/editing.vim b/nvim/plugin/editing.vim similarity index 95% rename from nvim/lib/editing.vim rename to nvim/plugin/editing.vim index 8ca20ac..369f3f8 100644 --- a/nvim/lib/editing.vim +++ b/nvim/plugin/editing.vim @@ -164,3 +164,13 @@ set commentstring=//%s xmap ga (LiveEasyAlign) nmap ga (LiveEasyAlign) " }}} + +" language-specific settings {{{ + + let g:rust_recommended_style = 0 + + let g:haskell_conceal = 0 + let g:haskell_conceal_enumerations = 0 + let g:haskell_multiline_strings = 1 + +" }}} diff --git a/nvim/lib/files.vim b/nvim/plugin/files.vim similarity index 100% rename from nvim/lib/files.vim rename to nvim/plugin/files.vim diff --git a/nvim/lib/git.vim b/nvim/plugin/git.vim similarity index 100% rename from nvim/lib/git.vim rename to nvim/plugin/git.vim diff --git a/nvim/lib/interface.vim b/nvim/plugin/interface.vim similarity index 100% rename from nvim/lib/interface.vim rename to nvim/plugin/interface.vim diff --git a/nvim/lib/terminal.vim b/nvim/plugin/terminal.vim similarity index 100% rename from nvim/lib/terminal.vim rename to nvim/plugin/terminal.vim From 12c736032d9fd353fed45004410d07a40799458a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 15 Dec 2019 23:32:32 +0200 Subject: [PATCH 265/713] [nvim] remove my ftplugin experiments --- nvim/after/ftplugin/javascript.vim | 3 +-- nvim/after/ftplugin/rust.vim | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/nvim/after/ftplugin/javascript.vim b/nvim/after/ftplugin/javascript.vim index aab9c80..d4217f4 100644 --- a/nvim/after/ftplugin/javascript.vim +++ b/nvim/after/ftplugin/javascript.vim @@ -1,2 +1 @@ -" verbose set matchpairs? -" setlocal matchpairs-=<:> +setlocal matchpairs-=<:> diff --git a/nvim/after/ftplugin/rust.vim b/nvim/after/ftplugin/rust.vim index 337cd7a..d4217f4 100644 --- a/nvim/after/ftplugin/rust.vim +++ b/nvim/after/ftplugin/rust.vim @@ -1,3 +1 @@ -echomsg "did ftplugin" setlocal matchpairs-=<:> -let b:random_variable = 123 From 914f01de141e0aaa66005fcb383fca177d351759 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 19 Dec 2019 18:56:29 +0200 Subject: [PATCH 266/713] [nvim] bind F9 to :make --- nvim/plugin/interface.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index d5abba5..86cf7d4 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -170,3 +170,6 @@ endif autocmd TermOpen * IndentLinesDisable augroup END " }}} + + +nnoremap make From 30e517a40cac7c104dec8eb2ce291ae7331509a1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 21 Dec 2019 21:19:24 +0200 Subject: [PATCH 267/713] [zsh] update links to Oh My Zsh --- zsh/completion.zsh | 2 +- zsh/functions.zsh | 4 ++-- zsh/plugins.zsh | 6 +++--- zsh/zplg.zsh | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/zsh/completion.zsh b/zsh/completion.zsh index 03c1401..439f4e8 100644 --- a/zsh/completion.zsh +++ b/zsh/completion.zsh @@ -1,5 +1,5 @@ # http://zsh.sourceforge.net/Doc/Release/Completion-System.html -# https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/completion.zsh +# https://github.com/ohmyzsh/ohmyzsh/blob/master/lib/completion.zsh # load fancier completion menu which (most notably) supports `list-colors` zmodload zsh/complist diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 8d5f809..5955fe9 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -62,8 +62,8 @@ fi eval "clipcopy(){$copy_cmd;};clippaste(){$paste_cmd;}" unset copy_cmd paste_cmd -# for compatibility with Oh-My-Zsh plugins -# Source: https://github.com/robbyrussell/oh-my-zsh/blob/5911aea46c71a2bcc6e7c92e5bebebf77b962233/lib/git.zsh#L58-L71 +# for compatibility with Oh My Zsh plugins +# Source: https://github.com/ohmyzsh/ohmyzsh/blob/5911aea46c71a2bcc6e7c92e5bebebf77b962233/lib/git.zsh#L58-L71 git_current_branch() { if [[ "$(command git rev-parse --is-inside-work-tree)" != true ]]; then return 1 diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index 069b173..340d378 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -17,7 +17,7 @@ _plugin completions 'zsh-users/zsh-completions' # compinit {{{ # note that completion system must be initialized after zsh-completions and - # before oh-my-zsh + # before Oh My Zsh autoload -U compinit run_compdump=1 @@ -44,12 +44,12 @@ _plugin completions 'zsh-users/zsh-completions' unset run_compdump # }}} -# Oh-My-Zsh {{{ +# Oh My Zsh {{{ omz_features=(key-bindings termsupport) omz_plugins=(git extract fasd) - _plugin oh-my-zsh 'robbyrussell/oh-my-zsh' \ + _plugin ohmyzsh 'ohmyzsh/ohmyzsh' \ load='lib/'${^omz_features}'.zsh' \ load='plugins/'${^omz_plugins}'/*.plugin.zsh' \ before_load='ZSH="$plugin_dir"' \ diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh index 73b343e..edc668f 100644 --- a/zsh/zplg.zsh +++ b/zsh/zplg.zsh @@ -293,8 +293,8 @@ plugin() { if (( ${#plugin_load} == 0 )); then # default loading patterns: - # - *.plugin.zsh for most plugins and Oh-My-Zsh ones - # - *.zsh-theme for most themes and Oh-My-Zsh ones + # - *.plugin.zsh for most plugins and Oh My Zsh ones + # - *.zsh-theme for most themes and Oh My Zsh ones # - init.zsh for Prezto plugins # ([1]) means "expand only to the first match" plugin_load=("(*.plugin.zsh|*.zsh-theme|init.zsh)([1])") From c31a5515f181c60fdc72790e8a24f5072cbe8427 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 23 Dec 2019 11:52:49 +0200 Subject: [PATCH 268/713] [zsh] add multiple file support for the `open` function --- zsh/functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 5955fe9..c82beec 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -41,7 +41,7 @@ if ! is_macos; then else open_cmd='print >&2 "open: Platform $OSTYPE is not supported"; return 1' fi - eval "open(){$open_cmd \"\$@\";}" + eval "open(){local f; for f in \"\$@\"; do $open_cmd \"\$f\"; done;}" unset open_cmd fi From 0bd63cd767af1765fc33e97cde9498cc3d90a7b9 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 25 Dec 2019 23:51:52 +0200 Subject: [PATCH 269/713] [git] refine and return custom format.pretty --- git/gitconfig | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/git/gitconfig b/git/gitconfig index 35cffee..3cfd4bc 100644 --- a/git/gitconfig +++ b/git/gitconfig @@ -6,9 +6,8 @@ [log] abbrevCommit = true - ; decorate = true -; [format] - ; pretty = %C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset) +[format] + pretty = %C(auto)%h%C(reset)%C(auto)%d%C(reset) %s %C(green)- %an %C(blue)(%ar)%C(reset) [core] pager = diff-so-fancy | less --tabs=4 --RAW-CONTROL-CHARS From 0d521c169b52e6ddcfb2332bd4d8b1f4be456a32 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 26 Dec 2019 00:04:52 +0200 Subject: [PATCH 270/713] [zsh, git] use Zsh aliases instead of gitconfig for my log format --- git/gitconfig | 5 ----- zsh/aliases.zsh | 6 ++++++ zsh/zshrc | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/git/gitconfig b/git/gitconfig index 3cfd4bc..a184545 100644 --- a/git/gitconfig +++ b/git/gitconfig @@ -4,11 +4,6 @@ [pull] rebase = true -[log] - abbrevCommit = true -[format] - pretty = %C(auto)%h%C(reset)%C(auto)%d%C(reset) %s %C(green)- %an %C(blue)(%ar)%C(reset) - [core] pager = diff-so-fancy | less --tabs=4 --RAW-CONTROL-CHARS diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 7238581..f7ef264 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -70,3 +70,9 @@ alias e="$EDITOR" if [[ "$EDITOR" == *vim ]]; then alias es="e -S" fi + +# some amendments to Oh My Zsh's git plugin +# https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/git/git.plugin.zsh +alias glo="git log --decorate --abbrev-commit --date=relative --pretty='%C(auto)%h%C(reset)%C(auto)%d%C(reset) %s %C(green)- %an %C(blue)(%ad)%C(reset)'" +alias glog='glo --graph' +alias gloga='glog --all' diff --git a/zsh/zshrc b/zsh/zshrc index 9747d4d..b9ec0b2 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -33,7 +33,7 @@ autoload -U colors && colors _perf_timer_start "total" -for script in functions options path env aliases plugins completion zle prompt colorscheme; do +for script in functions options path env plugins aliases completion zle prompt colorscheme; do _perf_timer_start "$script.zsh" source "$ZSH_DOTFILES/$script.zsh" _perf_timer_stop "$script.zsh" From 1c43cdcf515fdd9b77702c53321a05897f4f2e90 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 30 Dec 2019 17:22:28 +0200 Subject: [PATCH 271/713] [zsh] add function for checking out latest versions of plugins --- zsh/plugins.zsh | 15 +++++++++++---- zsh/zplg.zsh | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index 340d378..c094199 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -13,7 +13,9 @@ _plugin() { _perf_timer_stop "plugin $1" } -_plugin completions 'zsh-users/zsh-completions' +_checkout_latest_version='build=plugin-cfg-git-checkout-version "*"' + +_plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" # compinit {{{ # note that completion system must be initialized after zsh-completions and @@ -60,14 +62,19 @@ _plugin completions 'zsh-users/zsh-completions' # }}} -_plugin fzf 'junegunn/fzf' build='./install --bin' \ +_plugin fzf 'junegunn/fzf' "$_checkout_latest_version" \ + build='./install --bin' \ after_load='plugin-cfg-path path prepend bin' \ after_load='plugin-cfg-path manpath prepend man' -_plugin alias-tips 'djui/alias-tips' +if command_exists python; then + _plugin alias-tips 'djui/alias-tips' +fi FAST_WORK_DIR="$ZSH_CACHE_DIR" if [[ "$TERM" != "linux" ]]; then - _plugin fast-syntax-highlighting 'zdharma/fast-syntax-highlighting' + _plugin fast-syntax-highlighting 'zdharma/fast-syntax-highlighting' "$_checkout_latest_version" set-my-syntax-theme() { fast-theme "$ZSH_DOTFILES/my-syntax-theme.ini" "$@"; } fi + +unset _checkout_latest_version diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh index edc668f..6748413 100644 --- a/zsh/zplg.zsh +++ b/zsh/zplg.zsh @@ -395,6 +395,27 @@ plugin() { esac } + plugin-cfg-git-checkout-version() { + if (( $# < 1 )); then + _zplg_error "usage: $0 " + return 1 + fi + + local pattern="$1" tag no_tags=1 + + command git tag --sort=-version:refname | while IFS= read -r tag; do + no_tags=0 + if [[ "$tag" == ${~pattern} ]]; then + break + fi + done + + if (( ! no_tags )); then + _zplg_log "the latest version is $tag" + command git checkout --quiet "$tag" + fi + } + # }}} # Exits with success code 0 if the plugin is loaded, otherwise exits with error From 8f02ecf943c6e13c293d007dadde2b9cfc75064a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 4 Jan 2020 14:18:27 +0200 Subject: [PATCH 272/713] [nvim] fix null highlighting in JSON --- nvim/colors/dotfiles.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index d802676..a2eab62 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -282,6 +282,10 @@ hi! link jsExport Include " }}} +" JSON {{{ + hi! link jsonNull Constant +" }}} + " TypeScript {{{ let g:yats_host_keyword = 0 hi! link typescriptParens jsParens From 093bd9837c6b36a49190d78c21541e6bf5d97788 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 4 Jan 2020 23:20:09 +0200 Subject: [PATCH 273/713] [zsh] change jq theme --- zsh/env.zsh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/zsh/env.zsh b/zsh/env.zsh index 0cbcc3d..9870a4a 100644 --- a/zsh/env.zsh +++ b/zsh/env.zsh @@ -15,3 +15,17 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad" if [[ -z "$LS_COLORS" ]] && command_exists dircolors; then eval "$(dircolors --bourne-shell)" fi + +# see COLORS in jq(1) +jq_colors=( + "0;38;5;16" # null + "0;38;5;16" # false + "0;38;5;16" # true + "0;38;5;16" # numbers + "0;32" # strings + "0;39" # arrays + "0;39" # objects +) +# join all values from jq_colors with a semicolon +export JQ_COLORS="${(j.:.)jq_colors}" +# unset jq_colors From 894a81f2b379ae6e20db1490e38533d402ce68c1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 5 Jan 2020 13:43:46 +0200 Subject: [PATCH 274/713] [zsh] refactor *path variable manipulation functions --- zsh/path.zsh | 83 +++++++++++++++++++++++++--------------------------- zsh/zplg.zsh | 20 +++++++++---- 2 files changed, 54 insertions(+), 49 deletions(-) diff --git a/zsh/path.zsh b/zsh/path.zsh index bf180cc..37ea188 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -2,77 +2,74 @@ # tie these env variables to zsh arrays typeset -T PKG_CONFIG_PATH pkg_config_path ':' - -# keep only unique values in these arrays -typeset -U path fpath manpath pkg_config_path -export -U PATH FPATH MANPATH PKG_CONFIG_PATH - -path_append() { - local arr_name="$1" value="$2" - if eval "if (( \${${arr_name}[(ie)\$value]} > \${#${arr_name}} ))"; then - eval "${arr_name}+=(\"\$value\")" - eval "${arr_name}=(\"\${${arr_name}[@]}\" \"\$value\")" - fi -} +export PKG_CONFIG_PATH path_prepend() { - local arr_name="$1" value="$2" - if eval "if (( \${${arr_name}[(ie)\$value]} > \${#${arr_name}} ))"; then - eval "${arr_name}=(\"\$value\" \"\${${arr_name}[@]}\")" + if (( $# < 2 )); then + print >&2 "usage: $0 " + return 1 fi + local var_name="$1"; shift + local value; for value in "$@"; do + if eval "(( \${${var_name}[(ie)\$value]} > \${#${var_name}} ))"; then + eval "${var_name}=(\"\$value\" \"\${${var_name}[@]}\")" + fi + done } if is_macos; then - path=( - ~/Library/Python/*/bin - /usr/local/opt/ruby/bin - /usr/local/opt/file-formula/bin # file - /usr/local/opt/gnu-tar/libexec/gnubin # GNU tar - /usr/local/opt/unzip/bin # GNU unzip - /usr/local/opt/openssl/bin # openssl - /usr/local/opt/gnu-getopt/bin # getopt - /usr/local/opt/findutils/libexec/gnubin # GNU findutils - /usr/local/opt/coreutils/libexec/gnubin # GNU coreutils - /usr/local/opt/curl/bin # curl - "${path[@]}" - ) + # local Python binaries (for some reason they don't go into ~/.local/bin, but + # instead into the garbage ~/Library directory) + path_prepend path ~/Library/Python/*/bin(OnN) - manpath=( - /usr/local/opt/findutils/libexec/gnuman # GNU findutils - "${manpath[@]}" - ) + # GNU counterparts of command line utilities + path_prepend path /usr/local/opt/*/libexec/gnubin(N) + path_prepend manpath /usr/local/opt/*/libexec/gnuman(N) - for formula in ruby openssl curl; do + # add some keg-only Homebrew formulas + for formula in curl file-formula openssl ruby; do formula_path="/usr/local/opt/$formula" - if [[ -d "$formula_path" ]]; then - pkg_config_path+=( "$formula_path"/lib/pkgconfig ) + if [[ ! -d "$formula_path" ]]; then + continue + fi + + if [[ -d "$formula_path/bin" ]]; then + path_prepend path "$formula_path/bin" + fi + + if [[ -d "$formula_path/lib/pkgconfig" ]]; then + path_prepend pkg_config_path "$formula_path/lib/pkgconfig" fi done + + unset formula fi # Yarn global packages -path=(~/.yarn/bin "${path[@]}") +path_prepend path ~/.yarn/bin # Go export GOPATH=~/.go -path=("$GOPATH/bin" "${path[@]}") +path_prepend path "$GOPATH/bin" # Rust -path=(~/.cargo/bin "${path[@]}") +path_prepend path ~/.cargo/bin # check if the Rust toolchain was installed via rustup if rustup_home="$(rustup show home 2> /dev/null)" && rust_sysroot="$(rustc --print sysroot 2> /dev/null)" && [[ -d "$rustup_home" && -d "$rust_sysroot" && "$rust_sysroot" == "$rustup_home"/* ]] then # add paths of the selected Rust toolchain - fpath=("$rust_sysroot/share/zsh/site-functions" "${fpath[@]}") - manpath=("$rust_sysroot/share/man" "${manpath[@]}") + path_prepend fpath "$rust_sysroot/share/zsh/site-functions" + path_prepend manpath "$rust_sysroot/share/man" fi unset rustup_home rust_sysroot # add my binaries and completions -path=("${ZSH_DOTFILES:h}/scripts" "${path[@]}") -fpath=("$ZSH_DOTFILES/completions" "${fpath[@]}") +path_prepend path "${ZSH_DOTFILES:h}/scripts" +path_prepend fpath "$ZSH_DOTFILES/completions" # add user binaries -path=(~/.local/bin "${path[@]}") +path_prepend path ~/.local/bin + +unfunction path_prepend diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh index 6748413..72efd62 100644 --- a/zsh/zplg.zsh +++ b/zsh/zplg.zsh @@ -381,18 +381,26 @@ plugin() { return 1 fi - local var_name="$1" operator="$2"; shift 2; local values=("$@") + local var_name="$1" operator="$2"; shift 2 if [[ "$var_name" != *path || "${(Pt)var_name}" != array* ]]; then _zplg_error "unknown path variable $var_name" return 1 fi - case "$operator" in - prepend) eval "$var_name=(\"\$plugin_dir/\"\${^values} \${$var_name[@]})" ;; - append) eval "$var_name=(\${$var_name[@]} \"\$plugin_dir/\"\${^values})" ;; - *) _zplg_error "unknown $0 operator $operator" - esac + if [[ "$operator" != (prepend|append) ]]; then + _zplg_error "unknown operator $operator" + return 1 + fi + + local value; for value in "$plugin_dir/"${^@}; do + if eval "(( \${${var_name}[(ie)\$value]} > \${#${var_name}} ))"; then + case "$operator" in + prepend) eval "$var_name=(\"\$value\" \${$var_name[@]})" ;; + append) eval "$var_name=(\${$var_name[@]} \"\$value\")" ;; + esac + fi + done } plugin-cfg-git-checkout-version() { From e549d7fa2fe6867d591f7aafb88b1a638742ce66 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 5 Jan 2020 13:58:58 +0200 Subject: [PATCH 275/713] [zsh] refactor platform identification --- zsh/functions.zsh | 10 +++------- zsh/path.zsh | 2 +- zsh/zshrc | 13 +++++++++++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index c82beec..29772d6 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -16,10 +16,6 @@ viscd() { rm -f -- "$temp_file" } -is_linux() { [[ "$OSTYPE" == linux* ]]; } -is_macos() { [[ "$OSTYPE" == darwin* ]]; } -is_android() { [[ "$OSTYPE" == linux-android ]]; } - command_exists() { command -v "$1" &>/dev/null; } lazy_load() { @@ -33,8 +29,8 @@ lazy_load() { }" } -if ! is_macos; then - if is_android; then +if (( ! _is_macos )); then + if (( _is_android )); then open_cmd='termux-open' elif command_exists xdg-open; then open_cmd='nohup xdg-open &> /dev/null' @@ -45,7 +41,7 @@ if ! is_macos; then unset open_cmd fi -if is_macos; then +if (( _is_macos )); then copy_cmd='pbcopy' paste_cmd='pbpaste' elif command_exists xclip; then copy_cmd='xclip -in -selection clipboard' paste_cmd='xclip -out -selection clipboard' diff --git a/zsh/path.zsh b/zsh/path.zsh index 37ea188..6cc275d 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -17,7 +17,7 @@ path_prepend() { done } -if is_macos; then +if (( _is_macos )); then # local Python binaries (for some reason they don't go into ~/.local/bin, but # instead into the garbage ~/Library directory) path_prepend path ~/Library/Python/*/bin(OnN) diff --git a/zsh/zshrc b/zsh/zshrc index b9ec0b2..729b50e 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -33,6 +33,19 @@ autoload -U colors && colors _perf_timer_start "total" +# platform identification {{{ + if [[ "$OSTYPE" == linux* ]]; then + _is_linux=1 + if [[ "$OSTYPE" == linux-android ]]; then + _is_android=1 + fi + fi + + if [[ "$OSTYPE" == darwin* ]]; then + _is_macos=1 + fi +# }}} + for script in functions options path env plugins aliases completion zle prompt colorscheme; do _perf_timer_start "$script.zsh" source "$ZSH_DOTFILES/$script.zsh" From ff47c00035a4a80c3d28fa8a838dcf1a9ae85ec7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 5 Jan 2020 19:00:13 +0200 Subject: [PATCH 276/713] [zsh] unset jq_colors --- zsh/env.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zsh/env.zsh b/zsh/env.zsh index 9870a4a..8dc25fa 100644 --- a/zsh/env.zsh +++ b/zsh/env.zsh @@ -22,10 +22,10 @@ jq_colors=( "0;38;5;16" # false "0;38;5;16" # true "0;38;5;16" # numbers - "0;32" # strings - "0;39" # arrays - "0;39" # objects + "0;32" # strings + "0;39" # arrays + "0;39" # objects ) # join all values from jq_colors with a semicolon export JQ_COLORS="${(j.:.)jq_colors}" -# unset jq_colors +unset jq_colors From 42c2d377342266f35d22e8d81ebce2da0b3eeb83 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 6 Jan 2020 16:16:24 +0200 Subject: [PATCH 277/713] [nvim] fix coc#status error/warning signs --- nvim/coc-languages/c.vim | 8 ++++---- nvim/coc-languages/css.vim | 2 +- nvim/coc-languages/haskell.vim | 4 ++-- nvim/coc-languages/html.vim | 4 ++-- nvim/coc-languages/javascript.vim | 10 +++++----- nvim/coc-languages/json.vim | 2 +- nvim/coc-languages/python.vim | 8 ++++---- nvim/coc-languages/rust.vim | 4 ++-- nvim/plugin/completion.vim | 9 ++++++--- nvim/plugin/interface.vim | 2 +- 10 files changed, 28 insertions(+), 25 deletions(-) diff --git a/nvim/coc-languages/c.vim b/nvim/coc-languages/c.vim index 50d02bc..dab445e 100644 --- a/nvim/coc-languages/c.vim +++ b/nvim/coc-languages/c.vim @@ -1,7 +1,7 @@ let s:filetypes = ['c', 'cpp', 'objc', 'objcpp'] let g:coc_filetypes += s:filetypes -call coc#config('languageserver.ccls', { +let g:coc_user_config['languageserver.ccls'] = { \ 'filetypes': s:filetypes, \ 'command': 'ccls', \ 'rootPatterns': ['.ccls', 'compile_commands.json', '.vim/', '.git/', '.hg/'], @@ -10,10 +10,10 @@ call coc#config('languageserver.ccls', { \ 'directory': '/tmp/ccls', \ }, \ }, -\ }) +\ } -" call coc#config('languageserver.clangd', { +" let g:coc_user_config['languageserver.clangd'] = { " \ 'filetypes': s:filetypes, " \ 'command': 'clangd', " \ 'rootPatterns': ['compile_flags.txt', 'compile_commands.json', '.vim/', '.git/', '.hg/'], -" \ }) +" \ } diff --git a/nvim/coc-languages/css.vim b/nvim/coc-languages/css.vim index 0b322e5..aedd28e 100644 --- a/nvim/coc-languages/css.vim +++ b/nvim/coc-languages/css.vim @@ -1,2 +1,2 @@ -call coc#add_extension('coc-css') +let g:coc_global_extensions += ['coc-css'] let g:coc_filetypes += ['css', 'scss', 'less'] diff --git a/nvim/coc-languages/haskell.vim b/nvim/coc-languages/haskell.vim index fdafd7f..a80de3e 100644 --- a/nvim/coc-languages/haskell.vim +++ b/nvim/coc-languages/haskell.vim @@ -1,8 +1,8 @@ let s:filetypes = ['haskell', 'lhaskell', 'chaskell'] let g:coc_filetypes += s:filetypes -call coc#config('languageserver.haskell', { +let g:coc_user_config['languageserver.haskell'] = { \ 'filetypes': s:filetypes, \ 'command': 'hie-wrapper', \ 'rootPatterns': ['.stack.yaml', 'cabal.config', 'package.yaml'], \ 'initializationOptions': {}, -\ }) +\ } diff --git a/nvim/coc-languages/html.vim b/nvim/coc-languages/html.vim index 5880168..700fbf4 100644 --- a/nvim/coc-languages/html.vim +++ b/nvim/coc-languages/html.vim @@ -1,4 +1,4 @@ -call coc#add_extension('coc-html', 'coc-emmet') +let g:coc_global_extensions += ['coc-html', 'coc-emmet'] let s:emmet_filetype_mapping = { 'jinja': 'html' } let g:coc_filetypes += ['html'] + keys(s:emmet_filetype_mapping) -call coc#config('emmet.includeLanguages', s:emmet_filetype_mapping) +let g:coc_user_config['emmet.includeLanguages'] = s:emmet_filetype_mapping diff --git a/nvim/coc-languages/javascript.vim b/nvim/coc-languages/javascript.vim index ceed679..f5c88e9 100644 --- a/nvim/coc-languages/javascript.vim +++ b/nvim/coc-languages/javascript.vim @@ -1,13 +1,13 @@ -call coc#add_extension('coc-tsserver', 'coc-eslint', 'coc-prettier') +let g:coc_global_extensions += ['coc-tsserver', 'coc-eslint', 'coc-prettier'] let g:coc_filetypes += ['javascript', 'javascript.jsx', 'typescript', 'typescript.jsx'] -call coc#config('eslint', { +let g:coc_user_config['eslint'] = { \ 'filetypes': ['javascript', 'javascriptreact'], \ 'autoFixOnSave': v:true, -\ }) -call coc#config('prettier', { +\ } +let g:coc_user_config['prettier'] = { \ 'singleQuote': v:true, \ 'trailingComma': 'all', \ 'jsxBracketSameLine': v:true, \ 'eslintIntegration': v:true, \ 'disableSuccessMessage': v:true -\ }) +\ } diff --git a/nvim/coc-languages/json.vim b/nvim/coc-languages/json.vim index 277ca25..d875e3c 100644 --- a/nvim/coc-languages/json.vim +++ b/nvim/coc-languages/json.vim @@ -1,2 +1,2 @@ -call coc#add_extension('coc-json') +let g:coc_global_extensions += ['coc-json'] let g:coc_filetypes += ['json', 'json5'] diff --git a/nvim/coc-languages/python.vim b/nvim/coc-languages/python.vim index 371e1d9..25d9663 100644 --- a/nvim/coc-languages/python.vim +++ b/nvim/coc-languages/python.vim @@ -1,7 +1,7 @@ -call coc#add_extension('coc-python') +let g:coc_global_extensions += ['coc-python'] let g:coc_filetypes += ['python'] -call coc#config('pyls.plugins.pycodestyle.ignore', ['E501']) -call coc#config('python', { +let g:coc_user_config['pyls.plugins.pycodestyle.ignore'] = ['E501'] +let g:coc_user_config['python'] = { \ 'autocomplete': { 'showAdvancedMembers': v:false }, \ 'formatting': { 'provider': 'black' }, \ 'linting': { @@ -9,4 +9,4 @@ call coc#config('python', { \ 'flake8Enabled': v:true, \ 'flake8Args': ['--ignore', 'E501'], \ }, -\ }) +\ } diff --git a/nvim/coc-languages/rust.vim b/nvim/coc-languages/rust.vim index b83c6e5..d934cbf 100644 --- a/nvim/coc-languages/rust.vim +++ b/nvim/coc-languages/rust.vim @@ -1,3 +1,3 @@ -call coc#add_extension('coc-rls') +let g:coc_global_extensions += ['coc-rls'] let g:coc_filetypes += ['rust'] -call coc#config('rust', { 'clippy_preference': 'on' }) +let g:coc_user_config['rust'] = { 'clippy_preference': 'on' } diff --git a/nvim/plugin/completion.vim b/nvim/plugin/completion.vim index 1656f9a..b7f5519 100644 --- a/nvim/plugin/completion.vim +++ b/nvim/plugin/completion.vim @@ -74,13 +74,16 @@ endif command! -nargs=0 -range -bar CocFormat call s:CocFormat(, , ) " }}} - call coc#add_extension('coc-snippets') - call coc#config('diagnostic', { + let g:coc_global_extensions = [] + let g:coc_user_config = {} + + let g:coc_global_extensions += ['coc-snippets'] + let g:coc_user_config['diagnostic'] = { \ 'virtualText': v:true, \ 'enableMessage': 'jump', \ 'errorSign': 'XX', \ 'warningSign': '!!', - \ }) + \ } runtime! coc-languages/*.vim diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 86cf7d4..8a1d3fc 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -135,7 +135,7 @@ endif let g:airline_section_{a:section} = g:airline_section_{a:section} . airline#section#create_left([''] + a:items) endfunction function s:tweak_airline() - if exists('*coc#status') + if g:vim_ide call s:airline_section_prepend('x', ['coc#status']) endif call s:airline_section_append('y', ['filesize']) From 13c57e9dcc58c85bf724d1692212a54e8b2ea140 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 6 Jan 2020 16:40:45 +0200 Subject: [PATCH 278/713] [nvim] disable floating window for suggestions --- nvim/plugin/completion.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/plugin/completion.vim b/nvim/plugin/completion.vim index b7f5519..a19cd4c 100644 --- a/nvim/plugin/completion.vim +++ b/nvim/plugin/completion.vim @@ -84,6 +84,7 @@ endif \ 'errorSign': 'XX', \ 'warningSign': '!!', \ } + let g:coc_user_config['suggest.floatEnable'] = v:false runtime! coc-languages/*.vim From e415f2c1bf08ea2acee4b623337a1d80fe0a6458 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 11 Jan 2020 13:50:25 +0200 Subject: [PATCH 279/713] [kitty] disable window title in menu bar --- kitty/kitty.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kitty/kitty.conf b/kitty/kitty.conf index 30b075e..33f9b5e 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -576,6 +576,8 @@ macos_custom_beam_cursor yes #: on both light and dark backgrounds. WARNING: this might make your #: mouse cursor invisible on dual GPU machines. +macos_show_window_title_in window + #: }}} #: Keyboard shortcuts {{{ From 328a75d15758a9bd495afb99bcbbe54cae1f322c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 12 Jan 2020 10:34:16 +0200 Subject: [PATCH 280/713] [zsh] temporarily fix zplg errors caused by detached HEAD in plugins --- upgrade.zsh | 2 ++ zsh/zplg.zsh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/upgrade.zsh b/upgrade.zsh index 3f4b7be..81b28b3 100755 --- a/upgrade.zsh +++ b/upgrade.zsh @@ -4,6 +4,8 @@ DOTFILES_PATH="${0:a:h}" cd "$DOTFILES_PATH" || exit 1 ZSH_DOTFILES="$DOTFILES_PATH/zsh" +source "$ZSH_DOTFILES/functions.zsh" + git pull --rebase --stat origin master git submodule update --init --recursive --remote --progress diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh index 72efd62..3dbec9c 100644 --- a/zsh/zplg.zsh +++ b/zsh/zplg.zsh @@ -151,7 +151,7 @@ _zplg_load() { _zplg_source_git_upgrade() { local plugin_url="$1" plugin_dir="$2" - ( cd "$plugin_dir" && git pull && git submodule update --init --recursive ) + ( cd "$plugin_dir" && (git pull || git fetch) && git submodule update --init --recursive ) } # small helper for the git source From 26ee24272153b33255e19ca586c67c8d7d56036d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 17 Jan 2020 20:33:06 +0200 Subject: [PATCH 281/713] [nvim] add indent detection --- nvim/init.vim | 2 +- nvim/plugin/editing.vim | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/nvim/init.vim b/nvim/init.vim index 1c9bf26..e2e3313 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -36,10 +36,10 @@ Plug 'junegunn/vim-plug' Plug 'Yggdroot/indentLine' Plug 'henrik/vim-indexed-search' Plug 'andymass/vim-matchup' - " Plug 'tommcdo/vim-exchange' Plug 'inkarkat/vim-ingo-library' " required by LineJuggler Plug 'inkarkat/vim-LineJuggler', { 'branch': 'stable' } Plug 'reedes/vim-pencil' + Plug 'ciaranm/detectindent' " }}} " Text objects {{{ diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 369f3f8..590a550 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -6,6 +6,7 @@ set virtualedit=onemore set foldmethod=marker +" use line C-style comments instead of block ones (/* ... */) set commentstring=//%s @@ -30,6 +31,15 @@ set commentstring=//%s let g:indentLine_showFirstIndentLevel = 1 let g:indentLine_fileTypeExclude = ['text', 'help', 'tutor', 'man'] + let g:detectindent_preferred_indent = 2 + let g:detectindent_preferred_expandtab = 1 + " let g:detectindent_verbosity = 0 + + augroup vimrc-detect-indent + autocmd! + autocmd FileType * if empty(&bt) | DetectIndent | endif + augroup END + " }}} From 9e84c32f9d59e79f5d140adcf841d0e01e56669b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 20 Jan 2020 01:30:23 +0200 Subject: [PATCH 282/713] [nvim] remove hardcoded config path --- nvim/init.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/init.vim b/nvim/init.vim index e2e3313..12a6126 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -5,7 +5,7 @@ let g:vim_ide = get(g:, 'vim_ide', 0) let &runtimepath = g:nvim_dotfiles_dir.','.&runtimepath.','.g:nvim_dotfiles_dir.'/after' -let s:vim_config_dir = expand('~/.config/nvim') +let s:vim_config_dir = stdpath("config") let s:vim_plug_script = s:vim_config_dir . '/autoload/plug.vim' let s:vim_plug_home = s:vim_config_dir . '/plugged' From fe4e7cd307ccc5c93b747a904a541ef60045e186 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 27 Jan 2020 11:50:35 +0200 Subject: [PATCH 283/713] [nvim] disable markdown conceal --- nvim/plugin/editing.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 590a550..1450e38 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -175,6 +175,7 @@ set commentstring=//%s nmap ga (LiveEasyAlign) " }}} + " language-specific settings {{{ let g:rust_recommended_style = 0 @@ -183,4 +184,7 @@ set commentstring=//%s let g:haskell_conceal_enumerations = 0 let g:haskell_multiline_strings = 1 + let g:vim_markdown_conceal = 0 + let g:vim_markdown_conceal_code_blocks = 0 + " }}} From 1a9f2a6276c1ed2788d2fb4955deb457630c4f16 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 27 Jan 2020 12:00:26 +0200 Subject: [PATCH 284/713] [nvim] disable indent lines in text files --- nvim/ftplugin/text.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/ftplugin/text.vim b/nvim/ftplugin/text.vim index 1bc3f90..66ad5ed 100644 --- a/nvim/ftplugin/text.vim +++ b/nvim/ftplugin/text.vim @@ -1 +1,2 @@ call pencil#init() +IndentLinesDisable From 84d121f5e570fdcb0134bdb4ebe8fa83e0b38852 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 27 Jan 2020 17:09:50 +0200 Subject: [PATCH 285/713] [nvim] disable key mappings in the markdown plugin --- nvim/plugin/editing.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 1450e38..be109ed 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -186,5 +186,6 @@ set commentstring=//%s let g:vim_markdown_conceal = 0 let g:vim_markdown_conceal_code_blocks = 0 + let g:vim_markdown_no_default_key_mappings = 0 " }}} From e52821db5ebbe765c7d52ca5428cbe0bceb124bd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 30 Jan 2020 21:39:58 +0200 Subject: [PATCH 286/713] [git] add some more entries to gitignore_global --- git/gitignore_global | 2 ++ 1 file changed, 2 insertions(+) diff --git a/git/gitignore_global b/git/gitignore_global index d992b6f..382fa64 100644 --- a/git/gitignore_global +++ b/git/gitignore_global @@ -1 +1,3 @@ Session.vim +.project.vim +.DS_Store From 7025b697d62dd783f7000b4f2a20b822260b6d00 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 1 Feb 2020 17:56:51 +0200 Subject: [PATCH 287/713] [colorschemes] mention default setvtrgb config --- colorschemes/setvtrgb.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/colorschemes/setvtrgb.py b/colorschemes/setvtrgb.py index 366cc56..8a8f117 100755 --- a/colorschemes/setvtrgb.py +++ b/colorschemes/setvtrgb.py @@ -2,6 +2,11 @@ import _theme as theme +# default setvtrgb config: +# 0,170,0,170,0,170,0,170,85,255,85,255,85,255,85,255 +# 0,0,170,85,0,0,170,170,85,85,255,255,85,85,255,255 +# 0,0,0,0,170,170,170,170,85,85,85,85,255,255,255,255 + for i in range(3): print( ",".join( From 527936e3b3263f64d7567920a8fabb63b9f34c77 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 10 Feb 2020 14:36:49 +0200 Subject: [PATCH 288/713] [nvim] configure CtrlSF theme a bit --- nvim/colors/dotfiles.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index a2eab62..995384f 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -134,6 +134,11 @@ " }}} +" CtrlSF {{{ + hi! link ctrlsfMatch Search + hi! link ctrlsfLnumMatch ctrlsfMatch +" }}} + " AWK {{{ hi! link awkArrayElement Number hi! link awkBoolLogic Operator From 01a6ac0aef38c40b8a22426279b5337e97b233a1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 10 Feb 2020 14:37:12 +0200 Subject: [PATCH 289/713] [nvim] add proper highlighting for keyword operators in Python --- nvim/{ftplugin => after/syntax}/json.vim | 0 nvim/after/syntax/python.vim | 4 ++++ nvim/colors/dotfiles.vim | 7 ++++--- 3 files changed, 8 insertions(+), 3 deletions(-) rename nvim/{ftplugin => after/syntax}/json.vim (100%) create mode 100644 nvim/after/syntax/python.vim diff --git a/nvim/ftplugin/json.vim b/nvim/after/syntax/json.vim similarity index 100% rename from nvim/ftplugin/json.vim rename to nvim/after/syntax/json.vim diff --git a/nvim/after/syntax/python.vim b/nvim/after/syntax/python.vim new file mode 100644 index 0000000..5fa9647 --- /dev/null +++ b/nvim/after/syntax/python.vim @@ -0,0 +1,4 @@ +syn clear pythonOperator +syn match pythonOperator '\V=\|-\|+\|*\|@\|/\|%\|&\||\|^\|~\|<\|>\|!=' +syn keyword pythonOperatorKeyword and in is not or +syn cluster pythonExpression add=pythonOperatorKeyword diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 995384f..7601232 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -341,9 +341,10 @@ " }}} " Python {{{ - hi! link pythonBuiltinType Type - hi! link pythonBuiltinObj pythonFunction - hi! link pythonClassVar Variable + hi! link pythonBuiltinType Type + hi! link pythonBuiltinObj pythonFunction + hi! link pythonClassVar Variable + hi! link pythonOperatorKeyword Keyword " }}} " Ruby {{{ From 16818de1025ebbd02a4a77b1a689b29e29e62b2a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 23 Feb 2020 10:42:19 +0200 Subject: [PATCH 290/713] [nvim] add dash to keyword characters in CSS and its dialects --- nvim/ftplugin/css.vim | 1 + nvim/ftplugin/scss.vim | 1 + 2 files changed, 2 insertions(+) create mode 100644 nvim/ftplugin/css.vim create mode 100644 nvim/ftplugin/scss.vim diff --git a/nvim/ftplugin/css.vim b/nvim/ftplugin/css.vim new file mode 100644 index 0000000..df4fe48 --- /dev/null +++ b/nvim/ftplugin/css.vim @@ -0,0 +1 @@ +setlocal iskeyword+=- diff --git a/nvim/ftplugin/scss.vim b/nvim/ftplugin/scss.vim new file mode 100644 index 0000000..4144554 --- /dev/null +++ b/nvim/ftplugin/scss.vim @@ -0,0 +1 @@ +execute 'source' fnameescape(expand(':p:h').'/css.vim') From 73919c7b811bac351087c407867272f1b89f3c25 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 23 Feb 2020 14:45:46 +0200 Subject: [PATCH 291/713] [scripts] add onscreen-message.py --- nvim/plugin/editing.vim | 2 ++ scripts/onscreen-message.py | 45 +++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100755 scripts/onscreen-message.py diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index be109ed..df84744 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -188,4 +188,6 @@ set commentstring=//%s let g:vim_markdown_conceal_code_blocks = 0 let g:vim_markdown_no_default_key_mappings = 0 + let g:vala_syntax_folding_enabled = 0 + " }}} diff --git a/scripts/onscreen-message.py b/scripts/onscreen-message.py new file mode 100755 index 0000000..3ca6694 --- /dev/null +++ b/scripts/onscreen-message.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +import gi +import argparse + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, Gdk, Pango # noqa: E402 + + +parser = argparse.ArgumentParser() +parser.add_argument("message", type=str, nargs="+") +args = parser.parse_args() + +message = " ".join(args.message) + + +window = Gtk.ApplicationWindow() +window.set_keep_above(True) +window.set_decorated(False) +window.set_default_size(800, 100) + +scrolled_window = Gtk.ScrolledWindow() +label = Gtk.Label(label=message) +scrolled_window.add(label) +window.add(scrolled_window) + + +def on_key_release(target, event): + key = event.keyval + if key in [Gdk.KEY_Escape, Gdk.KEY_q, Gdk.KEY_Q]: + window.close() + + +def on_configure(target, event): + if target != window or event.type != Gdk.EventType.CONFIGURE: + return + font_desc = Pango.FontDescription() + font_desc.set_size(Pango.SCALE * event.height * 2 / 3) + label.override_font(font_desc) + + +window.connect("configure-event", on_configure) +window.connect("key-release-event", on_key_release) +window.show_all() +window.connect("destroy", Gtk.main_quit) +Gtk.main() From 9f2aeebb8a88a48153d1606ed39fadae9340537a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 23 Feb 2020 20:47:32 +0200 Subject: [PATCH 292/713] add my silly CrossCode mod I need on every one of my laptops --- crosscode/btw-i-use-arch-mod/package.json | 6 ++++++ crosscode/btw-i-use-arch-mod/prestart.js | 11 +++++++++++ 2 files changed, 17 insertions(+) create mode 100644 crosscode/btw-i-use-arch-mod/package.json create mode 100644 crosscode/btw-i-use-arch-mod/prestart.js diff --git a/crosscode/btw-i-use-arch-mod/package.json b/crosscode/btw-i-use-arch-mod/package.json new file mode 100644 index 0000000..77d9c76 --- /dev/null +++ b/crosscode/btw-i-use-arch-mod/package.json @@ -0,0 +1,6 @@ +{ + "name": "btw I use Arch", + "version": "0.0.0", + "description": "A mod for masochists like myself", + "prestart": "prestart.js" +} diff --git a/crosscode/btw-i-use-arch-mod/prestart.js b/crosscode/btw-i-use-arch-mod/prestart.js new file mode 100644 index 0000000..ad60383 --- /dev/null +++ b/crosscode/btw-i-use-arch-mod/prestart.js @@ -0,0 +1,11 @@ +ig.module('game.feature.masochist.keyboard-controls') + .requires('game.main') + .defines(() => { + sc.CrossCode.inject({ + init() { + this.parent(); + ig.input.bind(ig.KEY.J, 'aim'); + ig.input.bind(ig.KEY.K, 'dash'); + }, + }); + }); From 57d91218c9064f5d2e6bf487e4f627127a7e7bce Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 25 Feb 2020 00:25:20 +0200 Subject: [PATCH 293/713] [nvim] fix 'try' highlighting in TypeScript --- nvim/colors/dotfiles.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 7601232..bda5ebb 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -323,6 +323,7 @@ hi! link typescriptClassName jsClassDefinition hi! link typescriptClassHeritage jsClassDefinition hi! link typescriptExceptions jsException + hi! link typescriptTry typescriptExceptions " }}} " Markdown {{{ From b8ba43a5620a5d270153f4f1d233fda6c3110f8a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 7 Mar 2020 20:01:33 +0200 Subject: [PATCH 294/713] [nvim] tweak coc status in airline --- nvim/init.vim | 2 +- nvim/plugin/interface.vim | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nvim/init.vim b/nvim/init.vim index 12a6126..6371301 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -74,7 +74,7 @@ Plug 'junegunn/vim-plug' " Programming {{{ Plug 'sheerun/vim-polyglot' if g:vim_ide - Plug 'neoclide/coc.nvim', { 'do': 'yarn install' } + Plug 'neoclide/coc.nvim', { 'branch': 'release' } Plug 'dag/vim2hs' endif " }}} diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 8a1d3fc..0453216 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -101,14 +101,14 @@ endif let g:airline#extensions#branch#enabled = 1 let g:airline#extensions#tabline#enabled = 1 - let g:airline#extensions#coc#enabled = 1 + let g:airline#extensions#coc#enabled = 0 let g:airline#extensions#tabline#left_sep = ' ' let g:airline#extensions#tabline#left_alt_sep = '' let g:coc_status_error_sign = 'E:' let g:coc_status_warning_sign = 'W:' - call airline#parts#define_function('coc#status', 'coc#status') + call airline#parts#define('coc#status', { 'function': 'coc#status', 'accent': 'airline_term' }) function StatusLine_filesize() let l:bytes = getfsize(expand('%')) @@ -126,7 +126,7 @@ endif let l:factor = l:next_factor endfor endfunction - call airline#parts#define_function('filesize', 'StatusLine_filesize') + call airline#parts#define('filesize', { 'function': 'StatusLine_filesize' }) function s:airline_section_prepend(section, items) let g:airline_section_{a:section} = airline#section#create_right(a:items + ['']) . g:airline_section_{a:section} From f8e92066922197582a525f3442b699fd25a9c091 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 8 Mar 2020 02:49:27 +0200 Subject: [PATCH 295/713] [nvim] check for URLs in FormatOnSave --- nvim/plugin/files.vim | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nvim/plugin/files.vim b/nvim/plugin/files.vim index dc66d1b..7464f88 100644 --- a/nvim/plugin/files.vim +++ b/nvim/plugin/files.vim @@ -110,13 +110,16 @@ nnoremap &buftype is# '' ? ":writewall\" : "\" " on save (BufWritePre) {{{ + function s:IsUrl(str) + return a:str =~# '\v^\w+://' + endfunction + " create directory {{{ " Creates the parent directory of the file if it doesn't exist function s:CreateDirOnSave() - " is the filename of the buffer where the autocommand is executed let l:file = expand('') " check if this is a regular file and its path is not a URL - if empty(&buftype) && l:file !~# '\v^\w+://' + if empty(&buftype) && !s:IsUrl(l:file) let l:dir = fnamemodify(l:file, ':h') if !isdirectory(l:dir) | call mkdir(l:dir, 'p') | endif endif @@ -137,7 +140,8 @@ nnoremap &buftype is# '' ? ":writewall\" : "\" " auto-format with Coc.nvim {{{ let g:coc_format_on_save_ignore = [] function s:FormatOnSave() - if IsCocEnabled() && index(g:coc_format_on_save_ignore, &filetype) < 0 + let l:file = expand('') + if IsCocEnabled() && !s:IsUrl(l:file) && index(g:coc_format_on_save_ignore, &filetype) < 0 silent CocFormat endif endfunction From 1bca05325f9e542aa8bbea7f885350fd987cb6b1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 9 Mar 2020 18:22:03 +0200 Subject: [PATCH 296/713] [crosscode] re-export game execution context in btw-i-use-arch-mod --- crosscode/btw-i-use-arch-mod/package.json | 3 ++- crosscode/btw-i-use-arch-mod/preload.js | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 crosscode/btw-i-use-arch-mod/preload.js diff --git a/crosscode/btw-i-use-arch-mod/package.json b/crosscode/btw-i-use-arch-mod/package.json index 77d9c76..332d5cb 100644 --- a/crosscode/btw-i-use-arch-mod/package.json +++ b/crosscode/btw-i-use-arch-mod/package.json @@ -2,5 +2,6 @@ "name": "btw I use Arch", "version": "0.0.0", "description": "A mod for masochists like myself", - "prestart": "prestart.js" + "prestart": "prestart.js", + "preload": "preload.js" } diff --git a/crosscode/btw-i-use-arch-mod/preload.js b/crosscode/btw-i-use-arch-mod/preload.js new file mode 100644 index 0000000..0ff24fa --- /dev/null +++ b/crosscode/btw-i-use-arch-mod/preload.js @@ -0,0 +1,6 @@ +// I know that this is legacy feature provided by CCLoader way back when mods +// weren't executed inside the game iframe's context, but it is useful +// nevertheless because console in Chrome's devtools automatically selects +// window.top as the execution context by default, so writing `cc.` is faster +// than `modloader.frame.contentWindow` +window.top.cc = window; From 43959c4f9bcc328e51c8ba061c916a41484d8dea Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 10 Mar 2020 22:39:12 +0200 Subject: [PATCH 297/713] [nvim] fix filetype preferences for indentation --- nvim/{ => after}/ftplugin/asm.vim | 0 nvim/{ => after}/ftplugin/css.vim | 0 nvim/after/ftplugin/make.vim | 1 + nvim/{ => after}/ftplugin/markdown.vim | 0 nvim/{ => after}/ftplugin/python.vim | 0 nvim/{ => after}/ftplugin/scss.vim | 0 nvim/{ => after}/ftplugin/text.vim | 0 nvim/plugin/editing.vim | 11 +++++++---- nvim/plugin/files.vim | 2 +- 9 files changed, 9 insertions(+), 5 deletions(-) rename nvim/{ => after}/ftplugin/asm.vim (100%) rename nvim/{ => after}/ftplugin/css.vim (100%) create mode 100644 nvim/after/ftplugin/make.vim rename nvim/{ => after}/ftplugin/markdown.vim (100%) rename nvim/{ => after}/ftplugin/python.vim (100%) rename nvim/{ => after}/ftplugin/scss.vim (100%) rename nvim/{ => after}/ftplugin/text.vim (100%) diff --git a/nvim/ftplugin/asm.vim b/nvim/after/ftplugin/asm.vim similarity index 100% rename from nvim/ftplugin/asm.vim rename to nvim/after/ftplugin/asm.vim diff --git a/nvim/ftplugin/css.vim b/nvim/after/ftplugin/css.vim similarity index 100% rename from nvim/ftplugin/css.vim rename to nvim/after/ftplugin/css.vim diff --git a/nvim/after/ftplugin/make.vim b/nvim/after/ftplugin/make.vim new file mode 100644 index 0000000..b3d732f --- /dev/null +++ b/nvim/after/ftplugin/make.vim @@ -0,0 +1 @@ +IndentTabs 2 diff --git a/nvim/ftplugin/markdown.vim b/nvim/after/ftplugin/markdown.vim similarity index 100% rename from nvim/ftplugin/markdown.vim rename to nvim/after/ftplugin/markdown.vim diff --git a/nvim/ftplugin/python.vim b/nvim/after/ftplugin/python.vim similarity index 100% rename from nvim/ftplugin/python.vim rename to nvim/after/ftplugin/python.vim diff --git a/nvim/ftplugin/scss.vim b/nvim/after/ftplugin/scss.vim similarity index 100% rename from nvim/ftplugin/scss.vim rename to nvim/after/ftplugin/scss.vim diff --git a/nvim/ftplugin/text.vim b/nvim/after/ftplugin/text.vim similarity index 100% rename from nvim/ftplugin/text.vim rename to nvim/after/ftplugin/text.vim diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index df84744..35ee2af 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -31,13 +31,16 @@ set commentstring=//%s let g:indentLine_showFirstIndentLevel = 1 let g:indentLine_fileTypeExclude = ['text', 'help', 'tutor', 'man'] - let g:detectindent_preferred_indent = 2 - let g:detectindent_preferred_expandtab = 1 - " let g:detectindent_verbosity = 0 + function s:DetectIndent() + if !empty(&bt) | return | endif + let g:detectindent_preferred_indent = &l:shiftwidth + let g:detectindent_preferred_expandtab = &l:expandtab + DetectIndent + endfunction augroup vimrc-detect-indent autocmd! - autocmd FileType * if empty(&bt) | DetectIndent | endif + autocmd BufReadPost * call s:DetectIndent() augroup END " }}} diff --git a/nvim/plugin/files.vim b/nvim/plugin/files.vim index 7464f88..1daaf62 100644 --- a/nvim/plugin/files.vim +++ b/nvim/plugin/files.vim @@ -4,7 +4,7 @@ set fileformats=unix,dos,mac set wildignore+=.git,.svn,.hg,.DS_Store,*~ " arguably one of the most useful mappings -nnoremap &buftype is# '' ? ":writewall\" : "\" +nnoremap empty(&buftype) ? ":writewall\" : "\" " ripgrep (rg) {{{ From af65399b1e0b28debe6d5d5519447330149dcd67 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 14 Mar 2020 16:18:59 +0000 Subject: [PATCH 298/713] Bump acorn from 7.1.0 to 7.1.1 in /script-resources/markdown2htmldoc Bumps [acorn](https://github.com/acornjs/acorn) from 7.1.0 to 7.1.1. - [Release notes](https://github.com/acornjs/acorn/releases) - [Commits](https://github.com/acornjs/acorn/compare/7.1.0...7.1.1) Signed-off-by: dependabot[bot] --- script-resources/markdown2htmldoc/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script-resources/markdown2htmldoc/yarn.lock b/script-resources/markdown2htmldoc/yarn.lock index 08a1c41..7747ae2 100644 --- a/script-resources/markdown2htmldoc/yarn.lock +++ b/script-resources/markdown2htmldoc/yarn.lock @@ -95,9 +95,9 @@ acorn-jsx@^5.1.0: integrity sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw== acorn@^7.1.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c" - integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ== + version "7.1.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.1.tgz#e35668de0b402f359de515c5482a1ab9f89a69bf" + integrity sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg== ajv@^6.10.0, ajv@^6.10.2: version "6.10.2" From 49a01a09dc95e24bcde2de19a5a116293bcaf061 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 15 Mar 2020 09:53:04 +0200 Subject: [PATCH 299/713] [scripts] upgrade dependencies of markdown2htmldoc --- script-resources/markdown2htmldoc/yarn.lock | 351 ++++++++++++-------- 1 file changed, 204 insertions(+), 147 deletions(-) diff --git a/script-resources/markdown2htmldoc/yarn.lock b/script-resources/markdown2htmldoc/yarn.lock index 7747ae2..e81c6f9 100644 --- a/script-resources/markdown2htmldoc/yarn.lock +++ b/script-resources/markdown2htmldoc/yarn.lock @@ -2,119 +2,124 @@ # yarn lockfile v1 -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d" - integrity sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw== +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.8.3.tgz#33e25903d7481181534e12ec0a25f16b6fcf419e" + integrity sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g== dependencies: - "@babel/highlight" "^7.0.0" + "@babel/highlight" "^7.8.3" -"@babel/generator@^7.7.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.4.tgz#db651e2840ca9aa66f327dcec1dc5f5fa9611369" - integrity sha512-m5qo2WgdOJeyYngKImbkyQrnUN1mPceaG5BV+G0E3gWsa4l/jCSryWJdM2x8OuGAOyh+3d5pVYfZWCiNFtynxg== +"@babel/generator@^7.8.6": + version "7.8.8" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.8.8.tgz#cdcd58caab730834cee9eeadb729e833b625da3e" + integrity sha512-HKyUVu69cZoclptr8t8U5b6sx6zoWjh8jiUhnuj3MpZuKT2dJ8zPTuiy31luq32swhI0SpwItCIlU8XW7BZeJg== dependencies: - "@babel/types" "^7.7.4" + "@babel/types" "^7.8.7" jsesc "^2.5.1" lodash "^4.17.13" source-map "^0.5.0" -"@babel/helper-function-name@^7.7.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.7.4.tgz#ab6e041e7135d436d8f0a3eca15de5b67a341a2e" - integrity sha512-AnkGIdiBhEuiwdoMnKm7jfPfqItZhgRaZfMg1XX3bS25INOnLPjPG1Ppnajh8eqgt5kPJnfqrRHqFqmjKDZLzQ== +"@babel/helper-function-name@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz#eeeb665a01b1f11068e9fb86ad56a1cb1a824cca" + integrity sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA== dependencies: - "@babel/helper-get-function-arity" "^7.7.4" - "@babel/template" "^7.7.4" - "@babel/types" "^7.7.4" + "@babel/helper-get-function-arity" "^7.8.3" + "@babel/template" "^7.8.3" + "@babel/types" "^7.8.3" -"@babel/helper-get-function-arity@^7.7.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz#cb46348d2f8808e632f0ab048172130e636005f0" - integrity sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA== +"@babel/helper-get-function-arity@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz#b894b947bd004381ce63ea1db9f08547e920abd5" + integrity sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA== dependencies: - "@babel/types" "^7.7.4" + "@babel/types" "^7.8.3" -"@babel/helper-split-export-declaration@^7.7.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.4.tgz#57292af60443c4a3622cf74040ddc28e68336fd8" - integrity sha512-guAg1SXFcVr04Guk9eq0S4/rWS++sbmyqosJzVs8+1fH5NI+ZcmkaSkc7dmtAFbHFva6yRJnjW3yAcGxjueDug== +"@babel/helper-split-export-declaration@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz#31a9f30070f91368a7182cf05f831781065fc7a9" + integrity sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA== dependencies: - "@babel/types" "^7.7.4" + "@babel/types" "^7.8.3" -"@babel/highlight@^7.0.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.5.0.tgz#56d11312bd9248fa619591d02472be6e8cb32540" - integrity sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ== +"@babel/highlight@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.8.3.tgz#28f173d04223eaaa59bc1d439a3836e6d1265797" + integrity sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg== dependencies: chalk "^2.0.0" esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@^7.0.0", "@babel/parser@^7.7.4": - version "7.7.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.5.tgz#cbf45321619ac12d83363fcf9c94bb67fa646d71" - integrity sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig== +"@babel/parser@^7.7.0", "@babel/parser@^7.8.6": + version "7.8.8" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.8.tgz#4c3b7ce36db37e0629be1f0d50a571d2f86f6cd4" + integrity sha512-mO5GWzBPsPf6865iIbzNE0AvkKF3NE+2S3eRUpE+FE07BOAkXh6G+GW/Pj01hhXjve1WScbaIO4UlY1JKeqCcA== -"@babel/template@^7.7.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.7.4.tgz#428a7d9eecffe27deac0a98e23bf8e3675d2a77b" - integrity sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw== +"@babel/template@^7.8.3": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.8.6.tgz#86b22af15f828dfb086474f964dcc3e39c43ce2b" + integrity sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg== dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.7.4" - "@babel/types" "^7.7.4" + "@babel/code-frame" "^7.8.3" + "@babel/parser" "^7.8.6" + "@babel/types" "^7.8.6" -"@babel/traverse@^7.0.0": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.7.4.tgz#9c1e7c60fb679fe4fcfaa42500833333c2058558" - integrity sha512-P1L58hQyupn8+ezVA2z5KBm4/Zr4lCC8dwKCMYzsa5jFMDMQAzaBNy9W5VjB+KAmBjb40U7a/H6ao+Xo+9saIw== +"@babel/traverse@^7.7.0": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.8.6.tgz#acfe0c64e1cd991b3e32eae813a6eb564954b5ff" + integrity sha512-2B8l0db/DPi8iinITKuo7cbPznLCEk0kCxDoB9/N6gGNg/gxOXiR/IcymAFPiBwk5w6TtQ27w4wpElgp9btR9A== dependencies: - "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.7.4" - "@babel/helper-function-name" "^7.7.4" - "@babel/helper-split-export-declaration" "^7.7.4" - "@babel/parser" "^7.7.4" - "@babel/types" "^7.7.4" + "@babel/code-frame" "^7.8.3" + "@babel/generator" "^7.8.6" + "@babel/helper-function-name" "^7.8.3" + "@babel/helper-split-export-declaration" "^7.8.3" + "@babel/parser" "^7.8.6" + "@babel/types" "^7.8.6" debug "^4.1.0" globals "^11.1.0" lodash "^4.17.13" -"@babel/types@^7.0.0", "@babel/types@^7.7.4": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.7.4.tgz#516570d539e44ddf308c07569c258ff94fde9193" - integrity sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA== +"@babel/types@^7.7.0", "@babel/types@^7.8.3", "@babel/types@^7.8.6", "@babel/types@^7.8.7": + version "7.8.7" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.8.7.tgz#1fc9729e1acbb2337d5b6977a63979b4819f5d1d" + integrity sha512-k2TreEHxFA4CjGkL+GYjRyx35W0Mr7DP5+9q6WMkyKXB+904bYmG40syjMFV0oLlhhFCwWl0vA0DyzTDkwAiJw== dependencies: esutils "^2.0.2" lodash "^4.17.13" to-fast-properties "^2.0.0" -acorn-jsx@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.1.0.tgz#294adb71b57398b0680015f0a38c563ee1db5384" - integrity sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw== +"@types/color-name@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" + integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ== -acorn@^7.1.0: +acorn-jsx@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.2.0.tgz#4c66069173d6fdd68ed85239fc256226182b2ebe" + integrity sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ== + +acorn@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.1.tgz#e35668de0b402f359de515c5482a1ab9f89a69bf" integrity sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg== ajv@^6.10.0, ajv@^6.10.2: - version "6.10.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" - integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== + version "6.12.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.0.tgz#06d60b96d87b8454a5adaba86e7854da629db4b7" + integrity sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw== dependencies: - fast-deep-equal "^2.0.1" + fast-deep-equal "^3.1.1" fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.4.1" uri-js "^4.2.2" ansi-escapes@^4.2.1: - version "4.3.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.0.tgz#a4ce2b33d6b214b7950d8595c212f12ac9cc569d" - integrity sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg== + version "4.3.1" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.1.tgz#a5c47cc43181f1f38ffd7076837700d395522a61" + integrity sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA== dependencies: - type-fest "^0.8.1" + type-fest "^0.11.0" ansi-regex@^4.1.0: version "4.1.0" @@ -133,6 +138,14 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" +ansi-styles@^4.1.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" + integrity sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA== + dependencies: + "@types/color-name" "^1.1.1" + color-convert "^2.0.1" + argparse@^1.0.10, argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -146,14 +159,14 @@ astral-regex@^1.0.0: integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== babel-eslint@*: - version "10.0.3" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.3.tgz#81a2c669be0f205e19462fed2482d33e4687a88a" - integrity sha512-z3U7eMY6r/3f3/JB9mTsLjyxrv0Yb1zb8PCWCLpguxfCzBIZUwy23R1t/XKewP+8mEN2Ck8Dtr4q20z6ce6SoA== + version "10.1.0" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.1.0.tgz#6968e568a910b78fb3779cdd8b6ac2f479943232" + integrity sha512-ifWaTHQ0ce+448CYop8AdrQiBsGrnC+bMgfyKFdi6EsPLTAWG+QfyDeM6OH+FmWnKvEq5NnBMLvlBUPKQZoDSg== dependencies: "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.0.0" - "@babel/traverse" "^7.0.0" - "@babel/types" "^7.0.0" + "@babel/parser" "^7.7.0" + "@babel/traverse" "^7.7.0" + "@babel/types" "^7.7.0" eslint-visitor-keys "^1.0.0" resolve "^1.12.0" @@ -175,7 +188,7 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -chalk@^2.0.0, chalk@^2.1.0, chalk@^2.4.2: +chalk@^2.0.0, chalk@^2.1.0: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -184,6 +197,14 @@ chalk@^2.0.0, chalk@^2.1.0, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chalk@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" + integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + chardet@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" @@ -202,9 +223,9 @@ cli-width@^2.0.0: integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= clipboard@^2.0.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.4.tgz#836dafd66cf0fea5d71ce5d5b0bf6e958009112d" - integrity sha512-Vw26VSLRpJfBofiVaFb/I8PVfdI1OxKcYShe6fm0sP/DtmiWQNCjhM/okTvdCo0G+lMMm1rMYbk4IK4x1X+kgQ== + version "2.0.6" + resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.6.tgz#52921296eec0fdf77ead1749421b21c968647376" + integrity sha512-g5zbiixBRk/wyKakSwCKd7vQXDjFnAMGHoEyBogG/bw9kTD9GvdAvaoRR1ALcEzt3pVKxZR0pViekPMIS0QyGg== dependencies: good-listener "^1.2.2" select "^1.1.2" @@ -217,11 +238,23 @@ color-convert@^1.9.0: dependencies: color-name "1.1.3" +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -299,36 +332,36 @@ eslint-config-dmitmel@dmitmel/eslint-config-dmitmel: eslint-plugin-node "*" eslint-config-prettier@*: - version "6.7.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.7.0.tgz#9a876952e12df2b284adbd3440994bf1f39dfbb9" - integrity sha512-FamQVKM3jjUVwhG4hEMnbtsq7xOIDm+SY5iBPfR8gKsJoAB2IQnNF+bk1+8Fy44Nq7PPJaLvkRxILYdJWoguKQ== + version "6.10.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.10.0.tgz#7b15e303bf9c956875c948f6b21500e48ded6a7f" + integrity sha512-AtndijGte1rPILInUdHjvKEGbIV06NuvPrqlIEaEaWtbtvJh464mDeyGMdZEQMsGvC0ZVkiex1fSNcC4HAbRGg== dependencies: get-stdin "^6.0.0" -eslint-plugin-es@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-es/-/eslint-plugin-es-2.0.0.tgz#0f5f5da5f18aa21989feebe8a73eadefb3432976" - integrity sha512-f6fceVtg27BR02EYnBhgWLFQfK6bN4Ll0nQFrBHOlCsAyxeZkn0NHns5O0YZOPrV1B3ramd6cgFwaoFLcSkwEQ== +eslint-plugin-es@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-es/-/eslint-plugin-es-3.0.0.tgz#98cb1bc8ab0aa807977855e11ad9d1c9422d014b" + integrity sha512-6/Jb/J/ZvSebydwbBJO1R9E5ky7YeElfK56Veh7e4QGFHCXoIXGH9HhVz+ibJLM3XJ1XjP+T7rKBLUa/Y7eIng== dependencies: - eslint-utils "^1.4.2" + eslint-utils "^2.0.0" regexpp "^3.0.0" eslint-plugin-node@*: - version "10.0.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-10.0.0.tgz#fd1adbc7a300cf7eb6ac55cf4b0b6fc6e577f5a6" - integrity sha512-1CSyM/QCjs6PXaT18+zuAXsjXGIGo5Rw630rSKwokSs2jrYURQc4R5JZpoanNCqwNmepg+0eZ9L7YiRUJb8jiQ== + version "11.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-11.0.0.tgz#365944bb0804c5d1d501182a9bc41a0ffefed726" + integrity sha512-chUs/NVID+sknFiJzxoN9lM7uKSOEta8GC8365hw1nDfwIPIjjpRSwwPvQanWv8dt/pDe9EV4anmVSwdiSndNg== dependencies: - eslint-plugin-es "^2.0.0" - eslint-utils "^1.4.2" + eslint-plugin-es "^3.0.0" + eslint-utils "^2.0.0" ignore "^5.1.1" minimatch "^3.0.4" resolve "^1.10.1" semver "^6.1.0" eslint-plugin-prettier@*: - version "3.1.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.1.tgz#507b8562410d02a03f0ddc949c616f877852f2ba" - integrity sha512-A+TZuHZ0KU0cnn56/9mfR7/KjUJ9QNVXUhwvRFSR7PGPe0zQR6PTkmyqg1AtUUEOzTqeRsUwyKFh0oVZKVCrtA== + version "3.1.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.2.tgz#432e5a667666ab84ce72f945c72f77d996a5c9ba" + integrity sha512-GlolCC9y3XZfv3RQfwGew7NnuFDKsfI4lbvRK+PIIo23SFH+LemGs4cKwzAaRa+Mdb+lQO/STaIayno8T5sJJA== dependencies: prettier-linter-helpers "^1.0.0" @@ -340,22 +373,29 @@ eslint-scope@^5.0.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-utils@^1.4.2, eslint-utils@^1.4.3: +eslint-utils@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f" integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q== dependencies: eslint-visitor-keys "^1.1.0" +eslint-utils@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.0.0.tgz#7be1cc70f27a72a76cd14aa698bcabed6890e1cd" + integrity sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA== + dependencies: + eslint-visitor-keys "^1.1.0" + eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== eslint@*: - version "6.7.2" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.7.2.tgz#c17707ca4ad7b2d8af986a33feba71e18a9fecd1" - integrity sha512-qMlSWJaCSxDFr8fBPvJM9kJwbazrhNcBU3+DszDW1OlEwKBBRWsJc7NJFelvwQpanHCR14cOLD41x8Eqvo3Nng== + version "6.8.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb" + integrity sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig== dependencies: "@babel/code-frame" "^7.0.0" ajv "^6.10.0" @@ -396,12 +436,12 @@ eslint@*: v8-compile-cache "^2.0.3" espree@^6.1.2: - version "6.1.2" - resolved "https://registry.yarnpkg.com/espree/-/espree-6.1.2.tgz#6c272650932b4f91c3714e5e7b5f5e2ecf47262d" - integrity sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA== + version "6.2.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-6.2.1.tgz#77fc72e1fd744a2052c20f38a5b575832e82734a" + integrity sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw== dependencies: - acorn "^7.1.0" - acorn-jsx "^5.1.0" + acorn "^7.1.1" + acorn-jsx "^5.2.0" eslint-visitor-keys "^1.1.0" esprima@^4.0.0: @@ -410,9 +450,9 @@ esprima@^4.0.0: integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== esquery@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" - integrity sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA== + version "1.1.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.1.0.tgz#c5c0b66f383e7656404f86b31334d72524eddb48" + integrity sha512-MxYW9xKmROWF672KqjO75sszsA8Mxhw06YFeS5VHlB98KDHbOSurm3ArsjO60Eaf3QmGMCP1yn+0JQkNLo/97Q== dependencies: estraverse "^4.0.0" @@ -442,10 +482,10 @@ external-editor@^3.0.3: iconv-lite "^0.4.24" tmp "^0.0.33" -fast-deep-equal@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" - integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= +fast-deep-equal@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4" + integrity sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA== fast-diff@^1.1.2: version "1.2.0" @@ -453,9 +493,9 @@ fast-diff@^1.1.2: integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== fast-json-stable-stringify@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" - integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== fast-levenshtein@~2.0.6: version "2.0.6" @@ -463,9 +503,9 @@ fast-levenshtein@~2.0.6: integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= figures@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-3.1.0.tgz#4b198dd07d8d71530642864af2d45dd9e459c4ec" - integrity sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg== + version "3.2.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" + integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== dependencies: escape-string-regexp "^1.0.5" @@ -506,9 +546,9 @@ get-stdin@^6.0.0: integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== github-slugger@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/github-slugger/-/github-slugger-1.2.1.tgz#47e904e70bf2dccd0014748142d31126cfd49508" - integrity sha512-SsZUjg/P03KPzQBt7OxJPasGw6NRO5uOgiZ5RGXVud5iSIZ0eNZeNp5rTwCxtavrRUa/A77j8mePVc5lEvk0KQ== + version "1.3.0" + resolved "https://registry.yarnpkg.com/github-slugger/-/github-slugger-1.3.0.tgz#9bd0a95c5efdfc46005e82a906ef8e2a059124c9" + integrity sha512-gwJScWVNhFYSRDvURk/8yhcFBee6aFjye2a7Lhb2bUyRulpIoek9p0I9Kt7PT67d/nUlZbFu8L9RLiA0woQN8Q== dependencies: emoji-regex ">=6.0.0 <=6.1.1" @@ -537,9 +577,9 @@ globals@^11.1.0: integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== globals@^12.1.0: - version "12.3.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-12.3.0.tgz#1e564ee5c4dded2ab098b0f88f24702a3c56be13" - integrity sha512-wAfjdLgFsPZsklLJvOBUBmzYE8/CwhEqSBEMRXA3qxIiNtyqvjYurAtIfDh6chlEPUfmTY3MnZh5Hfh4q0UlIw== + version "12.4.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8" + integrity sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg== dependencies: type-fest "^0.8.1" @@ -555,6 +595,11 @@ has-flag@^3.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" @@ -599,22 +644,22 @@ inherits@2: integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== inquirer@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.0.0.tgz#9e2b032dde77da1db5db804758b8fea3a970519a" - integrity sha512-rSdC7zelHdRQFkWnhsMu2+2SO41mpv2oF2zy4tMhmiLWkcKbOAs87fWAJhVXttKVwhdZvymvnuM95EyEXg2/tQ== + version "7.1.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.1.0.tgz#1298a01859883e17c7264b82870ae1034f92dd29" + integrity sha512-5fJMWEmikSYu0nv/flMc475MhGbB7TSPd/2IpFV4I4rMklboCH2rQjYY5kKiYGHqUF9gvaambupcJFFG9dvReg== dependencies: ansi-escapes "^4.2.1" - chalk "^2.4.2" + chalk "^3.0.0" cli-cursor "^3.1.0" cli-width "^2.0.0" external-editor "^3.0.3" figures "^3.0.0" lodash "^4.17.15" mute-stream "0.0.8" - run-async "^2.2.0" - rxjs "^6.4.0" + run-async "^2.4.0" + rxjs "^6.5.3" string-width "^4.1.0" - strip-ansi "^5.1.0" + strip-ansi "^6.0.0" through "^2.3.6" is-extglob@^2.1.1: @@ -838,9 +883,9 @@ prettier@*: integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== prismjs@^1.17.1: - version "1.17.1" - resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.17.1.tgz#e669fcbd4cdd873c35102881c33b14d0d68519be" - integrity sha512-PrEDJAFdUGbOP6xK/UsfkC5ghJsPJviKgnQOoxaDbBjwc8op68Quupwt1DeAFoG8GImPhiKXAvvsH7wDSLsu1Q== + version "1.19.0" + resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.19.0.tgz#713afbd45c3baca4b321569f2df39e17e729d4dc" + integrity sha512-IVFtbW9mCWm9eOIaEkNyo2Vl4NnEifis2GQ7/MLRG5TQe6t+4Sj9J5QWI9i3v+SS43uZBlCAOn+zYTVYQcPXJw== optionalDependencies: clipboard "^2.0.0" @@ -870,9 +915,9 @@ resolve-from@^4.0.0: integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== resolve@^1.10.1, resolve@^1.12.0: - version "1.13.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.13.1.tgz#be0aa4c06acd53083505abb35f4d66932ab35d16" - integrity sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w== + version "1.15.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8" + integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w== dependencies: path-parse "^1.0.6" @@ -891,17 +936,17 @@ rimraf@2.6.3: dependencies: glob "^7.1.3" -run-async@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" - integrity sha1-A3GrSuC91yDUFm19/aZP96RFpsA= +run-async@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.0.tgz#e59054a5b86876cfae07f431d18cbaddc594f1e8" + integrity sha512-xJTbh/d7Lm7SBhc1tNvTpeCHaEzoyxPrqNlvSdMfBTYwaY++UJFyXUOxAtsRUXjlqOfj8luNaR9vjCh4KeV+pg== dependencies: is-promise "^2.1.0" -rxjs@^6.4.0: - version "6.5.3" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.3.tgz#510e26317f4db91a7eb1de77d9dd9ba0a4899a3a" - integrity sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA== +rxjs@^6.5.3: + version "6.5.4" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.4.tgz#e0777fe0d184cec7872df147f303572d414e211c" + integrity sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q== dependencies: tslib "^1.9.0" @@ -1005,6 +1050,13 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" +supports-color@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1" + integrity sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g== + dependencies: + has-flag "^4.0.0" + table@^5.2.3: version "5.4.6" resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" @@ -1043,9 +1095,9 @@ to-fast-properties@^2.0.0: integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= tslib@^1.9.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" - integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== + version "1.11.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35" + integrity sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA== type-check@~0.3.2: version "0.3.2" @@ -1054,6 +1106,11 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" +type-fest@^0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.11.0.tgz#97abf0872310fed88a5c466b25681576145e33f1" + integrity sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ== + type-fest@^0.8.1: version "0.8.1" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" From d7e9f0b72e9dea214ed845a5deef135b4aca014f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 25 Mar 2020 21:42:25 +0200 Subject: [PATCH 300/713] [kitty] change tab_bar_style to powerline --- kitty/kitty.conf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kitty/kitty.conf b/kitty/kitty.conf index 33f9b5e..9145472 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -311,7 +311,10 @@ tab_bar_edge top #: The margin to the left and right of the tab bar (in pts) -tab_bar_style separator +# TODO: change this to "separator" if maintainer of kitty agrees with me. +# see https://github.com/kovidgoyal/kitty/pull/2480 +# fortunately, kitty seems to have built-in powerline character support +tab_bar_style powerline #: The tab bar style, can be one of: fade or separator. In the fade #: style, each tab's edges fade into the background color, in the @@ -340,6 +343,8 @@ active_tab_font_style bold # inactive_tab_background #999 inactive_tab_font_style italic +tab_bar_background #999 + #: Tab bar colors and styles #: }}} From 63357c339468c5efa699ccc51afd362ba0bd4d63 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 25 Mar 2020 21:42:39 +0200 Subject: [PATCH 301/713] [nvim] enable eslint for typescript --- nvim/coc-languages/javascript.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nvim/coc-languages/javascript.vim b/nvim/coc-languages/javascript.vim index f5c88e9..e6b8c5a 100644 --- a/nvim/coc-languages/javascript.vim +++ b/nvim/coc-languages/javascript.vim @@ -1,7 +1,8 @@ let g:coc_global_extensions += ['coc-tsserver', 'coc-eslint', 'coc-prettier'] -let g:coc_filetypes += ['javascript', 'javascript.jsx', 'typescript', 'typescript.jsx'] +let s:filetypes = ['javascript', 'javascriptreact', 'typescript', 'typescriptreact'] +let g:coc_filetypes += s:filetypes let g:coc_user_config['eslint'] = { -\ 'filetypes': ['javascript', 'javascriptreact'], +\ 'filetypes': s:filetypes, \ 'autoFixOnSave': v:true, \ } let g:coc_user_config['prettier'] = { From ce7f8a30b9802497a69f13f2a231d7cdf9e7df7b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 25 Mar 2020 21:43:27 +0200 Subject: [PATCH 302/713] [nvim] use default coc.nvim plugin for airline --- nvim/plugin/interface.vim | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 0453216..d6817f2 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -101,15 +101,11 @@ endif let g:airline#extensions#branch#enabled = 1 let g:airline#extensions#tabline#enabled = 1 - let g:airline#extensions#coc#enabled = 0 + let g:airline#extensions#coc#enabled = 1 let g:airline#extensions#tabline#left_sep = ' ' let g:airline#extensions#tabline#left_alt_sep = '' - let g:coc_status_error_sign = 'E:' - let g:coc_status_warning_sign = 'W:' - call airline#parts#define('coc#status', { 'function': 'coc#status', 'accent': 'airline_term' }) - function StatusLine_filesize() let l:bytes = getfsize(expand('%')) if l:bytes < 0 | return '' | endif @@ -135,9 +131,6 @@ endif let g:airline_section_{a:section} = g:airline_section_{a:section} . airline#section#create_left([''] + a:items) endfunction function s:tweak_airline() - if g:vim_ide - call s:airline_section_prepend('x', ['coc#status']) - endif call s:airline_section_append('y', ['filesize']) endfunction augroup vimrc-interface-airline From e55381e59649549483bd3f801ced058cb17e8dfd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 6 Apr 2020 10:05:19 +0300 Subject: [PATCH 303/713] [scripts] upgrade dependencies of markdown2htmldoc --- script-resources/markdown2htmldoc/.yarnrc | 1 + script-resources/markdown2htmldoc/yarn.lock | 140 +++++++++++--------- 2 files changed, 76 insertions(+), 65 deletions(-) create mode 100644 script-resources/markdown2htmldoc/.yarnrc diff --git a/script-resources/markdown2htmldoc/.yarnrc b/script-resources/markdown2htmldoc/.yarnrc new file mode 100644 index 0000000..49e884c --- /dev/null +++ b/script-resources/markdown2htmldoc/.yarnrc @@ -0,0 +1 @@ +ignore-optional true diff --git a/script-resources/markdown2htmldoc/yarn.lock b/script-resources/markdown2htmldoc/yarn.lock index e81c6f9..d3627d4 100644 --- a/script-resources/markdown2htmldoc/yarn.lock +++ b/script-resources/markdown2htmldoc/yarn.lock @@ -9,12 +9,12 @@ dependencies: "@babel/highlight" "^7.8.3" -"@babel/generator@^7.8.6": - version "7.8.8" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.8.8.tgz#cdcd58caab730834cee9eeadb729e833b625da3e" - integrity sha512-HKyUVu69cZoclptr8t8U5b6sx6zoWjh8jiUhnuj3MpZuKT2dJ8zPTuiy31luq32swhI0SpwItCIlU8XW7BZeJg== +"@babel/generator@^7.9.0": + version "7.9.4" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.9.4.tgz#12441e90c3b3c4159cdecf312075bf1a8ce2dbce" + integrity sha512-rjP8ahaDy/ouhrvCoU1E5mqaitWrxwuNGU+dy1EpaoK48jZay4MdkskKGIMHLZNewg8sAsqpGSREJwP0zH3YQA== dependencies: - "@babel/types" "^7.8.7" + "@babel/types" "^7.9.0" jsesc "^2.5.1" lodash "^4.17.13" source-map "^0.5.0" @@ -42,19 +42,24 @@ dependencies: "@babel/types" "^7.8.3" +"@babel/helper-validator-identifier@^7.9.0": + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.0.tgz#ad53562a7fc29b3b9a91bbf7d10397fd146346ed" + integrity sha512-6G8bQKjOh+of4PV/ThDm/rRqlU7+IGoJuofpagU5GlEl29Vv0RGqqt86ZGRV8ZuSOY3o+8yXl5y782SMcG7SHw== + "@babel/highlight@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.8.3.tgz#28f173d04223eaaa59bc1d439a3836e6d1265797" - integrity sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg== + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.9.0.tgz#4e9b45ccb82b79607271b2979ad82c7b68163079" + integrity sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ== dependencies: + "@babel/helper-validator-identifier" "^7.9.0" chalk "^2.0.0" - esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@^7.7.0", "@babel/parser@^7.8.6": - version "7.8.8" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.8.tgz#4c3b7ce36db37e0629be1f0d50a571d2f86f6cd4" - integrity sha512-mO5GWzBPsPf6865iIbzNE0AvkKF3NE+2S3eRUpE+FE07BOAkXh6G+GW/Pj01hhXjve1WScbaIO4UlY1JKeqCcA== +"@babel/parser@^7.7.0", "@babel/parser@^7.8.6", "@babel/parser@^7.9.0": + version "7.9.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.9.4.tgz#68a35e6b0319bbc014465be43828300113f2f2e8" + integrity sha512-bC49otXX6N0/VYhgOMh4gnP26E9xnDZK3TmbNpxYzzz9BQLBosQwfyOe9/cXUU3txYhTzLCbcqd5c8y/OmCjHA== "@babel/template@^7.8.3": version "7.8.6" @@ -66,26 +71,26 @@ "@babel/types" "^7.8.6" "@babel/traverse@^7.7.0": - version "7.8.6" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.8.6.tgz#acfe0c64e1cd991b3e32eae813a6eb564954b5ff" - integrity sha512-2B8l0db/DPi8iinITKuo7cbPznLCEk0kCxDoB9/N6gGNg/gxOXiR/IcymAFPiBwk5w6TtQ27w4wpElgp9btR9A== + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.9.0.tgz#d3882c2830e513f4fe4cec9fe76ea1cc78747892" + integrity sha512-jAZQj0+kn4WTHO5dUZkZKhbFrqZE7K5LAQ5JysMnmvGij+wOdr+8lWqPeW0BcF4wFwrEXXtdGO7wcV6YPJcf3w== dependencies: "@babel/code-frame" "^7.8.3" - "@babel/generator" "^7.8.6" + "@babel/generator" "^7.9.0" "@babel/helper-function-name" "^7.8.3" "@babel/helper-split-export-declaration" "^7.8.3" - "@babel/parser" "^7.8.6" - "@babel/types" "^7.8.6" + "@babel/parser" "^7.9.0" + "@babel/types" "^7.9.0" debug "^4.1.0" globals "^11.1.0" lodash "^4.17.13" -"@babel/types@^7.7.0", "@babel/types@^7.8.3", "@babel/types@^7.8.6", "@babel/types@^7.8.7": - version "7.8.7" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.8.7.tgz#1fc9729e1acbb2337d5b6977a63979b4819f5d1d" - integrity sha512-k2TreEHxFA4CjGkL+GYjRyx35W0Mr7DP5+9q6WMkyKXB+904bYmG40syjMFV0oLlhhFCwWl0vA0DyzTDkwAiJw== +"@babel/types@^7.7.0", "@babel/types@^7.8.3", "@babel/types@^7.8.6", "@babel/types@^7.9.0": + version "7.9.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.9.0.tgz#00b064c3df83ad32b2dbf5ff07312b15c7f1efb5" + integrity sha512-BS9JKfXkzzJl8RluW4JGknzpiUV7ZrvTayM6yfqLTVBEnFtyowVIOu6rqxRd5cVO6yGoWf4T8u8dgK9oB+GCng== dependencies: - esutils "^2.0.2" + "@babel/helper-validator-identifier" "^7.9.0" lodash "^4.17.13" to-fast-properties "^2.0.0" @@ -322,7 +327,7 @@ escape-string-regexp@^1.0.5: eslint-config-dmitmel@dmitmel/eslint-config-dmitmel: version "4.1.3" - resolved "https://codeload.github.com/dmitmel/eslint-config-dmitmel/tar.gz/573f3d2ca2d77e20402dd7b96961881bec27fc5b" + resolved "https://codeload.github.com/dmitmel/eslint-config-dmitmel/tar.gz/9c162465673fa2ea11cac4091179b798499c00e5" dependencies: eslint-config-prettier "*" eslint-plugin-prettier "*" @@ -332,9 +337,9 @@ eslint-config-dmitmel@dmitmel/eslint-config-dmitmel: eslint-plugin-node "*" eslint-config-prettier@*: - version "6.10.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.10.0.tgz#7b15e303bf9c956875c948f6b21500e48ded6a7f" - integrity sha512-AtndijGte1rPILInUdHjvKEGbIV06NuvPrqlIEaEaWtbtvJh464mDeyGMdZEQMsGvC0ZVkiex1fSNcC4HAbRGg== + version "6.10.1" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.10.1.tgz#129ef9ec575d5ddc0e269667bf09defcd898642a" + integrity sha512-svTy6zh1ecQojvpbJSgH3aei/Rt7C6i090l5f2WQ4aB05lYHeZIR1qL4wZyyILTbtmnbHP5Yn8MrsOJMGa8RkQ== dependencies: get-stdin "^6.0.0" @@ -347,9 +352,9 @@ eslint-plugin-es@^3.0.0: regexpp "^3.0.0" eslint-plugin-node@*: - version "11.0.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-11.0.0.tgz#365944bb0804c5d1d501182a9bc41a0ffefed726" - integrity sha512-chUs/NVID+sknFiJzxoN9lM7uKSOEta8GC8365hw1nDfwIPIjjpRSwwPvQanWv8dt/pDe9EV4anmVSwdiSndNg== + version "11.1.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz#c95544416ee4ada26740a30474eefc5402dc671d" + integrity sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g== dependencies: eslint-plugin-es "^3.0.0" eslint-utils "^2.0.0" @@ -450,11 +455,11 @@ esprima@^4.0.0: integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== esquery@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.1.0.tgz#c5c0b66f383e7656404f86b31334d72524eddb48" - integrity sha512-MxYW9xKmROWF672KqjO75sszsA8Mxhw06YFeS5VHlB98KDHbOSurm3ArsjO60Eaf3QmGMCP1yn+0JQkNLo/97Q== + version "1.2.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.2.0.tgz#a010a519c0288f2530b3404124bfb5f02e9797fe" + integrity sha512-weltsSqdeWIX9G2qQZz7KlTRJdkkOCTPgLYJUz1Hacf48R4YOwGPHO3+ORfWedqJKbq5WQmsgK90n+pFLIKt/Q== dependencies: - estraverse "^4.0.0" + estraverse "^5.0.0" esrecurse@^4.1.0: version "4.2.1" @@ -463,11 +468,16 @@ esrecurse@^4.1.0: dependencies: estraverse "^4.1.0" -estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: +estraverse@^4.1.0, estraverse@^4.1.1: version "4.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== +estraverse@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.0.0.tgz#ac81750b482c11cca26e4b07e83ed8f75fbcdc22" + integrity sha512-j3acdrMzqrxmJTNj5dbr1YbjacrYgAxVMeF0gK16E3j494mOe7xygM/ZLIguEQ0ETwAg2hlJCtHRGav+y0Ny5A== + esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" @@ -526,9 +536,9 @@ flat-cache@^2.0.1: write "1.0.3" flatted@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" - integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== + version "2.0.2" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" + integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== fs.realpath@^1.0.0: version "1.0.0" @@ -553,9 +563,9 @@ github-slugger@^1.2.1: emoji-regex ">=6.0.0 <=6.1.1" glob-parent@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.0.tgz#5f4c1d1e748d30cd73ad2944b3577a81b081e8c2" - integrity sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw== + version "5.1.1" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229" + integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ== dependencies: is-glob "^4.0.1" @@ -780,17 +790,17 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= +minimist@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" + integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== mkdirp@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= + version "0.5.5" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" + integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== dependencies: - minimist "0.0.8" + minimist "^1.2.5" ms@^2.1.1: version "2.1.2" @@ -878,14 +888,14 @@ prettier-linter-helpers@^1.0.0: fast-diff "^1.1.2" prettier@*: - version "1.19.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" - integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== + version "2.0.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.3.tgz#9a06f0e94a51420e78b6925568b5bec72afe41ea" + integrity sha512-5qpBDBHO9fpE0zruKiTZm8Gxmz7kknO+WlQR/ivV+RMwgDw/WjOgmxLDn66MPrxq/WZPx/EgEZzh87xJO5E6Fw== prismjs@^1.17.1: - version "1.19.0" - resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.19.0.tgz#713afbd45c3baca4b321569f2df39e17e729d4dc" - integrity sha512-IVFtbW9mCWm9eOIaEkNyo2Vl4NnEifis2GQ7/MLRG5TQe6t+4Sj9J5QWI9i3v+SS43uZBlCAOn+zYTVYQcPXJw== + version "1.20.0" + resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.20.0.tgz#9b685fc480a3514ee7198eac6a3bf5024319ff03" + integrity sha512-AEDjSrVNkynnw6A+B1DsFkd6AVdTnp+/WoUixFRULlCLZVRZlVQMVWio/16jv7G1FscUxQxOQhWwApgbnxr6kQ== optionalDependencies: clipboard "^2.0.0" @@ -905,9 +915,9 @@ regexpp@^2.0.1: integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== regexpp@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.0.0.tgz#dd63982ee3300e67b41c1956f850aa680d9d330e" - integrity sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g== + version "3.1.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" + integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q== resolve-from@^4.0.0: version "4.0.0" @@ -944,9 +954,9 @@ run-async@^2.4.0: is-promise "^2.1.0" rxjs@^6.5.3: - version "6.5.4" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.4.tgz#e0777fe0d184cec7872df147f303572d414e211c" - integrity sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q== + version "6.5.5" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.5.tgz#c5c884e3094c8cfee31bf27eb87e54ccfc87f9ec" + integrity sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ== dependencies: tslib "^1.9.0" @@ -983,9 +993,9 @@ shebang-regex@^1.0.0: integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= signal-exit@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" - integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= + version "3.0.3" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" + integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== slice-ansi@^2.1.0: version "2.1.0" From eaf54fd311d1463a809f9fe9a4eface6b41872b8 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 10 Apr 2020 15:14:19 +0300 Subject: [PATCH 304/713] [nvim] change indent for `kivy` --- nvim/after/ftplugin/kivy.vim | 1 + 1 file changed, 1 insertion(+) create mode 100644 nvim/after/ftplugin/kivy.vim diff --git a/nvim/after/ftplugin/kivy.vim b/nvim/after/ftplugin/kivy.vim new file mode 100644 index 0000000..08d6c41 --- /dev/null +++ b/nvim/after/ftplugin/kivy.vim @@ -0,0 +1 @@ +IndentTabs 4 From 361ef09ae8099e792271335f8db8413a670cd3e7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 18 Apr 2020 14:53:08 +0300 Subject: [PATCH 305/713] [scripts] add a script for searching manpages with fzf --- scripts/visman | 3 +++ zsh/path.zsh | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100755 scripts/visman diff --git a/scripts/visman b/scripts/visman new file mode 100755 index 0000000..d7e1ed7 --- /dev/null +++ b/scripts/visman @@ -0,0 +1,3 @@ +#!/bin/sh + +man $(apropos '' | fzf --no-multi --tiebreak=begin | sed -n 's/^\([^ ]\+\) (\([^)]\+\)).*$/\2 \1/p') diff --git a/zsh/path.zsh b/zsh/path.zsh index 6cc275d..91c3d8b 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -2,7 +2,8 @@ # tie these env variables to zsh arrays typeset -T PKG_CONFIG_PATH pkg_config_path ':' -export PKG_CONFIG_PATH + +export PKG_CONFIG_PATH PATH MANPATH path_prepend() { if (( $# < 2 )); then From 589900c1d66259bd7d113dc41152d65e5fd19621 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 18 Apr 2020 21:02:47 +0300 Subject: [PATCH 306/713] [scripts] make visman work on macOS --- scripts/visman | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/visman b/scripts/visman index d7e1ed7..d2b9884 100755 --- a/scripts/visman +++ b/scripts/visman @@ -1,3 +1,4 @@ #!/bin/sh -man $(apropos '' | fzf --no-multi --tiebreak=begin | sed -n 's/^\([^ ]\+\) (\([^)]\+\)).*$/\2 \1/p') +# https://superuser.com/a/207474 +man $(apropos . | fzf --no-multi --tiebreak=begin | sed -n 's/^\([^ ]\+\) \?(\([^)]\+\)).*$/\2 \1/p') From e9f26ae43f3b15fcf89e09a5850e90dce2ed9727 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 30 Apr 2020 12:00:53 +0300 Subject: [PATCH 307/713] [system-files] enable all functions of the sysrq key on linux --- system/arch/.gitignore | 2 +- system/files/etc/sysctl.d/50-dmitmel.conf | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 system/files/etc/sysctl.d/50-dmitmel.conf diff --git a/system/arch/.gitignore b/system/arch/.gitignore index 43d261a..811022b 100644 --- a/system/arch/.gitignore +++ b/system/arch/.gitignore @@ -1,3 +1,3 @@ pkg src -*.pkg.tar.xz +*.pkg.tar.* diff --git a/system/files/etc/sysctl.d/50-dmitmel.conf b/system/files/etc/sysctl.d/50-dmitmel.conf new file mode 100644 index 0000000..3613892 --- /dev/null +++ b/system/files/etc/sysctl.d/50-dmitmel.conf @@ -0,0 +1 @@ +kernel.sysrq = 1 From 456b1cda0c5d80d4be9055366e678cb3b4c32e4f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 30 Apr 2020 12:01:37 +0300 Subject: [PATCH 308/713] [zsh] make multiple dot aliases more compatible --- zsh/aliases.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index f7ef264..5f1fe45 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -52,10 +52,10 @@ for n in {1..9}; do alias "$n"="cd +$n" done; unset n -alias ...='../..' -alias ....='../../..' -alias .....='../../../..' -alias ......='../../../../..' +alias ...='cd ../..' +alias ....='cd ../../..' +alias .....='cd ../../../..' +alias ......='cd ../../../../..' # print file sizes in human readable format alias du='du -h' From d49a22bcf391d882e493e186e45d6915995929d8 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 30 Apr 2020 12:02:00 +0300 Subject: [PATCH 309/713] [nvim] move more plugins into IDE mode --- nvim/init.vim | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/nvim/init.vim b/nvim/init.vim index 6371301..a641008 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -27,8 +27,10 @@ Plug 'junegunn/vim-plug' " }}} " Editing {{{ - Plug 'easymotion/vim-easymotion' - Plug 'junegunn/vim-easy-align' + if g:vim_ide + Plug 'easymotion/vim-easymotion' + Plug 'junegunn/vim-easy-align' + endif Plug 'Raimondi/delimitMate' Plug 'tpope/vim-repeat' Plug 'tpope/vim-commentary' @@ -61,9 +63,11 @@ Plug 'junegunn/vim-plug' " }}} " Git {{{ - Plug 'tpope/vim-fugitive' - Plug 'tpope/vim-rhubarb' - Plug 'airblade/vim-gitgutter' + if g:vim_ide + Plug 'tpope/vim-fugitive' + Plug 'tpope/vim-rhubarb' + Plug 'airblade/vim-gitgutter' + endif " }}} " FZF {{{ From 827b7286db4ee1bb6c84c43d6913682f5df8b128 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 30 Apr 2020 12:02:18 +0300 Subject: [PATCH 310/713] [nvim] tweak typescript highlighting a bit more --- nvim/colors/dotfiles.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index bda5ebb..55808d4 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -296,6 +296,7 @@ hi! link typescriptParens jsParens hi! link typescriptBraces javaScriptBraces hi! link typescriptOperator jsOperatorKeyword + hi! link typescriptKeywordOp typescriptOperator hi! link typescriptCastKeyword typescriptOperator hi! link typescriptMappedIn typescriptOperator hi! link typescriptBinaryOp jsOperator @@ -324,6 +325,8 @@ hi! link typescriptClassHeritage jsClassDefinition hi! link typescriptExceptions jsException hi! link typescriptTry typescriptExceptions + hi! link typescriptEnumKeyword typescriptClassKeyword + hi! link typescriptModule jsImport " }}} " Markdown {{{ From 2a65d011ce8703702ffcb1f742e4277fde050799 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 3 May 2020 02:26:21 +0300 Subject: [PATCH 311/713] [scripts] add a script for querying browser bookmarks --- script-resources/query-bookmarks.py | 21 ++++++++++++++++++ scripts/query-bookmarks.sh | 34 +++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 script-resources/query-bookmarks.py create mode 100755 scripts/query-bookmarks.sh diff --git a/script-resources/query-bookmarks.py b/script-resources/query-bookmarks.py new file mode 100644 index 0000000..58a0ba4 --- /dev/null +++ b/script-resources/query-bookmarks.py @@ -0,0 +1,21 @@ +# helper script for query-bookmarks.sh +# useful links: +# https://stackoverflow.com/a/740183/12005228 +# https://wiki.mozilla.org/Places:BookmarksComments + +import sqlite3 +import sys + +db = sqlite3.connect(sys.argv[1]) + +urls = {} +for urlId, url, in db.execute("SELECT id, url FROM urls"): + urls[urlId] = url + +for title, urlId, keyword, in db.execute( + "SELECT title, urlId, keyword FROM items WHERE kind = 1 AND validity AND NOT isDeleted" +): + url = urls[urlId] + print("{}\t{}".format(title, url)) + if keyword is not None: + print("{}\t{}".format(keyword, url)) diff --git a/scripts/query-bookmarks.sh b/scripts/query-bookmarks.sh new file mode 100755 index 0000000..2d210b7 --- /dev/null +++ b/scripts/query-bookmarks.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +# currently supports only Firefox +# folder support would be nice, though I doubt it is really useful +# NOTE: doesn't support multiple Firefox profiles + +set -eu + +script_dir="$(dirname "$0")" + +# POSIX sh doesn't have arrays, so I have to make do with loops +for db_file in ~/.mozilla/firefox/*/weave/bookmarks.sqlite; do + if [ ! -e "$db_file" ]; then exit 1; fi + + # Firefox holds a lock over the database file, so I can't connect to it even + # in the readonly mode: https://stackoverflow.com/a/7857866/12005228 + # as a workaround I copy the file + + db_copy_file=$(mktemp -t "query-bookmarks.XXXXXXXXXX.sqlite") + delete_db_copy_file() { + rm -rf "$db_copy_file" + } + trap delete_db_copy_file EXIT + + cp -f "$db_file" "$db_copy_file" + + if url="$(python "$script_dir/../script-resources/query-bookmarks.py" "$db_copy_file" | rofi -dmenu -i -p "bookmark")"; then + # dummy printf is used to remove the trailing newline produced by rofi: https://stackoverflow.com/a/12524345/12005228 + printf "%s" "$(echo "$url" | cut -f2-)" | xsel --clipboard --input + notify-send --icon=utilities-terminal --expire-time=2500 "$0" "bookmark link copied to clipboard!" + fi + + exit 0 +done From 817eb9a002af99d79eeef9eb4fbb24d944766650 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 3 May 2020 12:47:05 +0300 Subject: [PATCH 312/713] [scripts] rewrite query-bookmarks in Python with macOS support --- script-resources/query-bookmarks.py | 21 ----- scripts/query-bookmarks | 118 ++++++++++++++++++++++++++++ scripts/query-bookmarks.sh | 34 -------- 3 files changed, 118 insertions(+), 55 deletions(-) delete mode 100644 script-resources/query-bookmarks.py create mode 100755 scripts/query-bookmarks delete mode 100755 scripts/query-bookmarks.sh diff --git a/script-resources/query-bookmarks.py b/script-resources/query-bookmarks.py deleted file mode 100644 index 58a0ba4..0000000 --- a/script-resources/query-bookmarks.py +++ /dev/null @@ -1,21 +0,0 @@ -# helper script for query-bookmarks.sh -# useful links: -# https://stackoverflow.com/a/740183/12005228 -# https://wiki.mozilla.org/Places:BookmarksComments - -import sqlite3 -import sys - -db = sqlite3.connect(sys.argv[1]) - -urls = {} -for urlId, url, in db.execute("SELECT id, url FROM urls"): - urls[urlId] = url - -for title, urlId, keyword, in db.execute( - "SELECT title, urlId, keyword FROM items WHERE kind = 1 AND validity AND NOT isDeleted" -): - url = urls[urlId] - print("{}\t{}".format(title, url)) - if keyword is not None: - print("{}\t{}".format(keyword, url)) diff --git a/scripts/query-bookmarks b/scripts/query-bookmarks new file mode 100755 index 0000000..b4040f3 --- /dev/null +++ b/scripts/query-bookmarks @@ -0,0 +1,118 @@ +#!/usr/bin/env python3 + +# helper script for query-bookmarks.sh +# currently supports only Firefox +# folder support would be nice, though I doubt it is really useful +# useful links: +# http://kb.mozillazine.org/Profiles.ini_file +# https://stackoverflow.com/a/740183/12005228 +# https://wiki.mozilla.org/Places:BookmarksComments + +import sys +import os +from pathlib import Path +from configparser import ConfigParser +import tempfile +import shutil +import sqlite3 +import subprocess + + +# TODO: somehow merge `chooser_program` selection with the logic in `zsh/functions.zsh` +if sys.platform == "darwin": + firefox_home = Path.home() / "Library" / "Application Support" / "Firefox" + chooser_program = ["choose", "-i"] + clipboard_copy_program = ["pbcopy"] + + def notify_program_args(title, message, url): + return ["terminal-notifier", "-title", title, "-message", message, "-open", url] + + +elif os.name == "posix": + firefox_home = Path.home() / ".mozilla" / "firefox" + chooser_program = ["rofi", "-dmenu", "-i", "-p", "bookmark", "-format", "i"] + clipboard_copy_program = ["xsel", "--clipboard", "--input"] + # clipboard_copy_program = ["xclip", "-in", "-selection", "clipboard"] + + def notify_program_args(title, message, url): + return [ + "notify-send", + "--icon=utilities-terminal", + "--expire-time=3000", + title, + message, + ] + + +else: + raise Exception("platform '{}' is not supported!".format(sys.platform)) + + +profiles_config = ConfigParser(interpolation=None) +profiles_config.read(firefox_home / "profiles.ini") + +installs_sections = [s for s in profiles_config.sections() if s.startswith("Install")] +if not installs_sections: + raise Exception("no Firefox installations detected!") +if len(installs_sections) > 1: + raise Exception("multiple Firefox installations are not supported!") +profile_dir = firefox_home / profiles_config.get(installs_sections[0], "Default") + +db_path = profile_dir / "weave" / "bookmarks.sqlite" +if not db_path.is_file(): + raise Exception("'{}' is not a file".format(db_path)) + + +# Firefox holds a lock over the database file, so I can't connect to it even +# in the readonly mode: https://stackoverflow.com/a/7857866/12005228 +# as a workaround I copy the file +db_copy_fd, db_copy_path = tempfile.mkstemp(prefix="bookmarks.", suffix=".sqlite") +os.close(db_copy_fd) + +chooser_entries = [] + +try: + shutil.copyfile(db_path, db_copy_path) + db = sqlite3.connect(db_copy_path) + + urls = {} + for urlId, url in db.execute("SELECT id, url FROM urls"): + urls[urlId] = url + + for title, urlId, keyword in db.execute( + "SELECT title, urlId, keyword FROM items WHERE kind = 1 AND validity AND NOT isDeleted" + ): + url = urls[urlId] + chooser_entries.append((title, url)) + if keyword is not None: + chooser_entries.append((keyword, url)) + +finally: + os.remove(db_copy_path) + + +chooser_process = subprocess.Popen( + chooser_program, stdin=subprocess.PIPE, stdout=subprocess.PIPE +) + +with chooser_process.stdin as pipe: + for title, url in chooser_entries: + pipe.write("{} \u2014\u2014 {}\n".format(title, url).encode()) + +exit_code = chooser_process.wait() +if exit_code == 0: + chosen_index = int( + # an extra newline is inserted by rofi for whatever reason + chooser_process.stdout.read().rstrip(b"\n") + ) + _title, url = chooser_entries[chosen_index] + print(url) + + subprocess.run(clipboard_copy_program, input=url.encode(), check=True) + subprocess.run( + notify_program_args( + "query-bookmarks.py", "bookmark URL copied to clipboard!", url + ), + input=url.encode(), + check=True, + ) diff --git a/scripts/query-bookmarks.sh b/scripts/query-bookmarks.sh deleted file mode 100755 index 2d210b7..0000000 --- a/scripts/query-bookmarks.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -# currently supports only Firefox -# folder support would be nice, though I doubt it is really useful -# NOTE: doesn't support multiple Firefox profiles - -set -eu - -script_dir="$(dirname "$0")" - -# POSIX sh doesn't have arrays, so I have to make do with loops -for db_file in ~/.mozilla/firefox/*/weave/bookmarks.sqlite; do - if [ ! -e "$db_file" ]; then exit 1; fi - - # Firefox holds a lock over the database file, so I can't connect to it even - # in the readonly mode: https://stackoverflow.com/a/7857866/12005228 - # as a workaround I copy the file - - db_copy_file=$(mktemp -t "query-bookmarks.XXXXXXXXXX.sqlite") - delete_db_copy_file() { - rm -rf "$db_copy_file" - } - trap delete_db_copy_file EXIT - - cp -f "$db_file" "$db_copy_file" - - if url="$(python "$script_dir/../script-resources/query-bookmarks.py" "$db_copy_file" | rofi -dmenu -i -p "bookmark")"; then - # dummy printf is used to remove the trailing newline produced by rofi: https://stackoverflow.com/a/12524345/12005228 - printf "%s" "$(echo "$url" | cut -f2-)" | xsel --clipboard --input - notify-send --icon=utilities-terminal --expire-time=2500 "$0" "bookmark link copied to clipboard!" - fi - - exit 0 -done From ebd9124bb17b35248e66a6d5f9b15e2c7651c714 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 11 May 2020 14:20:26 +0300 Subject: [PATCH 313/713] [zsh] import completion.zsh changes from OMZ --- zsh/completion.zsh | 9 +++++---- zsh/env.zsh | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/zsh/completion.zsh b/zsh/completion.zsh index 439f4e8..5ae1e87 100644 --- a/zsh/completion.zsh +++ b/zsh/completion.zsh @@ -7,8 +7,8 @@ zstyle ':completion:*' menu select # show even more completion results zstyle ':completion:*' verbose yes -zstyle ':completion::complete:*' use-cache yes -zstyle ':completion::complete:*' cache-path "$ZSH_CACHE_DIR" +zstyle ':completion:*' use-cache yes +zstyle ':completion::*' cache-path "$ZSH_CACHE_DIR" # group completion result based on their categories zstyle ':completion:*' group-name '' @@ -44,5 +44,6 @@ _completion_get_hosts() { awk "match(\$0, /^Host[[:blank:]]*/) { print substr(\$0, RLENGTH+1); }" ~/.ssh/config fi } -zstyle -e ':completion:*:hosts' hosts 'reply=("${(@f)$(_completion_get_hosts)}") -' +zstyle -e ':completion:*:hosts' hosts 'reply=("${(@f)$(_completion_get_hosts)}")' + +autoload -U +X bashcompinit && bashcompinit diff --git a/zsh/env.zsh b/zsh/env.zsh index 8dc25fa..07f3124 100644 --- a/zsh/env.zsh +++ b/zsh/env.zsh @@ -26,6 +26,6 @@ jq_colors=( "0;39" # arrays "0;39" # objects ) -# join all values from jq_colors with a semicolon +# join all values from jq_colors with a colon export JQ_COLORS="${(j.:.)jq_colors}" unset jq_colors From 2a260771e9b4ccccf87a043a92c08505f5809e99 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 12 May 2020 16:46:12 +0300 Subject: [PATCH 314/713] [nvim] add a handy makeprg for markdown files --- nvim/after/ftplugin/markdown.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nvim/after/ftplugin/markdown.vim b/nvim/after/ftplugin/markdown.vim index d86c38b..b36eac8 100644 --- a/nvim/after/ftplugin/markdown.vim +++ b/nvim/after/ftplugin/markdown.vim @@ -1 +1,5 @@ execute 'source' fnameescape(expand(':p:h').'/text.vim') + +let s:src_file = expand('%') +let s:out_file = s:src_file.'.html' +let &l:makeprg = 'markdown2htmldoc '.shellescape(s:src_file).' '.shellescape(s:out_file) From 626bd91f002769a7942c0ccd78691e2419e13a09 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 14 May 2020 00:49:39 +0300 Subject: [PATCH 315/713] [zsh] add a ZLE widget for visman --- scripts/visman | 2 +- zsh/zle.zsh | 49 +++++++++++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/scripts/visman b/scripts/visman index d2b9884..d14c278 100755 --- a/scripts/visman +++ b/scripts/visman @@ -1,4 +1,4 @@ #!/bin/sh # https://superuser.com/a/207474 -man $(apropos . | fzf --no-multi --tiebreak=begin | sed -n 's/^\([^ ]\+\) \?(\([^)]\+\)).*$/\2 \1/p') +man $(apropos . | fzf --no-multi --tiebreak=begin --query="$*" | sed -n 's/^\([^ ]\+\) \?(\([^)]\+\)).*$/\2 \1/p') diff --git a/zsh/zle.zsh b/zsh/zle.zsh index 6a981d1..e088b30 100644 --- a/zsh/zle.zsh +++ b/zsh/zle.zsh @@ -22,7 +22,7 @@ } zle -N _fzf_history_widget - bindkey '^[r' _fzf_history_widget + bindkey '\er' _fzf_history_widget # }}} # palette {{{ @@ -129,22 +129,35 @@ # finally, bind the widget to Alt+Shift+P (or Esc+Shift+P) zle -N _palette_widget - bindkey "^[P" _palette_widget + bindkey '\eP' _palette_widget # }}} -# # expand-or-complete-with-dots {{{ -# expand-or-complete-with-dots() { -# local wrap_ctrl_supported -# if (( ${+terminfo[rmam]} && ${+terminfo[smam]} )); then -# wrap_ctrl_supported=1 -# fi -# # toggle line-wrapping off and back on again -# if [[ -n "$wrap_ctrl_supported" ]]; then echoti rmam; fi -# print -Pn "%F{red}...%f" -# if [[ -n "$wrap_ctrl_supported" ]]; then echoti smam; fi -# zle expand-or-complete -# zle redisplay -# } -# zle -N expand-or-complete-with-dots -# bindkey "^I" expand-or-complete-with-dots -# # }}} +# expand-or-complete-with-dots {{{ + # expand-or-complete-with-dots() { + # local wrap_ctrl_supported + # if (( ${+terminfo[rmam]} && ${+terminfo[smam]} )); then + # wrap_ctrl_supported=1 + # fi + # # toggle line-wrapping off and back on again + # if [[ -n "$wrap_ctrl_supported" ]]; then echoti rmam; fi + # print -Pn "%F{red}...%f" + # if [[ -n "$wrap_ctrl_supported" ]]; then echoti smam; fi + # zle expand-or-complete + # zle redisplay + # } + # zle -N expand-or-complete-with-dots + # bindkey "^I" expand-or-complete-with-dots +# }}} + +# find man page widget {{{ + _widget_find_man_page() { + local words=("${(@z)BUFFER}") + local cmd_name="${words[1]}" + zle push-line + BUFFER="visman ${(q)cmd_name}" + zle accept-line + } + zle -N find-man-page _widget_find_man_page + # bind to F1 + bindkey '\eOP' find-man-page +# }}} From 6e47910a468cff7ae112701df3c7a67aa9dde114 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 15 May 2020 20:11:45 +0300 Subject: [PATCH 316/713] [scripts] add script for integration with ccbot's emote registry dump --- scripts/copy-crosscode-emoji-url.sh | 33 +++++++++++++++++++++++++++++ scripts/copy-text-face.sh | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100755 scripts/copy-crosscode-emoji-url.sh diff --git a/scripts/copy-crosscode-emoji-url.sh b/scripts/copy-crosscode-emoji-url.sh new file mode 100755 index 0000000..c4834a0 --- /dev/null +++ b/scripts/copy-crosscode-emoji-url.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# shellcheck source=/dev/null +source ~/.config/copy-crosscode-emoji-url.conf.sh + +data_refs=() +data_urls=() +data_titles=() + +read_line() { + IFS= read -r "$@" +} + +# https://stackoverflow.com/a/15692004/12005228 +print_lines() { + eval "printf '%s\n' \"\${$1[@]}\"" +} + +while read_line ref && read_line url && read_line title; do + data_refs+=("$ref") + data_urls+=("$url") + data_titles+=("$title") +done < <( + curl --location --fail --max-time 10 "$CCBOT_EMOTE_REGISTRY_DUMP_URL" | + jq -r '.list[] | select(.safe) | .ref, .url, "\(.ref) [\(.guild_name)]"' +) + +if index="$(print_lines data_titles | rofi -dmenu -i -p cc-emoji -format i)"; then + echo -n "${data_urls[$index]}" | xsel --clipboard --input + notify-send --icon=utilities-terminal --expire-time=3000 "$0" "copied URL of ${data_refs[$index]} to clipboard!" +fi diff --git a/scripts/copy-text-face.sh b/scripts/copy-text-face.sh index 1d20dd5..40e368a 100755 --- a/scripts/copy-text-face.sh +++ b/scripts/copy-text-face.sh @@ -6,7 +6,7 @@ declare -A faces=( ["table flip"]=$'(\xe3\x83\x8e\xe0\xb2\xa0\xe7\x9b\x8a\xe0\xb2\xa0)\xe3\x83\x8e\xe5\xbd\xa1\xe2\x94\xbb\xe2\x94\x81\xe2\x94\xbb' ) -if IFS=$'\n' face_name="$(echo -e "${!faces[*]}" | rofi -dmenu)"; then +if IFS=$'\n' face_name="$(echo -E "${!faces[*]}" | rofi -dmenu -i)"; then face="${faces[$face_name]}" echo -n "$face" | xsel --clipboard --input notify-send --icon=utilities-terminal --expire-time=2500 "$0" "$face_name copied to clipboard" From b1d022e1fe97c6a9ceb36335c5637f220122fd24 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 17 May 2020 12:55:02 +0300 Subject: [PATCH 317/713] [nvim] move `colorcolumn` one column to the left --- nvim/plugin/editing.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 35ee2af..18e66d0 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -70,7 +70,7 @@ set commentstring=//%s " Wrapping {{{ set nowrap - set colorcolumn=80,100,120 + set colorcolumn=81,101,121 " }}} From e145d64d208d2e0cfa144d62afeee35bdd175b7b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 27 May 2020 22:51:52 +0300 Subject: [PATCH 318/713] [nvim] always show coc diagnostics in virtual text --- nvim/plugin/completion.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/plugin/completion.vim b/nvim/plugin/completion.vim index a19cd4c..79943cd 100644 --- a/nvim/plugin/completion.vim +++ b/nvim/plugin/completion.vim @@ -80,6 +80,7 @@ endif let g:coc_global_extensions += ['coc-snippets'] let g:coc_user_config['diagnostic'] = { \ 'virtualText': v:true, + \ 'virtualTextCurrentLineOnly': v:false, \ 'enableMessage': 'jump', \ 'errorSign': 'XX', \ 'warningSign': '!!', From 4bbc47593b2739e04117d51db0f23c2fedee68e9 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 29 May 2020 21:46:19 +0300 Subject: [PATCH 319/713] [scripts] add discord-whois --- scripts/discord-whois | 93 +++++++++++++++++++++++++++++++++++++++++++ zsh/functions.zsh | 2 +- 2 files changed, 94 insertions(+), 1 deletion(-) create mode 100755 scripts/discord-whois diff --git a/scripts/discord-whois b/scripts/discord-whois new file mode 100755 index 0000000..c9aedf4 --- /dev/null +++ b/scripts/discord-whois @@ -0,0 +1,93 @@ +#!/usr/bin/env python3 + +# https://discord.com/developers/docs/resources/user#user-object +# https://discord.com/developers/docs/resources/user#user-object#get-user +# https://discord.com/developers/docs/reference + +import sys +import os +import requests +import colorama +import time + +DISCORD_EPOCH = 1420070400000 # milliseconds +# https://discord.com/developers/docs/resources/user#user-object-user-flags +DISCORD_FLAGS = { + "Discord Employee": 1 << 0, + "Discord Partner": 1 << 1, + "HypeSquad Events": 1 << 2, + "Bug Hunter Level 1": 1 << 3, + "House of Bravery": 1 << 6, + "House of Brilliance": 1 << 7, + "House of Balance": 1 << 8, + "Early Supporter": 1 << 9, + "Team User": 1 << 10, + "System": 1 << 12, + "Bug Hunter Level 2": 1 << 14, + "Verified Bot": 1 << 16, + "Verified Bot Developer": 1 << 17, +} + +with open(os.path.expanduser("~/.config/dotfiles/discord-tools-bot-token.txt")) as f: + bot_token = f.read().strip() + +user_snowflake = int(sys.argv[1]) + +# no timeout here, sadly, due to this genius: https://github.com/psf/requests/issues/3099#issuecomment-215522806 +response = requests.get( + "https://discordapp.com/api/users/{}".format(user_snowflake), + headers={"Authorization": "Bot {}".format(bot_token)}, +) +try: + response.raise_for_status() +except requests.HTTPError as err: + print(response.json()) + raise err + +data = response.json() + + +def print_field(name, value): + print( + "{}{}:{} {}".format( + colorama.Style.BRIGHT, name.rjust(12), colorama.Style.RESET_ALL, value + ) + ) + + +def bool_to_yes_no(value): + return "yes" if value else "no" + + +print_field("ID", data["id"]) +print_field("Name", "{}#{}".format(data["username"], data["discriminator"])) +print_field( + "Avatar", + "https://cdn.discordapp.com/avatars/{}/{}.{}".format( + data["id"], data["avatar"], "gif" if data["avatar"].startswith("a_") else "png" + ), +) +print_field("Bot", bool_to_yes_no(data.get("bot", False))) +print_field("System user", bool_to_yes_no(data.get("system", False))) + +# https://discord.com/developers/docs/reference#convert-snowflake-to-datetime +snowflake_creation_time = (user_snowflake >> 22) + DISCORD_EPOCH +print_field( + "Created at", + "{}.{}".format( + time.strftime( + "%Y-%m-%d %H:%M:%S", time.gmtime(snowflake_creation_time // 1000) + ), + snowflake_creation_time % 1000, + ), +) + +user_flags = data["public_flags"] +if user_flags == 0: + print_field("Flags", "none") +else: + user_flag_names = [] + for flag_name, bitmask in DISCORD_FLAGS.items(): + if user_flags & bitmask: + user_flag_names.append(flag_name) + print_field("Flags", ", ".join(user_flag_names)) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 29772d6..7da6c1a 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -55,7 +55,7 @@ else paste_cmd='print >&2 "clippaste: '"$error_msg"'"; return 1' unset error_msg fi -eval "clipcopy(){$copy_cmd;};clippaste(){$paste_cmd;}" +eval "clipcopy(){ $copy_cmd; }; clippaste(){ $paste_cmd; }" unset copy_cmd paste_cmd # for compatibility with Oh My Zsh plugins From da9646e8a37dddc39ef2e8a63f16a6a9c7a77d3e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 30 May 2020 12:58:33 +0300 Subject: [PATCH 320/713] [scripts] add a script for streaming desktop audio to discord --- scripts/discord-stream-desktop-audio | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 scripts/discord-stream-desktop-audio diff --git a/scripts/discord-stream-desktop-audio b/scripts/discord-stream-desktop-audio new file mode 100755 index 0000000..603e5a4 --- /dev/null +++ b/scripts/discord-stream-desktop-audio @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 + +import discord +import sys +import os + +guild_id = int(sys.argv[1]) +voice_channel_id = int(sys.argv[2]) + +with open(os.path.expanduser("~/.config/dotfiles/discord-tools-bot-token.txt")) as f: + bot_token = f.read().strip() + + +bot = discord.Client() + + +@bot.event +async def on_ready(): + print("logged in as {0} ({0.id})".format(bot.user)) + + guild: discord.Guild = bot.get_guild(guild_id) + if guild is None: + raise Exception("guild not found") + voice_channel: discord.VoiceChannel = guild.get_channel(voice_channel_id) + if voice_channel is None: + raise Exception("channel not found") + + voice_client = await voice_channel.connect() + print("connected to {0} ({0.id}) in {1} ({1.id})".format(voice_channel, guild)) + + source = discord.FFmpegPCMAudio("default", before_options="-f pulse") + voice_client.play( + source, after=lambda e: print("Player error: %s" % e) if e else None + ) + + +bot.run(bot_token) From 4bd272f165fccfbd9535388b9a02bdd10eecb639 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 26 Jun 2020 16:25:10 +0300 Subject: [PATCH 321/713] [scripts/welcome] don't crash in environments where $SHELL is not present (e.g. Docker containers) --- script-resources/welcome/system_info.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/script-resources/welcome/system_info.py b/script-resources/welcome/system_info.py index 2f39a2e..c541261 100644 --- a/script-resources/welcome/system_info.py +++ b/script-resources/welcome/system_info.py @@ -42,7 +42,9 @@ def get_system_info(): if users_info: info("Users", users_info) - info("Shell", _get_shell()) + shell = _get_shell() + if shell is not None: + info("Shell", shell) info_lines.append("") @@ -101,7 +103,7 @@ def _get_users(): def _get_shell(): - return os.environ["SHELL"] + return os.environ.get("SHELL") def _get_cpu_usage(): From 114ab4b3fe1752312f06aaec043a71b728736301 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 30 Jun 2020 16:30:09 +0300 Subject: [PATCH 322/713] [scripts/welcome] fix crash when one of the users' terminals is None --- script-resources/welcome/system_info.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/script-resources/welcome/system_info.py b/script-resources/welcome/system_info.py index c541261..e711840 100644 --- a/script-resources/welcome/system_info.py +++ b/script-resources/welcome/system_info.py @@ -92,7 +92,9 @@ def _get_users(): terminals = users[name] colored_name = bright_colored(name, Fore.BLUE) - colored_terminals = [colored(term, Style.DIM, Fore.WHITE) for term in terminals] + colored_terminals = [ + colored(str(term), Style.DIM, Fore.WHITE) for term in terminals + ] terminals_str = ", ".join(colored_terminals) if len(colored_terminals) > 1: From db00d807bc492fcf3d3e4dc7045a3e851c2e051f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 4 Jul 2020 19:47:19 +0300 Subject: [PATCH 323/713] [kitty] add the new option for confirming window close --- kitty/kitty.conf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kitty/kitty.conf b/kitty/kitty.conf index 9145472..ec6f296 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -299,6 +299,12 @@ inactive_text_alpha 0.5 #: Fade the text in inactive windows by the specified amount (a number #: between zero and one, with zero being fully faded). +confirm_os_window_close 1 +#: Ask for confirmation when closing an OS window that has at least this +#: number of kitty windows in it. A value of zero disables confirmation. +#: This confirmation also applies to requests to quit the entire application (all +#: OS windows, via the quite action). + #: }}} #: Tab bar {{{ From ccae18c898b60a646d50c5bf7706fe3c6df672fb Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 4 Jul 2020 19:50:20 +0300 Subject: [PATCH 324/713] [git] remove useless git aliases I'm always using `gloga` rather than `tree`, and `unstage` + `discard` can be done with `git restore`/`grs` --- git/gitconfig | 5 ----- 1 file changed, 5 deletions(-) diff --git a/git/gitconfig b/git/gitconfig index a184545..d2f9d92 100644 --- a/git/gitconfig +++ b/git/gitconfig @@ -19,8 +19,3 @@ old = red bold new = green bold whitespace = red reverse - -[alias] - tree = log --all --graph - unstage = reset HEAD - discard = checkout From 8e1d1dd9cb058e978c32bbff2918573efc48e07a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 6 Jul 2020 18:51:13 +0300 Subject: [PATCH 325/713] [scripts/markdown2htmldoc] bundle the required stylesheets together with the generated document --- script-resources/markdown2htmldoc/main.js | 14 ++++++++++++-- script-resources/markdown2htmldoc/package.json | 1 + script-resources/markdown2htmldoc/yarn.lock | 5 +++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/script-resources/markdown2htmldoc/main.js b/script-resources/markdown2htmldoc/main.js index 46e162b..e69d911 100755 --- a/script-resources/markdown2htmldoc/main.js +++ b/script-resources/markdown2htmldoc/main.js @@ -41,6 +41,12 @@ md.use(markdownItHeaderAnchors); let markdownDocument = fs.readFileSync(args.get('inputFile', 0), 'utf-8'); let renderedMarkdown = md.render(markdownDocument); +let githubMarkdownCSS = fs.readFileSync( + require.resolve('github-markdown-css/github-markdown.css'), +); +let syntaxHighlightingThemeCSS = fs.readFileSync( + require.resolve('prismjs/themes/prism.css'), +); let renderedHtmlDocument = ` @@ -49,8 +55,12 @@ let renderedHtmlDocument = ` - - + + - - +${stylesheetsTexts.map((s) => ``).join('\n')}
${renderedMarkdown}
+${scriptsTexts.map((s) => ``).join('\n')} `; -fs.writeFileSync(args.get('outputFile', 1), renderedHtmlDocument, 'utf-8'); +fs.writeFileSync( + args.get('OUTPUT_FILE', 1), + renderedHtmlDocument, + args.get('output_encoding'), +); diff --git a/script-resources/markdown2htmldoc/markdown-it-header-anchors.js b/script-resources/markdown2htmldoc/markdown-it-header-anchors.js index d4470d3..80fa250 100644 --- a/script-resources/markdown2htmldoc/markdown-it-header-anchors.js +++ b/script-resources/markdown2htmldoc/markdown-it-header-anchors.js @@ -14,7 +14,7 @@ function markdownItHeaderAnchors(md) { let innerText = ''; let headingContentToken = tokens[idx + 1]; - headingContentToken.children.forEach(child => { + headingContentToken.children.forEach((child) => { switch (child.type) { case 'html_block': case 'html_inline': @@ -28,7 +28,7 @@ function markdownItHeaderAnchors(md) { }); if (innerText.length > 0) { - let id = slugger.slug(innerText); + let id = md.utils.escapeHtml(slugger.slug(innerText)); renderedHeadingOpen += ``; } diff --git a/script-resources/markdown2htmldoc/package.json b/script-resources/markdown2htmldoc/package.json index b75246c..cc1dae8 100644 --- a/script-resources/markdown2htmldoc/package.json +++ b/script-resources/markdown2htmldoc/package.json @@ -11,12 +11,10 @@ }, "devDependencies": { "eslint": "*", - "eslint-config-dmitmel": "dmitmel/eslint-config-dmitmel" - }, - "eslintConfig": { - "extends": "eslint-config-dmitmel/presets/node", - "rules": { - "node/shebang": "off" - } + "eslint-config-dmitmel": "dmitmel/eslint-config-dmitmel", + "eslint-config-prettier": "*", + "eslint-plugin-node": "*", + "eslint-plugin-prettier": "*", + "prettier": "*" } } diff --git a/script-resources/markdown2htmldoc/yarn.lock b/script-resources/markdown2htmldoc/yarn.lock index 15a0ead..ecb8902 100644 --- a/script-resources/markdown2htmldoc/yarn.lock +++ b/script-resources/markdown2htmldoc/yarn.lock @@ -2,97 +2,42 @@ # yarn lockfile v1 -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.8.3.tgz#33e25903d7481181534e12ec0a25f16b6fcf419e" - integrity sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g== +"@babel/code-frame@^7.0.0": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" + integrity sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg== dependencies: - "@babel/highlight" "^7.8.3" + "@babel/highlight" "^7.10.4" -"@babel/generator@^7.9.0": - version "7.9.4" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.9.4.tgz#12441e90c3b3c4159cdecf312075bf1a8ce2dbce" - integrity sha512-rjP8ahaDy/ouhrvCoU1E5mqaitWrxwuNGU+dy1EpaoK48jZay4MdkskKGIMHLZNewg8sAsqpGSREJwP0zH3YQA== +"@babel/helper-validator-identifier@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2" + integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw== + +"@babel/highlight@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.10.4.tgz#7d1bdfd65753538fabe6c38596cdb76d9ac60143" + integrity sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA== dependencies: - "@babel/types" "^7.9.0" - jsesc "^2.5.1" - lodash "^4.17.13" - source-map "^0.5.0" - -"@babel/helper-function-name@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz#eeeb665a01b1f11068e9fb86ad56a1cb1a824cca" - integrity sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA== - dependencies: - "@babel/helper-get-function-arity" "^7.8.3" - "@babel/template" "^7.8.3" - "@babel/types" "^7.8.3" - -"@babel/helper-get-function-arity@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz#b894b947bd004381ce63ea1db9f08547e920abd5" - integrity sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA== - dependencies: - "@babel/types" "^7.8.3" - -"@babel/helper-split-export-declaration@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz#31a9f30070f91368a7182cf05f831781065fc7a9" - integrity sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA== - dependencies: - "@babel/types" "^7.8.3" - -"@babel/helper-validator-identifier@^7.9.0": - version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.0.tgz#ad53562a7fc29b3b9a91bbf7d10397fd146346ed" - integrity sha512-6G8bQKjOh+of4PV/ThDm/rRqlU7+IGoJuofpagU5GlEl29Vv0RGqqt86ZGRV8ZuSOY3o+8yXl5y782SMcG7SHw== - -"@babel/highlight@^7.8.3": - version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.9.0.tgz#4e9b45ccb82b79607271b2979ad82c7b68163079" - integrity sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ== - dependencies: - "@babel/helper-validator-identifier" "^7.9.0" + "@babel/helper-validator-identifier" "^7.10.4" chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.7.0", "@babel/parser@^7.8.6", "@babel/parser@^7.9.0": - version "7.9.4" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.9.4.tgz#68a35e6b0319bbc014465be43828300113f2f2e8" - integrity sha512-bC49otXX6N0/VYhgOMh4gnP26E9xnDZK3TmbNpxYzzz9BQLBosQwfyOe9/cXUU3txYhTzLCbcqd5c8y/OmCjHA== - -"@babel/template@^7.8.3": - version "7.8.6" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.8.6.tgz#86b22af15f828dfb086474f964dcc3e39c43ce2b" - integrity sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg== +"@eslint/eslintrc@^0.1.3": + version "0.1.3" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.1.3.tgz#7d1a2b2358552cc04834c0979bd4275362e37085" + integrity sha512-4YVwPkANLeNtRjMekzux1ci8hIaH5eGKktGqR0d3LWsKNn5B2X/1Z6Trxy7jQXl9EBGE6Yj02O+t09FMeRllaA== dependencies: - "@babel/code-frame" "^7.8.3" - "@babel/parser" "^7.8.6" - "@babel/types" "^7.8.6" - -"@babel/traverse@^7.7.0": - version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.9.0.tgz#d3882c2830e513f4fe4cec9fe76ea1cc78747892" - integrity sha512-jAZQj0+kn4WTHO5dUZkZKhbFrqZE7K5LAQ5JysMnmvGij+wOdr+8lWqPeW0BcF4wFwrEXXtdGO7wcV6YPJcf3w== - dependencies: - "@babel/code-frame" "^7.8.3" - "@babel/generator" "^7.9.0" - "@babel/helper-function-name" "^7.8.3" - "@babel/helper-split-export-declaration" "^7.8.3" - "@babel/parser" "^7.9.0" - "@babel/types" "^7.9.0" - debug "^4.1.0" - globals "^11.1.0" - lodash "^4.17.13" - -"@babel/types@^7.7.0", "@babel/types@^7.8.3", "@babel/types@^7.8.6", "@babel/types@^7.9.0": - version "7.9.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.9.0.tgz#00b064c3df83ad32b2dbf5ff07312b15c7f1efb5" - integrity sha512-BS9JKfXkzzJl8RluW4JGknzpiUV7ZrvTayM6yfqLTVBEnFtyowVIOu6rqxRd5cVO6yGoWf4T8u8dgK9oB+GCng== - dependencies: - "@babel/helper-validator-identifier" "^7.9.0" - lodash "^4.17.13" - to-fast-properties "^2.0.0" + ajv "^6.12.4" + debug "^4.1.1" + espree "^7.3.0" + globals "^12.1.0" + ignore "^4.0.6" + import-fresh "^3.2.1" + js-yaml "^3.13.1" + lodash "^4.17.19" + minimatch "^3.0.4" + strip-json-comments "^3.1.1" "@types/color-name@^1.1.1": version "1.1.1" @@ -104,27 +49,25 @@ acorn-jsx@^5.2.0: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.2.0.tgz#4c66069173d6fdd68ed85239fc256226182b2ebe" integrity sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ== -acorn@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.1.tgz#e35668de0b402f359de515c5482a1ab9f89a69bf" - integrity sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg== +acorn@^7.4.0: + version "7.4.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.0.tgz#e1ad486e6c54501634c6c397c5c121daa383607c" + integrity sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w== -ajv@^6.10.0, ajv@^6.10.2: - version "6.12.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.0.tgz#06d60b96d87b8454a5adaba86e7854da629db4b7" - integrity sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw== +ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.4: + version "6.12.4" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.4.tgz#0614facc4522127fa713445c6bfd3ebd376e2234" + integrity sha512-eienB2c9qVQs2KWexhkrdMLVDoIQCz5KSeLxwg9Lzk4DOfBtIK9PQwwufcsn1jjGuf9WZmqPMbGxOzfcuphJCQ== dependencies: fast-deep-equal "^3.1.1" fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ansi-escapes@^4.2.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.1.tgz#a5c47cc43181f1f38ffd7076837700d395522a61" - integrity sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA== - dependencies: - type-fest "^0.11.0" +ansi-colors@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" + integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== ansi-regex@^4.1.0: version "4.1.0" @@ -163,18 +106,6 @@ astral-regex@^1.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== -babel-eslint@*: - version "10.1.0" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.1.0.tgz#6968e568a910b78fb3779cdd8b6ac2f479943232" - integrity sha512-ifWaTHQ0ce+448CYop8AdrQiBsGrnC+bMgfyKFdi6EsPLTAWG+QfyDeM6OH+FmWnKvEq5NnBMLvlBUPKQZoDSg== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.7.0" - "@babel/traverse" "^7.7.0" - "@babel/types" "^7.7.0" - eslint-visitor-keys "^1.0.0" - resolve "^1.12.0" - balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" @@ -193,7 +124,7 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -chalk@^2.0.0, chalk@^2.1.0: +chalk@^2.0.0: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -202,31 +133,14 @@ chalk@^2.0.0, chalk@^2.1.0: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" - integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== +chalk@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" + integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== dependencies: ansi-styles "^4.1.0" supports-color "^7.1.0" -chardet@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" - integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== - -cli-cursor@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" - integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== - dependencies: - restore-cursor "^3.1.0" - -cli-width@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" - integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= - clipboard@^2.0.0: version "2.0.6" resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.6.tgz#52921296eec0fdf77ead1749421b21c968647376" @@ -265,25 +179,23 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -cross-spawn@^6.0.5: - version "6.0.5" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" - integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== +cross-spawn@^7.0.2: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== dependencies: - nice-try "^1.0.4" - path-key "^2.0.1" - semver "^5.5.0" - shebang-command "^1.2.0" - which "^1.2.9" + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" -debug@^4.0.1, debug@^4.1.0: +debug@^4.0.1, debug@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== dependencies: ms "^2.1.1" -deep-is@~0.1.3: +deep-is@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= @@ -310,15 +222,17 @@ emoji-regex@^7.0.1: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" - integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== +enquirer@^2.3.5: + version "2.3.6" + resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" + integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== + dependencies: + ansi-colors "^4.1.1" entities@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.0.tgz#68d6084cab1b079767540d80e56a39b423e4abf4" - integrity sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw== + version "2.0.3" + resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.3.tgz#5c487e5742ab93c15abb5da22759b8590ec03b7f" + integrity sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ== escape-string-regexp@^1.0.5: version "1.0.5" @@ -326,27 +240,20 @@ escape-string-regexp@^1.0.5: integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= eslint-config-dmitmel@dmitmel/eslint-config-dmitmel: - version "4.1.3" - resolved "https://codeload.github.com/dmitmel/eslint-config-dmitmel/tar.gz/9c162465673fa2ea11cac4091179b798499c00e5" - dependencies: - eslint-config-prettier "*" - eslint-plugin-prettier "*" - prettier "*" - optionalDependencies: - babel-eslint "*" - eslint-plugin-node "*" + version "6.1.1" + resolved "https://codeload.github.com/dmitmel/eslint-config-dmitmel/tar.gz/6957792d434034e792e4b665d620ea5af6f8f02d" eslint-config-prettier@*: - version "6.10.1" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.10.1.tgz#129ef9ec575d5ddc0e269667bf09defcd898642a" - integrity sha512-svTy6zh1ecQojvpbJSgH3aei/Rt7C6i090l5f2WQ4aB05lYHeZIR1qL4wZyyILTbtmnbHP5Yn8MrsOJMGa8RkQ== + version "6.11.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz#f6d2238c1290d01c859a8b5c1f7d352a0b0da8b1" + integrity sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA== dependencies: get-stdin "^6.0.0" eslint-plugin-es@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-es/-/eslint-plugin-es-3.0.0.tgz#98cb1bc8ab0aa807977855e11ad9d1c9422d014b" - integrity sha512-6/Jb/J/ZvSebydwbBJO1R9E5ky7YeElfK56Veh7e4QGFHCXoIXGH9HhVz+ibJLM3XJ1XjP+T7rKBLUa/Y7eIng== + version "3.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz#75a7cdfdccddc0589934aeeb384175f221c57893" + integrity sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ== dependencies: eslint-utils "^2.0.0" regexpp "^3.0.0" @@ -364,55 +271,50 @@ eslint-plugin-node@*: semver "^6.1.0" eslint-plugin-prettier@*: - version "3.1.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.2.tgz#432e5a667666ab84ce72f945c72f77d996a5c9ba" - integrity sha512-GlolCC9y3XZfv3RQfwGew7NnuFDKsfI4lbvRK+PIIo23SFH+LemGs4cKwzAaRa+Mdb+lQO/STaIayno8T5sJJA== + version "3.1.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz#168ab43154e2ea57db992a2cd097c828171f75c2" + integrity sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg== dependencies: prettier-linter-helpers "^1.0.0" -eslint-scope@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9" - integrity sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw== +eslint-scope@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.0.tgz#d0f971dfe59c69e0cada684b23d49dbf82600ce5" + integrity sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w== dependencies: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-utils@^1.4.3: - version "1.4.3" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f" - integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q== +eslint-utils@^2.0.0, eslint-utils@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27" + integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg== dependencies: eslint-visitor-keys "^1.1.0" -eslint-utils@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.0.0.tgz#7be1cc70f27a72a76cd14aa698bcabed6890e1cd" - integrity sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA== - dependencies: - eslint-visitor-keys "^1.1.0" - -eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" - integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== +eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" + integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== eslint@*: - version "6.8.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb" - integrity sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig== + version "7.8.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.8.1.tgz#e59de3573fb6a5be8ff526c791571646d124a8fa" + integrity sha512-/2rX2pfhyUG0y+A123d0ccXtMm7DV7sH1m3lk9nk2DZ2LReq39FXHueR9xZwshE5MdfSf0xunSaMWRqyIA6M1w== dependencies: "@babel/code-frame" "^7.0.0" + "@eslint/eslintrc" "^0.1.3" ajv "^6.10.0" - chalk "^2.1.0" - cross-spawn "^6.0.5" + chalk "^4.0.0" + cross-spawn "^7.0.2" debug "^4.0.1" doctrine "^3.0.0" - eslint-scope "^5.0.0" - eslint-utils "^1.4.3" - eslint-visitor-keys "^1.1.0" - espree "^6.1.2" - esquery "^1.0.1" + enquirer "^2.3.5" + eslint-scope "^5.1.0" + eslint-utils "^2.1.0" + eslint-visitor-keys "^1.3.0" + espree "^7.3.0" + esquery "^1.2.0" esutils "^2.0.2" file-entry-cache "^5.0.1" functional-red-black-tree "^1.0.1" @@ -421,81 +323,70 @@ eslint@*: ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" - inquirer "^7.0.0" is-glob "^4.0.0" js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.3.0" - lodash "^4.17.14" + levn "^0.4.1" + lodash "^4.17.19" minimatch "^3.0.4" - mkdirp "^0.5.1" natural-compare "^1.4.0" - optionator "^0.8.3" + optionator "^0.9.1" progress "^2.0.0" - regexpp "^2.0.1" - semver "^6.1.2" - strip-ansi "^5.2.0" - strip-json-comments "^3.0.1" + regexpp "^3.1.0" + semver "^7.2.1" + strip-ansi "^6.0.0" + strip-json-comments "^3.1.0" table "^5.2.3" text-table "^0.2.0" v8-compile-cache "^2.0.3" -espree@^6.1.2: - version "6.2.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-6.2.1.tgz#77fc72e1fd744a2052c20f38a5b575832e82734a" - integrity sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw== +espree@^7.3.0: + version "7.3.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.0.tgz#dc30437cf67947cf576121ebd780f15eeac72348" + integrity sha512-dksIWsvKCixn1yrEXO8UosNSxaDoSYpq9reEjZSbHLpT5hpaCAKTLBwq0RHtLrIr+c0ByiYzWT8KTMRzoRCNlw== dependencies: - acorn "^7.1.1" + acorn "^7.4.0" acorn-jsx "^5.2.0" - eslint-visitor-keys "^1.1.0" + eslint-visitor-keys "^1.3.0" esprima@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esquery@^1.0.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.2.0.tgz#a010a519c0288f2530b3404124bfb5f02e9797fe" - integrity sha512-weltsSqdeWIX9G2qQZz7KlTRJdkkOCTPgLYJUz1Hacf48R4YOwGPHO3+ORfWedqJKbq5WQmsgK90n+pFLIKt/Q== +esquery@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.3.1.tgz#b78b5828aa8e214e29fb74c4d5b752e1c033da57" + integrity sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ== dependencies: - estraverse "^5.0.0" + estraverse "^5.1.0" esrecurse@^4.1.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" - integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== dependencies: - estraverse "^4.1.0" + estraverse "^5.2.0" -estraverse@^4.1.0, estraverse@^4.1.1: +estraverse@^4.1.1: version "4.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== -estraverse@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.0.0.tgz#ac81750b482c11cca26e4b07e83ed8f75fbcdc22" - integrity sha512-j3acdrMzqrxmJTNj5dbr1YbjacrYgAxVMeF0gK16E3j494mOe7xygM/ZLIguEQ0ETwAg2hlJCtHRGav+y0Ny5A== +estraverse@^5.1.0, estraverse@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880" + integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ== esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -external-editor@^3.0.3: - version "3.1.0" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" - integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== - dependencies: - chardet "^0.7.0" - iconv-lite "^0.4.24" - tmp "^0.0.33" - fast-deep-equal@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4" - integrity sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA== + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== fast-diff@^1.1.2: version "1.2.0" @@ -507,18 +398,11 @@ fast-json-stable-stringify@^2.0.0: resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== -fast-levenshtein@~2.0.6: +fast-levenshtein@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= -figures@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" - integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== - dependencies: - escape-string-regexp "^1.0.5" - file-entry-cache@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" @@ -586,11 +470,6 @@ glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -globals@^11.1.0: - version "11.12.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" - integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== - globals@^12.1.0: version "12.4.0" resolved "https://registry.yarnpkg.com/globals/-/globals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8" @@ -615,24 +494,17 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -iconv-lite@^0.4.24: - version "0.4.24" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" - integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== - dependencies: - safer-buffer ">= 2.1.2 < 3" - ignore@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== ignore@^5.1.1: - version "5.1.4" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf" - integrity sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A== + version "5.1.8" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" + integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== -import-fresh@^3.0.0: +import-fresh@^3.0.0, import-fresh@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66" integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ== @@ -658,25 +530,6 @@ inherits@2: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== -inquirer@^7.0.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.1.0.tgz#1298a01859883e17c7264b82870ae1034f92dd29" - integrity sha512-5fJMWEmikSYu0nv/flMc475MhGbB7TSPd/2IpFV4I4rMklboCH2rQjYY5kKiYGHqUF9gvaambupcJFFG9dvReg== - dependencies: - ansi-escapes "^4.2.1" - chalk "^3.0.0" - cli-cursor "^3.1.0" - cli-width "^2.0.0" - external-editor "^3.0.3" - figures "^3.0.0" - lodash "^4.17.15" - mute-stream "0.0.8" - run-async "^2.4.0" - rxjs "^6.5.3" - string-width "^4.1.0" - strip-ansi "^6.0.0" - through "^2.3.6" - is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" @@ -687,11 +540,6 @@ is-fullwidth-code-point@^2.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" - integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - is-glob@^4.0.0, is-glob@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" @@ -699,11 +547,6 @@ is-glob@^4.0.0, is-glob@^4.0.1: dependencies: is-extglob "^2.1.1" -is-promise@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" - integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= - isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -715,18 +558,13 @@ js-tokens@^4.0.0: integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== js-yaml@^3.13.1: - version "3.13.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" - integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== + version "3.14.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" + integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== dependencies: argparse "^1.0.7" esprima "^4.0.0" -jsesc@^2.5.1: - version "2.5.2" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" - integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== - json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" @@ -737,25 +575,25 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= -levn@^0.3.0, levn@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" - integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== dependencies: - prelude-ls "~1.1.2" - type-check "~0.3.2" + prelude-ls "^1.2.1" + type-check "~0.4.0" -linkify-it@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-2.2.0.tgz#e3b54697e78bf915c70a38acd78fd09e0058b1cf" - integrity sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw== +linkify-it@^3.0.1: + version "3.0.2" + resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-3.0.2.tgz#f55eeb8bc1d3ae754049e124ab3bb56d97797fb8" + integrity sha512-gDBO4aHNZS6coiZCKVhSNh43F9ioIL4JwRjLZPkoLIY4yZFwg264Y5lu2x6rb1Js42Gh6Yqm2f6L2AJcnkzinQ== dependencies: uc.micro "^1.0.1" -lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15: - version "4.17.19" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b" - integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ== +lodash@^4.17.14, lodash@^4.17.19: + version "4.17.20" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" + integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== markdown-it-emoji@*: version "1.4.0" @@ -768,13 +606,13 @@ markdown-it-task-checkbox@*: integrity sha512-7pxkHuvqTOu3iwVGmDPeYjQg+AIS9VQxzyLP9JCg9lBjgPAJXGEkChK6A2iFuj3tS0GV3HG2u5AMNhcQqwxpJw== markdown-it@*: - version "10.0.0" - resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-10.0.0.tgz#abfc64f141b1722d663402044e43927f1f50a8dc" - integrity sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg== + version "11.0.0" + resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-11.0.0.tgz#dbfc30363e43d756ebc52c38586b91b90046b876" + integrity sha512-+CvOnmbSubmQFSA9dKz1BRiaSMV7rhexl3sngKqFyXSagoA3fBdJQ8oZWtRy2knXdpDXaBw44euz37DeJQ9asg== dependencies: argparse "^1.0.7" entities "~2.0.0" - linkify-it "^2.0.0" + linkify-it "^3.0.1" mdurl "^1.0.1" uc.micro "^1.0.5" @@ -783,11 +621,6 @@ mdurl@^1.0.1: resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" integrity sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4= -mimic-fn@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" - integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== - minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" @@ -812,21 +645,11 @@ ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -mute-stream@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" - integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== - natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= -nice-try@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" - integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== - once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -834,29 +657,17 @@ once@^1.3.0: dependencies: wrappy "1" -onetime@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5" - integrity sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q== +optionator@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" + integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== dependencies: - mimic-fn "^2.1.0" - -optionator@^0.8.3: - version "0.8.3" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" - integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== - dependencies: - deep-is "~0.1.3" - fast-levenshtein "~2.0.6" - levn "~0.3.0" - prelude-ls "~1.1.2" - type-check "~0.3.2" - word-wrap "~1.2.3" - -os-tmpdir@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + word-wrap "^1.2.3" parent-module@^1.0.0: version "1.0.1" @@ -870,20 +681,20 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= -path-key@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" - integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= +path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== path-parse@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== -prelude-ls@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" - integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== prettier-linter-helpers@^1.0.0: version "1.0.0" @@ -893,9 +704,9 @@ prettier-linter-helpers@^1.0.0: fast-diff "^1.1.2" prettier@*: - version "2.0.3" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.3.tgz#9a06f0e94a51420e78b6925568b5bec72afe41ea" - integrity sha512-5qpBDBHO9fpE0zruKiTZm8Gxmz7kknO+WlQR/ivV+RMwgDw/WjOgmxLDn66MPrxq/WZPx/EgEZzh87xJO5E6Fw== + version "2.1.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.1.tgz#d9485dd5e499daa6cb547023b87a6cf51bee37d6" + integrity sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw== prismjs@^1.21.0: version "1.21.0" @@ -914,12 +725,7 @@ punycode@^2.1.0: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== -regexpp@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" - integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== - -regexpp@^3.0.0: +regexpp@^3.0.0, regexpp@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q== @@ -929,21 +735,13 @@ resolve-from@^4.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== -resolve@^1.10.1, resolve@^1.12.0: - version "1.15.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8" - integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w== +resolve@^1.10.1: + version "1.17.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" + integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== dependencies: path-parse "^1.0.6" -restore-cursor@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" - integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== - dependencies: - onetime "^5.1.0" - signal-exit "^3.0.2" - rimraf@2.6.3: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" @@ -951,56 +749,32 @@ rimraf@2.6.3: dependencies: glob "^7.1.3" -run-async@^2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.0.tgz#e59054a5b86876cfae07f431d18cbaddc594f1e8" - integrity sha512-xJTbh/d7Lm7SBhc1tNvTpeCHaEzoyxPrqNlvSdMfBTYwaY++UJFyXUOxAtsRUXjlqOfj8luNaR9vjCh4KeV+pg== - dependencies: - is-promise "^2.1.0" - -rxjs@^6.5.3: - version "6.5.5" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.5.tgz#c5c884e3094c8cfee31bf27eb87e54ccfc87f9ec" - integrity sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ== - dependencies: - tslib "^1.9.0" - -"safer-buffer@>= 2.1.2 < 3": - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== - select@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d" integrity sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0= -semver@^5.5.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" - integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== - -semver@^6.1.0, semver@^6.1.2: +semver@^6.1.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== -shebang-command@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" - integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= +semver@^7.2.1: + version "7.3.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" + integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== dependencies: - shebang-regex "^1.0.0" + shebang-regex "^3.0.0" -shebang-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" - integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= - -signal-exit@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" - integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== slice-ansi@^2.1.0: version "2.1.0" @@ -1011,11 +785,6 @@ slice-ansi@^2.1.0: astral-regex "^1.0.0" is-fullwidth-code-point "^2.0.0" -source-map@^0.5.0: - version "0.5.7" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" - integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= - sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" @@ -1030,16 +799,7 @@ string-width@^3.0.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" -string-width@^4.1.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" - integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.0" - -strip-ansi@^5.1.0, strip-ansi@^5.2.0: +strip-ansi@^5.1.0: version "5.2.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== @@ -1053,10 +813,10 @@ strip-ansi@^6.0.0: dependencies: ansi-regex "^5.0.0" -strip-json-comments@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" - integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== +strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== supports-color@^5.3.0: version "5.5.0" @@ -1066,9 +826,9 @@ supports-color@^5.3.0: has-flag "^3.0.0" supports-color@^7.1.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1" - integrity sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g== + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== dependencies: has-flag "^4.0.0" @@ -1087,44 +847,17 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= -through@^2.3.6: - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= - tiny-emitter@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz#1d1a56edfc51c43e863cbb5382a72330e3555423" integrity sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q== -tmp@^0.0.33: - version "0.0.33" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" - integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== dependencies: - os-tmpdir "~1.0.2" - -to-fast-properties@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" - integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= - -tslib@^1.9.0: - version "1.11.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35" - integrity sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA== - -type-check@~0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" - integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= - dependencies: - prelude-ls "~1.1.2" - -type-fest@^0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.11.0.tgz#97abf0872310fed88a5c466b25681576145e33f1" - integrity sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ== + prelude-ls "^1.2.1" type-fest@^0.8.1: version "0.8.1" @@ -1137,25 +870,25 @@ uc.micro@^1.0.1, uc.micro@^1.0.5: integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== uri-js@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" - integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== + version "4.4.0" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.0.tgz#aa714261de793e8a82347a7bcc9ce74e86f28602" + integrity sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g== dependencies: punycode "^2.1.0" v8-compile-cache@^2.0.3: - version "2.1.0" - resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" - integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g== + version "2.1.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745" + integrity sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ== -which@^1.2.9: - version "1.3.1" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" - integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== dependencies: isexe "^2.0.0" -word-wrap@~1.2.3: +word-wrap@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== From afb70a6ad3bfc5b09634ceb2855e861242d9ebc4 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 6 Sep 2020 13:26:11 +0300 Subject: [PATCH 365/713] [nvim] add option for specifying extra arguments for markdown2htmldoc --- nvim/after/ftplugin/markdown.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvim/after/ftplugin/markdown.vim b/nvim/after/ftplugin/markdown.vim index b36eac8..82aa090 100644 --- a/nvim/after/ftplugin/markdown.vim +++ b/nvim/after/ftplugin/markdown.vim @@ -3,3 +3,6 @@ execute 'source' fnameescape(expand(':p:h').'/text.vim') let s:src_file = expand('%') let s:out_file = s:src_file.'.html' let &l:makeprg = 'markdown2htmldoc '.shellescape(s:src_file).' '.shellescape(s:out_file) +for s:arg in get(g:, 'dotfiles_markdown2htmldoc_options', []) + let &l:makeprg .= ' '.shellescape(s:arg) +endfor From 0442601626c8f4142425c88ae1a51e081e005ee1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 6 Sep 2020 14:14:29 +0300 Subject: [PATCH 366/713] [colorschemes] rewrite the buildscript as a makefile --- colorschemes/Makefile | 23 +++++++++++++++++++ colorschemes/build.sh | 22 ------------------ .../{iterm.py => iterm.itermcolors.py} | 0 colorschemes/{kitty.py => kitty.conf.py} | 0 colorschemes/out/{nvim.vim => vim.vim} | 0 colorschemes/out/{shell.zsh => zsh.zsh} | 0 colorschemes/{setvtrgb.py => setvtrgb.txt.py} | 0 .../{termux.py => termux.properties.py} | 0 colorschemes/{nvim.py => vim.vim.py} | 0 colorschemes/{shell.py => zsh.zsh.py} | 0 nvim/colors/dotfiles.vim | 2 +- zsh/colorscheme.zsh | 2 +- 12 files changed, 25 insertions(+), 24 deletions(-) create mode 100644 colorschemes/Makefile delete mode 100755 colorschemes/build.sh rename colorschemes/{iterm.py => iterm.itermcolors.py} (100%) rename colorschemes/{kitty.py => kitty.conf.py} (100%) rename colorschemes/out/{nvim.vim => vim.vim} (100%) rename colorschemes/out/{shell.zsh => zsh.zsh} (100%) rename colorschemes/{setvtrgb.py => setvtrgb.txt.py} (100%) rename colorschemes/{termux.py => termux.properties.py} (100%) rename colorschemes/{nvim.py => vim.vim.py} (100%) rename colorschemes/{shell.py => zsh.zsh.py} (100%) diff --git a/colorschemes/Makefile b/colorschemes/Makefile new file mode 100644 index 0000000..8d90804 --- /dev/null +++ b/colorschemes/Makefile @@ -0,0 +1,23 @@ +# https://tech.davis-hansson.com/p/make/ +SHELL := bash +.ONESHELL: +.SHELLFLAGS := -eu -o pipefail -c +.DELETE_ON_ERROR: +MAKEFLAGS += --warn-undefined-variables +MAKEFLAGS += --no-builtin-rules + +.PHONY: all clean + +OUT_DIR := out +OUT_FILES := iterm.itermcolors kitty.conf vim.vim setvtrgb.txt zsh.zsh termux.properties + +all: $(OUT_DIR) $(addprefix $(OUT_DIR)/,$(OUT_FILES)) + +clean: + rm -rv out + +out: + mkdir -p $@ + +$(OUT_DIR)/%: %.py + ./$< > $@ diff --git a/colorschemes/build.sh b/colorschemes/build.sh deleted file mode 100755 index 2c504f8..0000000 --- a/colorschemes/build.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -set -e - -cd "$(dirname "${BASH_SOURCE[0]}")" - -mkdir -p out - -declare -A apps=( - [iterm]=itermcolors - [kitty]=conf - [nvim]=vim - [setvtrgb]=txt - [shell]=zsh - [termux]=properties -) - -for app in "${!apps[@]}"; do - output_file="$app.${apps[$app]}" - echo "$output_file" - ./"$app".py > ./out/"$output_file" -done diff --git a/colorschemes/iterm.py b/colorschemes/iterm.itermcolors.py similarity index 100% rename from colorschemes/iterm.py rename to colorschemes/iterm.itermcolors.py diff --git a/colorschemes/kitty.py b/colorschemes/kitty.conf.py similarity index 100% rename from colorschemes/kitty.py rename to colorschemes/kitty.conf.py diff --git a/colorschemes/out/nvim.vim b/colorschemes/out/vim.vim similarity index 100% rename from colorschemes/out/nvim.vim rename to colorschemes/out/vim.vim diff --git a/colorschemes/out/shell.zsh b/colorschemes/out/zsh.zsh similarity index 100% rename from colorschemes/out/shell.zsh rename to colorschemes/out/zsh.zsh diff --git a/colorschemes/setvtrgb.py b/colorschemes/setvtrgb.txt.py similarity index 100% rename from colorschemes/setvtrgb.py rename to colorschemes/setvtrgb.txt.py diff --git a/colorschemes/termux.py b/colorschemes/termux.properties.py similarity index 100% rename from colorschemes/termux.py rename to colorschemes/termux.properties.py diff --git a/colorschemes/nvim.py b/colorschemes/vim.vim.py similarity index 100% rename from colorschemes/nvim.py rename to colorschemes/vim.vim.py diff --git a/colorschemes/shell.py b/colorschemes/zsh.zsh.py similarity index 100% rename from colorschemes/shell.py rename to colorschemes/zsh.zsh.py diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index b418764..07ccfca 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -3,7 +3,7 @@ " Color definitions {{{ - execute 'source' fnameescape(g:nvim_dotfiles_dir.'/../colorschemes/out/nvim.vim') + execute 'source' fnameescape(g:nvim_dotfiles_dir.'/../colorschemes/out/vim.vim') if !&termguicolors && exists('$_COLORSCHEME_TERMINAL') set notermguicolors diff --git a/zsh/colorscheme.zsh b/zsh/colorscheme.zsh index 73f5275..bd4d4a4 100644 --- a/zsh/colorscheme.zsh +++ b/zsh/colorscheme.zsh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # partially based on https://github.com/chriskempson/base16-shell/blob/master/templates/default.mustache -source "$ZSH_DOTFILES/../colorschemes/out/shell.zsh" +source "$ZSH_DOTFILES/../colorschemes/out/zsh.zsh" if [[ -n "$TMUX" ]]; then # tmux From df59241a576a6d5c5ac99fb487eb7941e786b8a0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 6 Sep 2020 19:07:36 +0300 Subject: [PATCH 367/713] [scripts/markdown2htmldoc] fix an XSS when plain text is rendered in a code block --- script-resources/markdown2htmldoc/main.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/script-resources/markdown2htmldoc/main.js b/script-resources/markdown2htmldoc/main.js index 53fe9dc..d027f5a 100755 --- a/script-resources/markdown2htmldoc/main.js +++ b/script-resources/markdown2htmldoc/main.js @@ -6,9 +6,9 @@ const markdownIt = require('markdown-it'); const markdownItTaskCheckbox = require('markdown-it-task-checkbox'); const markdownItEmoji = require('markdown-it-emoji'); const markdownItHeaderAnchors = require('./markdown-it-header-anchors'); -const Prism = require('prismjs'); -const PRISM_COMPONENTS = require('prismjs/components.js'); +const Prism = require('prismjs/components/prism-core'); const loadPrismLanguages = require('prismjs/components/'); +const PRISM_COMPONENTS = require('prismjs/components.js'); // TODO: integrate const PRISM_THEMES = Object.keys(PRISM_COMPONENTS.themes).filter( @@ -54,14 +54,14 @@ let args = parser.parseArgs(); let md = markdownIt({ html: true, linkify: true, - highlight: (str, lang) => { - if (lang.length > 0) { + highlight: (code, lang) => { + if (lang) { loadPrismLanguages([lang]); if (Object.prototype.hasOwnProperty.call(Prism.languages, lang)) { - return Prism.highlight(str, Prism.languages[lang], lang); + return Prism.highlight(code, Prism.languages[lang], lang); } } - return str; + return null; }, }); md.use(markdownItTaskCheckbox); From 03cc0a522108a26151b887b6474280257526f2ae Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 6 Sep 2020 19:29:03 +0300 Subject: [PATCH 368/713] [scripts/markdown2htmldoc] load all languages --- script-resources/markdown2htmldoc/main.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/script-resources/markdown2htmldoc/main.js b/script-resources/markdown2htmldoc/main.js index d027f5a..97ef94e 100755 --- a/script-resources/markdown2htmldoc/main.js +++ b/script-resources/markdown2htmldoc/main.js @@ -51,15 +51,14 @@ parser.addArgument('--script', { let args = parser.parseArgs(); +loadPrismLanguages(); // loads all languages + let md = markdownIt({ html: true, linkify: true, highlight: (code, lang) => { - if (lang) { - loadPrismLanguages([lang]); - if (Object.prototype.hasOwnProperty.call(Prism.languages, lang)) { - return Prism.highlight(code, Prism.languages[lang], lang); - } + if (lang && Object.prototype.hasOwnProperty.call(Prism.languages, lang)) { + return Prism.highlight(code, Prism.languages[lang], lang); } return null; }, From d0bc803bcc785f6363ed55528baeb4050c2e00e5 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 6 Sep 2020 21:28:24 +0300 Subject: [PATCH 369/713] [colorschemes] add a Prism.js theme --- colorschemes/Makefile | 6 +- colorschemes/_theme.py | 11 ++ colorschemes/out/prismjs-theme.css | 126 ++++++++++++++++++++++ colorschemes/out/variables.css | 24 +++++ colorschemes/prismjs-theme-src.css | 125 +++++++++++++++++++++ colorschemes/prismjs-theme.css.py | 14 +++ colorschemes/variables.css.py | 8 ++ nvim/after/ftplugin/markdown.vim | 2 + script-resources/markdown2htmldoc/main.js | 14 ++- 9 files changed, 323 insertions(+), 7 deletions(-) create mode 100644 colorschemes/out/prismjs-theme.css create mode 100644 colorschemes/out/variables.css create mode 100644 colorschemes/prismjs-theme-src.css create mode 100755 colorschemes/prismjs-theme.css.py create mode 100755 colorschemes/variables.css.py diff --git a/colorschemes/Makefile b/colorschemes/Makefile index 8d90804..e61e976 100644 --- a/colorschemes/Makefile +++ b/colorschemes/Makefile @@ -9,7 +9,7 @@ MAKEFLAGS += --no-builtin-rules .PHONY: all clean OUT_DIR := out -OUT_FILES := iterm.itermcolors kitty.conf vim.vim setvtrgb.txt zsh.zsh termux.properties +OUT_FILES := iterm.itermcolors kitty.conf vim.vim setvtrgb.txt zsh.zsh termux.properties variables.css prismjs-theme.css all: $(OUT_DIR) $(addprefix $(OUT_DIR)/,$(OUT_FILES)) @@ -19,5 +19,7 @@ clean: out: mkdir -p $@ -$(OUT_DIR)/%: %.py +$(OUT_DIR)/%: %.py _theme.py ./$< > $@ + +$(OUT_DIR)/prismjs-theme.css: prismjs-theme-src.css diff --git a/colorschemes/_theme.py b/colorschemes/_theme.py index ed7df33..a467d1e 100644 --- a/colorschemes/_theme.py +++ b/colorschemes/_theme.py @@ -37,3 +37,14 @@ ansi_colors = [ ] link_color = ansi_colors[0xC] + +css_variables_prefix = "dotfiles-colorscheme-" +css_variables = { + "bg": bg, + "fg": fg, + "selection-bg": selection_bg, + "selection-fg": selection_fg, + "cursor-bg": cursor_bg, + "cursor-fg": cursor_fg, + **{"base-{:02X}".format(index): color for index, color in enumerate(base16_colors)}, +} diff --git a/colorschemes/out/prismjs-theme.css b/colorschemes/out/prismjs-theme.css new file mode 100644 index 0000000..5c2d831 --- /dev/null +++ b/colorschemes/out/prismjs-theme.css @@ -0,0 +1,126 @@ +/* Based on */ + +.markdown-body code, +.markdown-body pre { + font-family: 'Ubuntu Mono', monospace; + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; +} + +.markdown-body pre { + background-color: #2d2d2d; + color: #d3d0c8; +} + +.markdown-body pre::-moz-selection, +.markdown-body pre ::-moz-selection { + background-color: #515151; + color: #d3d0c8; +} + +.markdown-body pre::selection, +.markdown-body pre ::selection { + background-color: #515151; + color: #d3d0c8; +} + +.token.symbol { + color: #905; +} + +.token.bold { + font-weight: bold; +} + +.token.italic { + font-style: italic; +} + +.token.url { + text-decoration: underline; +} + +.token.entity { + cursor: help; +} + +.token.attr-equals, +.token.punctuation, +.token.operator, +.token.combinator { + color: #d3d0c8; +} + +.token.comment, +.token.doctype, +.token.doctype > .token.punctuation, +.token.cdata, +.token.cdata > .token.punctuation, +.token.prolog, +.token.blockquote, +.token.hr { + color: #747369; +} + +.token.variable, +.token.parameter, +.token.constant, +.token.tag, +.token.property, +.token.deleted, +.token.selector { + color: #f2777a; +} + +.token.boolean, +.token.number, +.token.unit, +.token.attr-name, +.token.color.hexcode, +.token.list { + color: #f99157; +} + +.token.class-name, +.token.maybe-class-name, +.token.builtin, +.token.variable.dom, +.token.macro, +.token.interpolation-punctuation, +.language-json .token.property { + color: #ffcc66; +} + +.token.string, +.token.char, +.token.attr-value, +.token.attr-value > .token.punctuation:not(.attr-equals), +.token.inserted { + color: #99cc99; +} + +.token.regex, +.token.pseudo-class, +.token.pseudo-element, +.token.entity, +.token.important { + color: #66cccc; +} + +.token.function, +.token.coord, +.token.url, +.token.heading, +.token.title, +.token.heading > .token.important, +.token.title > .token.punctuation { + color: #6699cc; +} + +.token.keyword, +.token.operator.arrow, +.token.rule { + color: #cc99cc; +} + diff --git a/colorschemes/out/variables.css b/colorschemes/out/variables.css new file mode 100644 index 0000000..7a7d1d4 --- /dev/null +++ b/colorschemes/out/variables.css @@ -0,0 +1,24 @@ +:root { + --dotfiles-colorscheme-bg: #2d2d2d; + --dotfiles-colorscheme-fg: #d3d0c8; + --dotfiles-colorscheme-selection-bg: #515151; + --dotfiles-colorscheme-selection-fg: #d3d0c8; + --dotfiles-colorscheme-cursor-bg: #d3d0c8; + --dotfiles-colorscheme-cursor-fg: #2d2d2d; + --dotfiles-colorscheme-base-00: #2d2d2d; + --dotfiles-colorscheme-base-01: #393939; + --dotfiles-colorscheme-base-02: #515151; + --dotfiles-colorscheme-base-03: #747369; + --dotfiles-colorscheme-base-04: #a09f93; + --dotfiles-colorscheme-base-05: #d3d0c8; + --dotfiles-colorscheme-base-06: #e8e6df; + --dotfiles-colorscheme-base-07: #f2f0ec; + --dotfiles-colorscheme-base-08: #f2777a; + --dotfiles-colorscheme-base-09: #f99157; + --dotfiles-colorscheme-base-0A: #ffcc66; + --dotfiles-colorscheme-base-0B: #99cc99; + --dotfiles-colorscheme-base-0C: #66cccc; + --dotfiles-colorscheme-base-0D: #6699cc; + --dotfiles-colorscheme-base-0E: #cc99cc; + --dotfiles-colorscheme-base-0F: #d27b53; +} diff --git a/colorschemes/prismjs-theme-src.css b/colorschemes/prismjs-theme-src.css new file mode 100644 index 0000000..4215cda --- /dev/null +++ b/colorschemes/prismjs-theme-src.css @@ -0,0 +1,125 @@ +/* Based on */ + +.markdown-body code, +.markdown-body pre { + font-family: 'Ubuntu Mono', monospace; + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; +} + +.markdown-body pre { + background-color: var(--dotfiles-colorscheme-bg); + color: var(--dotfiles-colorscheme-fg); +} + +.markdown-body pre::-moz-selection, +.markdown-body pre ::-moz-selection { + background-color: var(--dotfiles-colorscheme-selection-bg); + color: var(--dotfiles-colorscheme-selection-fg); +} + +.markdown-body pre::selection, +.markdown-body pre ::selection { + background-color: var(--dotfiles-colorscheme-selection-bg); + color: var(--dotfiles-colorscheme-selection-fg); +} + +.token.symbol { + color: #905; +} + +.token.bold { + font-weight: bold; +} + +.token.italic { + font-style: italic; +} + +.token.url { + text-decoration: underline; +} + +.token.entity { + cursor: help; +} + +.token.attr-equals, +.token.punctuation, +.token.operator, +.token.combinator { + color: var(--dotfiles-colorscheme-fg); +} + +.token.comment, +.token.doctype, +.token.doctype > .token.punctuation, +.token.cdata, +.token.cdata > .token.punctuation, +.token.prolog, +.token.blockquote, +.token.hr { + color: var(--dotfiles-colorscheme-base-03); +} + +.token.variable, +.token.parameter, +.token.constant, +.token.tag, +.token.property, +.token.deleted, +.token.selector { + color: var(--dotfiles-colorscheme-base-08); +} + +.token.boolean, +.token.number, +.token.unit, +.token.attr-name, +.token.color.hexcode, +.token.list { + color: var(--dotfiles-colorscheme-base-09); +} + +.token.class-name, +.token.maybe-class-name, +.token.builtin, +.token.variable.dom, +.token.macro, +.token.interpolation-punctuation, +.language-json .token.property { + color: var(--dotfiles-colorscheme-base-0A); +} + +.token.string, +.token.char, +.token.attr-value, +.token.attr-value > .token.punctuation:not(.attr-equals), +.token.inserted { + color: var(--dotfiles-colorscheme-base-0B); +} + +.token.regex, +.token.pseudo-class, +.token.pseudo-element, +.token.entity, +.token.important { + color: var(--dotfiles-colorscheme-base-0C); +} + +.token.function, +.token.coord, +.token.url, +.token.heading, +.token.title, +.token.heading > .token.important, +.token.title > .token.punctuation { + color: var(--dotfiles-colorscheme-base-0D); +} + +.token.keyword, +.token.operator.arrow, +.token.rule { + color: var(--dotfiles-colorscheme-base-0E); +} diff --git a/colorschemes/prismjs-theme.css.py b/colorschemes/prismjs-theme.css.py new file mode 100755 index 0000000..42b62b8 --- /dev/null +++ b/colorschemes/prismjs-theme.css.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import _theme as theme +import os + +with open(os.path.join(os.path.dirname(__file__), "prismjs-theme-src.css")) as f: + css_src = f.read() + +for var_name, color in theme.css_variables.items(): + css_src = css_src.replace( + "var(--{}{})".format(theme.css_variables_prefix, var_name), color + ) + +print(css_src) diff --git a/colorschemes/variables.css.py b/colorschemes/variables.css.py new file mode 100755 index 0000000..64c4609 --- /dev/null +++ b/colorschemes/variables.css.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 + +import _theme as theme + +print(":root {") +for var_name, color in theme.css_variables.items(): + print(" --{}{}: {};".format(theme.css_variables_prefix, var_name, color)) +print("}") diff --git a/nvim/after/ftplugin/markdown.vim b/nvim/after/ftplugin/markdown.vim index 82aa090..4fcafad 100644 --- a/nvim/after/ftplugin/markdown.vim +++ b/nvim/after/ftplugin/markdown.vim @@ -6,3 +6,5 @@ let &l:makeprg = 'markdown2htmldoc '.shellescape(s:src_file).' '.shellescape(s:o for s:arg in get(g:, 'dotfiles_markdown2htmldoc_options', []) let &l:makeprg .= ' '.shellescape(s:arg) endfor + +nnoremap Open %.html diff --git a/script-resources/markdown2htmldoc/main.js b/script-resources/markdown2htmldoc/main.js index 97ef94e..6a8b5a1 100755 --- a/script-resources/markdown2htmldoc/main.js +++ b/script-resources/markdown2htmldoc/main.js @@ -39,7 +39,7 @@ parser.addArgument('--no-default-stylesheets', { nargs: argparse.Const.SUPPRESS, }); parser.addArgument('--syntax-theme', { - choices: PRISM_THEMES, + choices: [...PRISM_THEMES, 'none', 'dotfiles'], }); parser.addArgument('--stylesheet', { @@ -78,7 +78,7 @@ let scriptsTexts = []; let syntaxThemeName = null; if (!args.get('no_default_stylesheets')) { - syntaxThemeName = 'prism'; + syntaxThemeName = 'dotfiles'; stylesheetsTexts.push( fs.readFileSync( require.resolve('github-markdown-css/github-markdown.css'), @@ -92,10 +92,14 @@ if (!args.get('no_default_stylesheets')) { } syntaxThemeName = args.get('syntax_theme') || syntaxThemeName; -if (syntaxThemeName) { +if (syntaxThemeName && syntaxThemeName !== 'none') { stylesheetsTexts.push( fs.readFileSync( - require.resolve(`prismjs/themes/${syntaxThemeName}.css`), + require.resolve( + syntaxThemeName === 'dotfiles' + ? '../../colorschemes/out/prismjs-theme.css' + : `prismjs/themes/${syntaxThemeName}.css`, + ), 'utf-8', ), ); @@ -125,7 +129,7 @@ ${renderedMarkdown} ${scriptsTexts.map((s) => ``).join('\n')} -`; +`.trim(); fs.writeFileSync( args.get('OUTPUT_FILE', 1), From 8c65e3b5a3cc7ff1491738a83de39738aa3776dc Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 6 Sep 2020 22:08:39 +0300 Subject: [PATCH 370/713] [scripts/copy-crosscode-emoji-url] change location of the config --- scripts/copy-crosscode-emoji-url | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index c4834a0..0dd5897 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -3,7 +3,7 @@ set -euo pipefail # shellcheck source=/dev/null -source ~/.config/copy-crosscode-emoji-url.conf.sh +source ~/.config/dotfiles/copy-crosscode-emoji-url.conf.sh data_refs=() data_urls=() From 90c01434efca13341ea209e644bc6a45a35e6a3a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 14 Sep 2020 17:45:20 +0300 Subject: [PATCH 371/713] [zsh] save the real "man" command to history when F1 is pressed --- scripts/fzf-search-manpage | 4 ++++ scripts/visman | 5 ++--- zsh/zle.zsh | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100755 scripts/fzf-search-manpage diff --git a/scripts/fzf-search-manpage b/scripts/fzf-search-manpage new file mode 100755 index 0000000..1199656 --- /dev/null +++ b/scripts/fzf-search-manpage @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +set -eu +# https://superuser.com/a/207474 +apropos . | fzf --no-multi --tiebreak=begin --query="$*" | sed -n 's/^\([^ ]\+\) \?(\([^)]\+\)).*$/\2 \1/p' diff --git a/scripts/visman b/scripts/visman index d14c278..6de69fe 100755 --- a/scripts/visman +++ b/scripts/visman @@ -1,4 +1,3 @@ -#!/bin/sh +#!/usr/bin/env sh -# https://superuser.com/a/207474 -man $(apropos . | fzf --no-multi --tiebreak=begin --query="$*" | sed -n 's/^\([^ ]\+\) \?(\([^)]\+\)).*$/\2 \1/p') +man $(fzf-search-manpage) diff --git a/zsh/zle.zsh b/zsh/zle.zsh index 74c3c4f..fd96c33 100644 --- a/zsh/zle.zsh +++ b/zsh/zle.zsh @@ -154,7 +154,9 @@ local words=("${(@z)BUFFER}") local cmd_name="${words[1]}" zle push-line - BUFFER="visman ${(q)cmd_name}" + local manpage="" + manpage="$(fzf-search-manpage "$cmd_name")" + BUFFER="man $manpage" zle accept-line } zle -N find-man-page _widget_find_man_page From f5966e9c4b238b2047af9a20fadbb12cf2be7658 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 19 Sep 2020 16:34:04 +0300 Subject: [PATCH 372/713] [nvim] add a mapping for switching keymaps along with customized versions of vim's keymaps --- nvim/keymap/russian-jcuken-custom.vim | 87 +++++++++++++++++++++++ nvim/keymap/ukrainian-jcuken-custom.vim | 92 +++++++++++++++++++++++++ nvim/plugin/editing.vim | 4 ++ 3 files changed, 183 insertions(+) create mode 100644 nvim/keymap/russian-jcuken-custom.vim create mode 100644 nvim/keymap/ukrainian-jcuken-custom.vim diff --git a/nvim/keymap/russian-jcuken-custom.vim b/nvim/keymap/russian-jcuken-custom.vim new file mode 100644 index 0000000..d56470f --- /dev/null +++ b/nvim/keymap/russian-jcuken-custom.vim @@ -0,0 +1,87 @@ +" Vim Keymap file for russian characters, layout 'jcuken', MS Windows variant +" (slightly incompatible with XFree86 'ru' keymap - makes use of NUMERO SIGN) +" Useful mainly with utf-8 but may work with other encodings + +" Maintainer: Artem Chuprina +" Last Changed: 2001 Jun 23 + +" All characters are given literally, conversion to another encoding (e.g., +" UTF-8) should work. +scriptencoding utf-8 + +let b:keymap_name = "ru" + +loadkeymap +~ Ё CYRILLIC CAPITAL LETTER IO +` ё CYRILLIC SMALL LETTER IO +F А CYRILLIC CAPITAL LETTER A +< Б CYRILLIC CAPITAL LETTER BE +D В CYRILLIC CAPITAL LETTER VE +U Г CYRILLIC CAPITAL LETTER GHE +L Д CYRILLIC CAPITAL LETTER DE +T Е CYRILLIC CAPITAL LETTER IE +: Ж CYRILLIC CAPITAL LETTER ZHE +P З CYRILLIC CAPITAL LETTER ZE +B И CYRILLIC CAPITAL LETTER I +Q Й CYRILLIC CAPITAL LETTER SHORT I +R К CYRILLIC CAPITAL LETTER KA +K Л CYRILLIC CAPITAL LETTER EL +V М CYRILLIC CAPITAL LETTER EM +Y Н CYRILLIC CAPITAL LETTER EN +J О CYRILLIC CAPITAL LETTER O +G П CYRILLIC CAPITAL LETTER PE +H Р CYRILLIC CAPITAL LETTER ER +C С CYRILLIC CAPITAL LETTER ES +N Т CYRILLIC CAPITAL LETTER TE +E У CYRILLIC CAPITAL LETTER U +A Ф CYRILLIC CAPITAL LETTER EF +{ Х CYRILLIC CAPITAL LETTER HA +W Ц CYRILLIC CAPITAL LETTER TSE +X Ч CYRILLIC CAPITAL LETTER CHE +I Ш CYRILLIC CAPITAL LETTER SHA +O Щ CYRILLIC CAPITAL LETTER SHCHA +} Ъ CYRILLIC CAPITAL LETTER HARD SIGN +S Ы CYRILLIC CAPITAL LETTER YERU +M Ь CYRILLIC CAPITAL LETTER SOFT SIGN +\" Э CYRILLIC CAPITAL LETTER E +> Ю CYRILLIC CAPITAL LETTER YU +Z Я CYRILLIC CAPITAL LETTER YA +f а CYRILLIC SMALL LETTER A +, б CYRILLIC SMALL LETTER BE +d в CYRILLIC SMALL LETTER VE +u г CYRILLIC SMALL LETTER GHE +l д CYRILLIC SMALL LETTER DE +t е CYRILLIC SMALL LETTER IE +; ж CYRILLIC SMALL LETTER ZHE +p з CYRILLIC SMALL LETTER ZE +b и CYRILLIC SMALL LETTER I +q й CYRILLIC SMALL LETTER SHORT I +r к CYRILLIC SMALL LETTER KA +k л CYRILLIC SMALL LETTER EL +v м CYRILLIC SMALL LETTER EM +y н CYRILLIC SMALL LETTER EN +j о CYRILLIC SMALL LETTER O +g п CYRILLIC SMALL LETTER PE +h р CYRILLIC SMALL LETTER ER +c с CYRILLIC SMALL LETTER ES +n т CYRILLIC SMALL LETTER TE +e у CYRILLIC SMALL LETTER U +a ф CYRILLIC SMALL LETTER EF +[ х CYRILLIC SMALL LETTER HA +w ц CYRILLIC SMALL LETTER TSE +x ч CYRILLIC SMALL LETTER CHE +i ш CYRILLIC SMALL LETTER SHA +o щ CYRILLIC SMALL LETTER SHCHA +] ъ CYRILLIC SMALL LETTER HARD SIGN +s ы CYRILLIC SMALL LETTER YERU +m ь CYRILLIC SMALL LETTER SOFT SIGN +' э CYRILLIC SMALL LETTER E +. ю CYRILLIC SMALL LETTER YU +z я CYRILLIC SMALL LETTER YA +@ " +# № NUMERO SIGN +$ ; +^ : +& ? +/ . +? , diff --git a/nvim/keymap/ukrainian-jcuken-custom.vim b/nvim/keymap/ukrainian-jcuken-custom.vim new file mode 100644 index 0000000..68600db --- /dev/null +++ b/nvim/keymap/ukrainian-jcuken-custom.vim @@ -0,0 +1,92 @@ +" Vim Keymap file for ukrainian characters, layout 'jcuken', MS Windows variant +" (slightly incompatible with XFree86 'uk' keymap - makes use of NUMERO SIGN) +" Derived from russian-jcuken.vim by Artem Chuprina +" Useful mainly with utf-8 but may work with other encodings + +" Maintainer: Anatoli Sakhnik +" Last Changed: 2007 Nov 11 + +" All characters are given literally, conversion to another encoding (e.g., +" UTF-8) should work. +scriptencoding utf-8 + +let b:keymap_name = "uk" + +loadkeymap +~ ~ +` ' +F А CYRILLIC CAPITAL LETTER A +< Б CYRILLIC CAPITAL LETTER BE +D В CYRILLIC CAPITAL LETTER VE +U Г CYRILLIC CAPITAL LETTER GHE +L Д CYRILLIC CAPITAL LETTER DE +T Е CYRILLIC CAPITAL LETTER IE +: Ж CYRILLIC CAPITAL LETTER ZHE +P З CYRILLIC CAPITAL LETTER ZE +B И CYRILLIC CAPITAL LETTER I +Q Й CYRILLIC CAPITAL LETTER SHORT I +R К CYRILLIC CAPITAL LETTER KA +K Л CYRILLIC CAPITAL LETTER EL +V М CYRILLIC CAPITAL LETTER EM +Y Н CYRILLIC CAPITAL LETTER EN +J О CYRILLIC CAPITAL LETTER O +G П CYRILLIC CAPITAL LETTER PE +H Р CYRILLIC CAPITAL LETTER ER +C С CYRILLIC CAPITAL LETTER ES +N Т CYRILLIC CAPITAL LETTER TE +E У CYRILLIC CAPITAL LETTER U +A Ф CYRILLIC CAPITAL LETTER EF +{ Х CYRILLIC CAPITAL LETTER HA +W Ц CYRILLIC CAPITAL LETTER TSE +X Ч CYRILLIC CAPITAL LETTER CHE +I Ш CYRILLIC CAPITAL LETTER SHA +O Щ CYRILLIC CAPITAL LETTER SHCHA +} Ї CYRILLIC CAPITAL LETTER YI +S І CYRILLIC CAPITAL LETTER BYELORUSSION-UKRAINIAN I +M Ь CYRILLIC CAPITAL LETTER SOFT SIGN +\" Є CYRILLIC CAPITAL LETTER UKRAINIAN IE +> Ю CYRILLIC CAPITAL LETTER YU +Z Я CYRILLIC CAPITAL LETTER YA +| Ґ CYRILLIC CAPITAL LETTER GHE WITH UPTURN +f а CYRILLIC SMALL LETTER A +, б CYRILLIC SMALL LETTER BE +d в CYRILLIC SMALL LETTER VE +u г CYRILLIC SMALL LETTER GHE +l д CYRILLIC SMALL LETTER DE +t е CYRILLIC SMALL LETTER IE +; ж CYRILLIC SMALL LETTER ZHE +p з CYRILLIC SMALL LETTER ZE +b и CYRILLIC SMALL LETTER I +q й CYRILLIC SMALL LETTER SHORT I +r к CYRILLIC SMALL LETTER KA +k л CYRILLIC SMALL LETTER EL +v м CYRILLIC SMALL LETTER EM +y н CYRILLIC SMALL LETTER EN +j о CYRILLIC SMALL LETTER O +g п CYRILLIC SMALL LETTER PE +h р CYRILLIC SMALL LETTER ER +c с CYRILLIC SMALL LETTER ES +n т CYRILLIC SMALL LETTER TE +e у CYRILLIC SMALL LETTER U +a ф CYRILLIC SMALL LETTER EF +[ х CYRILLIC SMALL LETTER HA +w ц CYRILLIC SMALL LETTER TSE +x ч CYRILLIC SMALL LETTER CHE +i ш CYRILLIC SMALL LETTER SHA +o щ CYRILLIC SMALL LETTER SHCHA +] ї CYRILLIC SMALL LETTER YI +s і CYRILLIC SMALL LETTER BYELORUSSION-UKRAINIAN I +m ь CYRILLIC SMALL LETTER SOFT SIGN +' є CYRILLIC SMALL LETTER UKRAINIAN IE +. ю CYRILLIC SMALL LETTER YU +z я CYRILLIC SMALL LETTER YA +\\ ґ CYRILLIC SMALL LETTER GHE WITH UPTURN +@ " +# № NUMERO SIGN +$ ; +^ : +& ? +/ . +? , +~ ~ +~~ Stress diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index bd06d2f..ab8ca6b 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -105,6 +105,10 @@ set commentstring=//%s nnoremap nnoremap + nnoremap kk set keymap& + nnoremap kr set keymap=russian-jcuken-custom + nnoremap ku set keymap=ukrainian-jcuken-custom + " }}} From 38238eb817c1ba17256e074c76658926f22cb7a6 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 25 Sep 2020 08:48:29 +0300 Subject: [PATCH 373/713] [nvim] fix the "E488: Trailing characters" error when pressing K with coc.nvim --- nvim/plugin/completion.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nvim/plugin/completion.vim b/nvim/plugin/completion.vim index c2969b9..a339936 100644 --- a/nvim/plugin/completion.vim +++ b/nvim/plugin/completion.vim @@ -21,11 +21,12 @@ endif return index(g:coc_filetypes, &filetype) >= 0 endfunction + command -nargs=* CocKeywordprg call CocAction('doHover') augroup vimrc-coc autocmd! autocmd FileType * if IsCocEnabled() \|let &l:formatexpr = "CocAction('formatSelected')" - \|let &l:keywordprg = ":call CocAction('doHover')" + \|let &l:keywordprg = ":CocKeywordprg" \|endif autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') augroup end From bd04f977c4aa7f224b39bc596c9f5c29c2aff60b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 25 Sep 2020 08:50:54 +0300 Subject: [PATCH 374/713] [nvim] enable rust-analyzer.cargo.loadOutDirsFromCheck --- nvim/coc-languages/rust.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nvim/coc-languages/rust.vim b/nvim/coc-languages/rust.vim index 6f2d545..343950d 100644 --- a/nvim/coc-languages/rust.vim +++ b/nvim/coc-languages/rust.vim @@ -6,8 +6,11 @@ let g:coc_user_config['rust-analyzer'] = { \ 'chainingHints': v:false, \ }, \ 'checkOnSave': { -\ 'command': 'clippy' +\ 'command': 'clippy', \ }, +\ 'cargo': { +\ 'loadOutDirsFromCheck': v:true, +\ } \ } " let g:coc_global_extensions += ['coc-rls'] From 13d28052056940f4820ce72dd9e8146827c2fc7f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 2 Oct 2020 17:34:21 +0300 Subject: [PATCH 375/713] [scripts] add the prime-run script along with a completion function --- scripts/prime-run | 2 ++ zsh/completions/_prime-run | 4 ++++ 2 files changed, 6 insertions(+) create mode 100755 scripts/prime-run create mode 100644 zsh/completions/_prime-run diff --git a/scripts/prime-run b/scripts/prime-run new file mode 100755 index 0000000..cfd112a --- /dev/null +++ b/scripts/prime-run @@ -0,0 +1,2 @@ +#!/bin/sh +__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia exec "$@" diff --git a/zsh/completions/_prime-run b/zsh/completions/_prime-run new file mode 100644 index 0000000..6347353 --- /dev/null +++ b/zsh/completions/_prime-run @@ -0,0 +1,4 @@ +#compdef prime-run + +_arguments \ + '*:: : _normal -p $service' From 705c794ea9c4acc1a2461afbcbb9fd3338d48975 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 2 Oct 2020 17:34:53 +0300 Subject: [PATCH 376/713] [misc] add Rofi configuration --- misc/rofi.config.rasi | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 misc/rofi.config.rasi diff --git a/misc/rofi.config.rasi b/misc/rofi.config.rasi new file mode 100644 index 0000000..1305d5e --- /dev/null +++ b/misc/rofi.config.rasi @@ -0,0 +1,5 @@ +configuration { + modi: "window,run,drun,ssh"; + font: "monospace 16"; + kb-cancel: "Control+g,Control+bracketleft,!Escape"; +} From f4a726a2c98e37c4b780b4d224550397d14c5917 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 4 Oct 2020 01:55:58 +0300 Subject: [PATCH 377/713] [zsh] add an option for disabling the colorscheme setter --- zsh/colorscheme.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zsh/colorscheme.zsh b/zsh/colorscheme.zsh index bd4d4a4..b941604 100644 --- a/zsh/colorscheme.zsh +++ b/zsh/colorscheme.zsh @@ -88,4 +88,6 @@ set-my-colorscheme() { fi } -set-my-colorscheme +if [[ -z "$DOTFILES_DISABLE_MY_COLORSCHEME" ]]; then + set-my-colorscheme +fi From db7d25f480a31d1af3ecd61abf243a0c310a83f2 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 4 Oct 2020 16:15:27 +0300 Subject: [PATCH 378/713] [scripts/copy-crosscode-emoji-url] rewrite in Python and reuse common bits of the query-bookmarks script --- script-resources/common_script_utils.py | 80 +++++++++++++++++++++++++ scripts/copy-crosscode-emoji-url | 75 ++++++++++++++--------- scripts/discord-whois | 1 + scripts/query-bookmarks | 62 +++++-------------- 4 files changed, 143 insertions(+), 75 deletions(-) create mode 100644 script-resources/common_script_utils.py diff --git a/script-resources/common_script_utils.py b/script-resources/common_script_utils.py new file mode 100644 index 0000000..9285ba3 --- /dev/null +++ b/script-resources/common_script_utils.py @@ -0,0 +1,80 @@ +import sys +import os +import subprocess + + +def platform_not_supported_error(): + raise Exception("platform '{}' is not supported!".format(sys.platform)) + + +def run_chooser(choices, prompt=None, async_read=False): + if sys.platform == "darwin": + process_args = ["choose", "-i"] + elif os.name == "posix": + process_args = ["rofi", "-dmenu", "-i", "-format", "i"] + if prompt is not None: + process_args += ["-p", prompt] + if async_read: + process_args += ["-async-pre-read", "0"] + else: + platform_not_supported_error() + + chooser_process = subprocess.Popen( + process_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE + ) + + with chooser_process.stdin as pipe: + for choice in choices: + assert "\n" not in choice + pipe.write(choice.encode()) + pipe.write(b"\n") + + exit_code = chooser_process.wait() + if exit_code != 0: + raise Exception("chooser process failed with exit code {}".format(exit_code)) + + chosen_index = int( + # an extra newline is inserted by rofi for whatever reason + chooser_process.stdout.read().rstrip(b"\n") + ) + + return chosen_index + + +def send_notification(title, message, url=None): + if sys.platform == "darwin": + process_args = [ + "terminal-notifier", + "-title", + title, + "-message", + message, + "-open", + ] + if url is not None: + process_args += [url] + elif os.name == "posix": + process_args = [ + "notify-send", + "--icon=utilities-terminal", + "--expire-time=3000", + title, + message, + ] + else: + platform_not_supported_error() + + subprocess.run(process_args, check=True) + + +def set_clipboard(text): + # TODO: somehow merge program selection with the logic in `zsh/functions.zsh` + if sys.platform == "darwin": + process_args = ["pbcopy"] + elif os.name == "posix": + process_args = ["xsel", "--clipboard", "--input"] + # process_args = ["xclip", "-in", "-selection", "clipboard"] + else: + platform_not_supported_error() + + subprocess.run(process_args, input=text.encode(), check=True) diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index 0dd5897..2937290 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -1,33 +1,50 @@ -#!/usr/bin/env bash +#!/usr/bin/env python3 -set -euo pipefail +import sys +import os +from pathlib import Path +from configparser import ConfigParser +import requests -# shellcheck source=/dev/null -source ~/.config/dotfiles/copy-crosscode-emoji-url.conf.sh - -data_refs=() -data_urls=() -data_titles=() - -read_line() { - IFS= read -r "$@" -} - -# https://stackoverflow.com/a/15692004/12005228 -print_lines() { - eval "printf '%s\n' \"\${$1[@]}\"" -} - -while read_line ref && read_line url && read_line title; do - data_refs+=("$ref") - data_urls+=("$url") - data_titles+=("$title") -done < <( - curl --location --fail --max-time 10 "$CCBOT_EMOTE_REGISTRY_DUMP_URL" | - jq -r '.list[] | select(.safe) | .ref, .url, "\(.ref) [\(.guild_name)]"' +sys.path.insert( + 1, os.path.join(os.path.dirname(os.path.dirname(__file__)), "script-resources") ) -if index="$(print_lines data_titles | rofi -dmenu -i -p cc-emoji -format i)"; then - echo -n "${data_urls[$index]}" | xsel --clipboard --input - notify-send --icon=utilities-terminal --expire-time=3000 "$0" "copied URL of ${data_refs[$index]} to clipboard!" -fi +import common_script_utils # noqa F401 + + +if os.name == "posix": + config_path = Path.home() / ".config" / "dotfiles" / "copy-crosscode-emoji-url.ini" +else: + common_script_utils.platform_not_supported_error() +config = ConfigParser(interpolation=None) +config.read(config_path) + + +data = [] + + +def emote_downloader_and_iterator(): + global data + + response = requests.get( + config["default"]["ccbot_emote_registry_dump_url"], timeout=3 + ) + response.raise_for_status() + + data = response.json() + assert data["version"] == 1 + + for emote in data["list"]: + yield "{emote[ref]} [{emote[guild_name]}]".format(emote=emote) + + +chosen_index = common_script_utils.run_chooser( + emote_downloader_and_iterator(), prompt="emote", async_read=True +) +chosen_emote = data["list"][chosen_index] +common_script_utils.set_clipboard(chosen_emote["url"]) +common_script_utils.send_notification( + os.path.basename(__file__), + "copied URL of {} to clipboard!".format(chosen_emote["ref"]), +) diff --git a/scripts/discord-whois b/scripts/discord-whois index c9aedf4..6304df1 100755 --- a/scripts/discord-whois +++ b/scripts/discord-whois @@ -37,6 +37,7 @@ user_snowflake = int(sys.argv[1]) response = requests.get( "https://discordapp.com/api/users/{}".format(user_snowflake), headers={"Authorization": "Bot {}".format(bot_token)}, + timeout=3, ) try: response.raise_for_status() diff --git a/scripts/query-bookmarks b/scripts/query-bookmarks index b4040f3..cfcf830 100755 --- a/scripts/query-bookmarks +++ b/scripts/query-bookmarks @@ -15,37 +15,20 @@ from configparser import ConfigParser import tempfile import shutil import sqlite3 -import subprocess + +sys.path.insert( + 1, os.path.join(os.path.dirname(os.path.dirname(__file__)), "script-resources") +) + +import common_script_utils # noqa F401 -# TODO: somehow merge `chooser_program` selection with the logic in `zsh/functions.zsh` if sys.platform == "darwin": firefox_home = Path.home() / "Library" / "Application Support" / "Firefox" - chooser_program = ["choose", "-i"] - clipboard_copy_program = ["pbcopy"] - - def notify_program_args(title, message, url): - return ["terminal-notifier", "-title", title, "-message", message, "-open", url] - - elif os.name == "posix": firefox_home = Path.home() / ".mozilla" / "firefox" - chooser_program = ["rofi", "-dmenu", "-i", "-p", "bookmark", "-format", "i"] - clipboard_copy_program = ["xsel", "--clipboard", "--input"] - # clipboard_copy_program = ["xclip", "-in", "-selection", "clipboard"] - - def notify_program_args(title, message, url): - return [ - "notify-send", - "--icon=utilities-terminal", - "--expire-time=3000", - title, - message, - ] - - else: - raise Exception("platform '{}' is not supported!".format(sys.platform)) + common_script_utils.platform_not_supported_error() profiles_config = ConfigParser(interpolation=None) @@ -91,28 +74,15 @@ finally: os.remove(db_copy_path) -chooser_process = subprocess.Popen( - chooser_program, stdin=subprocess.PIPE, stdout=subprocess.PIPE +chosen_index = common_script_utils.run_chooser( + ("{} \u2014\u2014 {}".format(title, url) for title, url in chooser_entries), + prompt="bookmark", ) -with chooser_process.stdin as pipe: - for title, url in chooser_entries: - pipe.write("{} \u2014\u2014 {}\n".format(title, url).encode()) +_title, url = chooser_entries[chosen_index] +print(url) -exit_code = chooser_process.wait() -if exit_code == 0: - chosen_index = int( - # an extra newline is inserted by rofi for whatever reason - chooser_process.stdout.read().rstrip(b"\n") - ) - _title, url = chooser_entries[chosen_index] - print(url) - - subprocess.run(clipboard_copy_program, input=url.encode(), check=True) - subprocess.run( - notify_program_args( - "query-bookmarks.py", "bookmark URL copied to clipboard!", url - ), - input=url.encode(), - check=True, - ) +common_script_utils.set_clipboard(url) +common_script_utils.send_notification( + os.path.basename(__file__), "bookmark URL copied to clipboard!", url +) From 0e1f13cc7b86c509bad68758a9b309a23419bf89 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 4 Oct 2020 19:26:44 +0300 Subject: [PATCH 379/713] [zsh] add a deswapping function for Linux --- zsh/functions.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index e62162d..db8190c 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -1,6 +1,5 @@ #!/usr/bin/env zsh - count() { echo "$#"; } bytecount() { wc -c "$@" | numfmt --to=iec-i; } @@ -91,3 +90,7 @@ for format_name format in "${(kv)date_formats[@]}"; do done; unset format_name format unset date_formats + +if (( _is_linux )) && command_exists swapoff && command_exists swapon; then + deswap() { sudo sh -c 'swapoff --all && swapon --all'; } +fi From 6f4b85af3346e8b6d818d3238a1cae7b10f30235 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 4 Oct 2020 19:27:16 +0300 Subject: [PATCH 380/713] [colorschemes] add a generator for the VSCode terminal --- colorschemes/Makefile | 4 +-- .../out/vscode-colorCustomizations.json | 23 ++++++++++++ .../vscode-colorCustomizations.json.py | 35 +++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 colorschemes/out/vscode-colorCustomizations.json create mode 100755 colorschemes/vscode-colorCustomizations.json.py diff --git a/colorschemes/Makefile b/colorschemes/Makefile index e61e976..d2fa14e 100644 --- a/colorschemes/Makefile +++ b/colorschemes/Makefile @@ -9,7 +9,7 @@ MAKEFLAGS += --no-builtin-rules .PHONY: all clean OUT_DIR := out -OUT_FILES := iterm.itermcolors kitty.conf vim.vim setvtrgb.txt zsh.zsh termux.properties variables.css prismjs-theme.css +OUT_FILES := iterm.itermcolors kitty.conf vim.vim setvtrgb.txt zsh.zsh termux.properties variables.css prismjs-theme.css vscode-colorCustomizations.json all: $(OUT_DIR) $(addprefix $(OUT_DIR)/,$(OUT_FILES)) @@ -20,6 +20,6 @@ out: mkdir -p $@ $(OUT_DIR)/%: %.py _theme.py - ./$< > $@ + python3 ./$< > $@ $(OUT_DIR)/prismjs-theme.css: prismjs-theme-src.css diff --git a/colorschemes/out/vscode-colorCustomizations.json b/colorschemes/out/vscode-colorCustomizations.json new file mode 100644 index 0000000..8912830 --- /dev/null +++ b/colorschemes/out/vscode-colorCustomizations.json @@ -0,0 +1,23 @@ +{ + "terminal.background": "#2d2d2d", + "terminal.foreground": "#d3d0c8", + "terminal.selectionBackground": "#515151", + "terminalCursor.background": "#2d2d2d", + "terminalCursor.foreground": "#d3d0c8", + "terminal.ansiBlack": "#2d2d2d", + "terminal.ansiRed": "#f2777a", + "terminal.ansiGreen": "#99cc99", + "terminal.ansiYellow": "#ffcc66", + "terminal.ansiBlue": "#6699cc", + "terminal.ansiMagenta": "#cc99cc", + "terminal.ansiCyan": "#66cccc", + "terminal.ansiWhite": "#d3d0c8", + "terminal.ansiBrightBlack": "#747369", + "terminal.ansiBrightRed": "#f2777a", + "terminal.ansiBrightGreen": "#99cc99", + "terminal.ansiBrightYellow": "#ffcc66", + "terminal.ansiBrightBlue": "#6699cc", + "terminal.ansiBrightMagenta": "#cc99cc", + "terminal.ansiBrightCyan": "#66cccc", + "terminal.ansiBrightWhite": "#f2f0ec" +} diff --git a/colorschemes/vscode-colorCustomizations.json.py b/colorschemes/vscode-colorCustomizations.json.py new file mode 100755 index 0000000..d139834 --- /dev/null +++ b/colorschemes/vscode-colorCustomizations.json.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + +import _theme as theme +import json + + +ANSI_COLOR_NAMES = [ + "Black", + "Red", + "Green", + "Yellow", + "Blue", + "Magenta", + "Cyan", + "White", +] + +colors = { + "terminal.background": theme.bg, + "terminal.foreground": theme.fg, + "terminal.selectionBackground": theme.selection_bg, + "terminalCursor.background": theme.cursor_fg, + "terminalCursor.foreground": theme.cursor_bg, +} + +for color_brightness in [False, True]: + for color_index, color_name in enumerate(ANSI_COLOR_NAMES): + color = theme.ansi_colors[ + color_index + int(color_brightness) * len(ANSI_COLOR_NAMES) + ] + colors[ + "terminal.ansi" + ("Bright" if color_brightness else "") + color_name + ] = color + +print(json.dumps(colors, ensure_ascii=False, indent=2)) From 5a5067b98c98468ff3fb4bc4442f51a5815091fa Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 4 Oct 2020 19:50:52 +0300 Subject: [PATCH 381/713] [colorschemes] add a generator for xfce4-terminal --- colorschemes/Makefile | 2 +- colorschemes/out/xfce4-terminal.theme | 13 +++++++++++++ colorschemes/xfce4-terminal.theme.py | 17 +++++++++++++++++ system/arch/PKGBUILD | 9 +++++---- 4 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 colorschemes/out/xfce4-terminal.theme create mode 100755 colorschemes/xfce4-terminal.theme.py diff --git a/colorschemes/Makefile b/colorschemes/Makefile index d2fa14e..a7e60cb 100644 --- a/colorschemes/Makefile +++ b/colorschemes/Makefile @@ -9,7 +9,7 @@ MAKEFLAGS += --no-builtin-rules .PHONY: all clean OUT_DIR := out -OUT_FILES := iterm.itermcolors kitty.conf vim.vim setvtrgb.txt zsh.zsh termux.properties variables.css prismjs-theme.css vscode-colorCustomizations.json +OUT_FILES := iterm.itermcolors kitty.conf vim.vim setvtrgb.txt zsh.zsh termux.properties variables.css prismjs-theme.css vscode-colorCustomizations.json xfce4-terminal.theme all: $(OUT_DIR) $(addprefix $(OUT_DIR)/,$(OUT_FILES)) diff --git a/colorschemes/out/xfce4-terminal.theme b/colorschemes/out/xfce4-terminal.theme new file mode 100644 index 0000000..34872c2 --- /dev/null +++ b/colorschemes/out/xfce4-terminal.theme @@ -0,0 +1,13 @@ +[Scheme] +Name=dmitmel's dotfiles colorscheme +ColorForeground=#d3d0c8 +ColorBackground=#2d2d2d +ColorCursorUseDefault=FALSE +ColorCursorForeground=#2d2d2d +ColorCursor=#d3d0c8 +ColorSelectionUseDefault=FALSE +ColorSelection=#d3d0c8 +ColorSelectionBackground=#515151 +TabActivityColor=#f2777a +ColorBoldUseDefault=TRUE +ColorPalette=#2d2d2d;#f2777a;#99cc99;#ffcc66;#6699cc;#cc99cc;#66cccc;#d3d0c8;#747369;#f2777a;#99cc99;#ffcc66;#6699cc;#cc99cc;#66cccc;#f2f0ec;#f99157;#d27b53;#393939;#515151;#a09f93;#e8e6df diff --git a/colorschemes/xfce4-terminal.theme.py b/colorschemes/xfce4-terminal.theme.py new file mode 100755 index 0000000..5775160 --- /dev/null +++ b/colorschemes/xfce4-terminal.theme.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 + +import _theme as theme + +print("[Scheme]") +print("Name=dmitmel's dotfiles colorscheme") +print("ColorForeground={}".format(theme.fg)) +print("ColorBackground={}".format(theme.bg)) +print("ColorCursorUseDefault=FALSE") +print("ColorCursorForeground={}".format(theme.cursor_fg)) +print("ColorCursor={}".format(theme.cursor_bg)) +print("ColorSelectionUseDefault=FALSE") +print("ColorSelection={}".format(theme.selection_fg)) +print("ColorSelectionBackground={}".format(theme.selection_bg)) +print("TabActivityColor={}".format(theme.ansi_colors[1])) +print("ColorBoldUseDefault=TRUE") +print("ColorPalette={}".format(";".join(theme.ansi_colors))) diff --git a/system/arch/PKGBUILD b/system/arch/PKGBUILD index b236ba2..1390f11 100644 --- a/system/arch/PKGBUILD +++ b/system/arch/PKGBUILD @@ -11,19 +11,20 @@ backup=() package() { cd "$(dirname "${BASH_SOURCE[0]}")/../files" - install -vDm644 ../../LICENSE -t "$pkgdir/usr/share/licenses/$pkgname" + install -vDm644 ../../LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}" _install_my_file -vDm644 etc/initcpio/hooks/bootmsg _install_my_file -vDm644 etc/initcpio/install/bootmsg _install_my_file -vDm644 etc/initcpio/hooks/consolecolors _install_my_file -vDm644 etc/initcpio/install/consolecolors - install -vdm750 "$pkgdir/etc/sudoers.d" + install -vdm750 "${pkgdir}/etc/sudoers.d" _install_my_file -vDm640 etc/sudoers.d/99_dmitmel_dotfiles _install_my_file -vDm644 etc/sysctl.d/50-dmitmel.conf _install_my_file -vDm644 etc/bootmsg - install -vDm644 ../../colorschemes/out/setvtrgb.txt "$pkgdir/etc/consolecolors" + install -vDm644 ../../colorschemes/out/setvtrgb.txt "${pkgdir}/etc/consolecolors" _install_my_file -vDm644 etc/locale.conf + install -vDm644 ../../colorschemes/out/xfce4-terminal.theme "${pkgdir}/usr/share/xfce4/terminal/colorschemes/${pkgname}.theme" } _install_my_file() { - install "$@" "$pkgdir/${*: -1}" + install "$@" "${pkgdir}/${*: -1}" } From b1f3d1e1abc28574b9b38c8610f7301832739acf Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 4 Oct 2020 19:53:03 +0300 Subject: [PATCH 382/713] [git] add shortcut for an empty initial commit --- git/gitconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/git/gitconfig b/git/gitconfig index 08867f3..b31aaa2 100644 --- a/git/gitconfig +++ b/git/gitconfig @@ -22,3 +22,4 @@ [alias] unstage = restore --staged + initial-commit = commit --message 'initial commit' --allow-empty From 659ae317769723a24448fc2c5ab15388fe9e075d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 7 Oct 2020 18:24:46 +0300 Subject: [PATCH 383/713] [tmux] enable mouse in tmux --- tmux/tmux.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tmux/tmux.conf b/tmux/tmux.conf index dadf25b..bd5be87 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -1 +1,2 @@ set -g default-terminal "tmux-256color" +set -g mouse on From ce1a7b23106c468157807560035a05706f34cc7e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 10 Oct 2020 20:07:18 +0300 Subject: [PATCH 384/713] [nvim] highlight the `as` keyword/operator as a keyword --- nvim/after/syntax/python.vim | 4 +--- nvim/after/syntax/rust.vim | 2 ++ nvim/colors/dotfiles.vim | 7 +++---- 3 files changed, 6 insertions(+), 7 deletions(-) create mode 100644 nvim/after/syntax/rust.vim diff --git a/nvim/after/syntax/python.vim b/nvim/after/syntax/python.vim index 5fa9647..2b6c632 100644 --- a/nvim/after/syntax/python.vim +++ b/nvim/after/syntax/python.vim @@ -1,4 +1,2 @@ -syn clear pythonOperator -syn match pythonOperator '\V=\|-\|+\|*\|@\|/\|%\|&\||\|^\|~\|<\|>\|!=' syn keyword pythonOperatorKeyword and in is not or -syn cluster pythonExpression add=pythonOperatorKeyword +hi def link pythonOperatorKeyword Keyword diff --git a/nvim/after/syntax/rust.vim b/nvim/after/syntax/rust.vim new file mode 100644 index 0000000..9d961c2 --- /dev/null +++ b/nvim/after/syntax/rust.vim @@ -0,0 +1,2 @@ +syn keyword rustOperatorKeyword as +hi def link rustOperatorKeyword Keyword diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 07ccfca..83e96a6 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -351,10 +351,9 @@ " }}} " Python {{{ - hi! link pythonBuiltinType Type - hi! link pythonBuiltinObj pythonFunction - hi! link pythonClassVar Variable - hi! link pythonOperatorKeyword Keyword + hi! link pythonBuiltinType Type + hi! link pythonBuiltinObj pythonFunction + hi! link pythonClassVar Variable " }}} " Ruby {{{ From fdbd9889911b4cb78dc81b97e865fcce51f0b556 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 11 Oct 2020 14:40:00 +0300 Subject: [PATCH 385/713] [misc] add Yay config --- misc/yay.config.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 misc/yay.config.json diff --git a/misc/yay.config.json b/misc/yay.config.json new file mode 100644 index 0000000..196f131 --- /dev/null +++ b/misc/yay.config.json @@ -0,0 +1,7 @@ +{ + "answerdiff": "All", + "completioninterval": 1, + "devel": true, + "removemake": "yes", + "sudoloop": true +} From 9f13090771f5d00f334df156b45ef810a76617ae Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 12 Oct 2020 18:33:10 +0300 Subject: [PATCH 386/713] [scripts/query-bookmarks] add folder support --- scripts/query-bookmarks | 58 ++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 12 deletions(-) diff --git a/scripts/query-bookmarks b/scripts/query-bookmarks index cfcf830..7c6e313 100755 --- a/scripts/query-bookmarks +++ b/scripts/query-bookmarks @@ -2,7 +2,6 @@ # helper script for query-bookmarks.sh # currently supports only Firefox -# folder support would be nice, though I doubt it is really useful # useful links: # http://kb.mozillazine.org/Profiles.ini_file # https://stackoverflow.com/a/740183/12005228 @@ -15,6 +14,7 @@ from configparser import ConfigParser import tempfile import shutil import sqlite3 +import collections sys.path.insert( 1, os.path.join(os.path.dirname(os.path.dirname(__file__)), "script-resources") @@ -41,6 +41,7 @@ if len(installs_sections) > 1: raise Exception("multiple Firefox installations are not supported!") profile_dir = firefox_home / profiles_config.get(installs_sections[0], "Default") +# should places.sqlite be used instead? db_path = profile_dir / "weave" / "bookmarks.sqlite" if not db_path.is_file(): raise Exception("'{}' is not a file".format(db_path)) @@ -59,27 +60,60 @@ try: db = sqlite3.connect(db_copy_path) urls = {} - for urlId, url in db.execute("SELECT id, url FROM urls"): - urls[urlId] = url + for url_id, url in db.execute("SELECT id, url FROM urls"): + urls[url_id] = url - for title, urlId, keyword in db.execute( - "SELECT title, urlId, keyword FROM items WHERE kind = 1 AND validity AND NOT isDeleted" + folders = {} + for folder_id, parent_folder_id, folder_title in db.execute( + "SELECT guid, parentGuid, title FROM items WHERE kind = 3 AND validity AND NOT isDeleted" ): - url = urls[urlId] - chooser_entries.append((title, url)) - if keyword is not None: - chooser_entries.append((keyword, url)) + folders[folder_id] = ( + parent_folder_id if parent_folder_id != folder_id else None, + folder_title, + ) + + for url_title, url_id, url_keyword, parent_folder_id in db.execute( + "SELECT title, urlId, keyword, parentGuid FROM items WHERE kind = 1 AND validity AND NOT isDeleted" + ): + url = urls[url_id] + + folder_path = collections.deque() + while parent_folder_id is not None: + folder = folders.get(parent_folder_id, None) + if folder is None: + # broken folder structure? + folder_path.clear() + break + parent_folder_id, folder_title = folder + if folder_title is not None: + folder_path.appendleft(folder_title) + + folder_path_str = ( + ("/" + "/".join(folder_path)) if len(folder_path) > 0 else None + ) + + chooser_entries.append((url_title, url, folder_path_str)) + if url_keyword is not None: + chooser_entries.append((url_keyword, url, folder_path_str)) finally: os.remove(db_copy_path) +def chooser_entries_iter(): + for title, url, folder_path_str in chooser_entries: + entry_items = [title, url] + if folder_path_str is not None: + entry_items.append(folder_path_str) + entry = " \u2014\u2014 ".join(entry_items) + yield entry + + chosen_index = common_script_utils.run_chooser( - ("{} \u2014\u2014 {}".format(title, url) for title, url in chooser_entries), - prompt="bookmark", + chooser_entries_iter(), prompt="bookmark" ) -_title, url = chooser_entries[chosen_index] +_title, url, _folder_path_str = chooser_entries[chosen_index] print(url) common_script_utils.set_clipboard(url) From 07d4c018aa50869483eba73a1082d9b1d9b0ee15 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 14 Oct 2020 21:38:41 +0300 Subject: [PATCH 387/713] [scripts/copy-crosscode-emoji-url] add an option for reading the emote registry dump from a file, make the config file optional --- script-resources/common_script_utils.py | 6 +++++ scripts/copy-crosscode-emoji-url | 34 ++++++++++++++++++++----- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/script-resources/common_script_utils.py b/script-resources/common_script_utils.py index 9285ba3..b96e195 100644 --- a/script-resources/common_script_utils.py +++ b/script-resources/common_script_utils.py @@ -1,6 +1,12 @@ import sys import os import subprocess +from pathlib import Path + + +if os.name == "posix": + DOTFILES_CONFIG_DIR = Path.home() / ".config" / "dotfiles" + DOTFILES_CACHE_DIR = Path.home() / ".cache" / "dotfiles" def platform_not_supported_error(): diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index 2937290..20bc752 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -2,9 +2,9 @@ import sys import os -from pathlib import Path from configparser import ConfigParser import requests +import json sys.path.insert( 1, os.path.join(os.path.dirname(os.path.dirname(__file__)), "script-resources") @@ -13,8 +13,16 @@ sys.path.insert( import common_script_utils # noqa F401 +DEFAULT_REGISTRY_DUMP_URL = ( + "https://stronghold.crosscode.ru/~crosscodebot/emote-registry-tmp-export.json" +) + + if os.name == "posix": - config_path = Path.home() / ".config" / "dotfiles" / "copy-crosscode-emoji-url.ini" + config_path = ( + common_script_utils.DOTFILES_CONFIG_DIR / "copy-crosscode-emoji-url.ini" + ) + default_registry_dump_file = common_script_utils.DOTFILES_CACHE_DIR / "dotfiles" else: common_script_utils.platform_not_supported_error() config = ConfigParser(interpolation=None) @@ -27,12 +35,26 @@ data = [] def emote_downloader_and_iterator(): global data - response = requests.get( - config["default"]["ccbot_emote_registry_dump_url"], timeout=3 + registry_dump_file = config.get( + "default", "ccbot_emote_registry_dump_file", fallback=None ) - response.raise_for_status() + if registry_dump_file is not None: + registry_dump_file = os.path.expanduser(registry_dump_file) + else: + registry_dump_file = default_registry_dump_file + + registry_dump_url = config.get( + "default", "ccbot_emote_registry_dump_url", fallback=DEFAULT_REGISTRY_DUMP_URL + ) + + try: + with open(registry_dump_file, "r") as f: + data = json.load(f) + except FileNotFoundError: + response = requests.get(registry_dump_url, timeout=10) + response.raise_for_status() + data = response.json() - data = response.json() assert data["version"] == 1 for emote in data["list"]: From 93c9925a03afb79d05f1d58b259de14fe54db3bc Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 15 Oct 2020 19:14:15 +0300 Subject: [PATCH 388/713] [nvim] make colorscheme improvements... --- nvim/colors/dotfiles.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 83e96a6..9c23aa0 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -333,6 +333,7 @@ hi! link typescriptModule jsImport hi! link typescriptAbstract Keyword hi! link typescriptTemplateSB PreProc + hi! link typescriptDebugger Keyword " }}} " Markdown {{{ @@ -352,6 +353,7 @@ " Python {{{ hi! link pythonBuiltinType Type + hi! link pythonExClass Type hi! link pythonBuiltinObj pythonFunction hi! link pythonClassVar Variable " }}} From 1a9bbbd7436a59bd0a1ae42eb62fb099ab601f25 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 21 Oct 2020 14:27:42 +0300 Subject: [PATCH 389/713] [zsh] what the hell did I commit and push? --- zsh/aliases.zsh | 4 ++++ zsh/functions.zsh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index e3ad922..0d20aae 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -85,3 +85,7 @@ fi alias sue="sudo --edit" alias rsync-backup='rsync --archive --compress --verbose --human-readable --partial --progress' + +if command_exists ncdu; then + alias ncdu='ncdu --confirm-quit' +fi diff --git a/zsh/functions.zsh b/zsh/functions.zsh index db8190c..88edb32 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -11,7 +11,7 @@ viscd() { local temp_file chosen_dir temp_file="$(mktemp -t ranger_cd.XXXXXXXXXX)" { - ranger --no-such-opt --choosedir="$temp_file" -- "${@:-$PWD}" + ranger --choosedir="$temp_file" -- "${@:-$PWD}" if chosen_dir="$(<"$temp_file")" && [[ -n "$chosen_dir" && "$chosen_dir" != "$PWD" ]]; then cd -- "$chosen_dir" fi From b4eff2694afa9aa53252cf34147c77372a3352e2 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 22 Oct 2020 13:32:50 +0300 Subject: [PATCH 390/713] [scripts] add a script for controlling media players --- scripts/copy-crosscode-emoji-url | 2 +- scripts/playerctl-simple-menu | 140 +++++++++++++++++++++++++++++++ scripts/query-bookmarks | 2 +- 3 files changed, 142 insertions(+), 2 deletions(-) create mode 100755 scripts/playerctl-simple-menu diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index 20bc752..21e772c 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -10,7 +10,7 @@ sys.path.insert( 1, os.path.join(os.path.dirname(os.path.dirname(__file__)), "script-resources") ) -import common_script_utils # noqa F401 +import common_script_utils # noqa: E402 DEFAULT_REGISTRY_DUMP_URL = ( diff --git a/scripts/playerctl-simple-menu b/scripts/playerctl-simple-menu new file mode 100755 index 0000000..26ecd84 --- /dev/null +++ b/scripts/playerctl-simple-menu @@ -0,0 +1,140 @@ +#!/usr/bin/env python3 + +# A simple graphical menu to control MPRIS-compatible players through Playerctl. +# +# +# +# TODO: Update the menu on player status changes. + +import gi + +gi.require_version("Playerctl", "2.0") +gi.require_version("Gtk", "3.0") +from gi.repository import Playerctl, Gtk, Gdk # noqa: E402 + + +def iter_actions_for_player(player): + if not player.props.can_control: + yield ("This player can't be controlled!", None, False, None) + return + + playback_status = player.props.playback_status + if playback_status == Playerctl.PlaybackStatus.PLAYING: + yield ("Pause", "media-playback-pause", player.props.can_pause, player.pause) + elif playback_status == Playerctl.PlaybackStatus.PAUSED: + yield ("Resume", "media-playback-start", player.props.can_play, player.play) + elif playback_status == Playerctl.PlaybackStatus.STOPPED: + yield ("Play", "media-playback-start", player.props.can_play, player.play) + + # See + yield ( + "Stop", + "media-playback-stop", + player.props.can_play and playback_status != Playerctl.PlaybackStatus.STOPPED, + player.stop, + ) + + yield ( + "Mute" if player.props.volume != 0.0 else "Normal volume", + "audio-volume-muted" if player.props.volume != 0.0 else "audio-volume-high", + True, + lambda volume: player.set_volume(volume), + 0.0 if player.props.volume != 0.0 else 1.0, + ) + yield ( + "Volume +10%", + "audio-volume-medium", + True, + lambda: player.set_volume(min(player.props.volume + 0.1, 1.0)), + ) + yield ( + "Volume -10%", + "audio-volume-low", + True, + lambda: player.set_volume(max(player.props.volume - 0.1, 0.0)), + ) + + yield ( + "Next", + "media-skip-forward", + player.props.can_go_next, + player.next, + ) + yield ( + "Previous", + "media-skip-backward", + player.props.can_go_previous, + player.previous, + ) + + shuffle = player.props.shuffle + yield ( + "Don't shuffle" if shuffle else "Shuffle", + "media-playlist-shuffle", + True, + lambda: player.set_shuffle(not shuffle), + ) + + loop_status = player.props.loop_status + for loop_action_name, loop_action_status in [ + ("Don't loop", Playerctl.LoopStatus.NONE), + ("Loop one", Playerctl.LoopStatus.TRACK), + ("Loop all", Playerctl.LoopStatus.PLAYLIST), + ]: + if loop_action_status == loop_status: + continue + yield ( + loop_action_name, + "media-playlist-repeat", + True, + lambda loop_action_status: player.set_loop_status(loop_action_status), + loop_action_status, + ) + + +root_menu = Gtk.Menu() + +for player_name in Playerctl.list_players(): + player = Playerctl.Player.new_from_name(player_name) + + player_menu_item = Gtk.MenuItem(label=player_name.instance) + actions_menu = Gtk.Menu() + + for ( + action_name, + action_icon_name, + action_enabled, + action_fn, + *action_fn_args, + ) in iter_actions_for_player(player): + action_menu_item = Gtk.ImageMenuItem(label=action_name) + + if action_icon_name is not None: + icon = Gtk.Image.new_from_icon_name(action_icon_name, Gtk.IconSize.MENU) + action_menu_item.set_image(icon) + + action_menu_item.set_sensitive(action_enabled) + if action_fn is not None: + action_menu_item.connect( + "activate", + lambda _menu_item, action_fn, action_fn_args: action_fn( + *action_fn_args + ), + action_fn, + action_fn_args, + ) + + actions_menu.append(action_menu_item) + + player_menu_item.set_submenu(actions_menu) + root_menu.append(player_menu_item) + + +root_menu.connect("selection-done", Gtk.main_quit) +root_menu.connect("deactivate", Gtk.main_quit) +root_menu.connect("destroy", Gtk.main_quit) + +root_menu.show_all() +root_menu.popup(None, None, None, None, 0, Gdk.CURRENT_TIME) + +Gtk.main() diff --git a/scripts/query-bookmarks b/scripts/query-bookmarks index 7c6e313..7dc63cb 100755 --- a/scripts/query-bookmarks +++ b/scripts/query-bookmarks @@ -20,7 +20,7 @@ sys.path.insert( 1, os.path.join(os.path.dirname(os.path.dirname(__file__)), "script-resources") ) -import common_script_utils # noqa F401 +import common_script_utils # noqa: E402 if sys.platform == "darwin": From 07672989725cdbeeeb60437c695fe834349b275e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 22 Oct 2020 15:34:37 +0300 Subject: [PATCH 391/713] [scripts/playerctl-simple-menu] add sorting by player priorities --- scripts/playerctl-simple-menu | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/playerctl-simple-menu b/scripts/playerctl-simple-menu index 26ecd84..9f197a7 100755 --- a/scripts/playerctl-simple-menu +++ b/scripts/playerctl-simple-menu @@ -13,6 +13,18 @@ gi.require_version("Gtk", "3.0") from gi.repository import Playerctl, Gtk, Gdk # noqa: E402 +# Larger priority values will make the player with this name appear higher in +# the menu. The default priority is 0. +PLAYER_NAME_PRIORITIES = { + "audacious": 2, + "mpv": 1, + "vlc": 1, + "firefox": -1, + "chrome": -2, + "chromium": -2, +} + + def iter_actions_for_player(player): if not player.props.can_control: yield ("This player can't be controlled!", None, False, None) @@ -94,7 +106,13 @@ def iter_actions_for_player(player): root_menu = Gtk.Menu() -for player_name in Playerctl.list_players(): +for player_name in sorted( + Playerctl.list_players(), + key=lambda player_name: ( + -PLAYER_NAME_PRIORITIES.get(player_name.name, 0), + player_name.instance, + ), +): player = Playerctl.Player.new_from_name(player_name) player_menu_item = Gtk.MenuItem(label=player_name.instance) From 6fe5b6355a6257f58d8d52c4b9aec822648f4842 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 22 Oct 2020 15:54:01 +0300 Subject: [PATCH 392/713] [scripts/playerctl-simple-menu] show player icons --- scripts/playerctl-simple-menu | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/scripts/playerctl-simple-menu b/scripts/playerctl-simple-menu index 9f197a7..996208b 100755 --- a/scripts/playerctl-simple-menu +++ b/scripts/playerctl-simple-menu @@ -24,6 +24,10 @@ PLAYER_NAME_PRIORITIES = { "chromium": -2, } +PLAYER_ICON_NAME_FIXES = { + "chrome": "google-chrome", +} + def iter_actions_for_player(player): if not player.props.can_control: @@ -115,7 +119,12 @@ for player_name in sorted( ): player = Playerctl.Player.new_from_name(player_name) - player_menu_item = Gtk.MenuItem(label=player_name.instance) + player_menu_item = Gtk.ImageMenuItem(label=player_name.instance) + + player_icon_name = PLAYER_ICON_NAME_FIXES.get(player_name.name, player_name.name) + player_icon = Gtk.Image.new_from_icon_name(player_icon_name, Gtk.IconSize.MENU) + player_menu_item.set_image(player_icon) + actions_menu = Gtk.Menu() for ( @@ -128,8 +137,10 @@ for player_name in sorted( action_menu_item = Gtk.ImageMenuItem(label=action_name) if action_icon_name is not None: - icon = Gtk.Image.new_from_icon_name(action_icon_name, Gtk.IconSize.MENU) - action_menu_item.set_image(icon) + action_icon = Gtk.Image.new_from_icon_name( + action_icon_name, Gtk.IconSize.MENU + ) + action_menu_item.set_image(action_icon) action_menu_item.set_sensitive(action_enabled) if action_fn is not None: From 7db0c34bcab33b949e8cf4a8e1ba1f20d2eaf44b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 22 Oct 2020 19:36:15 +0300 Subject: [PATCH 393/713] [scripts/playerctl-simple-menu] add mnemonic shortcuts for player actions --- scripts/playerctl-simple-menu | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/scripts/playerctl-simple-menu b/scripts/playerctl-simple-menu index 996208b..864e439 100755 --- a/scripts/playerctl-simple-menu +++ b/scripts/playerctl-simple-menu @@ -34,50 +34,54 @@ def iter_actions_for_player(player): yield ("This player can't be controlled!", None, False, None) return + # NOTE: Reminder about mnemonic keys: make sure that logically paired actions + # (play-stop, pause-resume) have the same mnemonic key if only one of the + # actions is available at any given moment. + playback_status = player.props.playback_status if playback_status == Playerctl.PlaybackStatus.PLAYING: - yield ("Pause", "media-playback-pause", player.props.can_pause, player.pause) + yield ("Pau_se", "media-playback-pause", player.props.can_pause, player.pause) elif playback_status == Playerctl.PlaybackStatus.PAUSED: - yield ("Resume", "media-playback-start", player.props.can_play, player.play) + yield ("Re_sume", "media-playback-start", player.props.can_play, player.play) elif playback_status == Playerctl.PlaybackStatus.STOPPED: - yield ("Play", "media-playback-start", player.props.can_play, player.play) + yield ("_Play", "media-playback-start", player.props.can_play, player.play) # See yield ( - "Stop", + "Sto_p", "media-playback-stop", player.props.can_play and playback_status != Playerctl.PlaybackStatus.STOPPED, player.stop, ) yield ( - "Mute" if player.props.volume != 0.0 else "Normal volume", + "_Mute" if player.props.volume != 0.0 else "Nor_mal volume", "audio-volume-muted" if player.props.volume != 0.0 else "audio-volume-high", True, lambda volume: player.set_volume(volume), 0.0 if player.props.volume != 0.0 else 1.0, ) yield ( - "Volume +10%", + "Volume _+10%", "audio-volume-medium", True, lambda: player.set_volume(min(player.props.volume + 0.1, 1.0)), ) yield ( - "Volume -10%", + "Volume _-10%", "audio-volume-low", True, lambda: player.set_volume(max(player.props.volume - 0.1, 0.0)), ) yield ( - "Next", + "_Next", "media-skip-forward", player.props.can_go_next, player.next, ) yield ( - "Previous", + "_Previous", "media-skip-backward", player.props.can_go_previous, player.previous, @@ -85,7 +89,7 @@ def iter_actions_for_player(player): shuffle = player.props.shuffle yield ( - "Don't shuffle" if shuffle else "Shuffle", + "Don't shu_ffle" if shuffle else "Shu_ffle", "media-playlist-shuffle", True, lambda: player.set_shuffle(not shuffle), @@ -93,9 +97,9 @@ def iter_actions_for_player(player): loop_status = player.props.loop_status for loop_action_name, loop_action_status in [ - ("Don't loop", Playerctl.LoopStatus.NONE), - ("Loop one", Playerctl.LoopStatus.TRACK), - ("Loop all", Playerctl.LoopStatus.PLAYLIST), + ("Don't _loop", Playerctl.LoopStatus.NONE), + ("Loop _one", Playerctl.LoopStatus.TRACK), + ("Loop _all", Playerctl.LoopStatus.PLAYLIST), ]: if loop_action_status == loop_status: continue @@ -119,7 +123,7 @@ for player_name in sorted( ): player = Playerctl.Player.new_from_name(player_name) - player_menu_item = Gtk.ImageMenuItem(label=player_name.instance) + player_menu_item = Gtk.ImageMenuItem.new_with_label(player_name.instance) player_icon_name = PLAYER_ICON_NAME_FIXES.get(player_name.name, player_name.name) player_icon = Gtk.Image.new_from_icon_name(player_icon_name, Gtk.IconSize.MENU) @@ -134,7 +138,7 @@ for player_name in sorted( action_fn, *action_fn_args, ) in iter_actions_for_player(player): - action_menu_item = Gtk.ImageMenuItem(label=action_name) + action_menu_item = Gtk.ImageMenuItem.new_with_mnemonic(action_name) if action_icon_name is not None: action_icon = Gtk.Image.new_from_icon_name( From 40dec8d6da971cd137c1b4529bd27f19033c8337 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 22 Oct 2020 19:46:01 +0300 Subject: [PATCH 394/713] [scripts/playerctl-simple-menu] add a button for playing the track from start --- scripts/playerctl-simple-menu | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/playerctl-simple-menu b/scripts/playerctl-simple-menu index 864e439..52252b9 100755 --- a/scripts/playerctl-simple-menu +++ b/scripts/playerctl-simple-menu @@ -81,7 +81,7 @@ def iter_actions_for_player(player): player.next, ) yield ( - "_Previous", + "P_revious", "media-skip-backward", player.props.can_go_previous, player.previous, @@ -101,16 +101,21 @@ def iter_actions_for_player(player): ("Loop _one", Playerctl.LoopStatus.TRACK), ("Loop _all", Playerctl.LoopStatus.PLAYLIST), ]: - if loop_action_status == loop_status: - continue yield ( loop_action_name, "media-playlist-repeat", - True, + loop_action_status != loop_status, lambda loop_action_status: player.set_loop_status(loop_action_status), loop_action_status, ) + yield ( + "Play a_gain", + "go-first", + player.props.can_seek, + lambda: player.set_position(0), + ) + root_menu = Gtk.Menu() From 4c2dd033a6214710562c8b030778bdaa3ac6487d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 22 Oct 2020 20:19:19 +0300 Subject: [PATCH 395/713] [scripts/playerctl-simple-menu] change mnemonic shortcuts --- scripts/playerctl-simple-menu | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/scripts/playerctl-simple-menu b/scripts/playerctl-simple-menu index 52252b9..ce0b82e 100755 --- a/scripts/playerctl-simple-menu +++ b/scripts/playerctl-simple-menu @@ -34,21 +34,32 @@ def iter_actions_for_player(player): yield ("This player can't be controlled!", None, False, None) return - # NOTE: Reminder about mnemonic keys: make sure that logically paired actions - # (play-stop, pause-resume) have the same mnemonic key if only one of the - # actions is available at any given moment. - playback_status = player.props.playback_status if playback_status == Playerctl.PlaybackStatus.PLAYING: - yield ("Pau_se", "media-playback-pause", player.props.can_pause, player.pause) + yield ( + "_Pause", + "media-playback-pause", + player.props.can_pause, + player.pause, + ) elif playback_status == Playerctl.PlaybackStatus.PAUSED: - yield ("Re_sume", "media-playback-start", player.props.can_play, player.play) + yield ( + "Resume (_P)", + "media-playback-start", + player.props.can_play, + player.play, + ) elif playback_status == Playerctl.PlaybackStatus.STOPPED: - yield ("_Play", "media-playback-start", player.props.can_play, player.play) + yield ( + "_Play", + "media-playback-start", + player.props.can_play, + player.play, + ) # See yield ( - "Sto_p", + "_Stop", "media-playback-stop", player.props.can_play and playback_status != Playerctl.PlaybackStatus.STOPPED, player.stop, @@ -62,13 +73,13 @@ def iter_actions_for_player(player): 0.0 if player.props.volume != 0.0 else 1.0, ) yield ( - "Volume _+10%", + "Volume +10%", "audio-volume-medium", True, lambda: player.set_volume(min(player.props.volume + 0.1, 1.0)), ) yield ( - "Volume _-10%", + "Volume -10%", "audio-volume-low", True, lambda: player.set_volume(max(player.props.volume - 0.1, 0.0)), @@ -81,7 +92,7 @@ def iter_actions_for_player(player): player.next, ) yield ( - "P_revious", + "Previous (_B)", "media-skip-backward", player.props.can_go_previous, player.previous, @@ -89,7 +100,7 @@ def iter_actions_for_player(player): shuffle = player.props.shuffle yield ( - "Don't shu_ffle" if shuffle else "Shu_ffle", + "Don't shuffle (_R)" if shuffle else "Shuffle (_R)", "media-playlist-shuffle", True, lambda: player.set_shuffle(not shuffle), From c127b901efa7e3bf29cbfde1e1fe0a9ce8784959 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 22 Oct 2020 22:05:29 +0300 Subject: [PATCH 396/713] [scripts/playerctl-simple-menu] add a message for when no players are detected --- scripts/playerctl-simple-menu | 77 +++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 34 deletions(-) diff --git a/scripts/playerctl-simple-menu b/scripts/playerctl-simple-menu index ce0b82e..5dfdb0e 100755 --- a/scripts/playerctl-simple-menu +++ b/scripts/playerctl-simple-menu @@ -130,53 +130,62 @@ def iter_actions_for_player(player): root_menu = Gtk.Menu() -for player_name in sorted( +player_names = sorted( Playerctl.list_players(), key=lambda player_name: ( -PLAYER_NAME_PRIORITIES.get(player_name.name, 0), player_name.instance, ), -): - player = Playerctl.Player.new_from_name(player_name) +) - player_menu_item = Gtk.ImageMenuItem.new_with_label(player_name.instance) +if len(player_names) > 0: + for player_name in player_names: + player = Playerctl.Player.new_from_name(player_name) - player_icon_name = PLAYER_ICON_NAME_FIXES.get(player_name.name, player_name.name) - player_icon = Gtk.Image.new_from_icon_name(player_icon_name, Gtk.IconSize.MENU) - player_menu_item.set_image(player_icon) + player_menu_item = Gtk.ImageMenuItem.new_with_label(player_name.instance) - actions_menu = Gtk.Menu() + player_icon_name = PLAYER_ICON_NAME_FIXES.get( + player_name.name, player_name.name + ) + player_icon = Gtk.Image.new_from_icon_name(player_icon_name, Gtk.IconSize.MENU) + player_menu_item.set_image(player_icon) - for ( - action_name, - action_icon_name, - action_enabled, - action_fn, - *action_fn_args, - ) in iter_actions_for_player(player): - action_menu_item = Gtk.ImageMenuItem.new_with_mnemonic(action_name) + actions_menu = Gtk.Menu() - if action_icon_name is not None: - action_icon = Gtk.Image.new_from_icon_name( - action_icon_name, Gtk.IconSize.MENU - ) - action_menu_item.set_image(action_icon) + for ( + action_name, + action_icon_name, + action_enabled, + action_fn, + *action_fn_args, + ) in iter_actions_for_player(player): + action_menu_item = Gtk.ImageMenuItem.new_with_mnemonic(action_name) - action_menu_item.set_sensitive(action_enabled) - if action_fn is not None: - action_menu_item.connect( - "activate", - lambda _menu_item, action_fn, action_fn_args: action_fn( - *action_fn_args - ), - action_fn, - action_fn_args, - ) + if action_icon_name is not None: + action_icon = Gtk.Image.new_from_icon_name( + action_icon_name, Gtk.IconSize.MENU + ) + action_menu_item.set_image(action_icon) - actions_menu.append(action_menu_item) + action_menu_item.set_sensitive(action_enabled) + if action_fn is not None: + action_menu_item.connect( + "activate", + lambda _menu_item, action_fn, action_fn_args: action_fn( + *action_fn_args + ), + action_fn, + action_fn_args, + ) - player_menu_item.set_submenu(actions_menu) - root_menu.append(player_menu_item) + actions_menu.append(action_menu_item) + + player_menu_item.set_submenu(actions_menu) + root_menu.append(player_menu_item) +else: + menu_item = Gtk.MenuItem.new_with_label("No players were detected!") + menu_item.set_sensitive(False) + root_menu.append(menu_item) root_menu.connect("selection-done", Gtk.main_quit) From 5d897827947225376ad707a6ace6274322d5a852 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 24 Oct 2020 15:53:29 +0300 Subject: [PATCH 397/713] [scripts/playerctl-simple-menu] display some metadata about the current track --- scripts/playerctl-simple-menu | 50 ++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/scripts/playerctl-simple-menu b/scripts/playerctl-simple-menu index 5dfdb0e..30307f4 100755 --- a/scripts/playerctl-simple-menu +++ b/scripts/playerctl-simple-menu @@ -6,11 +6,14 @@ # # TODO: Update the menu on player status changes. +import math import gi gi.require_version("Playerctl", "2.0") gi.require_version("Gtk", "3.0") -from gi.repository import Playerctl, Gtk, Gdk # noqa: E402 +gi.require_version("Gdk", "3.0") +gi.require_version("Pango", "1.0") +from gi.repository import Playerctl, Gtk, Gdk, GLib, Pango # noqa: E402 # Larger priority values will make the player with this name appear higher in @@ -29,6 +32,36 @@ PLAYER_ICON_NAME_FIXES = { } +def humanize_duration(duration): + minutes, seconds = divmod(math.floor(duration), 60) + hours, minutes = divmod(minutes, 60) + text = "{:02}:{:02}".format(minutes, seconds) + if hours > 0: + text = "{}:{}".format(hours, text) + return text + + +def iter_metadata_entries_for_player(player): + metadata = player.props.metadata + + title = metadata.lookup_value("xesam:title") + if title: + yield title.get_string() + + album = metadata.lookup_value("xesam:album") + if album: + yield album.get_string() + + if player.props.can_seek: + position_secs = player.props.position / 1e6 + duration = metadata.lookup_value("mpris:length") + if duration is not None and duration.is_of_type(GLib.VariantType.new("x")): + duration_secs = duration.get_int64() / 1e6 + yield "Time: {} / {}".format( + humanize_duration(position_secs), humanize_duration(duration_secs) + ) + + def iter_actions_for_player(player): if not player.props.can_control: yield ("This player can't be controlled!", None, False, None) @@ -152,6 +185,21 @@ if len(player_names) > 0: actions_menu = Gtk.Menu() + track_metadata = player.props.metadata + any_metadata_was_added = False + for meta_entry_text in iter_metadata_entries_for_player(player): + meta_menu_item = Gtk.MenuItem.new_with_label(meta_entry_text) + meta_menu_item.set_sensitive(False) + meta_menu_item_label = meta_menu_item.get_child() + meta_menu_item_label.set_ellipsize(Pango.EllipsizeMode.END) + meta_menu_item_label.set_max_width_chars(20) + + actions_menu.append(meta_menu_item) + any_metadata_was_added = True + + if any_metadata_was_added: + actions_menu.append(Gtk.SeparatorMenuItem.new()) + for ( action_name, action_icon_name, From 18ecbd5b338dadabee41e86319a620c0e7e4ff9c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 25 Oct 2020 17:30:08 +0200 Subject: [PATCH 398/713] [nvim] fix highlighting of destructured fields in TS --- nvim/colors/dotfiles.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 9c23aa0..2a6a76e 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -314,6 +314,8 @@ hi! link typescriptVariable jsStorageClass hi! link typescriptAmbientDeclaration typescriptVariable hi! link typescriptVariableDeclaration Variable + hi! link typescriptDestructureLabel typescriptVariableDeclaration + hi! link typescriptDestructureVariable typescriptVariableDeclaration hi! link typescriptGlobal typescriptVariableDeclaration hi! link typescriptTypeReference Type hi! link typescriptTypeParameter typescriptTypeReference From d421d47569ffcc3ce6d5c4e6b23b5e9a54062819 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 28 Oct 2020 20:52:59 +0200 Subject: [PATCH 399/713] I don't need a reason to write scripts! --- scripts/archlinux-packages-menu | 6 ++++++ scripts/random-local-ipv4 | 10 ++++++++++ 2 files changed, 16 insertions(+) create mode 100755 scripts/archlinux-packages-menu create mode 100755 scripts/random-local-ipv4 diff --git a/scripts/archlinux-packages-menu b/scripts/archlinux-packages-menu new file mode 100755 index 0000000..0ef8453 --- /dev/null +++ b/scripts/archlinux-packages-menu @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail + +if package="$(expac --sync '%r/%a/%n %v - %d' | rofi -dmenu)" && [[ -n "$package" ]]; then + xdg-open "https://www.archlinux.org/packages/${package%% *}/" +fi diff --git a/scripts/random-local-ipv4 b/scripts/random-local-ipv4 new file mode 100755 index 0000000..058ef11 --- /dev/null +++ b/scripts/random-local-ipv4 @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +import random + + +def randbyte(): + return random.randrange(0, 256) + + +print("127.{}.{}.{}".format(randbyte(), randbyte(), randbyte())) From ee186f728597f04ae5c4615e1da6a786c1f51e0b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 1 Nov 2020 16:21:57 +0200 Subject: [PATCH 400/713] [scripts/archlinux-packages-menu] add listing of packages from AUR --- scripts/archlinux-packages-menu | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/archlinux-packages-menu b/scripts/archlinux-packages-menu index 0ef8453..72a39b8 100755 --- a/scripts/archlinux-packages-menu +++ b/scripts/archlinux-packages-menu @@ -1,6 +1,18 @@ #!/usr/bin/env bash set -euo pipefail -if package="$(expac --sync '%r/%a/%n %v - %d' | rofi -dmenu)" && [[ -n "$package" ]]; then - xdg-open "https://www.archlinux.org/packages/${package%% *}/" +if package="$(set -euo pipefail; { + expac --sync '%r/%a/%n %v - %d' + curl --silent --location --fail --max-time 3 --compressed https://aur.archlinux.org/packages.gz | awk '!/^#/ { print "aur/" $0 }' +} | rofi -dmenu)" && [[ -n "$package" ]]; then + + package="${package%% *}" + if [[ "$package" == aur/* ]]; then + package="${package#aur/}" + url="https://aur.archlinux.org/packages/${package}/" + else + url="https://www.archlinux.org/packages/${package}/" + fi + + xdg-open "$url" fi From f9ed443e4a91908fa463fd534614ab463a37d589 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 4 Nov 2020 02:09:45 +0200 Subject: [PATCH 401/713] [nvim+zsh] disable the ugly fzf popup window and turn off rounded borders in the preview window --- nvim/plugin/interface.vim | 2 ++ zsh/env.zsh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index d6817f2..cb286af 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -145,6 +145,8 @@ endif nnoremap Helptags nnoremap f Files nnoremap b Buffers + let g:fzf_layout = { 'down': '~40%' } + let $FZF_DEFAULT_OPTS = '--preview-window=sharp' " }}} diff --git a/zsh/env.zsh b/zsh/env.zsh index 07f3124..bf26bc5 100644 --- a/zsh/env.zsh +++ b/zsh/env.zsh @@ -29,3 +29,5 @@ jq_colors=( # join all values from jq_colors with a colon export JQ_COLORS="${(j.:.)jq_colors}" unset jq_colors + +export FZF_DEFAULT_OPTS='--preview-window=sharp' From 6ed0ea251ce4697ecf99f5806e86b8546d59d557 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 7 Nov 2020 11:07:03 +0200 Subject: [PATCH 402/713] [scripts/archlinux-packages-menu] increase the timeout for downloading the AUR package list --- scripts/archlinux-packages-menu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/archlinux-packages-menu b/scripts/archlinux-packages-menu index 72a39b8..993897b 100755 --- a/scripts/archlinux-packages-menu +++ b/scripts/archlinux-packages-menu @@ -3,7 +3,7 @@ set -euo pipefail if package="$(set -euo pipefail; { expac --sync '%r/%a/%n %v - %d' - curl --silent --location --fail --max-time 3 --compressed https://aur.archlinux.org/packages.gz | awk '!/^#/ { print "aur/" $0 }' + curl --silent --location --fail --max-time 10 --compressed https://aur.archlinux.org/packages.gz | awk '!/^#/ { print "aur/" $0 }' } | rofi -dmenu)" && [[ -n "$package" ]]; then package="${package%% *}" From 265eaa565b214f6eee8b802268bced6c22bdb37d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 7 Nov 2020 23:07:27 +0200 Subject: [PATCH 403/713] [scripts/welcome] script crash on Python 3.9 on macOS --- script-resources/welcome/system_info.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/script-resources/welcome/system_info.py b/script-resources/welcome/system_info.py index e711840..e858f7c 100644 --- a/script-resources/welcome/system_info.py +++ b/script-resources/welcome/system_info.py @@ -188,9 +188,10 @@ def _get_distro_info(): if psutil.WINDOWS: return "windows", platform.system(), platform.release(), "" elif psutil.OSX: - from plistlib import readPlist + import plistlib - sw_vers = readPlist("/System/Library/CoreServices/SystemVersion.plist") + with open("/System/Library/CoreServices/SystemVersion.plist", "rb") as f: + sw_vers = plistlib.load(f) return "mac", sw_vers["ProductName"], sw_vers["ProductVersion"], "" elif _is_android(): from subprocess import check_output From ef1bd7fa6a89ff5e4c7ee054dc4d9ff21148bf70 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 9 Nov 2020 13:43:23 +0200 Subject: [PATCH 404/713] [nvim] fix comments and commentstring options in the nginx filetype --- nvim/after/syntax/nginx.vim | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 nvim/after/syntax/nginx.vim diff --git a/nvim/after/syntax/nginx.vim b/nvim/after/syntax/nginx.vim new file mode 100644 index 0000000..3ef6892 --- /dev/null +++ b/nvim/after/syntax/nginx.vim @@ -0,0 +1,8 @@ +" Guess what. The `syntax/jinja.vim` script for the jinja templating language, +" which is not included in neither Vim's runtime, nor Neovim's runtime, nor in +" vim-polyglot (so the only way to get it is to install the python package) is +" sourced in `syntax/nginx.vim` in vim-polyglot, which resets the `commentstring` +" set in `ftplugin/nginx.vim` and sets `comments` to some garbage. This script +" undoes that damage. +let &l:comments = &g:comments +let &l:commentstring = '# %s' From 9ce4eb6d4605b5ec803217c2549d54831b59703d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 12 Nov 2020 11:43:52 +0200 Subject: [PATCH 405/713] [nvim] add DragOut command --- nvim/plugin/files.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nvim/plugin/files.vim b/nvim/plugin/files.vim index 1daaf62..4af59ee 100644 --- a/nvim/plugin/files.vim +++ b/nvim/plugin/files.vim @@ -105,6 +105,20 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" command -nargs=* -complete=file -bar EditGlob call s:EditGlob() " }}} + " DragOut {{{ + " Shows a window for draging (-and-dropping) the currently opened file out. + function s:DragOut(path) + if empty(a:path) | return | endif + if !executable('dragon-drag-and-drop') + echoerr "Please install for the DragOut command to work." + return + endif + execute '!dragon-drag-and-drop '.shellescape(a:path) + endfunction + command -nargs=* -complete=file DragOut call s:DragOut(empty() ? expand('%') : ) + " }}} + + " }}} From 1c5373a9bf24f98f55474d47394228119b80c470 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 21 Nov 2020 18:59:24 +0200 Subject: [PATCH 406/713] [nvim] add vim-sneak --- nvim/colors/dotfiles.vim | 22 +++++++++++----------- nvim/init.vim | 5 +++-- nvim/plugin/editing.vim | 10 ++++++++++ 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 2a6a76e..6ca399f 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -17,7 +17,7 @@ let g:colors_name = g:dotfiles_colorscheme_name " }}} -" Highlighting function {{{ +" The highlighting function {{{ function s:is_number(value) return type(a:value) == v:t_number endfunction @@ -134,11 +134,18 @@ call s:hi('PMenu', 'fg', 0x1, '', '') call s:hi('PMenuSel', 0x1, 'fg', '', '') -" }}} - -" CtrlSF {{{ hi! link ctrlsfMatch Search hi! link ctrlsfLnumMatch ctrlsfMatch + + call s:hi('SpellBad', 'bg', '', 'undercurl', 0x8) + call s:hi('SpellLocal', 'bg', '', 'undercurl', 0xC) + call s:hi('SpellCap', 'bg', '', 'undercurl', 0xD) + call s:hi('SpellRare', 'bg', '', 'undercurl', 0xE) + + call s:hi('Sneak', 'bg', 0xB, 'bold', '') + hi! link SneakScope Visual + hi! link SneakLabel Sneak + " }}} " AWK {{{ @@ -382,10 +389,3 @@ hi! link zshFunction Function hi! link zshVariable Variable " }}} - -" Spelling {{{ - call s:hi('SpellBad', 'bg', '', 'undercurl', 0x8) - call s:hi('SpellLocal', 'bg', '', 'undercurl', 0xC) - call s:hi('SpellCap', 'bg', '', 'undercurl', 0xD) - call s:hi('SpellRare', 'bg', '', 'undercurl', 0xE) -" }}} diff --git a/nvim/init.vim b/nvim/init.vim index 363498c..f760852 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -28,7 +28,7 @@ Plug 'junegunn/vim-plug' " Editing {{{ if g:vim_ide - Plug 'easymotion/vim-easymotion' + " Plug 'easymotion/vim-easymotion' Plug 'junegunn/vim-easy-align' endif Plug 'Raimondi/delimitMate' @@ -36,13 +36,14 @@ Plug 'junegunn/vim-plug' Plug 'tpope/vim-commentary' Plug 'tpope/vim-surround' Plug 'Yggdroot/indentLine' + Plug 'idbrii/detectindent' Plug 'henrik/vim-indexed-search' Plug 'andymass/vim-matchup' Plug 'inkarkat/vim-ingo-library' " required by LineJuggler Plug 'inkarkat/vim-LineJuggler', { 'branch': 'stable' } Plug 'reedes/vim-pencil' - Plug 'idbrii/detectindent' Plug 'tommcdo/vim-exchange' + Plug 'justinmk/vim-sneak' " }}} " Text objects {{{ diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index ab8ca6b..b35af4d 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -172,6 +172,7 @@ set commentstring=//%s " plugins {{{ + let g:delimitMate_expand_space = 1 let g:delimitMate_expand_cr = 1 @@ -183,6 +184,15 @@ set commentstring=//%s xmap ga (LiveEasyAlign) nmap ga (LiveEasyAlign) + + let g:sneak#prompt = 'sneak> ' + map f Sneak_f + map F Sneak_F + map t Sneak_t + map T Sneak_T + noremap s s + noremap S S + " }}} From 93b0670f86222d3b9f53d6dff41e1ab755e62b12 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 22 Nov 2020 23:33:44 +0200 Subject: [PATCH 407/713] [scripts/copy-crosscode-emoji-url] add an option for specifying the default image size for the pasted emotes --- scripts/copy-crosscode-emoji-url | 15 +++++++++++---- scripts/query-bookmarks | 4 +--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index 21e772c..9ae73a1 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -6,9 +6,7 @@ from configparser import ConfigParser import requests import json -sys.path.insert( - 1, os.path.join(os.path.dirname(os.path.dirname(__file__)), "script-resources") -) +sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resources")) import common_script_utils # noqa: E402 @@ -65,7 +63,16 @@ chosen_index = common_script_utils.run_chooser( emote_downloader_and_iterator(), prompt="emote", async_read=True ) chosen_emote = data["list"][chosen_index] -common_script_utils.set_clipboard(chosen_emote["url"]) + +emote_url = chosen_emote["url"] +default_emote_image_size = config.getint( + "default", "default_emote_image_size", fallback=None +) +if default_emote_image_size is not None: + emote_url += "?size={}".format(default_emote_image_size) + +common_script_utils.set_clipboard(emote_url) + common_script_utils.send_notification( os.path.basename(__file__), "copied URL of {} to clipboard!".format(chosen_emote["ref"]), diff --git a/scripts/query-bookmarks b/scripts/query-bookmarks index 7dc63cb..1014eac 100755 --- a/scripts/query-bookmarks +++ b/scripts/query-bookmarks @@ -16,9 +16,7 @@ import shutil import sqlite3 import collections -sys.path.insert( - 1, os.path.join(os.path.dirname(os.path.dirname(__file__)), "script-resources") -) +sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resources")) import common_script_utils # noqa: E402 From b185e78886679da64e804f0245d20630f854c074 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 27 Nov 2020 11:55:24 +0200 Subject: [PATCH 408/713] [nvim] add a mapping for showing the signature help --- nvim/plugin/completion.vim | 8 +++++--- nvim/plugin/editing.vim | 4 ++-- nvim/plugin/files.vim | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/nvim/plugin/completion.vim b/nvim/plugin/completion.vim index a339936..380f82f 100644 --- a/nvim/plugin/completion.vim +++ b/nvim/plugin/completion.vim @@ -36,6 +36,8 @@ endif let g:coc_snippet_prev = '' inoremap coc#refresh() + inoremap call CocActionAsync('showSignatureHelp') + inoremap nmap [c (coc-diagnostic-prev) nmap ]c (coc-diagnostic-next) @@ -44,9 +46,9 @@ endif nmap gt (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) - nmap (coc-rename) - nmap (coc-codeaction) - vmap (coc-codeaction-selected) + nmap (coc-rename) + nmap (coc-codeaction-line) + vmap (coc-codeaction-selected) " nmap qf (coc-fix-current) nnoremap l CocList diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index b35af4d..b70785d 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -138,8 +138,8 @@ set commentstring=//%s augroup vimrc-editing-visual-star-search autocmd! autocmd VimEnter * - \ xmap * :call VisualStarSearch('/')n - \|xmap # :call VisualStarSearch('?')N + \ xmap * :call VisualStarSearch('/')n + \|xmap # :call VisualStarSearch('?')N augroup END " }}} diff --git a/nvim/plugin/files.vim b/nvim/plugin/files.vim index 4af59ee..79c0262 100644 --- a/nvim/plugin/files.vim +++ b/nvim/plugin/files.vim @@ -29,7 +29,7 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" let g:loaded_netrwPlugin = 1 " re-add Netrw's gx mappings since we've disabled them nnoremap gx call netrw#BrowseX(expand(''),netrw#CheckIfRemote()) - xnoremap gx :call netrw#BrowseXVis() + xnoremap gx :call netrw#BrowseXVis() " }}} From a1325168f21937d5f42688b5a05ef7a4df8b05a2 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 27 Nov 2020 18:45:48 +0200 Subject: [PATCH 409/713] update the copyright years --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index e70c16f..5258a2b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018 Dmytro Meleshko +Copyright (c) 2018-2020 Dmytro Meleshko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 643f996a94961e10190d0e650c976e91172b7ddd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 27 Nov 2020 21:17:16 +0200 Subject: [PATCH 410/713] [nvim] fix the insert-mode mapping for F1 --- nvim/plugin/completion.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/plugin/completion.vim b/nvim/plugin/completion.vim index 380f82f..109913a 100644 --- a/nvim/plugin/completion.vim +++ b/nvim/plugin/completion.vim @@ -37,7 +37,7 @@ endif inoremap coc#refresh() inoremap call CocActionAsync('showSignatureHelp') - inoremap + imap nmap [c (coc-diagnostic-prev) nmap ]c (coc-diagnostic-next) From d8cc8d3feb16f2b8d3d0d9cbbd098074b1de9553 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 30 Nov 2020 19:29:30 +0200 Subject: [PATCH 411/713] [zsh] minor edits --- zsh/env.zsh | 2 ++ zsh/zplg.zsh | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/zsh/env.zsh b/zsh/env.zsh index bf26bc5..796896d 100644 --- a/zsh/env.zsh +++ b/zsh/env.zsh @@ -31,3 +31,5 @@ export JQ_COLORS="${(j.:.)jq_colors}" unset jq_colors export FZF_DEFAULT_OPTS='--preview-window=sharp' + +export HOMEBREW_NO_AUTO_UPDATE=1 diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh index 3dbec9c..d0a3355 100644 --- a/zsh/zplg.zsh +++ b/zsh/zplg.zsh @@ -393,7 +393,12 @@ plugin() { return 1 fi - local value; for value in "$plugin_dir/"${^@}; do + local value; for value in "$@"; do + if [[ -z "$value" ]]; then + value="${plugin_dir}" + else + value="${plugin_dir}/${value}" + fi if eval "(( \${${var_name}[(ie)\$value]} > \${#${var_name}} ))"; then case "$operator" in prepend) eval "$var_name=(\"\$value\" \${$var_name[@]})" ;; From 57783871c199c8a1ba7096767aa1a20889dcb392 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 2 Dec 2020 02:05:02 +0200 Subject: [PATCH 412/713] [nvim] disable the annoying virtual text features of the rust plugin --- colorschemes/Makefile | 6 +++--- nvim/coc-languages/rust.vim | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/colorschemes/Makefile b/colorschemes/Makefile index a7e60cb..cf3a25b 100644 --- a/colorschemes/Makefile +++ b/colorschemes/Makefile @@ -14,12 +14,12 @@ OUT_FILES := iterm.itermcolors kitty.conf vim.vim setvtrgb.txt zsh.zsh termux.pr all: $(OUT_DIR) $(addprefix $(OUT_DIR)/,$(OUT_FILES)) clean: - rm -rv out + rm -rv $(OUT_DIR) -out: +$(OUT_DIR): mkdir -p $@ -$(OUT_DIR)/%: %.py _theme.py +$(OUT_DIR)/%: %.py _theme.py $(OUT_DIR) python3 ./$< > $@ $(OUT_DIR)/prismjs-theme.css: prismjs-theme-src.css diff --git a/nvim/coc-languages/rust.vim b/nvim/coc-languages/rust.vim index 343950d..dac412a 100644 --- a/nvim/coc-languages/rust.vim +++ b/nvim/coc-languages/rust.vim @@ -2,7 +2,11 @@ let g:coc_filetypes += ['rust'] let g:coc_global_extensions += ['coc-rust-analyzer'] let g:coc_user_config['rust-analyzer'] = { \ 'serverPath': 'rust-analyzer', +\ 'lens': { +\ 'enable': v:false, +\ }, \ 'inlayHints': { +\ 'typeHints': v:false, \ 'chainingHints': v:false, \ }, \ 'checkOnSave': { @@ -10,7 +14,7 @@ let g:coc_user_config['rust-analyzer'] = { \ }, \ 'cargo': { \ 'loadOutDirsFromCheck': v:true, -\ } +\ }, \ } " let g:coc_global_extensions += ['coc-rls'] From eb3f7b8726043c932449be7be45da6ccd45fc19b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 2 Dec 2020 02:06:27 +0200 Subject: [PATCH 413/713] [misc] add some GDB configs --- misc/gdbinit | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 misc/gdbinit diff --git a/misc/gdbinit b/misc/gdbinit new file mode 100644 index 0000000..2818e64 --- /dev/null +++ b/misc/gdbinit @@ -0,0 +1,8 @@ +set disassembly-flavor intel +set print asm-demangle on + +python +import os +if 'GDB_OUTPUT_TTY' in os.environ: + gdb.execute('tty ' + os.environ['GDB_OUTPUT_TTY']) +end From 0a134aab3027fe770893887f6e4be29d1e3ce47b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 3 Dec 2020 19:29:51 +0200 Subject: [PATCH 414/713] [nvim] add a file in runtimepath for loading the plugins list --- nvim/dotfiles/plugins-list.vim | 66 +++++++++++++++++++++++++++++++ nvim/init.vim | 72 +--------------------------------- 2 files changed, 68 insertions(+), 70 deletions(-) create mode 100644 nvim/dotfiles/plugins-list.vim diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim new file mode 100644 index 0000000..f8ec28c --- /dev/null +++ b/nvim/dotfiles/plugins-list.vim @@ -0,0 +1,66 @@ +" Files {{{ + Plug 'tpope/vim-eunuch' + if g:vim_ide + Plug 'francoiscabrol/ranger.vim' + endif +" }}} + +" Editing {{{ + if g:vim_ide + " Plug 'easymotion/vim-easymotion' + Plug 'junegunn/vim-easy-align' + endif + Plug 'Raimondi/delimitMate' + Plug 'tpope/vim-repeat' + Plug 'tpope/vim-commentary' + Plug 'tpope/vim-surround' + Plug 'Yggdroot/indentLine' + Plug 'idbrii/detectindent' + Plug 'henrik/vim-indexed-search' + Plug 'andymass/vim-matchup' + Plug 'inkarkat/vim-ingo-library' " required by LineJuggler + Plug 'inkarkat/vim-LineJuggler', { 'branch': 'stable' } + Plug 'reedes/vim-pencil' + Plug 'tommcdo/vim-exchange' + Plug 'justinmk/vim-sneak' +" }}} + +" Text objects {{{ + Plug 'kana/vim-textobj-user' + Plug 'kana/vim-textobj-entire' + Plug 'kana/vim-textobj-line' + Plug 'kana/vim-textobj-indent' +" }}} + +" UI {{{ + Plug 'moll/vim-bbye' + Plug 'gerw/vim-HiLinkTrace' + Plug 'vim-airline/vim-airline' + Plug 'tpope/vim-obsession' + Plug 'romainl/vim-qf' + if g:vim_ide + Plug 'dyng/ctrlsf.vim' + endif +" }}} + +" Git {{{ + if g:vim_ide + Plug 'tpope/vim-fugitive' + Plug 'tpope/vim-rhubarb' + Plug 'airblade/vim-gitgutter' + endif +" }}} + +" FZF {{{ + Plug 'junegunn/fzf', { 'do': './install --bin' } + Plug 'junegunn/fzf.vim' +" }}} + +" Programming {{{ + Plug 'sheerun/vim-polyglot' + Plug 'chikamichi/mediawiki.vim' + if g:vim_ide + Plug 'neoclide/coc.nvim', { 'branch': 'release' } + Plug 'dag/vim2hs' + endif +" }}} diff --git a/nvim/init.vim b/nvim/init.vim index f760852..558a98a 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -15,77 +15,9 @@ if !filereadable(s:vim_plug_script) autocmd VimEnter * PlugInstall --sync endif -call plug#begin(s:vim_config_dir . '/plugged') - +call plug#begin(s:vim_plug_home) Plug 'junegunn/vim-plug' - -" Files {{{ - Plug 'tpope/vim-eunuch' - if g:vim_ide - Plug 'francoiscabrol/ranger.vim' - endif -" }}} - -" Editing {{{ - if g:vim_ide - " Plug 'easymotion/vim-easymotion' - Plug 'junegunn/vim-easy-align' - endif - Plug 'Raimondi/delimitMate' - Plug 'tpope/vim-repeat' - Plug 'tpope/vim-commentary' - Plug 'tpope/vim-surround' - Plug 'Yggdroot/indentLine' - Plug 'idbrii/detectindent' - Plug 'henrik/vim-indexed-search' - Plug 'andymass/vim-matchup' - Plug 'inkarkat/vim-ingo-library' " required by LineJuggler - Plug 'inkarkat/vim-LineJuggler', { 'branch': 'stable' } - Plug 'reedes/vim-pencil' - Plug 'tommcdo/vim-exchange' - Plug 'justinmk/vim-sneak' -" }}} - -" Text objects {{{ - Plug 'kana/vim-textobj-user' - Plug 'kana/vim-textobj-entire' - Plug 'kana/vim-textobj-line' - Plug 'kana/vim-textobj-indent' -" }}} - -" UI {{{ - Plug 'moll/vim-bbye' - Plug 'gerw/vim-HiLinkTrace' - Plug 'vim-airline/vim-airline' - Plug 'tpope/vim-obsession' - Plug 'romainl/vim-qf' - if g:vim_ide - Plug 'dyng/ctrlsf.vim' - endif -" }}} - -" Git {{{ - if g:vim_ide - Plug 'tpope/vim-fugitive' - Plug 'tpope/vim-rhubarb' - Plug 'airblade/vim-gitgutter' - endif -" }}} - -" FZF {{{ - Plug 'junegunn/fzf', { 'do': './install --bin' } - Plug 'junegunn/fzf.vim' -" }}} - -" Programming {{{ - Plug 'sheerun/vim-polyglot' - Plug 'chikamichi/mediawiki.vim' - if g:vim_ide - Plug 'neoclide/coc.nvim', { 'branch': 'release' } - Plug 'dag/vim2hs' - endif -" }}} - +runtime! dotfiles/plugins-list.vim call plug#end() " Automatically install/clean plugins (because I'm a programmer) {{{ From 264846e06650cebb2a9986816befe231be1a9c05 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 4 Dec 2020 12:34:35 +0200 Subject: [PATCH 415/713] [nvim] unmap the annoying Q mapping --- nvim/plugin/editing.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index b70785d..3efd596 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -109,6 +109,8 @@ set commentstring=//%s nnoremap kr set keymap=russian-jcuken-custom nnoremap ku set keymap=ukrainian-jcuken-custom + nnoremap Q + " }}} From c53525dc0908363791b5bc32bccbbd79a3098015 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 7 Dec 2020 00:01:56 +0200 Subject: [PATCH 416/713] [scripts/copy-crosscode-emoji-url] SHOW ONLY SFW EMOTES --- scripts/copy-crosscode-emoji-url | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index 9ae73a1..e747a88 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -27,11 +27,11 @@ config = ConfigParser(interpolation=None) config.read(config_path) -data = [] +emotes = [] def emote_downloader_and_iterator(): - global data + global emotes registry_dump_file = config.get( "default", "ccbot_emote_registry_dump_file", fallback=None @@ -47,22 +47,24 @@ def emote_downloader_and_iterator(): try: with open(registry_dump_file, "r") as f: - data = json.load(f) + emote_registry_data = json.load(f) except FileNotFoundError: response = requests.get(registry_dump_url, timeout=10) response.raise_for_status() - data = response.json() + emote_registry_data = response.json() - assert data["version"] == 1 + assert emote_registry_data["version"] == 1 - for emote in data["list"]: + emotes = [emote for emote in emote_registry_data["list"] if emote["safe"]] + + for emote in emotes: yield "{emote[ref]} [{emote[guild_name]}]".format(emote=emote) chosen_index = common_script_utils.run_chooser( emote_downloader_and_iterator(), prompt="emote", async_read=True ) -chosen_emote = data["list"][chosen_index] +chosen_emote = emotes[chosen_index] emote_url = chosen_emote["url"] default_emote_image_size = config.getint( From b30830ed8525bbb602a09ff1d4d2321531da6fce Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 7 Dec 2020 01:14:02 +0200 Subject: [PATCH 417/713] [scripts] add a script for inspecting Discord snowflakes --- scripts/discord-snowflake | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 scripts/discord-snowflake diff --git a/scripts/discord-snowflake b/scripts/discord-snowflake new file mode 100755 index 0000000..25380b9 --- /dev/null +++ b/scripts/discord-snowflake @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 + +# https://discord.com/developers/docs/reference#snowflakes + +import sys +import colorama +import time + +DISCORD_EPOCH = 1420070400000 # milliseconds + +user_snowflake = int(sys.argv[1]) + + +def print_field(name, value): + print( + "{}{}:{} {}".format( + colorama.Style.BRIGHT, name.rjust(21), colorama.Style.RESET_ALL, value + ) + ) + + +creation_time = (user_snowflake >> 22) + DISCORD_EPOCH +internal_worker_id = (user_snowflake >> 17) & 0x1F +internal_process_id = (user_snowflake >> 12) & 0x1F +increment = user_snowflake & 0xFFF + +print_field( + "Created at", + "{}.{}".format( + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(creation_time // 1000)), + creation_time % 1000, + ), +) +print_field("Internal worker ID", internal_worker_id) +print_field("Internal process ID", internal_process_id) +print_field("Increment", increment) From aed76b82b8f48c14a690a6aa99223769d69dd6d6 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 7 Dec 2020 19:30:26 +0200 Subject: [PATCH 418/713] [nvim] fix typos and bugs which caused the visual star mappings to break --- nvim/plugin/editing.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 3efd596..bbb9521 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -131,7 +131,7 @@ set commentstring=//%s " * and # in the Visual mode will search the selected text function! s:VisualStarSearch(search_cmd) let l:tmp = @" - normal! gvy + normal! y let @/ = '\V' . substitute(escape(@", a:search_cmd . '\'), '\n', '\\n', 'g') let @" = l:tmp endfunction @@ -140,8 +140,8 @@ set commentstring=//%s augroup vimrc-editing-visual-star-search autocmd! autocmd VimEnter * - \ xmap * :call VisualStarSearch('/')n - \|xmap # :call VisualStarSearch('?')N + \ xmap * call VisualStarSearch('/')n + \|xmap # call VisualStarSearch('?')N augroup END " }}} From 1ae3156b29ff55c6ac05860d3331a8e067dd5593 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 7 Dec 2020 19:52:07 +0200 Subject: [PATCH 419/713] [nvim] arrrrrgh, fix one other misuse of --- nvim/plugin/files.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/plugin/files.vim b/nvim/plugin/files.vim index 79c0262..f07659f 100644 --- a/nvim/plugin/files.vim +++ b/nvim/plugin/files.vim @@ -29,7 +29,7 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" let g:loaded_netrwPlugin = 1 " re-add Netrw's gx mappings since we've disabled them nnoremap gx call netrw#BrowseX(expand(''),netrw#CheckIfRemote()) - xnoremap gx :call netrw#BrowseXVis() + xnoremap gx call netrw#BrowseXVis() " }}} From b4acbcf006869b0c10b793fe98284db479ab2f71 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 11 Dec 2020 10:54:09 +0200 Subject: [PATCH 420/713] [nvim] annoying floating windows... --- nvim/plugin/completion.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/plugin/completion.vim b/nvim/plugin/completion.vim index 109913a..53f5e23 100644 --- a/nvim/plugin/completion.vim +++ b/nvim/plugin/completion.vim @@ -90,6 +90,7 @@ endif \ 'warningSign': '!!', \ } let g:coc_user_config['suggest.floatEnable'] = v:false + let g:coc_user_config['workspace.progressTarget'] = "statusline" runtime! coc-languages/*.vim From e2ebbccb2e40f17310fa91ab0925866d8241a26a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 14 Dec 2020 10:58:46 +0200 Subject: [PATCH 421/713] [scripts/welcome] fix crash on newer Android versions where /proc/stat is inaccessible --- script-resources/welcome/system_info.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/script-resources/welcome/system_info.py b/script-resources/welcome/system_info.py index e858f7c..d840055 100644 --- a/script-resources/welcome/system_info.py +++ b/script-resources/welcome/system_info.py @@ -48,7 +48,9 @@ def get_system_info(): info_lines.append("") - info("CPU Usage", "%s", _get_cpu_usage()) + cpu_usage_info = _get_cpu_usage() + if cpu_usage_info is not None: + info("CPU Usage", "%s", cpu_usage_info) info("Memory", "%s / %s (%s)", *_get_memory()) for disk_info in _get_disks(): @@ -109,7 +111,11 @@ def _get_shell(): def _get_cpu_usage(): - percent = psutil.cpu_percent() + try: + percent = psutil.cpu_percent() + except Exception as e: + print("Error in _get_cpu_usage:", e) + return None return colorize_percent(percent, warning=60, critical=80) @@ -153,7 +159,7 @@ def _get_battery(): try: battery = psutil.sensors_battery() except Exception as e: - print(e) + print("Error in _get_battery:", e) return None if battery is None: From ee8762198ec809fa29fa3facd9586c4244cd72c9 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 16 Dec 2020 09:05:10 +0200 Subject: [PATCH 422/713] [nvim] this should come in handy --- nvim/plugin/editing.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index bbb9521..e86f007 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -53,6 +53,7 @@ set commentstring=//%s set list let &listchars = "tab:\u2192 ,extends:>,precedes:<,eol:\u00ac,trail:\u00b7" let &showbreak = '>' + set display+=uhex " }}} From dbf28a4df44f57806a52af5a11453b0fde55abdd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 16 Dec 2020 19:06:18 +0200 Subject: [PATCH 423/713] [misc] disable sudoloop in the Yay config --- misc/yay.config.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/misc/yay.config.json b/misc/yay.config.json index 196f131..10d82fa 100644 --- a/misc/yay.config.json +++ b/misc/yay.config.json @@ -2,6 +2,5 @@ "answerdiff": "All", "completioninterval": 1, "devel": true, - "removemake": "yes", - "sudoloop": true + "removemake": "yes" } From 46b224a1114fc914bfbe2ed83c35dba0d4f233ec Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 17 Dec 2020 20:16:25 +0200 Subject: [PATCH 424/713] [git] git config --global init.defaultBranch main --- git/gitconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/git/gitconfig b/git/gitconfig index b31aaa2..fb45607 100644 --- a/git/gitconfig +++ b/git/gitconfig @@ -23,3 +23,6 @@ [alias] unstage = restore --staged initial-commit = commit --message 'initial commit' --allow-empty + +[init] + defaultBranch = main From 5a45cf8a3aed69993c6ed03c7154987b688c8ae7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 17 Dec 2020 23:36:29 +0200 Subject: [PATCH 425/713] [scripts/copy-crosscode-emoji-url] change the default fetch URL --- scripts/copy-crosscode-emoji-url | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index e747a88..6bfd3cf 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -12,7 +12,7 @@ import common_script_utils # noqa: E402 DEFAULT_REGISTRY_DUMP_URL = ( - "https://stronghold.crosscode.ru/~crosscodebot/emote-registry-tmp-export.json" + "https://stronghold.crosscode.ru/~crosscodebot/emote-registry.json" ) From 7e460fe374c21b537ccc742507c7a029bf57b55c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 24 Dec 2020 23:50:07 +0200 Subject: [PATCH 426/713] [kitty] change tab bar colors to match the neovim UI --- colorschemes/kitty.conf.py | 7 +++++++ colorschemes/out/kitty.conf | 5 +++++ kitty/kitty.conf | 4 +--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/colorschemes/kitty.conf.py b/colorschemes/kitty.conf.py index 9af9bb6..a82df90 100755 --- a/colorschemes/kitty.conf.py +++ b/colorschemes/kitty.conf.py @@ -16,6 +16,13 @@ print_color("selection_foreground", theme.selection_fg) for index, color in enumerate(theme.ansi_colors[:16]): print_color("color" + str(index), color) print_color("url_color", theme.link_color) + print_color("active_border_color", theme.ansi_colors[2]) print_color("inactive_border_color", theme.ansi_colors[8]) print_color("bell_border_color", theme.ansi_colors[1]) + +print_color("active_tab_foreground", theme.base16_colors[0x1]) +print_color("active_tab_background", theme.base16_colors[0xB]) +print_color("inactive_tab_foreground", theme.base16_colors[0x4]) +print_color("inactive_tab_background", theme.base16_colors[0x1]) +print_color("tab_bar_background", theme.base16_colors[0x1]) diff --git a/colorschemes/out/kitty.conf b/colorschemes/out/kitty.conf index 8db5b80..5736557 100644 --- a/colorschemes/out/kitty.conf +++ b/colorschemes/out/kitty.conf @@ -24,3 +24,8 @@ url_color #6699cc active_border_color #99cc99 inactive_border_color #747369 bell_border_color #f2777a +active_tab_foreground #393939 +active_tab_background #99cc99 +inactive_tab_foreground #a09f93 +inactive_tab_background #393939 +tab_bar_background #393939 diff --git a/kitty/kitty.conf b/kitty/kitty.conf index ec6f296..1c2dc19 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -347,9 +347,7 @@ tab_bar_min_tabs 1 active_tab_font_style bold # inactive_tab_foreground #444 # inactive_tab_background #999 -inactive_tab_font_style italic - -tab_bar_background #999 +inactive_tab_font_style none #: Tab bar colors and styles From f32857ef1cb0bdc01092477a982d2f98de15ded3 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 24 Dec 2020 23:50:47 +0200 Subject: [PATCH 427/713] [git] add the annoying ropeprojects to gitignore --- git/gitignore_global | 1 + 1 file changed, 1 insertion(+) diff --git a/git/gitignore_global b/git/gitignore_global index 382fa64..36465da 100644 --- a/git/gitignore_global +++ b/git/gitignore_global @@ -1,3 +1,4 @@ Session.vim .project.vim .DS_Store +.ropeproject From 2e543b77559a9c565c83c993ab1edfab13aac9f2 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 28 Dec 2020 01:31:04 +0200 Subject: [PATCH 428/713] [scripts/discord-whois] print the default avatar URL --- scripts/discord-whois | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/discord-whois b/scripts/discord-whois index 6304df1..77211d2 100755 --- a/scripts/discord-whois +++ b/scripts/discord-whois @@ -51,7 +51,7 @@ data = response.json() def print_field(name, value): print( "{}{}:{} {}".format( - colorama.Style.BRIGHT, name.rjust(12), colorama.Style.RESET_ALL, value + colorama.Style.BRIGHT, name.rjust(15), colorama.Style.RESET_ALL, value ) ) @@ -68,6 +68,12 @@ print_field( data["id"], data["avatar"], "gif" if data["avatar"].startswith("a_") else "png" ), ) +print_field( + "Default avatar", + "https://cdn.discordapp.com/embed/avatars/{}.png".format( + int(data["discriminator"], 10) % 5 + ), +) print_field("Bot", bool_to_yes_no(data.get("bot", False))) print_field("System user", bool_to_yes_no(data.get("system", False))) From 11e651e1cbf10c4139d0cbb8a921891097bf8bce Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 29 Dec 2020 21:20:25 +0200 Subject: [PATCH 429/713] [nvim] add some mappings for quickly manipulating diffs --- nvim/plugin/editing.vim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index e86f007..817f7cc 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -112,6 +112,13 @@ set commentstring=//%s nnoremap Q + " normal mode + nnoremap dg :.diffget + nnoremap dp :.diffput + " visual mode + xnoremap dg :diffget + xnoremap dp :diffput + " }}} From ed7835b342fd3eb216d0c855c79ae6477959991a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 2 Jan 2021 00:58:04 +0200 Subject: [PATCH 430/713] [scripts/discord-whois] fix a crash on users with the default avatar --- scripts/discord-whois | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/discord-whois b/scripts/discord-whois index 77211d2..2a8cda9 100755 --- a/scripts/discord-whois +++ b/scripts/discord-whois @@ -62,18 +62,20 @@ def bool_to_yes_no(value): print_field("ID", data["id"]) print_field("Name", "{}#{}".format(data["username"], data["discriminator"])) -print_field( - "Avatar", + +default_avatar_url = "https://cdn.discordapp.com/embed/avatars/{}.png".format( + int(data["discriminator"], 10) % 5 +) +avatar_url = ( "https://cdn.discordapp.com/avatars/{}/{}.{}".format( data["id"], data["avatar"], "gif" if data["avatar"].startswith("a_") else "png" - ), -) -print_field( - "Default avatar", - "https://cdn.discordapp.com/embed/avatars/{}.png".format( - int(data["discriminator"], 10) % 5 - ), + ) + if data["avatar"] is not None + else default_avatar_url ) + +print_field("Avatar", avatar_url) +print_field("Default avatar", default_avatar_url) print_field("Bot", bool_to_yes_no(data.get("bot", False))) print_field("System user", bool_to_yes_no(data.get("system", False))) From cc28755977cec90b0bf356998780c6a259b104ff Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 3 Jan 2021 19:24:18 +0200 Subject: [PATCH 431/713] [zsh] set my syntax theme automatically --- zsh/plugins.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index 4e7c7e6..20d10c1 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -75,6 +75,9 @@ FAST_WORK_DIR="$ZSH_CACHE_DIR" if [[ "$TERM" != "linux" ]]; then _plugin fast-syntax-highlighting 'zdharma/fast-syntax-highlighting' "$_checkout_latest_version" set-my-syntax-theme() { fast-theme "$ZSH_DOTFILES/my-syntax-theme.ini" "$@"; } + if [[ "$FAST_THEME_NAME" != "my-syntax-theme" && -z "$DOTFILES_DISABLE_MY_COLORSCHEME" ]]; then + set-my-syntax-theme + fi fi unset _checkout_latest_version From ffa7f8f38adbb0c3e3b9c63153d4f93256ca25a9 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 3 Jan 2021 19:27:02 +0200 Subject: [PATCH 432/713] [zsh] add a bunch of new aliases --- zsh/aliases.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 0d20aae..f3c400e 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -89,3 +89,11 @@ alias rsync-backup='rsync --archive --compress --verbose --human-readable --part if command_exists ncdu; then alias ncdu='ncdu --confirm-quit' fi + +alias bin-disassemble='objdump -M intel-mnemonics -d' +alias bin-list-symbols='nm' +alias bin-list-dylib-symbols='nm -gD' + +# Duplicated as an alias to prevent autocorrection of the real "command" part. +# See also scripts/prime-run +alias prime-run='__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia ' From 51fd230d51549fe931cec27e070b4921b7ed3caa Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 3 Jan 2021 19:27:52 +0200 Subject: [PATCH 433/713] [zsh] fix a typo in the automatic theme setter --- zsh/plugins.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index 20d10c1..f446394 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -75,7 +75,7 @@ FAST_WORK_DIR="$ZSH_CACHE_DIR" if [[ "$TERM" != "linux" ]]; then _plugin fast-syntax-highlighting 'zdharma/fast-syntax-highlighting' "$_checkout_latest_version" set-my-syntax-theme() { fast-theme "$ZSH_DOTFILES/my-syntax-theme.ini" "$@"; } - if [[ "$FAST_THEME_NAME" != "my-syntax-theme" && -z "$DOTFILES_DISABLE_MY_COLORSCHEME" ]]; then + if [[ "$FAST_THEME_NAME" != "my-syntax-theme" && -z "$DOTFILES_DISABLE_MY_SYNTAX_THEME" ]]; then set-my-syntax-theme fi fi From f7ecdeac7b887ae2eba19ee7fc42ccc2fc4c6fa5 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 3 Jan 2021 21:22:34 +0200 Subject: [PATCH 434/713] [scripts/copy-crosscode-emoji-url] change the default URL --- scripts/copy-crosscode-emoji-url | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index 6bfd3cf..ddca297 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -11,9 +11,7 @@ sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resourc import common_script_utils # noqa: E402 -DEFAULT_REGISTRY_DUMP_URL = ( - "https://stronghold.crosscode.ru/~crosscodebot/emote-registry.json" -) +DEFAULT_REGISTRY_DUMP_URL = "https://stronghold.crosscode.ru/~ccbot/emote-registry.json" if os.name == "posix": From 3e499704a0e841f5eb5f5f294fd964aac1649dc5 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 5 Jan 2021 20:41:33 +0200 Subject: [PATCH 435/713] [zsh] make the diff alias even more concrete --- zsh/aliases.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index f3c400e..c5227a4 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -14,7 +14,7 @@ alias history='fc -i -l 1' alias cdd='dirs -v' alias grep='grep --color=auto' -alias diff='diff --color=auto' +alias diff='diff --color=auto --unified' # exa is a modern replacement for ls - https://the.exa.website/ if command_exists exa; then From cf9f46a90ea09a96bb35127601cc4f8685d50823 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 6 Jan 2021 00:33:47 +0200 Subject: [PATCH 436/713] [zsh] display current Python virtualenv in the prompt --- zsh/prompt.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index 3fba7a8..0644c0a 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -1,5 +1,7 @@ #!/usr/bin/env zsh +export VIRTUAL_ENV_DISABLE_PROMPT=false + # Escapes `%` in all arguments by replacing it with `%%`. Escaping is needed so # that untrusted input (e.g. git branch names) doesn't affect prompt rendering. prompt_escape() { @@ -51,7 +53,7 @@ prompt_vcs_info() { fi done - print -n ' %F{blue}git:%F{magenta}'"$(prompt_escape "$branch")"'%F{blue}%f' + print -n ' %F{blue}git:%F{magenta}'"$(prompt_escape "$branch")"'%f' } # configure prompt expansion @@ -98,6 +100,9 @@ PROMPT+=' in %F{cyan}%~%f' # VCS info PROMPT+='$(prompt_vcs_info 2>/dev/null)' +# Python's virtualenv +PROMPT+='${VIRTUAL_ENV:+" %F{blue}venv:%F{magenta}${VIRTUAL_ENV:t}%f"}' + PROMPT+=' ' # command execution time From 1e9f4c761842e61391c707ba19f3f1ff433ef00c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 8 Jan 2021 18:12:37 +0200 Subject: [PATCH 437/713] [scripts] add a script for marking files as recently used --- scripts/mark-as-recently-used | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 scripts/mark-as-recently-used diff --git a/scripts/mark-as-recently-used b/scripts/mark-as-recently-used new file mode 100755 index 0000000..63475cd --- /dev/null +++ b/scripts/mark-as-recently-used @@ -0,0 +1,14 @@ +#!/usr/bin/python3 +# Taken from + +import gi +import sys + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, Gio, GLib # noqa E402 + +rec_mgr = Gtk.RecentManager.get_default() +for arg in sys.argv[1:]: + rec_mgr.add_item(Gio.File.new_for_path(arg).get_uri()) +GLib.idle_add(Gtk.main_quit) +Gtk.main() From e786ef6448f910a50f90b48967421e91cb5c49c6 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 8 Jan 2021 18:26:24 +0200 Subject: [PATCH 438/713] [zsh] re-define j to use fzf for selection instead of fasd's algorithm --- zsh/plugins.zsh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index f446394..edba661 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -62,6 +62,27 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" # }}} +# fasd {{{ + +unalias j +j() { + local _fasd_ret + _fasd_ret="$( + # -l: list all paths in the database (without scores) + # -d: list only directories + # -R: in the reverse order + fasd -l -d -R | + fzf --height=40% --layout=reverse --tiebreak=index --query="$*" + )" + if [[ -d "$_fasd_ret" ]]; then + cd -- "$_fasd_ret" + elif [[ -n "$_fasd_ret" ]]; then + print -- "$_fasd_ret" + fi +} + +# }}} + # _plugin fzf 'junegunn/fzf' "$_checkout_latest_version" \ # build='./install --bin' \ # after_load='plugin-cfg-path path prepend bin' \ From f0619a16990916bbea2358b11caaa8221e57482d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 9 Jan 2021 20:44:38 +0200 Subject: [PATCH 439/713] [mozilla] add a little Firefox devtools customization --- mozilla/firefox/userContent.css | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 mozilla/firefox/userContent.css diff --git a/mozilla/firefox/userContent.css b/mozilla/firefox/userContent.css new file mode 100644 index 0000000..932f3e5 --- /dev/null +++ b/mozilla/firefox/userContent.css @@ -0,0 +1,14 @@ +/* prettier-ignore */ +@-moz-document url-prefix(chrome://devtools/content/), url(about:devtools-toolbox) { + :root { + --theme-body-font-size: 13px !important; + --theme-code-font-size: 13px !important; + --theme-code-line-height: calc(15 / 13) !important; + } + + /* + :root[platform="linux"] { + --monospace-font-family: "Ubuntu Mono" !important; + } + */ +} From 955559db5eb89459c43f3aa61967455aca745703 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 10 Jan 2021 20:04:27 +0200 Subject: [PATCH 440/713] [nvim] don't set formatexpr --- nvim/plugin/completion.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/nvim/plugin/completion.vim b/nvim/plugin/completion.vim index 53f5e23..2789e40 100644 --- a/nvim/plugin/completion.vim +++ b/nvim/plugin/completion.vim @@ -25,7 +25,6 @@ endif augroup vimrc-coc autocmd! autocmd FileType * if IsCocEnabled() - \|let &l:formatexpr = "CocAction('formatSelected')" \|let &l:keywordprg = ":CocKeywordprg" \|endif autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') From 14e64127e4fd068f28581bc11a52d73d8dc772c0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 12 Jan 2021 15:05:42 +0200 Subject: [PATCH 441/713] [nvim] fix syntax syncing for JS/TS after a vim-polyglot update (this made opening crosscode/assets/js/game.compiled.js insanely slow) --- nvim/after/ftplugin/css.vim | 1 - nvim/after/ftplugin/javascript.vim | 1 - nvim/after/ftplugin/markdown.vim | 2 +- nvim/after/ftplugin/mediawiki.vim | 2 +- nvim/after/ftplugin/scss.vim | 1 - nvim/after/ftplugin/typescript.vim | 1 - nvim/after/syntax/javascript.vim | 1 + nvim/after/syntax/typescript.vim | 1 + nvim/after/syntax/typescriptreact.vim | 1 + 9 files changed, 5 insertions(+), 6 deletions(-) delete mode 100644 nvim/after/ftplugin/css.vim delete mode 100644 nvim/after/ftplugin/javascript.vim delete mode 100644 nvim/after/ftplugin/scss.vim delete mode 100644 nvim/after/ftplugin/typescript.vim create mode 100644 nvim/after/syntax/javascript.vim create mode 100644 nvim/after/syntax/typescript.vim create mode 100644 nvim/after/syntax/typescriptreact.vim diff --git a/nvim/after/ftplugin/css.vim b/nvim/after/ftplugin/css.vim deleted file mode 100644 index df4fe48..0000000 --- a/nvim/after/ftplugin/css.vim +++ /dev/null @@ -1 +0,0 @@ -setlocal iskeyword+=- diff --git a/nvim/after/ftplugin/javascript.vim b/nvim/after/ftplugin/javascript.vim deleted file mode 100644 index d4217f4..0000000 --- a/nvim/after/ftplugin/javascript.vim +++ /dev/null @@ -1 +0,0 @@ -setlocal matchpairs-=<:> diff --git a/nvim/after/ftplugin/markdown.vim b/nvim/after/ftplugin/markdown.vim index 4fcafad..5408829 100644 --- a/nvim/after/ftplugin/markdown.vim +++ b/nvim/after/ftplugin/markdown.vim @@ -1,4 +1,4 @@ -execute 'source' fnameescape(expand(':p:h').'/text.vim') +source :h/text.vim let s:src_file = expand('%') let s:out_file = s:src_file.'.html' diff --git a/nvim/after/ftplugin/mediawiki.vim b/nvim/after/ftplugin/mediawiki.vim index d86c38b..5138151 100644 --- a/nvim/after/ftplugin/mediawiki.vim +++ b/nvim/after/ftplugin/mediawiki.vim @@ -1 +1 @@ -execute 'source' fnameescape(expand(':p:h').'/text.vim') +source :h/text.vim diff --git a/nvim/after/ftplugin/scss.vim b/nvim/after/ftplugin/scss.vim deleted file mode 100644 index 4144554..0000000 --- a/nvim/after/ftplugin/scss.vim +++ /dev/null @@ -1 +0,0 @@ -execute 'source' fnameescape(expand(':p:h').'/css.vim') diff --git a/nvim/after/ftplugin/typescript.vim b/nvim/after/ftplugin/typescript.vim deleted file mode 100644 index 2d4068f..0000000 --- a/nvim/after/ftplugin/typescript.vim +++ /dev/null @@ -1 +0,0 @@ -execute 'source' fnameescape(expand(':p:h').'/javascript.vim') diff --git a/nvim/after/syntax/javascript.vim b/nvim/after/syntax/javascript.vim new file mode 100644 index 0000000..4a253a1 --- /dev/null +++ b/nvim/after/syntax/javascript.vim @@ -0,0 +1 @@ +syntax sync minlines=500 diff --git a/nvim/after/syntax/typescript.vim b/nvim/after/syntax/typescript.vim new file mode 100644 index 0000000..2d9e54a --- /dev/null +++ b/nvim/after/syntax/typescript.vim @@ -0,0 +1 @@ +source :h/javascript.vim diff --git a/nvim/after/syntax/typescriptreact.vim b/nvim/after/syntax/typescriptreact.vim new file mode 100644 index 0000000..6a77e28 --- /dev/null +++ b/nvim/after/syntax/typescriptreact.vim @@ -0,0 +1 @@ +source :h/typescript.vim From 0cce46f083ce777b9efb9569c9a2e9d20d8d01a9 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 12 Jan 2021 15:06:43 +0200 Subject: [PATCH 442/713] [nvim] disable the po airline plugin --- nvim/plugin/interface.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index cb286af..7a196d3 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -102,6 +102,7 @@ endif let g:airline#extensions#branch#enabled = 1 let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#coc#enabled = 1 + let g:airline#extensions#po#enabled = 0 let g:airline#extensions#tabline#left_sep = ' ' let g:airline#extensions#tabline#left_alt_sep = '' From 9aa78e8c924af6a2c639546c68c153b1f94a27de Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 16 Jan 2021 17:10:36 +0200 Subject: [PATCH 443/713] [scripts/discord-whois] refactor and add more options --- scripts/discord-whois | 113 ++++++++++++++++++++++++++---------------- 1 file changed, 71 insertions(+), 42 deletions(-) diff --git a/scripts/discord-whois b/scripts/discord-whois index 2a8cda9..4dd5ca5 100755 --- a/scripts/discord-whois +++ b/scripts/discord-whois @@ -1,14 +1,16 @@ #!/usr/bin/env python3 -# https://discord.com/developers/docs/resources/user#user-object -# https://discord.com/developers/docs/resources/user#user-object#get-user -# https://discord.com/developers/docs/reference +# +# +# import sys import os import requests import colorama import time +import argparse + DISCORD_EPOCH = 1420070400000 # milliseconds # https://discord.com/developers/docs/resources/user#user-object-user-flags @@ -28,12 +30,29 @@ DISCORD_FLAGS = { "Verified Bot Developer": 1 << 17, } -with open(os.path.expanduser("~/.config/dotfiles/discord-tools-bot-token.txt")) as f: - bot_token = f.read().strip() -user_snowflake = int(sys.argv[1]) +parser = argparse.ArgumentParser() +parser.add_argument("user_snowflake", type=int) +parser.add_argument("--bot-token", type=str) +parser.add_argument("--image-size", type=int) +parser.add_argument("--get-prop", type=str) +cli_args = parser.parse_args() -# no timeout here, sadly, due to this genius: https://github.com/psf/requests/issues/3099#issuecomment-215522806 +user_snowflake = cli_args.user_snowflake + +bot_token = cli_args.bot_token +if bot_token is None: + with open( + os.path.expanduser("~/.config/dotfiles/discord-tools-bot-token.txt") + ) as f: + bot_token = f.read().strip() + +image_size = cli_args.image_size +if not (image_size is None or (image_size > 0 and image_size & (image_size - 1)) == 0): + parser.error("image_size must be greater than zero and a power of two") + + +# no timeout here, sadly, due to this genius: response = requests.get( "https://discordapp.com/api/users/{}".format(user_snowflake), headers={"Authorization": "Bot {}".format(bot_token)}, @@ -42,61 +61,71 @@ response = requests.get( try: response.raise_for_status() except requests.HTTPError as err: - print(response.json()) + print(response.json(), file=sys.stderr) raise err -data = response.json() +raw_data = response.json() +data = {} - -def print_field(name, value): - print( - "{}{}:{} {}".format( - colorama.Style.BRIGHT, name.rjust(15), colorama.Style.RESET_ALL, value - ) - ) - - -def bool_to_yes_no(value): - return "yes" if value else "no" - - -print_field("ID", data["id"]) -print_field("Name", "{}#{}".format(data["username"], data["discriminator"])) +data["ID"] = raw_data["id"] +data["Name"] = "{}#{}".format(raw_data["username"], raw_data["discriminator"]) default_avatar_url = "https://cdn.discordapp.com/embed/avatars/{}.png".format( - int(data["discriminator"], 10) % 5 + int(raw_data["discriminator"], 10) % 5 ) avatar_url = ( "https://cdn.discordapp.com/avatars/{}/{}.{}".format( - data["id"], data["avatar"], "gif" if data["avatar"].startswith("a_") else "png" + raw_data["id"], + raw_data["avatar"], + "gif" if raw_data["avatar"].startswith("a_") else "png", ) - if data["avatar"] is not None + if raw_data["avatar"] is not None else default_avatar_url ) +if image_size is not None: + avatar_url += "?size={}".format(image_size) -print_field("Avatar", avatar_url) -print_field("Default avatar", default_avatar_url) -print_field("Bot", bool_to_yes_no(data.get("bot", False))) -print_field("System user", bool_to_yes_no(data.get("system", False))) +data["Avatar"] = avatar_url +data["Default avatar"] = default_avatar_url + +data["Bot"] = raw_data.get("bot", False) +data["System user"] = raw_data.get("system", False) # https://discord.com/developers/docs/reference#convert-snowflake-to-datetime snowflake_creation_time = (user_snowflake >> 22) + DISCORD_EPOCH -print_field( - "Created at", - "{}.{}".format( - time.strftime( - "%Y-%m-%d %H:%M:%S", time.gmtime(snowflake_creation_time // 1000) - ), - snowflake_creation_time % 1000, - ), +data["Created at"] = "{}.{} UTC".format( + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(snowflake_creation_time // 1000)), + snowflake_creation_time % 1000, ) -user_flags = data["public_flags"] +user_flags = raw_data["public_flags"] if user_flags == 0: - print_field("Flags", "none") + data["Flags"] = "" else: user_flag_names = [] for flag_name, bitmask in DISCORD_FLAGS.items(): if user_flags & bitmask: user_flag_names.append(flag_name) - print_field("Flags", ", ".join(user_flag_names)) + data["Flags"] = ", ".join(user_flag_names) + + +if cli_args.get_prop is None: + max_name_length = max(map(len, data.keys())) + for name, value in data.items(): + + if value is True: + value = "yes" + elif value is False: + value = "no" + + print( + "{}{:>{}}:{} {}".format( + colorama.Style.BRIGHT, + name, + max_name_length + 1, + colorama.Style.RESET_ALL, + value, + ) + ) +else: + print(data[cli_args.get_prop]) From ab7320297f5aaade4fb40d440b6f65a12286c7e3 Mon Sep 17 00:00:00 2001 From: Keanu Date: Thu, 31 Dec 2020 16:02:00 +0000 Subject: [PATCH 444/713] [scripts/discord-stream] Now uses separate file. --- nvim/dotfiles/plugins-list.vim | 1 + scripts/discord-stream-desktop-audio | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index f8ec28c..9098d92 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -2,6 +2,7 @@ Plug 'tpope/vim-eunuch' if g:vim_ide Plug 'francoiscabrol/ranger.vim' + Plug 'rbgrouleff/bclose.vim' endif " }}} diff --git a/scripts/discord-stream-desktop-audio b/scripts/discord-stream-desktop-audio index 603e5a4..dd82faa 100755 --- a/scripts/discord-stream-desktop-audio +++ b/scripts/discord-stream-desktop-audio @@ -7,7 +7,7 @@ import os guild_id = int(sys.argv[1]) voice_channel_id = int(sys.argv[2]) -with open(os.path.expanduser("~/.config/dotfiles/discord-tools-bot-token.txt")) as f: +with open(os.path.expanduser("~/.config/dotfiles/discord-tools-user-token.txt")) as f: bot_token = f.read().strip() @@ -34,4 +34,4 @@ async def on_ready(): ) -bot.run(bot_token) +bot.run(bot_token, bot=False) From 5e2ea81830cb34a1db99376f1d6cd7f8e0d6c01c Mon Sep 17 00:00:00 2001 From: Keanu Date: Sat, 2 Jan 2021 18:39:31 +0100 Subject: [PATCH 445/713] [scripts/copy-emote] Removed requirement of 'safe' --- scripts/copy-crosscode-emoji-url | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index ddca297..5354f37 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -53,7 +53,9 @@ def emote_downloader_and_iterator(): assert emote_registry_data["version"] == 1 - emotes = [emote for emote in emote_registry_data["list"] if emote["safe"]] + emotes = [emote for emote in emote_registry_data["list"] + # if emote["safe"] + ] for emote in emotes: yield "{emote[ref]} [{emote[guild_name]}]".format(emote=emote) From 51a3ea7777f55cd01be96fe62e1866088a0d89ee Mon Sep 17 00:00:00 2001 From: Keanu Date: Sat, 2 Jan 2021 18:41:31 +0100 Subject: [PATCH 446/713] [nvim] Added Lua to coc. --- nvim/coc-languages/lua.vim | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 nvim/coc-languages/lua.vim diff --git a/nvim/coc-languages/lua.vim b/nvim/coc-languages/lua.vim new file mode 100644 index 0000000..e68ab5d --- /dev/null +++ b/nvim/coc-languages/lua.vim @@ -0,0 +1,3 @@ +let g:coc_global_extensions += ['coc-lua'] +let s:filetypes = ['lua'] +let g:coc_filetypes += s:filetypes From 0ddb5c5777da5a52724550ab7f33fe7befd12abb Mon Sep 17 00:00:00 2001 From: Keanu Date: Sat, 2 Jan 2021 18:41:54 +0100 Subject: [PATCH 447/713] [zsh] Added completions for gh cli. --- zsh/completions/_gh | 159 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 zsh/completions/_gh diff --git a/zsh/completions/_gh b/zsh/completions/_gh new file mode 100644 index 0000000..b872834 --- /dev/null +++ b/zsh/completions/_gh @@ -0,0 +1,159 @@ +#compdef _gh gh + +# zsh completion for gh -*- shell-script -*- + +__gh_debug() +{ + local file="$BASH_COMP_DEBUG_FILE" + if [[ -n ${file} ]]; then + echo "$*" >> "${file}" + fi +} + +_gh() +{ + local shellCompDirectiveError=1 + local shellCompDirectiveNoSpace=2 + local shellCompDirectiveNoFileComp=4 + local shellCompDirectiveFilterFileExt=8 + local shellCompDirectiveFilterDirs=16 + + local lastParam lastChar flagPrefix requestComp out directive compCount comp lastComp + local -a completions + + __gh_debug "\n========= starting completion logic ==========" + __gh_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" + + # The user could have moved the cursor backwards on the command-line. + # We need to trigger completion from the $CURRENT location, so we need + # to truncate the command-line ($words) up to the $CURRENT location. + # (We cannot use $CURSOR as its value does not work when a command is an alias.) + words=("${=words[1,CURRENT]}") + __gh_debug "Truncated words[*]: ${words[*]}," + + lastParam=${words[-1]} + lastChar=${lastParam[-1]} + __gh_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" + + # For zsh, when completing a flag with an = (e.g., gh -n=) + # completions must be prefixed with the flag + setopt local_options BASH_REMATCH + if [[ "${lastParam}" =~ '-.*=' ]]; then + # We are dealing with a flag with an = + flagPrefix="-P ${BASH_REMATCH}" + fi + + # Prepare the command to obtain completions + requestComp="${words[1]} __complete ${words[2,-1]}" + if [ "${lastChar}" = "" ]; then + # If the last parameter is complete (there is a space following it) + # We add an extra empty parameter so we can indicate this to the go completion code. + __gh_debug "Adding extra empty parameter" + requestComp="${requestComp} \"\"" + fi + + __gh_debug "About to call: eval ${requestComp}" + + # Use eval to handle any environment variables and such + out=$(eval ${requestComp} 2>/dev/null) + __gh_debug "completion output: ${out}" + + # Extract the directive integer following a : from the last line + local lastLine + while IFS='\n' read -r line; do + lastLine=${line} + done < <(printf "%s\n" "${out[@]}") + __gh_debug "last line: ${lastLine}" + + if [ "${lastLine[1]}" = : ]; then + directive=${lastLine[2,-1]} + # Remove the directive including the : and the newline + local suffix + (( suffix=${#lastLine}+2)) + out=${out[1,-$suffix]} + else + # There is no directive specified. Leave $out as is. + __gh_debug "No directive found. Setting do default" + directive=0 + fi + + __gh_debug "directive: ${directive}" + __gh_debug "completions: ${out}" + __gh_debug "flagPrefix: ${flagPrefix}" + + if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then + __gh_debug "Completion received error. Ignoring completions." + return + fi + + compCount=0 + while IFS='\n' read -r comp; do + if [ -n "$comp" ]; then + # If requested, completions are returned with a description. + # The description is preceded by a TAB character. + # For zsh's _describe, we need to use a : instead of a TAB. + # We first need to escape any : as part of the completion itself. + comp=${comp//:/\\:} + + local tab=$(printf '\t') + comp=${comp//$tab/:} + + ((compCount++)) + __gh_debug "Adding completion: ${comp}" + completions+=${comp} + lastComp=$comp + fi + done < <(printf "%s\n" "${out[@]}") + + if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then + # File extension filtering + local filteringCmd + filteringCmd='_files' + for filter in ${completions[@]}; do + if [ ${filter[1]} != '*' ]; then + # zsh requires a glob pattern to do file filtering + filter="\*.$filter" + fi + filteringCmd+=" -g $filter" + done + filteringCmd+=" ${flagPrefix}" + + __gh_debug "File filtering command: $filteringCmd" + _arguments '*:filename:'"$filteringCmd" + elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then + # File completion for directories only + local subDir + subdir="${completions[1]}" + if [ -n "$subdir" ]; then + __gh_debug "Listing directories in $subdir" + pushd "${subdir}" >/dev/null 2>&1 + else + __gh_debug "Listing directories in ." + fi + + _arguments '*:dirname:_files -/'" ${flagPrefix}" + if [ -n "$subdir" ]; then + popd >/dev/null 2>&1 + fi + elif [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ] && [ ${compCount} -eq 1 ]; then + __gh_debug "Activating nospace." + # We can use compadd here as there is no description when + # there is only one completion. + compadd -S '' "${lastComp}" + elif [ ${compCount} -eq 0 ]; then + if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then + __gh_debug "deactivating file completion" + else + # Perform file completion + __gh_debug "activating file completion" + _arguments '*:filename:_files'" ${flagPrefix}" + fi + else + _describe "completions" completions $(echo $flagPrefix) + fi +} + +# don't run the completion function when being source-ed or eval-ed +if [ "$funcstack[1]" = "_gh" ]; then + _gh +fi From 5425d38058ee150c9bc38b23e13df1ef7ace9ba0 Mon Sep 17 00:00:00 2001 From: Keanu Date: Sat, 16 Jan 2021 14:17:26 +0100 Subject: [PATCH 448/713] Add pull config. --- .github/pull.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .github/pull.yml diff --git a/.github/pull.yml b/.github/pull.yml new file mode 100644 index 0000000..2950aad --- /dev/null +++ b/.github/pull.yml @@ -0,0 +1,6 @@ +version: "1" +rules: + - base: master + upstream: dmitmel:master + mergeMethod: merge + mergeUnstable: true From f84dbb619c92ec0abf648293f861f2a1d4bbe5bc Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 16 Jan 2021 19:23:14 +0200 Subject: [PATCH 449/713] [scripts/copy-crosscode-emoji-url] add an option for adding the emote name to the copied URL --- scripts/copy-crosscode-emoji-url | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index ddca297..b34b43c 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -5,6 +5,7 @@ import os from configparser import ConfigParser import requests import json +import urllib.parse sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resources")) @@ -64,12 +65,20 @@ chosen_index = common_script_utils.run_chooser( ) chosen_emote = emotes[chosen_index] -emote_url = chosen_emote["url"] +emote_url = urllib.parse.urlparse(chosen_emote["url"]) +emote_url_query = urllib.parse.parse_qs(emote_url.query) + default_emote_image_size = config.getint( "default", "default_emote_image_size", fallback=None ) if default_emote_image_size is not None: - emote_url += "?size={}".format(default_emote_image_size) + emote_url_query["size"] = [str(default_emote_image_size)] + +if config.getboolean("default", "add_emote_name_to_url", fallback=False): + emote_url_query["name"] = [chosen_emote["name"]] + +emote_url_query = urllib.parse.urlencode(emote_url_query, doseq=True) +emote_url = urllib.parse.urlunparse(emote_url._replace(query=emote_url_query)) common_script_utils.set_clipboard(emote_url) From 62611bb01e4a87a7f00b5d1dec9729127f8aec2e Mon Sep 17 00:00:00 2001 From: Keanu Date: Sun, 17 Jan 2021 12:07:14 +0100 Subject: [PATCH 450/713] [nvim] Added WakaTime plugin. --- nvim/dotfiles/plugins-list.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index 9098d92..69dfedd 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -65,3 +65,7 @@ Plug 'dag/vim2hs' endif " }}} + +" Misc {{{ + Plug 'wakatime/vim-wakatime' +" }}} From 159a142967fb08f3227eca60982ba4e57883e76a Mon Sep 17 00:00:00 2001 From: Keanu Date: Sun, 17 Jan 2021 12:07:31 +0100 Subject: [PATCH 451/713] Removed fasd stuff. --- zsh/plugins.zsh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index edba661..0687e21 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -64,22 +64,22 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" # fasd {{{ -unalias j -j() { - local _fasd_ret - _fasd_ret="$( - # -l: list all paths in the database (without scores) - # -d: list only directories - # -R: in the reverse order - fasd -l -d -R | - fzf --height=40% --layout=reverse --tiebreak=index --query="$*" - )" - if [[ -d "$_fasd_ret" ]]; then - cd -- "$_fasd_ret" - elif [[ -n "$_fasd_ret" ]]; then - print -- "$_fasd_ret" - fi -} +#unalias j +#j() { +# local _fasd_ret +# _fasd_ret="$( +# # -l: list all paths in the database (without scores) +# # -d: list only directories +# # -R: in the reverse order +# fasd -l -d -R | +# fzf --height=40% --layout=reverse --tiebreak=index --query="$*" +# )" +# if [[ -d "$_fasd_ret" ]]; then +# cd -- "$_fasd_ret" +# elif [[ -n "$_fasd_ret" ]]; then +# print -- "$_fasd_ret" +# fi +#} # }}} From 4d6ff353f944cd47774386542af6f290b6f22d8a Mon Sep 17 00:00:00 2001 From: Keanu Date: Sun, 17 Jan 2021 14:26:01 +0100 Subject: [PATCH 452/713] Updated merge strategy. --- .github/pull.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/pull.yml b/.github/pull.yml index 2950aad..a1afdb1 100644 --- a/.github/pull.yml +++ b/.github/pull.yml @@ -1,6 +1,6 @@ -version: "1" +version: '1' rules: - base: master upstream: dmitmel:master - mergeMethod: merge + mergeMethod: rebase mergeUnstable: true From 6998226ea195d95dff1f9c7d2b45e5e65d0b656b Mon Sep 17 00:00:00 2001 From: "pull[bot]" <39814207+pull[bot]@users.noreply.github.com> Date: Sun, 17 Jan 2021 14:28:31 +0100 Subject: [PATCH 453/713] updated --- scripts/copy-crosscode-emoji-url | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index 5354f37..a72caf2 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -5,6 +5,7 @@ import os from configparser import ConfigParser import requests import json +import urllib.parse sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resources")) @@ -66,12 +67,20 @@ chosen_index = common_script_utils.run_chooser( ) chosen_emote = emotes[chosen_index] -emote_url = chosen_emote["url"] +emote_url = urllib.parse.urlparse(chosen_emote["url"]) +emote_url_query = urllib.parse.parse_qs(emote_url.query) + default_emote_image_size = config.getint( "default", "default_emote_image_size", fallback=None ) if default_emote_image_size is not None: - emote_url += "?size={}".format(default_emote_image_size) + emote_url_query["size"] = [str(default_emote_image_size)] + +if config.getboolean("default", "add_emote_name_to_url", fallback=False): + emote_url_query["name"] = [chosen_emote["name"]] + +emote_url_query = urllib.parse.urlencode(emote_url_query, doseq=True) +emote_url = urllib.parse.urlunparse(emote_url._replace(query=emote_url_query)) common_script_utils.set_clipboard(emote_url) From f62df4016ddae451017f8fea688362a93c03c6c6 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 18 Jan 2021 11:18:34 +0200 Subject: [PATCH 454/713] [scripts/copy-crosscode-emoji-url] change the order of URL params --- scripts/copy-crosscode-emoji-url | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index b34b43c..2e22b6c 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -68,15 +68,15 @@ chosen_emote = emotes[chosen_index] emote_url = urllib.parse.urlparse(chosen_emote["url"]) emote_url_query = urllib.parse.parse_qs(emote_url.query) +if config.getboolean("default", "add_emote_name_to_url", fallback=False): + emote_url_query["name"] = [chosen_emote["name"]] + default_emote_image_size = config.getint( "default", "default_emote_image_size", fallback=None ) if default_emote_image_size is not None: emote_url_query["size"] = [str(default_emote_image_size)] -if config.getboolean("default", "add_emote_name_to_url", fallback=False): - emote_url_query["name"] = [chosen_emote["name"]] - emote_url_query = urllib.parse.urlencode(emote_url_query, doseq=True) emote_url = urllib.parse.urlunparse(emote_url._replace(query=emote_url_query)) From 3d7078d8a14d4a282e0251ef41e08b76a9233133 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 18 Jan 2021 11:18:34 +0200 Subject: [PATCH 455/713] [scripts/copy-crosscode-emoji-url] change the order of URL params --- scripts/copy-crosscode-emoji-url | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index a72caf2..03d26cd 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -70,15 +70,15 @@ chosen_emote = emotes[chosen_index] emote_url = urllib.parse.urlparse(chosen_emote["url"]) emote_url_query = urllib.parse.parse_qs(emote_url.query) +if config.getboolean("default", "add_emote_name_to_url", fallback=False): + emote_url_query["name"] = [chosen_emote["name"]] + default_emote_image_size = config.getint( "default", "default_emote_image_size", fallback=None ) if default_emote_image_size is not None: emote_url_query["size"] = [str(default_emote_image_size)] -if config.getboolean("default", "add_emote_name_to_url", fallback=False): - emote_url_query["name"] = [chosen_emote["name"]] - emote_url_query = urllib.parse.urlencode(emote_url_query, doseq=True) emote_url = urllib.parse.urlunparse(emote_url._replace(query=emote_url_query)) From b7512877368e2e95f67f7896e1a6b71a27ce9f62 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 20 Jan 2021 10:45:30 +0200 Subject: [PATCH 456/713] update the copyright years --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 5258a2b..98d3340 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018-2020 Dmytro Meleshko +Copyright (c) 2018-2021 Dmytro Meleshko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 819e5e5a33d70eea8dc7c79365d17eeb3dc58517 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 20 Jan 2021 10:45:30 +0200 Subject: [PATCH 457/713] update the copyright years --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 5258a2b..98d3340 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018-2020 Dmytro Meleshko +Copyright (c) 2018-2021 Dmytro Meleshko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From d42428538c0b7df27e84bbc8eb220b35278d7e47 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 20 Jan 2021 17:37:55 +0200 Subject: [PATCH 458/713] [nvim] make the airline theme match my syntax theme even more --- nvim/autoload/airline/themes/dotfiles.vim | 24 +++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/nvim/autoload/airline/themes/dotfiles.vim b/nvim/autoload/airline/themes/dotfiles.vim index 752d247..374b6a3 100644 --- a/nvim/autoload/airline/themes/dotfiles.vim +++ b/nvim/autoload/airline/themes/dotfiles.vim @@ -1,4 +1,12 @@ -let s:palette = {} +let s:palette = { +\ "inactive" : {}, +\ "replace" : {}, +\ "normal" : {}, +\ "visual" : {}, +\ "insert" : {}, +\ "terminal" : {}, +\ "commandline" : {}, +\ } let s:colors = g:dotfiles_colorscheme_base16_colors function! s:base16_color(fg, bg) @@ -16,9 +24,11 @@ let s:palette.normal = airline#themes#generate_color_map( \ s:section_c) let s:section_a_overrides = { -\ 'insert' : s:base16_color(0x1, 0xD), -\ 'replace': s:base16_color(0x1, 0x8), -\ 'visual' : s:base16_color(0x1, 0xE), +\ 'insert' : s:base16_color(0x1, 0xD), +\ 'visual' : s:base16_color(0x1, 0xE), +\ 'replace' : s:base16_color(0x1, 0x8), +\ 'terminal' : s:base16_color(0x1, 0xD), +\ 'commandline' : s:base16_color(0x1, 0xC), \ } for [s:mode, s:color] in items(s:section_a_overrides) let s:palette[s:mode] = { 'airline_a': s:color, 'airline_z': s:color } @@ -40,4 +50,10 @@ if get(g:, 'loaded_ctrlp', 0) \ s:ctrlp_white) endif +for s:mode in keys(s:palette) + let s:palette[s:mode]['airline_warning'] = s:base16_color(0x0, 0xA) + let s:palette[s:mode]['airline_error'] = s:base16_color(0x0, 0x8) + let s:palette[s:mode]['airline_term'] = s:base16_color(0x9, 0x1) +endfor + let airline#themes#dotfiles#palette = s:palette From 4cc4389455b9d885ebe615dab2108c49085e07f5 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 20 Jan 2021 17:37:55 +0200 Subject: [PATCH 459/713] [nvim] make the airline theme match my syntax theme even more --- nvim/autoload/airline/themes/dotfiles.vim | 24 +++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/nvim/autoload/airline/themes/dotfiles.vim b/nvim/autoload/airline/themes/dotfiles.vim index 752d247..374b6a3 100644 --- a/nvim/autoload/airline/themes/dotfiles.vim +++ b/nvim/autoload/airline/themes/dotfiles.vim @@ -1,4 +1,12 @@ -let s:palette = {} +let s:palette = { +\ "inactive" : {}, +\ "replace" : {}, +\ "normal" : {}, +\ "visual" : {}, +\ "insert" : {}, +\ "terminal" : {}, +\ "commandline" : {}, +\ } let s:colors = g:dotfiles_colorscheme_base16_colors function! s:base16_color(fg, bg) @@ -16,9 +24,11 @@ let s:palette.normal = airline#themes#generate_color_map( \ s:section_c) let s:section_a_overrides = { -\ 'insert' : s:base16_color(0x1, 0xD), -\ 'replace': s:base16_color(0x1, 0x8), -\ 'visual' : s:base16_color(0x1, 0xE), +\ 'insert' : s:base16_color(0x1, 0xD), +\ 'visual' : s:base16_color(0x1, 0xE), +\ 'replace' : s:base16_color(0x1, 0x8), +\ 'terminal' : s:base16_color(0x1, 0xD), +\ 'commandline' : s:base16_color(0x1, 0xC), \ } for [s:mode, s:color] in items(s:section_a_overrides) let s:palette[s:mode] = { 'airline_a': s:color, 'airline_z': s:color } @@ -40,4 +50,10 @@ if get(g:, 'loaded_ctrlp', 0) \ s:ctrlp_white) endif +for s:mode in keys(s:palette) + let s:palette[s:mode]['airline_warning'] = s:base16_color(0x0, 0xA) + let s:palette[s:mode]['airline_error'] = s:base16_color(0x0, 0x8) + let s:palette[s:mode]['airline_term'] = s:base16_color(0x9, 0x1) +endfor + let airline#themes#dotfiles#palette = s:palette From 9b15d6e155b3b0eb1daf211f646d5f86042be7fc Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 21 Jan 2021 12:49:13 +0200 Subject: [PATCH 460/713] [nvim] add a plugin for RON --- nvim/dotfiles/plugins-list.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index f8ec28c..80028a8 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -59,6 +59,7 @@ " Programming {{{ Plug 'sheerun/vim-polyglot' Plug 'chikamichi/mediawiki.vim' + Plug 'ron-rs/ron.vim' if g:vim_ide Plug 'neoclide/coc.nvim', { 'branch': 'release' } Plug 'dag/vim2hs' From 06ff96bf30dd53c3331fa633326e699a5e45d04d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 21 Jan 2021 12:49:13 +0200 Subject: [PATCH 461/713] [nvim] add a plugin for RON --- nvim/dotfiles/plugins-list.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index 69dfedd..fbde4f6 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -60,6 +60,7 @@ " Programming {{{ Plug 'sheerun/vim-polyglot' Plug 'chikamichi/mediawiki.vim' + Plug 'ron-rs/ron.vim' if g:vim_ide Plug 'neoclide/coc.nvim', { 'branch': 'release' } Plug 'dag/vim2hs' From 5e5eb4d39f1757fd95c15edb057f484b05bd11b7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 25 Jan 2021 11:04:02 +0200 Subject: [PATCH 462/713] [nvim] fix the commentstring in po files --- nvim/after/syntax/nginx.vim | 2 +- nvim/after/syntax/po.vim | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 nvim/after/syntax/po.vim diff --git a/nvim/after/syntax/nginx.vim b/nvim/after/syntax/nginx.vim index 3ef6892..fb06acc 100644 --- a/nvim/after/syntax/nginx.vim +++ b/nvim/after/syntax/nginx.vim @@ -5,4 +5,4 @@ " set in `ftplugin/nginx.vim` and sets `comments` to some garbage. This script " undoes that damage. let &l:comments = &g:comments -let &l:commentstring = '# %s' +let &l:commentstring = '#%s' diff --git a/nvim/after/syntax/po.vim b/nvim/after/syntax/po.vim new file mode 100644 index 0000000..d345d77 --- /dev/null +++ b/nvim/after/syntax/po.vim @@ -0,0 +1 @@ +setl commentstring=#%s From 4b6cf8c56a7492bbb7715a06b40a9831677fc7e7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 25 Jan 2021 11:04:02 +0200 Subject: [PATCH 463/713] [nvim] fix the commentstring in po files --- nvim/after/syntax/nginx.vim | 2 +- nvim/after/syntax/po.vim | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 nvim/after/syntax/po.vim diff --git a/nvim/after/syntax/nginx.vim b/nvim/after/syntax/nginx.vim index 3ef6892..fb06acc 100644 --- a/nvim/after/syntax/nginx.vim +++ b/nvim/after/syntax/nginx.vim @@ -5,4 +5,4 @@ " set in `ftplugin/nginx.vim` and sets `comments` to some garbage. This script " undoes that damage. let &l:comments = &g:comments -let &l:commentstring = '# %s' +let &l:commentstring = '#%s' diff --git a/nvim/after/syntax/po.vim b/nvim/after/syntax/po.vim new file mode 100644 index 0000000..d345d77 --- /dev/null +++ b/nvim/after/syntax/po.vim @@ -0,0 +1 @@ +setl commentstring=#%s From 1a1b27fa65be19d65d4f758ccc5472486d477cb1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 25 Jan 2021 18:37:50 +0200 Subject: [PATCH 464/713] [zsh] fix the manpath-caused errors on shell startup once and for all --- zsh/path.zsh | 2 +- zsh/zplg.zsh | 2 +- zsh/zshrc | 11 ++++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/zsh/path.zsh b/zsh/path.zsh index 7bf8cac..19c4695 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -12,7 +12,7 @@ path_prepend() { fi local var_name="$1"; shift local value; for value in "$@"; do - if eval "(( \${${var_name}[(ie)\$value]} > \${#${var_name}} ))"; then + if eval "(( \${${var_name}[(ie)\$value]-1} > \${#${var_name}} ))"; then eval "${var_name}=(\"\$value\" \"\${${var_name}[@]}\")" fi done diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh index d0a3355..f6a16bf 100644 --- a/zsh/zplg.zsh +++ b/zsh/zplg.zsh @@ -399,7 +399,7 @@ plugin() { else value="${plugin_dir}/${value}" fi - if eval "(( \${${var_name}[(ie)\$value]} > \${#${var_name}} ))"; then + if eval "(( \${${var_name}[(ie)\$value]-1} > \${#${var_name}} ))"; then case "$operator" in prepend) eval "$var_name=(\"\$value\" \${$var_name[@]})" ;; append) eval "$var_name=(\${$var_name[@]} \"\$value\")" ;; diff --git a/zsh/zshrc b/zsh/zshrc index 729b50e..3513103 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -46,15 +46,20 @@ _perf_timer_start "total" fi # }}} +# For some reason manpath is not always set when logging with ssh for instance. +# Let's ensure that it is always set and exported. The additional colon ensures +# that the system manpath isn't overwritten (see manpath(1)), though in reality +# two colons get added for some reason, which is also valid, but means +# something slightly different (again, see manpath(1)). Hope this won't cause +# any problems in the future. +export MANPATH="$MANPATH:" + for script in functions options path env plugins aliases completion zle prompt colorscheme; do _perf_timer_start "$script.zsh" source "$ZSH_DOTFILES/$script.zsh" _perf_timer_stop "$script.zsh" done -# add colon after MANPATH so that it doesn't overwrite system MANPATH -MANPATH="$MANPATH:" - command_exists rbenv && eval "$(rbenv init -)" _perf_timer_stop "total" From e277f19ed3af53372af0aae719731e34edeb4e86 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 25 Jan 2021 18:37:50 +0200 Subject: [PATCH 465/713] [zsh] fix the manpath-caused errors on shell startup once and for all --- zsh/path.zsh | 2 +- zsh/zplg.zsh | 2 +- zsh/zshrc | 11 ++++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/zsh/path.zsh b/zsh/path.zsh index 7bf8cac..19c4695 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -12,7 +12,7 @@ path_prepend() { fi local var_name="$1"; shift local value; for value in "$@"; do - if eval "(( \${${var_name}[(ie)\$value]} > \${#${var_name}} ))"; then + if eval "(( \${${var_name}[(ie)\$value]-1} > \${#${var_name}} ))"; then eval "${var_name}=(\"\$value\" \"\${${var_name}[@]}\")" fi done diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh index d0a3355..f6a16bf 100644 --- a/zsh/zplg.zsh +++ b/zsh/zplg.zsh @@ -399,7 +399,7 @@ plugin() { else value="${plugin_dir}/${value}" fi - if eval "(( \${${var_name}[(ie)\$value]} > \${#${var_name}} ))"; then + if eval "(( \${${var_name}[(ie)\$value]-1} > \${#${var_name}} ))"; then case "$operator" in prepend) eval "$var_name=(\"\$value\" \${$var_name[@]})" ;; append) eval "$var_name=(\${$var_name[@]} \"\$value\")" ;; diff --git a/zsh/zshrc b/zsh/zshrc index 729b50e..3513103 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -46,15 +46,20 @@ _perf_timer_start "total" fi # }}} +# For some reason manpath is not always set when logging with ssh for instance. +# Let's ensure that it is always set and exported. The additional colon ensures +# that the system manpath isn't overwritten (see manpath(1)), though in reality +# two colons get added for some reason, which is also valid, but means +# something slightly different (again, see manpath(1)). Hope this won't cause +# any problems in the future. +export MANPATH="$MANPATH:" + for script in functions options path env plugins aliases completion zle prompt colorscheme; do _perf_timer_start "$script.zsh" source "$ZSH_DOTFILES/$script.zsh" _perf_timer_stop "$script.zsh" done -# add colon after MANPATH so that it doesn't overwrite system MANPATH -MANPATH="$MANPATH:" - command_exists rbenv && eval "$(rbenv init -)" _perf_timer_stop "total" From 7f3dfb96bea906b439778562386dd0249eec77b3 Mon Sep 17 00:00:00 2001 From: Keanu Date: Thu, 28 Jan 2021 16:23:34 +0100 Subject: [PATCH 466/713] [nvim] Added plugin coc-explorer. --- nvim/dotfiles/plugins-list.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index fbde4f6..fd4b244 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -4,6 +4,7 @@ Plug 'francoiscabrol/ranger.vim' Plug 'rbgrouleff/bclose.vim' endif + Plug 'weirongxu/coc-explorer' " }}} " Editing {{{ From abde79fbf70103baa6207988c3dbadb79a77ace8 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 29 Jan 2021 01:37:49 +0200 Subject: [PATCH 467/713] [nvim+zsh] fix the need for resetting FZF_DEFAULT_OPTS on Ubuntu and derivatives --- nvim/plugin/interface.vim | 2 +- zsh/env.zsh | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 7a196d3..3f2e4e2 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -147,7 +147,7 @@ endif nnoremap f Files nnoremap b Buffers let g:fzf_layout = { 'down': '~40%' } - let $FZF_DEFAULT_OPTS = '--preview-window=sharp' + let g:fzf_preview_window = ['right:noborder', 'ctrl-/'] " }}} diff --git a/zsh/env.zsh b/zsh/env.zsh index 796896d..eca6fb0 100644 --- a/zsh/env.zsh +++ b/zsh/env.zsh @@ -30,6 +30,4 @@ jq_colors=( export JQ_COLORS="${(j.:.)jq_colors}" unset jq_colors -export FZF_DEFAULT_OPTS='--preview-window=sharp' - export HOMEBREW_NO_AUTO_UPDATE=1 From 1e50762fcbd7244678d15f6d95d55715c13798e0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 29 Jan 2021 01:37:49 +0200 Subject: [PATCH 468/713] [nvim+zsh] fix the need for resetting FZF_DEFAULT_OPTS on Ubuntu and derivatives --- nvim/plugin/interface.vim | 2 +- zsh/env.zsh | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 7a196d3..3f2e4e2 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -147,7 +147,7 @@ endif nnoremap f Files nnoremap b Buffers let g:fzf_layout = { 'down': '~40%' } - let $FZF_DEFAULT_OPTS = '--preview-window=sharp' + let g:fzf_preview_window = ['right:noborder', 'ctrl-/'] " }}} diff --git a/zsh/env.zsh b/zsh/env.zsh index 796896d..eca6fb0 100644 --- a/zsh/env.zsh +++ b/zsh/env.zsh @@ -30,6 +30,4 @@ jq_colors=( export JQ_COLORS="${(j.:.)jq_colors}" unset jq_colors -export FZF_DEFAULT_OPTS='--preview-window=sharp' - export HOMEBREW_NO_AUTO_UPDATE=1 From f79ed65e0ccf5b2bde3010e6d578ecfb8c892e21 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 29 Jan 2021 12:34:26 +0200 Subject: [PATCH 469/713] [git] add temporary files to the gitignore --- git/gitignore_global | 1 + 1 file changed, 1 insertion(+) diff --git a/git/gitignore_global b/git/gitignore_global index 36465da..d5cb4b8 100644 --- a/git/gitignore_global +++ b/git/gitignore_global @@ -2,3 +2,4 @@ Session.vim .project.vim .DS_Store .ropeproject +*~ From b45d969f0cd9779d303b309947318c35925a90a8 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 29 Jan 2021 12:34:26 +0200 Subject: [PATCH 470/713] [git] add temporary files to the gitignore --- git/gitignore_global | 1 + 1 file changed, 1 insertion(+) diff --git a/git/gitignore_global b/git/gitignore_global index 36465da..d5cb4b8 100644 --- a/git/gitignore_global +++ b/git/gitignore_global @@ -2,3 +2,4 @@ Session.vim .project.vim .DS_Store .ropeproject +*~ From a659106248bdf63841ec19efdae210f684f25bd8 Mon Sep 17 00:00:00 2001 From: Keanu Date: Sat, 30 Jan 2021 14:17:07 +0100 Subject: [PATCH 471/713] [scripts/copy-env-var] Script to copy envvars. --- scripts/copy-env-var | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 scripts/copy-env-var diff --git a/scripts/copy-env-var b/scripts/copy-env-var new file mode 100755 index 0000000..9a4d88d --- /dev/null +++ b/scripts/copy-env-var @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -euo pipefail + +if variable="$(set -euo pipefail; { + awk 'BEGIN{for(v in ENVIRON) print v}' +} | rofi -dmenu)" && [[ -n $variable ]]; then + + variable="${variable%% *}" + + echo ${!variable} | xclip -sel clip +fi From 707397ae9ec005b25d09b991607d33987a073086 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 1 Feb 2021 12:44:49 +0200 Subject: [PATCH 472/713] [nvim] disable rust-analyzer's diagnostics and autoimports --- nvim/coc-languages/rust.vim | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/nvim/coc-languages/rust.vim b/nvim/coc-languages/rust.vim index dac412a..8deabe8 100644 --- a/nvim/coc-languages/rust.vim +++ b/nvim/coc-languages/rust.vim @@ -2,19 +2,13 @@ let g:coc_filetypes += ['rust'] let g:coc_global_extensions += ['coc-rust-analyzer'] let g:coc_user_config['rust-analyzer'] = { \ 'serverPath': 'rust-analyzer', -\ 'lens': { -\ 'enable': v:false, -\ }, -\ 'inlayHints': { -\ 'typeHints': v:false, -\ 'chainingHints': v:false, -\ }, -\ 'checkOnSave': { -\ 'command': 'clippy', -\ }, -\ 'cargo': { -\ 'loadOutDirsFromCheck': v:true, -\ }, +\ 'lens.enable': v:false, +\ 'inlayHints.typeHints': v:false, +\ 'inlayHints.chainingHints': v:false, +\ 'diagnostics.enable': v:false, +\ 'completion.autoimport.enable': v:false, +\ 'checkOnSave.command': 'clippy', +\ 'cargo.loadOutDirsFromCheck': v:true, \ } " let g:coc_global_extensions += ['coc-rls'] From 57f0e01b511f459a43f792723c8948f0746b5165 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 1 Feb 2021 12:44:49 +0200 Subject: [PATCH 473/713] [nvim] disable rust-analyzer's diagnostics and autoimports --- nvim/coc-languages/rust.vim | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/nvim/coc-languages/rust.vim b/nvim/coc-languages/rust.vim index dac412a..8deabe8 100644 --- a/nvim/coc-languages/rust.vim +++ b/nvim/coc-languages/rust.vim @@ -2,19 +2,13 @@ let g:coc_filetypes += ['rust'] let g:coc_global_extensions += ['coc-rust-analyzer'] let g:coc_user_config['rust-analyzer'] = { \ 'serverPath': 'rust-analyzer', -\ 'lens': { -\ 'enable': v:false, -\ }, -\ 'inlayHints': { -\ 'typeHints': v:false, -\ 'chainingHints': v:false, -\ }, -\ 'checkOnSave': { -\ 'command': 'clippy', -\ }, -\ 'cargo': { -\ 'loadOutDirsFromCheck': v:true, -\ }, +\ 'lens.enable': v:false, +\ 'inlayHints.typeHints': v:false, +\ 'inlayHints.chainingHints': v:false, +\ 'diagnostics.enable': v:false, +\ 'completion.autoimport.enable': v:false, +\ 'checkOnSave.command': 'clippy', +\ 'cargo.loadOutDirsFromCheck': v:true, \ } " let g:coc_global_extensions += ['coc-rls'] From 124221d1e392f9548eaea2ef6c5eccd7d5624b3f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 2 Feb 2021 22:28:48 +0200 Subject: [PATCH 474/713] [nvim] bring back a fix removed in 14e64127e4fd068f28581bc11a52d73d8dc772c0 --- nvim/after/ftplugin/javascript.vim | 1 + 1 file changed, 1 insertion(+) create mode 100644 nvim/after/ftplugin/javascript.vim diff --git a/nvim/after/ftplugin/javascript.vim b/nvim/after/ftplugin/javascript.vim new file mode 100644 index 0000000..d4217f4 --- /dev/null +++ b/nvim/after/ftplugin/javascript.vim @@ -0,0 +1 @@ +setlocal matchpairs-=<:> From 56ed052f855d70ddee3fff073ae8f899745f36a7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 2 Feb 2021 22:50:51 +0200 Subject: [PATCH 475/713] [zsh] display the current pyenv version in the prompt --- zsh/prompt.zsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index 0644c0a..aa79b0e 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -1,7 +1,5 @@ #!/usr/bin/env zsh -export VIRTUAL_ENV_DISABLE_PROMPT=false - # Escapes `%` in all arguments by replacing it with `%%`. Escaping is needed so # that untrusted input (e.g. git branch names) doesn't affect prompt rendering. prompt_escape() { @@ -102,6 +100,11 @@ PROMPT+='$(prompt_vcs_info 2>/dev/null)' # Python's virtualenv PROMPT+='${VIRTUAL_ENV:+" %F{blue}venv:%F{magenta}${VIRTUAL_ENV:t}%f"}' +VIRTUAL_ENV_DISABLE_PROMPT=true + +# pyenv +PROMPT+='${PYENV_VERSION:+" %F{blue}pyenv:%F{magenta}${PYENV_VERSION:t}%f"}' +PYENV_VIRTUAL_ENV_DISABLE_PROMPT=true PROMPT+=' ' From ed93c816f90795828bfe45c2c3db1d97e899254f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 2 Feb 2021 22:28:48 +0200 Subject: [PATCH 476/713] [nvim] bring back a fix removed in 14e64127e4fd068f28581bc11a52d73d8dc772c0 --- nvim/after/ftplugin/javascript.vim | 1 + 1 file changed, 1 insertion(+) create mode 100644 nvim/after/ftplugin/javascript.vim diff --git a/nvim/after/ftplugin/javascript.vim b/nvim/after/ftplugin/javascript.vim new file mode 100644 index 0000000..d4217f4 --- /dev/null +++ b/nvim/after/ftplugin/javascript.vim @@ -0,0 +1 @@ +setlocal matchpairs-=<:> From 60f8ca378893a5e2d19126f948fef152d64fd7dd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 2 Feb 2021 22:50:51 +0200 Subject: [PATCH 477/713] [zsh] display the current pyenv version in the prompt --- zsh/prompt.zsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index 0644c0a..aa79b0e 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -1,7 +1,5 @@ #!/usr/bin/env zsh -export VIRTUAL_ENV_DISABLE_PROMPT=false - # Escapes `%` in all arguments by replacing it with `%%`. Escaping is needed so # that untrusted input (e.g. git branch names) doesn't affect prompt rendering. prompt_escape() { @@ -102,6 +100,11 @@ PROMPT+='$(prompt_vcs_info 2>/dev/null)' # Python's virtualenv PROMPT+='${VIRTUAL_ENV:+" %F{blue}venv:%F{magenta}${VIRTUAL_ENV:t}%f"}' +VIRTUAL_ENV_DISABLE_PROMPT=true + +# pyenv +PROMPT+='${PYENV_VERSION:+" %F{blue}pyenv:%F{magenta}${PYENV_VERSION:t}%f"}' +PYENV_VIRTUAL_ENV_DISABLE_PROMPT=true PROMPT+=' ' From e81d4d3faae0b7a798ce7e56dff524e48103c3ba Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 4 Feb 2021 14:52:53 +0200 Subject: [PATCH 478/713] [scripts/welcome] add logo for Manjaro ARM --- script-resources/welcome/logos/manjaro-arm | 1 + 1 file changed, 1 insertion(+) create mode 120000 script-resources/welcome/logos/manjaro-arm diff --git a/script-resources/welcome/logos/manjaro-arm b/script-resources/welcome/logos/manjaro-arm new file mode 120000 index 0000000..aae509e --- /dev/null +++ b/script-resources/welcome/logos/manjaro-arm @@ -0,0 +1 @@ +manjaro \ No newline at end of file From 18700a8198434b63961b0a9afbccd9d3a69d8516 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 4 Feb 2021 14:52:53 +0200 Subject: [PATCH 479/713] [scripts/welcome] add logo for Manjaro ARM --- script-resources/welcome/logos/manjaro-arm | 1 + 1 file changed, 1 insertion(+) create mode 120000 script-resources/welcome/logos/manjaro-arm diff --git a/script-resources/welcome/logos/manjaro-arm b/script-resources/welcome/logos/manjaro-arm new file mode 120000 index 0000000..aae509e --- /dev/null +++ b/script-resources/welcome/logos/manjaro-arm @@ -0,0 +1 @@ +manjaro \ No newline at end of file From f35f14dba60bd1a0bb5f7f5f53269f7cef08c5a7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 4 Feb 2021 19:29:41 +0200 Subject: [PATCH 480/713] [kitty] enable the only two layouts I actually use --- kitty/kitty.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kitty/kitty.conf b/kitty/kitty.conf index 1c2dc19..f420e22 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -236,7 +236,7 @@ bell_on_tab yes #: suffix of "c" on the width/height values to have them interpreted #: as number of cells instead of pixels. -# enabled_layouts * +enabled_layouts horizontal, vertical #: The enabled window layouts. A comma separated list of layout names. #: The special value all means all layouts. The first listed layout From 3f7c26f124c2cd79836224a822c334b968ba0787 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 4 Feb 2021 19:58:19 +0200 Subject: [PATCH 481/713] [kitty] remove the sample config and keep only the changed bits --- kitty/kitty.conf | 916 ++--------------------------------------------- 1 file changed, 28 insertions(+), 888 deletions(-) diff --git a/kitty/kitty.conf b/kitty/kitty.conf index f420e22..d06cc3b 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -1,772 +1,52 @@ include ../colorschemes/out/kitty.conf -#: Fonts {{{ - -#: kitty has very powerful font management. You can configure -#: individual font faces and even specify special fonts for particular -#: characters. - -# font_family monospace -# bold_font auto -# italic_font auto -# bold_italic_font auto - -#: You can specify different fonts for the bold/italic/bold-italic -#: variants. By default they are derived automatically, by the OSes -#: font system. Setting them manually is useful for font families that -#: have many weight variants like Book, Medium, Thick, etc. For -#: example:: - -#: font_family Operator Mono Book -#: bold_font Operator Mono Medium -#: italic_font Operator Mono Book Italic -#: bold_italic_font Operator Mono Medium Italic - -# font_size 14.0 - -#: Font size (in pts) - -# adjust_line_height 0 -# adjust_column_width 0 - -#: Change the size of each character cell kitty renders. You can use -#: either numbers, which are interpreted as pixels or percentages -#: (number followed by %), which are interpreted as percentages of the -#: unmodified values. You can use negative pixels or percentages less -#: than 100% to reduce sizes (but this might cause rendering -#: artifacts). - -# symbol_map U+E0A0-U+E0A2,U+E0B0-U+E0B3 PowerlineSymbols - -#: Map the specified unicode codepoints to a particular font. Useful -#: if you need special rendering for some symbols, such as for -#: Powerline. Avoids the need for patched fonts. Each unicode code -#: point is specified in the form U+. You -#: can specify multiple code points, separated by commas and ranges -#: separated by hyphens. symbol_map itself can be specified multiple -#: times. Syntax is:: - -#: symbol_map codepoints Font Family Name - -# box_drawing_scale 0.001, 1, 1.5, 2 - -#: Change the sizes of the lines used for the box drawing unicode -#: characters These values are in pts. They will be scaled by the -#: monitor DPI to arrive at a pixel value. There must be four values -#: corresponding to thin, normal, thick, and very thick lines. - -#: }}} - -#: Cursor customization {{{ - -# cursor #cccccc - -#: Default cursor color - -# cursor_text_color #111111 - -#: Choose the color of text under the cursor. If you want it rendered -#: with the background color of the cell underneath instead, use the -#: special keyword: background - -# cursor_shape block - -#: The cursor shape can be one of (block, beam, underline) - +# Mouse {{{ +# Disable cursor blinking cursor_blink_interval 0 cursor_stop_blinking_after 0 +mouse_hide_wait 1 +# }}} -#: The interval (in seconds) at which to blink the cursor. Set to zero -#: to disable blinking. Note that numbers smaller than repaint_delay -#: will be limited to repaint_delay. Stop blinking cursor after the -#: specified number of seconds of keyboard inactivity. Set to zero to -#: never stop blinking. - -#: }}} - -#: Scrollback {{{ - -# scrollback_lines 2000 - -#: Number of lines of history to keep in memory for scrolling back. -#: Memory is allocated on demand. Negative numbers are (effectively) -#: infinite scrollback. Note that using very large scrollback is not -#: recommended a it can slow down resizing of the terminal and also -#: use large amounts of RAM. - -# scrollback_pager less --chop-long-lines --RAW-CONTROL-CHARS +INPUT_LINE_NUMBER - -#: Program with which to view scrollback in a new window. The -#: scrollback buffer is passed as STDIN to this program. If you change -#: it, make sure the program you use can handle ANSI escape sequences -#: for colors and text formatting. INPUT_LINE_NUMBER in the command -#: line above will be replaced by an integer representing which line -#: should be at the top of the screen. - -# wheel_scroll_multiplier 5.0 - -#: Modify the amount scrolled by the mouse wheel. Note this is only -#: used for low precision scrolling devices, not for high precision -#: scrolling on platforms such as macOS and Wayland. Use negative -#: numbers to change scroll direction. - -#: }}} - -#: Mouse {{{ - -# url_color #0087bd -url_style single - -#: The color and style for highlighting URLs on mouse-over. url_style -#: can be one of: none, single, double, curly - -# open_url_modifiers kitty_mod - -#: The modifier keys to press when clicking with the mouse on URLs to -#: open the URL - -# open_url_with default - -#: The program with which to open URLs that are clicked on. The -#: special value default means to use the operating system's default -#: URL handler. - -# copy_on_select no - -#: Copy to clipboard on select. With this enabled, simply selecting -#: text with the mouse will cause the text to be copied to clipboard. -#: Useful on platforms such as macOS/Wayland that do not have the -#: concept of primary selections. Note that this is a security risk, -#: as all programs, including websites open in your browser can read -#: the contents of the clipboard. - -# rectangle_select_modifiers ctrl+alt - -#: The modifiers to use rectangular selection (i.e. to select text in -#: a rectangular block with the mouse) - -# select_by_word_characters :@-./_~?&=%+# - -#: Characters considered part of a word when double clicking. In -#: addition to these characters any character that is marked as an -#: alpha-numeric character in the unicode database will be matched. - -# click_interval 0.5 - -#: The interval between successive clicks to detect double/triple -#: clicks (in seconds) - -mouse_hide_wait 3.0 - -#: Hide mouse cursor after the specified number of seconds of the -#: mouse not being used. Set to zero to disable mouse cursor hiding. - -focus_follows_mouse no - -#: Set the active window to the window under the mouse when moving the -#: mouse around - -#: }}} - -#: Performance tuning {{{ - -# repaint_delay 10 - -#: Delay (in milliseconds) between screen updates. Decreasing it, -#: increases frames-per-second (FPS) at the cost of more CPU usage. -#: The default value yields ~100 FPS which is more than sufficient for -#: most uses. Note that to actually achieve 100 FPS you have to either -#: set sync_to_monitor to no or use a monitor with a high refresh -#: rate. - -# input_delay 3 - -#: Delay (in milliseconds) before input from the program running in -#: the terminal is processed. Note that decreasing it will increase -#: responsiveness, but also increase CPU usage and might cause flicker -#: in full screen programs that redraw the entire screen on each loop, -#: because kitty is so fast that partial screen updates will be drawn. - -sync_to_monitor yes - -#: Sync screen updates to the refresh rate of the monitor. This -#: prevents tearing (https://en.wikipedia.org/wiki/Screen_tearing) -#: when scrolling. However, it limits the rendering speed to the -#: refresh rate of your monitor. With a very high speed mouse/high -#: keyboard repeat rate, you may notice some slight input latency. If -#: so, set this to no. - -#: }}} - -#: Terminal bell {{{ - -# enable_audio_bell yes - -#: Enable/disable the audio bell. Useful in environments that require -#: silence. - -# visual_bell_duration 0.0 - -#: Visual bell duration. Flash the screen when a bell occurs for the -#: specified number of seconds. Set to zero to disable. - -window_alert_on_bell yes - -#: Request window attention on bell. Makes the dock icon bounce on -#: macOS or the taskbar flash on linux. - -bell_on_tab yes - -#: Show a bell symbol on the tab if a bell occurs in one of the -#: windows in the tab and the window is not the currently focused -#: window - -#: }}} - -#: Window layout {{{ - -# remember_window_size yes -# initial_window_width 640 -# initial_window_height 400 - -#: If enabled, the window size will be remembered so that new -#: instances of kitty will have the same size as the previous -#: instance. If disabled, the window will initially have size -#: configured by initial_window_width/height, in pixels. You can use a -#: suffix of "c" on the width/height values to have them interpreted -#: as number of cells instead of pixels. - -enabled_layouts horizontal, vertical - -#: The enabled window layouts. A comma separated list of layout names. -#: The special value all means all layouts. The first listed layout -#: will be used as the startup layout. For a list of available -#: layouts, see the -#: https://sw.kovidgoyal.net/kitty/index.html#layouts. - -# window_resize_step_cells 2 -# window_resize_step_lines 2 - -#: The step size (in units of cell width/cell height) to use when -#: resizing windows. The cells value is used for horizontal resizing -#: and the lines value for vertical resizing. - -# window_border_width 1.0 - -#: The width (in pts) of window borders. Will be rounded to the -#: nearest number of pixels based on screen resolution. Note that -#: borders are displayed only when more than one window is visible. -#: They are meant to separate multiple windows. - -# draw_minimal_borders no - -#: Draw only the minimum borders needed. This means that only the -#: minimum needed borders for inactive windows are drawn. That is only -#: the borders that separate the inactive window from a neighbor. Note -#: that setting a non-zero window margin overrides this and causes all -#: borders to be drawn. - -window_margin_width 1.0 - -#: The window margin (in pts) (blank area outside the border) - -# single_window_margin_width -1000.0 - -#: The window margin (in pts) to use when only a single window is -#: visible. Negative values will cause the value of -#: window_margin_width to be used instead. - -window_padding_width 2.0 - -#: The window padding (in pts) (blank area between the text and the -#: window border) - -# active_border_color #00ff00 - -#: The color for the border of the active window - -# inactive_border_color #cccccc - -#: The color for the border of inactive windows - -# bell_border_color #ff5a00 - -#: The color for the border of inactive windows in which a bell has -#: occurred - -inactive_text_alpha 0.5 - -#: Fade the text in inactive windows by the specified amount (a number -#: between zero and one, with zero being fully faded). - +# OS Windows {{{ +# Always ask for confirmation before closing OS windows confirm_os_window_close 1 -#: Ask for confirmation when closing an OS window that has at least this -#: number of kitty windows in it. A value of zero disables confirmation. -#: This confirmation also applies to requests to quit the entire application (all -#: OS windows, via the quite action). +# }}} -#: }}} - -#: Tab bar {{{ +# Windows {{{ +# These are the only layouts I use: +enabled_layouts horizontal, vertical +window_margin_width 1.0 +window_padding_width 2.0 +inactive_text_alpha 0.5 +# }}} +# Tabs {{{ tab_bar_edge top - -#: Which edge to show the tab bar on, top or bottom - -# tab_bar_margin_width 0.0 - -#: The margin to the left and right of the tab bar (in pts) - -# TODO: change this to "separator" if maintainer of kitty agrees with me. -# see https://github.com/kovidgoyal/kitty/pull/2480 -# fortunately, kitty seems to have built-in powerline character support tab_bar_style powerline - -#: The tab bar style, can be one of: fade or separator. In the fade -#: style, each tab's edges fade into the background color, in the -#: separator style, tabs are separated by a configurable separator. - -# tab_fade 0.25 0.5 0.75 1 - -#: Control how each tab fades into the background when using fade for -#: the tab_bar_style. Each number is an alpha (between zero and one) -#: that controls how much the corresponding cell fades into the -#: background, with zero being no fade and one being full fade. You -#: can change the number of cells used by adding/removing entries to -#: this list. - +# This option doesn't really do anything when the tab bar style is `powerline`, +# but this Unicode character is a nice find, so let's keep it just in case. tab_separator " │ " - -#: The separator between tabs in the tab bar when using separator as -#: the tab_bar_style. - +# Always show the tab bar tab_bar_min_tabs 1 - -# active_tab_foreground #000 -# active_tab_background #eee active_tab_font_style bold -# inactive_tab_foreground #444 -# inactive_tab_background #999 inactive_tab_font_style none +# }}} -#: Tab bar colors and styles - -#: }}} - -#: Color scheme {{{ - -# foreground #dddddd -# background #000000 - -#: The foreground and background colors - -# background_opacity 1.0 -# dynamic_background_opacity no - -#: The opacity of the background. A number between 0 and 1, where 1 is -#: opaque and 0 is fully transparent. This will only work if -#: supported by the OS (for instance, when using a compositor under -#: X11). Note that it only sets the default background color's -#: opacity. This is so that things like the status bar in vim, -#: powerline prompts, etc. still look good. But it means that if you -#: use a color theme with a background color in your editor, it will -#: not be rendered as transparent. Instead you should change the -#: default background color in your kitty config and not use a -#: background color in the editor color scheme. Or use the escape -#: codes to set the terminals default colors in a shell script to -#: launch your editor. Be aware that using a value less than 1.0 is a -#: (possibly significant) performance hit. If you want to dynamically -#: change transparency of windows set dynamic_background_opacity to -#: yes (this is off by default as it has a performance cost) - -# dim_opacity 0.75 - -#: How much to dim text that has the DIM/FAINT attribute set. One -#: means no dimming and zero means fully dimmed (i.e. invisible). - -# selection_foreground #000000 -# selection_background #fffacd - -#: The foreground and background for text selected with the mouse - - -#: The 16 terminal colors. There are 8 basic colors, each color has a -#: dull and bright version. You can also set the remaining colors from -#: the 256 color table as color16 to color255. - -# color0 #000000 -# color8 #767676 - -#: black - -# color1 #cc0403 -# color9 #f2201f - -#: red - -# color2 #19cb00 -# color10 #23fd00 - -#: green - -# color3 #cecb00 -# color11 #fffd00 - -#: yellow - -# color4 #0d73cc -# color12 #1a8fff - -#: blue - -# color5 #cb1ed1 -# color13 #fd28ff - -#: magenta - -# color6 #0dcdcd -# color14 #14ffff - -#: cyan - -# color7 #dddddd -# color15 #ffffff - -#: white - -#: }}} - -#: Advanced {{{ - -# shell sh -c 'exec login -f -p $USER' -# shell zsh --login - -#: The shell program to execute. The default value of . means to use -#: whatever shell is set as the default shell for the current user. -#: Note that on macOS if you change this, you might need to add -#: --login to ensure that the shell starts in interactive mode and -#: reads its startup rc files. - -# editor . - -#: The console editor to use when editing the kitty config file or -#: similar tasks. A value of . means to use the environment variable -#: EDITOR. Note that this environment variable has to be set not just -#: in your shell startup scripts but system-wide, otherwise kitty will -#: not see it. - -# close_on_child_death no - -#: Close the window when the child process (shell) exits. If no (the -#: default), the terminal will remain open when the child exits as -#: long as there are still processes outputting to the terminal (for -#: example disowned or backgrounded processes). If yes, the window -#: will close as soon as the child process exits. Note that setting it -#: to yes means that any background processes still using the terminal -#: can fail silently because their stdout/stderr/stdin no longer work. - -# allow_remote_control no - -#: Allow other programs to control kitty. If you turn this on other -#: programs can control all aspects of kitty, including sending text -#: to kitty windows, opening new windows, closing windows, reading the -#: content of windows, etc. Note that this even works over ssh -#: connections. - -# env - -#: Specify environment variables to set in all child processes. Note -#: that environment variables are expanded recursively, so if you -#: use:: - -#: env MYVAR1=a -#: env MYVAR2=${MYVAR}/${HOME}/b - -#: The value of MYVAR2 will be a//b. - -# startup_session none - -#: Path to a session file to use for all kitty instances. Can be -#: overridden by using the kitty --session command line option for -#: individual instances. See -#: https://sw.kovidgoyal.net/kitty/index.html#sessions in the kitty -#: documentation for details. Note that relative paths are interpreted -#: with respect to the kitty config directory. Environment variables -#: in the path are expanded. - -# clipboard_control write-clipboard write-primary - -#: Allow programs running in kitty to read and write from the -#: clipboard. You can control exactly which actions are allowed. The -#: set of possible actions is: write-clipboard read-clipboard write- -#: primary read-primary The default is to allow writing to the -#: clipboard and primary selection. Note that enabling the read -#: functionality is a security risk as it means that any program, even -#: one running on a remote server via SSH can read your clipboard. - -# term xterm-kitty +# Miscellaneous {{{ +# Tip: on high-DPI screens the `double` style is more discernible +url_style single +# To be honest I don't have even a slightest clue as for why I changed the TERM term xterm-256color +# }}} -#: The value of the TERM environment variable to set. Changing this -#: can break many terminal programs, only change it if you know what -#: you are doing, not because you read some advice on Stack Overflow -#: to change it. The TERM variable if used by various programs to get -#: information about the capabilities and behavior of the terminal. If -#: you change it, depending on what programs you run, and how -#: different the terminal you are changing it to is, various things -#: from key-presses, to colors, to various advanced features may not -#: work. - -#: }}} - -#: OS specific tweaks {{{ - -# macos_titlebar_color system - -#: Change the color of the kitty window's titlebar on macOS. A value -#: of system means to use the default system color, a value of -#: background means to use the background color of the currently -#: active window and finally you can use an arbitrary color, such as -#: #12af59 or red. WARNING: This option works by using a hack, as -#: there is no proper Cocoa API for it. It sets the background color -#: of the entire window and makes the titlebar transparent. As such it -#: is incompatible with background_opacity. If you want to use both, -#: you are probably better off just hiding the titlebar with -#: macos_hide_titlebar. - -# macos_hide_titlebar no - -#: Hide the kitty window's title bar on macOS. - -# x11_hide_window_decorations no - -#: Hide the window decorations (title bar and window borders) on X11 -#: and Wayland. Whether this works and exactly what effect it has -#: depends on the window manager, as it is the job of the window -#: manager/compositor to draw window decorations. - +# macOS-specific settings {{{ macos_option_as_alt yes - -#: Use the option key as an alt key. With this set to no, kitty will -#: use the macOS native Option+Key = unicode character behavior. This -#: will break any Alt+key keyboard shortcuts in your terminal -#: programs, but you can use the macOS unicode input technique. - -# macos_hide_from_tasks no - -#: Hide the kitty window from running tasks (Option+Tab) on macOS. - -# macos_quit_when_last_window_closed no - -#: Have kitty quit when all the top-level windows are closed. By -#: default, kitty will stay running, even with no open windows, as is -#: the expected behavior on macOS. - -# macos_window_resizable yes - -#: Disable this if you want kitty top-level (OS) windows to not be -#: resizable on macOS. - -# macos_thicken_font 0 - -#: Draw an extra border around the font with the given width, to -#: increase legibility at small font sizes. For example, a value of -#: 0.75 will result in rendering that looks similar to sub-pixel -#: antialiasing at common font sizes. - -# macos_traditional_fullscreen no - -#: Use the traditional full-screen transition, that is faster, but -#: less pretty. - macos_custom_beam_cursor yes - -#: Enable/disable custom mouse cursor for macOS that is easier to see -#: on both light and dark backgrounds. WARNING: this might make your -#: mouse cursor invisible on dual GPU machines. - macos_show_window_title_in window +# open_url_modifiers cmd +# }}} -#: }}} - -#: Keyboard shortcuts {{{ - -#: For a list of key names, see: GLFW keys -#: . The name to use -#: is the part after the GLFW_KEY_ prefix. For a list of modifier -#: names, see: GLFW mods -#: - -#: On Linux you can also use XKB key names to bind keys that are not -#: supported by GLFW. See XKB keys -#: -#: for a list of key names. The name to use is the part after the XKB_KEY_ -#: prefix. Note that you should only use an XKB key name for keys that are not -#: present in the list of GLFW keys. - -#: Finally, you can use raw system key codes to map keys. To see the -#: system key code for a key, start kitty with the kitty --debug- -#: keyboard option. Then kitty will output some debug text for every -#: key event. In that text look for ``native_code`` the value of that -#: becomes the key name in the shortcut. For example: - -#: .. code-block:: none - -#: on_key_input: glfw key: 65 native_code: 0x61 action: PRESS mods: 0x0 text: 'a' - -#: Here, the key name for the A key is 0x61 and you can use it with:: - -#: map ctrl+0x61 something - -#: to map ctrl+a to something. - -#: You can use the special action no_op to unmap a keyboard shortcut -#: that is assigned in the default configuration. - -#: You can combine multiple actions to be triggered by a single -#: shortcut, using the syntax below:: - -#: map key combine action1 action2 action3 ... - -#: For example:: - -#: map kitty_mod+e combine : new_window : next_layout - -#: this will create a new window and switch to the next available -#: layout - -#: You can use multi-key shortcuts using the syntax shown below:: - -#: map key1>key2>key3 action - -#: For example:: - -#: map ctrl+f>2 set_font_size 20 - -# kitty_mod ctrl+shift - -#: The value of kitty_mod is used as the modifier for all default -#: shortcuts, you can change it in your kitty.conf to change the -#: modifiers for all the default shortcuts. - -# clear_all_shortcuts no - -#: You can have kitty remove all shortcut definition seen up to this -#: point. Useful, for instance, to remove the default shortcuts. - -#: Clipboard {{{ - -# map cmd+c copy_to_clipboard -# map kitty_mod+c copy_to_clipboard -# map cmd+v paste_from_clipboard -# map kitty_mod+v paste_from_clipboard -# map kitty_mod+s paste_from_selection -# map shift+insert paste_from_selection -# map kitty_mod+o pass_selection_to_program - -#: You can also pass the contents of the current selection to any -#: program using pass_selection_to_program. By default, the system's -#: open program is used, but you can specify your own, for example:: - -#: map kitty_mod+o pass_selection_to_program firefox - -#: You can pass the current selection to a terminal program running in -#: a new kitty window, by using the @selection placeholder:: - -#: map kitty_mod+y new_window less @selection - -#: }}} - -#: Scrolling {{{ - -# map kitty_mod+up scroll_line_up -# map kitty_mod+k scroll_line_up -# map kitty_mod+down scroll_line_down -# map kitty_mod+j scroll_line_down -# map kitty_mod+page_up scroll_page_up -# map kitty_mod+page_down scroll_page_down -# map kitty_mod+home scroll_home -# map kitty_mod+end scroll_end -# map kitty_mod+h show_scrollback - -#: You can pipe the contents of the current screen + history buffer as -#: STDIN to an arbitrary program using the ``pipe`` function. For -#: example, the following opens the scrollback buffer in less in an -#: overlay window:: - -#: map f1 pipe @ansi overlay less +G -R - -#: Placeholders available are: @text (which is plain text) and @ansi -#: (which includes text styling escape codes). For only the current -#: screen, use @screen or @ansi_screen. For the secondary screen, use -#: @alternate and @ansi_alternate. The secondary screen is the screen -#: not currently displayed. For example if you run a fullscreen -#: terminal application, the secondary screen will be the screen you -#: return to when quitting the application. You can also use ``none`` -#: for no STDIN input. - -#: To open in a new window, tab or new OS window, use ``window``, -#: ``tab``, or ``os_window`` respectively. You can also use ``none`` -#: in which case the data will be piped into the program without -#: creating any windows, useful if the program is a GUI program that -#: creates its own windows. - -#: }}} - -#: Window management {{{ - -# map kitty_mod+enter new_window - -#: You can open a new window running an arbitrary program, for -#: example:: - -#: map kitty_mod+y new_window mutt - -#: You can open a new window with the current working directory set to -#: the working directory of the current window using:: - -#: map ctrl+alt+enter new_window_with_cwd - -#: You can open a new window that is allowed to control kitty via the -#: kitty remote control facility by prefixing the command line with @. -#: Any programs running in that window will be allowed to control -#: kitty. For example:: - -#: map ctrl+enter new_window @ some_program - -# map cmd+n new_os_window -# map kitty_mod+n new_os_window -# map kitty_mod+w close_window -# map kitty_mod+] next_window -# map kitty_mod+[ previous_window -# map kitty_mod+f move_window_forward -# map kitty_mod+b move_window_backward -# map kitty_mod+` move_window_to_top -# map kitty_mod+r start_resizing_window -# map kitty_mod+1 first_window -# map kitty_mod+2 second_window -# map kitty_mod+3 third_window -# map kitty_mod+4 fourth_window -# map kitty_mod+5 fifth_window -# map kitty_mod+6 sixth_window -# map kitty_mod+7 seventh_window -# map kitty_mod+8 eighth_window -# map kitty_mod+9 ninth_window -# map kitty_mod+0 tenth_window -#: }}} - -#: Tab management {{{ - -# map ctrl+tab next_tab -# map kitty_mod+right next_tab -# map ctrl+shift+tab previous_tab -# map kitty_mod+left previous_tab -# map kitty_mod+t new_tab -# map kitty_mod+q close_tab -# map kitty_mod+. move_tab_forward -# map kitty_mod+, move_tab_backward -# map kitty_mod+alt+t set_tab_title - +# Keybindings {{{ map kitty_mod+1 goto_tab 1 map kitty_mod+2 goto_tab 2 map kitty_mod+3 goto_tab 3 @@ -777,144 +57,4 @@ map kitty_mod+7 goto_tab 7 map kitty_mod+8 goto_tab 8 map kitty_mod+9 goto_tab 9 map kitty_mod+0 goto_tab 10 - -#: You can also create shortcuts to go to specific tabs, with 1 being -#: the first tab:: - -#: map ctrl+alt+1 goto_tab 1 -#: map ctrl+alt+2 goto_tab 2 - -#: Just as with new_window above, you can also pass the name of -#: arbitrary commands to run when using new_tab and use -#: new_tab_with_cwd. Finally, if you want the new tab to open next to -#: the current tab rather than at the end of the tabs list, use:: - -#: map ctrl+t new_tab !neighbor [optional cmd to run] -#: }}} - -#: Layout management {{{ - -# map kitty_mod+l next_layout - -#: You can also create shortcuts to switch to specific layouts:: - -#: map ctrl+alt+t goto_layout tall -#: map ctrl+alt+s goto_layout stack - -#: Similarly, to switch back to the previous layout:: - -#: map ctrl+alt+p last_used_layout -#: }}} - -#: Font sizes {{{ - -#: You can change the font size for all top-level kitty windows at a -#: time or only the current one. - -# map kitty_mod+equal change_font_size all +2.0 -# map kitty_mod+minus change_font_size all -2.0 -# map kitty_mod+backspace change_font_size all 0 - -#: To setup shortcuts for specific font sizes:: - -#: map kitty_mod+f6 change_font_size all 10.0 - -#: To setup shortcuts to change only the current window's font size:: - -#: map kitty_mod+f6 change_font_size current 10.0 -#: }}} - -#: Select and act on visible text {{{ - -#: Use the hints kitten to select text and either pass it to an -#: external program or insert it into the terminal or copy it to the -#: clipboard. - -# map kitty_mod+e kitten hints - -#: Open a currently visible URL using the keyboard. The program used -#: to open the URL is specified in open_url_with. - -# map kitty_mod+p>f kitten hints --type path --program - - -#: Select a path/filename and insert it into the terminal. Useful, for -#: instance to run git commands on a filename output from a previous -#: git command. - -# map kitty_mod+p>shift+f kitten hints --type path - -#: Select a path/filename and open it with the default open program. - -# map kitty_mod+p>l kitten hints --type line --program - - -#: Select a line of text and insert it into the terminal. Use for the -#: output of things like: ls -1 - -# map kitty_mod+p>w kitten hints --type word --program - - -#: Select words and insert into terminal. - -# map kitty_mod+p>h kitten hints --type hash --program - - -#: Select something that looks like a hash and insert it into the -#: terminal. Useful with git, which uses sha1 hashes to identify -#: commits - - -#: The hints kitten has many more modes of operation that you can map -#: to different shortcuts. For a full description see kittens/hints. -#: }}} - -#: Miscellaneous {{{ - -# map kitty_mod+f11 toggle_fullscreen -# map kitty_mod+u kitten unicode_input -# map kitty_mod+f2 edit_config_file -# map kitty_mod+escape kitty_shell window - -#: Open the kitty shell in a new window/tab/overlay/os_window to -#: control kitty using commands. - -# map kitty_mod+a>m set_background_opacity +0.1 -# map kitty_mod+a>l set_background_opacity -0.1 -# map kitty_mod+a>1 set_background_opacity 1 -# map kitty_mod+a>d set_background_opacity default -# map kitty_mod+delete clear_terminal reset active - -#: You can create shortcuts to clear/reset the terminal. For example:: - -#: map kitty_mod+f9 clear_terminal reset active -#: map kitty_mod+f10 clear_terminal clear active -#: map kitty_mod+f11 clear_terminal scrollback active - -#: These will reset screen/clear screen/clear screen+scrollback -#: respectively. If you want to operate on all windows instead of just -#: the current one, use all instead of :italic`active`. - - -#: You can tell kitty to send arbitrary (UTF-8) encoded text to the -#: client program when pressing specified shortcut keys. For example:: - -#: map ctrl+alt+a send_text all Special text - -#: This will send "Special text" when you press the ctrl+alt+a key -#: combination. The text to be sent is a python string literal so you -#: can use escapes like \x1b to send control codes or \u21fb to send -#: unicode characters (or you can just input the unicode characters -#: directly as UTF-8 text). The first argument to send_text is the -#: keyboard modes in which to activate the shortcut. The possible -#: values are normal or application or kitty or a comma separated -#: combination of them. The special keyword all means all modes. The -#: modes normal and application refer to the DECCKM cursor key mode -#: for terminals, and kitty refers to the special kitty extended -#: keyboard protocol. - -#: Another example, that outputs a word and then moves the cursor to -#: the start of the line (same as pressing the Home key):: - -#: map ctrl+alt+a send_text normal Word\x1b[H -#: map ctrl+alt+a send_text application Word\x1bOH - -#: }}} - # }}} From bcf58ced93a261e941809095073fabd7264c0714 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 4 Feb 2021 19:29:41 +0200 Subject: [PATCH 482/713] [kitty] enable the only two layouts I actually use --- kitty/kitty.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kitty/kitty.conf b/kitty/kitty.conf index 1c2dc19..f420e22 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -236,7 +236,7 @@ bell_on_tab yes #: suffix of "c" on the width/height values to have them interpreted #: as number of cells instead of pixels. -# enabled_layouts * +enabled_layouts horizontal, vertical #: The enabled window layouts. A comma separated list of layout names. #: The special value all means all layouts. The first listed layout From f2882476712fcdc450c5edd35b6a9d0806e25a35 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 4 Feb 2021 19:58:19 +0200 Subject: [PATCH 483/713] [kitty] remove the sample config and keep only the changed bits --- kitty/kitty.conf | 916 ++--------------------------------------------- 1 file changed, 28 insertions(+), 888 deletions(-) diff --git a/kitty/kitty.conf b/kitty/kitty.conf index f420e22..d06cc3b 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -1,772 +1,52 @@ include ../colorschemes/out/kitty.conf -#: Fonts {{{ - -#: kitty has very powerful font management. You can configure -#: individual font faces and even specify special fonts for particular -#: characters. - -# font_family monospace -# bold_font auto -# italic_font auto -# bold_italic_font auto - -#: You can specify different fonts for the bold/italic/bold-italic -#: variants. By default they are derived automatically, by the OSes -#: font system. Setting them manually is useful for font families that -#: have many weight variants like Book, Medium, Thick, etc. For -#: example:: - -#: font_family Operator Mono Book -#: bold_font Operator Mono Medium -#: italic_font Operator Mono Book Italic -#: bold_italic_font Operator Mono Medium Italic - -# font_size 14.0 - -#: Font size (in pts) - -# adjust_line_height 0 -# adjust_column_width 0 - -#: Change the size of each character cell kitty renders. You can use -#: either numbers, which are interpreted as pixels or percentages -#: (number followed by %), which are interpreted as percentages of the -#: unmodified values. You can use negative pixels or percentages less -#: than 100% to reduce sizes (but this might cause rendering -#: artifacts). - -# symbol_map U+E0A0-U+E0A2,U+E0B0-U+E0B3 PowerlineSymbols - -#: Map the specified unicode codepoints to a particular font. Useful -#: if you need special rendering for some symbols, such as for -#: Powerline. Avoids the need for patched fonts. Each unicode code -#: point is specified in the form U+. You -#: can specify multiple code points, separated by commas and ranges -#: separated by hyphens. symbol_map itself can be specified multiple -#: times. Syntax is:: - -#: symbol_map codepoints Font Family Name - -# box_drawing_scale 0.001, 1, 1.5, 2 - -#: Change the sizes of the lines used for the box drawing unicode -#: characters These values are in pts. They will be scaled by the -#: monitor DPI to arrive at a pixel value. There must be four values -#: corresponding to thin, normal, thick, and very thick lines. - -#: }}} - -#: Cursor customization {{{ - -# cursor #cccccc - -#: Default cursor color - -# cursor_text_color #111111 - -#: Choose the color of text under the cursor. If you want it rendered -#: with the background color of the cell underneath instead, use the -#: special keyword: background - -# cursor_shape block - -#: The cursor shape can be one of (block, beam, underline) - +# Mouse {{{ +# Disable cursor blinking cursor_blink_interval 0 cursor_stop_blinking_after 0 +mouse_hide_wait 1 +# }}} -#: The interval (in seconds) at which to blink the cursor. Set to zero -#: to disable blinking. Note that numbers smaller than repaint_delay -#: will be limited to repaint_delay. Stop blinking cursor after the -#: specified number of seconds of keyboard inactivity. Set to zero to -#: never stop blinking. - -#: }}} - -#: Scrollback {{{ - -# scrollback_lines 2000 - -#: Number of lines of history to keep in memory for scrolling back. -#: Memory is allocated on demand. Negative numbers are (effectively) -#: infinite scrollback. Note that using very large scrollback is not -#: recommended a it can slow down resizing of the terminal and also -#: use large amounts of RAM. - -# scrollback_pager less --chop-long-lines --RAW-CONTROL-CHARS +INPUT_LINE_NUMBER - -#: Program with which to view scrollback in a new window. The -#: scrollback buffer is passed as STDIN to this program. If you change -#: it, make sure the program you use can handle ANSI escape sequences -#: for colors and text formatting. INPUT_LINE_NUMBER in the command -#: line above will be replaced by an integer representing which line -#: should be at the top of the screen. - -# wheel_scroll_multiplier 5.0 - -#: Modify the amount scrolled by the mouse wheel. Note this is only -#: used for low precision scrolling devices, not for high precision -#: scrolling on platforms such as macOS and Wayland. Use negative -#: numbers to change scroll direction. - -#: }}} - -#: Mouse {{{ - -# url_color #0087bd -url_style single - -#: The color and style for highlighting URLs on mouse-over. url_style -#: can be one of: none, single, double, curly - -# open_url_modifiers kitty_mod - -#: The modifier keys to press when clicking with the mouse on URLs to -#: open the URL - -# open_url_with default - -#: The program with which to open URLs that are clicked on. The -#: special value default means to use the operating system's default -#: URL handler. - -# copy_on_select no - -#: Copy to clipboard on select. With this enabled, simply selecting -#: text with the mouse will cause the text to be copied to clipboard. -#: Useful on platforms such as macOS/Wayland that do not have the -#: concept of primary selections. Note that this is a security risk, -#: as all programs, including websites open in your browser can read -#: the contents of the clipboard. - -# rectangle_select_modifiers ctrl+alt - -#: The modifiers to use rectangular selection (i.e. to select text in -#: a rectangular block with the mouse) - -# select_by_word_characters :@-./_~?&=%+# - -#: Characters considered part of a word when double clicking. In -#: addition to these characters any character that is marked as an -#: alpha-numeric character in the unicode database will be matched. - -# click_interval 0.5 - -#: The interval between successive clicks to detect double/triple -#: clicks (in seconds) - -mouse_hide_wait 3.0 - -#: Hide mouse cursor after the specified number of seconds of the -#: mouse not being used. Set to zero to disable mouse cursor hiding. - -focus_follows_mouse no - -#: Set the active window to the window under the mouse when moving the -#: mouse around - -#: }}} - -#: Performance tuning {{{ - -# repaint_delay 10 - -#: Delay (in milliseconds) between screen updates. Decreasing it, -#: increases frames-per-second (FPS) at the cost of more CPU usage. -#: The default value yields ~100 FPS which is more than sufficient for -#: most uses. Note that to actually achieve 100 FPS you have to either -#: set sync_to_monitor to no or use a monitor with a high refresh -#: rate. - -# input_delay 3 - -#: Delay (in milliseconds) before input from the program running in -#: the terminal is processed. Note that decreasing it will increase -#: responsiveness, but also increase CPU usage and might cause flicker -#: in full screen programs that redraw the entire screen on each loop, -#: because kitty is so fast that partial screen updates will be drawn. - -sync_to_monitor yes - -#: Sync screen updates to the refresh rate of the monitor. This -#: prevents tearing (https://en.wikipedia.org/wiki/Screen_tearing) -#: when scrolling. However, it limits the rendering speed to the -#: refresh rate of your monitor. With a very high speed mouse/high -#: keyboard repeat rate, you may notice some slight input latency. If -#: so, set this to no. - -#: }}} - -#: Terminal bell {{{ - -# enable_audio_bell yes - -#: Enable/disable the audio bell. Useful in environments that require -#: silence. - -# visual_bell_duration 0.0 - -#: Visual bell duration. Flash the screen when a bell occurs for the -#: specified number of seconds. Set to zero to disable. - -window_alert_on_bell yes - -#: Request window attention on bell. Makes the dock icon bounce on -#: macOS or the taskbar flash on linux. - -bell_on_tab yes - -#: Show a bell symbol on the tab if a bell occurs in one of the -#: windows in the tab and the window is not the currently focused -#: window - -#: }}} - -#: Window layout {{{ - -# remember_window_size yes -# initial_window_width 640 -# initial_window_height 400 - -#: If enabled, the window size will be remembered so that new -#: instances of kitty will have the same size as the previous -#: instance. If disabled, the window will initially have size -#: configured by initial_window_width/height, in pixels. You can use a -#: suffix of "c" on the width/height values to have them interpreted -#: as number of cells instead of pixels. - -enabled_layouts horizontal, vertical - -#: The enabled window layouts. A comma separated list of layout names. -#: The special value all means all layouts. The first listed layout -#: will be used as the startup layout. For a list of available -#: layouts, see the -#: https://sw.kovidgoyal.net/kitty/index.html#layouts. - -# window_resize_step_cells 2 -# window_resize_step_lines 2 - -#: The step size (in units of cell width/cell height) to use when -#: resizing windows. The cells value is used for horizontal resizing -#: and the lines value for vertical resizing. - -# window_border_width 1.0 - -#: The width (in pts) of window borders. Will be rounded to the -#: nearest number of pixels based on screen resolution. Note that -#: borders are displayed only when more than one window is visible. -#: They are meant to separate multiple windows. - -# draw_minimal_borders no - -#: Draw only the minimum borders needed. This means that only the -#: minimum needed borders for inactive windows are drawn. That is only -#: the borders that separate the inactive window from a neighbor. Note -#: that setting a non-zero window margin overrides this and causes all -#: borders to be drawn. - -window_margin_width 1.0 - -#: The window margin (in pts) (blank area outside the border) - -# single_window_margin_width -1000.0 - -#: The window margin (in pts) to use when only a single window is -#: visible. Negative values will cause the value of -#: window_margin_width to be used instead. - -window_padding_width 2.0 - -#: The window padding (in pts) (blank area between the text and the -#: window border) - -# active_border_color #00ff00 - -#: The color for the border of the active window - -# inactive_border_color #cccccc - -#: The color for the border of inactive windows - -# bell_border_color #ff5a00 - -#: The color for the border of inactive windows in which a bell has -#: occurred - -inactive_text_alpha 0.5 - -#: Fade the text in inactive windows by the specified amount (a number -#: between zero and one, with zero being fully faded). - +# OS Windows {{{ +# Always ask for confirmation before closing OS windows confirm_os_window_close 1 -#: Ask for confirmation when closing an OS window that has at least this -#: number of kitty windows in it. A value of zero disables confirmation. -#: This confirmation also applies to requests to quit the entire application (all -#: OS windows, via the quite action). +# }}} -#: }}} - -#: Tab bar {{{ +# Windows {{{ +# These are the only layouts I use: +enabled_layouts horizontal, vertical +window_margin_width 1.0 +window_padding_width 2.0 +inactive_text_alpha 0.5 +# }}} +# Tabs {{{ tab_bar_edge top - -#: Which edge to show the tab bar on, top or bottom - -# tab_bar_margin_width 0.0 - -#: The margin to the left and right of the tab bar (in pts) - -# TODO: change this to "separator" if maintainer of kitty agrees with me. -# see https://github.com/kovidgoyal/kitty/pull/2480 -# fortunately, kitty seems to have built-in powerline character support tab_bar_style powerline - -#: The tab bar style, can be one of: fade or separator. In the fade -#: style, each tab's edges fade into the background color, in the -#: separator style, tabs are separated by a configurable separator. - -# tab_fade 0.25 0.5 0.75 1 - -#: Control how each tab fades into the background when using fade for -#: the tab_bar_style. Each number is an alpha (between zero and one) -#: that controls how much the corresponding cell fades into the -#: background, with zero being no fade and one being full fade. You -#: can change the number of cells used by adding/removing entries to -#: this list. - +# This option doesn't really do anything when the tab bar style is `powerline`, +# but this Unicode character is a nice find, so let's keep it just in case. tab_separator " │ " - -#: The separator between tabs in the tab bar when using separator as -#: the tab_bar_style. - +# Always show the tab bar tab_bar_min_tabs 1 - -# active_tab_foreground #000 -# active_tab_background #eee active_tab_font_style bold -# inactive_tab_foreground #444 -# inactive_tab_background #999 inactive_tab_font_style none +# }}} -#: Tab bar colors and styles - -#: }}} - -#: Color scheme {{{ - -# foreground #dddddd -# background #000000 - -#: The foreground and background colors - -# background_opacity 1.0 -# dynamic_background_opacity no - -#: The opacity of the background. A number between 0 and 1, where 1 is -#: opaque and 0 is fully transparent. This will only work if -#: supported by the OS (for instance, when using a compositor under -#: X11). Note that it only sets the default background color's -#: opacity. This is so that things like the status bar in vim, -#: powerline prompts, etc. still look good. But it means that if you -#: use a color theme with a background color in your editor, it will -#: not be rendered as transparent. Instead you should change the -#: default background color in your kitty config and not use a -#: background color in the editor color scheme. Or use the escape -#: codes to set the terminals default colors in a shell script to -#: launch your editor. Be aware that using a value less than 1.0 is a -#: (possibly significant) performance hit. If you want to dynamically -#: change transparency of windows set dynamic_background_opacity to -#: yes (this is off by default as it has a performance cost) - -# dim_opacity 0.75 - -#: How much to dim text that has the DIM/FAINT attribute set. One -#: means no dimming and zero means fully dimmed (i.e. invisible). - -# selection_foreground #000000 -# selection_background #fffacd - -#: The foreground and background for text selected with the mouse - - -#: The 16 terminal colors. There are 8 basic colors, each color has a -#: dull and bright version. You can also set the remaining colors from -#: the 256 color table as color16 to color255. - -# color0 #000000 -# color8 #767676 - -#: black - -# color1 #cc0403 -# color9 #f2201f - -#: red - -# color2 #19cb00 -# color10 #23fd00 - -#: green - -# color3 #cecb00 -# color11 #fffd00 - -#: yellow - -# color4 #0d73cc -# color12 #1a8fff - -#: blue - -# color5 #cb1ed1 -# color13 #fd28ff - -#: magenta - -# color6 #0dcdcd -# color14 #14ffff - -#: cyan - -# color7 #dddddd -# color15 #ffffff - -#: white - -#: }}} - -#: Advanced {{{ - -# shell sh -c 'exec login -f -p $USER' -# shell zsh --login - -#: The shell program to execute. The default value of . means to use -#: whatever shell is set as the default shell for the current user. -#: Note that on macOS if you change this, you might need to add -#: --login to ensure that the shell starts in interactive mode and -#: reads its startup rc files. - -# editor . - -#: The console editor to use when editing the kitty config file or -#: similar tasks. A value of . means to use the environment variable -#: EDITOR. Note that this environment variable has to be set not just -#: in your shell startup scripts but system-wide, otherwise kitty will -#: not see it. - -# close_on_child_death no - -#: Close the window when the child process (shell) exits. If no (the -#: default), the terminal will remain open when the child exits as -#: long as there are still processes outputting to the terminal (for -#: example disowned or backgrounded processes). If yes, the window -#: will close as soon as the child process exits. Note that setting it -#: to yes means that any background processes still using the terminal -#: can fail silently because their stdout/stderr/stdin no longer work. - -# allow_remote_control no - -#: Allow other programs to control kitty. If you turn this on other -#: programs can control all aspects of kitty, including sending text -#: to kitty windows, opening new windows, closing windows, reading the -#: content of windows, etc. Note that this even works over ssh -#: connections. - -# env - -#: Specify environment variables to set in all child processes. Note -#: that environment variables are expanded recursively, so if you -#: use:: - -#: env MYVAR1=a -#: env MYVAR2=${MYVAR}/${HOME}/b - -#: The value of MYVAR2 will be a//b. - -# startup_session none - -#: Path to a session file to use for all kitty instances. Can be -#: overridden by using the kitty --session command line option for -#: individual instances. See -#: https://sw.kovidgoyal.net/kitty/index.html#sessions in the kitty -#: documentation for details. Note that relative paths are interpreted -#: with respect to the kitty config directory. Environment variables -#: in the path are expanded. - -# clipboard_control write-clipboard write-primary - -#: Allow programs running in kitty to read and write from the -#: clipboard. You can control exactly which actions are allowed. The -#: set of possible actions is: write-clipboard read-clipboard write- -#: primary read-primary The default is to allow writing to the -#: clipboard and primary selection. Note that enabling the read -#: functionality is a security risk as it means that any program, even -#: one running on a remote server via SSH can read your clipboard. - -# term xterm-kitty +# Miscellaneous {{{ +# Tip: on high-DPI screens the `double` style is more discernible +url_style single +# To be honest I don't have even a slightest clue as for why I changed the TERM term xterm-256color +# }}} -#: The value of the TERM environment variable to set. Changing this -#: can break many terminal programs, only change it if you know what -#: you are doing, not because you read some advice on Stack Overflow -#: to change it. The TERM variable if used by various programs to get -#: information about the capabilities and behavior of the terminal. If -#: you change it, depending on what programs you run, and how -#: different the terminal you are changing it to is, various things -#: from key-presses, to colors, to various advanced features may not -#: work. - -#: }}} - -#: OS specific tweaks {{{ - -# macos_titlebar_color system - -#: Change the color of the kitty window's titlebar on macOS. A value -#: of system means to use the default system color, a value of -#: background means to use the background color of the currently -#: active window and finally you can use an arbitrary color, such as -#: #12af59 or red. WARNING: This option works by using a hack, as -#: there is no proper Cocoa API for it. It sets the background color -#: of the entire window and makes the titlebar transparent. As such it -#: is incompatible with background_opacity. If you want to use both, -#: you are probably better off just hiding the titlebar with -#: macos_hide_titlebar. - -# macos_hide_titlebar no - -#: Hide the kitty window's title bar on macOS. - -# x11_hide_window_decorations no - -#: Hide the window decorations (title bar and window borders) on X11 -#: and Wayland. Whether this works and exactly what effect it has -#: depends on the window manager, as it is the job of the window -#: manager/compositor to draw window decorations. - +# macOS-specific settings {{{ macos_option_as_alt yes - -#: Use the option key as an alt key. With this set to no, kitty will -#: use the macOS native Option+Key = unicode character behavior. This -#: will break any Alt+key keyboard shortcuts in your terminal -#: programs, but you can use the macOS unicode input technique. - -# macos_hide_from_tasks no - -#: Hide the kitty window from running tasks (Option+Tab) on macOS. - -# macos_quit_when_last_window_closed no - -#: Have kitty quit when all the top-level windows are closed. By -#: default, kitty will stay running, even with no open windows, as is -#: the expected behavior on macOS. - -# macos_window_resizable yes - -#: Disable this if you want kitty top-level (OS) windows to not be -#: resizable on macOS. - -# macos_thicken_font 0 - -#: Draw an extra border around the font with the given width, to -#: increase legibility at small font sizes. For example, a value of -#: 0.75 will result in rendering that looks similar to sub-pixel -#: antialiasing at common font sizes. - -# macos_traditional_fullscreen no - -#: Use the traditional full-screen transition, that is faster, but -#: less pretty. - macos_custom_beam_cursor yes - -#: Enable/disable custom mouse cursor for macOS that is easier to see -#: on both light and dark backgrounds. WARNING: this might make your -#: mouse cursor invisible on dual GPU machines. - macos_show_window_title_in window +# open_url_modifiers cmd +# }}} -#: }}} - -#: Keyboard shortcuts {{{ - -#: For a list of key names, see: GLFW keys -#: . The name to use -#: is the part after the GLFW_KEY_ prefix. For a list of modifier -#: names, see: GLFW mods -#: - -#: On Linux you can also use XKB key names to bind keys that are not -#: supported by GLFW. See XKB keys -#: -#: for a list of key names. The name to use is the part after the XKB_KEY_ -#: prefix. Note that you should only use an XKB key name for keys that are not -#: present in the list of GLFW keys. - -#: Finally, you can use raw system key codes to map keys. To see the -#: system key code for a key, start kitty with the kitty --debug- -#: keyboard option. Then kitty will output some debug text for every -#: key event. In that text look for ``native_code`` the value of that -#: becomes the key name in the shortcut. For example: - -#: .. code-block:: none - -#: on_key_input: glfw key: 65 native_code: 0x61 action: PRESS mods: 0x0 text: 'a' - -#: Here, the key name for the A key is 0x61 and you can use it with:: - -#: map ctrl+0x61 something - -#: to map ctrl+a to something. - -#: You can use the special action no_op to unmap a keyboard shortcut -#: that is assigned in the default configuration. - -#: You can combine multiple actions to be triggered by a single -#: shortcut, using the syntax below:: - -#: map key combine action1 action2 action3 ... - -#: For example:: - -#: map kitty_mod+e combine : new_window : next_layout - -#: this will create a new window and switch to the next available -#: layout - -#: You can use multi-key shortcuts using the syntax shown below:: - -#: map key1>key2>key3 action - -#: For example:: - -#: map ctrl+f>2 set_font_size 20 - -# kitty_mod ctrl+shift - -#: The value of kitty_mod is used as the modifier for all default -#: shortcuts, you can change it in your kitty.conf to change the -#: modifiers for all the default shortcuts. - -# clear_all_shortcuts no - -#: You can have kitty remove all shortcut definition seen up to this -#: point. Useful, for instance, to remove the default shortcuts. - -#: Clipboard {{{ - -# map cmd+c copy_to_clipboard -# map kitty_mod+c copy_to_clipboard -# map cmd+v paste_from_clipboard -# map kitty_mod+v paste_from_clipboard -# map kitty_mod+s paste_from_selection -# map shift+insert paste_from_selection -# map kitty_mod+o pass_selection_to_program - -#: You can also pass the contents of the current selection to any -#: program using pass_selection_to_program. By default, the system's -#: open program is used, but you can specify your own, for example:: - -#: map kitty_mod+o pass_selection_to_program firefox - -#: You can pass the current selection to a terminal program running in -#: a new kitty window, by using the @selection placeholder:: - -#: map kitty_mod+y new_window less @selection - -#: }}} - -#: Scrolling {{{ - -# map kitty_mod+up scroll_line_up -# map kitty_mod+k scroll_line_up -# map kitty_mod+down scroll_line_down -# map kitty_mod+j scroll_line_down -# map kitty_mod+page_up scroll_page_up -# map kitty_mod+page_down scroll_page_down -# map kitty_mod+home scroll_home -# map kitty_mod+end scroll_end -# map kitty_mod+h show_scrollback - -#: You can pipe the contents of the current screen + history buffer as -#: STDIN to an arbitrary program using the ``pipe`` function. For -#: example, the following opens the scrollback buffer in less in an -#: overlay window:: - -#: map f1 pipe @ansi overlay less +G -R - -#: Placeholders available are: @text (which is plain text) and @ansi -#: (which includes text styling escape codes). For only the current -#: screen, use @screen or @ansi_screen. For the secondary screen, use -#: @alternate and @ansi_alternate. The secondary screen is the screen -#: not currently displayed. For example if you run a fullscreen -#: terminal application, the secondary screen will be the screen you -#: return to when quitting the application. You can also use ``none`` -#: for no STDIN input. - -#: To open in a new window, tab or new OS window, use ``window``, -#: ``tab``, or ``os_window`` respectively. You can also use ``none`` -#: in which case the data will be piped into the program without -#: creating any windows, useful if the program is a GUI program that -#: creates its own windows. - -#: }}} - -#: Window management {{{ - -# map kitty_mod+enter new_window - -#: You can open a new window running an arbitrary program, for -#: example:: - -#: map kitty_mod+y new_window mutt - -#: You can open a new window with the current working directory set to -#: the working directory of the current window using:: - -#: map ctrl+alt+enter new_window_with_cwd - -#: You can open a new window that is allowed to control kitty via the -#: kitty remote control facility by prefixing the command line with @. -#: Any programs running in that window will be allowed to control -#: kitty. For example:: - -#: map ctrl+enter new_window @ some_program - -# map cmd+n new_os_window -# map kitty_mod+n new_os_window -# map kitty_mod+w close_window -# map kitty_mod+] next_window -# map kitty_mod+[ previous_window -# map kitty_mod+f move_window_forward -# map kitty_mod+b move_window_backward -# map kitty_mod+` move_window_to_top -# map kitty_mod+r start_resizing_window -# map kitty_mod+1 first_window -# map kitty_mod+2 second_window -# map kitty_mod+3 third_window -# map kitty_mod+4 fourth_window -# map kitty_mod+5 fifth_window -# map kitty_mod+6 sixth_window -# map kitty_mod+7 seventh_window -# map kitty_mod+8 eighth_window -# map kitty_mod+9 ninth_window -# map kitty_mod+0 tenth_window -#: }}} - -#: Tab management {{{ - -# map ctrl+tab next_tab -# map kitty_mod+right next_tab -# map ctrl+shift+tab previous_tab -# map kitty_mod+left previous_tab -# map kitty_mod+t new_tab -# map kitty_mod+q close_tab -# map kitty_mod+. move_tab_forward -# map kitty_mod+, move_tab_backward -# map kitty_mod+alt+t set_tab_title - +# Keybindings {{{ map kitty_mod+1 goto_tab 1 map kitty_mod+2 goto_tab 2 map kitty_mod+3 goto_tab 3 @@ -777,144 +57,4 @@ map kitty_mod+7 goto_tab 7 map kitty_mod+8 goto_tab 8 map kitty_mod+9 goto_tab 9 map kitty_mod+0 goto_tab 10 - -#: You can also create shortcuts to go to specific tabs, with 1 being -#: the first tab:: - -#: map ctrl+alt+1 goto_tab 1 -#: map ctrl+alt+2 goto_tab 2 - -#: Just as with new_window above, you can also pass the name of -#: arbitrary commands to run when using new_tab and use -#: new_tab_with_cwd. Finally, if you want the new tab to open next to -#: the current tab rather than at the end of the tabs list, use:: - -#: map ctrl+t new_tab !neighbor [optional cmd to run] -#: }}} - -#: Layout management {{{ - -# map kitty_mod+l next_layout - -#: You can also create shortcuts to switch to specific layouts:: - -#: map ctrl+alt+t goto_layout tall -#: map ctrl+alt+s goto_layout stack - -#: Similarly, to switch back to the previous layout:: - -#: map ctrl+alt+p last_used_layout -#: }}} - -#: Font sizes {{{ - -#: You can change the font size for all top-level kitty windows at a -#: time or only the current one. - -# map kitty_mod+equal change_font_size all +2.0 -# map kitty_mod+minus change_font_size all -2.0 -# map kitty_mod+backspace change_font_size all 0 - -#: To setup shortcuts for specific font sizes:: - -#: map kitty_mod+f6 change_font_size all 10.0 - -#: To setup shortcuts to change only the current window's font size:: - -#: map kitty_mod+f6 change_font_size current 10.0 -#: }}} - -#: Select and act on visible text {{{ - -#: Use the hints kitten to select text and either pass it to an -#: external program or insert it into the terminal or copy it to the -#: clipboard. - -# map kitty_mod+e kitten hints - -#: Open a currently visible URL using the keyboard. The program used -#: to open the URL is specified in open_url_with. - -# map kitty_mod+p>f kitten hints --type path --program - - -#: Select a path/filename and insert it into the terminal. Useful, for -#: instance to run git commands on a filename output from a previous -#: git command. - -# map kitty_mod+p>shift+f kitten hints --type path - -#: Select a path/filename and open it with the default open program. - -# map kitty_mod+p>l kitten hints --type line --program - - -#: Select a line of text and insert it into the terminal. Use for the -#: output of things like: ls -1 - -# map kitty_mod+p>w kitten hints --type word --program - - -#: Select words and insert into terminal. - -# map kitty_mod+p>h kitten hints --type hash --program - - -#: Select something that looks like a hash and insert it into the -#: terminal. Useful with git, which uses sha1 hashes to identify -#: commits - - -#: The hints kitten has many more modes of operation that you can map -#: to different shortcuts. For a full description see kittens/hints. -#: }}} - -#: Miscellaneous {{{ - -# map kitty_mod+f11 toggle_fullscreen -# map kitty_mod+u kitten unicode_input -# map kitty_mod+f2 edit_config_file -# map kitty_mod+escape kitty_shell window - -#: Open the kitty shell in a new window/tab/overlay/os_window to -#: control kitty using commands. - -# map kitty_mod+a>m set_background_opacity +0.1 -# map kitty_mod+a>l set_background_opacity -0.1 -# map kitty_mod+a>1 set_background_opacity 1 -# map kitty_mod+a>d set_background_opacity default -# map kitty_mod+delete clear_terminal reset active - -#: You can create shortcuts to clear/reset the terminal. For example:: - -#: map kitty_mod+f9 clear_terminal reset active -#: map kitty_mod+f10 clear_terminal clear active -#: map kitty_mod+f11 clear_terminal scrollback active - -#: These will reset screen/clear screen/clear screen+scrollback -#: respectively. If you want to operate on all windows instead of just -#: the current one, use all instead of :italic`active`. - - -#: You can tell kitty to send arbitrary (UTF-8) encoded text to the -#: client program when pressing specified shortcut keys. For example:: - -#: map ctrl+alt+a send_text all Special text - -#: This will send "Special text" when you press the ctrl+alt+a key -#: combination. The text to be sent is a python string literal so you -#: can use escapes like \x1b to send control codes or \u21fb to send -#: unicode characters (or you can just input the unicode characters -#: directly as UTF-8 text). The first argument to send_text is the -#: keyboard modes in which to activate the shortcut. The possible -#: values are normal or application or kitty or a comma separated -#: combination of them. The special keyword all means all modes. The -#: modes normal and application refer to the DECCKM cursor key mode -#: for terminals, and kitty refers to the special kitty extended -#: keyboard protocol. - -#: Another example, that outputs a word and then moves the cursor to -#: the start of the line (same as pressing the Home key):: - -#: map ctrl+alt+a send_text normal Word\x1b[H -#: map ctrl+alt+a send_text application Word\x1bOH - -#: }}} - # }}} From 871aa910da09e451bb64fb23a76e55184103ec04 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 4 Feb 2021 22:41:27 +0200 Subject: [PATCH 484/713] [scripts] add my secret tmux attaching script --- scripts/tmux-attach-or-new.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 scripts/tmux-attach-or-new.sh diff --git a/scripts/tmux-attach-or-new.sh b/scripts/tmux-attach-or-new.sh new file mode 100755 index 0000000..e34f3e2 --- /dev/null +++ b/scripts/tmux-attach-or-new.sh @@ -0,0 +1,6 @@ +#!/bin/sh +if tmux has-session; then + exec tmux attach +else + exec tmux new +fi From fe2dd2c982b6968727929fb6b6f37d42d7a05d1e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 5 Feb 2021 11:13:25 +0200 Subject: [PATCH 485/713] [zsh] add a timestamp printing function --- zsh/functions.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 88edb32..e008988 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -83,6 +83,7 @@ declare -A date_formats=( compact '%Y%m%d%H%M%S' only-date '%Y-%m-%d' only-time '%H:%M:%S' + timestamp '%s' ) for format_name format in "${(kv)date_formats[@]}"; do From 6dc39b0e04b5f65b801bd26414ae2875c67a7356 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 5 Feb 2021 11:54:51 +0200 Subject: [PATCH 486/713] [nvim] add functions to workaround some interesting behaviors of vim --- nvim/plugin/editing.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 817f7cc..c042cd2 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -152,6 +152,11 @@ set commentstring=//%s \|xmap # call VisualStarSearch('?')N augroup END + " + command! -nargs=+ Search let @/ = escape(, '/') | normal // + " + command! -nargs=+ SearchLiteral let @/ = '\V'.escape(, '/\') | normal // + " }}} From aed0b5a30eaddf5283b4dd0c5065d86b6795a59b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 5 Feb 2021 11:57:28 +0200 Subject: [PATCH 487/713] [nvim] fix FixWhitespaceOnSave flooding the search history --- nvim/plugin/files.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nvim/plugin/files.vim b/nvim/plugin/files.vim index f07659f..b9266d5 100644 --- a/nvim/plugin/files.vim +++ b/nvim/plugin/files.vim @@ -144,9 +144,9 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" function s:FixWhitespaceOnSave() let l:pos = getpos('.') " remove trailing whitespace - %s/\s\+$//e + keeppatterns %s/\s\+$//e " remove trailing newlines - %s/\($\n\s*\)\+\%$//e + keeppatterns %s/\($\n\s*\)\+\%$//e call setpos('.', l:pos) endfunction " }}} From a27c05856a790e268a323a8be9f317204f38fc4f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 5 Feb 2021 11:13:25 +0200 Subject: [PATCH 488/713] [zsh] add a timestamp printing function --- zsh/functions.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 88edb32..e008988 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -83,6 +83,7 @@ declare -A date_formats=( compact '%Y%m%d%H%M%S' only-date '%Y-%m-%d' only-time '%H:%M:%S' + timestamp '%s' ) for format_name format in "${(kv)date_formats[@]}"; do From 618995cc7f1893648df9d5f38ab49edfed024ca0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 5 Feb 2021 11:54:51 +0200 Subject: [PATCH 489/713] [nvim] add functions to workaround some interesting behaviors of vim --- nvim/plugin/editing.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 817f7cc..c042cd2 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -152,6 +152,11 @@ set commentstring=//%s \|xmap # call VisualStarSearch('?')N augroup END + " + command! -nargs=+ Search let @/ = escape(, '/') | normal // + " + command! -nargs=+ SearchLiteral let @/ = '\V'.escape(, '/\') | normal // + " }}} From da7c44af354bbc3d8233fcbbf2e2ed0d3fe6b714 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 5 Feb 2021 11:57:28 +0200 Subject: [PATCH 490/713] [nvim] fix FixWhitespaceOnSave flooding the search history --- nvim/plugin/files.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nvim/plugin/files.vim b/nvim/plugin/files.vim index f07659f..b9266d5 100644 --- a/nvim/plugin/files.vim +++ b/nvim/plugin/files.vim @@ -144,9 +144,9 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" function s:FixWhitespaceOnSave() let l:pos = getpos('.') " remove trailing whitespace - %s/\s\+$//e + keeppatterns %s/\s\+$//e " remove trailing newlines - %s/\($\n\s*\)\+\%$//e + keeppatterns %s/\($\n\s*\)\+\%$//e call setpos('.', l:pos) endfunction " }}} From 7a3bcc5cc61d91353f75dde5399d8c1859b90d97 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 7 Feb 2021 19:49:38 +0200 Subject: [PATCH 491/713] [zsh] use Python 3 by default on macOS --- zsh/path.zsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zsh/path.zsh b/zsh/path.zsh index 19c4695..16e85bd 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -44,9 +44,11 @@ if (( _is_macos )); then if [[ -d "$formula_path/lib/pkgconfig" ]]; then path_prepend pkg_config_path "$formula_path/lib/pkgconfig" fi - done + done; unset formula - unset formula + # Use Python 3 executables by default, i.e. when a version suffix (`python3`) + # is not specified. + path_prepend path /usr/local/opt/python@3/libexec/bin fi if (( _is_macos )); then From a59a693e98a56e93a9d26855abc40f397da72824 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 7 Feb 2021 19:49:38 +0200 Subject: [PATCH 492/713] [zsh] use Python 3 by default on macOS --- zsh/path.zsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zsh/path.zsh b/zsh/path.zsh index 19c4695..16e85bd 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -44,9 +44,11 @@ if (( _is_macos )); then if [[ -d "$formula_path/lib/pkgconfig" ]]; then path_prepend pkg_config_path "$formula_path/lib/pkgconfig" fi - done + done; unset formula - unset formula + # Use Python 3 executables by default, i.e. when a version suffix (`python3`) + # is not specified. + path_prepend path /usr/local/opt/python@3/libexec/bin fi if (( _is_macos )); then From 207298c6f148bb1e870d4d349acb090b666f7f2b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 8 Feb 2021 20:07:02 +0200 Subject: [PATCH 493/713] [ranger] add ranger config --- ranger/rc.conf | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 ranger/rc.conf diff --git a/ranger/rc.conf b/ranger/rc.conf new file mode 100644 index 0000000..9e4bf36 --- /dev/null +++ b/ranger/rc.conf @@ -0,0 +1,3 @@ +set show_hidden true +set preview_images true +set preview_images_method kitty From 909783441d5fd7991e05b56b1b6e869af3a8ed0a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 8 Feb 2021 20:07:14 +0200 Subject: [PATCH 494/713] [kitty] stop changing TERM to something non-default --- kitty/kitty.conf | 2 -- 1 file changed, 2 deletions(-) diff --git a/kitty/kitty.conf b/kitty/kitty.conf index d06cc3b..714c9eb 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -35,8 +35,6 @@ inactive_tab_font_style none # Miscellaneous {{{ # Tip: on high-DPI screens the `double` style is more discernible url_style single -# To be honest I don't have even a slightest clue as for why I changed the TERM -term xterm-256color # }}} # macOS-specific settings {{{ From 33ed3720c813d9623ceaea2c1c84315746932606 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 8 Feb 2021 20:07:02 +0200 Subject: [PATCH 495/713] [ranger] add ranger config --- ranger/rc.conf | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 ranger/rc.conf diff --git a/ranger/rc.conf b/ranger/rc.conf new file mode 100644 index 0000000..9e4bf36 --- /dev/null +++ b/ranger/rc.conf @@ -0,0 +1,3 @@ +set show_hidden true +set preview_images true +set preview_images_method kitty From b15a03c3f91678242655e17716ff2afc6828d830 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 8 Feb 2021 20:07:14 +0200 Subject: [PATCH 496/713] [kitty] stop changing TERM to something non-default --- kitty/kitty.conf | 2 -- 1 file changed, 2 deletions(-) diff --git a/kitty/kitty.conf b/kitty/kitty.conf index d06cc3b..714c9eb 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -35,8 +35,6 @@ inactive_tab_font_style none # Miscellaneous {{{ # Tip: on high-DPI screens the `double` style is more discernible url_style single -# To be honest I don't have even a slightest clue as for why I changed the TERM -term xterm-256color # }}} # macOS-specific settings {{{ From 1abf65b087ff3c22d932647c426373f172877a17 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 8 Feb 2021 21:51:59 +0200 Subject: [PATCH 497/713] [nvim] properly display wavy underlines under spelling mistakes now that I have enabled all termcap features of kitty --- nvim/colors/dotfiles.vim | 13 +++++++++---- nvim/plugin/interface.vim | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 6ca399f..03ab4e9 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -137,10 +137,15 @@ hi! link ctrlsfMatch Search hi! link ctrlsfLnumMatch ctrlsfMatch - call s:hi('SpellBad', 'bg', '', 'undercurl', 0x8) - call s:hi('SpellLocal', 'bg', '', 'undercurl', 0xC) - call s:hi('SpellCap', 'bg', '', 'undercurl', 0xD) - call s:hi('SpellRare', 'bg', '', 'undercurl', 0xE) + let s:is_kitty = $TERM ==# 'xterm-kitty' + let s:spell_fg = s:is_kitty ? '' : 'bg' + let s:spell_bg = s:is_kitty ? 'NONE' : '' + let s:spell_attr = s:is_kitty ? 'undercurl' : '' + call s:hi('SpellBad', s:spell_fg, s:spell_bg, s:spell_attr, 0x8) + call s:hi('SpellLocal', s:spell_fg, s:spell_bg, s:spell_attr, 0xC) + call s:hi('SpellCap', s:spell_fg, s:spell_bg, s:spell_attr, 0xD) + call s:hi('SpellRare', s:spell_fg, s:spell_bg, s:spell_attr, 0xE) + unlet s:is_kitty s:spell_fg s:spell_bg s:spell_attr call s:hi('Sneak', 'bg', 0xB, 'bold', '') hi! link SneakScope Visual diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 3f2e4e2..03693c7 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -44,9 +44,9 @@ endif let l:cmd = a:cmd if &modified let l:answer = confirm("Save changes?", "&Yes\n&No\n&Cancel") - if l:answer is# 1 " Yes + if l:answer ==# 1 " Yes write - elseif l:answer is# 2 " No + elseif l:answer ==# 2 " No let l:cmd .= '!' else " Cancel/Other return From 851a494eb0b6be7bc6f48f6d6e3c7d358dd53b40 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 8 Feb 2021 21:51:59 +0200 Subject: [PATCH 498/713] [nvim] properly display wavy underlines under spelling mistakes now that I have enabled all termcap features of kitty --- nvim/colors/dotfiles.vim | 13 +++++++++---- nvim/plugin/interface.vim | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 6ca399f..03ab4e9 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -137,10 +137,15 @@ hi! link ctrlsfMatch Search hi! link ctrlsfLnumMatch ctrlsfMatch - call s:hi('SpellBad', 'bg', '', 'undercurl', 0x8) - call s:hi('SpellLocal', 'bg', '', 'undercurl', 0xC) - call s:hi('SpellCap', 'bg', '', 'undercurl', 0xD) - call s:hi('SpellRare', 'bg', '', 'undercurl', 0xE) + let s:is_kitty = $TERM ==# 'xterm-kitty' + let s:spell_fg = s:is_kitty ? '' : 'bg' + let s:spell_bg = s:is_kitty ? 'NONE' : '' + let s:spell_attr = s:is_kitty ? 'undercurl' : '' + call s:hi('SpellBad', s:spell_fg, s:spell_bg, s:spell_attr, 0x8) + call s:hi('SpellLocal', s:spell_fg, s:spell_bg, s:spell_attr, 0xC) + call s:hi('SpellCap', s:spell_fg, s:spell_bg, s:spell_attr, 0xD) + call s:hi('SpellRare', s:spell_fg, s:spell_bg, s:spell_attr, 0xE) + unlet s:is_kitty s:spell_fg s:spell_bg s:spell_attr call s:hi('Sneak', 'bg', 0xB, 'bold', '') hi! link SneakScope Visual diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 3f2e4e2..03693c7 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -44,9 +44,9 @@ endif let l:cmd = a:cmd if &modified let l:answer = confirm("Save changes?", "&Yes\n&No\n&Cancel") - if l:answer is# 1 " Yes + if l:answer ==# 1 " Yes write - elseif l:answer is# 2 " No + elseif l:answer ==# 2 " No let l:cmd .= '!' else " Cancel/Other return From 32cfe4f0d5220ef29cbadad0cc65b9c483c58d31 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 9 Feb 2021 12:29:15 +0200 Subject: [PATCH 499/713] [nvim] disable matchpairs in all other JS-like filetypes --- nvim/after/ftplugin/javascriptreact.vim | 1 + nvim/after/ftplugin/typescript.vim | 1 + nvim/after/ftplugin/typescriptreact.vim | 1 + 3 files changed, 3 insertions(+) create mode 100644 nvim/after/ftplugin/javascriptreact.vim create mode 100644 nvim/after/ftplugin/typescript.vim create mode 100644 nvim/after/ftplugin/typescriptreact.vim diff --git a/nvim/after/ftplugin/javascriptreact.vim b/nvim/after/ftplugin/javascriptreact.vim new file mode 100644 index 0000000..2d9e54a --- /dev/null +++ b/nvim/after/ftplugin/javascriptreact.vim @@ -0,0 +1 @@ +source :h/javascript.vim diff --git a/nvim/after/ftplugin/typescript.vim b/nvim/after/ftplugin/typescript.vim new file mode 100644 index 0000000..2d9e54a --- /dev/null +++ b/nvim/after/ftplugin/typescript.vim @@ -0,0 +1 @@ +source :h/javascript.vim diff --git a/nvim/after/ftplugin/typescriptreact.vim b/nvim/after/ftplugin/typescriptreact.vim new file mode 100644 index 0000000..6a77e28 --- /dev/null +++ b/nvim/after/ftplugin/typescriptreact.vim @@ -0,0 +1 @@ +source :h/typescript.vim From 6bd741c2368af99ddfcf9d74eda95ce0f7b104e6 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 9 Feb 2021 12:29:15 +0200 Subject: [PATCH 500/713] [nvim] disable matchpairs in all other JS-like filetypes --- nvim/after/ftplugin/javascriptreact.vim | 1 + nvim/after/ftplugin/typescript.vim | 1 + nvim/after/ftplugin/typescriptreact.vim | 1 + 3 files changed, 3 insertions(+) create mode 100644 nvim/after/ftplugin/javascriptreact.vim create mode 100644 nvim/after/ftplugin/typescript.vim create mode 100644 nvim/after/ftplugin/typescriptreact.vim diff --git a/nvim/after/ftplugin/javascriptreact.vim b/nvim/after/ftplugin/javascriptreact.vim new file mode 100644 index 0000000..2d9e54a --- /dev/null +++ b/nvim/after/ftplugin/javascriptreact.vim @@ -0,0 +1 @@ +source :h/javascript.vim diff --git a/nvim/after/ftplugin/typescript.vim b/nvim/after/ftplugin/typescript.vim new file mode 100644 index 0000000..2d9e54a --- /dev/null +++ b/nvim/after/ftplugin/typescript.vim @@ -0,0 +1 @@ +source :h/javascript.vim diff --git a/nvim/after/ftplugin/typescriptreact.vim b/nvim/after/ftplugin/typescriptreact.vim new file mode 100644 index 0000000..6a77e28 --- /dev/null +++ b/nvim/after/ftplugin/typescriptreact.vim @@ -0,0 +1 @@ +source :h/typescript.vim From bddaea14dd98032b28abb1ab238dc7684466332a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 12 Feb 2021 10:21:53 +0200 Subject: [PATCH 501/713] [crosscode] add a mod for binding mouse buttons to actions --- crosscode/btw-i-use-arch-mod/prestart.js | 154 +++++++++++++++++++++++ 1 file changed, 154 insertions(+) diff --git a/crosscode/btw-i-use-arch-mod/prestart.js b/crosscode/btw-i-use-arch-mod/prestart.js index bc03b9a..9be33fe 100644 --- a/crosscode/btw-i-use-arch-mod/prestart.js +++ b/crosscode/btw-i-use-arch-mod/prestart.js @@ -5,3 +5,157 @@ sc.OPTIONS_DEFINITION['keys-btw-i-use-arch.open-map-menu'] = { hasDivider: true, header: 'btw-i-use-arch', }; + +ig.KEY.MOUSE_LEFT = ig.KEY.MOUSE1; +ig.KEY.MOUSE_RIGHT = ig.KEY.MOUSE2; +ig.KEY.MOUSE_MIDDLE = -6; +ig.KEY.MOUSE_BACK = -7; +ig.KEY.MOUSE_FORWARD = -8; + +// As for the copied implementations of ig.Input#keydown and ig.Input#keyup: +// there is probably a way to avoid copying, most notably by abusing the logic +// of the keyCode check. See, in both methods it is basically the same, just +// with differing event names, but the logic is as follows: if the event is a +// keyboard event, get the `keyCode` property, otherwise check if +// `event.button` is 2, then assume the key is `ig.KEY.MOUSE2`, otherwise +// `ig.KEY.MOUSE1`. This means that I could replace the value of the `MOUSE1` +// constant to the keyCode determined with my custom logic, and so the fallback +// path will read my value, but ultimately I didn't do that because I figured +// there might be other parts of these functions which can use some +// refactoring. +ig.Input.inject({ + keydown(event) { + if ( + ig.system.crashed || + this.isInIframeAndUnfocused() || + (this.ignoreKeyboard && event.type !== 'mousedown') + ) { + return; + } + + if (ig.system.hasFocusLost()) { + if (event.type === 'mousedown') { + ig.system.regainFocus(); + } + return; + } + + if (event.type === 'mousedown') { + this.mouseGuiActive = true; + } + this.currentDevice = ig.INPUT_DEVICES.KEYBOARD_AND_MOUSE; + + if (event.target.type === 'text') { + return; + } + + let keyCode = this.getKeyCodeFromEvent(event); + + if ( + // It's quite interesting that the game kinda supports touch events, but + // they are never actually used in practice. + event.type === 'touchstart' || + event.type === 'mousedown' + ) { + this.mousemove(event); + } + + let action = this.bindings[keyCode]; + if (action != null) { + this.actions[action] = true; + // Not sure what are locks supposed to do. Oh wait, I figured it out: + // this is so that if a button is detected to be pressed in a frame, but + // if an un-press event is caught during the processing of the frame, the + // button... Hmmm, still not sure. Entirety of the game logic blocks the + // main thread, so it's impossible to catch two events during processing + // of the frame. + if (!this.locks[action]) { + this.presses[action] = true; + this.locks[action] = true; + } + event.stopPropagation(); + event.preventDefault(); + } + }, + + keyup(event) { + if ( + ig.system.crashed || + this.isInIframeAndUnfocused() || + (this.ignoreKeyboard && event.type !== 'mouseup') || + event.target.type === 'text' || + (ig.system.hasFocusLost() && event.type === 'mouseup') + ) { + return; + } + + this.currentDevice = ig.INPUT_DEVICES.KEYBOARD_AND_MOUSE; + + let keyCode = this.getKeyCodeFromEvent(event); + + let action = this.bindings[keyCode]; + if (action != null) { + this.keyups[action] = true; + this.delayedKeyup.push(action); + event.stopPropagation(); + event.preventDefault(); + } + }, + + getKeyCodeFromEvent(event) { + switch (event.type) { + case 'keyup': + case 'keydown': + return event.keyCode; + + case 'mouseup': + case 'mousedown': + switch (event.button) { + case 0: + return ig.KEY.MOUSE_LEFT; + case 1: + return ig.KEY.MOUSE_MIDDLE; + case 2: + return ig.KEY.MOUSE_RIGHT; + case 3: + return ig.KEY.MOUSE_BACK; + case 4: + return ig.KEY.MOUSE_FORWARD; + } + } + + // idk, fall back to the left mouse button. That's kind of what the default + // implementation does though. + return ig.KEY.MOUSE_LEFT; + }, +}); + +// Finally, some nice injection places. +sc.KeyBinderGui.inject({ + show(...args) { + this.parent(...args); + window.addEventListener('mousedown', this.bindedKeyCheck, false); + }, + + hide(...args) { + this.parent(...args); + window.removeEventListener('mousedown', this.bindedKeyCheck); + }, + + onKeyCheck(event) { + event.preventDefault(); + + let keyCode = ig.input.getKeyCodeFromEvent(event); + if (ig.interact.isBlocked() || this._isBlackedListed(keyCode)) return; + + // This call was added by me. Just in case. Because the `stopPropagation` + // call in `ig.Input` saved me from re-binds of left/right mouse buttons to + // whatever else other than interactions with menus. + event.stopPropagation(); + + if (this.finishCallback != null) { + this.finishCallback(keyCode, this.isAlternative, false); + } + this.hide(); + }, +}); From 8a4f6f8a4a3be43090914dba05f764a32587f8b3 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 12 Feb 2021 10:43:39 +0200 Subject: [PATCH 502/713] [nvim] disable ESLint integration for Prettier, sync configs --- nvim/coc-languages/javascript.vim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nvim/coc-languages/javascript.vim b/nvim/coc-languages/javascript.vim index e6b8c5a..98b3f26 100644 --- a/nvim/coc-languages/javascript.vim +++ b/nvim/coc-languages/javascript.vim @@ -5,10 +5,18 @@ let g:coc_user_config['eslint'] = { \ 'filetypes': s:filetypes, \ 'autoFixOnSave': v:true, \ } +" See let g:coc_user_config['prettier'] = { +\ 'printWidth': 100, +\ 'tabWidth': 2, +\ 'useTabs': v:false, +\ 'semi': v:true, \ 'singleQuote': v:true, +\ 'quoteProps': 'as-needed', +\ 'jsxSingleQuote': v:false, \ 'trailingComma': 'all', +\ 'bracketSpacing': v:true, \ 'jsxBracketSameLine': v:true, -\ 'eslintIntegration': v:true, -\ 'disableSuccessMessage': v:true +\ 'arrowParens': 'always', +\ 'disableSuccessMessage': v:true, \ } From 315a95750e19b3afc5cd16ed69d8bd5ef6c97b98 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 12 Feb 2021 10:51:34 +0200 Subject: [PATCH 503/713] [scripts/discord-stream-desktop-audio] allow specifying the audio device --- scripts/discord-stream-desktop-audio | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/discord-stream-desktop-audio b/scripts/discord-stream-desktop-audio index 603e5a4..e80d176 100755 --- a/scripts/discord-stream-desktop-audio +++ b/scripts/discord-stream-desktop-audio @@ -6,6 +6,7 @@ import os guild_id = int(sys.argv[1]) voice_channel_id = int(sys.argv[2]) +pulseaudio_device = sys.argv[3] with open(os.path.expanduser("~/.config/dotfiles/discord-tools-bot-token.txt")) as f: bot_token = f.read().strip() @@ -28,7 +29,7 @@ async def on_ready(): voice_client = await voice_channel.connect() print("connected to {0} ({0.id}) in {1} ({1.id})".format(voice_channel, guild)) - source = discord.FFmpegPCMAudio("default", before_options="-f pulse") + source = discord.FFmpegPCMAudio(pulseaudio_device, before_options="-f pulse") voice_client.play( source, after=lambda e: print("Player error: %s" % e) if e else None ) From 2a0ffb0cf59554bbfa981e17cd91f8507b2c6e0d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 12 Feb 2021 10:21:53 +0200 Subject: [PATCH 504/713] [crosscode] add a mod for binding mouse buttons to actions --- crosscode/btw-i-use-arch-mod/prestart.js | 154 +++++++++++++++++++++++ 1 file changed, 154 insertions(+) diff --git a/crosscode/btw-i-use-arch-mod/prestart.js b/crosscode/btw-i-use-arch-mod/prestart.js index bc03b9a..9be33fe 100644 --- a/crosscode/btw-i-use-arch-mod/prestart.js +++ b/crosscode/btw-i-use-arch-mod/prestart.js @@ -5,3 +5,157 @@ sc.OPTIONS_DEFINITION['keys-btw-i-use-arch.open-map-menu'] = { hasDivider: true, header: 'btw-i-use-arch', }; + +ig.KEY.MOUSE_LEFT = ig.KEY.MOUSE1; +ig.KEY.MOUSE_RIGHT = ig.KEY.MOUSE2; +ig.KEY.MOUSE_MIDDLE = -6; +ig.KEY.MOUSE_BACK = -7; +ig.KEY.MOUSE_FORWARD = -8; + +// As for the copied implementations of ig.Input#keydown and ig.Input#keyup: +// there is probably a way to avoid copying, most notably by abusing the logic +// of the keyCode check. See, in both methods it is basically the same, just +// with differing event names, but the logic is as follows: if the event is a +// keyboard event, get the `keyCode` property, otherwise check if +// `event.button` is 2, then assume the key is `ig.KEY.MOUSE2`, otherwise +// `ig.KEY.MOUSE1`. This means that I could replace the value of the `MOUSE1` +// constant to the keyCode determined with my custom logic, and so the fallback +// path will read my value, but ultimately I didn't do that because I figured +// there might be other parts of these functions which can use some +// refactoring. +ig.Input.inject({ + keydown(event) { + if ( + ig.system.crashed || + this.isInIframeAndUnfocused() || + (this.ignoreKeyboard && event.type !== 'mousedown') + ) { + return; + } + + if (ig.system.hasFocusLost()) { + if (event.type === 'mousedown') { + ig.system.regainFocus(); + } + return; + } + + if (event.type === 'mousedown') { + this.mouseGuiActive = true; + } + this.currentDevice = ig.INPUT_DEVICES.KEYBOARD_AND_MOUSE; + + if (event.target.type === 'text') { + return; + } + + let keyCode = this.getKeyCodeFromEvent(event); + + if ( + // It's quite interesting that the game kinda supports touch events, but + // they are never actually used in practice. + event.type === 'touchstart' || + event.type === 'mousedown' + ) { + this.mousemove(event); + } + + let action = this.bindings[keyCode]; + if (action != null) { + this.actions[action] = true; + // Not sure what are locks supposed to do. Oh wait, I figured it out: + // this is so that if a button is detected to be pressed in a frame, but + // if an un-press event is caught during the processing of the frame, the + // button... Hmmm, still not sure. Entirety of the game logic blocks the + // main thread, so it's impossible to catch two events during processing + // of the frame. + if (!this.locks[action]) { + this.presses[action] = true; + this.locks[action] = true; + } + event.stopPropagation(); + event.preventDefault(); + } + }, + + keyup(event) { + if ( + ig.system.crashed || + this.isInIframeAndUnfocused() || + (this.ignoreKeyboard && event.type !== 'mouseup') || + event.target.type === 'text' || + (ig.system.hasFocusLost() && event.type === 'mouseup') + ) { + return; + } + + this.currentDevice = ig.INPUT_DEVICES.KEYBOARD_AND_MOUSE; + + let keyCode = this.getKeyCodeFromEvent(event); + + let action = this.bindings[keyCode]; + if (action != null) { + this.keyups[action] = true; + this.delayedKeyup.push(action); + event.stopPropagation(); + event.preventDefault(); + } + }, + + getKeyCodeFromEvent(event) { + switch (event.type) { + case 'keyup': + case 'keydown': + return event.keyCode; + + case 'mouseup': + case 'mousedown': + switch (event.button) { + case 0: + return ig.KEY.MOUSE_LEFT; + case 1: + return ig.KEY.MOUSE_MIDDLE; + case 2: + return ig.KEY.MOUSE_RIGHT; + case 3: + return ig.KEY.MOUSE_BACK; + case 4: + return ig.KEY.MOUSE_FORWARD; + } + } + + // idk, fall back to the left mouse button. That's kind of what the default + // implementation does though. + return ig.KEY.MOUSE_LEFT; + }, +}); + +// Finally, some nice injection places. +sc.KeyBinderGui.inject({ + show(...args) { + this.parent(...args); + window.addEventListener('mousedown', this.bindedKeyCheck, false); + }, + + hide(...args) { + this.parent(...args); + window.removeEventListener('mousedown', this.bindedKeyCheck); + }, + + onKeyCheck(event) { + event.preventDefault(); + + let keyCode = ig.input.getKeyCodeFromEvent(event); + if (ig.interact.isBlocked() || this._isBlackedListed(keyCode)) return; + + // This call was added by me. Just in case. Because the `stopPropagation` + // call in `ig.Input` saved me from re-binds of left/right mouse buttons to + // whatever else other than interactions with menus. + event.stopPropagation(); + + if (this.finishCallback != null) { + this.finishCallback(keyCode, this.isAlternative, false); + } + this.hide(); + }, +}); From b0eef7960236b686f6ac562f569402c7caac583b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 12 Feb 2021 10:43:39 +0200 Subject: [PATCH 505/713] [nvim] disable ESLint integration for Prettier, sync configs --- nvim/coc-languages/javascript.vim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nvim/coc-languages/javascript.vim b/nvim/coc-languages/javascript.vim index e6b8c5a..98b3f26 100644 --- a/nvim/coc-languages/javascript.vim +++ b/nvim/coc-languages/javascript.vim @@ -5,10 +5,18 @@ let g:coc_user_config['eslint'] = { \ 'filetypes': s:filetypes, \ 'autoFixOnSave': v:true, \ } +" See let g:coc_user_config['prettier'] = { +\ 'printWidth': 100, +\ 'tabWidth': 2, +\ 'useTabs': v:false, +\ 'semi': v:true, \ 'singleQuote': v:true, +\ 'quoteProps': 'as-needed', +\ 'jsxSingleQuote': v:false, \ 'trailingComma': 'all', +\ 'bracketSpacing': v:true, \ 'jsxBracketSameLine': v:true, -\ 'eslintIntegration': v:true, -\ 'disableSuccessMessage': v:true +\ 'arrowParens': 'always', +\ 'disableSuccessMessage': v:true, \ } From 6fc06191a5dbd93b90bc84b496d6df49323a7cfc Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 12 Feb 2021 10:51:34 +0200 Subject: [PATCH 506/713] [scripts/discord-stream-desktop-audio] allow specifying the audio device --- scripts/discord-stream-desktop-audio | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/discord-stream-desktop-audio b/scripts/discord-stream-desktop-audio index dd82faa..0161def 100755 --- a/scripts/discord-stream-desktop-audio +++ b/scripts/discord-stream-desktop-audio @@ -6,6 +6,7 @@ import os guild_id = int(sys.argv[1]) voice_channel_id = int(sys.argv[2]) +pulseaudio_device = sys.argv[3] with open(os.path.expanduser("~/.config/dotfiles/discord-tools-user-token.txt")) as f: bot_token = f.read().strip() @@ -28,7 +29,7 @@ async def on_ready(): voice_client = await voice_channel.connect() print("connected to {0} ({0.id}) in {1} ({1.id})".format(voice_channel, guild)) - source = discord.FFmpegPCMAudio("default", before_options="-f pulse") + source = discord.FFmpegPCMAudio(pulseaudio_device, before_options="-f pulse") voice_client.play( source, after=lambda e: print("Player error: %s" % e) if e else None ) From 3f40b413f36227dc3ee08bff4f0b2ce6d6c9197d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 12 Feb 2021 15:27:03 +0200 Subject: [PATCH 507/713] [x11] add my xprofile --- x11/xprofile.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 x11/xprofile.sh diff --git a/x11/xprofile.sh b/x11/xprofile.sh new file mode 100755 index 0000000..eddbe8f --- /dev/null +++ b/x11/xprofile.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +export XDG_MENU_PREFIX=lxde- +export MOZ_USE_XINPUT2=1 +export QT_QPA_PLATFORMTHEME=qt5ct From 9555e5f7068ee579f723080bc43d9a7abd665c20 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 12 Feb 2021 15:27:03 +0200 Subject: [PATCH 508/713] [x11] add my xprofile --- x11/xprofile.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 x11/xprofile.sh diff --git a/x11/xprofile.sh b/x11/xprofile.sh new file mode 100755 index 0000000..eddbe8f --- /dev/null +++ b/x11/xprofile.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +export XDG_MENU_PREFIX=lxde- +export MOZ_USE_XINPUT2=1 +export QT_QPA_PLATFORMTHEME=qt5ct From 4ad73c71542c0e923919ae60545926c5218b11ef Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 12 Feb 2021 21:00:01 +0200 Subject: [PATCH 509/713] [zsh] improve path.zsh loading speed by not calling the entire rustc The effects of this were very significant on my good ol' winchester. --- zsh/path.zsh | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/zsh/path.zsh b/zsh/path.zsh index 16e85bd..d6a9bda 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -68,17 +68,32 @@ export GOPATH=~/go path_prepend path "$GOPATH/bin" # Rust -path_prepend path ~/.cargo/bin -# check if the Rust toolchain was installed via rustup -if rustup_home="$(rustup show home 2> /dev/null)" && - rust_sysroot="$(rustc --print sysroot 2> /dev/null)" && - [[ -d "$rustup_home" && -d "$rust_sysroot" && "$rust_sysroot" == "$rustup_home"/* ]] -then - # add paths of the selected Rust toolchain - path_prepend fpath "$rust_sysroot/share/zsh/site-functions" - path_prepend manpath "$rust_sysroot/share/man" +if [[ -f ~/.rustup/settings.toml ]]; then + # Make a low-effort attempt at quickly extracting the selected Rust toolchain + # from rustup's settings. The TOML file is obviously assumed to be well-formed + # and syntactically correct because virtually always it's manipulated with the + # use of rustup's CLI. Also a shortcut is taken: strings aren't unescaped + # because Rust toolchain names don't need escaping in strings. + # See also . + if rust_toolchain="$( + awk ' + match($0, /^default_toolchain = "(.+)"$/, matches) { + print matches[1]; + exit; + } + /^\[.+\]$/ { + exit; + } + ' ~/.rustup/settings.toml + )" && [[ -n "$rust_toolchain" ]]; then + rust_sysroot=~/.rustup/toolchains/"$rust_toolchain" + path_prepend path "$rust_sysroot"/bin + path_prepend fpath "$rust_sysroot"/zsh/site-functions + path_prepend manpath "$rust_sysroot"/share/man + fi + unset rust_toolchain rust_sysroot fi -unset rustup_home rust_sysroot +path_prepend path ~/.cargo/bin # add my binaries and completions path_prepend path "${ZSH_DOTFILES:h}/scripts" From 27f9b351c1266210caf6fc4d951c2a52ba3ccd87 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 13 Feb 2021 16:39:18 +0200 Subject: [PATCH 510/713] [zsh] export libs from the installed Rust toolchain as well --- zsh/path.zsh | 18 +++++++++++++++--- zsh/zshrc | 8 -------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/zsh/path.zsh b/zsh/path.zsh index d6a9bda..303370e 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -1,9 +1,11 @@ #!/usr/bin/env zsh -# tie these env variables to zsh arrays -typeset -T PKG_CONFIG_PATH pkg_config_path ':' +export PATH +export MANPATH -export PKG_CONFIG_PATH PATH MANPATH +# tie these env variables to zsh arrays +export -T PKG_CONFIG_PATH pkg_config_path ':' +export -T LD_LIBRARY_PATH ld_library_path ':' path_prepend() { if (( $# < 1 )); then @@ -90,6 +92,7 @@ if [[ -f ~/.rustup/settings.toml ]]; then path_prepend path "$rust_sysroot"/bin path_prepend fpath "$rust_sysroot"/zsh/site-functions path_prepend manpath "$rust_sysroot"/share/man + path_prepend ld_library_path "$rust_sysroot"/lib fi unset rust_toolchain rust_sysroot fi @@ -103,3 +106,12 @@ path_prepend fpath "$ZSH_DOTFILES/completions" path_prepend path ~/.local/bin unfunction path_prepend + +# For some reason manpath is not always set when logging with ssh for instance. +# Let's ensure that it is always set and exported. The additional colon ensures +# that the system manpath isn't overwritten (see manpath(1)). +if [[ -n "$MANPATH" && "$MANPATH" != *: ]]; then + # Append a colon if MANPATH isn't empty and doesn't end with a colon already + MANPATH="$MANPATH:" +fi +export MANPATH="$MANPATH" diff --git a/zsh/zshrc b/zsh/zshrc index 3513103..ea8cb05 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -46,14 +46,6 @@ _perf_timer_start "total" fi # }}} -# For some reason manpath is not always set when logging with ssh for instance. -# Let's ensure that it is always set and exported. The additional colon ensures -# that the system manpath isn't overwritten (see manpath(1)), though in reality -# two colons get added for some reason, which is also valid, but means -# something slightly different (again, see manpath(1)). Hope this won't cause -# any problems in the future. -export MANPATH="$MANPATH:" - for script in functions options path env plugins aliases completion zle prompt colorscheme; do _perf_timer_start "$script.zsh" source "$ZSH_DOTFILES/$script.zsh" From 412015d3749fb35c09f26f0a3f8d65d92d9a58ac Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 13 Feb 2021 17:31:01 +0200 Subject: [PATCH 511/713] [zsh] parse rustup settings with a zsh script instead to further improve performance --- zsh/path.zsh | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/zsh/path.zsh b/zsh/path.zsh index 303370e..fff9b36 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -77,25 +77,28 @@ if [[ -f ~/.rustup/settings.toml ]]; then # use of rustup's CLI. Also a shortcut is taken: strings aren't unescaped # because Rust toolchain names don't need escaping in strings. # See also . - if rust_toolchain="$( - awk ' - match($0, /^default_toolchain = "(.+)"$/, matches) { - print matches[1]; - exit; - } - /^\[.+\]$/ { - exit; - } - ' ~/.rustup/settings.toml - )" && [[ -n "$rust_toolchain" ]]; then + rust_toolchain="" + < ~/.rustup/settings.toml while IFS= read -r line; do + if [[ "$line" =~ '^default_toolchain = "(.+)"$' ]]; then + rust_toolchain="${match[1]}" + break + elif [[ "$line" == \[*\] ]]; then + break + fi + done; unset line + + if [[ -n "$rust_toolchain" ]]; then rust_sysroot=~/.rustup/toolchains/"$rust_toolchain" path_prepend path "$rust_sysroot"/bin path_prepend fpath "$rust_sysroot"/zsh/site-functions path_prepend manpath "$rust_sysroot"/share/man path_prepend ld_library_path "$rust_sysroot"/lib + unset rust_sysroot fi - unset rust_toolchain rust_sysroot + + unset rust_toolchain fi + path_prepend path ~/.cargo/bin # add my binaries and completions From 789d9caefd9e372ff9b54c7e93888d37394e9fad Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 13 Feb 2021 17:51:25 +0200 Subject: [PATCH 512/713] [zsh] parse ~/.ssh/config with a zsh script instead of awk as well --- zsh/completion.zsh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/zsh/completion.zsh b/zsh/completion.zsh index 5ae1e87..faa7748 100644 --- a/zsh/completion.zsh +++ b/zsh/completion.zsh @@ -40,9 +40,12 @@ zstyle ':completion:*:processes' force-list always _completion_get_hosts() { print localhost - if [[ -f ~/.ssh/config ]]; then - awk "match(\$0, /^Host[[:blank:]]*/) { print substr(\$0, RLENGTH+1); }" ~/.ssh/config - fi + local line + < ~/.ssh/config while IFS= read -r line; do + if [[ "$line" =~ '^Host[[:blank:]]+(.*)[[:blank:]]*' ]]; then + print -- "${match[1]}" + fi + done } zstyle -e ':completion:*:hosts' hosts 'reply=("${(@f)$(_completion_get_hosts)}")' From faa946c7ccb18d576111b5a4ed89019c15ed9898 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 14 Feb 2021 02:09:05 +0200 Subject: [PATCH 513/713] [zsh] implement update-grub for Arch systems --- zsh/aliases.zsh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index c5227a4..e75e872 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -74,7 +74,12 @@ alias du='du -h' alias df='df -h' alias free='free -h' -alias apt-get="echo -e \"use 'apt' instead of 'apt-get'\nif you really want to use 'apt-get', type '"'\\\\'"apt-get'\" #" +if command_exists apt && command_exists apt-get; then + apt_get_message="use 'apt' instead of 'apt-get' +if you really want to use 'apt-get', type '\\apt-get'" + alias apt-get="echo -E ${(qqq)apt_get_message} #" + unset apt_get_message +fi # editor alias edit="$EDITOR" @@ -97,3 +102,9 @@ alias bin-list-dylib-symbols='nm -gD' # Duplicated as an alias to prevent autocorrection of the real "command" part. # See also scripts/prime-run alias prime-run='__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia ' + +if ! command_exists update-grub; then + # Doesn't exist on Arch by default. Probably implementing this command was + # left as a challenge to the documentation reader. + alias update-grub="grub-mkconfig -o /boot/grub/grub.cfg" +fi From a06b1043762ba3346cd05ead542a177d5c53f3b0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 15 Feb 2021 16:22:36 +0200 Subject: [PATCH 514/713] [nvim] update the mappings for fugitive --- nvim/plugin/git.vim | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/nvim/plugin/git.vim b/nvim/plugin/git.vim index 66ca1dd..901d487 100644 --- a/nvim/plugin/git.vim +++ b/nvim/plugin/git.vim @@ -2,11 +2,12 @@ let g:gitgutter_map_keys = 0 nnoremap gg :G nnoremap g :Git - nnoremap gs :vertical Gstatus - nnoremap gd :Gdiff - nnoremap gb :Gblame - nnoremap gw :Gbrowse + nnoremap gs :vertical Git + nnoremap gd :Gdiffsplit + nnoremap gb :Git blame + nnoremap gw :GBrowse + nnoremap gW :.GBrowse nnoremap gc :Gcommit % - nnoremap gl :Glog - nnoremap gp :Gpush + nnoremap gl :Gclog + nnoremap gp :Git push " }}} From f9051aff76bdf2c3e9a0ebd862db6b7d48df2ca7 Mon Sep 17 00:00:00 2001 From: Keanu Date: Fri, 19 Feb 2021 21:47:22 +0100 Subject: [PATCH 515/713] Why was this on `rebase` again? --- .github/pull.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull.yml b/.github/pull.yml index a1afdb1..08de30a 100644 --- a/.github/pull.yml +++ b/.github/pull.yml @@ -2,5 +2,5 @@ version: '1' rules: - base: master upstream: dmitmel:master - mergeMethod: rebase + mergeMethod: merge mergeUnstable: true From 0ce30126c059280c7ad42c507d0be34b52368547 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 20 Feb 2021 13:45:57 +0200 Subject: [PATCH 516/713] [nvim] apparently :Gcommit has also been deprecated? --- nvim/plugin/git.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/plugin/git.vim b/nvim/plugin/git.vim index 901d487..c986e7b 100644 --- a/nvim/plugin/git.vim +++ b/nvim/plugin/git.vim @@ -7,7 +7,7 @@ nnoremap gb :Git blame nnoremap gw :GBrowse nnoremap gW :.GBrowse - nnoremap gc :Gcommit % + nnoremap gc :Git commit % nnoremap gl :Gclog nnoremap gp :Git push " }}} From a5f7bd35655f421b65138c7ef70ad54a107a8c38 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 20 Feb 2021 13:46:11 +0200 Subject: [PATCH 517/713] [nvim] add a plugin for highlighting CSS colors --- nvim/dotfiles/plugins-list.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index 80028a8..17e70ff 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -63,5 +63,6 @@ if g:vim_ide Plug 'neoclide/coc.nvim', { 'branch': 'release' } Plug 'dag/vim2hs' + Plug 'norcalli/nvim-colorizer.lua' endif " }}} From d597858ccee6a70a10b850da583f9fd58861de71 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 20 Feb 2021 13:46:27 +0200 Subject: [PATCH 518/713] [zsh] stop adding the 'bin' directory of Rustup toolchains to the PATH, this broke per-directory overrides because those rely on toolchain executables being symlinked to the rustup exe itself --- zsh/path.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/path.zsh b/zsh/path.zsh index fff9b36..02da266 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -89,7 +89,7 @@ if [[ -f ~/.rustup/settings.toml ]]; then if [[ -n "$rust_toolchain" ]]; then rust_sysroot=~/.rustup/toolchains/"$rust_toolchain" - path_prepend path "$rust_sysroot"/bin + # path_append path "$rust_sysroot"/bin path_prepend fpath "$rust_sysroot"/zsh/site-functions path_prepend manpath "$rust_sysroot"/share/man path_prepend ld_library_path "$rust_sysroot"/lib From a7d57f2fd81dfc26fb094d1036d23719ccc81332 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 22 Feb 2021 11:16:11 +0200 Subject: [PATCH 519/713] [nvim] very specific fix of highlighting with termguicolors enabled --- nvim/colors/dotfiles.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 03ab4e9..3083041 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -50,7 +50,7 @@ call s:hi('Italic', 0xE, '', 'italic', '') call s:hi('Bold', 0xA, '', 'bold', '') call s:hi('Underlined', 0x8, '', 'underline', '') - call s:hi('Title', 0xD, '', '', '') + call s:hi('Title', 0xD, '', 'NONE', '') hi! link Directory Title call s:hi('Conceal', 0xC, 'NONE', '', '') call s:hi('NonText', 0x3, '', '', '') From 8d525337fc46997fe2a3894158a5b85b4b1a01d8 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 27 Feb 2021 14:38:31 +0200 Subject: [PATCH 520/713] [nvim] add mappings for quick horizontal scrolling --- nvim/plugin/editing.vim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index c042cd2..ec77a41 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -119,6 +119,22 @@ set commentstring=//%s xnoremap dg :diffget xnoremap dp :diffput + " Horizontal scroll + " normal mode + nnoremap zh + nnoremap zH + nnoremap zh + nnoremap zl + nnoremap zL + nnoremap zl + " visual mode + xnoremap zh + xnoremap zH + xnoremap zh + xnoremap zl + xnoremap zL + xnoremap zl + " }}} From 97d8246877c2dbafdd1441b86263051143ac9ca5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Mar 2021 20:56:44 +0000 Subject: [PATCH 521/713] Bump prismjs from 1.21.0 to 1.23.0 in /script-resources/markdown2htmldoc Bumps [prismjs](https://github.com/PrismJS/prism) from 1.21.0 to 1.23.0. - [Release notes](https://github.com/PrismJS/prism/releases) - [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md) - [Commits](https://github.com/PrismJS/prism/compare/v1.21.0...v1.23.0) Signed-off-by: dependabot[bot] --- script-resources/markdown2htmldoc/package.json | 2 +- script-resources/markdown2htmldoc/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/script-resources/markdown2htmldoc/package.json b/script-resources/markdown2htmldoc/package.json index cc1dae8..9bdddea 100644 --- a/script-resources/markdown2htmldoc/package.json +++ b/script-resources/markdown2htmldoc/package.json @@ -7,7 +7,7 @@ "markdown-it": "*", "markdown-it-emoji": "*", "markdown-it-task-checkbox": "*", - "prismjs": "^1.21.0" + "prismjs": "^1.23.0" }, "devDependencies": { "eslint": "*", diff --git a/script-resources/markdown2htmldoc/yarn.lock b/script-resources/markdown2htmldoc/yarn.lock index ecb8902..7da943a 100644 --- a/script-resources/markdown2htmldoc/yarn.lock +++ b/script-resources/markdown2htmldoc/yarn.lock @@ -708,10 +708,10 @@ prettier@*: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.1.tgz#d9485dd5e499daa6cb547023b87a6cf51bee37d6" integrity sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw== -prismjs@^1.21.0: - version "1.21.0" - resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.21.0.tgz#36c086ec36b45319ec4218ee164c110f9fc015a3" - integrity sha512-uGdSIu1nk3kej2iZsLyDoJ7e9bnPzIgY0naW/HdknGj61zScaprVEVGHrPoXqI+M9sP0NDnTK2jpkvmldpuqDw== +prismjs@^1.23.0: + version "1.23.0" + resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.23.0.tgz#d3b3967f7d72440690497652a9d40ff046067f33" + integrity sha512-c29LVsqOaLbBHuIbsTxaKENh1N2EQBOHaWv7gkHN4dgRbxSREqDnDbtFJYdpPauS4YCplMSNCABQ6Eeor69bAA== optionalDependencies: clipboard "^2.0.0" From b467ed4d63f496a1d59f70215e2f2b961dce7994 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 5 Mar 2021 14:59:33 +0200 Subject: [PATCH 522/713] [nvim] switch from coc-python to coc-pyright --- nvim/coc-languages/python.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nvim/coc-languages/python.vim b/nvim/coc-languages/python.vim index 25d9663..ff6cd12 100644 --- a/nvim/coc-languages/python.vim +++ b/nvim/coc-languages/python.vim @@ -1,8 +1,8 @@ -let g:coc_global_extensions += ['coc-python'] +let g:coc_global_extensions += ['coc-pyright'] let g:coc_filetypes += ['python'] -let g:coc_user_config['pyls.plugins.pycodestyle.ignore'] = ['E501'] +" let g:coc_user_config['pyls.plugins.pycodestyle.ignore'] = ['E501'] +" let g:coc_user_config['python.autocomplete.showAdvancedMembers'] = v:false let g:coc_user_config['python'] = { -\ 'autocomplete': { 'showAdvancedMembers': v:false }, \ 'formatting': { 'provider': 'black' }, \ 'linting': { \ 'pylintEnabled': v:false, From aecef017f9202178c37e8cad24d0bad5ca8713f5 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 7 Mar 2021 13:06:14 +0200 Subject: [PATCH 523/713] [zsh] inline the fasd plugin from OMZ and remove the useless one called 'extract' --- zsh/plugins.zsh | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index edba661..f207b1c 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -49,7 +49,7 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" # Oh My Zsh {{{ omz_features=(key-bindings termsupport) - omz_plugins=(git extract fasd) + omz_plugins=(git) _plugin ohmyzsh 'ohmyzsh/ohmyzsh' \ load='lib/'${^omz_features}'.zsh' \ @@ -64,22 +64,35 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" # fasd {{{ -unalias j -j() { - local _fasd_ret - _fasd_ret="$( - # -l: list all paths in the database (without scores) - # -d: list only directories - # -R: in the reverse order - fasd -l -d -R | - fzf --height=40% --layout=reverse --tiebreak=index --query="$*" - )" - if [[ -d "$_fasd_ret" ]]; then - cd -- "$_fasd_ret" - elif [[ -n "$_fasd_ret" ]]; then - print -- "$_fasd_ret" + if command_exists fasd; then + # Initialization taken from + fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache" + if [[ "${commands[fasd]}" -nt "$fasd_cache" || ! -s "$fasd_cache" ]]; then + fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >| "$fasd_cache" + fi + source "$fasd_cache" + unset fasd_cache + + alias v='f -e "$EDITOR"' + alias o='a -e xdg-open' + + # alias j='zz' + j() { + local _fasd_ret + _fasd_ret="$( + # -l: list all paths in the database (without scores) + # -d: list only directories + # -R: in the reverse order + fasd -l -d -R | + fzf --height=40% --layout=reverse --tiebreak=index --query="$*" + )" + if [[ -d "$_fasd_ret" ]]; then + cd -- "$_fasd_ret" + elif [[ -n "$_fasd_ret" ]]; then + print -- "$_fasd_ret" + fi + } fi -} # }}} From b60438f49b85f2d4325b5e4963eedc0c0700c372 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 7 Mar 2021 14:59:48 +0200 Subject: [PATCH 524/713] [zsh] add library paths of all installed Rust toolchains --- zsh/path.zsh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/zsh/path.zsh b/zsh/path.zsh index 02da266..47fdf6d 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -70,7 +70,8 @@ export GOPATH=~/go path_prepend path "$GOPATH/bin" # Rust -if [[ -f ~/.rustup/settings.toml ]]; then +rustup_home="${RUSTUP_HOME:-$HOME/.rustup}" +if [[ -f "$rustup_home"/settings.toml ]]; then # Make a low-effort attempt at quickly extracting the selected Rust toolchain # from rustup's settings. The TOML file is obviously assumed to be well-formed # and syntactically correct because virtually always it's manipulated with the @@ -78,7 +79,7 @@ if [[ -f ~/.rustup/settings.toml ]]; then # because Rust toolchain names don't need escaping in strings. # See also . rust_toolchain="" - < ~/.rustup/settings.toml while IFS= read -r line; do + < "$rustup_home"/settings.toml while IFS= read -r line; do if [[ "$line" =~ '^default_toolchain = "(.+)"$' ]]; then rust_toolchain="${match[1]}" break @@ -88,16 +89,20 @@ if [[ -f ~/.rustup/settings.toml ]]; then done; unset line if [[ -n "$rust_toolchain" ]]; then - rust_sysroot=~/.rustup/toolchains/"$rust_toolchain" + rust_sysroot="$rustup_home"/toolchains/"$rust_toolchain" # path_append path "$rust_sysroot"/bin path_prepend fpath "$rust_sysroot"/zsh/site-functions path_prepend manpath "$rust_sysroot"/share/man - path_prepend ld_library_path "$rust_sysroot"/lib - unset rust_sysroot fi - unset rust_toolchain + for rust_sysroot in "$rustup_home"/toolchains/*(/); do + # The filenames of all libraries in toolchain dirs are suffixed with their + # build hashes or the compiler identifier, so in practice conflicts are + # insanely unlikely. + path_prepend ld_library_path "$rust_sysroot"/lib + done fi +unset rustup_home rust_toolchain rust_sysroot path_prepend path ~/.cargo/bin From 0a3c9b74240aad5e41494c47b24a7f5df045c454 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 7 Mar 2021 15:24:42 +0200 Subject: [PATCH 525/713] [nvim] add an indentation block motion --- nvim/autoload/dotfiles/indent_motion.vim | 63 ++++++++++++++++++++++++ nvim/autoload/dotfiles/utils.vim | 6 +++ nvim/plugin/dotfiles/indent_motion.vim | 9 ++++ 3 files changed, 78 insertions(+) create mode 100644 nvim/autoload/dotfiles/indent_motion.vim create mode 100644 nvim/autoload/dotfiles/utils.vim create mode 100644 nvim/plugin/dotfiles/indent_motion.vim diff --git a/nvim/autoload/dotfiles/indent_motion.vim b/nvim/autoload/dotfiles/indent_motion.vim new file mode 100644 index 0000000..31b51f4 --- /dev/null +++ b/nvim/autoload/dotfiles/indent_motion.vim @@ -0,0 +1,63 @@ +" Based on +" A motion for moving over enclosing indentation blocks. Primarily intended +" for reverse-engineering CrossCode. + +function dotfiles#indent_motion#run(direction) + let l:cursor_linenr = line(".") + let l:max_linenr = line("$") + + let l:retry = 0 + while l:retry <# 2 + let l:retry += 1 + + let l:base_linenr = l:cursor_linenr + let l:base_indent = 0 + while 1 <=# l:base_linenr && l:base_linenr <=# l:max_linenr + let l:base_indent = dotfiles#indent_motion#indent_level_of(l:base_linenr) + if l:base_indent >=# 0 + break + endif + let l:base_linenr += a:direction + endwhile + + let l:target_linenr = l:base_linenr + + let l:curr_linenr = l:base_linenr + a:direction + let l:prev_indent = l:base_indent + while 1 <=# l:curr_linenr && l:curr_linenr <=# l:max_linenr + let l:indent = dotfiles#indent_motion#indent_level_of(l:curr_linenr) + + if l:indent >=# 0 + if l:indent <# l:base_indent + break + else + let l:target_linenr = l:curr_linenr + endif + elseif l:base_indent ==# 0 && l:prev_indent ==# 0 + break + endif + + let l:prev_indent = l:indent + let l:curr_linenr += a:direction + endwhile + + if l:target_linenr ==# l:cursor_linenr + let l:cursor_linenr += a:direction + if 1 <=# l:cursor_linenr && l:cursor_linenr <=# l:max_linenr + continue + endif + endif + + break + endwhile + + execute "normal! " . l:target_linenr . "G^" +endfunction + +" +function dotfiles#indent_motion#indent_level_of(linenr) "{{{2 + if getline(a:linenr) ==# "" + return -1 + endif + return indent(a:linenr) +endfunction diff --git a/nvim/autoload/dotfiles/utils.vim b/nvim/autoload/dotfiles/utils.vim new file mode 100644 index 0000000..d3cd2b2 --- /dev/null +++ b/nvim/autoload/dotfiles/utils.vim @@ -0,0 +1,6 @@ +function dotfiles#utils#array_remove_element(array, element) + let l:index = index(a:array, a:element) + if l:index >= 0 + call remove(a:array, l:index) + endif +endfunction diff --git a/nvim/plugin/dotfiles/indent_motion.vim b/nvim/plugin/dotfiles/indent_motion.vim new file mode 100644 index 0000000..32c4525 --- /dev/null +++ b/nvim/plugin/dotfiles/indent_motion.vim @@ -0,0 +1,9 @@ +for [s:plug_mapping, s:direction, s:user_mapping] in [["prev", -1, "("], ["next", 1, ")"]] + let s:plug_mapping = "dotfiles_indent_motion_".s:plug_mapping + for s:mode in ["n", "v", "o"] + execute s:mode."noremap" "" s:plug_mapping "call dotfiles#indent_motion#run(".s:direction.")" + if !empty(s:user_mapping) + execute s:mode."map" s:user_mapping s:plug_mapping + endif + endfor +endfor From dfb049f52ff546af2d46edb821c30883b439e3d8 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 12 Mar 2021 13:28:08 +0200 Subject: [PATCH 526/713] [nvim] add a quick keymap switcher --- nvim/autoload/dotfiles/indent_motion.vim | 2 +- nvim/plugin/editing.vim | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/nvim/autoload/dotfiles/indent_motion.vim b/nvim/autoload/dotfiles/indent_motion.vim index 31b51f4..780d351 100644 --- a/nvim/autoload/dotfiles/indent_motion.vim +++ b/nvim/autoload/dotfiles/indent_motion.vim @@ -55,7 +55,7 @@ function dotfiles#indent_motion#run(direction) endfunction " -function dotfiles#indent_motion#indent_level_of(linenr) "{{{2 +function dotfiles#indent_motion#indent_level_of(linenr) if getline(a:linenr) ==# "" return -1 endif diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index ec77a41..3fb2af5 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -106,10 +106,6 @@ set commentstring=//%s nnoremap nnoremap - nnoremap kk set keymap& - nnoremap kr set keymap=russian-jcuken-custom - nnoremap ku set keymap=ukrainian-jcuken-custom - nnoremap Q " normal mode @@ -138,6 +134,19 @@ set commentstring=//%s " }}} +" Keymap switcher {{{ + + nnoremap kk set keymap& + nnoremap kr set keymap=russian-jcuken-custom + nnoremap ku set keymap=ukrainian-jcuken-custom + + nnoremap DotfilesSwapKeymaps + let g:dotfiles_prev_keymap = &keymap + command! -nargs=0 DotfilesSwapKeymaps let [g:dotfiles_prev_keymap, &keymap] = [&keymap, g:dotfiles_prev_keymap] + +" }}} + + " Search {{{ " ignore case if the pattern doesn't contain uppercase characters (use '\C' From 7177de926abdfc5599c6beacae6b982f2f4d4fb5 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 12 Mar 2021 13:39:16 +0200 Subject: [PATCH 527/713] [nvim] fix ranger on Android --- nvim/plugin/files.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nvim/plugin/files.vim b/nvim/plugin/files.vim index b9266d5..8b3d347 100644 --- a/nvim/plugin/files.vim +++ b/nvim/plugin/files.vim @@ -36,6 +36,10 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" " Ranger {{{ let g:ranger_replace_netrw = 1 let g:ranger_map_keys = 0 + " The default path (/tmp/chosenfile) is inaccessible at least on + " Android/Termux, so the tempname() function was chosen because it respects + " $TMPDIR. + let g:ranger_choice_file = tempname() nnoremap o Ranger " ranger.vim relies on the Bclose.vim plugin, but I use Bbye.vim, so this " command is here just for compatitabilty From 81d185be53bf31dce6ba4fbd5337807651e37fe9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Mar 2021 20:56:44 +0000 Subject: [PATCH 528/713] Bump prismjs from 1.21.0 to 1.23.0 in /script-resources/markdown2htmldoc Bumps [prismjs](https://github.com/PrismJS/prism) from 1.21.0 to 1.23.0. - [Release notes](https://github.com/PrismJS/prism/releases) - [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md) - [Commits](https://github.com/PrismJS/prism/compare/v1.21.0...v1.23.0) Signed-off-by: dependabot[bot] --- script-resources/markdown2htmldoc/package.json | 2 +- script-resources/markdown2htmldoc/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/script-resources/markdown2htmldoc/package.json b/script-resources/markdown2htmldoc/package.json index cc1dae8..9bdddea 100644 --- a/script-resources/markdown2htmldoc/package.json +++ b/script-resources/markdown2htmldoc/package.json @@ -7,7 +7,7 @@ "markdown-it": "*", "markdown-it-emoji": "*", "markdown-it-task-checkbox": "*", - "prismjs": "^1.21.0" + "prismjs": "^1.23.0" }, "devDependencies": { "eslint": "*", diff --git a/script-resources/markdown2htmldoc/yarn.lock b/script-resources/markdown2htmldoc/yarn.lock index ecb8902..7da943a 100644 --- a/script-resources/markdown2htmldoc/yarn.lock +++ b/script-resources/markdown2htmldoc/yarn.lock @@ -708,10 +708,10 @@ prettier@*: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.1.tgz#d9485dd5e499daa6cb547023b87a6cf51bee37d6" integrity sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw== -prismjs@^1.21.0: - version "1.21.0" - resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.21.0.tgz#36c086ec36b45319ec4218ee164c110f9fc015a3" - integrity sha512-uGdSIu1nk3kej2iZsLyDoJ7e9bnPzIgY0naW/HdknGj61zScaprVEVGHrPoXqI+M9sP0NDnTK2jpkvmldpuqDw== +prismjs@^1.23.0: + version "1.23.0" + resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.23.0.tgz#d3b3967f7d72440690497652a9d40ff046067f33" + integrity sha512-c29LVsqOaLbBHuIbsTxaKENh1N2EQBOHaWv7gkHN4dgRbxSREqDnDbtFJYdpPauS4YCplMSNCABQ6Eeor69bAA== optionalDependencies: clipboard "^2.0.0" From 65777555555253421d2ab120582590a69e21062c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 5 Mar 2021 14:59:33 +0200 Subject: [PATCH 529/713] [nvim] switch from coc-python to coc-pyright --- nvim/coc-languages/python.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nvim/coc-languages/python.vim b/nvim/coc-languages/python.vim index 25d9663..ff6cd12 100644 --- a/nvim/coc-languages/python.vim +++ b/nvim/coc-languages/python.vim @@ -1,8 +1,8 @@ -let g:coc_global_extensions += ['coc-python'] +let g:coc_global_extensions += ['coc-pyright'] let g:coc_filetypes += ['python'] -let g:coc_user_config['pyls.plugins.pycodestyle.ignore'] = ['E501'] +" let g:coc_user_config['pyls.plugins.pycodestyle.ignore'] = ['E501'] +" let g:coc_user_config['python.autocomplete.showAdvancedMembers'] = v:false let g:coc_user_config['python'] = { -\ 'autocomplete': { 'showAdvancedMembers': v:false }, \ 'formatting': { 'provider': 'black' }, \ 'linting': { \ 'pylintEnabled': v:false, From 35b1e9446e608656a578819544f59a000c1115ea Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 17 Mar 2021 19:56:07 +0200 Subject: [PATCH 530/713] [nvim] add a binding for my favorite git feature --- nvim/plugin/git.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/plugin/git.vim b/nvim/plugin/git.vim index c986e7b..cb154da 100644 --- a/nvim/plugin/git.vim +++ b/nvim/plugin/git.vim @@ -8,6 +8,7 @@ nnoremap gw :GBrowse nnoremap gW :.GBrowse nnoremap gc :Git commit % + nnoremap gC :Git commit --amend nnoremap gl :Gclog nnoremap gp :Git push " }}} From 173bf5851e9c97262d3643ea44104063b5db55fc Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 18 Mar 2021 20:25:15 +0200 Subject: [PATCH 531/713] [scripts] rewrite Python scripts to not use the requests module --- scripts/copy-crosscode-emoji-url | 7 +++---- scripts/discord-whois | 29 ++++++++++++++++++----------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index 2e22b6c..520b8e1 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -3,9 +3,9 @@ import sys import os from configparser import ConfigParser -import requests import json import urllib.parse +import urllib.request sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resources")) @@ -48,9 +48,8 @@ def emote_downloader_and_iterator(): with open(registry_dump_file, "r") as f: emote_registry_data = json.load(f) except FileNotFoundError: - response = requests.get(registry_dump_url, timeout=10) - response.raise_for_status() - emote_registry_data = response.json() + with urllib.request.urlopen(registry_dump_url, timeout=10) as response: + emote_registry_data = json.load(response) assert emote_registry_data["version"] == 1 diff --git a/scripts/discord-whois b/scripts/discord-whois index 4dd5ca5..91fd346 100755 --- a/scripts/discord-whois +++ b/scripts/discord-whois @@ -6,10 +6,13 @@ import sys import os -import requests +import urllib.request +import urllib.error import colorama import time import argparse +import json +import typing DISCORD_EPOCH = 1420070400000 # milliseconds @@ -52,19 +55,23 @@ if not (image_size is None or (image_size > 0 and image_size & (image_size - 1)) parser.error("image_size must be greater than zero and a power of two") -# no timeout here, sadly, due to this genius: -response = requests.get( - "https://discordapp.com/api/users/{}".format(user_snowflake), - headers={"Authorization": "Bot {}".format(bot_token)}, - timeout=3, -) try: - response.raise_for_status() -except requests.HTTPError as err: - print(response.json(), file=sys.stderr) + opener = urllib.request.build_opener() + # Don't send the User-Agent header, Discord blocks the default one + opener.addheaders = [] + with opener.open( + urllib.request.Request( + "http://discord.com/api/users/{}".format(user_snowflake), + headers={"Authorization": "Bot {}".format(bot_token)}, + ), + timeout=10, + ) as response: + raw_data = json.load(response) +except urllib.error.HTTPError as err: + print(err, file=sys.stderr) + print(err.read(), file=sys.stderr) raise err -raw_data = response.json() data = {} data["ID"] = raw_data["id"] From a848343e94b20cb20d5febac248df3a5991395e4 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 20 Mar 2021 02:03:40 +0200 Subject: [PATCH 532/713] [zsh] add the new Rubygems location to PATH --- zsh/path.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/path.zsh b/zsh/path.zsh index 47fdf6d..110644a 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -61,6 +61,7 @@ fi # Ruby gems path_prepend path ~/.gem/ruby/*/bin(N/) +path_prepend path ~/.local/share/gem/ruby/*/bin(N/) # Yarn global packages path_prepend path ~/.yarn/bin From 42b4c58377557b44a274ada93bfcbe83a61c210c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 20 Mar 2021 02:30:53 +0200 Subject: [PATCH 533/713] [crosscode] add a fallback manifest for the mod --- crosscode/btw-i-use-arch-mod/ccmod.json | 1 - crosscode/btw-i-use-arch-mod/package.json | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 crosscode/btw-i-use-arch-mod/package.json diff --git a/crosscode/btw-i-use-arch-mod/ccmod.json b/crosscode/btw-i-use-arch-mod/ccmod.json index de31768..b6c3fd8 100644 --- a/crosscode/btw-i-use-arch-mod/ccmod.json +++ b/crosscode/btw-i-use-arch-mod/ccmod.json @@ -1,7 +1,6 @@ { "id": "btw-i-use-arch", "title": "btw I use Arch", - "version": "0.0.0", "description": "A mod for masochists like myself", "prestart": "prestart.js", "poststart": "poststart.js" diff --git a/crosscode/btw-i-use-arch-mod/package.json b/crosscode/btw-i-use-arch-mod/package.json new file mode 100644 index 0000000..e6d5b2e --- /dev/null +++ b/crosscode/btw-i-use-arch-mod/package.json @@ -0,0 +1,8 @@ +{ + "name": "btw-i-use-arch", + "ccmodHumanName": "btw I use Arch", + "description": "A mod for masochists like myself", + "prestart": "prestart.js", + "main": "poststart.js", + "module": true +} From d129ba75632f846237b70bb254802ce08fa7c579 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 20 Mar 2021 23:14:48 +0200 Subject: [PATCH 534/713] [nvim] make the U mapping respect vim-repeat --- nvim/plugin/editing.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 3fb2af5..a05f20f 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -95,7 +95,7 @@ set commentstring=//%s " make the default Vim mappings more consistent " https://www.reddit.com/r/vim/comments/dgbr9l/mappings_i_would_change_for_more_consistent_vim/ - nnoremap U + nmap U nnoremap Y y$ " is treated as in terminals, so the original function of From e4c2a870150e196fbb9bc2c9b55cb276f277d633 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 21 Mar 2021 12:17:57 +0200 Subject: [PATCH 535/713] [zsh] install fasd if it's not present, also change the database path --- zsh/plugins.zsh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index f207b1c..322707d 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -64,7 +64,16 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" # fasd {{{ + if ! command_exists fasd; then + _plugin fasd 'clvv/fasd' \ + build='mkdir -pv man1 && cp -v ./fasd.1 man1/' + after_load='plugin-cfg-path path prepend ""' \ + after_load='plugin-cfg-path manpath prepend ""' + fi + if command_exists fasd; then + export _FASD_DATA="${XDG_DATA_HOME:-$HOME/.local/share}/fasd_db.csv" + # Initialization taken from fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache" if [[ "${commands[fasd]}" -nt "$fasd_cache" || ! -s "$fasd_cache" ]]; then From f24c8e5131795fa7ebefc6e98a394e7260dedfc1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 21 Mar 2021 15:13:42 +0200 Subject: [PATCH 536/713] [nvim] add nvim-treesitter (READ COMMIT NOTES) The thing is currently unstable, requires the nightly branch of neovim, and the highlighting groups need a lot of tweaking (obviously, :HLT doesn't work, making this even harder). I just put the configuration into the repo in case I need it in the future. --- nvim/dotfiles/plugins-list.vim | 3 +++ nvim/dotfiles/treesitter.vim | 11 +++++++++++ nvim/init.vim | 5 ++++- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 nvim/dotfiles/treesitter.vim diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index 17e70ff..3fa3e77 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -64,5 +64,8 @@ Plug 'neoclide/coc.nvim', { 'branch': 'release' } Plug 'dag/vim2hs' Plug 'norcalli/nvim-colorizer.lua' + if g:vim_ide_treesitter + Plug 'nvim-treesitter/nvim-treesitter', { 'do': ':TSUpdate' } + endif endif " }}} diff --git a/nvim/dotfiles/treesitter.vim b/nvim/dotfiles/treesitter.vim new file mode 100644 index 0000000..3c0e5e8 --- /dev/null +++ b/nvim/dotfiles/treesitter.vim @@ -0,0 +1,11 @@ +lua <:p:h') let g:vim_ide = get(g:, 'vim_ide', 0) +let g:vim_ide_treesitter = get(g:, 'vim_ide_treesitter', 0) let &runtimepath = g:nvim_dotfiles_dir.','.&runtimepath.','.g:nvim_dotfiles_dir.'/after' @@ -19,6 +20,9 @@ call plug#begin(s:vim_plug_home) Plug 'junegunn/vim-plug' runtime! dotfiles/plugins-list.vim call plug#end() +if g:vim_ide_treesitter + runtime! dotfiles/treesitter.vim +endif " Automatically install/clean plugins (because I'm a programmer) {{{ augroup vimrc-plugins @@ -30,5 +34,4 @@ call plug#end() augroup END " }}} - colorscheme dotfiles From e93033fd6940d5ca87d0482192a350f687efc456 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 25 Mar 2021 01:41:24 +0200 Subject: [PATCH 537/713] [nvim] disable the custom folding algorithm for Haskell --- nvim/after/ftplugin/haskell.vim | 3 +++ nvim/after/syntax/cabal.vim | 2 ++ nvim/after/syntax/cabalconfig.vim | 2 ++ nvim/after/syntax/nginx.vim | 4 ++-- 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 nvim/after/ftplugin/haskell.vim create mode 100644 nvim/after/syntax/cabal.vim create mode 100644 nvim/after/syntax/cabalconfig.vim diff --git a/nvim/after/ftplugin/haskell.vim b/nvim/after/ftplugin/haskell.vim new file mode 100644 index 0000000..bdabaed --- /dev/null +++ b/nvim/after/ftplugin/haskell.vim @@ -0,0 +1,3 @@ +let g:haskall_test = 1 +setlocal foldmethod< +setlocal foldtext< diff --git a/nvim/after/syntax/cabal.vim b/nvim/after/syntax/cabal.vim new file mode 100644 index 0000000..8ced55f --- /dev/null +++ b/nvim/after/syntax/cabal.vim @@ -0,0 +1,2 @@ +setlocal foldmethod< +setlocal foldtext< diff --git a/nvim/after/syntax/cabalconfig.vim b/nvim/after/syntax/cabalconfig.vim new file mode 100644 index 0000000..8ced55f --- /dev/null +++ b/nvim/after/syntax/cabalconfig.vim @@ -0,0 +1,2 @@ +setlocal foldmethod< +setlocal foldtext< diff --git a/nvim/after/syntax/nginx.vim b/nvim/after/syntax/nginx.vim index fb06acc..1e4e3af 100644 --- a/nvim/after/syntax/nginx.vim +++ b/nvim/after/syntax/nginx.vim @@ -4,5 +4,5 @@ " sourced in `syntax/nginx.vim` in vim-polyglot, which resets the `commentstring` " set in `ftplugin/nginx.vim` and sets `comments` to some garbage. This script " undoes that damage. -let &l:comments = &g:comments -let &l:commentstring = '#%s' +setlocal comments< +setlocal commentstring=#%s From 6a12867ee05c692585dc41cb83ab4fb647171df5 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 25 Mar 2021 23:13:25 +0200 Subject: [PATCH 538/713] fixup! [nvim] fix syntax syncing for JS/TS after a vim-polyglot update (this made opening crosscode/assets/js/game.compiled.js insanely slow) --- nvim/after/ftplugin/css.vim | 1 + nvim/after/ftplugin/scss.vim | 1 + 2 files changed, 2 insertions(+) create mode 100644 nvim/after/ftplugin/css.vim create mode 100644 nvim/after/ftplugin/scss.vim diff --git a/nvim/after/ftplugin/css.vim b/nvim/after/ftplugin/css.vim new file mode 100644 index 0000000..df4fe48 --- /dev/null +++ b/nvim/after/ftplugin/css.vim @@ -0,0 +1 @@ +setlocal iskeyword+=- diff --git a/nvim/after/ftplugin/scss.vim b/nvim/after/ftplugin/scss.vim new file mode 100644 index 0000000..94b3fea --- /dev/null +++ b/nvim/after/ftplugin/scss.vim @@ -0,0 +1 @@ +source :h/css.vim From 570307f0bc90e3fffef8ba49425a94b8a811856e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 26 Mar 2021 01:11:05 +0200 Subject: [PATCH 539/713] [nvim] fix highlighting of CSS pseudo-classes --- nvim/colors/dotfiles.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 3083041..ae217af 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -262,7 +262,8 @@ " CSS {{{ hi! link cssBraces Delimiter hi! link cssTagName htmlTagName - hi! link cssPseudoClassId Special + hi! link cssPseudoClassId Type + hi! link cssPseudoClass cssPseudoClassId hi! link cssClassName Type hi! link cssClassNameDot cssClassName hi! link cssAtRule Keyword From 4b0865b150e265db76aabf10e63af7740833562e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 26 Mar 2021 01:11:48 +0200 Subject: [PATCH 540/713] [scripts/pycalc] add a simple as a rock quadratic equation solver --- script-resources/pycalc_startup.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/script-resources/pycalc_startup.py b/script-resources/pycalc_startup.py index 7f97f03..6aab338 100644 --- a/script-resources/pycalc_startup.py +++ b/script-resources/pycalc_startup.py @@ -11,4 +11,21 @@ def factors(n): return result +def solve_quadratic(a, b, c): + if a == 0: + raise Exception("not a quadratic equation") + else: + d = b ** 2 - 4 * a * c + print("D = " + str(d)) + if d < 0: + print("no solutions") + elif d > 0: + sd = sqrt(d) + print("sqrt(D) = " + str(sd)) + print("x1 = " + str((-b + sd) / (2 * a))) + print("x2 = " + str((-b - sd) / (2 * a))) + else: + print("x = " + str(-b / (2 * a))) + + print("loaded Python calculator") From e2d21d085c38b71f0187889c6273a78a89064f40 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 26 Mar 2021 01:15:15 +0200 Subject: [PATCH 541/713] [nvim] fix highlighting of class names in SCSS --- nvim/colors/dotfiles.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index ae217af..a042dd5 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -275,6 +275,12 @@ hi! link cssAttrRegion cssAttr " }}} +" SCSS {{{ + hi! link scssSelectorName cssClassName + hi! link scssSelectorChar cssClassnameDot + hi! link scssAmpersand cssSelectorOp +" }}} + " JavaScript {{{ hi! link javaScriptBraces Delimiter hi! link jsParens Delimiter From 7d7a4b106b4359c5564fe6572dbb4892d7bdcbd9 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 26 Mar 2021 22:29:08 +0200 Subject: [PATCH 542/713] [scripts/playerctl-simple-menu] sort players which are currently playing something higher --- scripts/playerctl-simple-menu | 40 ++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/scripts/playerctl-simple-menu b/scripts/playerctl-simple-menu index 30307f4..3072017 100755 --- a/scripts/playerctl-simple-menu +++ b/scripts/playerctl-simple-menu @@ -31,6 +31,12 @@ PLAYER_ICON_NAME_FIXES = { "chrome": "google-chrome", } +PLAYER_PLAYBACK_STATUS_EMOJIS = { + Playerctl.PlaybackStatus.PLAYING: "\u25B6", + Playerctl.PlaybackStatus.PAUSED: "\u23F8", + Playerctl.PlaybackStatus.STOPPED: "\u23F9", +} + def humanize_duration(duration): minutes, seconds = divmod(math.floor(duration), 60) @@ -163,19 +169,37 @@ def iter_actions_for_player(player): root_menu = Gtk.Menu() -player_names = sorted( - Playerctl.list_players(), - key=lambda player_name: ( - -PLAYER_NAME_PRIORITIES.get(player_name.name, 0), - player_name.instance, - ), -) +player_names = Playerctl.list_players() if len(player_names) > 0: + players = [] for player_name in player_names: player = Playerctl.Player.new_from_name(player_name) + players.append( + { + "player": player, + "player_name": player_name, + "sorting_key": ( + player.props.playback_status != Playerctl.PlaybackStatus.PLAYING, + -PLAYER_NAME_PRIORITIES.get(player_name.name, 0), + player_name.instance, + ), + } + ) + players = sorted( + players, key=lambda player_and_meta: player_and_meta["sorting_key"] + ) - player_menu_item = Gtk.ImageMenuItem.new_with_label(player_name.instance) + for player_and_meta in players: + player_name = player_and_meta["player_name"] + player = player_and_meta["player"] + + player_menu_item = Gtk.ImageMenuItem.new_with_label( + "{} [{}]".format( + player_name.instance, + PLAYER_PLAYBACK_STATUS_EMOJIS[player.props.playback_status], + ) + ) player_icon_name = PLAYER_ICON_NAME_FIXES.get( player_name.name, player_name.name From f9127d6ce28ef03ab25dc277f0a8e8d58ef097ed Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 27 Mar 2021 13:11:44 +0200 Subject: [PATCH 543/713] [git] remove the "unstage" alias in favor of "grst" in zsh --- git/gitconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/git/gitconfig b/git/gitconfig index fb45607..ca5da55 100644 --- a/git/gitconfig +++ b/git/gitconfig @@ -21,7 +21,6 @@ whitespace = red reverse [alias] - unstage = restore --staged initial-commit = commit --message 'initial commit' --allow-empty [init] From 3d34200ac6b0781832723726aa8a1066acec4283 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 30 Mar 2021 01:22:56 +0300 Subject: [PATCH 544/713] [nvim] apparently usage of l: inside functions is entirely optional --- nvim/autoload/airline/themes/dotfiles.vim | 6 +-- nvim/autoload/dotfiles/indent_motion.vim | 54 +++++++++++------------ nvim/autoload/dotfiles/utils.vim | 6 +-- nvim/colors/dotfiles.vim | 18 ++++---- nvim/plugin/editing.vim | 4 +- nvim/plugin/files.vim | 26 +++++------ nvim/plugin/interface.vim | 32 +++++++------- 7 files changed, 73 insertions(+), 73 deletions(-) diff --git a/nvim/autoload/airline/themes/dotfiles.vim b/nvim/autoload/airline/themes/dotfiles.vim index 374b6a3..0f7805f 100644 --- a/nvim/autoload/airline/themes/dotfiles.vim +++ b/nvim/autoload/airline/themes/dotfiles.vim @@ -10,9 +10,9 @@ let s:palette = { let s:colors = g:dotfiles_colorscheme_base16_colors function! s:base16_color(fg, bg) - let l:fg = s:colors[a:fg] - let l:bg = s:colors[a:bg] - return [l:fg.gui, l:bg.gui, l:fg.cterm, l:bg.cterm] + let fg = s:colors[a:fg] + let bg = s:colors[a:bg] + return [fg.gui, bg.gui, fg.cterm, bg.cterm] endfunction let s:section_a = s:base16_color(0x1, 0xB) diff --git a/nvim/autoload/dotfiles/indent_motion.vim b/nvim/autoload/dotfiles/indent_motion.vim index 780d351..1d58e8c 100644 --- a/nvim/autoload/dotfiles/indent_motion.vim +++ b/nvim/autoload/dotfiles/indent_motion.vim @@ -2,48 +2,48 @@ " A motion for moving over enclosing indentation blocks. Primarily intended " for reverse-engineering CrossCode. -function dotfiles#indent_motion#run(direction) - let l:cursor_linenr = line(".") - let l:max_linenr = line("$") +function dotfiles#indent_motion#run(direction) abort + let cursor_linenr = line(".") + let max_linenr = line("$") - let l:retry = 0 - while l:retry <# 2 - let l:retry += 1 + let retry = 0 + while retry <# 2 + let retry += 1 - let l:base_linenr = l:cursor_linenr - let l:base_indent = 0 - while 1 <=# l:base_linenr && l:base_linenr <=# l:max_linenr - let l:base_indent = dotfiles#indent_motion#indent_level_of(l:base_linenr) - if l:base_indent >=# 0 + let base_linenr = cursor_linenr + let base_indent = 0 + while 1 <=# base_linenr && base_linenr <=# max_linenr + let base_indent = dotfiles#indent_motion#indent_level_of(base_linenr) + if base_indent >=# 0 break endif - let l:base_linenr += a:direction + let base_linenr += a:direction endwhile - let l:target_linenr = l:base_linenr + let target_linenr = base_linenr - let l:curr_linenr = l:base_linenr + a:direction - let l:prev_indent = l:base_indent - while 1 <=# l:curr_linenr && l:curr_linenr <=# l:max_linenr - let l:indent = dotfiles#indent_motion#indent_level_of(l:curr_linenr) + let curr_linenr = base_linenr + a:direction + let prev_indent = base_indent + while 1 <=# curr_linenr && curr_linenr <=# max_linenr + let indent = dotfiles#indent_motion#indent_level_of(curr_linenr) - if l:indent >=# 0 - if l:indent <# l:base_indent + if indent >=# 0 + if indent <# base_indent break else - let l:target_linenr = l:curr_linenr + let target_linenr = curr_linenr endif - elseif l:base_indent ==# 0 && l:prev_indent ==# 0 + elseif base_indent ==# 0 && prev_indent ==# 0 break endif - let l:prev_indent = l:indent - let l:curr_linenr += a:direction + let prev_indent = indent + let curr_linenr += a:direction endwhile - if l:target_linenr ==# l:cursor_linenr - let l:cursor_linenr += a:direction - if 1 <=# l:cursor_linenr && l:cursor_linenr <=# l:max_linenr + if target_linenr ==# cursor_linenr + let cursor_linenr += a:direction + if 1 <=# cursor_linenr && cursor_linenr <=# max_linenr continue endif endif @@ -51,7 +51,7 @@ function dotfiles#indent_motion#run(direction) break endwhile - execute "normal! " . l:target_linenr . "G^" + execute "normal! " . target_linenr . "G^" endfunction " diff --git a/nvim/autoload/dotfiles/utils.vim b/nvim/autoload/dotfiles/utils.vim index d3cd2b2..adf58cc 100644 --- a/nvim/autoload/dotfiles/utils.vim +++ b/nvim/autoload/dotfiles/utils.vim @@ -1,6 +1,6 @@ function dotfiles#utils#array_remove_element(array, element) - let l:index = index(a:array, a:element) - if l:index >= 0 - call remove(a:array, l:index) + let index = index(a:array, a:element) + if index >= 0 + call remove(a:array, index) endif endfunction diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index a042dd5..6398166 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -24,23 +24,23 @@ let s:colors = g:dotfiles_colorscheme_base16_colors function s:hi(group, fg, bg, attr, guisp) - let l:args = '' + let args = '' if a:fg isnot '' - let l:fg = s:is_number(a:fg) ? s:colors[a:fg] : {'gui': a:fg, 'cterm': a:fg} - let l:args .= ' guifg=' . l:fg.gui . ' ctermfg=' . l:fg.cterm + let fg = s:is_number(a:fg) ? s:colors[a:fg] : {'gui': a:fg, 'cterm': a:fg} + let args .= ' guifg=' . fg.gui . ' ctermfg=' . fg.cterm endif if a:bg isnot '' - let l:bg = s:is_number(a:bg) ? s:colors[a:bg] : {'gui': a:bg, 'cterm': a:bg} - let l:args .= ' guibg=' . l:bg.gui . ' ctermbg=' . l:bg.cterm + let bg = s:is_number(a:bg) ? s:colors[a:bg] : {'gui': a:bg, 'cterm': a:bg} + let args .= ' guibg=' . bg.gui . ' ctermbg=' . bg.cterm endif if a:attr isnot '' - let l:args .= ' gui=' . a:attr . ' cterm=' . a:attr + let args .= ' gui=' . a:attr . ' cterm=' . a:attr endif if a:guisp isnot '' - let l:guisp = s:is_number(a:guisp) ? s:colors[a:guisp].gui : a:guisp - let l:args .= ' guisp=' . l:guisp + let guisp = s:is_number(a:guisp) ? s:colors[a:guisp].gui : a:guisp + let args .= ' guisp=' . guisp endif - exec 'hi' a:group l:args + exec 'hi' a:group args endfunction " }}} diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index a05f20f..fc11f3a 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -163,10 +163,10 @@ set commentstring=//%s " * and # in the Visual mode will search the selected text function! s:VisualStarSearch(search_cmd) - let l:tmp = @" + let tmp = @" normal! y let @/ = '\V' . substitute(escape(@", a:search_cmd . '\'), '\n', '\\n', 'g') - let @" = l:tmp + let @" = tmp endfunction " HACK: my mappings are added on VimEnter to override mappings from the " vim-indexed-search plugin diff --git a/nvim/plugin/files.vim b/nvim/plugin/files.vim index 8b3d347..14fa58f 100644 --- a/nvim/plugin/files.vim +++ b/nvim/plugin/files.vim @@ -52,12 +52,12 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" " DiffWithSaved {{{ " Compare current buffer with the actual (saved) file on disk function s:DiffWithSaved() - let l:filetype = &filetype + let filetype = &filetype diffthis vnew | read # | normal! ggdd diffthis setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile readonly nomodifiable - let &filetype = l:filetype + let &filetype = filetype endfunction command DiffWithSaved call s:DiffWithSaved() " }}} @@ -100,9 +100,9 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" " argument list, so it doesn't play well with Obsession.vim because it " saves the argument list in the session file. function s:EditGlob(...) - for l:glob in a:000 - for l:name in glob(l:glob, 0, 1) - execute 'edit' fnameescape(l:name) + for glob in a:000 + for name in glob(glob, 0, 1) + execute 'edit' fnameescape(name) endfor endfor endfunction @@ -135,31 +135,31 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" " create directory {{{ " Creates the parent directory of the file if it doesn't exist function s:CreateDirOnSave() - let l:file = expand('') + let file = expand('') " check if this is a regular file and its path is not a URL - if empty(&buftype) && !s:IsUrl(l:file) - let l:dir = fnamemodify(l:file, ':h') - if !isdirectory(l:dir) | call mkdir(l:dir, 'p') | endif + if empty(&buftype) && !s:IsUrl(file) + let dir = fnamemodify(file, ':h') + if !isdirectory(dir) | call mkdir(dir, 'p') | endif endif endfunction " }}} " fix whitespace {{{ function s:FixWhitespaceOnSave() - let l:pos = getpos('.') + let pos = getpos('.') " remove trailing whitespace keeppatterns %s/\s\+$//e " remove trailing newlines keeppatterns %s/\($\n\s*\)\+\%$//e - call setpos('.', l:pos) + call setpos('.', pos) endfunction " }}} " auto-format with Coc.nvim {{{ let g:coc_format_on_save_ignore = [] function s:FormatOnSave() - let l:file = expand('') - if IsCocEnabled() && !s:IsUrl(l:file) && index(g:coc_format_on_save_ignore, &filetype) < 0 + let file = expand('') + if IsCocEnabled() && !s:IsUrl(file) && index(g:coc_format_on_save_ignore, &filetype) < 0 silent CocFormat endif endfunction diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 03693c7..194922d 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -41,18 +41,18 @@ endif " Bbye with confirmation, or fancy buffer closer {{{ function s:CloseBuffer(cmd) abort - let l:cmd = a:cmd + let cmd = a:cmd if &modified - let l:answer = confirm("Save changes?", "&Yes\n&No\n&Cancel") - if l:answer ==# 1 " Yes + let answer = confirm("Save changes?", "&Yes\n&No\n&Cancel") + if answer ==# 1 " Yes write - elseif l:answer ==# 2 " No - let l:cmd .= '!' + elseif answer ==# 2 " No + let cmd .= '!' else " Cancel/Other return endif endif - execute l:cmd + execute cmd endfunction " }}} @@ -108,19 +108,19 @@ endif let g:airline#extensions#tabline#left_alt_sep = '' function StatusLine_filesize() - let l:bytes = getfsize(expand('%')) - if l:bytes < 0 | return '' | endif + let bytes = getfsize(expand('%')) + if bytes < 0 | return '' | endif - let l:factor = 1 - for l:unit in ['B', 'K', 'M', 'G'] - let l:next_factor = l:factor * 1024 - if l:bytes < l:next_factor - let l:number_str = printf('%.2f', (l:bytes * 1.0) / l:factor) + let factor = 1 + for unit in ['B', 'K', 'M', 'G'] + let next_factor = factor * 1024 + if bytes < next_factor + let number_str = printf('%.2f', (bytes * 1.0) / factor) " remove trailing zeros - let l:number_str = substitute(l:number_str, '\v\.?0+$', '', '') - return l:number_str . l:unit + let number_str = substitute(number_str, '\v\.?0+$', '', '') + return number_str . unit endif - let l:factor = l:next_factor + let factor = next_factor endfor endfunction call airline#parts#define('filesize', { 'function': 'StatusLine_filesize' }) From 5ebbadb45d8fa31fde887a63f2b258c2989326e6 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 30 Mar 2021 15:15:33 +0300 Subject: [PATCH 545/713] [zsh] carefully rewrite all prints to not produce escape sequences --- install.zsh | 4 ++-- zsh/aliases.zsh | 2 +- zsh/completion.zsh | 4 ++-- zsh/functions.zsh | 10 +++++----- zsh/path.zsh | 2 +- zsh/plugins.zsh | 4 ++-- zsh/prompt.zsh | 4 ++-- zsh/zle.zsh | 8 ++++---- zsh/zplg.zsh | 4 ++-- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/install.zsh b/install.zsh index 7968da3..f816480 100755 --- a/install.zsh +++ b/install.zsh @@ -11,8 +11,8 @@ install_dotfile() { fi mkdir -pv "${dest:h}" - echo "installing dotfile '$dest'" - echo "$contents" > "$dest" + print -r -- "installing dotfile '$dest'" + print -r -- "$contents" > "$dest" } # ZSH diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index e75e872..c82c197 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -77,7 +77,7 @@ alias free='free -h' if command_exists apt && command_exists apt-get; then apt_get_message="use 'apt' instead of 'apt-get' if you really want to use 'apt-get', type '\\apt-get'" - alias apt-get="echo -E ${(qqq)apt_get_message} #" + alias apt-get="print -r -- ${(qqq)apt_get_message} #" unset apt_get_message fi diff --git a/zsh/completion.zsh b/zsh/completion.zsh index faa7748..b9fcf35 100644 --- a/zsh/completion.zsh +++ b/zsh/completion.zsh @@ -39,11 +39,11 @@ zstyle ':completion:*:processes-names' command "ps xho comm=" zstyle ':completion:*:processes' force-list always _completion_get_hosts() { - print localhost + print -r -- localhost local line < ~/.ssh/config while IFS= read -r line; do if [[ "$line" =~ '^Host[[:blank:]]+(.*)[[:blank:]]*' ]]; then - print -- "${match[1]}" + print -r -- "${match[1]}" fi done } diff --git a/zsh/functions.zsh b/zsh/functions.zsh index e008988..f7775a7 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -1,6 +1,6 @@ #!/usr/bin/env zsh -count() { echo "$#"; } +count() { print -r -- "$#"; } bytecount() { wc -c "$@" | numfmt --to=iec-i; } @@ -39,7 +39,7 @@ if (( ! _is_macos )); then elif command_exists xdg-open; then open_cmd='nohup xdg-open &> /dev/null' else - open_cmd='print >&2 "open: Platform $OSTYPE is not supported"; return 1' + open_cmd='print >&2 -r -- "open: Platform $OSTYPE is not supported"; return 1' fi eval "open(){local f; for f in \"\$@\"; do $open_cmd \"\$f\"; done;}" unset open_cmd @@ -55,8 +55,8 @@ elif command_exists termux-clipboard-set && command_exists termux-clipboard-get; copy_cmd='termux-clipboard-set' paste_cmd='termux-clipboard-get' else error_msg='Platform $OSTYPE is not supported' - copy_cmd='print >&2 "clipcopy: '"$error_msg"'"; return 1' - paste_cmd='print >&2 "clippaste: '"$error_msg"'"; return 1' + copy_cmd='print >&2 -r -- "clipcopy: '"$error_msg"'"; return 1' + paste_cmd='print >&2 -r -- "clippaste: '"$error_msg"'"; return 1' unset error_msg fi eval "clipcopy() { $copy_cmd; }; clippaste() { $paste_cmd; }" @@ -74,7 +74,7 @@ git_current_branch() { command git symbolic-ref --quiet HEAD 2> /dev/null || command git rev-parse --short HEAD 2> /dev/null )" || return - echo "${ref#refs/heads/}" + print -r -- "${ref#refs/heads/}" } declare -A date_formats=( diff --git a/zsh/path.zsh b/zsh/path.zsh index 110644a..be0077b 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -9,7 +9,7 @@ export -T LD_LIBRARY_PATH ld_library_path ':' path_prepend() { if (( $# < 1 )); then - print >&2 "usage: $0 " + print >&2 -r -- "usage: $0 " return 1 fi local var_name="$1"; shift diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index 322707d..df70f1d 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -34,7 +34,7 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" done; unset match if (( $run_compdump )); then - echo "$0: rebuilding zsh completion dump" + print -r -- "$0: rebuilding zsh completion dump" # -D flag turns off compdump loading compinit -D compdump @@ -98,7 +98,7 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" if [[ -d "$_fasd_ret" ]]; then cd -- "$_fasd_ret" elif [[ -n "$_fasd_ret" ]]; then - print -- "$_fasd_ret" + print -r -- "$_fasd_ret" fi } fi diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index aa79b0e..a47c2dc 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -3,7 +3,7 @@ # Escapes `%` in all arguments by replacing it with `%%`. Escaping is needed so # that untrusted input (e.g. git branch names) doesn't affect prompt rendering. prompt_escape() { - print -n "${@//\%/%%}" + print -rn -- "${@//\%/%%}" } prompt_preexec_hook() { @@ -51,7 +51,7 @@ prompt_vcs_info() { fi done - print -n ' %F{blue}git:%F{magenta}'"$(prompt_escape "$branch")"'%f' + print -rn -- ' %F{blue}git:%F{magenta}'"$(prompt_escape "$branch")"'%f' } # configure prompt expansion diff --git a/zsh/zle.zsh b/zsh/zle.zsh index fd96c33..2d0ee56 100644 --- a/zsh/zle.zsh +++ b/zsh/zle.zsh @@ -60,9 +60,9 @@ _palette_widget() { # download "TLDR pages" if we don't have them if [[ ! -d "$PALETTE_TLDR_PAGES_DIR" ]]; then - echo + print -r _palette_download_tldr_pages - echo + print -r fi # try to fill in a placeholder if there're any, otherwise pick a snippet @@ -118,12 +118,12 @@ # This function downloads the "TLDR pages" _palette_download_tldr_pages() { mkdir -pv "$PALETTE_TLDR_PAGES_DIR" - echo "Downloading tldr pages..." + print -r -- "Downloading tldr pages..." if curl -Lf https://github.com/tldr-pages/tldr/archive/master.tar.gz | tar -C "$PALETTE_TLDR_PAGES_DIR" --gzip --strip-components 2 --extract tldr-master/pages then - echo "Done!" + print -r -- "Done!" fi } diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh index f6a16bf..f087602 100644 --- a/zsh/zplg.zsh +++ b/zsh/zplg.zsh @@ -51,7 +51,7 @@ _ZPLG_PLUGINS_DIR="$ZPLG_HOME/plugins" # basic logging {{{ _zplg_log() { - print >&2 "${fg_bold[blue]}[zplg]${reset_color} $@" + print >&2 -r -- "${fg_bold[blue]}[zplg]${reset_color} $@" } _zplg_debug() { @@ -455,7 +455,7 @@ _zplg_is_plugin_loaded() { # Prints IDs of all loaded plugins. zplg-list() { # (F) modifier joins an array with newlines - print "${(F)ZPLG_LOADED_PLUGINS}" + print -r -- "${(F)ZPLG_LOADED_PLUGINS}" } # Upgrades all plugins if no arguments are given, otherwise upgrades plugins by From a90b41a8cc7b0014145fe30c6acb3aadd3347295 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 2 Apr 2021 21:50:17 +0300 Subject: [PATCH 546/713] fix "module not found" errors when importing Python code from script-resources --- pyrightconfig.json | 8 ++++++++ scripts/copy-crosscode-emoji-url | 3 +-- scripts/query-bookmarks | 3 +-- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 pyrightconfig.json diff --git a/pyrightconfig.json b/pyrightconfig.json new file mode 100644 index 0000000..741e0a1 --- /dev/null +++ b/pyrightconfig.json @@ -0,0 +1,8 @@ +{ + "executionEnvironments": [ + { + "root": "scripts", + "extraPaths": ["script-resources"] + } + ] +} diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index 520b8e1..2189e10 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -8,8 +8,7 @@ import urllib.parse import urllib.request sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resources")) - -import common_script_utils # noqa: E402 +import common_script_utils DEFAULT_REGISTRY_DUMP_URL = "https://stronghold.crosscode.ru/~ccbot/emote-registry.json" diff --git a/scripts/query-bookmarks b/scripts/query-bookmarks index 1014eac..5b7023c 100755 --- a/scripts/query-bookmarks +++ b/scripts/query-bookmarks @@ -17,8 +17,7 @@ import sqlite3 import collections sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resources")) - -import common_script_utils # noqa: E402 +import common_script_utils if sys.platform == "darwin": From 8dfc96c910b9d4f32253a419dd08930cd6384bf1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 2 Apr 2021 21:51:47 +0300 Subject: [PATCH 547/713] import scripts from dmitmel/factorio-tools@8f8f9725e5a2f5a44685d382d979ff3e60ac7589 written on 2020-05-25 --- script-resources/factorio/property_tree.py | 65 ++++++++++++++++++++++ scripts/factorio-dump-mod-settings | 36 ++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 script-resources/factorio/property_tree.py create mode 100755 scripts/factorio-dump-mod-settings diff --git a/script-resources/factorio/property_tree.py b/script-resources/factorio/property_tree.py new file mode 100644 index 0000000..24629e2 --- /dev/null +++ b/script-resources/factorio/property_tree.py @@ -0,0 +1,65 @@ +# +# +# +# +# + +import struct + + +def read_bool(buf): + return buf.read(1)[0] == 1 + + +def read_number(buf): + return struct.unpack(" +# +# +# + +import sys +import os +from pathlib import Path +import struct +import json + +sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resources")) +import factorio.property_tree + + +with open(Path.home() / ".factorio" / "mods" / "mod-settings.dat", "rb") as f: + + version_main, version_major, version_minor, version_developer = struct.unpack( + " Date: Mon, 5 Apr 2021 02:06:23 +0300 Subject: [PATCH 548/713] [crosscode] add an icon for the Arch mod --- crosscode/btw-i-use-arch-mod/README.md | 1 + crosscode/btw-i-use-arch-mod/ccmod.json | 3 +++ crosscode/btw-i-use-arch-mod/icon24.png | Bin 0 -> 1024 bytes 3 files changed, 4 insertions(+) create mode 100644 crosscode/btw-i-use-arch-mod/README.md create mode 100644 crosscode/btw-i-use-arch-mod/icon24.png diff --git a/crosscode/btw-i-use-arch-mod/README.md b/crosscode/btw-i-use-arch-mod/README.md new file mode 100644 index 0000000..446e038 --- /dev/null +++ b/crosscode/btw-i-use-arch-mod/README.md @@ -0,0 +1 @@ +The file [`icon24.png`] was cropped from the file [`/usr/share/archlinux/web/arch83x31.gif`](file:///usr/share/archlinux/web/arch83x31.gif) of the AUR package [`archlinux-artwork`](https://aur.archlinux.org/packages/archlinux-artwork/) and is distributed under the CC-BY-NC-SA license. diff --git a/crosscode/btw-i-use-arch-mod/ccmod.json b/crosscode/btw-i-use-arch-mod/ccmod.json index b6c3fd8..10f2db2 100644 --- a/crosscode/btw-i-use-arch-mod/ccmod.json +++ b/crosscode/btw-i-use-arch-mod/ccmod.json @@ -2,6 +2,9 @@ "id": "btw-i-use-arch", "title": "btw I use Arch", "description": "A mod for masochists like myself", + "icons": { + "24": "icon24.png" + }, "prestart": "prestart.js", "poststart": "poststart.js" } diff --git a/crosscode/btw-i-use-arch-mod/icon24.png b/crosscode/btw-i-use-arch-mod/icon24.png new file mode 100644 index 0000000000000000000000000000000000000000..9d83ec3070a946b9b9b09708628808df29400f34 GIT binary patch literal 1024 zcmV+b1poVqP)EX>4Tx04R}tkv&MmKp2MK{)i$K2ZM+>WT;LSL`B3& zt5Adrp;lj3p8qu^L^|% zjT0dB3|#3gf29sgf0ABnY0)E~cN@64ZfVLMaJd5vJQ=bnyHbc&FrNqB&*+=7K;JFU zz2^0;d5+TuAWgkW-T()Oz(|3z*L~jI)!w&%YnuK00eWU~s)lpu^8f$=j8IHeMJ9O* z000072nh=d3l9+!6BHE_78o2H92y=W93UejBO@XwD`5TU$h3Z%tTXP+VnMUSd^Y zYglD(TWND;Wo2t?Y+!GBVsU(XdwT#{oCsf^A6thBV4n?Qp%G=G6=rOAA%%z=Z2iH??+mzS8Bn1Pg{hMK5|ove_T zppBxjnW3tqrKYQ^t+ceXzrVkNuFi(A&xNqiiL=q0vcjLY$dI?xmAciKyw{t)*rB@1 zrM}Rg!P=w4+o{9Vs>a%^$lS2Y-m=Z$w$S6k!otkV%+%D>*x1;>*5}6B=*{2k)8p>l z>GJ32=j`n4;_UP3@%HZY`1AAg^7s1n`1}6;{+^?uGynhq0d!JMQvg8b*k%9#010qN zS#tmY3ljhU3ljkVnw%H_003-BL_t(2&z+D<4uBvGL^+m86B2Yst!ME5r;uW*p-vNZ zHo$vK_@wkAHQ+Nx1r{tg5G*Z7DBr#`L>N~3epFG&?OxujvJ}!3|F}$+f#;Jvg%NM= uwKI{RQB0AzD&RnyxJMD~eE>g7=|>LGW+ldV&yoB90000 Date: Mon, 5 Apr 2021 02:06:23 +0300 Subject: [PATCH 549/713] [crosscode] add an icon for the Arch mod --- crosscode/btw-i-use-arch-mod/README.md | 1 + crosscode/btw-i-use-arch-mod/ccmod.json | 3 +++ crosscode/btw-i-use-arch-mod/icon24.png | Bin 0 -> 1024 bytes 3 files changed, 4 insertions(+) create mode 100644 crosscode/btw-i-use-arch-mod/README.md create mode 100644 crosscode/btw-i-use-arch-mod/icon24.png diff --git a/crosscode/btw-i-use-arch-mod/README.md b/crosscode/btw-i-use-arch-mod/README.md new file mode 100644 index 0000000..e722c7f --- /dev/null +++ b/crosscode/btw-i-use-arch-mod/README.md @@ -0,0 +1 @@ +The file [`icon24.png`](icon24.png) was cropped from the file [`/usr/share/archlinux/web/arch83x31.gif`](file:///usr/share/archlinux/web/arch83x31.gif) of the AUR package [`archlinux-artwork`](https://aur.archlinux.org/packages/archlinux-artwork/) and is distributed under the CC-BY-NC-SA license. diff --git a/crosscode/btw-i-use-arch-mod/ccmod.json b/crosscode/btw-i-use-arch-mod/ccmod.json index b6c3fd8..10f2db2 100644 --- a/crosscode/btw-i-use-arch-mod/ccmod.json +++ b/crosscode/btw-i-use-arch-mod/ccmod.json @@ -2,6 +2,9 @@ "id": "btw-i-use-arch", "title": "btw I use Arch", "description": "A mod for masochists like myself", + "icons": { + "24": "icon24.png" + }, "prestart": "prestart.js", "poststart": "poststart.js" } diff --git a/crosscode/btw-i-use-arch-mod/icon24.png b/crosscode/btw-i-use-arch-mod/icon24.png new file mode 100644 index 0000000000000000000000000000000000000000..9d83ec3070a946b9b9b09708628808df29400f34 GIT binary patch literal 1024 zcmV+b1poVqP)EX>4Tx04R}tkv&MmKp2MK{)i$K2ZM+>WT;LSL`B3& zt5Adrp;lj3p8qu^L^|% zjT0dB3|#3gf29sgf0ABnY0)E~cN@64ZfVLMaJd5vJQ=bnyHbc&FrNqB&*+=7K;JFU zz2^0;d5+TuAWgkW-T()Oz(|3z*L~jI)!w&%YnuK00eWU~s)lpu^8f$=j8IHeMJ9O* z000072nh=d3l9+!6BHE_78o2H92y=W93UejBO@XwD`5TU$h3Z%tTXP+VnMUSd^Y zYglD(TWND;Wo2t?Y+!GBVsU(XdwT#{oCsf^A6thBV4n?Qp%G=G6=rOAA%%z=Z2iH??+mzS8Bn1Pg{hMK5|ove_T zppBxjnW3tqrKYQ^t+ceXzrVkNuFi(A&xNqiiL=q0vcjLY$dI?xmAciKyw{t)*rB@1 zrM}Rg!P=w4+o{9Vs>a%^$lS2Y-m=Z$w$S6k!otkV%+%D>*x1;>*5}6B=*{2k)8p>l z>GJ32=j`n4;_UP3@%HZY`1AAg^7s1n`1}6;{+^?uGynhq0d!JMQvg8b*k%9#010qN zS#tmY3ljhU3ljkVnw%H_003-BL_t(2&z+D<4uBvGL^+m86B2Yst!ME5r;uW*p-vNZ zHo$vK_@wkAHQ+Nx1r{tg5G*Z7DBr#`L>N~3epFG&?OxujvJ}!3|F}$+f#;Jvg%NM= uwKI{RQB0AzD&RnyxJMD~eE>g7=|>LGW+ldV&yoB90000 Date: Sat, 10 Apr 2021 14:33:22 +0300 Subject: [PATCH 550/713] clarify some things in the README --- README.md | 20 ++++++++++++++++++-- install.zsh | 38 -------------------------------------- upgrade.zsh | 14 -------------- 3 files changed, 18 insertions(+), 54 deletions(-) delete mode 100755 install.zsh delete mode 100755 upgrade.zsh diff --git a/README.md b/README.md index c1a6dd1..e0ce74c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,19 @@ -# .dotfiles +# dotfiles -My dotfiles for macOS, Arch Linux, Raspbian and Android (Termux). +My dotfiles (configurations and settings) for shells, text editors and other terminal programs, plus a collection of scripts. Written for and work on various UNIX-like OSes, primarily for: + +- Arch Linux, +- Linux Mint, +- server Ubuntu, +- macOS with GNU coreutils (i.e. BSDs are not supported), +- Android with Termux. + +And also a legendary project that has survived for thousands of years of development. + +## Disclaimer + +### **This is my personal project! No warranty is provided for running these as a superuser, I am in no way responsible for deletion of `/` with `rm -rf`, and _absolutely no support is provided_ whatsoever unless I explicitly say so personally!** + +**It is also recommended for users of this repository to read the scripts they are running. I didn't write the comments just for myself!** + +**Automatic installers are deliberately not provided.** diff --git a/install.zsh b/install.zsh deleted file mode 100755 index f816480..0000000 --- a/install.zsh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env zsh - -DOTFILES_PATH="${0:a:h}" - -install_dotfile() { - local dest="$1" - local contents="$2" - - if [[ -f "$dest" ]]; then - mv -vi "$dest" "$dest.dmitmel-dotfiles-backup" - fi - - mkdir -pv "${dest:h}" - print -r -- "installing dotfile '$dest'" - print -r -- "$contents" > "$dest" -} - -# ZSH -for file_name in zshrc; do - file_path="$DOTFILES_PATH/zsh/$file_name" - install_dotfile "$HOME/.$file_name" "source ${(q)file_path}" -done - -# Neovim -for file_name in {init,ginit}.vim; do - file_path="$DOTFILES_PATH/nvim/$file_name" - install_dotfile "$HOME/.config/nvim/$file_name" "source ${(q)file_path}" -done - -# Kitty -file_name=kitty.conf -file_path="$DOTFILES_PATH/kitty/$file_name" -install_dotfile "$HOME/.config/kitty/$file_name" "include ${(q)file_path}" - -# tmux -file_name=tmux.conf -file_path="$DOTFILES_PATH/tmux/$file_name" -install_dotfile "$HOME/.$file_name" "source-file ${(q)file_path}" diff --git a/upgrade.zsh b/upgrade.zsh deleted file mode 100755 index 81b28b3..0000000 --- a/upgrade.zsh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env zsh - -DOTFILES_PATH="${0:a:h}" -cd "$DOTFILES_PATH" || exit 1 -ZSH_DOTFILES="$DOTFILES_PATH/zsh" - -source "$ZSH_DOTFILES/functions.zsh" - -git pull --rebase --stat origin master -git submodule update --init --recursive --remote --progress - -ZPLG_SKIP_LOADING=1 -source "$ZSH_DOTFILES/plugins.zsh" -zplg-upgrade From 855538c9219be9f9e2a428d1482404f987e82e2d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 12 Apr 2021 00:53:51 +0300 Subject: [PATCH 551/713] [scripts] fix a bug in run_chooser when no search results are found --- scripts/copy-crosscode-emoji-url | 35 ++++++++++++++++---------------- scripts/query-bookmarks | 13 ++++++------ 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index 2189e10..c955100 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -61,26 +61,27 @@ def emote_downloader_and_iterator(): chosen_index = common_script_utils.run_chooser( emote_downloader_and_iterator(), prompt="emote", async_read=True ) -chosen_emote = emotes[chosen_index] +if chosen_index >= 0: + chosen_emote = emotes[chosen_index] -emote_url = urllib.parse.urlparse(chosen_emote["url"]) -emote_url_query = urllib.parse.parse_qs(emote_url.query) + emote_url = urllib.parse.urlparse(chosen_emote["url"]) + emote_url_query = urllib.parse.parse_qs(emote_url.query) -if config.getboolean("default", "add_emote_name_to_url", fallback=False): - emote_url_query["name"] = [chosen_emote["name"]] + if config.getboolean("default", "add_emote_name_to_url", fallback=False): + emote_url_query["name"] = [chosen_emote["name"]] -default_emote_image_size = config.getint( - "default", "default_emote_image_size", fallback=None -) -if default_emote_image_size is not None: - emote_url_query["size"] = [str(default_emote_image_size)] + default_emote_image_size = config.getint( + "default", "default_emote_image_size", fallback=None + ) + if default_emote_image_size is not None: + emote_url_query["size"] = [str(default_emote_image_size)] -emote_url_query = urllib.parse.urlencode(emote_url_query, doseq=True) -emote_url = urllib.parse.urlunparse(emote_url._replace(query=emote_url_query)) + emote_url_query = urllib.parse.urlencode(emote_url_query, doseq=True) + emote_url = urllib.parse.urlunparse(emote_url._replace(query=emote_url_query)) -common_script_utils.set_clipboard(emote_url) + common_script_utils.set_clipboard(emote_url) -common_script_utils.send_notification( - os.path.basename(__file__), - "copied URL of {} to clipboard!".format(chosen_emote["ref"]), -) + common_script_utils.send_notification( + os.path.basename(__file__), + "copied URL of {} to clipboard!".format(chosen_emote["ref"]), + ) diff --git a/scripts/query-bookmarks b/scripts/query-bookmarks index 5b7023c..7388700 100755 --- a/scripts/query-bookmarks +++ b/scripts/query-bookmarks @@ -110,10 +110,11 @@ chosen_index = common_script_utils.run_chooser( chooser_entries_iter(), prompt="bookmark" ) -_title, url, _folder_path_str = chooser_entries[chosen_index] -print(url) +if chosen_index >= 0: + _title, url, _folder_path_str = chooser_entries[chosen_index] + print(url) -common_script_utils.set_clipboard(url) -common_script_utils.send_notification( - os.path.basename(__file__), "bookmark URL copied to clipboard!", url -) + common_script_utils.set_clipboard(url) + common_script_utils.send_notification( + os.path.basename(__file__), "bookmark URL copied to clipboard!", url + ) From fa2406e572a58e09b77aa83e359783028e53dc87 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 18 Apr 2021 17:57:23 +0300 Subject: [PATCH 552/713] [common_script_utils] add support for using fzf as a chooser Among other things this means that the emote copier is finally supported on Android. --- script-resources/common_script_utils.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/script-resources/common_script_utils.py b/script-resources/common_script_utils.py index b96e195..ca15364 100644 --- a/script-resources/common_script_utils.py +++ b/script-resources/common_script_utils.py @@ -14,7 +14,17 @@ def platform_not_supported_error(): def run_chooser(choices, prompt=None, async_read=False): - if sys.platform == "darwin": + supports_result_index = True + if os.isatty(sys.stderr.fileno()): + process_args = [ + "fzf", + "--with-nth=2..", + "--height=50%", + "--reverse", + "--tiebreak=index", + ] + supports_result_index = False + elif sys.platform == "darwin": process_args = ["choose", "-i"] elif os.name == "posix": process_args = ["rofi", "-dmenu", "-i", "-format", "i"] @@ -30,8 +40,11 @@ def run_chooser(choices, prompt=None, async_read=False): ) with chooser_process.stdin as pipe: - for choice in choices: + for index, choice in enumerate(choices): assert "\n" not in choice + if not supports_result_index: + pipe.write(str(index).encode()) + pipe.write(b" ") pipe.write(choice.encode()) pipe.write(b"\n") @@ -39,11 +52,7 @@ def run_chooser(choices, prompt=None, async_read=False): if exit_code != 0: raise Exception("chooser process failed with exit code {}".format(exit_code)) - chosen_index = int( - # an extra newline is inserted by rofi for whatever reason - chooser_process.stdout.read().rstrip(b"\n") - ) - + chosen_index = int(chooser_process.stdout.read().strip().split()[0]) return chosen_index From 5585f9c6937d4727492afe5a0b58a2985a2af063 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 18 Apr 2021 18:06:47 +0300 Subject: [PATCH 553/713] begin adding types to the Python scripts --- script-resources/common_script_utils.py | 17 +++++--- script-resources/factorio/property_tree.py | 19 ++++---- script-resources/welcome/humanize.py | 5 ++- scripts/copy-crosscode-emoji-url | 27 +++++++----- scripts/factorio-dump-mod-settings | 4 ++ scripts/query-bookmarks | 50 ++++++++++++++-------- scripts/random-local-ipv4 | 2 +- 7 files changed, 76 insertions(+), 48 deletions(-) diff --git a/script-resources/common_script_utils.py b/script-resources/common_script_utils.py index ca15364..fa23b02 100644 --- a/script-resources/common_script_utils.py +++ b/script-resources/common_script_utils.py @@ -2,18 +2,21 @@ import sys import os import subprocess from pathlib import Path +from typing import Iterable, NoReturn if os.name == "posix": - DOTFILES_CONFIG_DIR = Path.home() / ".config" / "dotfiles" - DOTFILES_CACHE_DIR = Path.home() / ".cache" / "dotfiles" + DOTFILES_CONFIG_DIR: Path = Path.home() / ".config" / "dotfiles" + DOTFILES_CACHE_DIR: Path = Path.home() / ".cache" / "dotfiles" -def platform_not_supported_error(): +def platform_not_supported_error() -> NoReturn: raise Exception("platform '{}' is not supported!".format(sys.platform)) -def run_chooser(choices, prompt=None, async_read=False): +def run_chooser( + choices: Iterable[str], prompt: str = None, async_read: bool = False +) -> int: supports_result_index = True if os.isatty(sys.stderr.fileno()): process_args = [ @@ -48,7 +51,7 @@ def run_chooser(choices, prompt=None, async_read=False): pipe.write(choice.encode()) pipe.write(b"\n") - exit_code = chooser_process.wait() + exit_code: int = chooser_process.wait() if exit_code != 0: raise Exception("chooser process failed with exit code {}".format(exit_code)) @@ -56,7 +59,7 @@ def run_chooser(choices, prompt=None, async_read=False): return chosen_index -def send_notification(title, message, url=None): +def send_notification(title: str, message: str, url: str = None) -> None: if sys.platform == "darwin": process_args = [ "terminal-notifier", @@ -82,7 +85,7 @@ def send_notification(title, message, url=None): subprocess.run(process_args, check=True) -def set_clipboard(text): +def set_clipboard(text: str) -> None: # TODO: somehow merge program selection with the logic in `zsh/functions.zsh` if sys.platform == "darwin": process_args = ["pbcopy"] diff --git a/script-resources/factorio/property_tree.py b/script-resources/factorio/property_tree.py index 24629e2..9275ff4 100644 --- a/script-resources/factorio/property_tree.py +++ b/script-resources/factorio/property_tree.py @@ -5,21 +5,22 @@ # import struct +from typing import Any, IO -def read_bool(buf): +def read_bool(buf: IO[bytes]) -> bool: return buf.read(1)[0] == 1 -def read_number(buf): +def read_number(buf: IO[bytes]) -> float: return struct.unpack(" int: return struct.unpack(" str: is_empty = read_bool(buf) if is_empty: return "" @@ -29,25 +30,25 @@ def read_string(buf): return buf.read(len_).decode("utf8") -def read_dictionary(buf): +def read_dictionary(buf: IO[bytes]) -> dict[str, Any]: len_ = _read_length(buf) - value = {} + value: dict[str, Any] = {} for _ in range(len_): key = read_string(buf) value[key] = read(buf) return value -def read_list(buf): +def read_list(buf: IO[bytes]) -> list[Any]: len_ = _read_length(buf) - value = [] + value: list[Any] = [] for _ in range(len_): read_string(buf) value.append(read(buf)) return value -def read(buf): +def read(buf: IO[bytes]) -> Any: type_, _any_type_flag = buf.read(2) if type_ == 0: return None diff --git a/script-resources/welcome/humanize.py b/script-resources/welcome/humanize.py index 7c5ae8d..ac7c7fb 100644 --- a/script-resources/welcome/humanize.py +++ b/script-resources/welcome/humanize.py @@ -24,10 +24,11 @@ def humanize_bytes(bytes): units = ["B", "kB", "MB", "GB"] factor = 1 - for _unit in units: + unit = "" + for unit in units: next_factor = factor << 10 if bytes < next_factor: break factor = next_factor - return "%.2f %s" % (float(bytes) / factor, _unit) + return "%.2f %s" % (float(bytes) / factor, unit) diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index c955100..2192be2 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -2,8 +2,10 @@ import sys import os +from pathlib import Path from configparser import ConfigParser import json +from typing import Any, Generator, Optional, Union import urllib.parse import urllib.request @@ -15,23 +17,25 @@ DEFAULT_REGISTRY_DUMP_URL = "https://stronghold.crosscode.ru/~ccbot/emote-regist if os.name == "posix": - config_path = ( + config_path: Path = ( common_script_utils.DOTFILES_CONFIG_DIR / "copy-crosscode-emoji-url.ini" ) - default_registry_dump_file = common_script_utils.DOTFILES_CACHE_DIR / "dotfiles" + default_registry_dump_file: Path = ( + common_script_utils.DOTFILES_CACHE_DIR / "dotfiles" + ) else: common_script_utils.platform_not_supported_error() config = ConfigParser(interpolation=None) config.read(config_path) -emotes = [] +emotes: list[dict[str, Any]] = [] -def emote_downloader_and_iterator(): +def emote_downloader_and_iterator() -> Generator[str, None, None]: global emotes - registry_dump_file = config.get( + registry_dump_file: Optional[Union[str, Path]] = config.get( "default", "ccbot_emote_registry_dump_file", fallback=None ) if registry_dump_file is not None: @@ -43,6 +47,7 @@ def emote_downloader_and_iterator(): "default", "ccbot_emote_registry_dump_url", fallback=DEFAULT_REGISTRY_DUMP_URL ) + emote_registry_data: dict[str, Any] try: with open(registry_dump_file, "r") as f: emote_registry_data = json.load(f) @@ -64,8 +69,8 @@ chosen_index = common_script_utils.run_chooser( if chosen_index >= 0: chosen_emote = emotes[chosen_index] - emote_url = urllib.parse.urlparse(chosen_emote["url"]) - emote_url_query = urllib.parse.parse_qs(emote_url.query) + emote_url: urllib.parse.ParseResult = urllib.parse.urlparse(chosen_emote["url"]) + emote_url_query: dict[str, list[str]] = urllib.parse.parse_qs(emote_url.query) if config.getboolean("default", "add_emote_name_to_url", fallback=False): emote_url_query["name"] = [chosen_emote["name"]] @@ -76,10 +81,12 @@ if chosen_index >= 0: if default_emote_image_size is not None: emote_url_query["size"] = [str(default_emote_image_size)] - emote_url_query = urllib.parse.urlencode(emote_url_query, doseq=True) - emote_url = urllib.parse.urlunparse(emote_url._replace(query=emote_url_query)) + emote_url_query_str = urllib.parse.urlencode(emote_url_query, doseq=True) + emote_url_str = urllib.parse.urlunparse( + emote_url._replace(query=emote_url_query_str) + ) - common_script_utils.set_clipboard(emote_url) + common_script_utils.set_clipboard(emote_url_str) common_script_utils.send_notification( os.path.basename(__file__), diff --git a/scripts/factorio-dump-mod-settings b/scripts/factorio-dump-mod-settings index 2f817b3..5f04b2e 100755 --- a/scripts/factorio-dump-mod-settings +++ b/scripts/factorio-dump-mod-settings @@ -16,6 +16,10 @@ import factorio.property_tree with open(Path.home() / ".factorio" / "mods" / "mod-settings.dat", "rb") as f: + version_main: int + version_major: int + version_minor: int + version_developer: int version_main, version_major, version_minor, version_developer = struct.unpack( " +# +# import sys import os @@ -14,16 +14,16 @@ from configparser import ConfigParser import tempfile import shutil import sqlite3 -import collections +from typing import Optional, Tuple, Generator sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resources")) import common_script_utils if sys.platform == "darwin": - firefox_home = Path.home() / "Library" / "Application Support" / "Firefox" + firefox_home: Path = Path.home() / "Library" / "Application Support" / "Firefox" elif os.name == "posix": - firefox_home = Path.home() / ".mozilla" / "firefox" + firefox_home: Path = Path.home() / ".mozilla" / "firefox" else: common_script_utils.platform_not_supported_error() @@ -31,15 +31,17 @@ else: profiles_config = ConfigParser(interpolation=None) profiles_config.read(firefox_home / "profiles.ini") -installs_sections = [s for s in profiles_config.sections() if s.startswith("Install")] +installs_sections: list[str] = [ + s for s in profiles_config.sections() if s.startswith("Install") +] if not installs_sections: raise Exception("no Firefox installations detected!") if len(installs_sections) > 1: raise Exception("multiple Firefox installations are not supported!") -profile_dir = firefox_home / profiles_config.get(installs_sections[0], "Default") +profile_dir: Path = firefox_home / profiles_config.get(installs_sections[0], "Default") # should places.sqlite be used instead? -db_path = profile_dir / "weave" / "bookmarks.sqlite" +db_path: Path = profile_dir / "weave" / "bookmarks.sqlite" if not db_path.is_file(): raise Exception("'{}' is not a file".format(db_path)) @@ -50,17 +52,22 @@ if not db_path.is_file(): db_copy_fd, db_copy_path = tempfile.mkstemp(prefix="bookmarks.", suffix=".sqlite") os.close(db_copy_fd) -chooser_entries = [] +chooser_entries: list[Tuple[str, str, Optional[str]]] = [] try: shutil.copyfile(db_path, db_copy_path) db = sqlite3.connect(db_copy_path) - urls = {} + urls: dict[int, str] = {} + url_id: int + url: str for url_id, url in db.execute("SELECT id, url FROM urls"): urls[url_id] = url - folders = {} + folders: dict[str, Tuple[Optional[str], str]] = {} + folder_id: str + parent_folder_id: str + folder_title: str for folder_id, parent_folder_id, folder_title in db.execute( "SELECT guid, parentGuid, title FROM items WHERE kind = 3 AND validity AND NOT isDeleted" ): @@ -69,24 +76,29 @@ try: folder_title, ) + url_title: str + url_id: int + url_keyword: str + parent_folder_id: str for url_title, url_id, url_keyword, parent_folder_id in db.execute( "SELECT title, urlId, keyword, parentGuid FROM items WHERE kind = 1 AND validity AND NOT isDeleted" ): url = urls[url_id] - folder_path = collections.deque() - while parent_folder_id is not None: - folder = folders.get(parent_folder_id, None) + folder_path = list[str]() + parent_folder_id_2: Optional[str] = parent_folder_id + while parent_folder_id_2 is not None: + folder = folders.get(parent_folder_id_2, None) if folder is None: # broken folder structure? folder_path.clear() break - parent_folder_id, folder_title = folder + parent_folder_id_2, folder_title = folder if folder_title is not None: - folder_path.appendleft(folder_title) + folder_path.append(folder_title) folder_path_str = ( - ("/" + "/".join(folder_path)) if len(folder_path) > 0 else None + ("/" + "/".join(reversed(folder_path))) if len(folder_path) > 0 else None ) chooser_entries.append((url_title, url, folder_path_str)) @@ -97,7 +109,7 @@ finally: os.remove(db_copy_path) -def chooser_entries_iter(): +def chooser_entries_iter() -> Generator[str, None, None]: for title, url, folder_path_str in chooser_entries: entry_items = [title, url] if folder_path_str is not None: diff --git a/scripts/random-local-ipv4 b/scripts/random-local-ipv4 index 058ef11..dbf02a4 100755 --- a/scripts/random-local-ipv4 +++ b/scripts/random-local-ipv4 @@ -3,7 +3,7 @@ import random -def randbyte(): +def randbyte() -> int: return random.randrange(0, 256) From bff7aeb006184518bd403d7b4da38ed84b24483b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 22 Apr 2021 18:33:23 +0300 Subject: [PATCH 554/713] [scripts] add leveldb-dump --- scripts/leveldb-dump | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 scripts/leveldb-dump diff --git a/scripts/leveldb-dump b/scripts/leveldb-dump new file mode 100755 index 0000000..90e7964 --- /dev/null +++ b/scripts/leveldb-dump @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 +import argparse +from pathlib import Path +from typing import Union +import plyvel +import json +from sys import stdout +import base64 + +parser = argparse.ArgumentParser() +parser.add_argument( + "--encode", + "-e", + choices=["utf8", "base16", "base32", "base64", "base85"], + default="utf8", +) +parser.add_argument("db_path", type=Path) +cli_args = parser.parse_args() + + +def bytes_to_json(b: bytes) -> Union[str, list[int]]: + if cli_args.encode == "utf8": + try: + return b.decode("utf8") + except UnicodeDecodeError: + return list(b) + elif cli_args.encode == "base16": + return base64.b16encode(b).decode("ascii") + elif cli_args.encode == "base32": + return base64.b32encode(b).decode("ascii") + elif cli_args.encode == "base64": + return base64.b64encode(b).decode("ascii") + elif cli_args.encode == "base85": + return base64.b85encode(b).decode("ascii") + else: + assert False + + +db = plyvel.DB(str(cli_args.db_path), create_if_missing=False) +with db.iterator() as iterator: + for key, value in iterator: + json.dump({"key": bytes_to_json(key), "value": bytes_to_json(value)}, stdout) + stdout.write("\n") From be265eac7ca109bd4d7b193a27c2c6e469376173 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 22 Apr 2021 20:11:56 +0300 Subject: [PATCH 555/713] [nvim] minor fixes to typescript syntax highlighting --- nvim/colors/dotfiles.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 6398166..f6dcc2b 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -330,6 +330,7 @@ hi! link typescriptCall Variable hi! link typescriptArrowFuncArg typescriptCall hi! link typescriptFuncType typescriptCall + hi! link typescriptMessage NONE hi! link typescriptVariable jsStorageClass hi! link typescriptAmbientDeclaration typescriptVariable hi! link typescriptVariableDeclaration Variable @@ -342,6 +343,7 @@ hi! link typescriptConstructorType typescriptConstructSignature hi! link typescriptEndColons Delimiter hi! link typescriptImport jsImport + hi! link typescriptImportType typescriptImport hi! link typescriptExport jsExport hi! link typescriptNull jsNull hi! link typescriptObjectLabel jsObjectKey From 0221e6c08c3abc13440168d92a95995b16e41ac7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 23 Apr 2021 01:19:59 +0300 Subject: [PATCH 556/713] [nvim] add a binding for my other favorite git command --- nvim/plugin/git.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/plugin/git.vim b/nvim/plugin/git.vim index cb154da..1b8b235 100644 --- a/nvim/plugin/git.vim +++ b/nvim/plugin/git.vim @@ -11,4 +11,5 @@ nnoremap gC :Git commit --amend nnoremap gl :Gclog nnoremap gp :Git push + nnoremap gP :Git push --force-with-lease " }}} From 4d42627b83412dc0d837d90d8c6faf483e562c00 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 23 Apr 2021 17:41:11 +0300 Subject: [PATCH 557/713] [nvim] use tcomment.vim instead of vim-commentary --- nvim/dotfiles/plugins-list.vim | 6 +++++- nvim/plugin/editing.vim | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index 3fa3e77..d540517 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -12,7 +12,11 @@ endif Plug 'Raimondi/delimitMate' Plug 'tpope/vim-repeat' - Plug 'tpope/vim-commentary' + " if g:vim_ide + Plug 'tomtom/tcomment_vim' + " else + " Plug 'tpope/vim-commentary' + " endif Plug 'tpope/vim-surround' Plug 'Yggdroot/indentLine' Plug 'idbrii/detectindent' diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index fc11f3a..d53d96a 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -233,6 +233,18 @@ set commentstring=//%s noremap s s noremap S S + " Remove the mappings that I won't use + let g:tcomment_maps = 0 + + nmap gc TComment_gc + nmap gcc TComment_gcc + nmap gC TComment_gcb + " The default block commenting mapping refuses to work on a single line, as + " a workaround I give it another empty one to work with. + nmap gCC m'o''TComment_gcb+ + xnoremap gc :TCommentMaybeInline + xnoremap gC :TCommentBlock + " }}} From 44ba053b7c34ec074cb256d54003b258e389876e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 23 Apr 2021 21:17:50 +0300 Subject: [PATCH 558/713] [nvim] correctly highlight class names in declarations --- nvim/colors/dotfiles.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index f6dcc2b..4c137f3 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -375,8 +375,9 @@ " }}} " Python {{{ - hi! link pythonBuiltinType Type - hi! link pythonExClass Type + hi! link pythonClass Type + hi! link pythonBuiltinType pythonClass + hi! link pythonExClass pythonClass hi! link pythonBuiltinObj pythonFunction hi! link pythonClassVar Variable " }}} From 660316fb14a154a51040b5959d071aafe67b68b7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 23 Apr 2021 21:38:37 +0300 Subject: [PATCH 559/713] [scripts/leveldb-dump] support setting separate key and value encodings --- scripts/leveldb-dump | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/scripts/leveldb-dump b/scripts/leveldb-dump index 90e7964..f1d273e 100755 --- a/scripts/leveldb-dump +++ b/scripts/leveldb-dump @@ -8,36 +8,42 @@ from sys import stdout import base64 parser = argparse.ArgumentParser() -parser.add_argument( - "--encode", - "-e", - choices=["utf8", "base16", "base32", "base64", "base85"], - default="utf8", -) +encoding_names = ["utf8", "base16", "base32", "base64", "base85"] +parser.add_argument("--encoding", "-e", choices=encoding_names, default="utf8") +parser.add_argument("--key-encoding", choices=encoding_names, default=None) +parser.add_argument("--value-encoding", choices=encoding_names, default=None) parser.add_argument("db_path", type=Path) cli_args = parser.parse_args() -def bytes_to_json(b: bytes) -> Union[str, list[int]]: - if cli_args.encode == "utf8": +def bytes_to_json(b: bytes, encoding: str) -> Union[str, list[int]]: + if encoding == "utf8": try: return b.decode("utf8") except UnicodeDecodeError: return list(b) - elif cli_args.encode == "base16": + elif encoding == "base16": return base64.b16encode(b).decode("ascii") - elif cli_args.encode == "base32": + elif encoding == "base32": return base64.b32encode(b).decode("ascii") - elif cli_args.encode == "base64": + elif encoding == "base64": return base64.b64encode(b).decode("ascii") - elif cli_args.encode == "base85": + elif encoding == "base85": return base64.b85encode(b).decode("ascii") else: assert False +key_encoding: str = cli_args.key_encoding or cli_args.encoding +value_encoding: str = cli_args.value_encoding or cli_args.encoding db = plyvel.DB(str(cli_args.db_path), create_if_missing=False) with db.iterator() as iterator: for key, value in iterator: - json.dump({"key": bytes_to_json(key), "value": bytes_to_json(value)}, stdout) + json.dump( + { + "key": bytes_to_json(key, key_encoding), + "value": bytes_to_json(value, value_encoding), + }, + stdout, + ) stdout.write("\n") From 436fffdd6debb61d8459969f19941bd98c67741c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 24 Apr 2021 13:51:14 +0300 Subject: [PATCH 560/713] [nvim] add a comment textobject in continuation to 4d42627b83412dc0d837d90d8c6faf483e562c00 You may be wondering why I have exchanged a single simple plugin for two arguably more complex ones. Well, vim-commentary couldn't put comments on blank lines, so there. And also tcomment.vim was mentioned in the README of the former plugin. --- nvim/dotfiles/plugins-list.vim | 1 + nvim/plugin/editing.vim | 3 +++ 2 files changed, 4 insertions(+) diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index d540517..c08d2bf 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -14,6 +14,7 @@ Plug 'tpope/vim-repeat' " if g:vim_ide Plug 'tomtom/tcomment_vim' + Plug 'glts/vim-textobj-comment' " else " Plug 'tpope/vim-commentary' " endif diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index d53d96a..59b18d3 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -236,6 +236,7 @@ set commentstring=//%s " Remove the mappings that I won't use let g:tcomment_maps = 0 + " Closely replicate the behavior of tpope/vim-commentary nmap gc TComment_gc nmap gcc TComment_gcc nmap gC TComment_gcb @@ -244,6 +245,8 @@ set commentstring=//%s nmap gCC m'o''TComment_gcb+ xnoremap gc :TCommentMaybeInline xnoremap gC :TCommentBlock + " Make an alias for the comment text object + omap gc ac " }}} From 70acf70f0bdfb0da95905ea974ab29f45c1eec97 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 25 Apr 2021 20:48:46 +0300 Subject: [PATCH 561/713] [nvim] entirely get rid of the CtrlSF plugin --- nvim/dotfiles/plugins-list.vim | 3 --- nvim/plugin/files.vim | 29 +++++++++++++++++++++-------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index c08d2bf..ff2ce70 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -43,9 +43,6 @@ Plug 'vim-airline/vim-airline' Plug 'tpope/vim-obsession' Plug 'romainl/vim-qf' - if g:vim_ide - Plug 'dyng/ctrlsf.vim' - endif " }}} " Git {{{ diff --git a/nvim/plugin/files.vim b/nvim/plugin/files.vim index 14fa58f..da700db 100644 --- a/nvim/plugin/files.vim +++ b/nvim/plugin/files.vim @@ -20,6 +20,23 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" command! -bang -nargs=* Rg call fzf#vim#grep(s:rg_cmd . ' --column --line-number --no-heading --fixed-strings --smart-case --color always ' . shellescape(), 1, 0) command! -bang -nargs=* Find Rg endif + + nnoremap / :grep + + function! s:grep_mapping_star_normal() + let word = expand("") + if !empty(word) + call feedkeys(":\grep " . shellescape('\b' . word . '\b'), 'n') + endif + endfunction + function! s:grep_mapping_star_visual() + let tmp = @" + normal! y + call feedkeys(":\grep " . shellescape(@"), 'n') + let @" = tmp + endfunction + nnoremap * call grep_mapping_star_normal() + xnoremap * call grep_mapping_star_visual() " }}} @@ -29,7 +46,10 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" let g:loaded_netrwPlugin = 1 " re-add Netrw's gx mappings since we've disabled them nnoremap gx call netrw#BrowseX(expand(''),netrw#CheckIfRemote()) - xnoremap gx call netrw#BrowseXVis() + " This one can be rewritten in a way to not clobber the yank register... + " Most notably, the built-in mapping, which uses netrw#BrowseXVis(), doesn't + " work and breaks the editor, at least for me. + xnoremap gx y:call netrw#BrowseX(@",netrw#CheckIfRemote()) " }}} @@ -176,10 +196,3 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" augroup END " }}} - - -" CtrlSF {{{ - nmap / CtrlSFPrompt - nmap * CtrlSFCwordPath - xmap * CtrlSFVwordPath -" }}} From 8198c861f43c86701232c90dc11e93e5d7572f98 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 25 Apr 2021 21:18:23 +0300 Subject: [PATCH 562/713] [nvim] disable automatic folds in the fugitive window because they break the UI --- nvim/after/ftplugin/fugitive.vim | 1 + 1 file changed, 1 insertion(+) create mode 100644 nvim/after/ftplugin/fugitive.vim diff --git a/nvim/after/ftplugin/fugitive.vim b/nvim/after/ftplugin/fugitive.vim new file mode 100644 index 0000000..ab49c88 --- /dev/null +++ b/nvim/after/ftplugin/fugitive.vim @@ -0,0 +1 @@ +setlocal nofoldenable foldmethod=manual From 2c6193a487576af25552a0574a2bb3cc74f16635 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 25 Apr 2021 21:20:14 +0300 Subject: [PATCH 563/713] [nvim] collapse the set and setlocal commands because the Vimscript syntax allows it --- nvim/after/ftplugin/haskell.vim | 4 +--- nvim/after/syntax/cabal.vim | 3 +-- nvim/after/syntax/cabalconfig.vim | 3 +-- nvim/after/syntax/nginx.vim | 3 +-- nvim/plugin/editing.vim | 10 ++-------- 5 files changed, 6 insertions(+), 17 deletions(-) diff --git a/nvim/after/ftplugin/haskell.vim b/nvim/after/ftplugin/haskell.vim index bdabaed..8d98c34 100644 --- a/nvim/after/ftplugin/haskell.vim +++ b/nvim/after/ftplugin/haskell.vim @@ -1,3 +1 @@ -let g:haskall_test = 1 -setlocal foldmethod< -setlocal foldtext< +setlocal foldmethod< foldtext< diff --git a/nvim/after/syntax/cabal.vim b/nvim/after/syntax/cabal.vim index 8ced55f..8d98c34 100644 --- a/nvim/after/syntax/cabal.vim +++ b/nvim/after/syntax/cabal.vim @@ -1,2 +1 @@ -setlocal foldmethod< -setlocal foldtext< +setlocal foldmethod< foldtext< diff --git a/nvim/after/syntax/cabalconfig.vim b/nvim/after/syntax/cabalconfig.vim index 8ced55f..8d98c34 100644 --- a/nvim/after/syntax/cabalconfig.vim +++ b/nvim/after/syntax/cabalconfig.vim @@ -1,2 +1 @@ -setlocal foldmethod< -setlocal foldtext< +setlocal foldmethod< foldtext< diff --git a/nvim/after/syntax/nginx.vim b/nvim/after/syntax/nginx.vim index 1e4e3af..bf72a83 100644 --- a/nvim/after/syntax/nginx.vim +++ b/nvim/after/syntax/nginx.vim @@ -4,5 +4,4 @@ " sourced in `syntax/nginx.vim` in vim-polyglot, which resets the `commentstring` " set in `ftplugin/nginx.vim` and sets `comments` to some garbage. This script " undoes that damage. -setlocal comments< -setlocal commentstring=#%s +setlocal comments< commentstring=#%s diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 59b18d3..46cbe9b 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -58,23 +58,17 @@ set commentstring=//%s " Cursor and Scrolling {{{ - - set number - set relativenumber - set cursorline - + set number relativenumber cursorline " remember cursor position augroup vimrc-editing-remember-cursor-position autocmd! autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exec "normal! g`\"" | endif augroup END - " }}} " Wrapping {{{ - set nowrap - set colorcolumn=81,101,121 + set nowrap colorcolumn=81,101,121 " }}} From 74e978d78eddeac171b5ca8586331a672e7842cd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 26 Apr 2021 10:07:31 +0300 Subject: [PATCH 564/713] [nvim] use Yapf with a modified config for formatting --- colorschemes/_theme.py | 3 +-- colorschemes/iterm.itermcolors.py | 13 +++++-------- colorschemes/prismjs-theme.css.py | 4 +--- colorschemes/setvtrgb.txt.py | 9 +-------- colorschemes/variables.css.py | 1 + colorschemes/vim.vim.py | 1 + .../vscode-colorCustomizations.json.py | 8 ++------ colorschemes/xfce4-terminal.theme.py | 1 + colorschemes/zsh.zsh.py | 1 - nvim/coc-languages/python.vim | 18 +++++++++++++++--- python/yapf.ini | 8 ++++++++ script-resources/common_script_utils.py | 9 ++------- script-resources/welcome/colors.py | 1 + script-resources/welcome/main.py | 1 + script-resources/welcome/system_info.py | 18 +++++++----------- 15 files changed, 47 insertions(+), 49 deletions(-) create mode 100644 python/yapf.ini diff --git a/colorschemes/_theme.py b/colorschemes/_theme.py index a467d1e..1695bdc 100644 --- a/colorschemes/_theme.py +++ b/colorschemes/_theme.py @@ -32,8 +32,7 @@ selection_bg = base16_colors[0x2] selection_fg = fg ansi_colors = [ - base16_colors[int(i, 16)] - for i in "0 8 B A D E C 5 3 8 B A D E C 7 9 F 1 2 4 6".split() + base16_colors[int(i, 16)] for i in "0 8 B A D E C 5 3 8 B A D E C 7 9 F 1 2 4 6".split() ] link_color = ansi_colors[0xC] diff --git a/colorschemes/iterm.itermcolors.py b/colorschemes/iterm.itermcolors.py index 5594ff5..622d3ec 100755 --- a/colorschemes/iterm.itermcolors.py +++ b/colorschemes/iterm.itermcolors.py @@ -2,6 +2,7 @@ import _theme as theme + print( """\ @@ -13,7 +14,7 @@ print( def print_color(key_name, color): - r, g, b = [float(int(color[2 * i + 1 : 2 * i + 3], 16)) / 255 for i in range(3)] + r, g, b = [float(int(color[2 * i + 1:2 * i + 3], 16)) / 255 for i in range(3)] print( """\ {} Color @@ -27,9 +28,7 @@ def print_color(key_name, color): Blue Component {} \ -""".format( - key_name, r, g, b - ) +""".format(key_name, r, g, b) ) @@ -44,9 +43,7 @@ for index, color in enumerate(theme.ansi_colors[:16]): print_color("Ansi " + str(index), color) print_color("Link", theme.link_color) -print( - """\ +print("""\ \ -""" -) +""") diff --git a/colorschemes/prismjs-theme.css.py b/colorschemes/prismjs-theme.css.py index 42b62b8..ba5cdf5 100755 --- a/colorschemes/prismjs-theme.css.py +++ b/colorschemes/prismjs-theme.css.py @@ -7,8 +7,6 @@ with open(os.path.join(os.path.dirname(__file__), "prismjs-theme-src.css")) as f css_src = f.read() for var_name, color in theme.css_variables.items(): - css_src = css_src.replace( - "var(--{}{})".format(theme.css_variables_prefix, var_name), color - ) + css_src = css_src.replace("var(--{}{})".format(theme.css_variables_prefix, var_name), color) print(css_src) diff --git a/colorschemes/setvtrgb.txt.py b/colorschemes/setvtrgb.txt.py index 8a8f117..99432e3 100755 --- a/colorschemes/setvtrgb.txt.py +++ b/colorschemes/setvtrgb.txt.py @@ -8,11 +8,4 @@ import _theme as theme # 0,0,0,0,170,170,170,170,85,85,85,85,255,255,255,255 for i in range(3): - print( - ",".join( - [ - str(int(color[2 * i + 1 : 2 * i + 3], 16)) - for color in theme.ansi_colors[:16] - ] - ) - ) + print(",".join([str(int(color[2 * i + 1:2 * i + 3], 16)) for color in theme.ansi_colors[:16]])) diff --git a/colorschemes/variables.css.py b/colorschemes/variables.css.py index 64c4609..4ed4c1c 100755 --- a/colorschemes/variables.css.py +++ b/colorschemes/variables.css.py @@ -2,6 +2,7 @@ import _theme as theme + print(":root {") for var_name, color in theme.css_variables.items(): print(" --{}{}: {};".format(theme.css_variables_prefix, var_name, color)) diff --git a/colorschemes/vim.vim.py b/colorschemes/vim.vim.py index bba2493..0f138d4 100755 --- a/colorschemes/vim.vim.py +++ b/colorschemes/vim.vim.py @@ -2,6 +2,7 @@ import _theme as theme + print("let dotfiles_colorscheme_name = '{}'".format(theme.name)) print("let dotfiles_colorscheme_base16_name = '{}'".format(theme.base16_name)) print("let dotfiles_colorscheme_base16_colors = [") diff --git a/colorschemes/vscode-colorCustomizations.json.py b/colorschemes/vscode-colorCustomizations.json.py index d139834..8832f92 100755 --- a/colorschemes/vscode-colorCustomizations.json.py +++ b/colorschemes/vscode-colorCustomizations.json.py @@ -25,11 +25,7 @@ colors = { for color_brightness in [False, True]: for color_index, color_name in enumerate(ANSI_COLOR_NAMES): - color = theme.ansi_colors[ - color_index + int(color_brightness) * len(ANSI_COLOR_NAMES) - ] - colors[ - "terminal.ansi" + ("Bright" if color_brightness else "") + color_name - ] = color + color = theme.ansi_colors[color_index + int(color_brightness) * len(ANSI_COLOR_NAMES)] + colors["terminal.ansi" + ("Bright" if color_brightness else "") + color_name] = color print(json.dumps(colors, ensure_ascii=False, indent=2)) diff --git a/colorschemes/xfce4-terminal.theme.py b/colorschemes/xfce4-terminal.theme.py index 5775160..3b5f71e 100755 --- a/colorschemes/xfce4-terminal.theme.py +++ b/colorschemes/xfce4-terminal.theme.py @@ -2,6 +2,7 @@ import _theme as theme + print("[Scheme]") print("Name=dmitmel's dotfiles colorscheme") print("ColorForeground={}".format(theme.fg)) diff --git a/colorschemes/zsh.zsh.py b/colorschemes/zsh.zsh.py index 96c73af..bc5c031 100755 --- a/colorschemes/zsh.zsh.py +++ b/colorschemes/zsh.zsh.py @@ -2,7 +2,6 @@ import _theme as theme - for attr in [ "bg", "fg", diff --git a/nvim/coc-languages/python.vim b/nvim/coc-languages/python.vim index ff6cd12..a23c440 100644 --- a/nvim/coc-languages/python.vim +++ b/nvim/coc-languages/python.vim @@ -1,12 +1,24 @@ let g:coc_global_extensions += ['coc-pyright'] let g:coc_filetypes += ['python'] -" let g:coc_user_config['pyls.plugins.pycodestyle.ignore'] = ['E501'] + +let s:ignored_errors = [] +" Indent is not a multiple of 4 +let s:ignored_errors += ['E111'] +" Indent is not a multiple of 4 for comments +let s:ignored_errors += ['E114'] +" Line too long +let s:ignored_errors += ['E501'] + +" let g:coc_user_config['pyls.plugins.pycodestyle.ignore'] = s:ignored_errors " let g:coc_user_config['python.autocomplete.showAdvancedMembers'] = v:false let g:coc_user_config['python'] = { -\ 'formatting': { 'provider': 'black' }, +\ 'formatting': { +\ 'provider': 'yapf', +\ 'yapfArgs': ['--style=' . simplify(g:nvim_dotfiles_dir.'/../python/yapf.ini')] +\ }, \ 'linting': { \ 'pylintEnabled': v:false, \ 'flake8Enabled': v:true, -\ 'flake8Args': ['--ignore', 'E501'], +\ 'flake8Args': ['--ignore=' . join(s:ignored_errors, ',')], \ }, \ } diff --git a/python/yapf.ini b/python/yapf.ini new file mode 100644 index 0000000..fca5143 --- /dev/null +++ b/python/yapf.ini @@ -0,0 +1,8 @@ +[style] +based_on_style = google +column_limit = 99 +indent_width = 4 +blank_lines_between_top_level_imports_and_variables = 2 +dedent_closing_brackets = true +coalesce_brackets = true +spaces_around_power_operator = true diff --git a/script-resources/common_script_utils.py b/script-resources/common_script_utils.py index fa23b02..981a488 100644 --- a/script-resources/common_script_utils.py +++ b/script-resources/common_script_utils.py @@ -4,7 +4,6 @@ import subprocess from pathlib import Path from typing import Iterable, NoReturn - if os.name == "posix": DOTFILES_CONFIG_DIR: Path = Path.home() / ".config" / "dotfiles" DOTFILES_CACHE_DIR: Path = Path.home() / ".cache" / "dotfiles" @@ -14,9 +13,7 @@ def platform_not_supported_error() -> NoReturn: raise Exception("platform '{}' is not supported!".format(sys.platform)) -def run_chooser( - choices: Iterable[str], prompt: str = None, async_read: bool = False -) -> int: +def run_chooser(choices: Iterable[str], prompt: str = None, async_read: bool = False) -> int: supports_result_index = True if os.isatty(sys.stderr.fileno()): process_args = [ @@ -38,9 +35,7 @@ def run_chooser( else: platform_not_supported_error() - chooser_process = subprocess.Popen( - process_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE - ) + chooser_process = subprocess.Popen(process_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE) with chooser_process.stdin as pipe: for index, choice in enumerate(choices): diff --git a/script-resources/welcome/colors.py b/script-resources/welcome/colors.py index b32d782..cb05872 100644 --- a/script-resources/welcome/colors.py +++ b/script-resources/welcome/colors.py @@ -1,5 +1,6 @@ from colorama import Fore, Style, ansi + COLORS = [ansi.code_to_chars(30 + color_index) for color_index in range(0, 8)] diff --git a/script-resources/welcome/main.py b/script-resources/welcome/main.py index 40e9c42..7f0c9ee 100755 --- a/script-resources/welcome/main.py +++ b/script-resources/welcome/main.py @@ -5,6 +5,7 @@ import re from colors import COLORS, Style from system_info import get_system_info + print("") logo_lines, info_lines = get_system_info() diff --git a/script-resources/welcome/system_info.py b/script-resources/welcome/system_info.py index d840055..df4b81c 100644 --- a/script-resources/welcome/system_info.py +++ b/script-resources/welcome/system_info.py @@ -94,9 +94,7 @@ def _get_users(): terminals = users[name] colored_name = bright_colored(name, Fore.BLUE) - colored_terminals = [ - colored(str(term), Style.DIM, Fore.WHITE) for term in terminals - ] + colored_terminals = [colored(str(term), Style.DIM, Fore.WHITE) for term in terminals] terminals_str = ", ".join(colored_terminals) if len(colored_terminals) > 1: @@ -140,14 +138,12 @@ def _get_disks(): continue usage = psutil.disk_usage(disk.mountpoint) - result.append( - ( - disk.mountpoint, - humanize_bytes(usage.used), - humanize_bytes(usage.total), - colorize_percent(usage.percent, warning=70, critical=85), - ) - ) + result.append(( + disk.mountpoint, + humanize_bytes(usage.used), + humanize_bytes(usage.total), + colorize_percent(usage.percent, warning=70, critical=85), + )) return result From dbd76019c896cc8efd52f87d353ea1f5e7bb3273 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 26 Apr 2021 10:11:02 +0300 Subject: [PATCH 565/713] at long last, reformat all Python code with 2 space indents --- colorschemes/_theme.py | 48 ++-- colorschemes/iterm.itermcolors.py | 12 +- colorschemes/kitty.conf.py | 4 +- colorschemes/prismjs-theme.css.py | 4 +- colorschemes/setvtrgb.txt.py | 2 +- colorschemes/termux.properties.py | 4 +- colorschemes/variables.css.py | 2 +- colorschemes/vim.vim.py | 6 +- .../vscode-colorCustomizations.json.py | 32 +-- colorschemes/zsh.zsh.py | 20 +- nvim/coc-languages/python.vim | 2 + python/yapf.ini | 3 +- script-resources/common_script_utils.py | 136 ++++----- script-resources/factorio/property_tree.py | 74 ++--- script-resources/pycalc_startup.py | 38 +-- script-resources/welcome/colors.py | 14 +- script-resources/welcome/humanize.py | 48 ++-- script-resources/welcome/main.py | 26 +- script-resources/welcome/system_info.py | 258 +++++++++--------- 19 files changed, 367 insertions(+), 366 deletions(-) diff --git a/colorschemes/_theme.py b/colorschemes/_theme.py index 1695bdc..644f440 100644 --- a/colorschemes/_theme.py +++ b/colorschemes/_theme.py @@ -4,22 +4,22 @@ base16_name = "eighties" name = "base16-" + base16_name base16_colors = [ - "#2d2d2d", # 0 - "#393939", # 1 - "#515151", # 2 - "#747369", # 3 - "#a09f93", # 4 - "#d3d0c8", # 5 - "#e8e6df", # 6 - "#f2f0ec", # 7 - "#f2777a", # 8 - "#f99157", # 9 - "#ffcc66", # a - "#99cc99", # b - "#66cccc", # c - "#6699cc", # d - "#cc99cc", # e - "#d27b53", # f + "#2d2d2d", # 0 + "#393939", # 1 + "#515151", # 2 + "#747369", # 3 + "#a09f93", # 4 + "#d3d0c8", # 5 + "#e8e6df", # 6 + "#f2f0ec", # 7 + "#f2777a", # 8 + "#f99157", # 9 + "#ffcc66", # a + "#99cc99", # b + "#66cccc", # c + "#6699cc", # d + "#cc99cc", # e + "#d27b53", # f ] bg = base16_colors[0x0] @@ -32,18 +32,18 @@ selection_bg = base16_colors[0x2] selection_fg = fg ansi_colors = [ - base16_colors[int(i, 16)] for i in "0 8 B A D E C 5 3 8 B A D E C 7 9 F 1 2 4 6".split() + base16_colors[int(i, 16)] for i in "0 8 B A D E C 5 3 8 B A D E C 7 9 F 1 2 4 6".split() ] link_color = ansi_colors[0xC] css_variables_prefix = "dotfiles-colorscheme-" css_variables = { - "bg": bg, - "fg": fg, - "selection-bg": selection_bg, - "selection-fg": selection_fg, - "cursor-bg": cursor_bg, - "cursor-fg": cursor_fg, - **{"base-{:02X}".format(index): color for index, color in enumerate(base16_colors)}, + "bg": bg, + "fg": fg, + "selection-bg": selection_bg, + "selection-fg": selection_fg, + "cursor-bg": cursor_bg, + "cursor-fg": cursor_fg, + **{"base-{:02X}".format(index): color for index, color in enumerate(base16_colors)}, } diff --git a/colorschemes/iterm.itermcolors.py b/colorschemes/iterm.itermcolors.py index 622d3ec..8cd59e5 100755 --- a/colorschemes/iterm.itermcolors.py +++ b/colorschemes/iterm.itermcolors.py @@ -4,7 +4,7 @@ import _theme as theme print( - """\ + """\ @@ -14,9 +14,9 @@ print( def print_color(key_name, color): - r, g, b = [float(int(color[2 * i + 1:2 * i + 3], 16)) / 255 for i in range(3)] - print( - """\ + r, g, b = [float(int(color[2 * i + 1:2 * i + 3], 16)) / 255 for i in range(3)] + print( + """\ {} Color Color Space @@ -29,7 +29,7 @@ def print_color(key_name, color): {} \ """.format(key_name, r, g, b) - ) + ) print_color("Background", theme.bg) @@ -40,7 +40,7 @@ print_color("Cursor Text", theme.cursor_fg) print_color("Selection Color", theme.selection_bg) print_color("Selected Text Color", theme.selection_fg) for index, color in enumerate(theme.ansi_colors[:16]): - print_color("Ansi " + str(index), color) + print_color("Ansi " + str(index), color) print_color("Link", theme.link_color) print("""\ diff --git a/colorschemes/kitty.conf.py b/colorschemes/kitty.conf.py index a82df90..81544aa 100755 --- a/colorschemes/kitty.conf.py +++ b/colorschemes/kitty.conf.py @@ -4,7 +4,7 @@ import _theme as theme def print_color(key_name, color): - print("{} {}".format(key_name, color)) + print("{} {}".format(key_name, color)) print_color("background", theme.bg) @@ -14,7 +14,7 @@ print_color("cursor_text_color", theme.cursor_fg) print_color("selection_background", theme.selection_bg) print_color("selection_foreground", theme.selection_fg) for index, color in enumerate(theme.ansi_colors[:16]): - print_color("color" + str(index), color) + print_color("color" + str(index), color) print_color("url_color", theme.link_color) print_color("active_border_color", theme.ansi_colors[2]) diff --git a/colorschemes/prismjs-theme.css.py b/colorschemes/prismjs-theme.css.py index ba5cdf5..924f81d 100755 --- a/colorschemes/prismjs-theme.css.py +++ b/colorschemes/prismjs-theme.css.py @@ -4,9 +4,9 @@ import _theme as theme import os with open(os.path.join(os.path.dirname(__file__), "prismjs-theme-src.css")) as f: - css_src = f.read() + css_src = f.read() for var_name, color in theme.css_variables.items(): - css_src = css_src.replace("var(--{}{})".format(theme.css_variables_prefix, var_name), color) + css_src = css_src.replace("var(--{}{})".format(theme.css_variables_prefix, var_name), color) print(css_src) diff --git a/colorschemes/setvtrgb.txt.py b/colorschemes/setvtrgb.txt.py index 99432e3..9dfb27f 100755 --- a/colorschemes/setvtrgb.txt.py +++ b/colorschemes/setvtrgb.txt.py @@ -8,4 +8,4 @@ import _theme as theme # 0,0,0,0,170,170,170,170,85,85,85,85,255,255,255,255 for i in range(3): - print(",".join([str(int(color[2 * i + 1:2 * i + 3], 16)) for color in theme.ansi_colors[:16]])) + print(",".join([str(int(color[2 * i + 1:2 * i + 3], 16)) for color in theme.ansi_colors[:16]])) diff --git a/colorschemes/termux.properties.py b/colorschemes/termux.properties.py index 164df7a..e6843ff 100755 --- a/colorschemes/termux.properties.py +++ b/colorschemes/termux.properties.py @@ -4,11 +4,11 @@ import _theme as theme def print_color(key_name, color): - print("{}={}".format(key_name, color)) + print("{}={}".format(key_name, color)) print_color("background", theme.bg) print_color("foreground", theme.fg) print_color("cursor", theme.cursor_bg) for index, color in enumerate(theme.ansi_colors[:16]): - print_color("color" + str(index), color) + print_color("color" + str(index), color) diff --git a/colorschemes/variables.css.py b/colorschemes/variables.css.py index 4ed4c1c..2338a6f 100755 --- a/colorschemes/variables.css.py +++ b/colorschemes/variables.css.py @@ -5,5 +5,5 @@ import _theme as theme print(":root {") for var_name, color in theme.css_variables.items(): - print(" --{}{}: {};".format(theme.css_variables_prefix, var_name, color)) + print(" --{}{}: {};".format(theme.css_variables_prefix, var_name, color)) print("}") diff --git a/colorschemes/vim.vim.py b/colorschemes/vim.vim.py index 0f138d4..38dfed0 100755 --- a/colorschemes/vim.vim.py +++ b/colorschemes/vim.vim.py @@ -8,15 +8,15 @@ print("let dotfiles_colorscheme_base16_name = '{}'".format(theme.base16_name)) print("let dotfiles_colorscheme_base16_colors = [") gui_to_cterm_mapping = [0, 18, 19, 8, 20, 7, 21, 15, 1, 16, 3, 2, 6, 4, 5, 17] for colors_pair in zip(theme.base16_colors[:16], gui_to_cterm_mapping): - print("\\ {{'gui': '{}', 'cterm': '{:>02}'}},".format(*colors_pair)) + print("\\ {{'gui': '{}', 'cterm': '{:>02}'}},".format(*colors_pair)) print("\\ ]") def print_terminal_color(key_name, color): - print("let terminal_color_{} = '{}'".format(key_name, color)) + print("let terminal_color_{} = '{}'".format(key_name, color)) print_terminal_color("background", theme.bg) print_terminal_color("foreground", theme.fg) for index, color in enumerate(theme.ansi_colors[:16]): - print_terminal_color(str(index), color) + print_terminal_color(str(index), color) diff --git a/colorschemes/vscode-colorCustomizations.json.py b/colorschemes/vscode-colorCustomizations.json.py index 8832f92..ed1b1dc 100755 --- a/colorschemes/vscode-colorCustomizations.json.py +++ b/colorschemes/vscode-colorCustomizations.json.py @@ -5,27 +5,27 @@ import json ANSI_COLOR_NAMES = [ - "Black", - "Red", - "Green", - "Yellow", - "Blue", - "Magenta", - "Cyan", - "White", + "Black", + "Red", + "Green", + "Yellow", + "Blue", + "Magenta", + "Cyan", + "White", ] colors = { - "terminal.background": theme.bg, - "terminal.foreground": theme.fg, - "terminal.selectionBackground": theme.selection_bg, - "terminalCursor.background": theme.cursor_fg, - "terminalCursor.foreground": theme.cursor_bg, + "terminal.background": theme.bg, + "terminal.foreground": theme.fg, + "terminal.selectionBackground": theme.selection_bg, + "terminalCursor.background": theme.cursor_fg, + "terminalCursor.foreground": theme.cursor_bg, } for color_brightness in [False, True]: - for color_index, color_name in enumerate(ANSI_COLOR_NAMES): - color = theme.ansi_colors[color_index + int(color_brightness) * len(ANSI_COLOR_NAMES)] - colors["terminal.ansi" + ("Bright" if color_brightness else "") + color_name] = color + for color_index, color_name in enumerate(ANSI_COLOR_NAMES): + color = theme.ansi_colors[color_index + int(color_brightness) * len(ANSI_COLOR_NAMES)] + colors["terminal.ansi" + ("Bright" if color_brightness else "") + color_name] = color print(json.dumps(colors, ensure_ascii=False, indent=2)) diff --git a/colorschemes/zsh.zsh.py b/colorschemes/zsh.zsh.py index bc5c031..5a32295 100755 --- a/colorschemes/zsh.zsh.py +++ b/colorschemes/zsh.zsh.py @@ -3,17 +3,17 @@ import _theme as theme for attr in [ - "bg", - "fg", - "cursor_bg", - "cursor_fg", - "selection_bg", - "selection_fg", - "link_color", + "bg", + "fg", + "cursor_bg", + "cursor_fg", + "selection_bg", + "selection_fg", + "link_color", ]: - color = getattr(theme, attr) - print("colorscheme_{}={}".format(attr, color[1:])) + color = getattr(theme, attr) + print("colorscheme_{}={}".format(attr, color[1:])) print("colorscheme_ansi_colors=(") for color in theme.ansi_colors: - print(" {}".format(color[1:])) + print(" {}".format(color[1:])) print(")") diff --git a/nvim/coc-languages/python.vim b/nvim/coc-languages/python.vim index a23c440..1f0037d 100644 --- a/nvim/coc-languages/python.vim +++ b/nvim/coc-languages/python.vim @@ -6,6 +6,8 @@ let s:ignored_errors = [] let s:ignored_errors += ['E111'] " Indent is not a multiple of 4 for comments let s:ignored_errors += ['E114'] +" Indent for continuation lines is smaller than expected +let s:ignored_errors += ['E121'] " Line too long let s:ignored_errors += ['E501'] diff --git a/python/yapf.ini b/python/yapf.ini index fca5143..e4ceea7 100644 --- a/python/yapf.ini +++ b/python/yapf.ini @@ -1,7 +1,8 @@ [style] based_on_style = google column_limit = 99 -indent_width = 4 +indent_width = 2 +continuation_indent_width = 2 blank_lines_between_top_level_imports_and_variables = 2 dedent_closing_brackets = true coalesce_brackets = true diff --git a/script-resources/common_script_utils.py b/script-resources/common_script_utils.py index 981a488..239eb11 100644 --- a/script-resources/common_script_utils.py +++ b/script-resources/common_script_utils.py @@ -5,89 +5,89 @@ from pathlib import Path from typing import Iterable, NoReturn if os.name == "posix": - DOTFILES_CONFIG_DIR: Path = Path.home() / ".config" / "dotfiles" - DOTFILES_CACHE_DIR: Path = Path.home() / ".cache" / "dotfiles" + DOTFILES_CONFIG_DIR: Path = Path.home() / ".config" / "dotfiles" + DOTFILES_CACHE_DIR: Path = Path.home() / ".cache" / "dotfiles" def platform_not_supported_error() -> NoReturn: - raise Exception("platform '{}' is not supported!".format(sys.platform)) + raise Exception("platform '{}' is not supported!".format(sys.platform)) def run_chooser(choices: Iterable[str], prompt: str = None, async_read: bool = False) -> int: - supports_result_index = True - if os.isatty(sys.stderr.fileno()): - process_args = [ - "fzf", - "--with-nth=2..", - "--height=50%", - "--reverse", - "--tiebreak=index", - ] - supports_result_index = False - elif sys.platform == "darwin": - process_args = ["choose", "-i"] - elif os.name == "posix": - process_args = ["rofi", "-dmenu", "-i", "-format", "i"] - if prompt is not None: - process_args += ["-p", prompt] - if async_read: - process_args += ["-async-pre-read", "0"] - else: - platform_not_supported_error() + supports_result_index = True + if os.isatty(sys.stderr.fileno()): + process_args = [ + "fzf", + "--with-nth=2..", + "--height=50%", + "--reverse", + "--tiebreak=index", + ] + supports_result_index = False + elif sys.platform == "darwin": + process_args = ["choose", "-i"] + elif os.name == "posix": + process_args = ["rofi", "-dmenu", "-i", "-format", "i"] + if prompt is not None: + process_args += ["-p", prompt] + if async_read: + process_args += ["-async-pre-read", "0"] + else: + platform_not_supported_error() - chooser_process = subprocess.Popen(process_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + chooser_process = subprocess.Popen(process_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE) - with chooser_process.stdin as pipe: - for index, choice in enumerate(choices): - assert "\n" not in choice - if not supports_result_index: - pipe.write(str(index).encode()) - pipe.write(b" ") - pipe.write(choice.encode()) - pipe.write(b"\n") + with chooser_process.stdin as pipe: + for index, choice in enumerate(choices): + assert "\n" not in choice + if not supports_result_index: + pipe.write(str(index).encode()) + pipe.write(b" ") + pipe.write(choice.encode()) + pipe.write(b"\n") - exit_code: int = chooser_process.wait() - if exit_code != 0: - raise Exception("chooser process failed with exit code {}".format(exit_code)) + exit_code: int = chooser_process.wait() + if exit_code != 0: + raise Exception("chooser process failed with exit code {}".format(exit_code)) - chosen_index = int(chooser_process.stdout.read().strip().split()[0]) - return chosen_index + chosen_index = int(chooser_process.stdout.read().strip().split()[0]) + return chosen_index def send_notification(title: str, message: str, url: str = None) -> None: - if sys.platform == "darwin": - process_args = [ - "terminal-notifier", - "-title", - title, - "-message", - message, - "-open", - ] - if url is not None: - process_args += [url] - elif os.name == "posix": - process_args = [ - "notify-send", - "--icon=utilities-terminal", - "--expire-time=3000", - title, - message, - ] - else: - platform_not_supported_error() + if sys.platform == "darwin": + process_args = [ + "terminal-notifier", + "-title", + title, + "-message", + message, + "-open", + ] + if url is not None: + process_args += [url] + elif os.name == "posix": + process_args = [ + "notify-send", + "--icon=utilities-terminal", + "--expire-time=3000", + title, + message, + ] + else: + platform_not_supported_error() - subprocess.run(process_args, check=True) + subprocess.run(process_args, check=True) def set_clipboard(text: str) -> None: - # TODO: somehow merge program selection with the logic in `zsh/functions.zsh` - if sys.platform == "darwin": - process_args = ["pbcopy"] - elif os.name == "posix": - process_args = ["xsel", "--clipboard", "--input"] - # process_args = ["xclip", "-in", "-selection", "clipboard"] - else: - platform_not_supported_error() + # TODO: somehow merge program selection with the logic in `zsh/functions.zsh` + if sys.platform == "darwin": + process_args = ["pbcopy"] + elif os.name == "posix": + process_args = ["xsel", "--clipboard", "--input"] + # process_args = ["xclip", "-in", "-selection", "clipboard"] + else: + platform_not_supported_error() - subprocess.run(process_args, input=text.encode(), check=True) + subprocess.run(process_args, input=text.encode(), check=True) diff --git a/script-resources/factorio/property_tree.py b/script-resources/factorio/property_tree.py index 9275ff4..24f921c 100644 --- a/script-resources/factorio/property_tree.py +++ b/script-resources/factorio/property_tree.py @@ -9,58 +9,58 @@ from typing import Any, IO def read_bool(buf: IO[bytes]) -> bool: - return buf.read(1)[0] == 1 + return buf.read(1)[0] == 1 def read_number(buf: IO[bytes]) -> float: - return struct.unpack(" int: - return struct.unpack(" str: - is_empty = read_bool(buf) - if is_empty: - return "" - len_ = buf.read(1)[0] - if len_ == 0xFF: - len_ = _read_length(buf) - return buf.read(len_).decode("utf8") + is_empty = read_bool(buf) + if is_empty: + return "" + len_ = buf.read(1)[0] + if len_ == 0xFF: + len_ = _read_length(buf) + return buf.read(len_).decode("utf8") def read_dictionary(buf: IO[bytes]) -> dict[str, Any]: - len_ = _read_length(buf) - value: dict[str, Any] = {} - for _ in range(len_): - key = read_string(buf) - value[key] = read(buf) - return value + len_ = _read_length(buf) + value: dict[str, Any] = {} + for _ in range(len_): + key = read_string(buf) + value[key] = read(buf) + return value def read_list(buf: IO[bytes]) -> list[Any]: - len_ = _read_length(buf) - value: list[Any] = [] - for _ in range(len_): - read_string(buf) - value.append(read(buf)) - return value + len_ = _read_length(buf) + value: list[Any] = [] + for _ in range(len_): + read_string(buf) + value.append(read(buf)) + return value def read(buf: IO[bytes]) -> Any: - type_, _any_type_flag = buf.read(2) - if type_ == 0: - return None - elif type_ == 1: - return read_bool(buf) - elif type_ == 2: - return read_number(buf) - elif type_ == 3: - return read_string(buf) - elif type_ == 4: - return read_list(buf) - elif type_ == 5: - return read_dictionary(buf) - else: - raise Exception("unknown property tree type 0x{:02x}".format(type_)) + type_, _any_type_flag = buf.read(2) + if type_ == 0: + return None + elif type_ == 1: + return read_bool(buf) + elif type_ == 2: + return read_number(buf) + elif type_ == 3: + return read_string(buf) + elif type_ == 4: + return read_list(buf) + elif type_ == 5: + return read_dictionary(buf) + else: + raise Exception("unknown property tree type 0x{:02x}".format(type_)) diff --git a/script-resources/pycalc_startup.py b/script-resources/pycalc_startup.py index 6aab338..1ffb1b2 100644 --- a/script-resources/pycalc_startup.py +++ b/script-resources/pycalc_startup.py @@ -3,29 +3,29 @@ from fractions import Fraction def factors(n): - result = set() - for i in range(1, int(sqrt(n)) + 1): - if n % i == 0: - result.add(i) - result.add(n // i) - return result + result = set() + for i in range(1, int(sqrt(n)) + 1): + if n % i == 0: + result.add(i) + result.add(n // i) + return result def solve_quadratic(a, b, c): - if a == 0: - raise Exception("not a quadratic equation") + if a == 0: + raise Exception("not a quadratic equation") + else: + d = b ** 2 - 4 * a * c + print("D = " + str(d)) + if d < 0: + print("no solutions") + elif d > 0: + sd = sqrt(d) + print("sqrt(D) = " + str(sd)) + print("x1 = " + str((-b + sd) / (2 * a))) + print("x2 = " + str((-b - sd) / (2 * a))) else: - d = b ** 2 - 4 * a * c - print("D = " + str(d)) - if d < 0: - print("no solutions") - elif d > 0: - sd = sqrt(d) - print("sqrt(D) = " + str(sd)) - print("x1 = " + str((-b + sd) / (2 * a))) - print("x2 = " + str((-b - sd) / (2 * a))) - else: - print("x = " + str(-b / (2 * a))) + print("x = " + str(-b / (2 * a))) print("loaded Python calculator") diff --git a/script-resources/welcome/colors.py b/script-resources/welcome/colors.py index cb05872..a835612 100644 --- a/script-resources/welcome/colors.py +++ b/script-resources/welcome/colors.py @@ -5,18 +5,18 @@ COLORS = [ansi.code_to_chars(30 + color_index) for color_index in range(0, 8)] def colored(string, *colors): - return "".join(colors + (string, Style.RESET_ALL)) + return "".join(colors + (string, Style.RESET_ALL)) def bright_colored(string, *colors): - return "".join(colors + (Style.BRIGHT, string, Style.RESET_ALL)) + return "".join(colors + (Style.BRIGHT, string, Style.RESET_ALL)) def colorize_percent(percent, warning, critical, inverse=False): - COLORS = [Fore.GREEN, Fore.YELLOW, Fore.RED] + COLORS = [Fore.GREEN, Fore.YELLOW, Fore.RED] - color_index = 0 if percent < warning else 1 if percent < critical else 2 - if inverse: - color_index = 2 - color_index + color_index = 0 if percent < warning else 1 if percent < critical else 2 + if inverse: + color_index = 2 - color_index - return colored("%.2f%%" % percent, COLORS[color_index]) + return colored("%.2f%%" % percent, COLORS[color_index]) diff --git a/script-resources/welcome/humanize.py b/script-resources/welcome/humanize.py index ac7c7fb..9631a9c 100644 --- a/script-resources/welcome/humanize.py +++ b/script-resources/welcome/humanize.py @@ -1,34 +1,34 @@ def humanize_timedelta(timedelta): - result = [] + result = [] - days = timedelta.days - mm, ss = divmod(timedelta.seconds, 60) - hh, mm = divmod(mm, 60) + days = timedelta.days + mm, ss = divmod(timedelta.seconds, 60) + hh, mm = divmod(mm, 60) - def plural(n): - return n, "s" if abs(n) != 1 else "" + def plural(n): + return n, "s" if abs(n) != 1 else "" - if days > 0: - result.append("%d day%s" % plural(days)) - if hh > 0 or result: - result.append("%d hour%s" % plural(hh)) - if mm > 0 or result: - result.append("%d min%s" % plural(mm)) - if len(result) <= 1: - result.append("%d sec%s" % plural(ss)) + if days > 0: + result.append("%d day%s" % plural(days)) + if hh > 0 or result: + result.append("%d hour%s" % plural(hh)) + if mm > 0 or result: + result.append("%d min%s" % plural(mm)) + if len(result) <= 1: + result.append("%d sec%s" % plural(ss)) - return ", ".join(result) + return ", ".join(result) def humanize_bytes(bytes): - units = ["B", "kB", "MB", "GB"] + units = ["B", "kB", "MB", "GB"] - factor = 1 - unit = "" - for unit in units: - next_factor = factor << 10 - if bytes < next_factor: - break - factor = next_factor + factor = 1 + unit = "" + for unit in units: + next_factor = factor << 10 + if bytes < next_factor: + break + factor = next_factor - return "%.2f %s" % (float(bytes) / factor, unit) + return "%.2f %s" % (float(bytes) / factor, unit) diff --git a/script-resources/welcome/main.py b/script-resources/welcome/main.py index 7f0c9ee..6eb37f7 100755 --- a/script-resources/welcome/main.py +++ b/script-resources/welcome/main.py @@ -13,24 +13,24 @@ logo_line_widths = [len(re.sub(r"{\d}", "", line)) for line in logo_lines] logo_width = max(logo_line_widths) for line_index in range(0, max(len(logo_lines), len(info_lines))): - line = "" + line = "" - logo_line_width = 0 + logo_line_width = 0 - if line_index < len(logo_lines): - logo_line = logo_lines[line_index] - logo_line_width = logo_line_widths[line_index] + if line_index < len(logo_lines): + logo_line = logo_lines[line_index] + logo_line_width = logo_line_widths[line_index] - line += Style.BRIGHT - line += logo_line.format(*COLORS) - line += Style.RESET_ALL + line += Style.BRIGHT + line += logo_line.format(*COLORS) + line += Style.RESET_ALL - line += " " * (logo_width - logo_line_width + 3) + line += " " * (logo_width - logo_line_width + 3) - if line_index < len(info_lines): - info_line = info_lines[line_index] - line += info_line + if line_index < len(info_lines): + info_line = info_lines[line_index] + line += info_line - print(line) + print(line) print("") diff --git a/script-resources/welcome/system_info.py b/script-resources/welcome/system_info.py index df4b81c..9d72ded 100644 --- a/script-resources/welcome/system_info.py +++ b/script-resources/welcome/system_info.py @@ -11,202 +11,200 @@ from humanize import humanize_bytes, humanize_timedelta def get_system_info(): - info_lines = [] + info_lines = [] - def info(name, value, *format_args): - line = bright_colored(name + ":", Fore.YELLOW) + " " + value - if format_args: - line = line % format_args - info_lines.append(line) + def info(name, value, *format_args): + line = bright_colored(name + ":", Fore.YELLOW) + " " + value + if format_args: + line = line % format_args + info_lines.append(line) - username = getuser() - hostname = _get_hostname() + username = getuser() + hostname = _get_hostname() - info_lines.append( - bright_colored(username, Fore.BLUE) + "@" + bright_colored(hostname, Fore.RED) - ) - info_lines.append("") + info_lines.append(bright_colored(username, Fore.BLUE) + "@" + bright_colored(hostname, Fore.RED)) + info_lines.append("") - distro_id, distro_name, distro_version, distro_codename = _get_distro_info() - info("OS", " ".join([distro_name, distro_version, distro_codename])) + distro_id, distro_name, distro_version, distro_codename = _get_distro_info() + info("OS", " ".join([distro_name, distro_version, distro_codename])) - logo_path = os.path.join(os.path.dirname(__file__), "logos", distro_id) - with open(logo_path) as logo_file: - logo_lines = logo_file.read().splitlines() + logo_path = os.path.join(os.path.dirname(__file__), "logos", distro_id) + with open(logo_path) as logo_file: + logo_lines = logo_file.read().splitlines() - info("Kernel", "%s %s", platform.system(), platform.release()) + info("Kernel", "%s %s", platform.system(), platform.release()) - info("Uptime", humanize_timedelta(_get_uptime())) + info("Uptime", humanize_timedelta(_get_uptime())) - users_info = _get_users() - if users_info: - info("Users", users_info) + users_info = _get_users() + if users_info: + info("Users", users_info) - shell = _get_shell() - if shell is not None: - info("Shell", shell) + shell = _get_shell() + if shell is not None: + info("Shell", shell) - info_lines.append("") + info_lines.append("") - cpu_usage_info = _get_cpu_usage() - if cpu_usage_info is not None: - info("CPU Usage", "%s", cpu_usage_info) - info("Memory", "%s / %s (%s)", *_get_memory()) + cpu_usage_info = _get_cpu_usage() + if cpu_usage_info is not None: + info("CPU Usage", "%s", cpu_usage_info) + info("Memory", "%s / %s (%s)", *_get_memory()) - for disk_info in _get_disks(): - info("Disk (%s)", "%s / %s (%s)", *disk_info) + for disk_info in _get_disks(): + info("Disk (%s)", "%s / %s (%s)", *disk_info) - battery_info = _get_battery() - if battery_info is not None: - info("Battery", "%s (%s)", *battery_info) + battery_info = _get_battery() + if battery_info is not None: + info("Battery", "%s (%s)", *battery_info) - info_lines.append("") + info_lines.append("") - for local_ip_address in _get_local_ipv4_addresses(): - info("Local IPv4 Address (%s)", "%s", *local_ip_address) + for local_ip_address in _get_local_ipv4_addresses(): + info("Local IPv4 Address (%s)", "%s", *local_ip_address) - return logo_lines, info_lines + return logo_lines, info_lines def _get_hostname(): - hostname = socket.gethostname() - return hostname + hostname = socket.gethostname() + return hostname def _get_uptime(): - return datetime.now() - datetime.fromtimestamp(psutil.boot_time()) + return datetime.now() - datetime.fromtimestamp(psutil.boot_time()) def _get_users(): - users = {} + users = {} - for user in psutil.users(): - name = user.name - terminal = user.terminal - if name in users: - users[name].append(terminal) - else: - users[name] = [terminal] + for user in psutil.users(): + name = user.name + terminal = user.terminal + if name in users: + users[name].append(terminal) + else: + users[name] = [terminal] - result = [] + result = [] - for name in users: - terminals = users[name] + for name in users: + terminals = users[name] - colored_name = bright_colored(name, Fore.BLUE) - colored_terminals = [colored(str(term), Style.DIM, Fore.WHITE) for term in terminals] + colored_name = bright_colored(name, Fore.BLUE) + colored_terminals = [colored(str(term), Style.DIM, Fore.WHITE) for term in terminals] - terminals_str = ", ".join(colored_terminals) - if len(colored_terminals) > 1: - terminals_str = "(%s)" % terminals_str - result.append(colored_name + "@" + terminals_str) + terminals_str = ", ".join(colored_terminals) + if len(colored_terminals) > 1: + terminals_str = "(%s)" % terminals_str + result.append(colored_name + "@" + terminals_str) - return ", ".join(result) + return ", ".join(result) def _get_shell(): - return os.environ.get("SHELL") + return os.environ.get("SHELL") def _get_cpu_usage(): - try: - percent = psutil.cpu_percent() - except Exception as e: - print("Error in _get_cpu_usage:", e) - return None + try: + percent = psutil.cpu_percent() + except Exception as e: + print("Error in _get_cpu_usage:", e) + return None - return colorize_percent(percent, warning=60, critical=80) + return colorize_percent(percent, warning=60, critical=80) def _get_memory(): - memory = psutil.virtual_memory() - return ( - humanize_bytes(memory.used), - humanize_bytes(memory.total), - colorize_percent(memory.percent, warning=60, critical=80), - ) + memory = psutil.virtual_memory() + return ( + humanize_bytes(memory.used), + humanize_bytes(memory.total), + colorize_percent(memory.percent, warning=60, critical=80), + ) def _get_disks(): - result = [] + result = [] - for disk in psutil.disk_partitions(all=False): - if psutil.WINDOWS and ("cdrom" in disk.opts or disk.fstype == ""): - # skip cd-rom drives with no disk in it on Windows; they may raise - # ENOENT, pop-up a Windows GUI error for a non-ready partition or - # just hang - continue + for disk in psutil.disk_partitions(all=False): + if psutil.WINDOWS and ("cdrom" in disk.opts or disk.fstype == ""): + # skip cd-rom drives with no disk in it on Windows; they may raise + # ENOENT, pop-up a Windows GUI error for a non-ready partition or + # just hang + continue - usage = psutil.disk_usage(disk.mountpoint) - result.append(( - disk.mountpoint, - humanize_bytes(usage.used), - humanize_bytes(usage.total), - colorize_percent(usage.percent, warning=70, critical=85), - )) + usage = psutil.disk_usage(disk.mountpoint) + result.append(( + disk.mountpoint, + humanize_bytes(usage.used), + humanize_bytes(usage.total), + colorize_percent(usage.percent, warning=70, critical=85), + )) - return result + return result def _get_battery(): - if not hasattr(psutil, "sensors_battery"): - return None + if not hasattr(psutil, "sensors_battery"): + return None - try: - battery = psutil.sensors_battery() - except Exception as e: - print("Error in _get_battery:", e) - return None + try: + battery = psutil.sensors_battery() + except Exception as e: + print("Error in _get_battery:", e) + return None - if battery is None: - return None + if battery is None: + return None - percent = battery.percent - if battery.power_plugged: - status = "charging" if percent < 100 else "fully charged" - else: - status = "%s left" % humanize_timedelta(timedelta(seconds=battery.secsleft)) - return colorize_percent(percent, critical=10, warning=20, inverse=True), status + percent = battery.percent + if battery.power_plugged: + status = "charging" if percent < 100 else "fully charged" + else: + status = "%s left" % humanize_timedelta(timedelta(seconds=battery.secsleft)) + return colorize_percent(percent, critical=10, warning=20, inverse=True), status def _get_local_ipv4_addresses(): - result = [] + result = [] - for interface, addresses in psutil.net_if_addrs().items(): - for address in addresses: - if address.family != socket.AF_INET: - # allow only IPv4 addresses (skip IPv6 and MAC, for example) - continue - if interface.startswith("lo"): - # skip loopback interfaces - continue + for interface, addresses in psutil.net_if_addrs().items(): + for address in addresses: + if address.family != socket.AF_INET: + # allow only IPv4 addresses (skip IPv6 and MAC, for example) + continue + if interface.startswith("lo"): + # skip loopback interfaces + continue - result.append((interface, address.address)) + result.append((interface, address.address)) - return result + return result def _get_distro_info(): - if psutil.WINDOWS: - return "windows", platform.system(), platform.release(), "" - elif psutil.OSX: - import plistlib + if psutil.WINDOWS: + return "windows", platform.system(), platform.release(), "" + elif psutil.OSX: + import plistlib - with open("/System/Library/CoreServices/SystemVersion.plist", "rb") as f: - sw_vers = plistlib.load(f) - return "mac", sw_vers["ProductName"], sw_vers["ProductVersion"], "" - elif _is_android(): - from subprocess import check_output + with open("/System/Library/CoreServices/SystemVersion.plist", "rb") as f: + sw_vers = plistlib.load(f) + return "mac", sw_vers["ProductName"], sw_vers["ProductVersion"], "" + elif _is_android(): + from subprocess import check_output - android_version = check_output(["getprop", "ro.build.version.release"]) - return "android", "Android", android_version.decode().strip(), "" - elif psutil.LINUX: - import distro + android_version = check_output(["getprop", "ro.build.version.release"]) + return "android", "Android", android_version.decode().strip(), "" + elif psutil.LINUX: + import distro - return distro.id(), distro.name(), distro.version(), distro.codename() + return distro.id(), distro.name(), distro.version(), distro.codename() - raise NotImplementedError("unsupported OS") + raise NotImplementedError("unsupported OS") def _is_android(): - return os.path.isdir("/system/app") and os.path.isdir("/system/priv-app") + return os.path.isdir("/system/app") and os.path.isdir("/system/priv-app") From f8c01686eef09dbcaa2098f4d2e991f4c3cbdd60 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 26 Apr 2021 10:20:57 +0300 Subject: [PATCH 566/713] reformat all remaining Python scripts --- nvim/coc-languages/python.vim | 2 + scripts/copy-crosscode-emoji-url | 92 +++---- scripts/discord-snowflake | 19 +- scripts/discord-stream-desktop-audio | 28 +- scripts/discord-whois | 129 +++++---- scripts/factorio-dump-mod-settings | 38 ++- scripts/leveldb-dump | 49 ++-- scripts/mark-as-recently-used | 8 +- scripts/mediawiki-preview | 266 +++++++++--------- scripts/onscreen-message | 20 +- scripts/playerctl-simple-menu | 395 +++++++++++++-------------- scripts/query-bookmarks | 134 +++++---- scripts/random-local-ipv4 | 4 +- 13 files changed, 572 insertions(+), 612 deletions(-) diff --git a/nvim/coc-languages/python.vim b/nvim/coc-languages/python.vim index 1f0037d..336cf65 100644 --- a/nvim/coc-languages/python.vim +++ b/nvim/coc-languages/python.vim @@ -8,6 +8,8 @@ let s:ignored_errors += ['E111'] let s:ignored_errors += ['E114'] " Indent for continuation lines is smaller than expected let s:ignored_errors += ['E121'] +" Import not at the top of the file +let s:ignored_errors += ['E402'] " Line too long let s:ignored_errors += ['E501'] diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index 2192be2..e5ad71b 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -9,86 +9,76 @@ from typing import Any, Generator, Optional, Union import urllib.parse import urllib.request + sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resources")) import common_script_utils DEFAULT_REGISTRY_DUMP_URL = "https://stronghold.crosscode.ru/~ccbot/emote-registry.json" - if os.name == "posix": - config_path: Path = ( - common_script_utils.DOTFILES_CONFIG_DIR / "copy-crosscode-emoji-url.ini" - ) - default_registry_dump_file: Path = ( - common_script_utils.DOTFILES_CACHE_DIR / "dotfiles" - ) + config_path: Path = (common_script_utils.DOTFILES_CONFIG_DIR / "copy-crosscode-emoji-url.ini") + default_registry_dump_file: Path = (common_script_utils.DOTFILES_CACHE_DIR / "dotfiles") else: - common_script_utils.platform_not_supported_error() + common_script_utils.platform_not_supported_error() config = ConfigParser(interpolation=None) config.read(config_path) - emotes: list[dict[str, Any]] = [] def emote_downloader_and_iterator() -> Generator[str, None, None]: - global emotes + global emotes - registry_dump_file: Optional[Union[str, Path]] = config.get( - "default", "ccbot_emote_registry_dump_file", fallback=None - ) - if registry_dump_file is not None: - registry_dump_file = os.path.expanduser(registry_dump_file) - else: - registry_dump_file = default_registry_dump_file + registry_dump_file: Optional[Union[ + str, Path]] = config.get("default", "ccbot_emote_registry_dump_file", fallback=None) + if registry_dump_file is not None: + registry_dump_file = os.path.expanduser(registry_dump_file) + else: + registry_dump_file = default_registry_dump_file - registry_dump_url = config.get( - "default", "ccbot_emote_registry_dump_url", fallback=DEFAULT_REGISTRY_DUMP_URL - ) + registry_dump_url = config.get( + "default", "ccbot_emote_registry_dump_url", fallback=DEFAULT_REGISTRY_DUMP_URL + ) - emote_registry_data: dict[str, Any] - try: - with open(registry_dump_file, "r") as f: - emote_registry_data = json.load(f) - except FileNotFoundError: - with urllib.request.urlopen(registry_dump_url, timeout=10) as response: - emote_registry_data = json.load(response) + emote_registry_data: dict[str, Any] + try: + with open(registry_dump_file, "r") as f: + emote_registry_data = json.load(f) + except FileNotFoundError: + with urllib.request.urlopen(registry_dump_url, timeout=10) as response: + emote_registry_data = json.load(response) - assert emote_registry_data["version"] == 1 + assert emote_registry_data["version"] == 1 - emotes = [emote for emote in emote_registry_data["list"] if emote["safe"]] + emotes = [emote for emote in emote_registry_data["list"] if emote["safe"]] - for emote in emotes: - yield "{emote[ref]} [{emote[guild_name]}]".format(emote=emote) + for emote in emotes: + yield "{emote[ref]} [{emote[guild_name]}]".format(emote=emote) chosen_index = common_script_utils.run_chooser( - emote_downloader_and_iterator(), prompt="emote", async_read=True + emote_downloader_and_iterator(), prompt="emote", async_read=True ) if chosen_index >= 0: - chosen_emote = emotes[chosen_index] + chosen_emote = emotes[chosen_index] - emote_url: urllib.parse.ParseResult = urllib.parse.urlparse(chosen_emote["url"]) - emote_url_query: dict[str, list[str]] = urllib.parse.parse_qs(emote_url.query) + emote_url: urllib.parse.ParseResult = urllib.parse.urlparse(chosen_emote["url"]) + emote_url_query: dict[str, list[str]] = urllib.parse.parse_qs(emote_url.query) - if config.getboolean("default", "add_emote_name_to_url", fallback=False): - emote_url_query["name"] = [chosen_emote["name"]] + if config.getboolean("default", "add_emote_name_to_url", fallback=False): + emote_url_query["name"] = [chosen_emote["name"]] - default_emote_image_size = config.getint( - "default", "default_emote_image_size", fallback=None - ) - if default_emote_image_size is not None: - emote_url_query["size"] = [str(default_emote_image_size)] + default_emote_image_size = config.getint("default", "default_emote_image_size", fallback=None) + if default_emote_image_size is not None: + emote_url_query["size"] = [str(default_emote_image_size)] - emote_url_query_str = urllib.parse.urlencode(emote_url_query, doseq=True) - emote_url_str = urllib.parse.urlunparse( - emote_url._replace(query=emote_url_query_str) - ) + emote_url_query_str = urllib.parse.urlencode(emote_url_query, doseq=True) + emote_url_str = urllib.parse.urlunparse(emote_url._replace(query=emote_url_query_str)) - common_script_utils.set_clipboard(emote_url_str) + common_script_utils.set_clipboard(emote_url_str) - common_script_utils.send_notification( - os.path.basename(__file__), - "copied URL of {} to clipboard!".format(chosen_emote["ref"]), - ) + common_script_utils.send_notification( + os.path.basename(__file__), + "copied URL of {} to clipboard!".format(chosen_emote["ref"]), + ) diff --git a/scripts/discord-snowflake b/scripts/discord-snowflake index 25380b9..85343ba 100755 --- a/scripts/discord-snowflake +++ b/scripts/discord-snowflake @@ -6,17 +6,16 @@ import sys import colorama import time + DISCORD_EPOCH = 1420070400000 # milliseconds user_snowflake = int(sys.argv[1]) def print_field(name, value): - print( - "{}{}:{} {}".format( - colorama.Style.BRIGHT, name.rjust(21), colorama.Style.RESET_ALL, value - ) - ) + print( + "{}{}:{} {}".format(colorama.Style.BRIGHT, name.rjust(21), colorama.Style.RESET_ALL, value) + ) creation_time = (user_snowflake >> 22) + DISCORD_EPOCH @@ -25,11 +24,11 @@ internal_process_id = (user_snowflake >> 12) & 0x1F increment = user_snowflake & 0xFFF print_field( - "Created at", - "{}.{}".format( - time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(creation_time // 1000)), - creation_time % 1000, - ), + "Created at", + "{}.{}".format( + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(creation_time // 1000)), + creation_time % 1000, + ), ) print_field("Internal worker ID", internal_worker_id) print_field("Internal process ID", internal_process_id) diff --git a/scripts/discord-stream-desktop-audio b/scripts/discord-stream-desktop-audio index e80d176..da925b4 100755 --- a/scripts/discord-stream-desktop-audio +++ b/scripts/discord-stream-desktop-audio @@ -4,35 +4,33 @@ import discord import sys import os + guild_id = int(sys.argv[1]) voice_channel_id = int(sys.argv[2]) pulseaudio_device = sys.argv[3] with open(os.path.expanduser("~/.config/dotfiles/discord-tools-bot-token.txt")) as f: - bot_token = f.read().strip() - + bot_token = f.read().strip() bot = discord.Client() @bot.event async def on_ready(): - print("logged in as {0} ({0.id})".format(bot.user)) + print("logged in as {0} ({0.id})".format(bot.user)) - guild: discord.Guild = bot.get_guild(guild_id) - if guild is None: - raise Exception("guild not found") - voice_channel: discord.VoiceChannel = guild.get_channel(voice_channel_id) - if voice_channel is None: - raise Exception("channel not found") + guild: discord.Guild = bot.get_guild(guild_id) + if guild is None: + raise Exception("guild not found") + voice_channel: discord.VoiceChannel = guild.get_channel(voice_channel_id) + if voice_channel is None: + raise Exception("channel not found") - voice_client = await voice_channel.connect() - print("connected to {0} ({0.id}) in {1} ({1.id})".format(voice_channel, guild)) + voice_client = await voice_channel.connect() + print("connected to {0} ({0.id}) in {1} ({1.id})".format(voice_channel, guild)) - source = discord.FFmpegPCMAudio(pulseaudio_device, before_options="-f pulse") - voice_client.play( - source, after=lambda e: print("Player error: %s" % e) if e else None - ) + source = discord.FFmpegPCMAudio(pulseaudio_device, before_options="-f pulse") + voice_client.play(source, after=lambda e: print("Player error: %s" % e) if e else None) bot.run(bot_token) diff --git a/scripts/discord-whois b/scripts/discord-whois index 91fd346..0598fed 100755 --- a/scripts/discord-whois +++ b/scripts/discord-whois @@ -18,22 +18,21 @@ import typing DISCORD_EPOCH = 1420070400000 # milliseconds # https://discord.com/developers/docs/resources/user#user-object-user-flags DISCORD_FLAGS = { - "Discord Employee": 1 << 0, - "Discord Partner": 1 << 1, - "HypeSquad Events": 1 << 2, - "Bug Hunter Level 1": 1 << 3, - "House of Bravery": 1 << 6, - "House of Brilliance": 1 << 7, - "House of Balance": 1 << 8, - "Early Supporter": 1 << 9, - "Team User": 1 << 10, - "System": 1 << 12, - "Bug Hunter Level 2": 1 << 14, - "Verified Bot": 1 << 16, - "Verified Bot Developer": 1 << 17, + "Discord Employee": 1 << 0, + "Discord Partner": 1 << 1, + "HypeSquad Events": 1 << 2, + "Bug Hunter Level 1": 1 << 3, + "House of Bravery": 1 << 6, + "House of Brilliance": 1 << 7, + "House of Balance": 1 << 8, + "Early Supporter": 1 << 9, + "Team User": 1 << 10, + "System": 1 << 12, + "Bug Hunter Level 2": 1 << 14, + "Verified Bot": 1 << 16, + "Verified Bot Developer": 1 << 17, } - parser = argparse.ArgumentParser() parser.add_argument("user_snowflake", type=int) parser.add_argument("--bot-token", type=str) @@ -45,32 +44,29 @@ user_snowflake = cli_args.user_snowflake bot_token = cli_args.bot_token if bot_token is None: - with open( - os.path.expanduser("~/.config/dotfiles/discord-tools-bot-token.txt") - ) as f: - bot_token = f.read().strip() + with open(os.path.expanduser("~/.config/dotfiles/discord-tools-bot-token.txt")) as f: + bot_token = f.read().strip() image_size = cli_args.image_size if not (image_size is None or (image_size > 0 and image_size & (image_size - 1)) == 0): - parser.error("image_size must be greater than zero and a power of two") - + parser.error("image_size must be greater than zero and a power of two") try: - opener = urllib.request.build_opener() - # Don't send the User-Agent header, Discord blocks the default one - opener.addheaders = [] - with opener.open( - urllib.request.Request( - "http://discord.com/api/users/{}".format(user_snowflake), - headers={"Authorization": "Bot {}".format(bot_token)}, - ), - timeout=10, - ) as response: - raw_data = json.load(response) + opener = urllib.request.build_opener() + # Don't send the User-Agent header, Discord blocks the default one + opener.addheaders = [] + with opener.open( + urllib.request.Request( + "http://discord.com/api/users/{}".format(user_snowflake), + headers={"Authorization": "Bot {}".format(bot_token)}, + ), + timeout=10, + ) as response: + raw_data = json.load(response) except urllib.error.HTTPError as err: - print(err, file=sys.stderr) - print(err.read(), file=sys.stderr) - raise err + print(err, file=sys.stderr) + print(err.read(), file=sys.stderr) + raise err data = {} @@ -78,19 +74,17 @@ data["ID"] = raw_data["id"] data["Name"] = "{}#{}".format(raw_data["username"], raw_data["discriminator"]) default_avatar_url = "https://cdn.discordapp.com/embed/avatars/{}.png".format( - int(raw_data["discriminator"], 10) % 5 + int(raw_data["discriminator"], 10) % 5 ) avatar_url = ( - "https://cdn.discordapp.com/avatars/{}/{}.{}".format( - raw_data["id"], - raw_data["avatar"], - "gif" if raw_data["avatar"].startswith("a_") else "png", - ) - if raw_data["avatar"] is not None - else default_avatar_url + "https://cdn.discordapp.com/avatars/{}/{}.{}".format( + raw_data["id"], + raw_data["avatar"], + "gif" if raw_data["avatar"].startswith("a_") else "png", + ) if raw_data["avatar"] is not None else default_avatar_url ) if image_size is not None: - avatar_url += "?size={}".format(image_size) + avatar_url += "?size={}".format(image_size) data["Avatar"] = avatar_url data["Default avatar"] = default_avatar_url @@ -101,38 +95,37 @@ data["System user"] = raw_data.get("system", False) # https://discord.com/developers/docs/reference#convert-snowflake-to-datetime snowflake_creation_time = (user_snowflake >> 22) + DISCORD_EPOCH data["Created at"] = "{}.{} UTC".format( - time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(snowflake_creation_time // 1000)), - snowflake_creation_time % 1000, + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(snowflake_creation_time // 1000)), + snowflake_creation_time % 1000, ) user_flags = raw_data["public_flags"] if user_flags == 0: - data["Flags"] = "" + data["Flags"] = "" else: - user_flag_names = [] - for flag_name, bitmask in DISCORD_FLAGS.items(): - if user_flags & bitmask: - user_flag_names.append(flag_name) - data["Flags"] = ", ".join(user_flag_names) - + user_flag_names = [] + for flag_name, bitmask in DISCORD_FLAGS.items(): + if user_flags & bitmask: + user_flag_names.append(flag_name) + data["Flags"] = ", ".join(user_flag_names) if cli_args.get_prop is None: - max_name_length = max(map(len, data.keys())) - for name, value in data.items(): + max_name_length = max(map(len, data.keys())) + for name, value in data.items(): - if value is True: - value = "yes" - elif value is False: - value = "no" + if value is True: + value = "yes" + elif value is False: + value = "no" - print( - "{}{:>{}}:{} {}".format( - colorama.Style.BRIGHT, - name, - max_name_length + 1, - colorama.Style.RESET_ALL, - value, - ) - ) + print( + "{}{:>{}}:{} {}".format( + colorama.Style.BRIGHT, + name, + max_name_length + 1, + colorama.Style.RESET_ALL, + value, + ) + ) else: - print(data[cli_args.get_prop]) + print(data[cli_args.get_prop]) diff --git a/scripts/factorio-dump-mod-settings b/scripts/factorio-dump-mod-settings index 5f04b2e..8530465 100755 --- a/scripts/factorio-dump-mod-settings +++ b/scripts/factorio-dump-mod-settings @@ -10,31 +10,29 @@ from pathlib import Path import struct import json + sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resources")) import factorio.property_tree - with open(Path.home() / ".factorio" / "mods" / "mod-settings.dat", "rb") as f: - version_main: int - version_major: int - version_minor: int - version_developer: int - version_main, version_major, version_minor, version_developer = struct.unpack( - " Union[str, list[int]]: - if encoding == "utf8": - try: - return b.decode("utf8") - except UnicodeDecodeError: - return list(b) - elif encoding == "base16": - return base64.b16encode(b).decode("ascii") - elif encoding == "base32": - return base64.b32encode(b).decode("ascii") - elif encoding == "base64": - return base64.b64encode(b).decode("ascii") - elif encoding == "base85": - return base64.b85encode(b).decode("ascii") - else: - assert False + if encoding == "utf8": + try: + return b.decode("utf8") + except UnicodeDecodeError: + return list(b) + elif encoding == "base16": + return base64.b16encode(b).decode("ascii") + elif encoding == "base32": + return base64.b32encode(b).decode("ascii") + elif encoding == "base64": + return base64.b64encode(b).decode("ascii") + elif encoding == "base85": + return base64.b85encode(b).decode("ascii") + else: + assert False key_encoding: str = cli_args.key_encoding or cli_args.encoding value_encoding: str = cli_args.value_encoding or cli_args.encoding db = plyvel.DB(str(cli_args.db_path), create_if_missing=False) with db.iterator() as iterator: - for key, value in iterator: - json.dump( - { - "key": bytes_to_json(key, key_encoding), - "value": bytes_to_json(value, value_encoding), - }, - stdout, - ) - stdout.write("\n") + for key, value in iterator: + json.dump( + { + "key": bytes_to_json(key, key_encoding), + "value": bytes_to_json(value, value_encoding), + }, + stdout, + ) + stdout.write("\n") diff --git a/scripts/mark-as-recently-used b/scripts/mark-as-recently-used index 63475cd..c35e763 100755 --- a/scripts/mark-as-recently-used +++ b/scripts/mark-as-recently-used @@ -1,14 +1,16 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # Taken from import gi import sys + gi.require_version("Gtk", "3.0") -from gi.repository import Gtk, Gio, GLib # noqa E402 +from gi.repository import Gtk, Gio, GLib + rec_mgr = Gtk.RecentManager.get_default() for arg in sys.argv[1:]: - rec_mgr.add_item(Gio.File.new_for_path(arg).get_uri()) + rec_mgr.add_item(Gio.File.new_for_path(arg).get_uri()) GLib.idle_add(Gtk.main_quit) Gtk.main() diff --git a/scripts/mediawiki-preview b/scripts/mediawiki-preview index c1cfc68..b2d978b 100755 --- a/scripts/mediawiki-preview +++ b/scripts/mediawiki-preview @@ -38,7 +38,6 @@ # - The module `skins.citizen.scripts` references search inputs which aren't # created by this script. - import argparse import mwclient import json @@ -51,85 +50,85 @@ LANG = "en" LANG_TEXT_DIRECTION = "ltr" MODULES_POST_LOAD = { - "vector": [ - "site", - "mediawiki.page.startup", - "mediawiki.page.ready", - "mediawiki.toc", - # "mediawiki.searchSuggest", - # "mediawiki.page.watch.ajax", - "skins.vector.js", - ], - "citizen": [ - # "site", - # "mediawiki.page.startup", - # "mediawiki.page.ready", - # "mediawiki.toc", - # "skins.citizen.scripts.toc", - # "skins.citizen.scripts.search", - # "skins.citizen.styles.search", - # "skins.citizen.icons.search", - # "skins.citizen.scripts", - ], + "vector": [ + "site", + "mediawiki.page.startup", + "mediawiki.page.ready", + "mediawiki.toc", + # "mediawiki.searchSuggest", + # "mediawiki.page.watch.ajax", + "skins.vector.js", + ], + "citizen": [ + # "site", + # "mediawiki.page.startup", + # "mediawiki.page.ready", + # "mediawiki.toc", + # "skins.citizen.scripts.toc", + # "skins.citizen.scripts.search", + # "skins.citizen.styles.search", + # "skins.citizen.icons.search", + # "skins.citizen.scripts", + ], } MODULES_POST_LOAD_BLOCKED = { - "citizen": [ - "skins.citizen.scripts.toc", - "skins.citizen.scripts.search", - "skins.citizen.styles.search", - "skins.citizen.icons.search", - ], + "citizen": [ + "skins.citizen.scripts.toc", + "skins.citizen.scripts.search", + "skins.citizen.styles.search", + "skins.citizen.icons.search", + ], } MODULES_PRELOAD_STYLES = { - "vector": [ - "mediawiki.legacy.commonPrint", - "mediawiki.legacy.shared", - "mediawiki.skinning.interface", - "mediawiki.toc.styles", - "skins.vector.styles", - "site.styles", - ], - "citizen": [ - # "mediawiki.legacy.commonPrint", - # "mediawiki.legacy.shared", - "mediawiki.skinning.content.externallinks", - # "mediawiki.toc.styles", - "skins.citizen.icons", - "skins.citizen.styles", - "skins.citizen.icons.ca", - "skins.citizen.icons.es", - "skins.citizen.icons.footer", - "skins.citizen.icons.n", - "skins.citizen.icons.pt", - "skins.citizen.icons.t", - "skins.citizen.styles.fonts", - "skins.citizen.styles.toc", - "site.styles", - ], + "vector": [ + "mediawiki.legacy.commonPrint", + "mediawiki.legacy.shared", + "mediawiki.skinning.interface", + "mediawiki.toc.styles", + "skins.vector.styles", + "site.styles", + ], + "citizen": [ + # "mediawiki.legacy.commonPrint", + # "mediawiki.legacy.shared", + "mediawiki.skinning.content.externallinks", + # "mediawiki.toc.styles", + "skins.citizen.icons", + "skins.citizen.styles", + "skins.citizen.icons.ca", + "skins.citizen.icons.es", + "skins.citizen.icons.footer", + "skins.citizen.icons.n", + "skins.citizen.icons.pt", + "skins.citizen.icons.t", + "skins.citizen.styles.fonts", + "skins.citizen.styles.toc", + "site.styles", + ], } MODULES_PRELOAD_SCRIPTS = { - "vector": ["startup"], - "citizen": ["startup"], + "vector": ["startup"], + "citizen": ["startup"], } # ported from def escape_css_class(class_str): - class_str = re.sub( - r"""(^[0-9\-])|[\x00-\x20!"#$%&'()*+,.\/:;<=>?@[\]^`{|}~]|\xA0""", - "_", - class_str, - ) - class_str = re.sub(r"_+", "_", class_str) - class_str = class_str.rstrip("_") - return class_str + class_str = re.sub( + r"""(^[0-9\-])|[\x00-\x20!"#$%&'()*+,.\/:;<=>?@[\]^`{|}~]|\xA0""", + "_", + class_str, + ) + class_str = re.sub(r"_+", "_", class_str) + class_str = class_str.rstrip("_") + return class_str def json_dumps_compact(data): - return json.dumps(data, indent=None, separators=(",", ":")) + return json.dumps(data, indent=None, separators=(",", ":")) parser = argparse.ArgumentParser() @@ -137,50 +136,55 @@ parser.add_argument("--site", type=str, required=True) parser.add_argument("--scheme", type=str, default="https") parser.add_argument("--skin", type=str, default="vector") parser.add_argument( - "--input", type=str, required=True, + "--input", + type=str, + required=True, ) parser.add_argument("--title", type=str) parser.add_argument("--output", type=str, required=True) cli_args = parser.parse_args() - site = mwclient.Site(cli_args.site, scheme=cli_args.scheme) def get_load_script_url(**args): - return "{path}load{ext}?{args}".format( - path=site.path, - ext=site.ext, - args=urlencode({"lang": LANG, "skin": cli_args.skin, **args}), - ) + return "{path}load{ext}?{args}".format( + path=site.path, + ext=site.ext, + args=urlencode({ + "lang": LANG, + "skin": cli_args.skin, + **args + }), + ) with open(cli_args.input, "r") as f: - wikitext_str = f.read() + wikitext_str = f.read() result = site.post( - "parse", - title=cli_args.title, - text=wikitext_str, - contentmodel="wikitext", - prop="text|indicators|displaytitle|modules|jsconfigvars|categorieshtml", - preview=True, - pst=True, # pre-save transforms - sectionpreview=False, - disableeditsection=True, # disables "[edit]" links next to headers - useskin=cli_args.skin, - uselang=LANG, + "parse", + title=cli_args.title, + text=wikitext_str, + contentmodel="wikitext", + prop="text|indicators|displaytitle|modules|jsconfigvars|categorieshtml", + preview=True, + pst=True, # pre-save transforms + sectionpreview=False, + disableeditsection=True, # disables "[edit]" links next to headers + useskin=cli_args.skin, + uselang=LANG, )["parse"] def get_modules(page_modules, added_modules_dict, blocked_modules_dict={}): - modules = page_modules + added_modules_dict[cli_args.skin] - for blocked_module in blocked_modules_dict.get(cli_args.skin, []): - try: - modules.remove(blocked_module) - except ValueError: - pass - return modules + modules = page_modules + added_modules_dict[cli_args.skin] + for blocked_module in blocked_modules_dict.get(cli_args.skin, []): + try: + modules.remove(blocked_module) + except ValueError: + pass + return modules rendered_html = """\ @@ -240,53 +244,43 @@ rendered_html = """\ """.format( - lang=html.escape(LANG), - text_dir=html.escape(LANG_TEXT_DIRECTION), - base_url=html.escape("{}://{}".format(site.scheme, site.host)), - page_modules_state_json=json_dumps_compact( - { - "noscript": "ready", - "user.options": "ready", - "user.tokens": "loading", - **{name: "ready" for name in MODULES_PRELOAD_STYLES[cli_args.skin]}, - } - ), - page_config_json=json_dumps_compact(result["jsconfigvars"]), - page_modules_json=json_dumps_compact( - get_modules(result["modules"], MODULES_POST_LOAD, MODULES_POST_LOAD_BLOCKED) - ), - style_url=html.escape( - get_load_script_url( - only="styles", - modules="|".join( - get_modules(result["modulestyles"], MODULES_PRELOAD_STYLES) - ), - ) - ), - script_url=html.escape( - get_load_script_url( - only="scripts", - modules="|".join( - get_modules(result["modulescripts"], MODULES_PRELOAD_SCRIPTS) - ), - raw="1", - ) - ), - skin=html.escape(cli_args.skin), - page_class=html.escape(escape_css_class(result["displaytitle"])), - title=html.escape(result["displaytitle"]), - indicators_html="\n".join( - [ - '
{}
'.format( - indicator["name"], indicator["*"] - ) - for indicator in result["indicators"] - ] - ), - content_html=result["text"]["*"], - categories_html=result["categorieshtml"]["*"], + lang=html.escape(LANG), + text_dir=html.escape(LANG_TEXT_DIRECTION), + base_url=html.escape("{}://{}".format(site.scheme, site.host)), + page_modules_state_json=json_dumps_compact({ + "noscript": "ready", + "user.options": "ready", + "user.tokens": "loading", + **{name: "ready" for name in MODULES_PRELOAD_STYLES[cli_args.skin]}, + }), + page_config_json=json_dumps_compact(result["jsconfigvars"]), + page_modules_json=json_dumps_compact( + get_modules(result["modules"], MODULES_POST_LOAD, MODULES_POST_LOAD_BLOCKED) + ), + style_url=html.escape( + get_load_script_url( + only="styles", + modules="|".join(get_modules(result["modulestyles"], MODULES_PRELOAD_STYLES)), + ) + ), + script_url=html.escape( + get_load_script_url( + only="scripts", + modules="|".join(get_modules(result["modulescripts"], MODULES_PRELOAD_SCRIPTS)), + raw="1", + ) + ), + skin=html.escape(cli_args.skin), + page_class=html.escape(escape_css_class(result["displaytitle"])), + title=html.escape(result["displaytitle"]), + indicators_html="\n".join([ + '
{}
'.format( + indicator["name"], indicator["*"] + ) for indicator in result["indicators"] + ]), + content_html=result["text"]["*"], + categories_html=result["categorieshtml"]["*"], ) - with open(cli_args.output, "w") as f: - f.write(rendered_html) + f.write(rendered_html) diff --git a/scripts/onscreen-message b/scripts/onscreen-message index 3ca6694..32c3b5a 100755 --- a/scripts/onscreen-message +++ b/scripts/onscreen-message @@ -2,8 +2,9 @@ import gi import argparse + gi.require_version("Gtk", "3.0") -from gi.repository import Gtk, Gdk, Pango # noqa: E402 +from gi.repository import Gtk, Gdk, Pango parser = argparse.ArgumentParser() @@ -12,7 +13,6 @@ args = parser.parse_args() message = " ".join(args.message) - window = Gtk.ApplicationWindow() window.set_keep_above(True) window.set_decorated(False) @@ -25,17 +25,17 @@ window.add(scrolled_window) def on_key_release(target, event): - key = event.keyval - if key in [Gdk.KEY_Escape, Gdk.KEY_q, Gdk.KEY_Q]: - window.close() + key = event.keyval + if key in [Gdk.KEY_Escape, Gdk.KEY_q, Gdk.KEY_Q]: + window.close() def on_configure(target, event): - if target != window or event.type != Gdk.EventType.CONFIGURE: - return - font_desc = Pango.FontDescription() - font_desc.set_size(Pango.SCALE * event.height * 2 / 3) - label.override_font(font_desc) + if target != window or event.type != Gdk.EventType.CONFIGURE: + return + font_desc = Pango.FontDescription() + font_desc.set_size(Pango.SCALE * event.height * 2 / 3) + label.override_font(font_desc) window.connect("configure-event", on_configure) diff --git a/scripts/playerctl-simple-menu b/scripts/playerctl-simple-menu index 3072017..f351bb4 100755 --- a/scripts/playerctl-simple-menu +++ b/scripts/playerctl-simple-menu @@ -9,162 +9,162 @@ import math import gi + gi.require_version("Playerctl", "2.0") gi.require_version("Gtk", "3.0") gi.require_version("Gdk", "3.0") gi.require_version("Pango", "1.0") -from gi.repository import Playerctl, Gtk, Gdk, GLib, Pango # noqa: E402 - +from gi.repository import Playerctl, Gtk, Gdk, GLib, Pango # Larger priority values will make the player with this name appear higher in # the menu. The default priority is 0. PLAYER_NAME_PRIORITIES = { - "audacious": 2, - "mpv": 1, - "vlc": 1, - "firefox": -1, - "chrome": -2, - "chromium": -2, + "audacious": 2, + "mpv": 1, + "vlc": 1, + "firefox": -1, + "chrome": -2, + "chromium": -2, } PLAYER_ICON_NAME_FIXES = { - "chrome": "google-chrome", + "chrome": "google-chrome", } PLAYER_PLAYBACK_STATUS_EMOJIS = { - Playerctl.PlaybackStatus.PLAYING: "\u25B6", - Playerctl.PlaybackStatus.PAUSED: "\u23F8", - Playerctl.PlaybackStatus.STOPPED: "\u23F9", + Playerctl.PlaybackStatus.PLAYING: "\u25B6", + Playerctl.PlaybackStatus.PAUSED: "\u23F8", + Playerctl.PlaybackStatus.STOPPED: "\u23F9", } def humanize_duration(duration): - minutes, seconds = divmod(math.floor(duration), 60) - hours, minutes = divmod(minutes, 60) - text = "{:02}:{:02}".format(minutes, seconds) - if hours > 0: - text = "{}:{}".format(hours, text) - return text + minutes, seconds = divmod(math.floor(duration), 60) + hours, minutes = divmod(minutes, 60) + text = "{:02}:{:02}".format(minutes, seconds) + if hours > 0: + text = "{}:{}".format(hours, text) + return text def iter_metadata_entries_for_player(player): - metadata = player.props.metadata + metadata = player.props.metadata - title = metadata.lookup_value("xesam:title") - if title: - yield title.get_string() + title = metadata.lookup_value("xesam:title") + if title: + yield title.get_string() - album = metadata.lookup_value("xesam:album") - if album: - yield album.get_string() + album = metadata.lookup_value("xesam:album") + if album: + yield album.get_string() - if player.props.can_seek: - position_secs = player.props.position / 1e6 - duration = metadata.lookup_value("mpris:length") - if duration is not None and duration.is_of_type(GLib.VariantType.new("x")): - duration_secs = duration.get_int64() / 1e6 - yield "Time: {} / {}".format( - humanize_duration(position_secs), humanize_duration(duration_secs) - ) + if player.props.can_seek: + position_secs = player.props.position / 1e6 + duration = metadata.lookup_value("mpris:length") + if duration is not None and duration.is_of_type(GLib.VariantType.new("x")): + duration_secs = duration.get_int64() / 1e6 + yield "Time: {} / {}".format( + humanize_duration(position_secs), humanize_duration(duration_secs) + ) def iter_actions_for_player(player): - if not player.props.can_control: - yield ("This player can't be controlled!", None, False, None) - return + if not player.props.can_control: + yield ("This player can't be controlled!", None, False, None) + return - playback_status = player.props.playback_status - if playback_status == Playerctl.PlaybackStatus.PLAYING: - yield ( - "_Pause", - "media-playback-pause", - player.props.can_pause, - player.pause, - ) - elif playback_status == Playerctl.PlaybackStatus.PAUSED: - yield ( - "Resume (_P)", - "media-playback-start", - player.props.can_play, - player.play, - ) - elif playback_status == Playerctl.PlaybackStatus.STOPPED: - yield ( - "_Play", - "media-playback-start", - player.props.can_play, - player.play, - ) - - # See + playback_status = player.props.playback_status + if playback_status == Playerctl.PlaybackStatus.PLAYING: yield ( - "_Stop", - "media-playback-stop", - player.props.can_play and playback_status != Playerctl.PlaybackStatus.STOPPED, - player.stop, + "_Pause", + "media-playback-pause", + player.props.can_pause, + player.pause, + ) + elif playback_status == Playerctl.PlaybackStatus.PAUSED: + yield ( + "Resume (_P)", + "media-playback-start", + player.props.can_play, + player.play, + ) + elif playback_status == Playerctl.PlaybackStatus.STOPPED: + yield ( + "_Play", + "media-playback-start", + player.props.can_play, + player.play, ) + # See + yield ( + "_Stop", + "media-playback-stop", + player.props.can_play and playback_status != Playerctl.PlaybackStatus.STOPPED, + player.stop, + ) + + yield ( + "_Mute" if player.props.volume != 0.0 else "Nor_mal volume", + "audio-volume-muted" if player.props.volume != 0.0 else "audio-volume-high", + True, + lambda volume: player.set_volume(volume), + 0.0 if player.props.volume != 0.0 else 1.0, + ) + yield ( + "Volume +10%", + "audio-volume-medium", + True, + lambda: player.set_volume(min(player.props.volume + 0.1, 1.0)), + ) + yield ( + "Volume -10%", + "audio-volume-low", + True, + lambda: player.set_volume(max(player.props.volume - 0.1, 0.0)), + ) + + yield ( + "_Next", + "media-skip-forward", + player.props.can_go_next, + player.next, + ) + yield ( + "Previous (_B)", + "media-skip-backward", + player.props.can_go_previous, + player.previous, + ) + + shuffle = player.props.shuffle + yield ( + "Don't shuffle (_R)" if shuffle else "Shuffle (_R)", + "media-playlist-shuffle", + True, + lambda: player.set_shuffle(not shuffle), + ) + + loop_status = player.props.loop_status + for loop_action_name, loop_action_status in [ + ("Don't _loop", Playerctl.LoopStatus.NONE), + ("Loop _one", Playerctl.LoopStatus.TRACK), + ("Loop _all", Playerctl.LoopStatus.PLAYLIST), + ]: yield ( - "_Mute" if player.props.volume != 0.0 else "Nor_mal volume", - "audio-volume-muted" if player.props.volume != 0.0 else "audio-volume-high", - True, - lambda volume: player.set_volume(volume), - 0.0 if player.props.volume != 0.0 else 1.0, - ) - yield ( - "Volume +10%", - "audio-volume-medium", - True, - lambda: player.set_volume(min(player.props.volume + 0.1, 1.0)), - ) - yield ( - "Volume -10%", - "audio-volume-low", - True, - lambda: player.set_volume(max(player.props.volume - 0.1, 0.0)), + loop_action_name, + "media-playlist-repeat", + loop_action_status != loop_status, + lambda loop_action_status: player.set_loop_status(loop_action_status), + loop_action_status, ) - yield ( - "_Next", - "media-skip-forward", - player.props.can_go_next, - player.next, - ) - yield ( - "Previous (_B)", - "media-skip-backward", - player.props.can_go_previous, - player.previous, - ) - - shuffle = player.props.shuffle - yield ( - "Don't shuffle (_R)" if shuffle else "Shuffle (_R)", - "media-playlist-shuffle", - True, - lambda: player.set_shuffle(not shuffle), - ) - - loop_status = player.props.loop_status - for loop_action_name, loop_action_status in [ - ("Don't _loop", Playerctl.LoopStatus.NONE), - ("Loop _one", Playerctl.LoopStatus.TRACK), - ("Loop _all", Playerctl.LoopStatus.PLAYLIST), - ]: - yield ( - loop_action_name, - "media-playlist-repeat", - loop_action_status != loop_status, - lambda loop_action_status: player.set_loop_status(loop_action_status), - loop_action_status, - ) - - yield ( - "Play a_gain", - "go-first", - player.props.can_seek, - lambda: player.set_position(0), - ) + yield ( + "Play a_gain", + "go-first", + player.props.can_seek, + lambda: player.set_position(0), + ) root_menu = Gtk.Menu() @@ -172,93 +172,84 @@ root_menu = Gtk.Menu() player_names = Playerctl.list_players() if len(player_names) > 0: - players = [] - for player_name in player_names: - player = Playerctl.Player.new_from_name(player_name) - players.append( - { - "player": player, - "player_name": player_name, - "sorting_key": ( - player.props.playback_status != Playerctl.PlaybackStatus.PLAYING, - -PLAYER_NAME_PRIORITIES.get(player_name.name, 0), - player_name.instance, - ), - } - ) - players = sorted( - players, key=lambda player_and_meta: player_and_meta["sorting_key"] + players = [] + for player_name in player_names: + player = Playerctl.Player.new_from_name(player_name) + players.append({ + "player": + player, + "player_name": + player_name, + "sorting_key": ( + player.props.playback_status != Playerctl.PlaybackStatus.PLAYING, + -PLAYER_NAME_PRIORITIES.get(player_name.name, 0), + player_name.instance, + ), + }) + players = sorted(players, key=lambda player_and_meta: player_and_meta["sorting_key"]) + + for player_and_meta in players: + player_name = player_and_meta["player_name"] + player = player_and_meta["player"] + + player_menu_item = Gtk.ImageMenuItem.new_with_label( + "{} [{}]".format( + player_name.instance, + PLAYER_PLAYBACK_STATUS_EMOJIS[player.props.playback_status], + ) ) - for player_and_meta in players: - player_name = player_and_meta["player_name"] - player = player_and_meta["player"] + player_icon_name = PLAYER_ICON_NAME_FIXES.get(player_name.name, player_name.name) + player_icon = Gtk.Image.new_from_icon_name(player_icon_name, Gtk.IconSize.MENU) + player_menu_item.set_image(player_icon) - player_menu_item = Gtk.ImageMenuItem.new_with_label( - "{} [{}]".format( - player_name.instance, - PLAYER_PLAYBACK_STATUS_EMOJIS[player.props.playback_status], - ) + actions_menu = Gtk.Menu() + + track_metadata = player.props.metadata + any_metadata_was_added = False + for meta_entry_text in iter_metadata_entries_for_player(player): + meta_menu_item = Gtk.MenuItem.new_with_label(meta_entry_text) + meta_menu_item.set_sensitive(False) + meta_menu_item_label = meta_menu_item.get_child() + meta_menu_item_label.set_ellipsize(Pango.EllipsizeMode.END) + meta_menu_item_label.set_max_width_chars(20) + + actions_menu.append(meta_menu_item) + any_metadata_was_added = True + + if any_metadata_was_added: + actions_menu.append(Gtk.SeparatorMenuItem.new()) + + for ( + action_name, + action_icon_name, + action_enabled, + action_fn, + *action_fn_args, + ) in iter_actions_for_player(player): + action_menu_item = Gtk.ImageMenuItem.new_with_mnemonic(action_name) + + if action_icon_name is not None: + action_icon = Gtk.Image.new_from_icon_name(action_icon_name, Gtk.IconSize.MENU) + action_menu_item.set_image(action_icon) + + action_menu_item.set_sensitive(action_enabled) + if action_fn is not None: + action_menu_item.connect( + "activate", + lambda _menu_item, action_fn, action_fn_args: action_fn(*action_fn_args), + action_fn, + action_fn_args, ) - player_icon_name = PLAYER_ICON_NAME_FIXES.get( - player_name.name, player_name.name - ) - player_icon = Gtk.Image.new_from_icon_name(player_icon_name, Gtk.IconSize.MENU) - player_menu_item.set_image(player_icon) + actions_menu.append(action_menu_item) - actions_menu = Gtk.Menu() - - track_metadata = player.props.metadata - any_metadata_was_added = False - for meta_entry_text in iter_metadata_entries_for_player(player): - meta_menu_item = Gtk.MenuItem.new_with_label(meta_entry_text) - meta_menu_item.set_sensitive(False) - meta_menu_item_label = meta_menu_item.get_child() - meta_menu_item_label.set_ellipsize(Pango.EllipsizeMode.END) - meta_menu_item_label.set_max_width_chars(20) - - actions_menu.append(meta_menu_item) - any_metadata_was_added = True - - if any_metadata_was_added: - actions_menu.append(Gtk.SeparatorMenuItem.new()) - - for ( - action_name, - action_icon_name, - action_enabled, - action_fn, - *action_fn_args, - ) in iter_actions_for_player(player): - action_menu_item = Gtk.ImageMenuItem.new_with_mnemonic(action_name) - - if action_icon_name is not None: - action_icon = Gtk.Image.new_from_icon_name( - action_icon_name, Gtk.IconSize.MENU - ) - action_menu_item.set_image(action_icon) - - action_menu_item.set_sensitive(action_enabled) - if action_fn is not None: - action_menu_item.connect( - "activate", - lambda _menu_item, action_fn, action_fn_args: action_fn( - *action_fn_args - ), - action_fn, - action_fn_args, - ) - - actions_menu.append(action_menu_item) - - player_menu_item.set_submenu(actions_menu) - root_menu.append(player_menu_item) + player_menu_item.set_submenu(actions_menu) + root_menu.append(player_menu_item) else: - menu_item = Gtk.MenuItem.new_with_label("No players were detected!") - menu_item.set_sensitive(False) - root_menu.append(menu_item) - + menu_item = Gtk.MenuItem.new_with_label("No players were detected!") + menu_item.set_sensitive(False) + root_menu.append(menu_item) root_menu.connect("selection-done", Gtk.main_quit) root_menu.connect("deactivate", Gtk.main_quit) diff --git a/scripts/query-bookmarks b/scripts/query-bookmarks index 1e8db42..fa3867f 100755 --- a/scripts/query-bookmarks +++ b/scripts/query-bookmarks @@ -16,35 +16,31 @@ import shutil import sqlite3 from typing import Optional, Tuple, Generator + sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resources")) import common_script_utils - if sys.platform == "darwin": - firefox_home: Path = Path.home() / "Library" / "Application Support" / "Firefox" + firefox_home: Path = Path.home() / "Library" / "Application Support" / "Firefox" elif os.name == "posix": - firefox_home: Path = Path.home() / ".mozilla" / "firefox" + firefox_home: Path = Path.home() / ".mozilla" / "firefox" else: - common_script_utils.platform_not_supported_error() - + common_script_utils.platform_not_supported_error() profiles_config = ConfigParser(interpolation=None) profiles_config.read(firefox_home / "profiles.ini") -installs_sections: list[str] = [ - s for s in profiles_config.sections() if s.startswith("Install") -] +installs_sections: list[str] = [s for s in profiles_config.sections() if s.startswith("Install")] if not installs_sections: - raise Exception("no Firefox installations detected!") + raise Exception("no Firefox installations detected!") if len(installs_sections) > 1: - raise Exception("multiple Firefox installations are not supported!") + raise Exception("multiple Firefox installations are not supported!") profile_dir: Path = firefox_home / profiles_config.get(installs_sections[0], "Default") # should places.sqlite be used instead? db_path: Path = profile_dir / "weave" / "bookmarks.sqlite" if not db_path.is_file(): - raise Exception("'{}' is not a file".format(db_path)) - + raise Exception("'{}' is not a file".format(db_path)) # Firefox holds a lock over the database file, so I can't connect to it even # in the readonly mode: https://stackoverflow.com/a/7857866/12005228 @@ -55,78 +51,74 @@ os.close(db_copy_fd) chooser_entries: list[Tuple[str, str, Optional[str]]] = [] try: - shutil.copyfile(db_path, db_copy_path) - db = sqlite3.connect(db_copy_path) + shutil.copyfile(db_path, db_copy_path) + db = sqlite3.connect(db_copy_path) - urls: dict[int, str] = {} - url_id: int - url: str - for url_id, url in db.execute("SELECT id, url FROM urls"): - urls[url_id] = url + urls: dict[int, str] = {} + url_id: int + url: str + for url_id, url in db.execute("SELECT id, url FROM urls"): + urls[url_id] = url - folders: dict[str, Tuple[Optional[str], str]] = {} - folder_id: str - parent_folder_id: str - folder_title: str - for folder_id, parent_folder_id, folder_title in db.execute( - "SELECT guid, parentGuid, title FROM items WHERE kind = 3 AND validity AND NOT isDeleted" - ): - folders[folder_id] = ( - parent_folder_id if parent_folder_id != folder_id else None, - folder_title, - ) + folders: dict[str, Tuple[Optional[str], str]] = {} + folder_id: str + parent_folder_id: str + folder_title: str + for folder_id, parent_folder_id, folder_title in db.execute( + "SELECT guid, parentGuid, title FROM items WHERE kind = 3 AND validity AND NOT isDeleted" + ): + folders[folder_id] = ( + parent_folder_id if parent_folder_id != folder_id else None, + folder_title, + ) - url_title: str - url_id: int - url_keyword: str - parent_folder_id: str - for url_title, url_id, url_keyword, parent_folder_id in db.execute( - "SELECT title, urlId, keyword, parentGuid FROM items WHERE kind = 1 AND validity AND NOT isDeleted" - ): - url = urls[url_id] + url_title: str + url_id: int + url_keyword: str + parent_folder_id: str + for url_title, url_id, url_keyword, parent_folder_id in db.execute( + "SELECT title, urlId, keyword, parentGuid FROM items WHERE kind = 1 AND validity AND NOT isDeleted" + ): + url = urls[url_id] - folder_path = list[str]() - parent_folder_id_2: Optional[str] = parent_folder_id - while parent_folder_id_2 is not None: - folder = folders.get(parent_folder_id_2, None) - if folder is None: - # broken folder structure? - folder_path.clear() - break - parent_folder_id_2, folder_title = folder - if folder_title is not None: - folder_path.append(folder_title) + folder_path = list[str]() + parent_folder_id_2: Optional[str] = parent_folder_id + while parent_folder_id_2 is not None: + folder = folders.get(parent_folder_id_2, None) + if folder is None: + # broken folder structure? + folder_path.clear() + break + parent_folder_id_2, folder_title = folder + if folder_title is not None: + folder_path.append(folder_title) - folder_path_str = ( - ("/" + "/".join(reversed(folder_path))) if len(folder_path) > 0 else None - ) + folder_path_str = (("/" + "/".join(reversed(folder_path))) if len(folder_path) > 0 else None) - chooser_entries.append((url_title, url, folder_path_str)) - if url_keyword is not None: - chooser_entries.append((url_keyword, url, folder_path_str)) + chooser_entries.append((url_title, url, folder_path_str)) + if url_keyword is not None: + chooser_entries.append((url_keyword, url, folder_path_str)) finally: - os.remove(db_copy_path) + os.remove(db_copy_path) def chooser_entries_iter() -> Generator[str, None, None]: - for title, url, folder_path_str in chooser_entries: - entry_items = [title, url] - if folder_path_str is not None: - entry_items.append(folder_path_str) - entry = " \u2014\u2014 ".join(entry_items) - yield entry + for title, url, folder_path_str in chooser_entries: + entry_items = [title, url] + if folder_path_str is not None: + entry_items.append(folder_path_str) + entry = " \u2014\u2014 ".join(entry_items) + yield entry -chosen_index = common_script_utils.run_chooser( - chooser_entries_iter(), prompt="bookmark" -) +chosen_index = common_script_utils.run_chooser(chooser_entries_iter(), prompt="bookmark") if chosen_index >= 0: - _title, url, _folder_path_str = chooser_entries[chosen_index] - print(url) + _title, url, _folder_path_str = chooser_entries[chosen_index] + print(url) - common_script_utils.set_clipboard(url) - common_script_utils.send_notification( - os.path.basename(__file__), "bookmark URL copied to clipboard!", url - ) + common_script_utils.set_clipboard(url) + common_script_utils.send_notification( + os.path.basename(__file__), "bookmark URL copied to clipboard!", url + ) diff --git a/scripts/random-local-ipv4 b/scripts/random-local-ipv4 index dbf02a4..a72180c 100755 --- a/scripts/random-local-ipv4 +++ b/scripts/random-local-ipv4 @@ -1,10 +1,10 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import random def randbyte() -> int: - return random.randrange(0, 256) + return random.randrange(0, 256) print("127.{}.{}.{}".format(randbyte(), randbyte(), randbyte())) From c12afbc6ff50e599139edf9e6f9e93bd83cabae6 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 26 Apr 2021 10:25:01 +0300 Subject: [PATCH 567/713] [nvim] move the flake8 config to an external file --- nvim/coc-languages/python.vim | 15 +-------------- python/flake8.ini | 12 ++++++++++++ 2 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 python/flake8.ini diff --git a/nvim/coc-languages/python.vim b/nvim/coc-languages/python.vim index 336cf65..20b80e1 100644 --- a/nvim/coc-languages/python.vim +++ b/nvim/coc-languages/python.vim @@ -1,19 +1,6 @@ let g:coc_global_extensions += ['coc-pyright'] let g:coc_filetypes += ['python'] -let s:ignored_errors = [] -" Indent is not a multiple of 4 -let s:ignored_errors += ['E111'] -" Indent is not a multiple of 4 for comments -let s:ignored_errors += ['E114'] -" Indent for continuation lines is smaller than expected -let s:ignored_errors += ['E121'] -" Import not at the top of the file -let s:ignored_errors += ['E402'] -" Line too long -let s:ignored_errors += ['E501'] - -" let g:coc_user_config['pyls.plugins.pycodestyle.ignore'] = s:ignored_errors " let g:coc_user_config['python.autocomplete.showAdvancedMembers'] = v:false let g:coc_user_config['python'] = { \ 'formatting': { @@ -23,6 +10,6 @@ let g:coc_user_config['python'] = { \ 'linting': { \ 'pylintEnabled': v:false, \ 'flake8Enabled': v:true, -\ 'flake8Args': ['--ignore=' . join(s:ignored_errors, ',')], +\ 'flake8Args': ['--config=' . simplify(g:nvim_dotfiles_dir.'/../python/flake8.ini')], \ }, \ } diff --git a/python/flake8.ini b/python/flake8.ini new file mode 100644 index 0000000..b0c0191 --- /dev/null +++ b/python/flake8.ini @@ -0,0 +1,12 @@ +[flake8] +ignore = + # Indent is not a multiple of 4 + E111 + # Indent is not a multiple of 4 for comments + E114 + # Indent for continuation lines is smaller than expected + E121 + # Import not at the top of the file + E402 + # Line too long + E501 From be46fba566886ae410eed51b2dfe9690e30dda3f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 26 Apr 2021 15:42:56 +0300 Subject: [PATCH 568/713] [scripts/copy-crosscode-emoji-url] add an option for allowing nsfw emotes --- scripts/copy-crosscode-emoji-url | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index e5ad71b..45c6935 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -51,7 +51,8 @@ def emote_downloader_and_iterator() -> Generator[str, None, None]: assert emote_registry_data["version"] == 1 - emotes = [emote for emote in emote_registry_data["list"] if emote["safe"]] + allow_nsfw = config.getboolean("default", "allow_nsfw", fallback=False) + emotes = [emote for emote in emote_registry_data["list"] if emote["safe"] or allow_nsfw] for emote in emotes: yield "{emote[ref]} [{emote[guild_name]}]".format(emote=emote) From 191fba04bbfe622cb4f1671f9cc3372cb3becc07 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 27 Apr 2021 14:48:16 +0300 Subject: [PATCH 569/713] [zsh] move zcompdump into ~/.cache --- zsh/plugins.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index df70f1d..e91bc94 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -1,6 +1,6 @@ #!/usr/bin/env zsh -ZSH_CACHE_DIR="$HOME/.cache/dotfiles" +ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/dotfiles" if [[ ! -d "$ZSH_CACHE_DIR" ]]; then mkdir -pv "$ZSH_CACHE_DIR" fi @@ -28,7 +28,7 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" # . match only plain files # m-1 check if the file was modified today # see "Filename Generation" in zshexpn(1) - for match in $HOME/.zcompdump(N.m-1); do + for match in "${ZSH_CACHE_DIR}/zcompdump"(N.m-1); do run_compdump=0 break done; unset match @@ -36,7 +36,7 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" if (( $run_compdump )); then print -r -- "$0: rebuilding zsh completion dump" # -D flag turns off compdump loading - compinit -D + compinit -D -d "${ZSH_CACHE_DIR}/zcompdump" compdump else # -C flag disables some checks performed by compinit - they are not needed From 4b54ae7f02be7c893a81ac7bdb9943c0bf144db1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 27 Apr 2021 14:48:16 +0300 Subject: [PATCH 570/713] [zsh] move zcompdump into ~/.cache --- zsh/plugins.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index df70f1d..dd62b51 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -1,6 +1,6 @@ #!/usr/bin/env zsh -ZSH_CACHE_DIR="$HOME/.cache/dotfiles" +ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/dotfiles" if [[ ! -d "$ZSH_CACHE_DIR" ]]; then mkdir -pv "$ZSH_CACHE_DIR" fi @@ -28,7 +28,7 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" # . match only plain files # m-1 check if the file was modified today # see "Filename Generation" in zshexpn(1) - for match in $HOME/.zcompdump(N.m-1); do + for match in "${ZSH_CACHE_DIR}/zcompdump"(N.m-1); do run_compdump=0 break done; unset match @@ -36,12 +36,12 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" if (( $run_compdump )); then print -r -- "$0: rebuilding zsh completion dump" # -D flag turns off compdump loading - compinit -D + compinit -D -d "${ZSH_CACHE_DIR}/zcompdump" compdump else # -C flag disables some checks performed by compinit - they are not needed # because we already have a fresh compdump - compinit -C + compinit -C -d "${ZSH_CACHE_DIR}/zcompdump" fi unset run_compdump # }}} From a79d588f34268e00ea35c6b22c654d3a4db75384 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 4 May 2021 02:32:55 +0300 Subject: [PATCH 571/713] still not using neovim GUIs --- nvim/ginit.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/ginit.vim b/nvim/ginit.vim index 9a7395a..75b5e75 100644 --- a/nvim/ginit.vim +++ b/nvim/ginit.vim @@ -1,7 +1,7 @@ " nvim-qt settings {{{ if exists('g:GuiLoaded') - GuiFont Ubuntu Mono derivative Powerline:h14 + GuiFont Ubuntu Mono:h14 GuiTabline 0 endif From 578180ea4ca09df65e0a0470e15a675df3d023a9 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 5 May 2021 01:41:59 +0300 Subject: [PATCH 572/713] [python] stop flake8 from complaining over binary operators --- python/flake8.ini | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/flake8.ini b/python/flake8.ini index b0c0191..bbaa233 100644 --- a/python/flake8.ini +++ b/python/flake8.ini @@ -10,3 +10,7 @@ ignore = E402 # Line too long E501 + # Newline before a binary operator + W503 + # Newline after a binary operator + W504 From 1b38e41eec9da0d06d6cfe18087c16cc9e12afac Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 6 May 2021 15:34:09 +0300 Subject: [PATCH 573/713] fixup! at long last, reformat all Python code with 2 space indents --- nvim/after/ftplugin/python.vim | 1 - 1 file changed, 1 deletion(-) delete mode 100644 nvim/after/ftplugin/python.vim diff --git a/nvim/after/ftplugin/python.vim b/nvim/after/ftplugin/python.vim deleted file mode 100644 index e10ab03..0000000 --- a/nvim/after/ftplugin/python.vim +++ /dev/null @@ -1 +0,0 @@ -Indent 4 From fcf01bf6a9b439a5d903d86fc0947804f9946292 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 6 May 2021 15:34:09 +0300 Subject: [PATCH 574/713] fixup! at long last, reformat all Python code with 2 space indents --- nvim/after/ftplugin/python.vim | 1 - 1 file changed, 1 deletion(-) delete mode 100644 nvim/after/ftplugin/python.vim diff --git a/nvim/after/ftplugin/python.vim b/nvim/after/ftplugin/python.vim deleted file mode 100644 index e10ab03..0000000 --- a/nvim/after/ftplugin/python.vim +++ /dev/null @@ -1 +0,0 @@ -Indent 4 From f3ed9af843f7b7387bbfcbd38c11fdde48b6f7c0 Mon Sep 17 00:00:00 2001 From: Keanu Date: Sat, 8 May 2021 11:54:32 +0000 Subject: [PATCH 575/713] [Codespaces] Add install script. --- install.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..a30d1b9 --- /dev/null +++ b/install.sh @@ -0,0 +1,4 @@ +rm -rf ~/.oh-my-zsh +sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended +git clone https://github.com/keanuplayz/dotfiles ~/.dotfiles +echo "source ~/.dotfiles/zsh/zshrc" \ No newline at end of file From 35dfa8d18475633291cb222a3fac0c5560ae6e30 Mon Sep 17 00:00:00 2001 From: Keanu Date: Sat, 8 May 2021 11:56:38 +0000 Subject: [PATCH 576/713] [Codespaces] Fix install script. --- install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 install.sh diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index a30d1b9..0c325eb --- a/install.sh +++ b/install.sh @@ -1,4 +1,5 @@ rm -rf ~/.oh-my-zsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended git clone https://github.com/keanuplayz/dotfiles ~/.dotfiles -echo "source ~/.dotfiles/zsh/zshrc" \ No newline at end of file +echo "source ~/.dotfiles/zsh/zshrc" >> ~/.zshrc +zsh \ No newline at end of file From cc4aa3ab52781060c2e17bf98907343c22f60e01 Mon Sep 17 00:00:00 2001 From: Keanu Date: Sat, 8 May 2021 12:01:33 +0000 Subject: [PATCH 577/713] [Codespaces] Install welcome script dependencies. --- install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install.sh b/install.sh index 0c325eb..8557c1d 100755 --- a/install.sh +++ b/install.sh @@ -2,4 +2,5 @@ rm -rf ~/.oh-my-zsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended git clone https://github.com/keanuplayz/dotfiles ~/.dotfiles echo "source ~/.dotfiles/zsh/zshrc" >> ~/.zshrc +pip install colorama psutil distro zsh \ No newline at end of file From 1ae2e1bfcc26a410e00d04e8aec204b195a8eec4 Mon Sep 17 00:00:00 2001 From: Keanu Date: Sat, 8 May 2021 12:04:47 +0000 Subject: [PATCH 578/713] [Codespaces] Add Python venv to gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0e47e03..5ee376a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.pyc node_modules/ +.venv \ No newline at end of file From 0809e03363722ed614a6fc535d62ce8b1ae6a3f8 Mon Sep 17 00:00:00 2001 From: Keanu Date: Sat, 8 May 2021 12:06:12 +0000 Subject: [PATCH 579/713] [Codespaces] Attempt to autorun ZSH. --- install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 8557c1d..60d0d3c 100755 --- a/install.sh +++ b/install.sh @@ -3,4 +3,5 @@ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/too git clone https://github.com/keanuplayz/dotfiles ~/.dotfiles echo "source ~/.dotfiles/zsh/zshrc" >> ~/.zshrc pip install colorama psutil distro -zsh \ No newline at end of file +echo "zsh" >> ~/.bashrc +source ~/.bashrc \ No newline at end of file From e2a7a13222b300848308c93c4861d6ed51eea6ee Mon Sep 17 00:00:00 2001 From: Keanu Date: Sat, 8 May 2021 12:12:04 +0000 Subject: [PATCH 580/713] [Codespaces] Set hostname because why not? --- install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install.sh b/install.sh index 60d0d3c..22b40ad 100755 --- a/install.sh +++ b/install.sh @@ -1,3 +1,4 @@ +sudo hostname KeanuCodespaces rm -rf ~/.oh-my-zsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended git clone https://github.com/keanuplayz/dotfiles ~/.dotfiles From 50440e632a0afdc878356ad6dc801b21f1094905 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 8 May 2021 15:53:40 +0300 Subject: [PATCH 581/713] [web] add my userscripts --- {mozilla => web}/firefox/userContent.css | 0 web/userscripts/README.md | 1 + .../github-icon-vertical-align.user.js | 32 +++++++++++++++++ web/userscripts/github-line-height.user.js | 34 +++++++++++++++++++ web/userscripts/github-tab-size.user.js | 34 +++++++++++++++++++ .../steamcommunity-com-linkfilter.user.js | 16 +++++++++ .../twitter-s-param-remover.user.js | 17 ++++++++++ web/userscripts/youtube-screenshot.user.js | 30 ++++++++++++++++ 8 files changed, 164 insertions(+) rename {mozilla => web}/firefox/userContent.css (100%) create mode 100644 web/userscripts/README.md create mode 100644 web/userscripts/github-icon-vertical-align.user.js create mode 100644 web/userscripts/github-line-height.user.js create mode 100644 web/userscripts/github-tab-size.user.js create mode 100644 web/userscripts/steamcommunity-com-linkfilter.user.js create mode 100644 web/userscripts/twitter-s-param-remover.user.js create mode 100644 web/userscripts/youtube-screenshot.user.js diff --git a/mozilla/firefox/userContent.css b/web/firefox/userContent.css similarity index 100% rename from mozilla/firefox/userContent.css rename to web/firefox/userContent.css diff --git a/web/userscripts/README.md b/web/userscripts/README.md new file mode 100644 index 0000000..c118d98 --- /dev/null +++ b/web/userscripts/README.md @@ -0,0 +1 @@ +[Tampermonkey](https://www.tampermonkey.net/) ([Firefox extension](https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/), [Chrome extension](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo)) is recommended for loading these as it supports installing and updating userscripts from a remote URL. diff --git a/web/userscripts/github-icon-vertical-align.user.js b/web/userscripts/github-icon-vertical-align.user.js new file mode 100644 index 0000000..69a94b1 --- /dev/null +++ b/web/userscripts/github-icon-vertical-align.user.js @@ -0,0 +1,32 @@ +// ==UserScript== +// @name GitHub icon vertical alignment fix +// @version 1 +// @grant none +// @match https://github.com/* +// @match https://gist.github.com/* +// @run-at document-start +// ==/UserScript== + +(() => { + 'use strict'; + + function addStylesheet() { + let style = document.createElement('style'); + style.append( + // + '.btn-sm .octicon {\n', + ' vertical-align: middle;\n', + '}\n', + ); + document.head.appendChild(style); + } + + if (document.readyState !== 'loading') { + addStylesheet(); + } else { + document.addEventListener('readystatechange', () => { + if (document.readyState === 'loading') return; + addStylesheet(); + }); + } +})(); diff --git a/web/userscripts/github-line-height.user.js b/web/userscripts/github-line-height.user.js new file mode 100644 index 0000000..fa0a9e5 --- /dev/null +++ b/web/userscripts/github-line-height.user.js @@ -0,0 +1,34 @@ +// ==UserScript== +// @name GitHub line-height +// @version 1 +// @grant none +// @match https://github.com/* +// @match https://gist.github.com/* +// @run-at document-start +// ==/UserScript== + +(() => { + 'use strict'; + + const LINE_HEIGHT = '1.2'; + + function addStylesheet() { + let style = document.createElement('style'); + style.append( + '.blob-num, .blob-code, .markdown-body .highlight pre, .markdown-body pre, \n', + '.cm-s-github-light .CodeMirror-lines, textarea.file-editor-textarea {\n', + ` line-height: ${LINE_HEIGHT};\n`, + '}\n', + ); + document.head.appendChild(style); + } + + if (document.readyState !== 'loading') { + addStylesheet(); + } else { + document.addEventListener('readystatechange', () => { + if (document.readyState === 'loading') return; + addStylesheet(); + }); + } +})(); diff --git a/web/userscripts/github-tab-size.user.js b/web/userscripts/github-tab-size.user.js new file mode 100644 index 0000000..12e5fad --- /dev/null +++ b/web/userscripts/github-tab-size.user.js @@ -0,0 +1,34 @@ +// ==UserScript== +// @name GitHub tab size 4 +// @version 1 +// @grant none +// @match https://github.com/* +// @match https://gist.github.com/* +// @run-at document-start +// ==/UserScript== + +(() => { + 'use strict'; + + const TAB_SIZE = '4'; + + function addStylesheet() { + let style = document.createElement('style'); + style.append( + '* {\n', + ` -moz-tab-size: ${TAB_SIZE} !important;\n`, + ` tab-size: ${TAB_SIZE} !important;\n`, + '}\n', + ); + document.head.appendChild(style); + } + + if (document.readyState !== 'loading') { + addStylesheet(); + } else { + document.addEventListener('readystatechange', () => { + if (document.readyState === 'loading') return; + addStylesheet(); + }); + } +})(); diff --git a/web/userscripts/steamcommunity-com-linkfilter.user.js b/web/userscripts/steamcommunity-com-linkfilter.user.js new file mode 100644 index 0000000..324e011 --- /dev/null +++ b/web/userscripts/steamcommunity-com-linkfilter.user.js @@ -0,0 +1,16 @@ +// ==UserScript== +// @name steamcommunity.com linkfilter disabler +// @version 1 +// @grant none +// @run-at document-start +// @match https://steamcommunity.com/linkfilter/* +// ==/UserScript== + +(() => { + 'use strict'; + let searchParams = new URLSearchParams(window.location.search); + let url = searchParams.get('url'); + if (url) { + window.location.replace(url); + } +})(); diff --git a/web/userscripts/twitter-s-param-remover.user.js b/web/userscripts/twitter-s-param-remover.user.js new file mode 100644 index 0000000..42fb6bd --- /dev/null +++ b/web/userscripts/twitter-s-param-remover.user.js @@ -0,0 +1,17 @@ +// ==UserScript== +// @name twitter ?s=20 remover +// @version 1 +// @grant none +// @match https://twitter.com/* +// @run-at document-start +// ==/UserScript== + +(() => { + 'use strict'; + let searchParams = new URLSearchParams(window.location.search); + let strangeValue = searchParams.get('s'); + if (/[0-9]+/.test(strangeValue)) { + searchParams.delete('s'); + window.location.search = searchParams.toString(); + } +})(); diff --git a/web/userscripts/youtube-screenshot.user.js b/web/userscripts/youtube-screenshot.user.js new file mode 100644 index 0000000..cb5e191 --- /dev/null +++ b/web/userscripts/youtube-screenshot.user.js @@ -0,0 +1,30 @@ +// ==UserScript== +// @name YouTube screenshotter +// @version 1 +// @grant none +// @match https://www.youtube.com/* +// @run-at document-end +// ==/UserScript== + +(() => { + 'use strict'; + + function main() { + window.__userscript__takeScreenshot = function (video, imageType = 'image/png') { + if (!(video instanceof HTMLVideoElement)) { + throw new Error('Assertion failed: video instanceof HTMLVideoElement'); + } + + let canvas = document.createElement('canvas'); + canvas.width = video.videoWidth; + canvas.height = video.videoHeight; + let ctx = canvas.getContext('2d'); + ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight); + window.open(canvas.toDataURL(imageType), '_blank'); + }; + } + + let script = document.createElement('script'); + script.append('(' + main + ')();'); + (document.body || document.head || document.documentElement).appendChild(script); +})(); From 92361f9a54ee77a02f8826f0c2ea125f1f5be18e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 8 May 2021 16:21:27 +0300 Subject: [PATCH 582/713] [userscripts] use the available helper functions --- .../github-icon-vertical-align.user.js | 29 +++++------------ web/userscripts/github-line-height.user.js | 31 +++++-------------- web/userscripts/github-tab-size.user.js | 31 +++++-------------- web/userscripts/youtube-screenshot.user.js | 10 +++--- 4 files changed, 28 insertions(+), 73 deletions(-) diff --git a/web/userscripts/github-icon-vertical-align.user.js b/web/userscripts/github-icon-vertical-align.user.js index 69a94b1..eb24152 100644 --- a/web/userscripts/github-icon-vertical-align.user.js +++ b/web/userscripts/github-icon-vertical-align.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name GitHub icon vertical alignment fix -// @version 1 -// @grant none +// @version 2 +// @grant GM_addStyle // @match https://github.com/* // @match https://gist.github.com/* // @run-at document-start @@ -9,24 +9,9 @@ (() => { 'use strict'; - - function addStylesheet() { - let style = document.createElement('style'); - style.append( - // - '.btn-sm .octicon {\n', - ' vertical-align: middle;\n', - '}\n', - ); - document.head.appendChild(style); - } - - if (document.readyState !== 'loading') { - addStylesheet(); - } else { - document.addEventListener('readystatechange', () => { - if (document.readyState === 'loading') return; - addStylesheet(); - }); - } + GM_addStyle(` + .btn-sm .octicon { + vertical-align: middle; + } + `); })(); diff --git a/web/userscripts/github-line-height.user.js b/web/userscripts/github-line-height.user.js index fa0a9e5..70b1aca 100644 --- a/web/userscripts/github-line-height.user.js +++ b/web/userscripts/github-line-height.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name GitHub line-height -// @version 1 -// @grant none +// @version 2 +// @grant GM_addStyle // @match https://github.com/* // @match https://gist.github.com/* // @run-at document-start @@ -9,26 +9,11 @@ (() => { 'use strict'; - const LINE_HEIGHT = '1.2'; - - function addStylesheet() { - let style = document.createElement('style'); - style.append( - '.blob-num, .blob-code, .markdown-body .highlight pre, .markdown-body pre, \n', - '.cm-s-github-light .CodeMirror-lines, textarea.file-editor-textarea {\n', - ` line-height: ${LINE_HEIGHT};\n`, - '}\n', - ); - document.head.appendChild(style); - } - - if (document.readyState !== 'loading') { - addStylesheet(); - } else { - document.addEventListener('readystatechange', () => { - if (document.readyState === 'loading') return; - addStylesheet(); - }); - } + GM_addStyle(` + .blob-num, .blob-code, .markdown-body .highlight pre, .markdown-body pre, + .cm-s-github-light .CodeMirror-lines, textarea.file-editor-textarea { + line-height: ${LINE_HEIGHT}; + } + `); })(); diff --git a/web/userscripts/github-tab-size.user.js b/web/userscripts/github-tab-size.user.js index 12e5fad..1dd581b 100644 --- a/web/userscripts/github-tab-size.user.js +++ b/web/userscripts/github-tab-size.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name GitHub tab size 4 -// @version 1 -// @grant none +// @version 2 +// @grant GM_addStyle // @match https://github.com/* // @match https://gist.github.com/* // @run-at document-start @@ -9,26 +9,11 @@ (() => { 'use strict'; - const TAB_SIZE = '4'; - - function addStylesheet() { - let style = document.createElement('style'); - style.append( - '* {\n', - ` -moz-tab-size: ${TAB_SIZE} !important;\n`, - ` tab-size: ${TAB_SIZE} !important;\n`, - '}\n', - ); - document.head.appendChild(style); - } - - if (document.readyState !== 'loading') { - addStylesheet(); - } else { - document.addEventListener('readystatechange', () => { - if (document.readyState === 'loading') return; - addStylesheet(); - }); - } + GM_addStyle(` + * { + -moz-tab-size: ${TAB_SIZE} !important; + tab-size: ${TAB_SIZE} !important; + } + `); })(); diff --git a/web/userscripts/youtube-screenshot.user.js b/web/userscripts/youtube-screenshot.user.js index cb5e191..e2c2f29 100644 --- a/web/userscripts/youtube-screenshot.user.js +++ b/web/userscripts/youtube-screenshot.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name YouTube screenshotter -// @version 1 -// @grant none +// @version 2 +// @grant GM_addElement // @match https://www.youtube.com/* // @run-at document-end // ==/UserScript== @@ -24,7 +24,7 @@ }; } - let script = document.createElement('script'); - script.append('(' + main + ')();'); - (document.body || document.head || document.documentElement).appendChild(script); + GM_addElement('script', { + textContent: `(${main.toString()})();`, + }); })(); From f62f9bc0bab6b8e1d036ca384ad82c6ee8946b4b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 8 May 2021 22:00:21 +0300 Subject: [PATCH 583/713] Revert "[userscripts] use the available helper functions" This reverts commit 92361f9a54ee77a02f8826f0c2ea125f1f5be18e. --- .../github-icon-vertical-align.user.js | 29 ++++++++++++----- web/userscripts/github-line-height.user.js | 31 ++++++++++++++----- web/userscripts/github-tab-size.user.js | 31 ++++++++++++++----- web/userscripts/youtube-screenshot.user.js | 10 +++--- 4 files changed, 73 insertions(+), 28 deletions(-) diff --git a/web/userscripts/github-icon-vertical-align.user.js b/web/userscripts/github-icon-vertical-align.user.js index eb24152..c30a35d 100644 --- a/web/userscripts/github-icon-vertical-align.user.js +++ b/web/userscripts/github-icon-vertical-align.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name GitHub icon vertical alignment fix -// @version 2 -// @grant GM_addStyle +// @version 3 +// @grant none // @match https://github.com/* // @match https://gist.github.com/* // @run-at document-start @@ -9,9 +9,24 @@ (() => { 'use strict'; - GM_addStyle(` - .btn-sm .octicon { - vertical-align: middle; - } - `); + + function addStylesheet() { + let style = document.createElement('style'); + style.append( + // + '.btn-sm .octicon {\n', + ' vertical-align: middle;\n', + '}\n', + ); + document.head.appendChild(style); + } + + if (document.readyState !== 'loading') { + addStylesheet(); + } else { + document.addEventListener('readystatechange', () => { + if (document.readyState === 'loading') return; + addStylesheet(); + }); + } })(); diff --git a/web/userscripts/github-line-height.user.js b/web/userscripts/github-line-height.user.js index 70b1aca..32aca81 100644 --- a/web/userscripts/github-line-height.user.js +++ b/web/userscripts/github-line-height.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name GitHub line-height -// @version 2 -// @grant GM_addStyle +// @version 3 +// @grant none // @match https://github.com/* // @match https://gist.github.com/* // @run-at document-start @@ -9,11 +9,26 @@ (() => { 'use strict'; + const LINE_HEIGHT = '1.2'; - GM_addStyle(` - .blob-num, .blob-code, .markdown-body .highlight pre, .markdown-body pre, - .cm-s-github-light .CodeMirror-lines, textarea.file-editor-textarea { - line-height: ${LINE_HEIGHT}; - } - `); + + function addStylesheet() { + let style = document.createElement('style'); + style.append( + '.blob-num, .blob-code, .markdown-body .highlight pre, .markdown-body pre, \n', + '.cm-s-github-light .CodeMirror-lines, textarea.file-editor-textarea {\n', + ` line-height: ${LINE_HEIGHT};\n`, + '}\n', + ); + document.head.appendChild(style); + } + + if (document.readyState !== 'loading') { + addStylesheet(); + } else { + document.addEventListener('readystatechange', () => { + if (document.readyState === 'loading') return; + addStylesheet(); + }); + } })(); diff --git a/web/userscripts/github-tab-size.user.js b/web/userscripts/github-tab-size.user.js index 1dd581b..570f79d 100644 --- a/web/userscripts/github-tab-size.user.js +++ b/web/userscripts/github-tab-size.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name GitHub tab size 4 -// @version 2 -// @grant GM_addStyle +// @version 3 +// @grant none // @match https://github.com/* // @match https://gist.github.com/* // @run-at document-start @@ -9,11 +9,26 @@ (() => { 'use strict'; + const TAB_SIZE = '4'; - GM_addStyle(` - * { - -moz-tab-size: ${TAB_SIZE} !important; - tab-size: ${TAB_SIZE} !important; - } - `); + + function addStylesheet() { + let style = document.createElement('style'); + style.append( + '* {\n', + ` -moz-tab-size: ${TAB_SIZE} !important;\n`, + ` tab-size: ${TAB_SIZE} !important;\n`, + '}\n', + ); + document.head.appendChild(style); + } + + if (document.readyState !== 'loading') { + addStylesheet(); + } else { + document.addEventListener('readystatechange', () => { + if (document.readyState === 'loading') return; + addStylesheet(); + }); + } })(); diff --git a/web/userscripts/youtube-screenshot.user.js b/web/userscripts/youtube-screenshot.user.js index e2c2f29..e4e0bac 100644 --- a/web/userscripts/youtube-screenshot.user.js +++ b/web/userscripts/youtube-screenshot.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name YouTube screenshotter -// @version 2 -// @grant GM_addElement +// @version 3 +// @grant none // @match https://www.youtube.com/* // @run-at document-end // ==/UserScript== @@ -24,7 +24,7 @@ }; } - GM_addElement('script', { - textContent: `(${main.toString()})();`, - }); + let script = document.createElement('script'); + script.append(`(${main.toString()})();`); + (document.body || document.head || document.documentElement).appendChild(script); })(); From 32c743318374481327cf8af6f12f16aaa9ebbfd8 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 8 May 2021 22:24:52 +0300 Subject: [PATCH 584/713] upgrade the dependencies of markdown2htmldoc --- script-resources/markdown2htmldoc/main.js | 66 +-- .../markdown2htmldoc/package.json | 14 +- script-resources/markdown2htmldoc/yarn.lock | 502 ++++++++++-------- 3 files changed, 305 insertions(+), 277 deletions(-) diff --git a/script-resources/markdown2htmldoc/main.js b/script-resources/markdown2htmldoc/main.js index 6a8b5a1..9efa1c7 100755 --- a/script-resources/markdown2htmldoc/main.js +++ b/script-resources/markdown2htmldoc/main.js @@ -11,45 +11,43 @@ const loadPrismLanguages = require('prismjs/components/'); const PRISM_COMPONENTS = require('prismjs/components.js'); // TODO: integrate -const PRISM_THEMES = Object.keys(PRISM_COMPONENTS.themes).filter( - (k) => k !== 'meta', -); +const PRISM_THEMES = Object.keys(PRISM_COMPONENTS.themes).filter((k) => k !== 'meta'); let parser = new argparse.ArgumentParser(); -parser.addArgument('INPUT_FILE', { - nargs: argparse.Const.OPTIONAL, +parser.add_argument('INPUT_FILE', { + nargs: argparse.OPTIONAL, help: '(stdin by default)', }); -parser.addArgument('OUTPUT_FILE', { - nargs: argparse.Const.OPTIONAL, +parser.add_argument('OUTPUT_FILE', { + nargs: argparse.OPTIONAL, help: '(stdout by default)', }); -parser.addArgument('--input-encoding', { - defaultValue: 'utf-8', +parser.add_argument('--input-encoding', { + default: 'utf-8', help: '(utf-8 by default)', }); -parser.addArgument('--output-encoding', { - defaultValue: 'utf-8', +parser.add_argument('--output-encoding', { + default: 'utf-8', help: '(utf-8 by default)', }); -parser.addArgument('--no-default-stylesheets', { - nargs: argparse.Const.SUPPRESS, +parser.add_argument('--no-default-stylesheets', { + action: argparse.BooleanOptionalAction, }); -parser.addArgument('--syntax-theme', { +parser.add_argument('--syntax-theme', { choices: [...PRISM_THEMES, 'none', 'dotfiles'], }); -parser.addArgument('--stylesheet', { - nargs: argparse.Const.ZERO_OR_MORE, +parser.add_argument('--stylesheet', { + nargs: argparse.ZERO_OR_MORE, }); -parser.addArgument('--script', { - nargs: argparse.Const.ZERO_OR_MORE, +parser.add_argument('--script', { + nargs: argparse.ZERO_OR_MORE, }); -let args = parser.parseArgs(); +let args = parser.parse_args(); loadPrismLanguages(); // loads all languages @@ -67,31 +65,23 @@ md.use(markdownItTaskCheckbox); md.use(markdownItEmoji); md.use(markdownItHeaderAnchors); -let markdownDocument = fs.readFileSync( - args.get('INPUT_FILE', 0), - args.get('input_encoding'), -); +let markdownDocument = fs.readFileSync(args.INPUT_FILE || 0, args.input_encoding); let renderedMarkdown = md.render(markdownDocument); let stylesheetsTexts = []; let scriptsTexts = []; let syntaxThemeName = null; -if (!args.get('no_default_stylesheets')) { +console.log(Object.entries(args)); +if (!args.no_default_stylesheets) { syntaxThemeName = 'dotfiles'; stylesheetsTexts.push( - fs.readFileSync( - require.resolve('github-markdown-css/github-markdown.css'), - 'utf-8', - ), - fs.readFileSync( - require.resolve('./github-markdown-additions.css'), - 'utf-8', - ), + fs.readFileSync(require.resolve('github-markdown-css/github-markdown.css'), 'utf-8'), + fs.readFileSync(require.resolve('./github-markdown-additions.css'), 'utf-8'), ); } -syntaxThemeName = args.get('syntax_theme') || syntaxThemeName; +syntaxThemeName = args.syntax_theme || syntaxThemeName; if (syntaxThemeName && syntaxThemeName !== 'none') { stylesheetsTexts.push( fs.readFileSync( @@ -105,11 +95,11 @@ if (syntaxThemeName && syntaxThemeName !== 'none') { ); } -for (let stylesheetPath of args.get('stylesheet', [])) { +for (let stylesheetPath of args.stylesheet || []) { stylesheetsTexts.push(fs.readFileSync(stylesheetPath)); } -for (let scriptPath of args.get('script', [])) { +for (let scriptPath of args.script || []) { scriptsTexts.push(fs.readFileSync(scriptPath)); } @@ -131,8 +121,4 @@ ${scriptsTexts.map((s) => ``).join('\n')} `.trim(); -fs.writeFileSync( - args.get('OUTPUT_FILE', 1), - renderedHtmlDocument, - args.get('output_encoding'), -); +fs.writeFileSync(args.OUTPUT_FILE || 1, renderedHtmlDocument, args.output_encoding); diff --git a/script-resources/markdown2htmldoc/package.json b/script-resources/markdown2htmldoc/package.json index 9bdddea..60a265a 100644 --- a/script-resources/markdown2htmldoc/package.json +++ b/script-resources/markdown2htmldoc/package.json @@ -1,20 +1,20 @@ { "private": true, "dependencies": { - "argparse": "^1.0.10", + "argparse": "^2.0.1", "github-markdown-css": "^4.0.0", "github-slugger": "^1.2.1", - "markdown-it": "*", - "markdown-it-emoji": "*", + "markdown-it": "12.0.6", + "markdown-it-emoji": "2.0.0", "markdown-it-task-checkbox": "*", "prismjs": "^1.23.0" }, "devDependencies": { - "eslint": "*", + "eslint": "7.26.0", "eslint-config-dmitmel": "dmitmel/eslint-config-dmitmel", - "eslint-config-prettier": "*", + "eslint-config-prettier": "8.3.0", "eslint-plugin-node": "*", - "eslint-plugin-prettier": "*", - "prettier": "*" + "eslint-plugin-prettier": "3.4.0", + "prettier": "2.2.1" } } diff --git a/script-resources/markdown2htmldoc/yarn.lock b/script-resources/markdown2htmldoc/yarn.lock index 7da943a..04554e2 100644 --- a/script-resources/markdown2htmldoc/yarn.lock +++ b/script-resources/markdown2htmldoc/yarn.lock @@ -2,31 +2,31 @@ # yarn lockfile v1 -"@babel/code-frame@^7.0.0": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" - integrity sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg== +"@babel/code-frame@7.12.11": + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" + integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== dependencies: "@babel/highlight" "^7.10.4" -"@babel/helper-validator-identifier@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2" - integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw== +"@babel/helper-validator-identifier@^7.14.0": + version "7.14.0" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.0.tgz#d26cad8a47c65286b15df1547319a5d0bcf27288" + integrity sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A== "@babel/highlight@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.10.4.tgz#7d1bdfd65753538fabe6c38596cdb76d9ac60143" - integrity sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA== + version "7.14.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.14.0.tgz#3197e375711ef6bf834e67d0daec88e4f46113cf" + integrity sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg== dependencies: - "@babel/helper-validator-identifier" "^7.10.4" + "@babel/helper-validator-identifier" "^7.14.0" chalk "^2.0.0" js-tokens "^4.0.0" -"@eslint/eslintrc@^0.1.3": - version "0.1.3" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.1.3.tgz#7d1a2b2358552cc04834c0979bd4275362e37085" - integrity sha512-4YVwPkANLeNtRjMekzux1ci8hIaH5eGKktGqR0d3LWsKNn5B2X/1Z6Trxy7jQXl9EBGE6Yj02O+t09FMeRllaA== +"@eslint/eslintrc@^0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.1.tgz#442763b88cecbe3ee0ec7ca6d6dd6168550cbf14" + integrity sha512-5v7TDE9plVhvxQeWLXDTvFvJBdH6pEsdnl2g/dAptmuFEPedQ4Erq5rsDsX+mvAM610IhNaO2W5V1dOOnDKxkQ== dependencies: ajv "^6.12.4" debug "^4.1.1" @@ -35,81 +35,84 @@ ignore "^4.0.6" import-fresh "^3.2.1" js-yaml "^3.13.1" - lodash "^4.17.19" minimatch "^3.0.4" strip-json-comments "^3.1.1" -"@types/color-name@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" - integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ== - -acorn-jsx@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.2.0.tgz#4c66069173d6fdd68ed85239fc256226182b2ebe" - integrity sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ== +acorn-jsx@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b" + integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng== acorn@^7.4.0: - version "7.4.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.0.tgz#e1ad486e6c54501634c6c397c5c121daa383607c" - integrity sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w== + version "7.4.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" + integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.4: - version "6.12.4" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.4.tgz#0614facc4522127fa713445c6bfd3ebd376e2234" - integrity sha512-eienB2c9qVQs2KWexhkrdMLVDoIQCz5KSeLxwg9Lzk4DOfBtIK9PQwwufcsn1jjGuf9WZmqPMbGxOzfcuphJCQ== +ajv@^6.10.0, ajv@^6.12.4: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== dependencies: fast-deep-equal "^3.1.1" fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ajv@^8.0.1: + version "8.2.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.2.0.tgz#c89d3380a784ce81b2085f48811c4c101df4c602" + integrity sha512-WSNGFuyWd//XO8n/m/EaOlNLtO0yL8EXT/74LqT4khdhpZjP7lkj/kT5uwRmGitKEVp/Oj7ZUHeGfPtgHhQ5CA== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" + ansi-colors@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== -ansi-regex@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" - integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== - ansi-regex@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== -ansi-styles@^3.2.0, ansi-styles@^3.2.1: +ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: color-convert "^1.9.0" -ansi-styles@^4.1.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" - integrity sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA== +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== dependencies: - "@types/color-name" "^1.1.1" color-convert "^2.0.1" -argparse@^1.0.10, argparse@^1.0.7: +argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== dependencies: sprintf-js "~1.0.2" -astral-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" - integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + +astral-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" + integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== brace-expansion@^1.1.7: version "1.1.11" @@ -134,17 +137,17 @@ chalk@^2.0.0: supports-color "^5.3.0" chalk@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" - integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== + version "4.1.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.1.tgz#c80b3fab28bf6371e6863325eee67e618b77e6ad" + integrity sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg== dependencies: ansi-styles "^4.1.0" supports-color "^7.1.0" clipboard@^2.0.0: - version "2.0.6" - resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.6.tgz#52921296eec0fdf77ead1749421b21c968647376" - integrity sha512-g5zbiixBRk/wyKakSwCKd7vQXDjFnAMGHoEyBogG/bw9kTD9GvdAvaoRR1ALcEzt3pVKxZR0pViekPMIS0QyGg== + version "2.0.8" + resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.8.tgz#ffc6c103dd2967a83005f3f61976aa4655a4cdba" + integrity sha512-Y6WO0unAIQp5bLmk1zdThRhgJt/x3ks6f30s3oE3H1mgIEU33XyQjEf8gsf6DxC7NPX8Y1SsNWjUjL/ywLnnbQ== dependencies: good-listener "^1.2.2" select "^1.1.2" @@ -189,11 +192,11 @@ cross-spawn@^7.0.2: which "^2.0.1" debug@^4.0.1, debug@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" - integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== + version "4.3.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" + integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== dependencies: - ms "^2.1.1" + ms "2.1.2" deep-is@^0.1.3: version "0.1.3" @@ -217,10 +220,10 @@ doctrine@^3.0.0: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.1.1.tgz#c6cd0ec1b0642e2a3c67a1137efc5e796da4f88e" integrity sha1-xs0OwbBkLio8Z6ETfvxeeW2k+I4= -emoji-regex@^7.0.1: - version "7.0.3" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" - integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== enquirer@^2.3.5: version "2.3.6" @@ -229,10 +232,10 @@ enquirer@^2.3.5: dependencies: ansi-colors "^4.1.1" -entities@~2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.3.tgz#5c487e5742ab93c15abb5da22759b8590ec03b7f" - integrity sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ== +entities@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/entities/-/entities-2.1.0.tgz#992d3129cf7df6870b96c57858c249a120f8b8b5" + integrity sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w== escape-string-regexp@^1.0.5: version "1.0.5" @@ -240,15 +243,13 @@ escape-string-regexp@^1.0.5: integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= eslint-config-dmitmel@dmitmel/eslint-config-dmitmel: - version "6.1.1" - resolved "https://codeload.github.com/dmitmel/eslint-config-dmitmel/tar.gz/6957792d434034e792e4b665d620ea5af6f8f02d" + version "7.2.0" + resolved "https://codeload.github.com/dmitmel/eslint-config-dmitmel/tar.gz/1d4c7bccde6812183d1a5fdb4a07e0cf9bfdacb1" -eslint-config-prettier@*: - version "6.11.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz#f6d2238c1290d01c859a8b5c1f7d352a0b0da8b1" - integrity sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA== - dependencies: - get-stdin "^6.0.0" +eslint-config-prettier@8.3.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz#f7471b20b6fe8a9a9254cc684454202886a2dd7a" + integrity sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew== eslint-plugin-es@^3.0.0: version "3.0.1" @@ -270,19 +271,19 @@ eslint-plugin-node@*: resolve "^1.10.1" semver "^6.1.0" -eslint-plugin-prettier@*: - version "3.1.4" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz#168ab43154e2ea57db992a2cd097c828171f75c2" - integrity sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg== +eslint-plugin-prettier@3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.0.tgz#cdbad3bf1dbd2b177e9825737fe63b476a08f0c7" + integrity sha512-UDK6rJT6INSfcOo545jiaOwB701uAIt2/dR7WnFQoGCVl1/EMqdANBmwUaqqQ45aXprsTGzSa39LI1PyuRBxxw== dependencies: prettier-linter-helpers "^1.0.0" -eslint-scope@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.0.tgz#d0f971dfe59c69e0cada684b23d49dbf82600ce5" - integrity sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w== +eslint-scope@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== dependencies: - esrecurse "^4.1.0" + esrecurse "^4.3.0" estraverse "^4.1.1" eslint-utils@^2.0.0, eslint-utils@^2.1.0: @@ -297,29 +298,34 @@ eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== -eslint@*: - version "7.8.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.8.1.tgz#e59de3573fb6a5be8ff526c791571646d124a8fa" - integrity sha512-/2rX2pfhyUG0y+A123d0ccXtMm7DV7sH1m3lk9nk2DZ2LReq39FXHueR9xZwshE5MdfSf0xunSaMWRqyIA6M1w== +eslint-visitor-keys@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" + integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== + +eslint@7.26.0: + version "7.26.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.26.0.tgz#d416fdcdcb3236cd8f282065312813f8c13982f6" + integrity sha512-4R1ieRf52/izcZE7AlLy56uIHHDLT74Yzz2Iv2l6kDaYvEu9x+wMB5dZArVL8SYGXSYV2YAg70FcW5Y5nGGNIg== dependencies: - "@babel/code-frame" "^7.0.0" - "@eslint/eslintrc" "^0.1.3" + "@babel/code-frame" "7.12.11" + "@eslint/eslintrc" "^0.4.1" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" debug "^4.0.1" doctrine "^3.0.0" enquirer "^2.3.5" - eslint-scope "^5.1.0" + eslint-scope "^5.1.1" eslint-utils "^2.1.0" - eslint-visitor-keys "^1.3.0" - espree "^7.3.0" - esquery "^1.2.0" + eslint-visitor-keys "^2.0.0" + espree "^7.3.1" + esquery "^1.4.0" esutils "^2.0.2" - file-entry-cache "^5.0.1" + file-entry-cache "^6.0.1" functional-red-black-tree "^1.0.1" glob-parent "^5.0.0" - globals "^12.1.0" + globals "^13.6.0" ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" @@ -327,7 +333,7 @@ eslint@*: js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" - lodash "^4.17.19" + lodash "^4.17.21" minimatch "^3.0.4" natural-compare "^1.4.0" optionator "^0.9.1" @@ -336,17 +342,17 @@ eslint@*: semver "^7.2.1" strip-ansi "^6.0.0" strip-json-comments "^3.1.0" - table "^5.2.3" + table "^6.0.4" text-table "^0.2.0" v8-compile-cache "^2.0.3" -espree@^7.3.0: - version "7.3.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.0.tgz#dc30437cf67947cf576121ebd780f15eeac72348" - integrity sha512-dksIWsvKCixn1yrEXO8UosNSxaDoSYpq9reEjZSbHLpT5hpaCAKTLBwq0RHtLrIr+c0ByiYzWT8KTMRzoRCNlw== +espree@^7.3.0, espree@^7.3.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6" + integrity sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g== dependencies: acorn "^7.4.0" - acorn-jsx "^5.2.0" + acorn-jsx "^5.3.1" eslint-visitor-keys "^1.3.0" esprima@^4.0.0: @@ -354,14 +360,14 @@ esprima@^4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esquery@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.3.1.tgz#b78b5828aa8e214e29fb74c4d5b752e1c033da57" - integrity sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ== +esquery@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" + integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== dependencies: estraverse "^5.1.0" -esrecurse@^4.1.0: +esrecurse@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== @@ -403,42 +409,41 @@ fast-levenshtein@^2.0.6: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= -file-entry-cache@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" - integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== dependencies: - flat-cache "^2.0.1" + flat-cache "^3.0.4" -flat-cache@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" - integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== +flat-cache@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" + integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== dependencies: - flatted "^2.0.0" - rimraf "2.6.3" - write "1.0.3" + flatted "^3.1.0" + rimraf "^3.0.2" -flatted@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" - integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== +flatted@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.1.1.tgz#c4b489e80096d9df1dfc97c79871aea7c617c469" + integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA== fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= -get-stdin@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" - integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== - github-markdown-css@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/github-markdown-css/-/github-markdown-css-4.0.0.tgz#be9f4caf7a389228d4c368336260ffc909061f35" @@ -452,16 +457,16 @@ github-slugger@^1.2.1: emoji-regex ">=6.0.0 <=6.1.1" glob-parent@^5.0.0: - version "5.1.1" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229" - integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ== + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== dependencies: is-glob "^4.0.1" glob@^7.1.3: - version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" - integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + version "7.1.7" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" + integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -477,6 +482,13 @@ globals@^12.1.0: dependencies: type-fest "^0.8.1" +globals@^13.6.0: + version "13.8.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.8.0.tgz#3e20f504810ce87a8d72e55aecf8435b50f4c1b3" + integrity sha512-rHtdA6+PDBIjeEvA91rpqzEvk/k3/i7EeNQiryiWuJH0Hw9cpyJMAt2jtbAwUaRdhD+573X4vWw6IcjKPasi9Q== + dependencies: + type-fest "^0.20.2" + good-listener@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/good-listener/-/good-listener-1.2.2.tgz#d53b30cdf9313dffb7dc9a0d477096aa6d145c50" @@ -494,6 +506,13 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== +has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + dependencies: + function-bind "^1.1.1" + ignore@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" @@ -505,9 +524,9 @@ ignore@^5.1.1: integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== import-fresh@^3.0.0, import-fresh@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66" - integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ== + version "3.3.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== dependencies: parent-module "^1.0.0" resolve-from "^4.0.0" @@ -530,15 +549,22 @@ inherits@2: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== +is-core-module@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.3.0.tgz#d341652e3408bca69c4671b79a0954a3d349f887" + integrity sha512-xSphU2KG9867tsYdLD4RWQ1VqdFl4HTO9Thf3I/3dLEfr0dbPTWKsuCKrgqMljg4nPE+Gq0VCnzT3gr0CyBmsw== + dependencies: + has "^1.0.3" + is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== is-glob@^4.0.0, is-glob@^4.0.1: version "4.0.1" @@ -558,9 +584,9 @@ js-tokens@^4.0.0: integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== js-yaml@^3.13.1: - version "3.14.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" - integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== + version "3.14.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" + integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== dependencies: argparse "^1.0.7" esprima "^4.0.0" @@ -570,6 +596,11 @@ json-schema-traverse@^0.4.1: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" @@ -590,28 +621,45 @@ linkify-it@^3.0.1: dependencies: uc.micro "^1.0.1" -lodash@^4.17.14, lodash@^4.17.19: - version "4.17.20" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" - integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== +lodash.clonedeep@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" + integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= -markdown-it-emoji@*: - version "1.4.0" - resolved "https://registry.yarnpkg.com/markdown-it-emoji/-/markdown-it-emoji-1.4.0.tgz#9bee0e9a990a963ba96df6980c4fddb05dfb4dcc" - integrity sha1-m+4OmpkKljupbfaYDE/dsF37Tcw= +lodash.truncate@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" + integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= + +lodash@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + +markdown-it-emoji@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/markdown-it-emoji/-/markdown-it-emoji-2.0.0.tgz#3164ad4c009efd946e98274f7562ad611089a231" + integrity sha512-39j7/9vP/CPCKbEI44oV8yoPJTpvfeReTn/COgRhSpNrjWF3PfP/JUxxB0hxV6ynOY8KH8Y8aX9NMDdo6z+6YQ== markdown-it-task-checkbox@*: version "1.0.6" resolved "https://registry.yarnpkg.com/markdown-it-task-checkbox/-/markdown-it-task-checkbox-1.0.6.tgz#9ebd7b6382e99162264605bc580f2ac118be4242" integrity sha512-7pxkHuvqTOu3iwVGmDPeYjQg+AIS9VQxzyLP9JCg9lBjgPAJXGEkChK6A2iFuj3tS0GV3HG2u5AMNhcQqwxpJw== -markdown-it@*: - version "11.0.0" - resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-11.0.0.tgz#dbfc30363e43d756ebc52c38586b91b90046b876" - integrity sha512-+CvOnmbSubmQFSA9dKz1BRiaSMV7rhexl3sngKqFyXSagoA3fBdJQ8oZWtRy2knXdpDXaBw44euz37DeJQ9asg== +markdown-it@12.0.6: + version "12.0.6" + resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-12.0.6.tgz#adcc8e5fe020af292ccbdf161fe84f1961516138" + integrity sha512-qv3sVLl4lMT96LLtR7xeRJX11OUFjsaD5oVat2/SNBIb21bJXwal2+SklcRbTwGwqWpWH/HRtYavOoJE+seL8w== dependencies: - argparse "^1.0.7" - entities "~2.0.0" + argparse "^2.0.1" + entities "~2.1.0" linkify-it "^3.0.1" mdurl "^1.0.1" uc.micro "^1.0.5" @@ -628,19 +676,7 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" - integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== - -mkdirp@^0.5.1: - version "0.5.5" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" - integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== - dependencies: - minimist "^1.2.5" - -ms@^2.1.1: +ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== @@ -703,10 +739,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@*: - version "2.1.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.1.tgz#d9485dd5e499daa6cb547023b87a6cf51bee37d6" - integrity sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw== +prettier@2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" + integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== prismjs@^1.23.0: version "1.23.0" @@ -730,22 +766,28 @@ regexpp@^3.0.0, regexpp@^3.1.0: resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q== +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + resolve-from@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== resolve@^1.10.1: - version "1.17.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" - integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== + version "1.20.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" + integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== dependencies: + is-core-module "^2.2.0" path-parse "^1.0.6" -rimraf@2.6.3: - version "2.6.3" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" - integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== dependencies: glob "^7.1.3" @@ -760,9 +802,11 @@ semver@^6.1.0: integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== semver@^7.2.1: - version "7.3.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" - integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== + version "7.3.5" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" + integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== + dependencies: + lru-cache "^6.0.0" shebang-command@^2.0.0: version "2.0.0" @@ -776,35 +820,28 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -slice-ansi@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" - integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== +slice-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" + integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== dependencies: - ansi-styles "^3.2.0" - astral-regex "^1.0.0" - is-fullwidth-code-point "^2.0.0" + ansi-styles "^4.0.0" + astral-regex "^2.0.0" + is-fullwidth-code-point "^3.0.0" sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= -string-width@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" - integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== +string-width@^4.2.0: + version "4.2.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.2.tgz#dafd4f9559a7585cfba529c6a0a4f73488ebd4c5" + integrity sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA== dependencies: - emoji-regex "^7.0.1" - is-fullwidth-code-point "^2.0.0" - strip-ansi "^5.1.0" - -strip-ansi@^5.1.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" - integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== - dependencies: - ansi-regex "^4.1.0" + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.0" strip-ansi@^6.0.0: version "6.0.0" @@ -832,15 +869,17 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -table@^5.2.3: - version "5.4.6" - resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" - integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== +table@^6.0.4: + version "6.7.0" + resolved "https://registry.yarnpkg.com/table/-/table-6.7.0.tgz#26274751f0ee099c547f6cb91d3eff0d61d155b2" + integrity sha512-SAM+5p6V99gYiiy2gT5ArdzgM1dLDed0nkrWmG6Fry/bUS/m9x83BwpJUOf1Qj/x2qJd+thL6IkIx7qPGRxqBw== dependencies: - ajv "^6.10.2" - lodash "^4.17.14" - slice-ansi "^2.1.0" - string-width "^3.0.0" + ajv "^8.0.1" + lodash.clonedeep "^4.5.0" + lodash.truncate "^4.4.2" + slice-ansi "^4.0.0" + string-width "^4.2.0" + strip-ansi "^6.0.0" text-table@^0.2.0: version "0.2.0" @@ -859,6 +898,11 @@ type-check@^0.4.0, type-check@~0.4.0: dependencies: prelude-ls "^1.2.1" +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + type-fest@^0.8.1: version "0.8.1" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" @@ -870,16 +914,16 @@ uc.micro@^1.0.1, uc.micro@^1.0.5: integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== uri-js@^4.2.2: - version "4.4.0" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.0.tgz#aa714261de793e8a82347a7bcc9ce74e86f28602" - integrity sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g== + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== dependencies: punycode "^2.1.0" v8-compile-cache@^2.0.3: - version "2.1.1" - resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745" - integrity sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ== + version "2.3.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" + integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== which@^2.0.1: version "2.0.2" @@ -898,9 +942,7 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -write@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" - integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== - dependencies: - mkdirp "^0.5.1" +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== From c461a7443a5c4f6935bb3dbee87d7dedb227237c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 9 May 2021 01:10:50 +0300 Subject: [PATCH 585/713] [nvim] enable vim-pencil in emails --- nvim/after/ftplugin/mail.vim | 1 + 1 file changed, 1 insertion(+) create mode 100644 nvim/after/ftplugin/mail.vim diff --git a/nvim/after/ftplugin/mail.vim b/nvim/after/ftplugin/mail.vim new file mode 100644 index 0000000..5138151 --- /dev/null +++ b/nvim/after/ftplugin/mail.vim @@ -0,0 +1 @@ +source :h/text.vim From b1566353e5423975793df2fd07ca8e7d48c83534 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 9 May 2021 10:55:05 +0300 Subject: [PATCH 586/713] [zsh+nvim] fix sudoedit detection --- zsh/aliases.zsh | 1 - zsh/functions.zsh | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index c82c197..8d960ae 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -87,7 +87,6 @@ alias e="$EDITOR" if [[ "$EDITOR" == *vim ]]; then alias es="e -S" fi -alias sue="sudo --edit" alias rsync-backup='rsync --archive --compress --verbose --human-readable --partial --progress' diff --git a/zsh/functions.zsh b/zsh/functions.zsh index f7775a7..a9d956d 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -95,3 +95,10 @@ unset date_formats if (( _is_linux )) && command_exists swapoff && command_exists swapon; then deswap() { sudo sh -c 'swapoff --all && swapon --all'; } fi + +# Taken from +sudoedit() { + SUDO_COMMAND="sudoedit $@" command sudoedit "$@" +} +alias sudoe="sudoedit" +alias sue="sudoedit" From 84ad770f3df25ee0068d5dd8a7c624361fb9bbe2 Mon Sep 17 00:00:00 2001 From: Keanu Date: Mon, 10 May 2021 12:52:04 +0200 Subject: [PATCH 587/713] [zsh] Added Apache2 plugin. --- zsh/plugins.zsh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index dd62b51..044dc8c 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -105,6 +105,13 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" # }}} +# Apache2 {{{ + # Crappy solution, but only run if it's on a Raspberry Pi 4 B + if grep -q BCM2711 /proc/cpuinfo; then + _plugin apache2 'voronkovich/apache2.plugin.zsh' + fi +# }}} + # _plugin fzf 'junegunn/fzf' "$_checkout_latest_version" \ # build='./install --bin' \ # after_load='plugin-cfg-path path prepend bin' \ From b7454a658b03418ac0c3543c90959b245a9bac9f Mon Sep 17 00:00:00 2001 From: Keanu Date: Mon, 10 May 2021 12:58:36 +0200 Subject: [PATCH 588/713] [zsh] Added gitio plugin. --- zsh/plugins.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index 044dc8c..f1c9dbe 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -112,6 +112,8 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" fi # }}} +_plugin gitio 'denysdovhan/gitio-zsh' + # _plugin fzf 'junegunn/fzf' "$_checkout_latest_version" \ # build='./install --bin' \ # after_load='plugin-cfg-path path prepend bin' \ From 47d365b837fb59bd7fdb820385f0916adce763b5 Mon Sep 17 00:00:00 2001 From: Keanu Date: Mon, 10 May 2021 16:05:55 +0200 Subject: [PATCH 589/713] [zsh] Add gpg-crypt commands. --- zsh/functions.zsh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index a9d956d..b3cf23a 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -102,3 +102,25 @@ sudoedit() { } alias sudoe="sudoedit" alias sue="sudoedit" + +# gpg-crypt {{{ + # Encrypt the given file or directory to a given recipient + function gpg-encrypt() { + if [ "$#" -ne 2 ]; then + echo "Usage: $0 FILE/DIRECTORY RECIPIENT" >&2 + return 1 + fi + + tar -c `basename $1` | gpg --encrypt --recipient $2 -o `basename $1`.tar.gpg + } + + # Decrypt the given tar.gpg file + function gpg-decrypt() { + if [ "$#" -ne 1 ] || [[ "$1" != *.tar.gpg ]]; then + echo "Usage: $0 FILE.tar.gpg" >&2 + return 1 + fi + + gpg --quiet --decrypt $1 | tar -x + } +# }}} From 6ebac00f433bc5ee3907405b2f3bb840b1b08eb1 Mon Sep 17 00:00:00 2001 From: Keanu Date: Mon, 10 May 2021 17:20:40 +0200 Subject: [PATCH 590/713] [zsh] Added silence function. --- zsh/functions.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index b3cf23a..bbf832c 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -6,6 +6,8 @@ bytecount() { wc -c "$@" | numfmt --to=iec-i; } mkcd() { mkdir -p "$@" && cd "${@[-1]}"; } +silence() { $1 &>/dev/null } + viscd() { setopt local_options err_return local temp_file chosen_dir From be27b811f73566252f95b86288eefbd296ee6f94 Mon Sep 17 00:00:00 2001 From: Keanu Date: Mon, 10 May 2021 19:32:38 +0200 Subject: [PATCH 591/713] [zsh] Load custom folder. --- zsh/zshrc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zsh/zshrc b/zsh/zshrc index ea8cb05..87660f3 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -52,6 +52,12 @@ for script in functions options path env plugins aliases completion zle prompt c _perf_timer_stop "$script.zsh" done +for script in $ZSH_DOTFILES/custom/**; do + _perf_timer_start "$script" + source "$script" + _perf_timer_stop "$script" +done + command_exists rbenv && eval "$(rbenv init -)" _perf_timer_stop "total" From 091449f6044a2c5ae2087dc69fbf4780871ace2a Mon Sep 17 00:00:00 2001 From: Keanu Date: Mon, 10 May 2021 20:38:37 +0200 Subject: [PATCH 592/713] [zsh] Reimplement loading of custom scripts. --- zsh/functions.zsh | 4 ++++ zsh/zshrc | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index bbf832c..f161e0d 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -6,6 +6,10 @@ bytecount() { wc -c "$@" | numfmt --to=iec-i; } mkcd() { mkdir -p "$@" && cd "${@[-1]}"; } +# Re-added from: +# https://github.com/dmitmel/dotfiles/blob/16f0a1cf32ec97355da2e17de1c4bb458431767b/zsh/functions.zsh#L19 +source_if_exists() { [[ -f "$1" ]] && source "$1" } + silence() { $1 &>/dev/null } viscd() { diff --git a/zsh/zshrc b/zsh/zshrc index 87660f3..7a099d9 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -52,11 +52,13 @@ for script in functions options path env plugins aliases completion zle prompt c _perf_timer_stop "$script.zsh" done -for script in $ZSH_DOTFILES/custom/**; do - _perf_timer_start "$script" - source "$script" - _perf_timer_stop "$script" -done +if [[ -d "$ZSH_DOTFILES/custom" ]]; then + for script in $ZSH_DOTFILES/custom/*.zsh; do + _perf_timer_start "custom/${script##*/}" + source "$script" + _perf_timer_stop "custom/${script##*/}" + done +fi command_exists rbenv && eval "$(rbenv init -)" From 391e01b647cbc4aac1da4c1da31aaa05c2e145e9 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 11 May 2021 10:56:02 +0300 Subject: [PATCH 593/713] [zsh] get rid of some useless things --- .gitignore | 1 + zsh/.gitignore | 1 - zsh/zshrc | 2 -- 3 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 zsh/.gitignore diff --git a/.gitignore b/.gitignore index 0e47e03..85f3c76 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.pyc node_modules/ +*.md.html diff --git a/zsh/.gitignore b/zsh/.gitignore deleted file mode 100644 index 95cb55a..0000000 --- a/zsh/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/custom/ diff --git a/zsh/zshrc b/zsh/zshrc index ea8cb05..8961f85 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -52,8 +52,6 @@ for script in functions options path env plugins aliases completion zle prompt c _perf_timer_stop "$script.zsh" done -command_exists rbenv && eval "$(rbenv init -)" - _perf_timer_stop "total" welcome From 39c393822da986285a06de45df33efd2c8b286fd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 11 May 2021 10:56:53 +0300 Subject: [PATCH 594/713] [zsh] load zplg from the main entry script --- zsh/options.zsh | 3 +++ zsh/plugins.zsh | 7 +------ zsh/zshrc | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/zsh/options.zsh b/zsh/options.zsh index 3679194..f71f718 100644 --- a/zsh/options.zsh +++ b/zsh/options.zsh @@ -58,3 +58,6 @@ setopt hist_verify setopt inc_append_history # synchronize history between active sessions setopt share_history + +# Among other things, used for compatibility with OMZ plugins. +ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/dotfiles" diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index dd62b51..73f3045 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -1,11 +1,6 @@ #!/usr/bin/env zsh -ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/dotfiles" -if [[ ! -d "$ZSH_CACHE_DIR" ]]; then - mkdir -pv "$ZSH_CACHE_DIR" -fi - -source "$ZSH_DOTFILES/zplg.zsh" +mkdir -pv "$ZSH_CACHE_DIR" _plugin() { _perf_timer_start "plugin $1" diff --git a/zsh/zshrc b/zsh/zshrc index 8961f85..ae1c1c7 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -46,7 +46,7 @@ _perf_timer_start "total" fi # }}} -for script in functions options path env plugins aliases completion zle prompt colorscheme; do +for script in functions options path env zplg plugins aliases completion zle prompt colorscheme; do _perf_timer_start "$script.zsh" source "$ZSH_DOTFILES/$script.zsh" _perf_timer_stop "$script.zsh" From 7eb8ac07728f2f026a09790466881e2bb147aaab Mon Sep 17 00:00:00 2001 From: Keanu Date: Fri, 14 May 2021 10:05:35 +0200 Subject: [PATCH 595/713] [zsh] Don't time every custom script. --- zsh/zshrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index 7850b78..55fa9c1 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -53,11 +53,11 @@ for script in functions options path env zplg plugins aliases completion zle pro done if [[ -d "$ZSH_DOTFILES/custom" ]]; then + _perf_timer_start "custom scripts" for script in $ZSH_DOTFILES/custom/*.zsh; do - _perf_timer_start "custom/${script##*/}" source "$script" - _perf_timer_stop "custom/${script##*/}" done + _perf_timer_stop "custom scripts" fi _perf_timer_stop "total" From 8804edfafe8c898f85445df81b5fc2134abdd3a2 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 14 May 2021 11:45:59 +0300 Subject: [PATCH 596/713] [zsh] add a little alias to kitty's icat --- zsh/aliases.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 8d960ae..b044eb4 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -107,3 +107,7 @@ if ! command_exists update-grub; then # left as a challenge to the documentation reader. alias update-grub="grub-mkconfig -o /boot/grub/grub.cfg" fi + +if command_exists kitty && ! command_exists icat; then + alias icat="kitty +kitten icat" +fi From 02cee81a909bfaae750e4a8bf37d80c00e96c91c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 14 May 2021 15:28:44 +0300 Subject: [PATCH 597/713] [nvim] add a GBrowse handler for AUR package repos --- nvim/autoload/dotfiles/fugitive/aur.vim | 84 ++++++++++++++++++++++++ nvim/autoload/dotfiles/indent_motion.vim | 4 +- nvim/autoload/dotfiles/utils.vim | 2 +- nvim/plugin/git.vim | 12 ++++ 4 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 nvim/autoload/dotfiles/fugitive/aur.vim diff --git a/nvim/autoload/dotfiles/fugitive/aur.vim b/nvim/autoload/dotfiles/fugitive/aur.vim new file mode 100644 index 0000000..18df068 --- /dev/null +++ b/nvim/autoload/dotfiles/fugitive/aur.vim @@ -0,0 +1,84 @@ +" Based on +" Also see . +" Other intersting links: +" +" +" +" +" +" +function! dotfiles#fugitive#aur#handler(opts) abort + if type(a:opts) != v:t_dict + return '' + endif + let opts = a:opts + + let parsed = dotfiles#fugitive#aur#parse_url(get(opts, 'remote', '')) + if empty(parsed) + return '' + endif + + let path = substitute(opts.path, '^/', '', '') + if path =~# '^\.git/refs/heads/' + let branch = path[16:-1] + " AUR packages can have only a single branch, master, as it is mapped to + " the branch named after the package in the central Git repository. + if branch ==# 'master' + return parsed.cgit_prefix . '/log/' . parsed.cgit_suffix + endif + return '' + elseif path =~# '^\.git/refs/tags/' + " Tags are not allowed for AUR packages. + let tag = path[15:-1] + return '' + elseif path =~# '^\.git/refs/remotes/[^/]\+/.' + let remote_branch = matchstr(path[18:-1], '^[^/]\+/\zs.*$') + " Same story as with regular branches. + if remote_branch ==# 'master' + return parsed.cgit_prefix . '/log/' . parsed.cgit_suffix + endif + return '' + elseif path =~# '^\.git/' + return parsed.cgit_prefix . '/' . parsed.cgit_suffix + endif + + if opts.commit =~# '^\d\=$' + return '' + elseif expand('%') =~? '^fugitive:' + let commit = opts.commit + else + let commit = a:opts.repo.rev_parse('HEAD') + endif + + let line = min([opts.line1, opts.line2]) + let parsed.cgit_suffix .= '&id=' . substitute(commit, '#', '%23', 'g') + if opts.type ==# 'blob' || opts.type ==# 'tree' + return parsed.cgit_prefix . '/tree/' . substitute(path, '/$', '', 'g') . parsed.cgit_suffix . (line ? '#n'.line : '') + elseif opts.type ==# 'commit' || opts.type ==# 'tag' + return parsed.cgit_prefix . '/commit/' . parsed.cgit_suffix + endif + + return '' +endfunction + + +" Based on +" and . +" Also see . +function! dotfiles#fugitive#aur#parse_url(url) abort + let intro_re = '%(https=|git|ssh)\://%([^/@]+\@)=' + let domain_re = 'aur\.archlinux\.org' + let repo_path_re = '[a-zA-Z0-9][a-zA-Z0-9_\.\+\-]{-}' + let outro_re = '%(\.git)=/=' + let combined_re = '\v^'.intro_re.'\zs('.domain_re.')/('.repo_path_re.')\ze'.outro_re.'$' + let matches = matchlist(a:url, combined_re) + if empty(matches) + return {} + endif + let domain = matches[1] + let package = matches[2] + let homepage = 'https://'.domain.'/pkgbase/'.package + let cgit_prefix = 'https://'.domain.'/cgit/aur.git' + let cgit_suffix = '?h='.package + return {'domain': domain, 'package': package, 'homepage': homepage, 'cgit_prefix': cgit_prefix, 'cgit_suffix': cgit_suffix} +endfunction diff --git a/nvim/autoload/dotfiles/indent_motion.vim b/nvim/autoload/dotfiles/indent_motion.vim index 1d58e8c..42ab37d 100644 --- a/nvim/autoload/dotfiles/indent_motion.vim +++ b/nvim/autoload/dotfiles/indent_motion.vim @@ -2,7 +2,7 @@ " A motion for moving over enclosing indentation blocks. Primarily intended " for reverse-engineering CrossCode. -function dotfiles#indent_motion#run(direction) abort +function! dotfiles#indent_motion#run(direction) abort let cursor_linenr = line(".") let max_linenr = line("$") @@ -55,7 +55,7 @@ function dotfiles#indent_motion#run(direction) abort endfunction " -function dotfiles#indent_motion#indent_level_of(linenr) +function! dotfiles#indent_motion#indent_level_of(linenr) abort if getline(a:linenr) ==# "" return -1 endif diff --git a/nvim/autoload/dotfiles/utils.vim b/nvim/autoload/dotfiles/utils.vim index adf58cc..b96de6e 100644 --- a/nvim/autoload/dotfiles/utils.vim +++ b/nvim/autoload/dotfiles/utils.vim @@ -1,4 +1,4 @@ -function dotfiles#utils#array_remove_element(array, element) +function! dotfiles#utils#array_remove_element(array, element) abort let index = index(a:array, a:element) if index >= 0 call remove(a:array, index) diff --git a/nvim/plugin/git.vim b/nvim/plugin/git.vim index 1b8b235..54455b3 100644 --- a/nvim/plugin/git.vim +++ b/nvim/plugin/git.vim @@ -13,3 +13,15 @@ nnoremap gp :Git push nnoremap gP :Git push --force-with-lease " }}} + +" Fugitive.vim handlers {{{ + + if !exists('g:fugitive_browse_handlers') + let g:fugitive_browse_handlers = [] + endif + + if index(g:fugitive_browse_handlers, function('dotfiles#fugitive#aur#handler')) < 0 + call insert(g:fugitive_browse_handlers, function('dotfiles#fugitive#aur#handler')) + endif + +" }}} From a34e6beee217eb06b43ba8ed000d070898ee8b39 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 15 May 2021 13:07:18 +0300 Subject: [PATCH 598/713] [zsh] add a couple of aliases to numfmt --- zsh/aliases.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index b044eb4..1a40d6f 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -111,3 +111,6 @@ fi if command_exists kitty && ! command_exists icat; then alias icat="kitty +kitten icat" fi + +alias bytefmt2="numfmt --to=iec-i --suffix=B" +alias bytefmt10="numfmt --to=si --suffix=B" From 96df378bb0b2fdbe111cfc0d8f0eab7a99a06b3b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 15 May 2021 18:45:59 +0300 Subject: [PATCH 599/713] [nvim] add some more mappings --- nvim/plugin/editing.vim | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 46cbe9b..8b2ec27 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -100,7 +100,8 @@ set commentstring=//%s nnoremap nnoremap - nnoremap Q + " Source of this trick: + nnoremap Q gq " normal mode nnoremap dg :.diffget @@ -110,10 +111,18 @@ set commentstring=//%s xnoremap dp :diffput " Horizontal scroll + " Alt+hjkl and Alt+Arrow - scroll one column/row + " Alt+Shift+hjkl - scroll half a page " normal mode nnoremap zh nnoremap zH nnoremap zh + nnoremap + nnoremap + nnoremap + nnoremap + nnoremap + nnoremap nnoremap zl nnoremap zL nnoremap zl @@ -121,6 +130,12 @@ set commentstring=//%s xnoremap zh xnoremap zH xnoremap zh + xnoremap + xnoremap + xnoremap + xnoremap + xnoremap + xnoremap xnoremap zl xnoremap zL xnoremap zl From 280606b2b014660395774e21f1384b77477e79ac Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 15 May 2021 19:35:44 +0300 Subject: [PATCH 600/713] [nvim] fix plugins after update --- nvim/colors/dotfiles.vim | 6 ++++-- nvim/plugin/interface.vim | 13 +++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 4c137f3..0a69a98 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -98,10 +98,12 @@ call s:hi('WarningMsg', 0x9, 'NONE', '', '') call s:hi('TooLong', 0x8, '', '', '') call s:hi('Debug', 0x8, '', '', '') - hi! link CocErrorSign Error + hi! link CocErrorSign Error call s:hi('CocWarningSign', 'bg', 0xA, '', '') call s:hi('CocInfoSign', 'bg', 0xD, '', '') - hi! link CocHintSign CocInfoSign + hi! link CocHintSign CocInfoSign + call s:hi('CocFadeOut', 0x3, '', '', '') + hi! link CocMarkdownLink Underlined call s:hi('FoldColumn', 0xC, 0x1, '', '') call s:hi('Folded', 0x3, 0x1, '', '') diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 194922d..2f4ac1f 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -93,6 +93,7 @@ endif let g:airline_symbols = { \ 'readonly': 'RO', \ 'whitespace': "\u21e5 ", + \ 'colnr': '', \ 'linenr': '', \ 'maxlinenr': ' ', \ 'branch': '', @@ -103,6 +104,7 @@ endif let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#coc#enabled = 1 let g:airline#extensions#po#enabled = 0 + let g:airline#extensions#scrollbar#enabled = 0 let g:airline#extensions#tabline#left_sep = ' ' let g:airline#extensions#tabline#left_alt_sep = '' @@ -125,6 +127,17 @@ endif endfunction call airline#parts#define('filesize', { 'function': 'StatusLine_filesize' }) + " Undo this commit a little bit: + " + call airline#parts#define('maxlinenr', { + \ 'raw': '/%L%{g:airline_symbols.maxlinenr}', + \ 'accent': 'bold', + \ }) + call airline#parts#define('colnr', { + \ 'raw': '%{g:airline_symbols.colnr}:%v', + \ 'accent': 'none', + \ }) + function s:airline_section_prepend(section, items) let g:airline_section_{a:section} = airline#section#create_right(a:items + ['']) . g:airline_section_{a:section} endfunction From cbaeeb2f131d9734ec6d8f745a2cca40d5dcec72 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 15 May 2021 22:00:13 +0300 Subject: [PATCH 601/713] fixup! [zsh] add a couple of aliases to numfmt --- zsh/functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index a9d956d..c5b7eaa 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -2,7 +2,7 @@ count() { print -r -- "$#"; } -bytecount() { wc -c "$@" | numfmt --to=iec-i; } +bytecount() { wc -c "$@" | bytefmt2; } mkcd() { mkdir -p "$@" && cd "${@[-1]}"; } From 002cb0fca8b2fd510bf25b0b3a4c42006c6a782f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 16 May 2021 02:42:08 +0300 Subject: [PATCH 602/713] [nvim] enable automatic markdown text wrapping See also dmitmel/eslint-config-dmitmel@4302a7077d33c8d4b8a9a483535a92f430a2f775 --- README.md | 6 ++++-- crosscode/btw-i-use-arch-mod/README.md | 5 ++++- nvim/coc-languages/javascript.vim | 1 + web/userscripts/README.md | 6 +++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e0ce74c..8ae3c22 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # dotfiles -My dotfiles (configurations and settings) for shells, text editors and other terminal programs, plus a collection of scripts. Written for and work on various UNIX-like OSes, primarily for: +My dotfiles (configurations and settings) for shells, text editors and other terminal programs, plus +a collection of scripts. Written for and work on various UNIX-like OSes, primarily for: - Arch Linux, - Linux Mint, @@ -14,6 +15,7 @@ And also a legendary project that has survived for thousands of years of develop ### **This is my personal project! No warranty is provided for running these as a superuser, I am in no way responsible for deletion of `/` with `rm -rf`, and _absolutely no support is provided_ whatsoever unless I explicitly say so personally!** -**It is also recommended for users of this repository to read the scripts they are running. I didn't write the comments just for myself!** +**It is also recommended for users of this repository to read the scripts they are running. I didn't +write the comments just for myself!** **Automatic installers are deliberately not provided.** diff --git a/crosscode/btw-i-use-arch-mod/README.md b/crosscode/btw-i-use-arch-mod/README.md index e722c7f..4b55718 100644 --- a/crosscode/btw-i-use-arch-mod/README.md +++ b/crosscode/btw-i-use-arch-mod/README.md @@ -1 +1,4 @@ -The file [`icon24.png`](icon24.png) was cropped from the file [`/usr/share/archlinux/web/arch83x31.gif`](file:///usr/share/archlinux/web/arch83x31.gif) of the AUR package [`archlinux-artwork`](https://aur.archlinux.org/packages/archlinux-artwork/) and is distributed under the CC-BY-NC-SA license. +The file [`icon24.png`](icon24.png) was cropped from the file +[`/usr/share/archlinux/web/arch83x31.gif`](file:///usr/share/archlinux/web/arch83x31.gif) of the AUR +package [`archlinux-artwork`](https://aur.archlinux.org/packages/archlinux-artwork/) and is +distributed under the CC-BY-NC-SA license. diff --git a/nvim/coc-languages/javascript.vim b/nvim/coc-languages/javascript.vim index 98b3f26..8ea16b3 100644 --- a/nvim/coc-languages/javascript.vim +++ b/nvim/coc-languages/javascript.vim @@ -19,4 +19,5 @@ let g:coc_user_config['prettier'] = { \ 'jsxBracketSameLine': v:true, \ 'arrowParens': 'always', \ 'disableSuccessMessage': v:true, +\ 'proseWrap': 'always', \ } diff --git a/web/userscripts/README.md b/web/userscripts/README.md index c118d98..b3f9c91 100644 --- a/web/userscripts/README.md +++ b/web/userscripts/README.md @@ -1 +1,5 @@ -[Tampermonkey](https://www.tampermonkey.net/) ([Firefox extension](https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/), [Chrome extension](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo)) is recommended for loading these as it supports installing and updating userscripts from a remote URL. +[Tampermonkey](https://www.tampermonkey.net/) +([Firefox extension](https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/), +[Chrome extension](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo)) +is recommended for loading these as it supports installing and updating userscripts from a remote +URL. From 0ff90ad310f2eedebfb7c4e6793b66bf5b930664 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 16 May 2021 02:48:21 +0300 Subject: [PATCH 603/713] fixup! upgrade the dependencies of markdown2htmldoc --- script-resources/markdown2htmldoc/main.js | 1 - 1 file changed, 1 deletion(-) diff --git a/script-resources/markdown2htmldoc/main.js b/script-resources/markdown2htmldoc/main.js index 9efa1c7..8138353 100755 --- a/script-resources/markdown2htmldoc/main.js +++ b/script-resources/markdown2htmldoc/main.js @@ -72,7 +72,6 @@ let stylesheetsTexts = []; let scriptsTexts = []; let syntaxThemeName = null; -console.log(Object.entries(args)); if (!args.no_default_stylesheets) { syntaxThemeName = 'dotfiles'; stylesheetsTexts.push( From ca5544566ac9ab2b6e0c8ae49963c33a60154e63 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 16 May 2021 15:18:43 +0300 Subject: [PATCH 604/713] [nvim] make various airline setup improvements 1. List the extensions I use explicitly. 2. Use the `iminsert` part instead of `keymap` as it shows the short code from `b:keymap_name`. 3. Move the file size display part into its own "extension". 4. Update the file size part on-the-fly by using `wordcount()` not more frequently than 2 seconds. 5. Abuse the extension system for tweaking `maxlinenr` and `colnr`, and also read their real definitions. Pretty cool, am I right? --- .../airline/extensions/dotfiles_filesize.vim | 43 +++++++++++ .../airline/extensions/dotfiles_tweaks.vim | 11 +++ nvim/dotfiles/plugins-list.vim | 6 +- nvim/plugin/interface.vim | 74 +++++-------------- 4 files changed, 74 insertions(+), 60 deletions(-) create mode 100644 nvim/autoload/airline/extensions/dotfiles_filesize.vim create mode 100644 nvim/autoload/airline/extensions/dotfiles_tweaks.vim diff --git a/nvim/autoload/airline/extensions/dotfiles_filesize.vim b/nvim/autoload/airline/extensions/dotfiles_filesize.vim new file mode 100644 index 0000000..aa52fcd --- /dev/null +++ b/nvim/autoload/airline/extensions/dotfiles_filesize.vim @@ -0,0 +1,43 @@ +" Based on + +function! airline#extensions#dotfiles_filesize#init(ext) abort + call airline#parts#define_function('dotfiles_filesize', 'airline#extensions#dotfiles_filesize#get') + call a:ext.add_statusline_func('airline#extensions#dotfiles_filesize#apply') +endfunction + +function! airline#extensions#dotfiles_filesize#apply(...) abort + call airline#extensions#append_to_section('y', airline#section#create_right(['', '', 'dotfiles_filesize'])) +endfunction + +" Finally, this function will be invoked from the statusline. +function! airline#extensions#dotfiles_filesize#get() abort + " Use several preliminary checks to prevent frequent updates. You see, + " wordcount() has to iterate the entire file to calculate its byte size. + " + " + " Implementation of wordcount: + if empty(get(b:, 'dotfiles_filesize_str', '')) || + \ (get(b:, 'dotfiles_filesize_changedtick', 0) !=# b:changedtick && + \ reltimefloat(reltime()) - get(b:, 'dotfiles_filesize_timer') >=# get(g:, 'airline#extensions#dotfiles_filesize#update_delay', 0)) + let bytes = wordcount().bytes + let b:dotfiles_filesize = bytes + + let factor = 1 + for unit in ['B', 'K', 'M', 'G'] + let next_factor = factor * 1024 + if bytes <# next_factor + let number_str = printf('%.2f', (bytes * 1.0) / factor) + " remove trailing zeros + let number_str = substitute(number_str, '\v(\.0*)=$', '', '') + let b:dotfiles_filesize_str = number_str . unit + break + endif + let factor = next_factor + endfor + + let b:dotfiles_filesize_changedtick = b:changedtick + let b:dotfiles_filesize_timer = reltimefloat(reltime()) + endif + + return b:dotfiles_filesize_str +endfunction diff --git a/nvim/autoload/airline/extensions/dotfiles_tweaks.vim b/nvim/autoload/airline/extensions/dotfiles_tweaks.vim new file mode 100644 index 0000000..d1822a3 --- /dev/null +++ b/nvim/autoload/airline/extensions/dotfiles_tweaks.vim @@ -0,0 +1,11 @@ +function! airline#extensions#dotfiles_tweaks#init(ext) abort + " Undo this commit a little bit: + " + call airline#parts#define('maxlinenr', { + \ 'raw': trim(airline#parts#get('maxlinenr').raw), + \ }) + call airline#parts#define('colnr', { + \ 'raw': trim(airline#parts#get('colnr').raw), + \ 'accent': 'none', + \ }) +endfunction diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index ff2ce70..7e94fa2 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -12,12 +12,7 @@ endif Plug 'Raimondi/delimitMate' Plug 'tpope/vim-repeat' - " if g:vim_ide Plug 'tomtom/tcomment_vim' - Plug 'glts/vim-textobj-comment' - " else - " Plug 'tpope/vim-commentary' - " endif Plug 'tpope/vim-surround' Plug 'Yggdroot/indentLine' Plug 'idbrii/detectindent' @@ -35,6 +30,7 @@ Plug 'kana/vim-textobj-entire' Plug 'kana/vim-textobj-line' Plug 'kana/vim-textobj-indent' + Plug 'glts/vim-textobj-comment' " }}} " UI {{{ diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 2f4ac1f..48619e1 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -87,71 +87,35 @@ endif " Airline (statusline) {{{ - let g:airline_theme = 'dotfiles' - let g:airline_symbols = { \ 'readonly': 'RO', - \ 'whitespace': "\u21e5 ", + \ 'whitespace': '', \ 'colnr': '', \ 'linenr': '', \ 'maxlinenr': ' ', \ 'branch': '', - \ 'notexists': " [?]", + \ 'notexists': ' [?]', \ } - - let g:airline#extensions#branch#enabled = 1 - let g:airline#extensions#tabline#enabled = 1 - let g:airline#extensions#coc#enabled = 1 - let g:airline#extensions#po#enabled = 0 - let g:airline#extensions#scrollbar#enabled = 0 - + let g:airline_extensions = [ + \ 'quickfix', + \ 'fzf', + \ 'term', + \ 'hunks', + \ 'branch', + \ 'fugitiveline', + \ 'coc', + \ 'whitespace', + \ 'wordcount', + \ 'tabline', + \ 'obsession', + \ 'dotfiles_tweaks', + \ 'dotfiles_filesize', + \ ] + let g:airline_detect_iminsert = 1 let g:airline#extensions#tabline#left_sep = ' ' let g:airline#extensions#tabline#left_alt_sep = '' - - function StatusLine_filesize() - let bytes = getfsize(expand('%')) - if bytes < 0 | return '' | endif - - let factor = 1 - for unit in ['B', 'K', 'M', 'G'] - let next_factor = factor * 1024 - if bytes < next_factor - let number_str = printf('%.2f', (bytes * 1.0) / factor) - " remove trailing zeros - let number_str = substitute(number_str, '\v\.?0+$', '', '') - return number_str . unit - endif - let factor = next_factor - endfor - endfunction - call airline#parts#define('filesize', { 'function': 'StatusLine_filesize' }) - - " Undo this commit a little bit: - " - call airline#parts#define('maxlinenr', { - \ 'raw': '/%L%{g:airline_symbols.maxlinenr}', - \ 'accent': 'bold', - \ }) - call airline#parts#define('colnr', { - \ 'raw': '%{g:airline_symbols.colnr}:%v', - \ 'accent': 'none', - \ }) - - function s:airline_section_prepend(section, items) - let g:airline_section_{a:section} = airline#section#create_right(a:items + ['']) . g:airline_section_{a:section} - endfunction - function s:airline_section_append(section, items) - let g:airline_section_{a:section} = g:airline_section_{a:section} . airline#section#create_left([''] + a:items) - endfunction - function s:tweak_airline() - call s:airline_section_append('y', ['filesize']) - endfunction - augroup vimrc-interface-airline - autocmd! - autocmd user AirlineAfterInit call s:tweak_airline() - augroup END - + let g:airline#extensions#dotfiles_filesize#update_delay = 2 " }}} From 030c018bb4a1c51ffa6895b2840c578d37db1053 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 16 May 2021 15:55:17 +0300 Subject: [PATCH 605/713] [nvim] make it so that indentLines doesn't close the intro screen --- nvim/plugin/editing.vim | 7 +++++++ nvim/plugin/interface.vim | 8 -------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 8b2ec27..62b7c4c 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -31,6 +31,13 @@ set commentstring=//%s let g:indentLine_showFirstIndentLevel = 1 let g:indentLine_fileTypeExclude = ['text', 'help', 'tutor', 'man'] + augroup vimrc-indentlines-disable + autocmd! + autocmd TermOpen * IndentLinesDisable + " + autocmd VimEnter * if bufname('%') == '' | IndentLinesDisable | endif + augroup END + let g:detectindent_max_lines_to_analyse = 128 let g:detectindent_check_comment_syntax = 1 diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 48619e1..11671da 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -137,12 +137,4 @@ endif " }}} -" Terminal {{{ - augroup vimrc-terminal - autocmd! - autocmd TermOpen * IndentLinesDisable - augroup END -" }}} - - nnoremap make From 59c121fc3186f331140fc272aa82d42c137df6ee Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 16 May 2021 15:55:17 +0300 Subject: [PATCH 606/713] [nvim] fix the disappearing intro/welcome screen --- nvim/colors/dotfiles.vim | 2 +- nvim/dotfiles/plugins-list.vim | 1 + nvim/plugin/editing.vim | 9 ++++++++- nvim/plugin/interface.vim | 8 -------- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 0a69a98..270e8e1 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -54,7 +54,7 @@ hi! link Directory Title call s:hi('Conceal', 0xC, 'NONE', '', '') call s:hi('NonText', 0x3, '', '', '') - hi! link SpecialKey NonText + hi! link SpecialKey Special call s:hi('MatchParen', 'fg', 0x3, '', '') call s:hi('Keyword', 0xE, '', '', '') diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index 7e94fa2..cb6c36c 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -55,6 +55,7 @@ " }}} " Programming {{{ + let g:polyglot_disabled = ['sensible'] Plug 'sheerun/vim-polyglot' Plug 'chikamichi/mediawiki.vim' Plug 'ron-rs/ron.vim' diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 8b2ec27..3b825ba 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -31,6 +31,13 @@ set commentstring=//%s let g:indentLine_showFirstIndentLevel = 1 let g:indentLine_fileTypeExclude = ['text', 'help', 'tutor', 'man'] + augroup vimrc-indentlines-disable + autocmd! + autocmd TermOpen * IndentLinesDisable + " + autocmd VimEnter * if bufname('%') == '' | IndentLinesDisable | endif + augroup END + let g:detectindent_max_lines_to_analyse = 128 let g:detectindent_check_comment_syntax = 1 @@ -51,7 +58,7 @@ set commentstring=//%s " Invisible characters {{{ set list - let &listchars = "tab:\u2192 ,extends:>,precedes:<,eol:\u00ac,trail:\u00b7" + let &listchars = "tab:\u2192 ,extends:>,precedes:<,eol:\u00ac,trail:\u00b7,nbsp:+" let &showbreak = '>' set display+=uhex " }}} diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 48619e1..11671da 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -137,12 +137,4 @@ endif " }}} -" Terminal {{{ - augroup vimrc-terminal - autocmd! - autocmd TermOpen * IndentLinesDisable - augroup END -" }}} - - nnoremap make From abdb1a736679a7329627e5cb00c2961d6f0246d0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 16 May 2021 21:01:43 +0300 Subject: [PATCH 607/713] [nvim] fix Polyglot's bundled vim-sleuth (plus a couple of minor edits) And remove detectindent because now I no longer need it. --- nvim/coc-languages/python.vim | 4 ++-- nvim/colors/dotfiles.vim | 7 +++--- nvim/dotfiles/plugins-list.vim | 1 - nvim/init.vim | 40 ++++++++++++++++++++++++++++++++++ nvim/plugin/editing.vim | 15 ------------- 5 files changed, 46 insertions(+), 21 deletions(-) diff --git a/nvim/coc-languages/python.vim b/nvim/coc-languages/python.vim index 20b80e1..49851ad 100644 --- a/nvim/coc-languages/python.vim +++ b/nvim/coc-languages/python.vim @@ -5,11 +5,11 @@ let g:coc_filetypes += ['python'] let g:coc_user_config['python'] = { \ 'formatting': { \ 'provider': 'yapf', -\ 'yapfArgs': ['--style=' . simplify(g:nvim_dotfiles_dir.'/../python/yapf.ini')] +\ 'yapfArgs': ['--style=' . simplify(g:dotfiles_dir.'/python/yapf.ini')] \ }, \ 'linting': { \ 'pylintEnabled': v:false, \ 'flake8Enabled': v:true, -\ 'flake8Args': ['--config=' . simplify(g:nvim_dotfiles_dir.'/../python/flake8.ini')], +\ 'flake8Args': ['--config=' . simplify(g:dotfiles_dir.'/python/flake8.ini')], \ }, \ } diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 270e8e1..a48e3af 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -3,12 +3,14 @@ " Color definitions {{{ - execute 'source' fnameescape(g:nvim_dotfiles_dir.'/../colorschemes/out/vim.vim') + execute 'source' fnameescape(g:dotfiles_dir.'/colorschemes/out/vim.vim') if !&termguicolors && exists('$_COLORSCHEME_TERMINAL') set notermguicolors endif + let s:is_kitty = $TERM ==# 'xterm-kitty' + " }}} " Theme setup {{{ @@ -102,7 +104,7 @@ call s:hi('CocWarningSign', 'bg', 0xA, '', '') call s:hi('CocInfoSign', 'bg', 0xD, '', '') hi! link CocHintSign CocInfoSign - call s:hi('CocFadeOut', 0x3, '', '', '') + call s:hi('CocFadeOut', 0x3, '', '', '') hi! link CocMarkdownLink Underlined call s:hi('FoldColumn', 0xC, 0x1, '', '') @@ -139,7 +141,6 @@ hi! link ctrlsfMatch Search hi! link ctrlsfLnumMatch ctrlsfMatch - let s:is_kitty = $TERM ==# 'xterm-kitty' let s:spell_fg = s:is_kitty ? '' : 'bg' let s:spell_bg = s:is_kitty ? 'NONE' : '' let s:spell_attr = s:is_kitty ? 'undercurl' : '' diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index cb6c36c..0f3b104 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -15,7 +15,6 @@ Plug 'tomtom/tcomment_vim' Plug 'tpope/vim-surround' Plug 'Yggdroot/indentLine' - Plug 'idbrii/detectindent' Plug 'henrik/vim-indexed-search' Plug 'andymass/vim-matchup' Plug 'inkarkat/vim-ingo-library' " required by LineJuggler diff --git a/nvim/init.vim b/nvim/init.vim index c1f6da4..a1911ba 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,4 +1,5 @@ let g:nvim_dotfiles_dir = expand(':p:h') +let g:dotfiles_dir = expand(':p:h:h') let g:vim_ide = get(g:, 'vim_ide', 0) let g:vim_ide_treesitter = get(g:, 'vim_ide_treesitter', 0) @@ -16,6 +17,21 @@ if !filereadable(s:vim_plug_script) autocmd VimEnter * PlugInstall --sync endif +" HACK: Set `shiftwidth` to something unreasonable to make Polyglot's built-in +" indentation detector believe that it's the "default" value. The problem +" comes from the fact that Polyglot bundles vim-sleuth, but executes it in an +" autoload script, which is loaded by an ftdetect script, which is... loaded +" when vim-plug invokes `filetype on`. Thus vim-sleuth is loaded way before +" the primary chunk of my configuration is loaded, so it won't see my +" preferred indentation value, save 8 (Vim's default) to a local variable +" `s:default_shiftwidth` and always assume that some ftplugin explicitly +" modified the shiftwidth to 2 (my real default value) for that particular +" filetype. So instead I use a classic approach to rectify the problem: +" ridiculously hacky workarounds. In any case, blame this commit: +" . +let s:fake_default_shiftwidth = 0 +let &shiftwidth = s:fake_default_shiftwidth + call plug#begin(s:vim_plug_home) Plug 'junegunn/vim-plug' runtime! dotfiles/plugins-list.vim @@ -35,3 +51,27 @@ endif " }}} colorscheme dotfiles + +if exists(':Sleuth') + " HACK: Continuation of the indentation detection hack. Here I first destroy + " Polyglot's vim-sleuth's autocommands, fortunately there is just one, which + " calls `s:detect_indent()` on `BufEnter`. And also registration into tpope's + " statusline plugin, which I don't use, therefore I don't care. + augroup polyglot-sleuth + autocmd! + " HACK: Now I install my own autocommand, which first resets the local + " shiftwidth to the unreasonable value picked above, which vim-sleuth + " internally compares with its local `s:default_shiftwidth`, sees that both + " are the same, and proceeds to execute the indent detection algorithm. + " Boom, my work here is done. + autocmd BufEnter * let &l:shiftwidth = s:fake_default_shiftwidth | Sleuth + augroup END + + " HACK: In case you are wondering why I'm using Polyglot's bundled vim-sleuth + " given that it requires those terrible hacks to function normally and respect + " my configs, and not something like + " (this is a fork I used to use and which checks syntax groups to improve + " detection quality). ...Well, frankly, even though vim-sleuth's detector uses + " unreliable (at first glance) regex heuristics, in practice it still works + " better than detectindent's syntax group querying. +endif diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 3b825ba..15fce1c 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -38,21 +38,6 @@ set commentstring=//%s autocmd VimEnter * if bufname('%') == '' | IndentLinesDisable | endif augroup END - let g:detectindent_max_lines_to_analyse = 128 - let g:detectindent_check_comment_syntax = 1 - - function s:DetectIndent() - if !empty(&bt) | return | endif - let g:detectindent_preferred_indent = &l:shiftwidth - let g:detectindent_preferred_expandtab = &l:expandtab - DetectIndent - endfunction - - augroup vimrc-detect-indent - autocmd! - autocmd BufReadPost * call s:DetectIndent() - augroup END - " }}} From 53bbede27fbefcebe1bcea2fdec5132f360c123d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 17 May 2021 23:24:48 +0300 Subject: [PATCH 608/713] [zsh] load Rust-related completions with zplg And add some more timers. --- zsh/completions/_rust | 215 -------- zsh/completions/_rustup | 1070 --------------------------------------- zsh/options.zsh | 3 - zsh/path.zsh | 3 +- zsh/plugins.zsh | 20 +- zsh/zplg.zsh | 10 +- zsh/zshrc | 4 + 7 files changed, 29 insertions(+), 1296 deletions(-) delete mode 100644 zsh/completions/_rust delete mode 100644 zsh/completions/_rustup diff --git a/zsh/completions/_rust b/zsh/completions/_rust deleted file mode 100644 index 404f622..0000000 --- a/zsh/completions/_rust +++ /dev/null @@ -1,215 +0,0 @@ -#compdef rustc - -local -a _rustc_opts_switches _rustc_opts_lint _rustc_opts_debug - -typeset -A opt_args - -_rustc_debuginfo_levels=( - "0[no debug info]" - "1[line-tables only (for stacktraces and breakpoints)]" - "2[full debug info with variable and type information (same as -g)]" -) - -_rustc_crate_types=( - 'bin' - 'lib' - 'rlib' - 'dylib' - 'staticlib' -) - -_rustc_emit_types=( - 'asm' - 'llvm-bc' - 'llvm-ir' - 'obj' - 'link' - 'dep-info' -) -_rustc_pretty_types=( - 'normal[un-annotated source]' - 'expanded[crates expanded]' - 'typed[crates expanded, with type annotations]' - 'identified[fully parenthesized, AST nodes and blocks with IDs]' - 'flowgraph[graphviz formatted flowgraph for node]:NODEID:' -) -_rustc_color_types=( - 'auto[colorize, if output goes to a tty (default)]' - 'always[always colorize output]' - 'never[never colorize output]' -) -_rustc_info_types=( - 'crate-name[Output the crate name and exit]' - 'file-names[Output the file(s) that would be written if compilation continued and exited]' - 'sysroot[Output the sysroot and exit]' -) - -_rustc_opts_vals=( - --crate-name='[Specify the name of the crate being built]' - --crate-type='[Comma separated list of types of crates for the compiler to emit]:TYPES:_values -s "," "Crate types" "$_rustc_crate_types[@]"' - --emit='[Comma separated list of types of output for the compiler to emit]:TYPES:_values -s "," "Emit Targets" "$_rustc_emit_types[@]"' - --cfg='[Configure the compilation environment]:SPEC:' - --out-dir='[Write output to compiler-chosen filename in . Ignored if -o is specified. (default the current directory)]:DIR:_files -/' - -o'[Write output to . Ignored if more than one --emit is specified.]:FILENAME:_files' - --pretty='[Pretty-print the input instead of compiling]::TYPE:_values "TYPES" "$_rustc_pretty_types[@]"' - -L'[Add a directory to the library search path]:DIR:_files -/' - --target='[Target triple cpu-manufacturer-kernel\[-os\] to compile]:TRIPLE:' - --color='[Configure coloring of output]:CONF:_values "COLORS" "$_rustc_color_types[@]"' - {-v,--version}'[Print version info and exit]::VERBOSE:(verbose)' - --explain='[Provide a detailed explanation of an error message]:OPT:' - --extern'[Specify where an external rust library is located]:ARG:' - --print='[Comma separated list of compiler information to print on stdout]:TYPES:_values -s "," "Compiler Information" "$_rustc_info_types[@]"' -) - -_rustc_opts_switches=( - -g'[Equivalent to -C debuginfo=2]' - {-h,--help}'[Display the help message]' - {-V,--verbose}'[use verbose output]' - -O'[Equivalent to -C opt-level=2]' - --test'[Build a test harness]' -) - - -_rustc_opts_link=( - 'static[Path to the library to link statically]:PATH:_files -/' - 'dylib[Path to the library to link dynamically]:PATH:_files -/' - 'framework[Path to the library to link as a framework]:PATH:_files -/' -) - -_rustc_opts_codegen=( - 'ar[Path to the archive utility to use when assembling archives.]:BIN:_path_files' - 'linker[Path to the linker utility to use when linking libraries, executables, and objects.]:BIN:_path_files' - 'link-args[A space-separated list of extra arguments to pass to the linker when the linker is invoked.]:ARGS:' - 'lto[Perform LLVM link-time optimizations]' - 'target-cpu[Selects a target processor. If the value is "help", then a list of available CPUs is printed.]:CPU:' - 'target-feature[A space-separated list of features to enable or disable for the target. A preceding "+" enables a feature while a preceding "-" disables it. Available features can be discovered through target-cpu=help.]:FEATURE:' - 'passes[A space-separated list of extra LLVM passes to run. A value of "list" will cause rustc to print all known passes and exit. The passes specified are appended at the end of the normal pass manager.]:LIST:' - 'llvm-args[A space-separated list of arguments to pass through to LLVM.]:ARGS:' - 'save-temps[If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated throughout compilation in the output directory.]' - 'rpath[If specified, then the rpath value for dynamic libraries will be set in either dynamic library or executable outputs.]' - 'no-prepopulate-passes[Suppresses pre-population of the LLVM pass manager that is run over the module.]' - 'no-vectorize-loops[Suppresses running the loop vectorization LLVM pass, regardless of optimization level.]' - 'no-vectorize-slp[Suppresses running the LLVM SLP vectorization pass, regardless of optimization level.]' - 'soft-float[Generates software floating point library calls instead of hardware instructions.]' - 'prefer-dynamic[Prefers dynamic linking to static linking.]' - "no-integrated-as[Force usage of an external assembler rather than LLVM's integrated one.]" - 'no-redzone[disable the use of the redzone]' - 'relocation-model[The relocation model to use. (default: pic)]:MODEL:(pic static dynamic-no-pic)' - 'code-model[choose the code model to use (llc -code-model for details)]:MODEL:' - 'metadata[metadata to mangle symbol names with]:VAL:' - 'extra-filenames[extra data to put in each output filename]:VAL:' - 'codegen-units[divide crate into N units to optimize in parallel]:N:' - 'remark[print remarks for these optimization passes (space separated, or "all")]:TYPE:' - 'debuginfo[debug info emission level, 0 = no debug info, 1 = line tables only, 2 = full debug info with variable and type information]:LEVEL:_values "Debug Levels" "$_rustc_debuginfo_levels[@]"' - 'opt-level[Optimize with possible levels 0-3]:LEVEL:(0 1 2 3)' - 'help[Show all codegen options]' -) - -_rustc_opts_lint=( - 'help[Show a list of all lints]' - 'box-pointers[(default: allow) use of owned (Box type) heap memory]' - 'experimental[(default: allow) detects use of #\[experimental\] items]' - 'fat-ptr-transmutes[(default: allow) detects transmutes of fat pointers]' - 'missing-docs[(default: allow) detects missing documentation for public members]' - 'unsafe-blocks[(default: allow) usage of an "unsafe" block]' - 'unstable[(default: allow) detects use of #\[unstable\] items (incl. items with no stability attribute)]' - 'unused-extern-crates[(default: allow) extern crates that are never used]' - 'unused-import-braces[(default: allow) unnecessary braces around an imported item]' - 'unused-qualifications[(default: allow) detects unnecessarily qualified names]' - 'unused-results[(default: allow) unused result of an expression in a statement]' - 'unused-typecasts[(default: allow) detects unnecessary type casts that can be removed]' - 'variant-size-differences[(default: allow) detects enums with widely varying variant sizes]' - 'dead-code[(default: warn) detect unused, unexported items]' - 'deprecated[(default: warn) detects use of #\[deprecated\] items]' - 'improper-ctypes[(default: warn) proper use of libc types in foreign modules]' - 'missing-copy-implementations[(default: warn) detects potentially-forgotten implementations of "Copy"]' - 'non-camel-case-types[(default: warn) types, variants, traits and type parameters should have camel case names]' - 'non-shorthand-field-patterns[(default: warn) using "Struct { x: x }" instead of "Struct { x }"]' - 'non-snake-case[(default: warn) methods, functions, lifetime parameters and modules should have snake case names]' - 'non-upper-case-globals[(default: warn) static constants should have uppercase identifiers]' - 'overflowing-literals[(default: warn) literal out of range for its type]' - 'path-statements[(default: warn) path statements with no effect]' - 'raw-pointer-deriving[(default: warn) uses of #\[derive\] with raw pointers are rarely correct]' - 'unknown-lints[(default: warn) unrecognized lint attribute]' - 'unreachable-code[(default: warn) detects unreachable code paths]' - 'unsigned-negation[(default: warn) using an unary minus operator on unsigned type]' - 'unused-allocation[(default: warn) detects unnecessary allocations that can be eliminated]' - 'unused-assignments[(default: warn) detect assignments that will never be read]' - 'unused-attributes[(default: warn) detects attributes that were not used by the compiler]' - 'unused-comparisons[(default: warn) comparisons made useless by limits of the types involved]' - 'unused-imports[(default: warn) imports that are never used]' - 'unused-must-use[(default: warn) unused result of a type flagged as must_use]' - "unused-mut[(default: warn) detect mut variables which don't need to be mutable]" - 'unused-parens[(default: warn) "if", "match", "while" and "return" do not need parentheses]' - 'unused-unsafe[(default: warn) unnecessary use of an "unsafe" block]' - 'unused-variables[(default: warn) detect variables which are not used in any way]' - 'warnings[(default: warn) mass-change the level for lints which produce warnings]' - 'while-true[(default: warn) suggest using "loop { }" instead of "while true { }"]' - "exceeding-bitshifts[(default: deny) shift exceeds the type's number of bits]" - 'unknown-crate-types[(default: deny) unknown crate type found in #\[crate_type\] directive]' - 'unknown-features[(default: deny) unknown features found in crate-level #\[feature\] directives]' - 'bad-style[non-camel-case-types, non-snake-case, non-upper-case-globals]' - 'unused[unused-imports, unused-variables, unused-assignments, dead-code, unused-mut, unreachable-code, unused-must-use, unused-unsafe, path-statements]' -) - -_rustc_opts_debug=( - 'verbose[in general, enable more debug printouts]' - 'time-passes[measure time of each rustc pass]' - 'count-llvm-insns[count where LLVM instrs originate]' - 'time-llvm-passes[measure time of each LLVM pass]' - 'trans-stats[gather trans statistics]' - 'asm-comments[generate comments into the assembly (may change behavior)]' - 'no-verify[skip LLVM verification]' - 'borrowck-stats[gather borrowck statistics]' - 'no-landing-pads[omit landing pads for unwinding]' - 'debug-llvm[enable debug output from LLVM]' - 'show-span[show spans for compiler debugging]' - 'count-type-sizes[count the sizes of aggregate types]' - 'meta-stats[gather metadata statistics]' - 'print-link-args[Print the arguments passed to the linker]' - 'gc[Garbage collect shared data (experimental)]' - 'print-llvm-passes[Prints the llvm optimization passes being run]' - 'ast-json[Print the AST as JSON and halt]' - 'ast-json-noexpand[Print the pre-expansion AST as JSON and halt]' - 'ls[List the symbols defined by a library crate]' - 'save-analysis[Write syntax and type analysis information in addition to normal output]' - 'flowgraph-print-loans[Include loan analysis data in --pretty flowgraph output]' - 'flowgraph-print-moves[Include move analysis data in --pretty flowgraph output]' - 'flowgraph-print-assigns[Include assignment analysis data in --pretty flowgraph output]' - 'flowgraph-print-all[Include all dataflow analysis data in --pretty flowgraph output]' - 'print-regiion-graph[Prints region inference graph. Use with RUST_REGION_GRAPH=help for more info]' - 'parse-only[Parse only; do not compile, assemble, or link]' - 'no-trans[Run all passes except translation; no output]' - 'no-analysis[Parse and expand the source, but run no analysis]' - 'unstable-options[Adds unstable command line options to rustc interface]' - 'print-enum-sizes[Print the size of enums and their variants]' -) - -_rustc_opts_fun_lint(){ - _values -s , 'options' \ - "$_rustc_opts_lint[@]" -} - -_rustc_opts_fun_debug(){ - _values 'options' "$_rustc_opts_debug[@]" -} - -_rustc_opts_fun_codegen(){ - _values 'options' "$_rustc_opts_codegen[@]" -} - -_rustc_opts_fun_link(){ - _values 'options' "$_rustc_opts_link[@]" -} - -_arguments -s : \ - '(-W --warn)'{-W,--warn=}'[Set lint warnings]:lint options:_rustc_opts_fun_lint' \ - '(-A --allow)'{-A,--allow=}'[Set lint allowed]:lint options:_rustc_opts_fun_lint' \ - '(-D --deny)'{-D,--deny=}'[Set lint denied]:lint options:_rustc_opts_fun_lint' \ - '(-F --forbid)'{-F,--forbid=}'[Set lint forbidden]:lint options:_rustc_opts_fun_lint' \ - '*-Z[Set internal debugging options]:debug options:_rustc_opts_fun_debug' \ - '(-C --codegen)'{-C,--codegen}'[Set internal Codegen options]:codegen options:_rustc_opts_fun_codegen' \ - '*-l[Link the generated crates to the specified native library NAME. the optional KIND can be one of, static, dylib, or framework. If omitted, dylib is assumed.]:ARG:_rustc_opts_fun_link' \ - "$_rustc_opts_switches[@]" \ - "$_rustc_opts_vals[@]" \ - '::files:_files -g "*.rs"' diff --git a/zsh/completions/_rustup b/zsh/completions/_rustup deleted file mode 100644 index 4a84ba9..0000000 --- a/zsh/completions/_rustup +++ /dev/null @@ -1,1070 +0,0 @@ -#compdef rustup - -autoload -U is-at-least - -_rustup() { - typeset -A opt_args - typeset -a _arguments_options - local ret=1 - - if is-at-least 5.2; then - _arguments_options=(-s -S -C) - else - _arguments_options=(-s -C) - fi - - local context curcontext="$curcontext" state line - _arguments "${_arguments_options[@]}" \ -'-v[Enable verbose output]' \ -'--verbose[Enable verbose output]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup_commands" \ -"*::: :->rustup" \ -&& ret=0 - case $state in - (rustup) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-command-$line[1]:" - case $line[1] in - (show) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__show_commands" \ -"*::: :->show" \ -&& ret=0 -case $state in - (show) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-show-command-$line[1]:" - case $line[1] in - (active-toolchain) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(install) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(uninstall) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(update) -_arguments "${_arguments_options[@]}" \ -'--no-self-update[Don'\''t perform self update when running the `rustup` command]' \ -'--force[Force an update, even if some components are missing]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -'::toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(default) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(toolchain) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__toolchain_commands" \ -"*::: :->toolchain" \ -&& ret=0 -case $state in - (toolchain) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-toolchain-command-$line[1]:" - case $line[1] in - (list) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(update) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(add) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(install) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(remove) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(uninstall) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(link) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -':path:_files' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(target) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__target_commands" \ -"*::: :->target" \ -&& ret=0 -case $state in - (target) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-target-command-$line[1]:" - case $line[1] in - (list) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(install) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':target:_files' \ -&& ret=0 -;; -(add) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':target:_files' \ -&& ret=0 -;; -(uninstall) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':target:_files' \ -&& ret=0 -;; -(remove) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':target:_files' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(component) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__component_commands" \ -"*::: :->component" \ -&& ret=0 -case $state in - (component) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-component-command-$line[1]:" - case $line[1] in - (list) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(add) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'--target=[]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':component:_files' \ -&& ret=0 -;; -(remove) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'--target=[]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':component:_files' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(override) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__override_commands" \ -"*::: :->override" \ -&& ret=0 -case $state in - (override) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-override-command-$line[1]:" - case $line[1] in - (list) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(add) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(set) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(remove) -_arguments "${_arguments_options[@]}" \ -'--path=[Path to the directory]' \ -'--nonexistent[Remove override toolchain for all nonexistent directories]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(unset) -_arguments "${_arguments_options[@]}" \ -'--path=[Path to the directory]' \ -'--nonexistent[Remove override toolchain for all nonexistent directories]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(run) -_arguments "${_arguments_options[@]}" \ -'--install[Install the requested toolchain if needed]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -':command:_files' \ -&& ret=0 -;; -(which) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':command:_files' \ -&& ret=0 -;; -(docs) -_arguments "${_arguments_options[@]}" \ -'--path[Only print the path to the documentation]' \ -'--book[The Rust Programming Language book]' \ -'--std[Standard library API documentation]' \ -'--reference[The Rust Reference]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(doc) -_arguments "${_arguments_options[@]}" \ -'--path[Only print the path to the documentation]' \ -'--book[The Rust Programming Language book]' \ -'--std[Standard library API documentation]' \ -'--reference[The Rust Reference]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(man) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':command:_files' \ -&& ret=0 -;; -(self) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__self_commands" \ -"*::: :->self" \ -&& ret=0 -case $state in - (self) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-self-command-$line[1]:" - case $line[1] in - (update) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(uninstall) -_arguments "${_arguments_options[@]}" \ -'-y[]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(upgrade-data) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(telemetry) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__telemetry_commands" \ -"*::: :->telemetry" \ -&& ret=0 -case $state in - (telemetry) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-telemetry-command-$line[1]:" - case $line[1] in - (enable) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(disable) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(analyze) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(set) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__set_commands" \ -"*::: :->set" \ -&& ret=0 -case $state in - (set) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-set-command-$line[1]:" - case $line[1] in - (default-host) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':host_triple:_files' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(completions) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -'::shell:(zsh bash fish powershell elvish)' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -} - -(( $+functions[_rustup_commands] )) || -_rustup_commands() { - local commands; commands=( - "show:Show the active and installed toolchains" \ -"install:Update Rust toolchains" \ -"uninstall:Uninstall Rust toolchains" \ -"update:Update Rust toolchains and rustup" \ -"default:Set the default toolchain" \ -"toolchain:Modify or query the installed toolchains" \ -"target:Modify a toolchain's supported targets" \ -"component:Modify a toolchain's installed components" \ -"override:Modify directory toolchain overrides" \ -"run:Run a command with an environment configured for a given toolchain" \ -"which:Display which binary will be run for a given command" \ -"doc:Open the documentation for the current toolchain" \ -"man:View the man page for a given command" \ -"self:Modify the rustup installation" \ -"telemetry:rustup telemetry commands" \ -"set:Alter rustup settings" \ -"completions:Generate completion scripts for your shell" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup commands' commands "$@" -} -(( $+functions[_rustup__show__active-toolchain_commands] )) || -_rustup__show__active-toolchain_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup show active-toolchain commands' commands "$@" -} -(( $+functions[_rustup__add_commands] )) || -_rustup__add_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup add commands' commands "$@" -} -(( $+functions[_rustup__component__add_commands] )) || -_rustup__component__add_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup component add commands' commands "$@" -} -(( $+functions[_rustup__override__add_commands] )) || -_rustup__override__add_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override add commands' commands "$@" -} -(( $+functions[_rustup__target__add_commands] )) || -_rustup__target__add_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target add commands' commands "$@" -} -(( $+functions[_rustup__toolchain__add_commands] )) || -_rustup__toolchain__add_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain add commands' commands "$@" -} -(( $+functions[_rustup__telemetry__analyze_commands] )) || -_rustup__telemetry__analyze_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup telemetry analyze commands' commands "$@" -} -(( $+functions[_rustup__completions_commands] )) || -_rustup__completions_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup completions commands' commands "$@" -} -(( $+functions[_rustup__component_commands] )) || -_rustup__component_commands() { - local commands; commands=( - "list:List installed and available components" \ -"add:Add a component to a Rust toolchain" \ -"remove:Remove a component from a Rust toolchain" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup component commands' commands "$@" -} -(( $+functions[_rustup__default_commands] )) || -_rustup__default_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup default commands' commands "$@" -} -(( $+functions[_rustup__set__default-host_commands] )) || -_rustup__set__default-host_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup set default-host commands' commands "$@" -} -(( $+functions[_rustup__telemetry__disable_commands] )) || -_rustup__telemetry__disable_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup telemetry disable commands' commands "$@" -} -(( $+functions[_rustup__doc_commands] )) || -_rustup__doc_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup doc commands' commands "$@" -} -(( $+functions[_docs_commands] )) || -_docs_commands() { - local commands; commands=( - - ) - _describe -t commands 'docs commands' commands "$@" -} -(( $+functions[_rustup__docs_commands] )) || -_rustup__docs_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup docs commands' commands "$@" -} -(( $+functions[_rustup__telemetry__enable_commands] )) || -_rustup__telemetry__enable_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup telemetry enable commands' commands "$@" -} -(( $+functions[_rustup__component__help_commands] )) || -_rustup__component__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup component help commands' commands "$@" -} -(( $+functions[_rustup__help_commands] )) || -_rustup__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup help commands' commands "$@" -} -(( $+functions[_rustup__override__help_commands] )) || -_rustup__override__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override help commands' commands "$@" -} -(( $+functions[_rustup__self__help_commands] )) || -_rustup__self__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup self help commands' commands "$@" -} -(( $+functions[_rustup__set__help_commands] )) || -_rustup__set__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup set help commands' commands "$@" -} -(( $+functions[_rustup__show__help_commands] )) || -_rustup__show__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup show help commands' commands "$@" -} -(( $+functions[_rustup__target__help_commands] )) || -_rustup__target__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target help commands' commands "$@" -} -(( $+functions[_rustup__telemetry__help_commands] )) || -_rustup__telemetry__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup telemetry help commands' commands "$@" -} -(( $+functions[_rustup__toolchain__help_commands] )) || -_rustup__toolchain__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain help commands' commands "$@" -} -(( $+functions[_rustup__install_commands] )) || -_rustup__install_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup install commands' commands "$@" -} -(( $+functions[_rustup__target__install_commands] )) || -_rustup__target__install_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target install commands' commands "$@" -} -(( $+functions[_rustup__toolchain__install_commands] )) || -_rustup__toolchain__install_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain install commands' commands "$@" -} -(( $+functions[_rustup__toolchain__link_commands] )) || -_rustup__toolchain__link_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain link commands' commands "$@" -} -(( $+functions[_rustup__component__list_commands] )) || -_rustup__component__list_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup component list commands' commands "$@" -} -(( $+functions[_rustup__override__list_commands] )) || -_rustup__override__list_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override list commands' commands "$@" -} -(( $+functions[_rustup__target__list_commands] )) || -_rustup__target__list_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target list commands' commands "$@" -} -(( $+functions[_rustup__toolchain__list_commands] )) || -_rustup__toolchain__list_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain list commands' commands "$@" -} -(( $+functions[_rustup__man_commands] )) || -_rustup__man_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup man commands' commands "$@" -} -(( $+functions[_rustup__override_commands] )) || -_rustup__override_commands() { - local commands; commands=( - "list:List directory toolchain overrides" \ -"set:Set the override toolchain for a directory" \ -"unset:Remove the override toolchain for a directory" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup override commands' commands "$@" -} -(( $+functions[_rustup__component__remove_commands] )) || -_rustup__component__remove_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup component remove commands' commands "$@" -} -(( $+functions[_rustup__override__remove_commands] )) || -_rustup__override__remove_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override remove commands' commands "$@" -} -(( $+functions[_rustup__remove_commands] )) || -_rustup__remove_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup remove commands' commands "$@" -} -(( $+functions[_rustup__target__remove_commands] )) || -_rustup__target__remove_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target remove commands' commands "$@" -} -(( $+functions[_rustup__toolchain__remove_commands] )) || -_rustup__toolchain__remove_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain remove commands' commands "$@" -} -(( $+functions[_rustup__run_commands] )) || -_rustup__run_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup run commands' commands "$@" -} -(( $+functions[_rustup__self_commands] )) || -_rustup__self_commands() { - local commands; commands=( - "update:Download and install updates to rustup" \ -"uninstall:Uninstall rustup." \ -"upgrade-data:Upgrade the internal data format." \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup self commands' commands "$@" -} -(( $+functions[_rustup__override__set_commands] )) || -_rustup__override__set_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override set commands' commands "$@" -} -(( $+functions[_rustup__set_commands] )) || -_rustup__set_commands() { - local commands; commands=( - "default-host:The triple used to identify toolchains when not specified" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup set commands' commands "$@" -} -(( $+functions[_rustup__show_commands] )) || -_rustup__show_commands() { - local commands; commands=( - "active-toolchain:Show the active toolchain" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup show commands' commands "$@" -} -(( $+functions[_rustup__target_commands] )) || -_rustup__target_commands() { - local commands; commands=( - "list:List installed and available targets" \ -"add:Add a target to a Rust toolchain" \ -"remove:Remove a target from a Rust toolchain" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup target commands' commands "$@" -} -(( $+functions[_rustup__telemetry_commands] )) || -_rustup__telemetry_commands() { - local commands; commands=( - "enable:Enable rustup telemetry" \ -"disable:Disable rustup telemetry" \ -"analyze:Analyze stored telemetry" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup telemetry commands' commands "$@" -} -(( $+functions[_rustup__toolchain_commands] )) || -_rustup__toolchain_commands() { - local commands; commands=( - "list:List installed toolchains" \ -"install:Install or update a given toolchain" \ -"uninstall:Uninstall a toolchain" \ -"link:Create a custom toolchain by symlinking to a directory" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup toolchain commands' commands "$@" -} -(( $+functions[_rustup__self__uninstall_commands] )) || -_rustup__self__uninstall_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup self uninstall commands' commands "$@" -} -(( $+functions[_rustup__target__uninstall_commands] )) || -_rustup__target__uninstall_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target uninstall commands' commands "$@" -} -(( $+functions[_rustup__toolchain__uninstall_commands] )) || -_rustup__toolchain__uninstall_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain uninstall commands' commands "$@" -} -(( $+functions[_rustup__uninstall_commands] )) || -_rustup__uninstall_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup uninstall commands' commands "$@" -} -(( $+functions[_rustup__override__unset_commands] )) || -_rustup__override__unset_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override unset commands' commands "$@" -} -(( $+functions[_rustup__self__update_commands] )) || -_rustup__self__update_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup self update commands' commands "$@" -} -(( $+functions[_rustup__toolchain__update_commands] )) || -_rustup__toolchain__update_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain update commands' commands "$@" -} -(( $+functions[_rustup__update_commands] )) || -_rustup__update_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup update commands' commands "$@" -} -(( $+functions[_rustup__self__upgrade-data_commands] )) || -_rustup__self__upgrade-data_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup self upgrade-data commands' commands "$@" -} -(( $+functions[_rustup__which_commands] )) || -_rustup__which_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup which commands' commands "$@" -} - -_rustup "$@" \ No newline at end of file diff --git a/zsh/options.zsh b/zsh/options.zsh index f71f718..3679194 100644 --- a/zsh/options.zsh +++ b/zsh/options.zsh @@ -58,6 +58,3 @@ setopt hist_verify setopt inc_append_history # synchronize history between active sessions setopt share_history - -# Among other things, used for compatibility with OMZ plugins. -ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/dotfiles" diff --git a/zsh/path.zsh b/zsh/path.zsh index be0077b..4358341 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -109,7 +109,8 @@ path_prepend path ~/.cargo/bin # add my binaries and completions path_prepend path "${ZSH_DOTFILES:h}/scripts" -path_prepend fpath "$ZSH_DOTFILES/completions" +path_prepend fpath "${ZSH_DOTFILES}/completions" +path_prepend fpath "${ZSH_CACHE_DIR}/site-functions" # add user binaries path_prepend path ~/.local/bin diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index 73f3045..b7fdafc 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -1,7 +1,5 @@ #!/usr/bin/env zsh -mkdir -pv "$ZSH_CACHE_DIR" - _plugin() { _perf_timer_start "plugin $1" plugin "$@" @@ -11,8 +9,22 @@ _plugin() { _checkout_latest_version='build=plugin-cfg-git-checkout-version "*"' _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" +_plugin completions-rustc 'https://raw.githubusercontent.com/rust-lang/zsh-config/master/_rust' from=url \ + after_load='plugin-cfg-path fpath prepend ""' +_plugin completions-cargo 'https://raw.githubusercontent.com/rust-lang/cargo/master/src/etc/_cargo' from=url \ + after_load='plugin-cfg-path fpath prepend ""' + +rustup_comp_path="${ZSH_CACHE_DIR}/site-functions/_rustup" +if [[ "${commands[rustup]}" -nt "$rustup_comp_path" || ! -s "$rustup_comp_path" ]]; then + _perf_timer_start "generate rustup completions" + rustup completions zsh >| "$rustup_comp_path" + _perf_timer_stop "generate rustup completions" +fi +unset rustup_comp_path # compinit {{{ + _perf_timer_start "compinit" + # note that completion system must be initialized after zsh-completions and # before Oh My Zsh autoload -U compinit @@ -39,6 +51,8 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" compinit -C -d "${ZSH_CACHE_DIR}/zcompdump" fi unset run_compdump + + _perf_timer_stop "compinit" # }}} # Oh My Zsh {{{ @@ -69,6 +83,7 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" if command_exists fasd; then export _FASD_DATA="${XDG_DATA_HOME:-$HOME/.local/share}/fasd_db.csv" + _perf_timer_start "fasd init" # Initialization taken from fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache" if [[ "${commands[fasd]}" -nt "$fasd_cache" || ! -s "$fasd_cache" ]]; then @@ -76,6 +91,7 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" fi source "$fasd_cache" unset fasd_cache + _perf_timer_stop "fasd init" alias v='f -e "$EDITOR"' alias o='a -e xdg-open' diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh index f087602..c0c40d6 100644 --- a/zsh/zplg.zsh +++ b/zsh/zplg.zsh @@ -46,7 +46,7 @@ fi # Directory in which plugins are stored. It is separate from $ZPLG_HOME for # compatitability with future versions. -_ZPLG_PLUGINS_DIR="$ZPLG_HOME/plugins" +ZPLG_PLUGINS_DIR="$ZPLG_HOME/plugins" # basic logging {{{ @@ -302,7 +302,7 @@ plugin() { # download plugin {{{ - local plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" + local plugin_dir="$ZPLG_PLUGINS_DIR/$plugin_id" # simple check whether the plugin directory exists is enough for me if [[ ! -d "$plugin_dir" ]]; then _zplg_log "downloading $plugin_id" @@ -478,7 +478,7 @@ _zplg_is_plugin_loaded() { plugin_url="${ZPLG_LOADED_PLUGIN_URLS[$plugin_id]}" plugin_from="${ZPLG_LOADED_PLUGIN_SOURCES[$plugin_id]}" - plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" + plugin_dir="$ZPLG_PLUGINS_DIR/$plugin_id" _zplg_log "upgrading $plugin_id" _zplg_source_"$plugin_from"_upgrade "$plugin_url" "$plugin_dir" || return "$?" @@ -512,7 +512,7 @@ _zplg_is_plugin_loaded() { plugin_url="${ZPLG_LOADED_PLUGIN_URLS[$plugin_id]}" plugin_from="${ZPLG_LOADED_PLUGIN_SOURCES[$plugin_id]}" - plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" + plugin_dir="$ZPLG_PLUGINS_DIR/$plugin_id" _zplg_log "removing $plugin_id" rm -rf "$plugin_dir" @@ -543,7 +543,7 @@ _zplg_is_plugin_loaded() { return 1 fi - local plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" + local plugin_dir="$ZPLG_PLUGINS_DIR/$plugin_id" _zplg_log "removing $plugin_id" rm -rf "$plugin_dir" diff --git a/zsh/zshrc b/zsh/zshrc index ae1c1c7..8fcf10a 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -2,6 +2,10 @@ ZSH_DOTFILES="${0:h}" +# Among other things, used for compatibility with OMZ plugins. +ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/dotfiles" +mkdir -pv -- "$ZSH_CACHE_DIR" "${ZSH_CACHE_DIR}/site-functions" + autoload -U colors && colors # Performance {{{ From 4895f06c02d05b0143bc4f60b094ea607e144f5a Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 19 May 2021 11:04:26 +0300 Subject: [PATCH 609/713] [nvim] disable indentation overrides for Python --- nvim/plugin/editing.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 15fce1c..70ba62e 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -266,4 +266,6 @@ set commentstring=//%s let g:vala_syntax_folding_enabled = 0 + let g:python_recommended_style = 0 + " }}} From e0df40d97cc9b24d3e67da599fcb2975756c3657 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 19 May 2021 11:04:40 +0300 Subject: [PATCH 610/713] [nvim] bring back the diff jump motions --- nvim/plugin/git.vim | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/nvim/plugin/git.vim b/nvim/plugin/git.vim index 54455b3..9c3c0c8 100644 --- a/nvim/plugin/git.vim +++ b/nvim/plugin/git.vim @@ -1,17 +1,21 @@ " mappings {{{ let g:gitgutter_map_keys = 0 - nnoremap gg :G - nnoremap g :Git - nnoremap gs :vertical Git - nnoremap gd :Gdiffsplit - nnoremap gb :Git blame - nnoremap gw :GBrowse - nnoremap gW :.GBrowse - nnoremap gc :Git commit % - nnoremap gC :Git commit --amend - nnoremap gl :Gclog - nnoremap gp :Git push - nnoremap gP :Git push --force-with-lease + nnoremap gg :G + nnoremap g :Git + nnoremap gs :vertical Git + nnoremap gd :Gdiffsplit + nnoremap gb :Git blame + nnoremap gw :GBrowse + nnoremap gW :.GBrowse + nnoremap gc :Git commit % + nnoremap gC :Git commit --amend + nnoremap gl :Gclog + nnoremap gp :Git push + nnoremap gP :Git push --force-with-lease + " Jump to the next/previous change in the diff mode because I replace the + " built-in mappings with coc.nvim's for jumping through diagnostics. + nnoremap [g [c + nnoremap ]g ]c " }}} " Fugitive.vim handlers {{{ From 8891f63982ccf8bd4f3d31fc9afc5384f5cb65df Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 20 May 2021 13:17:16 +0300 Subject: [PATCH 611/713] [nvim] bring back the sentence jump motions in prose files --- nvim/after/ftplugin/text.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvim/after/ftplugin/text.vim b/nvim/after/ftplugin/text.vim index 66ad5ed..8b66a8f 100644 --- a/nvim/after/ftplugin/text.vim +++ b/nvim/after/ftplugin/text.vim @@ -1,2 +1,5 @@ call pencil#init() IndentLinesDisable +" Reset these mappings to their default function (jumping over sentences): +noremap ( ( +noremap ) ) From 630d6885a1b44c17b56609ec0d16305bb04647da Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 22 May 2021 15:17:44 +0300 Subject: [PATCH 612/713] [scripts/colortest] add another script which prints color codes --- script-resources/colortest.awk | 17 +++++++++++------ scripts/colortest | 2 +- scripts/colortest2 | 2 +- scripts/colortest3 | 7 +++++++ 4 files changed, 20 insertions(+), 8 deletions(-) create mode 100755 scripts/colortest3 diff --git a/script-resources/colortest.awk b/script-resources/colortest.awk index cf66228..6f87514 100644 --- a/script-resources/colortest.awk +++ b/script-resources/colortest.awk @@ -14,20 +14,24 @@ BEGIN { print ""; } -function print_color(color) { - printf "\033[48;5;%sm \033[0m", color +function print_color(color, idx) { + if (OPT_COLOR_CODES) { + printf "\033[1;30;48;5;%sm %02X \033[0m", color, idx; + } else { + printf "\033[48;5;%sm \033[0m", color; + } } function test_standard_colors() { print "16 standard colors:"; - for (color = 0; color < 16; color += 1) print_color(color); + for (color = 0; color < 16; color += 1) print_color(color, color); print ""; } function test_base16_colorscheme() { print "base16 colorscheme:"; split("0 18 19 8 20 7 21 15 1 16 3 2 6 4 5 17", colors, " "); - for (i = 1; i <= length(colors); i++) print_color(colors[i]); + for (i = 1; i <= length(colors); i++) print_color(colors[i], i - 1); print ""; } @@ -39,7 +43,8 @@ function test_6x6x6_cube() { for (row = 0; row < 6; row++) { for (block_x = 0; block_x < block_grid_w; block_x++) { for (col = 0; col < 6; col++) { - print_color(16 + col + 6*row + 6*6*block_x + block_grid_w*6*6*block_y); + color = col + 6*row + 6*6*block_x + block_grid_w*6*6*block_y + print_color(16 + color, color); } } print ""; @@ -50,7 +55,7 @@ function test_6x6x6_cube() { function test_grayscale() { print "grayscale from black to white in 24 steps:"; for (color = 0; color < 24; color += 1) { - print_color(16 + 6*6*6 + color) + print_color(16 + 6*6*6 + color, color) } print ""; } diff --git a/scripts/colortest b/scripts/colortest index 99f0f4b..9f5bc94 100755 --- a/scripts/colortest +++ b/scripts/colortest @@ -1,6 +1,6 @@ #!/bin/sh -set -e +set -eu script_dir="$(dirname "$0")" diff --git a/scripts/colortest2 b/scripts/colortest2 index 9b685c6..8a439ff 100755 --- a/scripts/colortest2 +++ b/scripts/colortest2 @@ -1,6 +1,6 @@ #!/bin/sh -set -e +set -eu script_dir="$(dirname "$0")" cols="$(tput cols)" diff --git a/scripts/colortest3 b/scripts/colortest3 new file mode 100755 index 0000000..84a2cef --- /dev/null +++ b/scripts/colortest3 @@ -0,0 +1,7 @@ +#!/bin/sh + +set -eu + +script_dir="$(dirname "$0")" + +exec awk -v OPT_COLOR_CODES=1 -f "${script_dir}/../script-resources/colortest.awk" From 796a8a9c4d94a593a8c5a727a7df16fa55b1ec3d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 22 May 2021 15:21:04 +0300 Subject: [PATCH 613/713] [nvim] allow compiling S[AC]SS stylesheets with F9 --- nvim/after/ftplugin/markdown.vim | 3 ++- nvim/after/ftplugin/sass.vim | 1 + nvim/after/ftplugin/scss.vim | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 nvim/after/ftplugin/sass.vim diff --git a/nvim/after/ftplugin/markdown.vim b/nvim/after/ftplugin/markdown.vim index 5408829..f5408c0 100644 --- a/nvim/after/ftplugin/markdown.vim +++ b/nvim/after/ftplugin/markdown.vim @@ -2,9 +2,10 @@ source :h/text.vim let s:src_file = expand('%') let s:out_file = s:src_file.'.html' -let &l:makeprg = 'markdown2htmldoc '.shellescape(s:src_file).' '.shellescape(s:out_file) +let &l:makeprg = 'markdown2htmldoc' for s:arg in get(g:, 'dotfiles_markdown2htmldoc_options', []) let &l:makeprg .= ' '.shellescape(s:arg) endfor +let &l:makeprg .= ' -- '.shellescape(s:src_file).' '.shellescape(s:out_file) nnoremap Open %.html diff --git a/nvim/after/ftplugin/sass.vim b/nvim/after/ftplugin/sass.vim new file mode 100644 index 0000000..6e88f83 --- /dev/null +++ b/nvim/after/ftplugin/sass.vim @@ -0,0 +1 @@ +source :h/scss.vim diff --git a/nvim/after/ftplugin/scss.vim b/nvim/after/ftplugin/scss.vim index 94b3fea..9d5f7f1 100644 --- a/nvim/after/ftplugin/scss.vim +++ b/nvim/after/ftplugin/scss.vim @@ -1 +1,9 @@ source :h/css.vim + +let s:src_file = expand('%') +let s:out_file = s:src_file.'.css' +let &l:makeprg = 'sass' +for s:arg in get(g:, 'dotfiles_dart_sass_options', []) + let &l:makeprg .= ' '.shellescape(s:arg) +endfor +let &l:makeprg .= ' -- '.shellescape(s:src_file).':'.shellescape(s:out_file) From c62a48504f789ebf055d5dc722e658f08b7c3dcf Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 22 May 2021 15:26:36 +0300 Subject: [PATCH 614/713] [nvim] when loading the theme, reset ALL previously set highlighting attributes --- nvim/colors/dotfiles.vim | 79 +++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 37 deletions(-) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index a48e3af..ec9826f 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -25,39 +25,45 @@ endfunction let s:colors = g:dotfiles_colorscheme_base16_colors - function s:hi(group, fg, bg, attr, guisp) - let args = '' + function s:hi(group, fg, bg, attr, sp) + let fg = {} + let bg = {} + let attr = 'NONE' + let sp = {} if a:fg isnot '' let fg = s:is_number(a:fg) ? s:colors[a:fg] : {'gui': a:fg, 'cterm': a:fg} - let args .= ' guifg=' . fg.gui . ' ctermfg=' . fg.cterm endif if a:bg isnot '' let bg = s:is_number(a:bg) ? s:colors[a:bg] : {'gui': a:bg, 'cterm': a:bg} - let args .= ' guibg=' . bg.gui . ' ctermbg=' . bg.cterm endif if a:attr isnot '' - let args .= ' gui=' . a:attr . ' cterm=' . a:attr + let attr = a:attr endif - if a:guisp isnot '' - let guisp = s:is_number(a:guisp) ? s:colors[a:guisp].gui : a:guisp - let args .= ' guisp=' . guisp + if a:sp isnot '' + let sp = s:is_number(a:sp) ? s:colors[a:sp] : {'gui': a:sp, 'cterm': a:sp} endif - exec 'hi' a:group args + exec 'hi' a:group + \ 'guifg='.get(fg, 'gui', 'NONE') 'ctermfg='.get(fg, 'cterm', 'NONE') + \ 'guibg='.get(bg, 'gui', 'NONE') 'ctermbg='.get(bg, 'cterm', 'NONE') + \ 'gui='.(attr) 'cterm='.(attr) + \ 'guisp='.get(sp, 'gui', 'NONE') endfunction " }}} " General syntax highlighting {{{ - call s:hi('Normal', 0x5, 0x0, '', '') - call s:hi('Italic', 0xE, '', 'italic', '') - call s:hi('Bold', 0xA, '', 'bold', '') - call s:hi('Underlined', 0x8, '', 'underline', '') - call s:hi('Title', 0xD, '', 'NONE', '') + " TODO: `hi clear` ? + + call s:hi('Normal', 0x5, 0x0, '', '') + call s:hi('Italic', 0xE, '', 'italic', '') + call s:hi('Bold', 0xA, '', 'bold', '') + call s:hi('Underlined', 0x8, '', 'underline', '') + call s:hi('Title', 0xD, '', '', '') hi! link Directory Title - call s:hi('Conceal', 0xC, 'NONE', '', '') - call s:hi('NonText', 0x3, '', '', '') + call s:hi('Conceal', 0xC, '', '', '') + call s:hi('NonText', 0x3, '', '', '') hi! link SpecialKey Special - call s:hi('MatchParen', 'fg', 0x3, '', '') + call s:hi('MatchParen', 'fg', 0x3, '', '') call s:hi('Keyword', 0xE, '', '', '') hi! link Statement Keyword @@ -78,7 +84,7 @@ hi! link SpecialComment Comment call s:hi('Todo', 'bg', 0xA, 'bold', '') call s:hi('Function', 0xD, '', '', '') - call s:hi('Identifier', 0x8, '', 'none', '') + call s:hi('Identifier', 0x8, '', '', '') hi! link Variable Identifier " call s:hi('Include', 0xF, '', '', '') hi! link Include Keyword @@ -88,30 +94,30 @@ hi! link Delimiter NONE call s:hi('Special', 0xC, '', '', '') call s:hi('Tag', 0xA, '', '', '') - call s:hi('Type', 0xA, '', 'none', '') + call s:hi('Type', 0xA, '', '', '') hi! link Typedef Type " }}} " User interface {{{ - call s:hi('Error', 'bg', 0x8, '', '') - call s:hi('ErrorMsg', 0x8, 'NONE', '', '') - call s:hi('WarningMsg', 0x9, 'NONE', '', '') - call s:hi('TooLong', 0x8, '', '', '') - call s:hi('Debug', 0x8, '', '', '') + call s:hi('Error', 'bg', 0x8, '', '') + call s:hi('ErrorMsg', 0x8, '', '', '') + call s:hi('WarningMsg', 0x9, '', '', '') + call s:hi('TooLong', 0x8, '', '', '') + call s:hi('Debug', 0x8, '', '', '') hi! link CocErrorSign Error - call s:hi('CocWarningSign', 'bg', 0xA, '', '') - call s:hi('CocInfoSign', 'bg', 0xD, '', '') + call s:hi('CocWarningSign', 'bg', 0xA, '', '') + call s:hi('CocInfoSign', 'bg', 0xD, '', '') hi! link CocHintSign CocInfoSign - call s:hi('CocFadeOut', 0x3, '', '', '') + call s:hi('CocFadeOut', 0x3, '', '', '') hi! link CocMarkdownLink Underlined call s:hi('FoldColumn', 0xC, 0x1, '', '') call s:hi('Folded', 0x3, 0x1, '', '') - call s:hi('IncSearch', 0x1, 0x9, 'none', '') - call s:hi('Search', 0x1, 0xA, '', '') + call s:hi('IncSearch', 0x1, 0x9, '', '') + call s:hi('Search', 0x1, 0xA, '', '') hi! link Substitute Search call s:hi('ModeMsg', 0xB, '', '', '') @@ -120,7 +126,7 @@ call s:hi('Visual', '', 0x2, '', '') call s:hi('WildMenu', 0x1, 'fg', '', '') - call s:hi('CursorLine', '', 0x1, 'none', '') + call s:hi('CursorLine', '', 0x1, '', '') hi! link CursorColumn CursorLine call s:hi('ColorColumn', '', 0x1, '', '') call s:hi('LineNr', 0x3, 0x1, '', '') @@ -128,7 +134,7 @@ call s:hi('QuickFixLine', '', 0x2, '', '') call s:hi('SignColumn', 0x3, 0x1, '', '') - call s:hi('StatusLine', 0x4, 0x1, 'none', '') + call s:hi('StatusLine', 0x4, 0x1, '', '') call s:hi('StatusLineNC', 0x3, 0x1, '', '') call s:hi('VertSplit', 0x2, 0x2, '', '') call s:hi('TabLine', 0x3, 0x1, '', '') @@ -142,13 +148,12 @@ hi! link ctrlsfLnumMatch ctrlsfMatch let s:spell_fg = s:is_kitty ? '' : 'bg' - let s:spell_bg = s:is_kitty ? 'NONE' : '' let s:spell_attr = s:is_kitty ? 'undercurl' : '' - call s:hi('SpellBad', s:spell_fg, s:spell_bg, s:spell_attr, 0x8) - call s:hi('SpellLocal', s:spell_fg, s:spell_bg, s:spell_attr, 0xC) - call s:hi('SpellCap', s:spell_fg, s:spell_bg, s:spell_attr, 0xD) - call s:hi('SpellRare', s:spell_fg, s:spell_bg, s:spell_attr, 0xE) - unlet s:is_kitty s:spell_fg s:spell_bg s:spell_attr + call s:hi('SpellBad', s:spell_fg, s:is_kitty ? '' : 0x8, s:spell_attr, 0x8) + call s:hi('SpellLocal', s:spell_fg, s:is_kitty ? '' : 0xC, s:spell_attr, 0xC) + call s:hi('SpellCap', s:spell_fg, s:is_kitty ? '' : 0xD, s:spell_attr, 0xD) + call s:hi('SpellRare', s:spell_fg, s:is_kitty ? '' : 0xE, s:spell_attr, 0xE) + unlet s:is_kitty s:spell_fg s:spell_attr call s:hi('Sneak', 'bg', 0xB, 'bold', '') hi! link SneakScope Visual From f06382d651bbf592b2d5f1a240c005045f586e64 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 22 May 2021 16:22:35 +0300 Subject: [PATCH 615/713] [nvim] fix some bugs with indentation detection yet again. --- nvim/init.vim | 13 +++++++++++-- nvim/plugin/editing.vim | 4 ++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/nvim/init.vim b/nvim/init.vim index a1911ba..fbbb72a 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -63,8 +63,17 @@ if exists(':Sleuth') " shiftwidth to the unreasonable value picked above, which vim-sleuth " internally compares with its local `s:default_shiftwidth`, sees that both " are the same, and proceeds to execute the indent detection algorithm. - " Boom, my work here is done. - autocmd BufEnter * let &l:shiftwidth = s:fake_default_shiftwidth | Sleuth + " ALSO Note how I'm not using `BufEnter` as vim-sleuth does because + " apparently `BufWinEnter` leads to better compatibility with the + " indentLine plugin and potentially less useless invocations (see the note + " about window splits in the docs for this event). Oh, one last thing: + " vim-sleuth forgets to assign the tabstop options, which I have to do as + " well. But anyway, boom, my work here is done. + autocmd BufWinEnter * + \ let &l:shiftwidth = s:fake_default_shiftwidth + \| Sleuth + \| let &l:tabstop = &l:shiftwidth + \| let &l:softtabstop = &l:shiftwidth augroup END " HACK: In case you are wondering why I'm using Polyglot's bundled vim-sleuth diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 70ba62e..5a81cec 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -15,8 +15,8 @@ set commentstring=//%s function SetIndent(expandtab, shiftwidth) let &l:expandtab = a:expandtab let &l:shiftwidth = str2nr(a:shiftwidth) - let &l:tabstop = &shiftwidth - let &l:softtabstop = &shiftwidth + let &l:tabstop = &l:shiftwidth + let &l:softtabstop = &l:shiftwidth endfunction command -nargs=1 Indent call SetIndent(1, ) command -nargs=1 IndentTabs call SetIndent(0, ) From 76eacb2ac270d09577ec15e36f3b75d9335881b9 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 22 May 2021 17:10:37 +0300 Subject: [PATCH 616/713] [nvim+zsh] use a better FZF theme --- nvim/colors/dotfiles.vim | 5 +++-- nvim/plugin/interface.vim | 2 ++ zsh/env.zsh | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index ec9826f..bea107b 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -5,7 +5,8 @@ execute 'source' fnameescape(g:dotfiles_dir.'/colorschemes/out/vim.vim') - if !&termguicolors && exists('$_COLORSCHEME_TERMINAL') + let s:is_gui_color = !has('win32') && !has('win64') && !has('win32unix') && has('termguicolors') && &termguicolors + if s:is_gui_color && exists('$_COLORSCHEME_TERMINAL') set notermguicolors endif @@ -153,7 +154,7 @@ call s:hi('SpellLocal', s:spell_fg, s:is_kitty ? '' : 0xC, s:spell_attr, 0xC) call s:hi('SpellCap', s:spell_fg, s:is_kitty ? '' : 0xD, s:spell_attr, 0xD) call s:hi('SpellRare', s:spell_fg, s:is_kitty ? '' : 0xE, s:spell_attr, 0xE) - unlet s:is_kitty s:spell_fg s:spell_attr + unlet s:spell_fg s:spell_attr call s:hi('Sneak', 'bg', 0xB, 'bold', '') hi! link SneakScope Visual diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 11671da..8e357ce 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -123,6 +123,8 @@ endif nnoremap Helptags nnoremap f Files nnoremap b Buffers + " + let $FZF_DEFAULT_OPTS = '--color=16' let g:fzf_layout = { 'down': '~40%' } let g:fzf_preview_window = ['right:noborder', 'ctrl-/'] " }}} diff --git a/zsh/env.zsh b/zsh/env.zsh index eca6fb0..baf1882 100644 --- a/zsh/env.zsh +++ b/zsh/env.zsh @@ -31,3 +31,6 @@ export JQ_COLORS="${(j.:.)jq_colors}" unset jq_colors export HOMEBREW_NO_AUTO_UPDATE=1 + +# https://github.com/junegunn/fzf/blob/764316a53d0eb60b315f0bbcd513de58ed57a876/src/tui/tui.go#L496-L515 +export FZF_DEFAULT_OPTS="--color=16" From eea04f738e9fe5a045e036aa5a8050468260a6cb Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 22 May 2021 17:27:23 +0300 Subject: [PATCH 617/713] [nvim] disable folds in diff files in continuation of 8198c86 --- nvim/after/ftplugin/diff.vim | 1 + 1 file changed, 1 insertion(+) create mode 100644 nvim/after/ftplugin/diff.vim diff --git a/nvim/after/ftplugin/diff.vim b/nvim/after/ftplugin/diff.vim new file mode 100644 index 0000000..ab49c88 --- /dev/null +++ b/nvim/after/ftplugin/diff.vim @@ -0,0 +1 @@ +setlocal nofoldenable foldmethod=manual From 432cb47135b0c2d4efbdbf53f3754e3bea5858bb Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 25 May 2021 19:09:12 +0300 Subject: [PATCH 618/713] [nvim] use the built-in expansion mechanism in makeprg --- nvim/after/ftplugin/markdown.vim | 8 +------- nvim/after/ftplugin/scss.vim | 8 +------- nvim/plugin/interface.vim | 2 +- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/nvim/after/ftplugin/markdown.vim b/nvim/after/ftplugin/markdown.vim index f5408c0..94e958b 100644 --- a/nvim/after/ftplugin/markdown.vim +++ b/nvim/after/ftplugin/markdown.vim @@ -1,11 +1,5 @@ source :h/text.vim -let s:src_file = expand('%') -let s:out_file = s:src_file.'.html' -let &l:makeprg = 'markdown2htmldoc' -for s:arg in get(g:, 'dotfiles_markdown2htmldoc_options', []) - let &l:makeprg .= ' '.shellescape(s:arg) -endfor -let &l:makeprg .= ' -- '.shellescape(s:src_file).' '.shellescape(s:out_file) +let &l:makeprg = 'markdown2htmldoc -- %:S %:S.html' nnoremap Open %.html diff --git a/nvim/after/ftplugin/scss.vim b/nvim/after/ftplugin/scss.vim index 9d5f7f1..db198fe 100644 --- a/nvim/after/ftplugin/scss.vim +++ b/nvim/after/ftplugin/scss.vim @@ -1,9 +1,3 @@ source :h/css.vim -let s:src_file = expand('%') -let s:out_file = s:src_file.'.css' -let &l:makeprg = 'sass' -for s:arg in get(g:, 'dotfiles_dart_sass_options', []) - let &l:makeprg .= ' '.shellescape(s:arg) -endfor -let &l:makeprg .= ' -- '.shellescape(s:src_file).':'.shellescape(s:out_file) +let &l:makeprg = 'sass -- %:S:%:S.css' diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 8e357ce..7e38b1d 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -139,4 +139,4 @@ endif " }}} -nnoremap make +nnoremap make! From a281507269397fbdc7fccb44f2f1763e16ecf2cd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 25 May 2021 19:40:42 +0300 Subject: [PATCH 619/713] [nvim] add a makeprg for awk --- nvim/after/ftplugin/awk.vim | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 nvim/after/ftplugin/awk.vim diff --git a/nvim/after/ftplugin/awk.vim b/nvim/after/ftplugin/awk.vim new file mode 100644 index 0000000..d7574a4 --- /dev/null +++ b/nvim/after/ftplugin/awk.vim @@ -0,0 +1,4 @@ +" +let &l:makeprg = 'awk --lint --source "BEGIN{exit(0)}END{exit(0)}" --file %:S' +" +let &l:errorformat = 'awk: %f:%l: %m' From 7ded7fc2f3e6aec96cfc87d40cd95a5ccb4e3eb1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 25 May 2021 19:58:01 +0300 Subject: [PATCH 620/713] [nvim] show filename in a confirmation prompt for Bbye --- nvim/plugin/interface.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 7e38b1d..975c079 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -43,7 +43,8 @@ endif function s:CloseBuffer(cmd) abort let cmd = a:cmd if &modified - let answer = confirm("Save changes?", "&Yes\n&No\n&Cancel") + " + let answer = confirm("Save changes to \"".expand('%')."\"?", "&Yes\n&No\n&Cancel") if answer ==# 1 " Yes write elseif answer ==# 2 " No From 8bd66911da8c4c2631297f4ec09ccbd4d9359cd7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 26 May 2021 14:11:39 +0300 Subject: [PATCH 621/713] [scripts] add a little tool for working with CC saves --- scripts/crosscode-saved | 127 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100755 scripts/crosscode-saved diff --git a/scripts/crosscode-saved b/scripts/crosscode-saved new file mode 100755 index 0000000..8e64e33 --- /dev/null +++ b/scripts/crosscode-saved @@ -0,0 +1,127 @@ +#!/usr/bin/env python3 + +import base64 +import argparse +from hashlib import md5 +from typing import IO +from Crypto.Cipher import AES +from Crypto import Random +import sys + + +CC_ENCRYPTION_MARKER_BYTES = b"[-!_0_!-]" +CC_ENCRYPTION_PASSPHRASE = b":_.NaN0" + + +def main(): + parser = argparse.ArgumentParser() + # NOTE: Empty help strings are necessary for subparsers to show up in help. + subparsers = parser.add_subparsers(required=True, metavar="COMMAND") + + subparser = subparsers.add_parser("pipe-decrypt", help="") + subparser.set_defaults(func=cmd_pipe_decrypt) + subparser.add_argument("input_file", nargs="?", default="-") + subparser.add_argument("output_file", nargs="?", default="-") + + subparser = subparsers.add_parser("pipe-encrypt", help="") + subparser.set_defaults(func=cmd_pipe_encrypt) + subparser.add_argument("input_file", nargs="?", default="-") + subparser.add_argument("output_file", nargs="?", default="-") + + args = parser.parse_args() + args.func(args) + + +def cmd_pipe_decrypt(args: argparse.Namespace) -> None: + input_file: IO[bytes] = ( + sys.stdin.buffer if args.input_file == "-" else open(args.input_file, 'rb') + ) + output_file: IO[bytes] = ( + sys.stdout.buffer if args.output_file == "-" else open(args.output_file, 'wb') + ) + + encrypted = input_file.read() + assert encrypted.startswith(CC_ENCRYPTION_MARKER_BYTES) + encrypted = encrypted[len(CC_ENCRYPTION_MARKER_BYTES):] + decrypted = CryptoJsBridge.decrypt(encrypted, CC_ENCRYPTION_PASSPHRASE) + output_file.write(decrypted) + + +def cmd_pipe_encrypt(args: argparse.Namespace) -> None: + input_file: IO[bytes] = ( + sys.stdin.buffer if args.input_file == "-" else open(args.input_file, 'rb') + ) + output_file: IO[bytes] = ( + sys.stdout.buffer if args.output_file == "-" else open(args.output_file, 'wb') + ) + + decrypted = input_file.read() + encrypted = CryptoJsBridge.encrypt(decrypted, CC_ENCRYPTION_PASSPHRASE) + output_file.write(CC_ENCRYPTION_MARKER_BYTES) + output_file.write(encrypted) + + +class CryptoJsBridge: + """ + Taken from . + Also see . + """ + + BLOCK_SIZE = 16 + SALTED_MARKER = b"Salted__" + SALT_SIZE = 8 + KEY_SIZE = 32 + IV_SIZE = 16 + + @classmethod + def pad(cls, data: bytes) -> bytes: + length = cls.BLOCK_SIZE - (len(data) % cls.BLOCK_SIZE) + return data + bytes([length]) * length + + @classmethod + def unpad(cls, data: bytes) -> bytes: + return data[:-data[-1]] + + @classmethod + def bytes_to_key(cls, data: bytes, salt: bytes, output: int) -> bytes: + """ + Extended from . + """ + assert len(salt) == cls.SALT_SIZE + data += salt + key = md5(data).digest() + final_key = key + while len(final_key) < output: + key = md5(key + data).digest() + final_key += key + return final_key[:output] + + @classmethod + def encrypt(cls, message: bytes, passphrase: bytes) -> bytes: + """ + Equivalent to `CryptoJS.AES.encrypt(message, passphrase).toString()`. + """ + salt = Random.new().read(cls.SALT_SIZE) + key_iv = cls.bytes_to_key(passphrase, salt, cls.KEY_SIZE + cls.IV_SIZE) + key, iv = key_iv[:cls.KEY_SIZE], key_iv[cls.KEY_SIZE:] + aes = AES.new(key, AES.MODE_CBC, iv) + ciphertext = aes.encrypt(cls.pad(message)) + return base64.b64encode(cls.SALTED_MARKER + salt + ciphertext) + + @classmethod + def decrypt(cls, encrypted: bytes, passphrase: bytes) -> bytes: + """ + Equivalent to `CryptoJS.AES.decrypt(encrypted, passphrase).toString(CryptoJS.enc.Utf8)`. + """ + encrypted = base64.b64decode(encrypted) + assert encrypted.startswith(cls.SALTED_MARKER) + encrypted = encrypted[len(cls.SALTED_MARKER):] + salt, ciphertext = encrypted[:cls.SALT_SIZE], encrypted[cls.SALT_SIZE:] + key_iv = cls.bytes_to_key(passphrase, salt, cls.KEY_SIZE + cls.IV_SIZE) + key, iv = key_iv[:cls.KEY_SIZE], key_iv[cls.KEY_SIZE:] + aes = AES.new(key, AES.MODE_CBC, iv) + return cls.unpad(aes.decrypt(ciphertext)) + + +if __name__ == "__main__": + main() From 7b7b1ba1c28fa8ecbb5630a89e27f912c9fae142 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 27 May 2021 12:48:45 +0300 Subject: [PATCH 622/713] [zsh] unify the fzf window settings a little bit --- script-resources/common_script_utils.py | 2 +- scripts/fzf-search-manpage | 2 +- zsh/env.zsh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/script-resources/common_script_utils.py b/script-resources/common_script_utils.py index 239eb11..4d13e50 100644 --- a/script-resources/common_script_utils.py +++ b/script-resources/common_script_utils.py @@ -19,7 +19,7 @@ def run_chooser(choices: Iterable[str], prompt: str = None, async_read: bool = F process_args = [ "fzf", "--with-nth=2..", - "--height=50%", + "--height=40%", "--reverse", "--tiebreak=index", ] diff --git a/scripts/fzf-search-manpage b/scripts/fzf-search-manpage index 1199656..c567225 100755 --- a/scripts/fzf-search-manpage +++ b/scripts/fzf-search-manpage @@ -1,4 +1,4 @@ #!/usr/bin/env sh set -eu # https://superuser.com/a/207474 -apropos . | fzf --no-multi --tiebreak=begin --query="$*" | sed -n 's/^\([^ ]\+\) \?(\([^)]\+\)).*$/\2 \1/p' +apropos . | fzf --height=40% --reverse --no-multi --tiebreak=begin --query="$*" | sed -n 's/^\([^ ]\+\) \?(\([^)]\+\)).*$/\2 \1/p' diff --git a/zsh/env.zsh b/zsh/env.zsh index baf1882..34e23a0 100644 --- a/zsh/env.zsh +++ b/zsh/env.zsh @@ -33,4 +33,4 @@ unset jq_colors export HOMEBREW_NO_AUTO_UPDATE=1 # https://github.com/junegunn/fzf/blob/764316a53d0eb60b315f0bbcd513de58ed57a876/src/tui/tui.go#L496-L515 -export FZF_DEFAULT_OPTS="--color=16" +export FZF_DEFAULT_OPTS="--color=16 --height=40% --reverse" From 3b6fe44f196492a662bf750347d8b9966dc5340d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 28 May 2021 13:13:21 +0300 Subject: [PATCH 623/713] Revert "fixup! [zsh] add a couple of aliases to numfmt" This reverts commit cbaeeb2f131d9734ec6d8f745a2cca40d5dcec72. --- zsh/functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index c5b7eaa..3bc4d0f 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -2,7 +2,7 @@ count() { print -r -- "$#"; } -bytecount() { wc -c "$@" | bytefmt2; } +bytecount() { wc -c "$@" | numfmt --to=iec-i --suffix=B; } mkcd() { mkdir -p "$@" && cd "${@[-1]}"; } From 85b179e60dda2ba2b7b90bd96d7d7e9ade148612 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 29 May 2021 14:55:41 +0300 Subject: [PATCH 624/713] [zsh] open new shells in the last working directory --- zsh/functions.zsh | 23 +++++++++++++++++++++++ zsh/zshrc | 15 ++++++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 3bc4d0f..9448bea 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -102,3 +102,26 @@ sudoedit() { } alias sudoe="sudoedit" alias sue="sudoedit" + +# This idea was taken from +SYNC_WORKING_DIR_STORAGE="${ZSH_CACHE_DIR}/last-working-dir" + +autoload -Uz add-zsh-hook +add-zsh-hook chpwd sync_working_dir_chpwd_hook +sync_working_dir_chpwd_hook() { + if [[ "$ZSH_SUBSHELL" == 0 ]]; then + sync_working_dir_save + fi +} + +sync_working_dir_save() { + pwd >| "$SYNC_WORKING_DIR_STORAGE" +} + +sync_working_dir_load() { + local dir + if dir="$(<"$SYNC_WORKING_DIR_STORAGE")" 2>/dev/null && [[ -n "$dir" ]]; then + cd -- "$dir" + fi +} +alias cds="sync_working_dir_load" diff --git a/zsh/zshrc b/zsh/zshrc index 8fcf10a..e8bf236 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -23,14 +23,17 @@ autoload -U colors && colors } _perf_timer_stop() { + # Record the stop time as precisely as possible even in the case of an error + local stop_time="$EPOCHREALTIME" local name="$1" if [[ -z "$name" ]]; then print >&2 "$0: usage: $0 " return 1 fi - local stop_time="$EPOCHREALTIME" start_time="${_perf_timers[$name]}" + local start_time="${_perf_timers[$name]}" + unset "_perf_timers[${(qq)name}]" local -i duration="$(( (stop_time - start_time) * 1000 ))" - print -- "$(print -P '%F{8}==>%f') ${name}: ${duration}ms" + print -r -- "$(print -P '%F{8}==>%f') ${name}: ${duration}ms" } # }}} @@ -58,4 +61,10 @@ done _perf_timer_stop "total" -welcome +if [[ -z "$DOTFILES_DISABLE_WELCOME" ]]; then + welcome +fi + +if [[ -z "$DOTFILES_SYNC_LAST_WORKING_DIR" ]]; then + sync_working_dir_load +fi From 0832e579f8da1dfef5ad9a0907dbdf2d6f679856 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 29 May 2021 18:52:40 +0300 Subject: [PATCH 625/713] [scripts/discord-whois] add an option for printing the raw response --- scripts/discord-whois | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/discord-whois b/scripts/discord-whois index 0598fed..41403ee 100755 --- a/scripts/discord-whois +++ b/scripts/discord-whois @@ -12,7 +12,6 @@ import colorama import time import argparse import json -import typing DISCORD_EPOCH = 1420070400000 # milliseconds @@ -38,6 +37,7 @@ parser.add_argument("user_snowflake", type=int) parser.add_argument("--bot-token", type=str) parser.add_argument("--image-size", type=int) parser.add_argument("--get-prop", type=str) +parser.add_argument("--api-response", action='store_true') cli_args = parser.parse_args() user_snowflake = cli_args.user_snowflake @@ -68,6 +68,11 @@ except urllib.error.HTTPError as err: print(err.read(), file=sys.stderr) raise err +if cli_args.api_response: + json.dump(raw_data, sys.stdout, ensure_ascii=False, indent=2) + sys.stdout.write('\n') + sys.exit() + data = {} data["ID"] = raw_data["id"] From 55cfc1862127171e6902eb70e7b3a503e0e8af62 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 29 May 2021 19:30:15 +0300 Subject: [PATCH 626/713] [nvim] a few changes to the colors of the checkhealth menu --- nvim/colors/dotfiles.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index bea107b..157fb63 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -160,6 +160,11 @@ hi! link SneakScope Visual hi! link SneakLabel Sneak + " checkhealth UI + call s:hi('healthSuccess', 'bg', 0xB, 'bold', '') + call s:hi('healthWarning', 'bg', 0xA, 'bold', '') + call s:hi('healthError', 'bg', 0x8, 'bold', '') + " }}} " AWK {{{ From 0e14982fa3af1292b4ca20806b03397ed76d2c48 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 30 May 2021 14:35:15 +0300 Subject: [PATCH 627/713] [userscripts] add some useless scripts --- .../github-set-theme-without-login.user.js | 17 +++++++++ .../gitlab-set-theme-without-login.user.js | 35 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 web/userscripts/github-set-theme-without-login.user.js create mode 100644 web/userscripts/gitlab-set-theme-without-login.user.js diff --git a/web/userscripts/github-set-theme-without-login.user.js b/web/userscripts/github-set-theme-without-login.user.js new file mode 100644 index 0000000..5dc9ad2 --- /dev/null +++ b/web/userscripts/github-set-theme-without-login.user.js @@ -0,0 +1,17 @@ +// ==UserScript== +// @name GitHub set theme without login +// @version 1 +// @grant none +// @match https://github.com/* +// @match https://gist.github.com/* +// @run-at document-start +// ==/UserScript== + +(() => { + 'use strict'; + + let $html = document.documentElement; + $html.dataset.colorMode = 'dark'; + $html.dataset.darkTheme = 'dark_dimmed'; + $html.dataset.lightTheme = 'light'; +})(); diff --git a/web/userscripts/gitlab-set-theme-without-login.user.js b/web/userscripts/gitlab-set-theme-without-login.user.js new file mode 100644 index 0000000..38f54af --- /dev/null +++ b/web/userscripts/gitlab-set-theme-without-login.user.js @@ -0,0 +1,35 @@ +// ==UserScript== +// @name GitLab set theme without login +// @description DOES NOT WORK +// @version 1 +// @grant none +// @match https://gitlab.com/* +// @match https://salsa.debian.org/* +// @run-at document-start +// ==/UserScript== + +(() => { + 'use strict'; + + for (let $link of document.getElementsByTagName('link')) { + if (!($link.as === 'style' || $link.rel === 'stylesheet')) continue; + + let pattern = /^(https:\/\/assets\.gitlab-static\.net\/assets\/)(.+)(-[0-9a-fA-F]{64}\.css)$/; + let matches = $link.href.match(pattern); + if (matches == null) continue; + let [hrefBefore, assetPath, hrefAfter] = matches.slice(1); + let newAssetPath = null; + + if (assetPath === 'application' || assetPath === 'application_utilities') { + newAssetPath = `${assetPath}_dark`; + } else if (assetPath === 'highlight/themes/white') { + newAssetPath = 'highlight/themes/dark'; + } + + if (newAssetPath == null) continue; + $link.href = `${hrefBefore}${newAssetPath}${hrefAfter}`; + } + + document.body.classList.remove('ui-indigo'); + document.body.classList.add('gl-dark'); +})(); From ef606d6cd926975084f50eaad6fb93c891740c76 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 30 May 2021 15:23:27 +0300 Subject: [PATCH 628/713] [scripts/markdown2htmldoc] FINALLY COMPLETE MY MARKDOWN THEME --- colorschemes/Makefile | 2 +- colorschemes/_theme.py | 1 + colorschemes/colorscheme.scss.py | 13 + colorschemes/out/colorscheme.scss | 25 + colorschemes/out/prismjs-theme.css | 6 +- colorschemes/prismjs-theme-src.css | 6 +- nvim/colors/dotfiles.vim | 1 + .../github-markdown-additions.css | 11 - script-resources/markdown2htmldoc/main.js | 19 +- .../markdown-it-header-anchors.js | 15 +- .../markdown2htmldoc/package.json | 10 +- .../markdown2htmldoc/themes-out/github.css | 1 + .../markdown2htmldoc/themes-out/my.css | 1 + .../markdown2htmldoc/themes-src/github.scss | 24 + .../markdown2htmldoc/themes-src/my.scss | 472 ++++++++++++++++++ script-resources/markdown2htmldoc/yarn.lock | 101 +++- 16 files changed, 669 insertions(+), 39 deletions(-) create mode 100755 colorschemes/colorscheme.scss.py create mode 100644 colorschemes/out/colorscheme.scss delete mode 100644 script-resources/markdown2htmldoc/github-markdown-additions.css create mode 100644 script-resources/markdown2htmldoc/themes-out/github.css create mode 100644 script-resources/markdown2htmldoc/themes-out/my.css create mode 100644 script-resources/markdown2htmldoc/themes-src/github.scss create mode 100644 script-resources/markdown2htmldoc/themes-src/my.scss diff --git a/colorschemes/Makefile b/colorschemes/Makefile index cf3a25b..52b08a3 100644 --- a/colorschemes/Makefile +++ b/colorschemes/Makefile @@ -9,7 +9,7 @@ MAKEFLAGS += --no-builtin-rules .PHONY: all clean OUT_DIR := out -OUT_FILES := iterm.itermcolors kitty.conf vim.vim setvtrgb.txt zsh.zsh termux.properties variables.css prismjs-theme.css vscode-colorCustomizations.json xfce4-terminal.theme +OUT_FILES := iterm.itermcolors kitty.conf vim.vim setvtrgb.txt zsh.zsh termux.properties variables.css colorscheme.scss prismjs-theme.css vscode-colorCustomizations.json xfce4-terminal.theme all: $(OUT_DIR) $(addprefix $(OUT_DIR)/,$(OUT_FILES)) diff --git a/colorschemes/_theme.py b/colorschemes/_theme.py index 644f440..0fb8671 100644 --- a/colorschemes/_theme.py +++ b/colorschemes/_theme.py @@ -3,6 +3,7 @@ # base16-eighties by Chris Kempson (http://chriskempson.com) base16_name = "eighties" name = "base16-" + base16_name +is_dark = True base16_colors = [ "#2d2d2d", # 0 "#393939", # 1 diff --git a/colorschemes/colorscheme.scss.py b/colorschemes/colorscheme.scss.py new file mode 100755 index 0000000..9eff318 --- /dev/null +++ b/colorschemes/colorscheme.scss.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +# TODO: Prefix the name with an underscore when I rewrite the theme generator, +# see . + +import _theme as theme + + +print('$is-dark: {};'.format("true" if theme.is_dark else "false")) +for var_name, color in theme.css_variables.items(): + print("${}: {};".format(var_name, color)) +print("$base: ({});".format(', '.join(theme.base16_colors))) +print("$ansi: ({});".format(', '.join(theme.ansi_colors))) diff --git a/colorschemes/out/colorscheme.scss b/colorschemes/out/colorscheme.scss new file mode 100644 index 0000000..6ce8cd2 --- /dev/null +++ b/colorschemes/out/colorscheme.scss @@ -0,0 +1,25 @@ +$is-dark: true; +$bg: #2d2d2d; +$fg: #d3d0c8; +$selection-bg: #515151; +$selection-fg: #d3d0c8; +$cursor-bg: #d3d0c8; +$cursor-fg: #2d2d2d; +$base-00: #2d2d2d; +$base-01: #393939; +$base-02: #515151; +$base-03: #747369; +$base-04: #a09f93; +$base-05: #d3d0c8; +$base-06: #e8e6df; +$base-07: #f2f0ec; +$base-08: #f2777a; +$base-09: #f99157; +$base-0A: #ffcc66; +$base-0B: #99cc99; +$base-0C: #66cccc; +$base-0D: #6699cc; +$base-0E: #cc99cc; +$base-0F: #d27b53; +$base: (#2d2d2d, #393939, #515151, #747369, #a09f93, #d3d0c8, #e8e6df, #f2f0ec, #f2777a, #f99157, #ffcc66, #99cc99, #66cccc, #6699cc, #cc99cc, #d27b53); +$ansi: (#2d2d2d, #f2777a, #99cc99, #ffcc66, #6699cc, #cc99cc, #66cccc, #d3d0c8, #747369, #f2777a, #99cc99, #ffcc66, #6699cc, #cc99cc, #66cccc, #f2f0ec, #f99157, #d27b53, #393939, #515151, #a09f93, #e8e6df); diff --git a/colorschemes/out/prismjs-theme.css b/colorschemes/out/prismjs-theme.css index 5c2d831..010b18a 100644 --- a/colorschemes/out/prismjs-theme.css +++ b/colorschemes/out/prismjs-theme.css @@ -14,12 +14,8 @@ } .markdown-body pre::-moz-selection, -.markdown-body pre ::-moz-selection { - background-color: #515151; - color: #d3d0c8; -} - .markdown-body pre::selection, +.markdown-body pre ::-moz-selection, .markdown-body pre ::selection { background-color: #515151; color: #d3d0c8; diff --git a/colorschemes/prismjs-theme-src.css b/colorschemes/prismjs-theme-src.css index 4215cda..50733e4 100644 --- a/colorschemes/prismjs-theme-src.css +++ b/colorschemes/prismjs-theme-src.css @@ -14,12 +14,8 @@ } .markdown-body pre::-moz-selection, -.markdown-body pre ::-moz-selection { - background-color: var(--dotfiles-colorscheme-selection-bg); - color: var(--dotfiles-colorscheme-selection-fg); -} - .markdown-body pre::selection, +.markdown-body pre ::-moz-selection, .markdown-body pre ::selection { background-color: var(--dotfiles-colorscheme-selection-bg); color: var(--dotfiles-colorscheme-selection-fg); diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 157fb63..ec50d72 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -293,6 +293,7 @@ hi! link scssSelectorName cssClassName hi! link scssSelectorChar cssClassnameDot hi! link scssAmpersand cssSelectorOp + hi! link scssProperty cssProp " }}} " JavaScript {{{ diff --git a/script-resources/markdown2htmldoc/github-markdown-additions.css b/script-resources/markdown2htmldoc/github-markdown-additions.css deleted file mode 100644 index 15b26fd..0000000 --- a/script-resources/markdown2htmldoc/github-markdown-additions.css +++ /dev/null @@ -1,11 +0,0 @@ -html, -body { - padding: 0; - margin: 0; -} - -.markdown-body { - max-width: 882px; - margin: 0 auto; - padding: 32px; -} diff --git a/script-resources/markdown2htmldoc/main.js b/script-resources/markdown2htmldoc/main.js index 8138353..312896e 100755 --- a/script-resources/markdown2htmldoc/main.js +++ b/script-resources/markdown2htmldoc/main.js @@ -33,8 +33,9 @@ parser.add_argument('--output-encoding', { help: '(utf-8 by default)', }); -parser.add_argument('--no-default-stylesheets', { - action: argparse.BooleanOptionalAction, +parser.add_argument('--theme', { + choices: ['dotfiles', 'github', 'none'], + default: 'dotfiles', }); parser.add_argument('--syntax-theme', { choices: [...PRISM_THEMES, 'none', 'dotfiles'], @@ -70,14 +71,14 @@ let renderedMarkdown = md.render(markdownDocument); let stylesheetsTexts = []; let scriptsTexts = []; -let syntaxThemeName = null; +let syntaxThemeName = 'dotfiles'; -if (!args.no_default_stylesheets) { - syntaxThemeName = 'dotfiles'; - stylesheetsTexts.push( - fs.readFileSync(require.resolve('github-markdown-css/github-markdown.css'), 'utf-8'), - fs.readFileSync(require.resolve('./github-markdown-additions.css'), 'utf-8'), - ); +if (args.theme === 'dotfiles') { + stylesheetsTexts.push(fs.readFileSync(require.resolve('./themes-out/my.css'), 'utf-8')); +} else if (args.theme === 'github') { + stylesheetsTexts.push(fs.readFileSync(require.resolve('./themes-out/github.css'), 'utf-8')); +} else { + syntaxThemeName = 'none'; } syntaxThemeName = args.syntax_theme || syntaxThemeName; diff --git a/script-resources/markdown2htmldoc/markdown-it-header-anchors.js b/script-resources/markdown2htmldoc/markdown-it-header-anchors.js index 80fa250..34e46bf 100644 --- a/script-resources/markdown2htmldoc/markdown-it-header-anchors.js +++ b/script-resources/markdown2htmldoc/markdown-it-header-anchors.js @@ -1,12 +1,21 @@ const GithubSlugger = require('github-slugger'); +const OCTICON_LINK_ICON_SVG = [ + // Basically copied from Github's HTML. Also see + // . I wonder what other + // attributes can be thrown out to make this image smaller? After all, it is + // duplicated for each and every heading. + '', +].join(''); + function markdownItHeaderAnchors(md) { let slugger = new GithubSlugger(); let defaultRender = md.renderer.rules.heading_open || - ((tokens, idx, options, _env, self) => - self.renderToken(tokens, idx, options)); + ((tokens, idx, options, _env, self) => self.renderToken(tokens, idx, options)); // eslint-disable-next-line camelcase md.renderer.rules.heading_open = (tokens, idx, opts, env, self) => { @@ -29,7 +38,7 @@ function markdownItHeaderAnchors(md) { if (innerText.length > 0) { let id = md.utils.escapeHtml(slugger.slug(innerText)); - renderedHeadingOpen += ``; + renderedHeadingOpen += ``; } return renderedHeadingOpen; diff --git a/script-resources/markdown2htmldoc/package.json b/script-resources/markdown2htmldoc/package.json index 60a265a..d85fba2 100644 --- a/script-resources/markdown2htmldoc/package.json +++ b/script-resources/markdown2htmldoc/package.json @@ -1,8 +1,12 @@ { "private": true, + "scripts": { + "theme:build": "sass --no-source-map --style=compressed themes-src/:themes-out/", + "theme:watch": "sass --no-source-map --style=compressed --watch themes-src/:themes-out/" + }, "dependencies": { "argparse": "^2.0.1", - "github-markdown-css": "^4.0.0", + "github-markdown-css": "*", "github-slugger": "^1.2.1", "markdown-it": "12.0.6", "markdown-it-emoji": "2.0.0", @@ -15,6 +19,8 @@ "eslint-config-prettier": "8.3.0", "eslint-plugin-node": "*", "eslint-plugin-prettier": "3.4.0", - "prettier": "2.2.1" + "normalize.css": "^8.0.1", + "prettier": "2.2.1", + "sass": "^1.33.0" } } diff --git a/script-resources/markdown2htmldoc/themes-out/github.css b/script-resources/markdown2htmldoc/themes-out/github.css new file mode 100644 index 0000000..a1648be --- /dev/null +++ b/script-resources/markdown2htmldoc/themes-out/github.css @@ -0,0 +1 @@ +.markdown-body .octicon{display:inline-block;fill:currentColor;vertical-align:text-bottom}.markdown-body .anchor{float:left;line-height:1;margin-left:-20px;padding-right:4px}.markdown-body .anchor:focus{outline:none}.markdown-body h1 .octicon-link,.markdown-body h2 .octicon-link,.markdown-body h3 .octicon-link,.markdown-body h4 .octicon-link,.markdown-body h5 .octicon-link,.markdown-body h6 .octicon-link{color:#1b1f23;vertical-align:middle;visibility:hidden}.markdown-body h1:hover .anchor,.markdown-body h2:hover .anchor,.markdown-body h3:hover .anchor,.markdown-body h4:hover .anchor,.markdown-body h5:hover .anchor,.markdown-body h6:hover .anchor{text-decoration:none}.markdown-body h1:hover .anchor .octicon-link,.markdown-body h2:hover .anchor .octicon-link,.markdown-body h3:hover .anchor .octicon-link,.markdown-body h4:hover .anchor .octicon-link,.markdown-body h5:hover .anchor .octicon-link,.markdown-body h6:hover .anchor .octicon-link{visibility:visible}.markdown-body h1:hover .anchor .octicon-link:before,.markdown-body h2:hover .anchor .octicon-link:before,.markdown-body h3:hover .anchor .octicon-link:before,.markdown-body h4:hover .anchor .octicon-link:before,.markdown-body h5:hover .anchor .octicon-link:before,.markdown-body h6:hover .anchor .octicon-link:before{width:16px;height:16px;content:" ";display:inline-block;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' width='16' height='16' aria-hidden='true'%3E%3Cpath fill-rule='evenodd' d='M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z'%3E%3C/path%3E%3C/svg%3E")}.markdown-body{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;line-height:1.5;color:#24292e;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji;font-size:16px;line-height:1.5;word-wrap:break-word}.markdown-body details{display:block}.markdown-body summary{display:list-item}.markdown-body a{background-color:initial}.markdown-body a:active,.markdown-body a:hover{outline-width:0}.markdown-body strong{font-weight:inherit;font-weight:bolder}.markdown-body h1{font-size:2em;margin:.67em 0}.markdown-body img{border-style:none}.markdown-body code,.markdown-body kbd,.markdown-body pre{font-family:monospace,monospace;font-size:1em}.markdown-body hr{box-sizing:initial;height:0;overflow:visible}.markdown-body input{font:inherit;margin:0}.markdown-body input{overflow:visible}.markdown-body [type=checkbox]{box-sizing:border-box;padding:0}.markdown-body *{box-sizing:border-box}.markdown-body input{font-family:inherit;font-size:inherit;line-height:inherit}.markdown-body a{color:#0366d6;text-decoration:none}.markdown-body a:hover{text-decoration:underline}.markdown-body strong{font-weight:600}.markdown-body hr{height:0;margin:15px 0;overflow:hidden;background:transparent;border:0;border-bottom:1px solid #dfe2e5}.markdown-body hr:after,.markdown-body hr:before{display:table;content:""}.markdown-body hr:after{clear:both}.markdown-body table{border-spacing:0;border-collapse:collapse}.markdown-body td,.markdown-body th{padding:0}.markdown-body details summary{cursor:pointer}.markdown-body kbd{display:inline-block;padding:3px 5px;font:11px SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;line-height:10px;color:#444d56;vertical-align:middle;background-color:#fafbfc;border:1px solid #d1d5da;border-radius:3px;box-shadow:inset 0 -1px 0 #d1d5da}.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6{margin-top:0;margin-bottom:0}.markdown-body h1{font-size:32px}.markdown-body h1,.markdown-body h2{font-weight:600}.markdown-body h2{font-size:24px}.markdown-body h3{font-size:20px}.markdown-body h3,.markdown-body h4{font-weight:600}.markdown-body h4{font-size:16px}.markdown-body h5{font-size:14px}.markdown-body h5,.markdown-body h6{font-weight:600}.markdown-body h6{font-size:12px}.markdown-body p{margin-top:0;margin-bottom:10px}.markdown-body blockquote{margin:0}.markdown-body ol,.markdown-body ul{padding-left:0;margin-top:0;margin-bottom:0}.markdown-body ol ol,.markdown-body ul ol{list-style-type:lower-roman}.markdown-body ol ol ol,.markdown-body ol ul ol,.markdown-body ul ol ol,.markdown-body ul ul ol{list-style-type:lower-alpha}.markdown-body dd{margin-left:0}.markdown-body code,.markdown-body pre{font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:12px}.markdown-body pre{margin-top:0;margin-bottom:0}.markdown-body input::-webkit-inner-spin-button,.markdown-body input::-webkit-outer-spin-button{margin:0;-webkit-appearance:none;appearance:none}.markdown-body :checked+.radio-label{position:relative;z-index:1;border-color:#0366d6}.markdown-body .border{border:1px solid #e1e4e8 !important}.markdown-body .border-0{border:0 !important}.markdown-body .border-bottom{border-bottom:1px solid #e1e4e8 !important}.markdown-body .rounded-1{border-radius:3px !important}.markdown-body .bg-white{background-color:#fff !important}.markdown-body .bg-gray-light{background-color:#fafbfc !important}.markdown-body .text-gray-light{color:#6a737d !important}.markdown-body .mb-0{margin-bottom:0 !important}.markdown-body .my-2{margin-top:8px !important;margin-bottom:8px !important}.markdown-body .pl-0{padding-left:0 !important}.markdown-body .py-0{padding-top:0 !important;padding-bottom:0 !important}.markdown-body .pl-1{padding-left:4px !important}.markdown-body .pl-2{padding-left:8px !important}.markdown-body .py-2{padding-top:8px !important;padding-bottom:8px !important}.markdown-body .pl-3,.markdown-body .px-3{padding-left:16px !important}.markdown-body .px-3{padding-right:16px !important}.markdown-body .pl-4{padding-left:24px !important}.markdown-body .pl-5{padding-left:32px !important}.markdown-body .pl-6{padding-left:40px !important}.markdown-body .f6{font-size:12px !important}.markdown-body .lh-condensed{line-height:1.25 !important}.markdown-body .text-bold{font-weight:600 !important}.markdown-body .pl-c{color:#6a737d}.markdown-body .pl-c1,.markdown-body .pl-s .pl-v{color:#005cc5}.markdown-body .pl-e,.markdown-body .pl-en{color:#6f42c1}.markdown-body .pl-s .pl-s1,.markdown-body .pl-smi{color:#24292e}.markdown-body .pl-ent{color:#22863a}.markdown-body .pl-k{color:#d73a49}.markdown-body .pl-pds,.markdown-body .pl-s,.markdown-body .pl-s .pl-pse .pl-s1,.markdown-body .pl-sr,.markdown-body .pl-sr .pl-cce,.markdown-body .pl-sr .pl-sra,.markdown-body .pl-sr .pl-sre{color:#032f62}.markdown-body .pl-smw,.markdown-body .pl-v{color:#e36209}.markdown-body .pl-bu{color:#b31d28}.markdown-body .pl-ii{color:#fafbfc;background-color:#b31d28}.markdown-body .pl-c2{color:#fafbfc;background-color:#d73a49}.markdown-body .pl-c2:before{content:"^M"}.markdown-body .pl-sr .pl-cce{font-weight:700;color:#22863a}.markdown-body .pl-ml{color:#735c0f}.markdown-body .pl-mh,.markdown-body .pl-mh .pl-en,.markdown-body .pl-ms{font-weight:700;color:#005cc5}.markdown-body .pl-mi{font-style:italic;color:#24292e}.markdown-body .pl-mb{font-weight:700;color:#24292e}.markdown-body .pl-md{color:#b31d28;background-color:#ffeef0}.markdown-body .pl-mi1{color:#22863a;background-color:#f0fff4}.markdown-body .pl-mc{color:#e36209;background-color:#ffebda}.markdown-body .pl-mi2{color:#f6f8fa;background-color:#005cc5}.markdown-body .pl-mdr{font-weight:700;color:#6f42c1}.markdown-body .pl-ba{color:#586069}.markdown-body .pl-sg{color:#959da5}.markdown-body .pl-corl{text-decoration:underline;color:#032f62}.markdown-body .mb-0{margin-bottom:0 !important}.markdown-body .my-2{margin-bottom:8px !important}.markdown-body .my-2{margin-top:8px !important}.markdown-body .pl-0{padding-left:0 !important}.markdown-body .py-0{padding-top:0 !important;padding-bottom:0 !important}.markdown-body .pl-1{padding-left:4px !important}.markdown-body .pl-2{padding-left:8px !important}.markdown-body .py-2{padding-top:8px !important;padding-bottom:8px !important}.markdown-body .pl-3{padding-left:16px !important}.markdown-body .pl-4{padding-left:24px !important}.markdown-body .pl-5{padding-left:32px !important}.markdown-body .pl-6{padding-left:40px !important}.markdown-body .pl-7{padding-left:48px !important}.markdown-body .pl-8{padding-left:64px !important}.markdown-body .pl-9{padding-left:80px !important}.markdown-body .pl-10{padding-left:96px !important}.markdown-body .pl-11{padding-left:112px !important}.markdown-body .pl-12{padding-left:128px !important}.markdown-body hr{border-bottom-color:#eee}.markdown-body kbd{display:inline-block;padding:3px 5px;font:11px SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;line-height:10px;color:#444d56;vertical-align:middle;background-color:#fafbfc;border:1px solid #d1d5da;border-radius:3px;box-shadow:inset 0 -1px 0 #d1d5da}.markdown-body:after,.markdown-body:before{display:table;content:""}.markdown-body:after{clear:both}.markdown-body>:first-child{margin-top:0 !important}.markdown-body>:last-child{margin-bottom:0 !important}.markdown-body a:not([href]){color:inherit;text-decoration:none}.markdown-body blockquote,.markdown-body details,.markdown-body dl,.markdown-body ol,.markdown-body p,.markdown-body pre,.markdown-body table,.markdown-body ul{margin-top:0;margin-bottom:16px}.markdown-body hr{height:.25em;padding:0;margin:24px 0;background-color:#e1e4e8;border:0}.markdown-body blockquote{padding:0 1em;color:#6a737d;border-left:.25em solid #dfe2e5}.markdown-body blockquote>:first-child{margin-top:0}.markdown-body blockquote>:last-child{margin-bottom:0}.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6{margin-top:24px;margin-bottom:16px;font-weight:600;line-height:1.25}.markdown-body h1{font-size:2em}.markdown-body h1,.markdown-body h2{padding-bottom:.3em;border-bottom:1px solid #eaecef}.markdown-body h2{font-size:1.5em}.markdown-body h3{font-size:1.25em}.markdown-body h4{font-size:1em}.markdown-body h5{font-size:.875em}.markdown-body h6{font-size:.85em;color:#6a737d}.markdown-body ol,.markdown-body ul{padding-left:2em}.markdown-body ol ol,.markdown-body ol ul,.markdown-body ul ol,.markdown-body ul ul{margin-top:0;margin-bottom:0}.markdown-body li{word-wrap:break-all}.markdown-body li>p{margin-top:16px}.markdown-body li+li{margin-top:.25em}.markdown-body dl{padding:0}.markdown-body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:600}.markdown-body dl dd{padding:0 16px;margin-bottom:16px}.markdown-body table{display:block;width:100%;overflow:auto}.markdown-body table th{font-weight:600}.markdown-body table td,.markdown-body table th{padding:6px 13px;border:1px solid #dfe2e5}.markdown-body table tr{background-color:#fff;border-top:1px solid #c6cbd1}.markdown-body table tr:nth-child(2n){background-color:#f6f8fa}.markdown-body img{max-width:100%;box-sizing:initial;background-color:#fff}.markdown-body img[align=right]{padding-left:20px}.markdown-body img[align=left]{padding-right:20px}.markdown-body code{padding:.2em .4em;margin:0;font-size:85%;background-color:rgba(27, 31, 35, 0.05);border-radius:3px}.markdown-body pre{word-wrap:normal}.markdown-body pre>code{padding:0;margin:0;font-size:100%;word-break:normal;white-space:pre;background:transparent;border:0}.markdown-body .highlight{margin-bottom:16px}.markdown-body .highlight pre{margin-bottom:0;word-break:normal}.markdown-body .highlight pre,.markdown-body pre{padding:16px;overflow:auto;font-size:85%;line-height:1.45;background-color:#f6f8fa;border-radius:3px}.markdown-body pre code{display:inline;max-width:auto;padding:0;margin:0;overflow:visible;line-height:inherit;word-wrap:normal;background-color:initial;border:0}.markdown-body .commit-tease-sha{display:inline-block;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:90%;color:#444d56}.markdown-body .full-commit .btn-outline:not(:disabled):hover{color:#005cc5;border-color:#005cc5}.markdown-body .blob-wrapper{overflow-x:auto;overflow-y:hidden}.markdown-body .blob-wrapper-embedded{max-height:240px;overflow-y:auto}.markdown-body .blob-num{width:1%;min-width:50px;padding-right:10px;padding-left:10px;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:12px;line-height:20px;color:rgba(27, 31, 35, 0.3);text-align:right;white-space:nowrap;vertical-align:top;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.markdown-body .blob-num:hover{color:rgba(27, 31, 35, 0.6)}.markdown-body .blob-num:before{content:attr(data-line-number)}.markdown-body .blob-code{position:relative;padding-right:10px;padding-left:10px;line-height:20px;vertical-align:top}.markdown-body .blob-code-inner{overflow:visible;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:12px;color:#24292e;word-wrap:normal;white-space:pre}.markdown-body .pl-token.active,.markdown-body .pl-token:hover{cursor:pointer;background:#ffea7f}.markdown-body .tab-size[data-tab-size="1"]{-moz-tab-size:1;tab-size:1}.markdown-body .tab-size[data-tab-size="2"]{-moz-tab-size:2;tab-size:2}.markdown-body .tab-size[data-tab-size="3"]{-moz-tab-size:3;tab-size:3}.markdown-body .tab-size[data-tab-size="4"]{-moz-tab-size:4;tab-size:4}.markdown-body .tab-size[data-tab-size="5"]{-moz-tab-size:5;tab-size:5}.markdown-body .tab-size[data-tab-size="6"]{-moz-tab-size:6;tab-size:6}.markdown-body .tab-size[data-tab-size="7"]{-moz-tab-size:7;tab-size:7}.markdown-body .tab-size[data-tab-size="8"]{-moz-tab-size:8;tab-size:8}.markdown-body .tab-size[data-tab-size="9"]{-moz-tab-size:9;tab-size:9}.markdown-body .tab-size[data-tab-size="10"]{-moz-tab-size:10;tab-size:10}.markdown-body .tab-size[data-tab-size="11"]{-moz-tab-size:11;tab-size:11}.markdown-body .tab-size[data-tab-size="12"]{-moz-tab-size:12;tab-size:12}.markdown-body .task-list-item{list-style-type:none}.markdown-body .task-list-item+.task-list-item{margin-top:3px}.markdown-body .task-list-item input{margin:0 .2em .25em -1.6em;vertical-align:middle}html,body{padding:0;margin:0}.markdown-body{box-sizing:border-box;min-width:200px;max-width:960px;margin:0 auto;padding:32px}@media(max-width: 767px){.markdown-body{padding:16px}} diff --git a/script-resources/markdown2htmldoc/themes-out/my.css b/script-resources/markdown2htmldoc/themes-out/my.css new file mode 100644 index 0000000..af9f8a5 --- /dev/null +++ b/script-resources/markdown2htmldoc/themes-out/my.css @@ -0,0 +1 @@ +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}*{box-sizing:border-box}body{color:#d3d0c8;background-color:#2d2d2d;font-family:"Ubuntu",sans-serif;font-size:16px;line-height:1.5;word-wrap:break-word;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body::-moz-selection,body::selection,body ::-moz-selection,body ::selection{color:#d3d0c8;background-color:#515151}article{min-width:200px;max-width:960px;margin:0 auto;padding:32px}@media(max-width: 767px){article{padding:24px}}article::after,article::before{display:table;content:""}article::after{clear:both}article>:first-child{margin-block-start:0 !important}article>:last-child{margin-block-end:0 !important}.octicon{display:inline-block;overflow:visible !important;vertical-align:text-bottom;fill:currentColor}a{color:#69c;text-decoration:none}a:hover,a:focus,a:active{text-decoration:underline}a:not([href]){color:unset;text-decoration:none}hr{margin-block-start:1.5em;margin-block-end:1.5em;border:.2em solid #515151}hr::after,hr::before{display:table;content:""}hr::after{clear:both}dl,details,table,blockquote,ul,ol,pre,p{margin-block-start:1em;margin-block-end:1em}blockquote{margin-inline-start:0;margin-inline-end:0;padding-inline-start:1em;border-inline-start:.25em solid #515151}blockquote>:first-child{margin-block-start:0 !important}blockquote>:last-child{margin-block-end:0 !important}summary{cursor:pointer}img{max-width:100%;box-sizing:content-box;background-color:#393939}img[align=left],img[align=right]{margin:.5em 1.25em}img[align=left]{margin-left:0}img[align=right]{margin-right:0}ins,del{text-decoration:none}ins{color:#9c9}del{color:#f2777a}mark{background-color:#fc6;color:#2d2d2d}h1,h2,h3,h4,h5,h6{margin-block-start:1.5em;margin-block-end:1em;padding-block-end:.3em;border-block-end:1px solid #515151;font-weight:600;line-height:1.25}h1 .anchor,h2 .anchor,h3 .anchor,h4 .anchor,h5 .anchor,h6 .anchor{float:left;padding-right:4px;margin-left:-20px;color:unset}h1 .anchor:hover,h2 .anchor:hover,h3 .anchor:hover,h4 .anchor:hover,h5 .anchor:hover,h6 .anchor:hover{text-decoration:none}h1 .anchor:focus,h2 .anchor:focus,h3 .anchor:focus,h4 .anchor:focus,h5 .anchor:focus,h6 .anchor:focus{outline:none}h1 .anchor>*,h2 .anchor>*,h3 .anchor>*,h4 .anchor>*,h5 .anchor>*,h6 .anchor>*{visibility:hidden;vertical-align:middle}h1:hover .anchor>*,h2:hover .anchor>*,h3:hover .anchor>*,h4:hover .anchor>*,h5:hover .anchor>*,h6:hover .anchor>*{visibility:visible}h1{font-size:2em}h2{font-size:1.5em}h3{font-size:1.25em}h4{font-size:1em}h5{font-size:.875em}h6{font-size:.85em}code,kbd,samp,pre{font-family:"Ubuntu Mono",monospace}code{padding-block-start:.2em;padding-block-end:.2em;padding-inline-start:.3em;padding-inline-end:.3em;background-color:rgba(116,115,105,.2);border-radius:4px}pre{padding:1em;overflow:auto;color:#d3d0c8;background-color:#2d2d2d;border:1px solid #515151;border-radius:4px;line-height:1.3;word-wrap:normal}pre code{padding:unset;background-color:unset;border:unset}kbd{display:inline-block;padding-block-start:.2em;padding-block-end:.2em;padding-inline-start:.3em;padding-inline-end:.3em;vertical-align:bottom;font:0.75em/0.8333333333 Ubuntu Mono, monospace;color:#d3d0c8;background-color:#1a1a1a;border:.1em solid #0d0d0d;border-bottom-width:.4em;border-radius:4px}table{display:block;width:100%;overflow:auto;border-spacing:0;border-collapse:collapse;width:max-content;max-width:100%}th{font-weight:600}td,th{padding-block-start:.4em;padding-block-end:.4em;padding-inline-start:.75em;padding-inline-end:.75em;border:1px solid #515151}tr:nth-child(2n){background-color:rgba(81,81,81,.1)}ol,ul{padding-inline-start:2em}ol ol,ol ul,ul ol,ul ul{margin-block-start:0;margin-block-end:0}li{margin-block-start:.25em;margin-block-end:.25em}dt{margin-block-start:1em;font-weight:600;font-style:italic}dd{margin-block-end:1em;margin-inline-start:1em}ul>li.task-list-item{list-style-type:none}ul>li.task-list-item input[type=checkbox]:first-child{margin:0 .2em .25em -1.6em;vertical-align:middle} diff --git a/script-resources/markdown2htmldoc/themes-src/github.scss b/script-resources/markdown2htmldoc/themes-src/github.scss new file mode 100644 index 0000000..d62cf79 --- /dev/null +++ b/script-resources/markdown2htmldoc/themes-src/github.scss @@ -0,0 +1,24 @@ +// See also: +// <-- Nice. +// +// +// + +@use '../node_modules/github-markdown-css/github-markdown.css'; + +html, +body { + padding: 0; + margin: 0; +} + +.markdown-body { + box-sizing: border-box; + min-width: 200px; + max-width: 960px; + margin: 0 auto; + padding: 32px; + @media (max-width: 768px - 1px) { + padding: 16px; + } +} diff --git a/script-resources/markdown2htmldoc/themes-src/my.scss b/script-resources/markdown2htmldoc/themes-src/my.scss new file mode 100644 index 0000000..45be05f --- /dev/null +++ b/script-resources/markdown2htmldoc/themes-src/my.scss @@ -0,0 +1,472 @@ +// My GLORIOUS theme for rendered Markdown documents (But may come in handy for +// other projects? Who knows!). Integrated with my colorscheme generators, best +// paired with my very own syntax highlighting theme. Based on +// sindresorhus/github-markdown-css[1] and primer/css[2]. By the way, here[3] +// is the first ever public version of the Markdown styles. Also, GitLab's +// stylesheet can be found here[4], it supports way more syntactical features. +// +// [1]: +// [2]: +// [3]: +// [4]: +// +// User-Agent stylesheets (): +// Firefox: +// Chromium: +// +// NOTE: This stylesheet makes heavy use of the +// {margin,padding,border}-{inline,block}-{start,end} rules (apparently they +// are called CSS Logical Properties[5]), for two reasons: +// +// 1. Judging by MDN this might give us not only easy RTL support, but possibly +// even support for vertical text directions. +// +// 2. UA stylesheets also rely on those, so overrides of those end up being +// more explicit and are shown in the devtools correctly. +// +// 3. However, they have pretty bad cross-browser support at the moment, so TODO: remove. +// +// [5]: + +@use 'sass:math'; +@use 'sass:color'; + +// NOTE: GitHub uses an ancient version of normalize.css: +// +@use '../node_modules/normalize.css/normalize.css'; + +@use '../../../colorschemes/out/colorscheme.scss'; + +//////////////////////////////////////////////////////////////////////////////// +// CONFIGURATION CONSTANTS AND FUNCTIONS +//////////////////////////////////////////////////////////////////////////////// + +// +$font-default: 'Ubuntu', sans-serif; +$font-monospace: 'Ubuntu Mono', monospace; +// https://github.com/primer/css/blob/63764f7edd59c5f4949c91e5373471aa8b0d4865/src/support/variables/typography.scss#L29-L32 +$line-height-headings: 1.25; +$line-height-code-blocks: 1.3; +$line-height-default: 1.5; +// +$font-size-default: 16px; + +// +$border-radius: 4px; +@function border($width: 1px, $style: solid, $color: colorscheme.$base-02) { + @return $width $style $color; +} + +$paragraph-spacing: 1em; + +//////////////////////////////////////////////////////////////////////////////// +// MIXINS AND FUNCTIONS +//////////////////////////////////////////////////////////////////////////////// + +@mixin clearfix { + &::after, + &::before { + display: table; + content: ''; + } + &::after { + clear: both; + } +} + +@mixin cancel-out-child-margins { + & > :first-child { + margin-block-start: 0 !important; + } + & > :last-child { + margin-block-end: 0 !important; + } +} + +// prettier-ignore +@mixin margin-block($margin) { margin-block-start: $margin; margin-block-end: $margin; } +// prettier-ignore +@mixin margin-inline($margin) { margin-inline-start: $margin; margin-inline-end: $margin; } +// prettier-ignore +@mixin padding-block($padding) { padding-block-start: $padding; padding-block-end: $padding; } +// prettier-ignore +@mixin padding-inline($padding) { padding-inline-start: $padding; padding-inline-end: $padding; } + +//////////////////////////////////////////////////////////////////////////////// +// BASE STYLES +// +// +//////////////////////////////////////////////////////////////////////////////// + +// +* { + box-sizing: border-box; +} + +// +// +body { + color: colorscheme.$fg; + background-color: colorscheme.$bg; + font-family: $font-default; + font-size: $font-size-default; + line-height: $line-height-default; + word-wrap: break-word; + + $tab-size: 4; + -moz-tab-size: $tab-size; + -o-tab-size: $tab-size; + tab-size: $tab-size; + + &::-moz-selection, + &::selection, + & ::-moz-selection, + & ::selection { + color: colorscheme.$selection-fg; + background-color: colorscheme.$selection-bg; + } +} + +// Also called `.markdown-body` by GitHub. +article { + min-width: 200px; + max-width: 960px; + margin: 0 auto; + padding: 32px; + @media (max-width: 768px - 1px) { + padding: 24px; + } + + @include clearfix(); + @include cancel-out-child-margins(); +} + +// +// +.octicon { + display: inline-block; + overflow: visible !important; // Not sure about this. + vertical-align: text-bottom; + fill: currentColor; +} + +// +a { + color: colorscheme.$base-0D; + text-decoration: none; + + &:hover, + &:focus, + &:active { + text-decoration: underline; + } + + // + &:not([href]) { + color: unset; + text-decoration: none; + } +} + +// +// +hr { + @include margin-block($paragraph-spacing * 1.5); + border: border($width: 0.2em); + @include clearfix(); +} + +// Set up paragraph margins for paragraphs themselves and other elements that +// will appear at the top level. +// +dl, +details, +table, +blockquote, +ul, +ol, +pre, +p { + @include margin-block($paragraph-spacing); +} + +// +blockquote { + @include margin-inline(0); + padding-inline-start: 1em; + border-inline-start: border($width: 0.25em); + @include cancel-out-child-margins(); +} + +// +summary { + cursor: pointer; +} + +// +img { + max-width: 100%; + // Fixes manually specified widths for images. + box-sizing: content-box; + background-color: colorscheme.$base-01; + + &[align='left'], + &[align='right'] { + margin: 0.5em 1.25em; + } + + &[align='left'] { + margin-left: 0; + } + + &[align='right'] { + margin-right: 0; + } +} + +ins, +del { + text-decoration: none; +} + +ins { + color: colorscheme.$base-0B; +} + +del { + color: colorscheme.$base-08; +} + +mark { + background-color: colorscheme.$base-0A; + color: colorscheme.$bg; +} + +//////////////////////////////////////////////////////////////////////////////// +// HEADINGS +// +//////////////////////////////////////////////////////////////////////////////// + +// +h1, +h2, +h3, +h4, +h5, +h6 { + margin-block-start: $paragraph-spacing * 1.5; + margin-block-end: $paragraph-spacing * 1; + padding-block-end: 0.3em; + border-block-end: border(); + // Make the headers less bold, the default font-weight is 700. + font-weight: 600; + line-height: $line-height-headings; + + // + .anchor { + float: left; + $size: 16px; + $offset: 4px; + padding-right: $offset; + margin-left: -($size + $offset); + + // Undo the default styles for links. + color: unset; + &:hover { + text-decoration: none; + } + &:focus { + outline: none; + } + + > * { + visibility: hidden; + vertical-align: middle; + } + } + + &:hover .anchor { + > * { + visibility: visible; + } + } +} + +h1 { + font-size: 2em; +} + +h2 { + font-size: 1.5em; +} + +h3 { + font-size: 1.25em; +} + +h4 { + font-size: 1em; +} + +h5 { + font-size: 0.875em; +} + +h6 { + font-size: 0.85em; +} + +//////////////////////////////////////////////////////////////////////////////// +// CODE +// +// +//////////////////////////////////////////////////////////////////////////////// + +code, +kbd, +samp, +pre { + font-family: $font-monospace; +} + +// Inline code snippets. +code { + @include padding-block(0.2em); + @include padding-inline(0.3em); + background-color: rgba(colorscheme.$base-03, 0.2); + border-radius: $border-radius; +} + +// Code blocks. +pre { + padding: 1em; + overflow: auto; + color: colorscheme.$fg; + background-color: colorscheme.$bg; + border: border(); + border-radius: $border-radius; + line-height: $line-height-code-blocks; + word-wrap: normal; + + // Undo the highlighting of inline snippets. + code { + padding: unset; + background-color: unset; + border: unset; + } +} + +//////////////////////////////////////////////////////////////////////////////// +// KEYBOARD SHORTCUTS +// +//////////////////////////////////////////////////////////////////////////////// + +kbd { + display: inline-block; + @include padding-block(0.2em); + @include padding-inline(0.3em); + vertical-align: bottom; + + // The original stylesheet specifies both font-size and line-height in + // pixels, but I want to do the same in relative units instead, so + // recalculating everything proportionally. + $orig-font-size: /* 11px */ 12px; + $orig-line-height: 10px; + $rel-font-size: math.div($orig-font-size, 16px) * 1em; + $rel-line-height: math.div($orig-line-height, $orig-font-size); + // This rule implicitly resets all inherited font-related properties. + font: #{$rel-font-size}/#{$rel-line-height} #{$font-monospace}; + + $kbd-bg-color: if(colorscheme.$is-dark, colorscheme.$bg, colorscheme.$fg); + $kbd-fg-color: if(colorscheme.$is-dark, colorscheme.$fg, colorscheme.$bg); + + color: $kbd-fg-color; + background-color: color.change($kbd-bg-color, $lightness: 10%); + border: border($width: 0.1em, $color: color.change($kbd-bg-color, $lightness: 5%)); + border-bottom-width: 0.4em; + border-radius: $border-radius; +} + +//////////////////////////////////////////////////////////////////////////////// +// TABLES +// +//////////////////////////////////////////////////////////////////////////////// + +// +table { + display: block; + width: 100%; + overflow: auto; + // + border-spacing: 0; + border-collapse: collapse; + + // For browsers with support for `max-content`. Not sure what this pair of + // rules does differently from just `width: 100%`. + width: max-content; + max-width: 100%; +} + +th { + font-weight: 600; +} + +td, +th { + @include padding-block(0.4em); + @include padding-inline(0.75em); + border: border(); +} + +tr:nth-child(2n) { + background-color: rgba(colorscheme.$base-02, 0.1); +} + +//////////////////////////////////////////////////////////////////////////////// +// LISTS +// +//////////////////////////////////////////////////////////////////////////////// + +// +ol, +ul { + padding-inline-start: 2em; + + // Disable the "paragraph" margins for nested lists. + // + & & { + @include margin-block(0); + } +} + +// +li { + @include margin-block($paragraph-spacing * 0.25); +} + +// +dt { + margin-block-start: $paragraph-spacing; + font-weight: 600; + font-style: italic; +} + +// +dd { + margin-block-end: $paragraph-spacing; + margin-inline-start: 1em; +} + +// Apparently not available in Primer? Had to copy from the extracted +// production stylesheets. +// +// +ul > li.task-list-item { + list-style-type: none; + input[type='checkbox']:first-child { + margin: 0 0.2em 0.25em -1.6em; + vertical-align: middle; + } +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/script-resources/markdown2htmldoc/yarn.lock b/script-resources/markdown2htmldoc/yarn.lock index 04554e2..1ef4184 100644 --- a/script-resources/markdown2htmldoc/yarn.lock +++ b/script-resources/markdown2htmldoc/yarn.lock @@ -92,6 +92,14 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: dependencies: color-convert "^2.0.1" +anymatch@~3.1.1: + version "3.1.2" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" + integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -114,6 +122,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +binary-extensions@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" + integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -122,6 +135,13 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +braces@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + callsites@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" @@ -144,6 +164,21 @@ chalk@^4.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" +"chokidar@>=3.0.0 <4.0.0": + version "3.5.1" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.1.tgz#ee9ce7bbebd2b79f49f304799d5468e31e14e68a" + integrity sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw== + dependencies: + anymatch "~3.1.1" + braces "~3.0.2" + glob-parent "~5.1.0" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.5.0" + optionalDependencies: + fsevents "~2.3.1" + clipboard@^2.0.0: version "2.0.8" resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.8.tgz#ffc6c103dd2967a83005f3f61976aa4655a4cdba" @@ -416,6 +451,13 @@ file-entry-cache@^6.0.1: dependencies: flat-cache "^3.0.4" +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + flat-cache@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" @@ -434,6 +476,11 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= +fsevents@~2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" @@ -444,7 +491,7 @@ functional-red-black-tree@^1.0.1: resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= -github-markdown-css@^4.0.0: +github-markdown-css@*: version "4.0.0" resolved "https://registry.yarnpkg.com/github-markdown-css/-/github-markdown-css-4.0.0.tgz#be9f4caf7a389228d4c368336260ffc909061f35" integrity sha512-mH0bcIKv4XAN0mQVokfTdKo2OD5K8WJE9+lbMdM32/q0Ie5tXgVN/2o+zvToRMxSTUuiTRcLg5hzkFfOyBYreg== @@ -456,7 +503,7 @@ github-slugger@^1.2.1: dependencies: emoji-regex ">=6.0.0 <=6.1.1" -glob-parent@^5.0.0: +glob-parent@^5.0.0, glob-parent@~5.1.0: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== @@ -549,6 +596,13 @@ inherits@2: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + is-core-module@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.3.0.tgz#d341652e3408bca69c4671b79a0954a3d349f887" @@ -566,13 +620,18 @@ is-fullwidth-code-point@^3.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== -is-glob@^4.0.0, is-glob@^4.0.1: +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== dependencies: is-extglob "^2.1.1" +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -686,6 +745,16 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +normalize.css@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/normalize.css/-/normalize.css-8.0.1.tgz#9b98a208738b9cc2634caacbc42d131c97487bf3" + integrity sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg== + once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -727,6 +796,11 @@ path-parse@^1.0.6: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== +picomatch@^2.0.4, picomatch@^2.2.1: + version "2.2.3" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.3.tgz#465547f359ccc206d3c48e46a1bcb89bf7ee619d" + integrity sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg== + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -761,6 +835,13 @@ punycode@^2.1.0: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== +readdirp@~3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.5.0.tgz#9ba74c019b15d365278d2e91bb8c48d7b4d42c9e" + integrity sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ== + dependencies: + picomatch "^2.2.1" + regexpp@^3.0.0, regexpp@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" @@ -791,6 +872,13 @@ rimraf@^3.0.2: dependencies: glob "^7.1.3" +sass@^1.33.0: + version "1.33.0" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.33.0.tgz#a26186902ee56585b9db6751fd151237f561dbc2" + integrity sha512-9v0MUXnSi62FtfjqcwZ+b8B9FIxdwFEb3FPUkjEPXWd0b5KcnPGSp2XF9WrzcH1ZxedfgJVTdA3A1j4eEj53xg== + dependencies: + chokidar ">=3.0.0 <4.0.0" + select@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d" @@ -891,6 +979,13 @@ tiny-emitter@^2.0.0: resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz#1d1a56edfc51c43e863cbb5382a72330e3555423" integrity sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q== +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" From 74a20d6db2d3668ca98ec1680bab21f88cf16bab Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 30 May 2021 15:42:08 +0300 Subject: [PATCH 629/713] [scripts/markdown2htmldoc] don't use CSS Logical Properties --- .../markdown2htmldoc/themes-out/my.css | 2 +- .../markdown2htmldoc/themes-src/my.scss | 72 +++++++------------ 2 files changed, 27 insertions(+), 47 deletions(-) diff --git a/script-resources/markdown2htmldoc/themes-out/my.css b/script-resources/markdown2htmldoc/themes-out/my.css index af9f8a5..c6918ce 100644 --- a/script-resources/markdown2htmldoc/themes-out/my.css +++ b/script-resources/markdown2htmldoc/themes-out/my.css @@ -1 +1 @@ -/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}*{box-sizing:border-box}body{color:#d3d0c8;background-color:#2d2d2d;font-family:"Ubuntu",sans-serif;font-size:16px;line-height:1.5;word-wrap:break-word;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body::-moz-selection,body::selection,body ::-moz-selection,body ::selection{color:#d3d0c8;background-color:#515151}article{min-width:200px;max-width:960px;margin:0 auto;padding:32px}@media(max-width: 767px){article{padding:24px}}article::after,article::before{display:table;content:""}article::after{clear:both}article>:first-child{margin-block-start:0 !important}article>:last-child{margin-block-end:0 !important}.octicon{display:inline-block;overflow:visible !important;vertical-align:text-bottom;fill:currentColor}a{color:#69c;text-decoration:none}a:hover,a:focus,a:active{text-decoration:underline}a:not([href]){color:unset;text-decoration:none}hr{margin-block-start:1.5em;margin-block-end:1.5em;border:.2em solid #515151}hr::after,hr::before{display:table;content:""}hr::after{clear:both}dl,details,table,blockquote,ul,ol,pre,p{margin-block-start:1em;margin-block-end:1em}blockquote{margin-inline-start:0;margin-inline-end:0;padding-inline-start:1em;border-inline-start:.25em solid #515151}blockquote>:first-child{margin-block-start:0 !important}blockquote>:last-child{margin-block-end:0 !important}summary{cursor:pointer}img{max-width:100%;box-sizing:content-box;background-color:#393939}img[align=left],img[align=right]{margin:.5em 1.25em}img[align=left]{margin-left:0}img[align=right]{margin-right:0}ins,del{text-decoration:none}ins{color:#9c9}del{color:#f2777a}mark{background-color:#fc6;color:#2d2d2d}h1,h2,h3,h4,h5,h6{margin-block-start:1.5em;margin-block-end:1em;padding-block-end:.3em;border-block-end:1px solid #515151;font-weight:600;line-height:1.25}h1 .anchor,h2 .anchor,h3 .anchor,h4 .anchor,h5 .anchor,h6 .anchor{float:left;padding-right:4px;margin-left:-20px;color:unset}h1 .anchor:hover,h2 .anchor:hover,h3 .anchor:hover,h4 .anchor:hover,h5 .anchor:hover,h6 .anchor:hover{text-decoration:none}h1 .anchor:focus,h2 .anchor:focus,h3 .anchor:focus,h4 .anchor:focus,h5 .anchor:focus,h6 .anchor:focus{outline:none}h1 .anchor>*,h2 .anchor>*,h3 .anchor>*,h4 .anchor>*,h5 .anchor>*,h6 .anchor>*{visibility:hidden;vertical-align:middle}h1:hover .anchor>*,h2:hover .anchor>*,h3:hover .anchor>*,h4:hover .anchor>*,h5:hover .anchor>*,h6:hover .anchor>*{visibility:visible}h1{font-size:2em}h2{font-size:1.5em}h3{font-size:1.25em}h4{font-size:1em}h5{font-size:.875em}h6{font-size:.85em}code,kbd,samp,pre{font-family:"Ubuntu Mono",monospace}code{padding-block-start:.2em;padding-block-end:.2em;padding-inline-start:.3em;padding-inline-end:.3em;background-color:rgba(116,115,105,.2);border-radius:4px}pre{padding:1em;overflow:auto;color:#d3d0c8;background-color:#2d2d2d;border:1px solid #515151;border-radius:4px;line-height:1.3;word-wrap:normal}pre code{padding:unset;background-color:unset;border:unset}kbd{display:inline-block;padding-block-start:.2em;padding-block-end:.2em;padding-inline-start:.3em;padding-inline-end:.3em;vertical-align:bottom;font:0.75em/0.8333333333 Ubuntu Mono, monospace;color:#d3d0c8;background-color:#1a1a1a;border:.1em solid #0d0d0d;border-bottom-width:.4em;border-radius:4px}table{display:block;width:100%;overflow:auto;border-spacing:0;border-collapse:collapse;width:max-content;max-width:100%}th{font-weight:600}td,th{padding-block-start:.4em;padding-block-end:.4em;padding-inline-start:.75em;padding-inline-end:.75em;border:1px solid #515151}tr:nth-child(2n){background-color:rgba(81,81,81,.1)}ol,ul{padding-inline-start:2em}ol ol,ol ul,ul ol,ul ul{margin-block-start:0;margin-block-end:0}li{margin-block-start:.25em;margin-block-end:.25em}dt{margin-block-start:1em;font-weight:600;font-style:italic}dd{margin-block-end:1em;margin-inline-start:1em}ul>li.task-list-item{list-style-type:none}ul>li.task-list-item input[type=checkbox]:first-child{margin:0 .2em .25em -1.6em;vertical-align:middle} +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}*{box-sizing:border-box}body{color:#d3d0c8;background-color:#2d2d2d;font-family:"Ubuntu",sans-serif;font-size:16px;line-height:1.5;word-wrap:break-word;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body::-moz-selection,body::selection,body ::-moz-selection,body ::selection{color:#d3d0c8;background-color:#515151}article{min-width:200px;max-width:960px;margin:0 auto;padding:32px}@media(max-width: 767px){article{padding:24px}}article::after,article::before{display:table;content:""}article::after{clear:both}article>:first-child{margin-top:0 !important}article>:last-child{margin-bottom:0 !important}.octicon{display:inline-block;overflow:visible !important;vertical-align:text-bottom;fill:currentColor}a{color:#69c;text-decoration:none}a:hover,a:focus,a:active{text-decoration:underline}a:not([href]){color:unset;text-decoration:none}hr{margin-top:1.5em;margin-bottom:1.5em;border:.2em solid #515151}hr::after,hr::before{display:table;content:""}hr::after{clear:both}dl,details,table,blockquote,ul,ol,pre,p{margin-top:1em;margin-bottom:1em}blockquote{margin-left:0;margin-right:0;padding-left:1em;border-left:.25em solid #515151}blockquote>:first-child{margin-top:0 !important}blockquote>:last-child{margin-bottom:0 !important}summary{cursor:pointer}img{max-width:100%;box-sizing:content-box;background-color:#393939}img[align=left],img[align=right]{margin:.5em 1.25em}img[align=left]{margin-left:0}img[align=right]{margin-right:0}ins,del{text-decoration:none}ins{color:#9c9}del{color:#f2777a}mark{background-color:#fc6;color:#2d2d2d}h1,h2,h3,h4,h5,h6{margin-top:1.5em;margin-bottom:1em;padding-bottom:.3em;border-bottom:1px solid #515151;font-weight:600;line-height:1.25}h1 .anchor,h2 .anchor,h3 .anchor,h4 .anchor,h5 .anchor,h6 .anchor{float:left;padding-right:4px;margin-left:-20px;color:unset}h1 .anchor:hover,h2 .anchor:hover,h3 .anchor:hover,h4 .anchor:hover,h5 .anchor:hover,h6 .anchor:hover{text-decoration:none}h1 .anchor:focus,h2 .anchor:focus,h3 .anchor:focus,h4 .anchor:focus,h5 .anchor:focus,h6 .anchor:focus{outline:none}h1 .anchor>*,h2 .anchor>*,h3 .anchor>*,h4 .anchor>*,h5 .anchor>*,h6 .anchor>*{visibility:hidden;vertical-align:middle}h1:hover .anchor>*,h2:hover .anchor>*,h3:hover .anchor>*,h4:hover .anchor>*,h5:hover .anchor>*,h6:hover .anchor>*{visibility:visible}h1{font-size:2em}h2{font-size:1.5em}h3{font-size:1.25em}h4{font-size:1em}h5{font-size:.875em}h6{font-size:.85em}code,kbd,samp,pre{font-family:"Ubuntu Mono",monospace}code{padding:.2em .3em;background-color:rgba(116,115,105,.2);border-radius:4px}pre{padding:1em;overflow:auto;color:#d3d0c8;background-color:#2d2d2d;border:1px solid #515151;border-radius:4px;line-height:1.3;word-wrap:normal}pre code{padding:unset;background-color:unset;border:unset}kbd{display:inline-block;padding:.2em .3em;vertical-align:bottom;font:0.75em/0.8333333333 Ubuntu Mono, monospace;color:#d3d0c8;background-color:#1a1a1a;border:.1em solid #0d0d0d;border-bottom-width:.4em;border-radius:4px}table{display:block;width:100%;overflow:auto;border-spacing:0;border-collapse:collapse;width:max-content;max-width:100%}th{font-weight:600}td,th{padding:.4em .75em;border:1px solid #515151}tr:nth-child(2n){background-color:rgba(81,81,81,.1)}ol,ul{padding-left:2em}ol ol,ol ul,ul ol,ul ul{margin-top:0;margin-bottom:0}li{margin-top:.25em;margin-bottom:.25em}dt{margin-top:1em;font-weight:600;font-style:italic}dd{margin-bottom:1em;margin-left:0;padding-left:1em}ul>li.task-list-item{list-style-type:none}ul>li.task-list-item input[type=checkbox]:first-child{margin:0 .2em .25em -1.6em;vertical-align:middle} diff --git a/script-resources/markdown2htmldoc/themes-src/my.scss b/script-resources/markdown2htmldoc/themes-src/my.scss index 45be05f..96fb6b6 100644 --- a/script-resources/markdown2htmldoc/themes-src/my.scss +++ b/script-resources/markdown2htmldoc/themes-src/my.scss @@ -13,20 +13,6 @@ // User-Agent stylesheets (): // Firefox: // Chromium: -// -// NOTE: This stylesheet makes heavy use of the -// {margin,padding,border}-{inline,block}-{start,end} rules (apparently they -// are called CSS Logical Properties[5]), for two reasons: -// -// 1. Judging by MDN this might give us not only easy RTL support, but possibly -// even support for vertical text directions. -// -// 2. UA stylesheets also rely on those, so overrides of those end up being -// more explicit and are shown in the devtools correctly. -// -// 3. However, they have pretty bad cross-browser support at the moment, so TODO: remove. -// -// [5]: @use 'sass:math'; @use 'sass:color'; @@ -76,22 +62,13 @@ $paragraph-spacing: 1em; @mixin cancel-out-child-margins { & > :first-child { - margin-block-start: 0 !important; + margin-top: 0 !important; } & > :last-child { - margin-block-end: 0 !important; + margin-bottom: 0 !important; } } -// prettier-ignore -@mixin margin-block($margin) { margin-block-start: $margin; margin-block-end: $margin; } -// prettier-ignore -@mixin margin-inline($margin) { margin-inline-start: $margin; margin-inline-end: $margin; } -// prettier-ignore -@mixin padding-block($padding) { padding-block-start: $padding; padding-block-end: $padding; } -// prettier-ignore -@mixin padding-inline($padding) { padding-inline-start: $padding; padding-inline-end: $padding; } - //////////////////////////////////////////////////////////////////////////////// // BASE STYLES // @@ -171,7 +148,8 @@ a { // // hr { - @include margin-block($paragraph-spacing * 1.5); + margin-top: $paragraph-spacing * 1.5; + margin-bottom: $paragraph-spacing * 1.5; border: border($width: 0.2em); @include clearfix(); } @@ -187,14 +165,16 @@ ul, ol, pre, p { - @include margin-block($paragraph-spacing); + margin-top: $paragraph-spacing; + margin-bottom: $paragraph-spacing; } // blockquote { - @include margin-inline(0); - padding-inline-start: 1em; - border-inline-start: border($width: 0.25em); + margin-left: 0; + margin-right: 0; + padding-left: 1em; + border-left: border($width: 0.25em); @include cancel-out-child-margins(); } @@ -254,10 +234,10 @@ h3, h4, h5, h6 { - margin-block-start: $paragraph-spacing * 1.5; - margin-block-end: $paragraph-spacing * 1; - padding-block-end: 0.3em; - border-block-end: border(); + margin-top: $paragraph-spacing * 1.5; + margin-bottom: $paragraph-spacing * 1; + padding-bottom: 0.3em; + border-bottom: border(); // Make the headers less bold, the default font-weight is 700. font-weight: 600; line-height: $line-height-headings; @@ -331,8 +311,7 @@ pre { // Inline code snippets. code { - @include padding-block(0.2em); - @include padding-inline(0.3em); + padding: 0.2em 0.3em; background-color: rgba(colorscheme.$base-03, 0.2); border-radius: $border-radius; } @@ -363,8 +342,7 @@ pre { kbd { display: inline-block; - @include padding-block(0.2em); - @include padding-inline(0.3em); + padding: 0.2em 0.3em; vertical-align: bottom; // The original stylesheet specifies both font-size and line-height in @@ -413,8 +391,7 @@ th { td, th { - @include padding-block(0.4em); - @include padding-inline(0.75em); + padding: 0.4em 0.75em; border: border(); } @@ -430,31 +407,34 @@ tr:nth-child(2n) { // ol, ul { - padding-inline-start: 2em; + padding-left: 2em; // Disable the "paragraph" margins for nested lists. // & & { - @include margin-block(0); + margin-top: 0; + margin-bottom: 0; } } // li { - @include margin-block($paragraph-spacing * 0.25); + margin-top: $paragraph-spacing * 0.25; + margin-bottom: $paragraph-spacing * 0.25; } // dt { - margin-block-start: $paragraph-spacing; + margin-top: $paragraph-spacing; font-weight: 600; font-style: italic; } // dd { - margin-block-end: $paragraph-spacing; - margin-inline-start: 1em; + margin-bottom: $paragraph-spacing; + margin-left: 0; + padding-left: 1em; } // Apparently not available in Primer? Had to copy from the extracted From 2be34dfad76f79a9b72cb1292506cfa3d6797f45 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 30 May 2021 17:53:53 +0300 Subject: [PATCH 630/713] [colorschemes] rewrite the generator from scratch --- colorschemes/Makefile | 25 - colorschemes/_theme.py | 50 -- colorschemes/colorscheme.scss.py | 13 - colorschemes/iterm.itermcolors.py | 49 -- colorschemes/kitty.conf.py | 28 -- colorschemes/main.py | 436 ++++++++++++++++++ .../{colorscheme.scss => _colorscheme.scss} | 0 colorschemes/out/prismjs-theme.css | 1 - colorschemes/prismjs-theme.css.py | 12 - colorschemes/setvtrgb.txt.py | 11 - colorschemes/termux.properties.py | 14 - colorschemes/variables.css.py | 9 - colorschemes/vim.vim.py | 22 - .../vscode-colorCustomizations.json.py | 31 -- colorschemes/xfce4-terminal.theme.py | 18 - colorschemes/zsh.zsh.py | 19 - .../markdown2htmldoc/themes-src/my.scss | 2 +- 17 files changed, 437 insertions(+), 303 deletions(-) delete mode 100644 colorschemes/Makefile delete mode 100644 colorschemes/_theme.py delete mode 100755 colorschemes/colorscheme.scss.py delete mode 100755 colorschemes/iterm.itermcolors.py delete mode 100755 colorschemes/kitty.conf.py create mode 100755 colorschemes/main.py rename colorschemes/out/{colorscheme.scss => _colorscheme.scss} (100%) delete mode 100755 colorschemes/prismjs-theme.css.py delete mode 100755 colorschemes/setvtrgb.txt.py delete mode 100755 colorschemes/termux.properties.py delete mode 100755 colorschemes/variables.css.py delete mode 100755 colorschemes/vim.vim.py delete mode 100755 colorschemes/vscode-colorCustomizations.json.py delete mode 100755 colorschemes/xfce4-terminal.theme.py delete mode 100755 colorschemes/zsh.zsh.py diff --git a/colorschemes/Makefile b/colorschemes/Makefile deleted file mode 100644 index 52b08a3..0000000 --- a/colorschemes/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# https://tech.davis-hansson.com/p/make/ -SHELL := bash -.ONESHELL: -.SHELLFLAGS := -eu -o pipefail -c -.DELETE_ON_ERROR: -MAKEFLAGS += --warn-undefined-variables -MAKEFLAGS += --no-builtin-rules - -.PHONY: all clean - -OUT_DIR := out -OUT_FILES := iterm.itermcolors kitty.conf vim.vim setvtrgb.txt zsh.zsh termux.properties variables.css colorscheme.scss prismjs-theme.css vscode-colorCustomizations.json xfce4-terminal.theme - -all: $(OUT_DIR) $(addprefix $(OUT_DIR)/,$(OUT_FILES)) - -clean: - rm -rv $(OUT_DIR) - -$(OUT_DIR): - mkdir -p $@ - -$(OUT_DIR)/%: %.py _theme.py $(OUT_DIR) - python3 ./$< > $@ - -$(OUT_DIR)/prismjs-theme.css: prismjs-theme-src.css diff --git a/colorschemes/_theme.py b/colorschemes/_theme.py deleted file mode 100644 index 0fb8671..0000000 --- a/colorschemes/_theme.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python3 - -# base16-eighties by Chris Kempson (http://chriskempson.com) -base16_name = "eighties" -name = "base16-" + base16_name -is_dark = True -base16_colors = [ - "#2d2d2d", # 0 - "#393939", # 1 - "#515151", # 2 - "#747369", # 3 - "#a09f93", # 4 - "#d3d0c8", # 5 - "#e8e6df", # 6 - "#f2f0ec", # 7 - "#f2777a", # 8 - "#f99157", # 9 - "#ffcc66", # a - "#99cc99", # b - "#66cccc", # c - "#6699cc", # d - "#cc99cc", # e - "#d27b53", # f -] - -bg = base16_colors[0x0] -fg = base16_colors[0x5] - -cursor_bg = fg -cursor_fg = bg - -selection_bg = base16_colors[0x2] -selection_fg = fg - -ansi_colors = [ - base16_colors[int(i, 16)] for i in "0 8 B A D E C 5 3 8 B A D E C 7 9 F 1 2 4 6".split() -] - -link_color = ansi_colors[0xC] - -css_variables_prefix = "dotfiles-colorscheme-" -css_variables = { - "bg": bg, - "fg": fg, - "selection-bg": selection_bg, - "selection-fg": selection_fg, - "cursor-bg": cursor_bg, - "cursor-fg": cursor_fg, - **{"base-{:02X}".format(index): color for index, color in enumerate(base16_colors)}, -} diff --git a/colorschemes/colorscheme.scss.py b/colorschemes/colorscheme.scss.py deleted file mode 100755 index 9eff318..0000000 --- a/colorschemes/colorscheme.scss.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python3 - -# TODO: Prefix the name with an underscore when I rewrite the theme generator, -# see . - -import _theme as theme - - -print('$is-dark: {};'.format("true" if theme.is_dark else "false")) -for var_name, color in theme.css_variables.items(): - print("${}: {};".format(var_name, color)) -print("$base: ({});".format(', '.join(theme.base16_colors))) -print("$ansi: ({});".format(', '.join(theme.ansi_colors))) diff --git a/colorschemes/iterm.itermcolors.py b/colorschemes/iterm.itermcolors.py deleted file mode 100755 index 8cd59e5..0000000 --- a/colorschemes/iterm.itermcolors.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python3 - -import _theme as theme - - -print( - """\ - - - -\ -""" -) - - -def print_color(key_name, color): - r, g, b = [float(int(color[2 * i + 1:2 * i + 3], 16)) / 255 for i in range(3)] - print( - """\ - {} Color - - Color Space - sRGB - Red Component - {} - Green Component - {} - Blue Component - {} - \ -""".format(key_name, r, g, b) - ) - - -print_color("Background", theme.bg) -print_color("Foreground", theme.fg) -print_color("Bold", theme.fg) -print_color("Cursor", theme.cursor_bg) -print_color("Cursor Text", theme.cursor_fg) -print_color("Selection Color", theme.selection_bg) -print_color("Selected Text Color", theme.selection_fg) -for index, color in enumerate(theme.ansi_colors[:16]): - print_color("Ansi " + str(index), color) -print_color("Link", theme.link_color) - -print("""\ - -\ -""") diff --git a/colorschemes/kitty.conf.py b/colorschemes/kitty.conf.py deleted file mode 100755 index 81544aa..0000000 --- a/colorschemes/kitty.conf.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python3 - -import _theme as theme - - -def print_color(key_name, color): - print("{} {}".format(key_name, color)) - - -print_color("background", theme.bg) -print_color("foreground", theme.fg) -print_color("cursor", theme.cursor_bg) -print_color("cursor_text_color", theme.cursor_fg) -print_color("selection_background", theme.selection_bg) -print_color("selection_foreground", theme.selection_fg) -for index, color in enumerate(theme.ansi_colors[:16]): - print_color("color" + str(index), color) -print_color("url_color", theme.link_color) - -print_color("active_border_color", theme.ansi_colors[2]) -print_color("inactive_border_color", theme.ansi_colors[8]) -print_color("bell_border_color", theme.ansi_colors[1]) - -print_color("active_tab_foreground", theme.base16_colors[0x1]) -print_color("active_tab_background", theme.base16_colors[0xB]) -print_color("inactive_tab_foreground", theme.base16_colors[0x4]) -print_color("inactive_tab_background", theme.base16_colors[0x1]) -print_color("tab_bar_background", theme.base16_colors[0x1]) diff --git a/colorschemes/main.py b/colorschemes/main.py new file mode 100755 index 0000000..11e34ee --- /dev/null +++ b/colorschemes/main.py @@ -0,0 +1,436 @@ +#!/usr/bin/env python3 + +import json +import os +from abc import abstractmethod +from typing import Dict, Iterable, List, Protocol, TextIO, runtime_checkable + + +__dir__ = os.path.dirname(__file__) + + +class Color: + + def __init__(self, r: int, g: int, b: int) -> None: + assert 0 <= r <= 0xff + assert 0 <= g <= 0xff + assert 0 <= b <= 0xff + self.r = r + self.g = g + self.b = b + + @classmethod + def from_hex(cls, s: str) -> "Color": + assert len(s) == 6 + return Color(int(s[0:2], 16), int(s[2:4], 16), int(s[4:6], 16)) + + @property + def css_hex(self) -> str: + return "#{:02x}{:02x}{:02x}".format(self.r, self.g, self.b) + + @property + def hex(self) -> str: + return "{:02x}{:02x}{:02x}".format(self.r, self.g, self.b) + + def __getitem__(self, index: int) -> int: + if index == 0: + return self.r + elif index == 1: + return self.g + elif index == 2: + return self.b + else: + raise IndexError("color component index out of range") + + def __iter__(self) -> Iterable[int]: + yield self.r + yield self.g + yield self.b + + +BASE16_TO_ANSI_MAPPING: List[int] = [ + 0x0, 0x8, 0xB, 0xA, 0xD, 0xE, 0xC, 0x5, # 0x0 + 0x3, 0x8, 0xB, 0xA, 0xD, 0xE, 0xC, 0x7, # 0x8 + 0x9, 0xF, 0x1, 0x2, 0x4, 0x6, # 0x10 +] # yapf: disable + +ANSI_TO_BASE16_MAPPING: List[int] = [BASE16_TO_ANSI_MAPPING.index(i) for i in range(16)] + + +@runtime_checkable +class Theme(Protocol): + + @property + @abstractmethod + def base16_name(self) -> str: + raise NotImplementedError() + + @property + @abstractmethod + def is_dark(self) -> bool: + raise NotImplementedError() + + @property + @abstractmethod + def base16_colors(self) -> List[Color]: + raise NotImplementedError() + + @property + def name(self) -> str: + return "base16-{}".format(self.base16_name) + + @property + def bg(self) -> Color: + return self.base16_colors[0x0] + + @property + def fg(self) -> Color: + return self.base16_colors[0x5] + + @property + def cursor_bg(self) -> Color: + return self.fg + + @property + def cursor_fg(self) -> Color: + return self.bg + + @property + def selection_bg(self) -> Color: + return self.base16_colors[0x2] + + @property + def selection_fg(self) -> Color: + return self.fg + + @property + def ansi_colors(self) -> List[Color]: + return [self.base16_colors[i] for i in BASE16_TO_ANSI_MAPPING] + + @property + def link_color(self) -> Color: + return self.ansi_colors[0xC] + + @property + def css_variables(self) -> Dict[str, Color]: + d = { + "bg": self.bg, + "fg": self.fg, + "selection-bg": self.selection_bg, + "selection-fg": self.selection_fg, + "cursor-bg": self.cursor_bg, + "cursor-fg": self.cursor_fg, + } + for index, color in enumerate(self.base16_colors): + d["base-{:02X}".format(index)] = color + return d + + +class MyTheme(Theme): + base16_name = "eighties" + is_dark = True + base16_colors = [ + Color.from_hex("2d2d2d"), # 0 + Color.from_hex("393939"), # 1 + Color.from_hex("515151"), # 2 + Color.from_hex("747369"), # 3 + Color.from_hex("a09f93"), # 4 + Color.from_hex("d3d0c8"), # 5 + Color.from_hex("e8e6df"), # 6 + Color.from_hex("f2f0ec"), # 7 + Color.from_hex("f2777a"), # 8 + Color.from_hex("f99157"), # 9 + Color.from_hex("ffcc66"), # a + Color.from_hex("99cc99"), # b + Color.from_hex("66cccc"), # c + Color.from_hex("6699cc"), # d + Color.from_hex("cc99cc"), # e + Color.from_hex("d27b53"), # f + ] + + +@runtime_checkable +class ThemeGenerator(Protocol): + + @abstractmethod + def file_name(self) -> str: + raise NotImplementedError() + + @abstractmethod + def generate(self, theme: Theme, output: TextIO) -> None: + raise NotImplementedError() + + +class ThemeGeneratorKitty(ThemeGenerator): + + def file_name(self) -> str: + return "kitty.conf" + + def generate(self, theme: Theme, output: TextIO) -> None: + + def write_color(key_name: str, color: Color) -> None: + output.write("{} {}\n".format(key_name, color.css_hex)) + + write_color("background", theme.bg) + write_color("foreground", theme.fg) + write_color("cursor", theme.cursor_bg) + write_color("cursor_text_color", theme.cursor_fg) + write_color("selection_background", theme.selection_bg) + write_color("selection_foreground", theme.selection_fg) + for index, color in enumerate(theme.ansi_colors[:16]): + write_color("color{}".format(index), color) + write_color("url_color", theme.link_color) + + write_color("active_border_color", theme.ansi_colors[2]) + write_color("inactive_border_color", theme.ansi_colors[8]) + write_color("bell_border_color", theme.ansi_colors[1]) + + write_color("active_tab_foreground", theme.base16_colors[0x1]) + write_color("active_tab_background", theme.base16_colors[0xB]) + write_color("inactive_tab_foreground", theme.base16_colors[0x4]) + write_color("inactive_tab_background", theme.base16_colors[0x1]) + write_color("tab_bar_background", theme.base16_colors[0x1]) + + +class ThemeGeneratorTermux(ThemeGenerator): + + def file_name(self) -> str: + return "termux.properties" + + def generate(self, theme: Theme, output: TextIO) -> None: + + def write_color(key_name: str, color: Color) -> None: + output.write("{}={}\n".format(key_name, color.css_hex)) + + write_color("background", theme.bg) + write_color("foreground", theme.fg) + write_color("cursor", theme.cursor_bg) + for index, color in enumerate(theme.ansi_colors[:16]): + write_color("color{}".format(index), color) + + +class ThemeGeneratorZsh(ThemeGenerator): + + def file_name(self) -> str: + return "zsh.zsh" + + def generate(self, theme: Theme, output: TextIO) -> None: + + def write_color(key_name: str, color: Color) -> None: + output.write("colorscheme_{}={}\n".format(key_name, color.hex)) + + write_color("bg", theme.bg) + write_color("fg", theme.fg) + write_color("cursor_bg", theme.cursor_bg) + write_color("cursor_fg", theme.cursor_fg) + write_color("selection_bg", theme.selection_bg) + write_color("selection_fg", theme.selection_fg) + write_color("link_color", theme.link_color) + + output.write("colorscheme_ansi_colors=(\n") + for color in theme.ansi_colors: + output.write(" {}\n".format(color.hex)) + output.write(")\n") + + +class ThemeGeneratorVim(ThemeGenerator): + + def file_name(self) -> str: + return "vim.vim" + + def generate(self, theme: Theme, output: TextIO) -> None: + namespace = "dotfiles_colorscheme_" + output.write("let {}name = '{}'\n".format(namespace, theme.name)) + output.write("let {}base16_name = '{}'\n".format(namespace, theme.base16_name)) + output.write("let {}base16_colors = [\n".format(namespace)) + for gui_color, cterm_color in zip(theme.base16_colors, ANSI_TO_BASE16_MAPPING): + output.write( + "\\ {{'gui': '{}', 'cterm': '{:02}'}},\n".format(gui_color.css_hex, cterm_color) + ) + output.write("\\ ]\n") + + namespace = "terminal_color_" + output.write("let {}background = '{}'\n".format(namespace, theme.bg.css_hex)) + output.write("let {}foreground = '{}'\n".format(namespace, theme.fg.css_hex)) + for index, color in enumerate(theme.ansi_colors[:16]): + output.write("let {}{} = '{}'\n".format(namespace, index, color.css_hex)) + + +class ThemeGeneratorSetvtrgb(ThemeGenerator): + # default setvtrgb config: + # 0,170,0,170,0,170,0,170,85,255,85,255,85,255,85,255 + # 0,0,170,85,0,0,170,170,85,85,255,255,85,85,255,255 + # 0,0,0,0,170,170,170,170,85,85,85,85,255,255,255,255 + + def file_name(self) -> str: + return "setvtrgb.txt" + + def generate(self, theme: Theme, output: TextIO) -> None: + for i in range(3): + output.write(",".join(str(color[i]) for color in theme.ansi_colors[:16])) + output.write("\n") + + +class ThemeGeneratorXfceTerminal(ThemeGenerator): + + def file_name(self) -> str: + return "xfce4-terminal.theme" + + def generate(self, theme: Theme, output: TextIO) -> None: + output.write("[Scheme]\n") + output.write("Name=dmitmel's dotfiles colorscheme\n") + output.write("ColorForeground={}\n".format(theme.fg.css_hex)) + output.write("ColorBackground={}\n".format(theme.bg.css_hex)) + output.write("ColorCursorUseDefault=FALSE\n") + output.write("ColorCursorForeground={}\n".format(theme.cursor_fg.css_hex)) + output.write("ColorCursor={}\n".format(theme.cursor_bg.css_hex)) + output.write("ColorSelectionUseDefault=FALSE\n") + output.write("ColorSelection={}\n".format(theme.selection_fg.css_hex)) + output.write("ColorSelectionBackground={}\n".format(theme.selection_bg.css_hex)) + output.write("TabActivityColor={}\n".format(theme.base16_colors[0x8].css_hex)) + output.write("ColorBoldUseDefault=TRUE\n") + output.write( + "ColorPalette={}\n".format(";".join(color.css_hex for color in theme.ansi_colors)) + ) + + +class ThemeGeneratorVscode(ThemeGenerator): + + def file_name(self) -> str: + return "vscode-colorCustomizations.json" + + def generate(self, theme: Theme, output: TextIO) -> None: + ANSI_COLOR_NAMES = [ + "Black", + "Red", + "Green", + "Yellow", + "Blue", + "Magenta", + "Cyan", + "White", + ] + + colors: Dict[str, str] = { + "terminal.background": theme.bg.css_hex, + "terminal.foreground": theme.fg.css_hex, + "terminal.selectionBackground": theme.selection_bg.css_hex, + "terminalCursor.background": theme.cursor_fg.css_hex, + "terminalCursor.foreground": theme.cursor_bg.css_hex, + } + + for is_bright in [False, True]: + for color_index, color_name in enumerate(ANSI_COLOR_NAMES): + color = theme.ansi_colors[color_index + int(is_bright) * len(ANSI_COLOR_NAMES)] + colors["terminal.ansi" + ("Bright" if is_bright else "") + color_name] = color.css_hex + + json.dump(colors, output, ensure_ascii=False, indent=2) + output.write("\n") + + +class ThemeGeneratorIterm(ThemeGenerator): + + def file_name(self) -> str: + return "iterm.itermcolors" + + def generate(self, theme: Theme, output: TextIO) -> None: + output.write('\n') + output.write( + '\n' + ) + output.write('\n') + output.write("\n") + + def write_color(key_name, color): + r, g, b = (float(component) / 0xff for component in color) + output.write(" {} Color\n".format(key_name)) + output.write(" \n") + output.write(" Color Space\n") + output.write(" sRGB\n") + output.write(" Red Component\n") + output.write(" {}\n".format(r)) + output.write(" Green Component\n") + output.write(" {}\n".format(g)) + output.write(" Blue Component\n") + output.write(" {}\n".format(b)) + output.write(" \n") + + write_color("Background", theme.bg) + write_color("Foreground", theme.fg) + write_color("Bold", theme.fg) + write_color("Cursor", theme.cursor_bg) + write_color("Cursor Text", theme.cursor_fg) + write_color("Selection Color", theme.selection_bg) + write_color("Selected Text Color", theme.selection_fg) + for index, color in enumerate(theme.ansi_colors[:16]): + write_color("Ansi " + str(index), color) + write_color("Link", theme.link_color) + + output.write("\n") + output.write("\n") + + +class ThemeGeneratorCssVariables(ThemeGenerator): + + def file_name(self) -> str: + return "variables.css" + + def generate(self, theme: Theme, output: TextIO) -> None: + output.write(":root {\n") + for var_name, color in theme.css_variables.items(): + output.write(" --dotfiles-colorscheme-{}: {};\n".format(var_name, color.css_hex)) + output.write("}\n") + + +class ThemeGeneratorScss(ThemeGenerator): + + def file_name(self) -> str: + return "_colorscheme.scss" + + def generate(self, theme: Theme, output: TextIO) -> None: + output.write("$is-dark: {};\n".format("true" if theme.is_dark else "false")) + for var_name, color in theme.css_variables.items(): + output.write("${}: {};\n".format(var_name, color.css_hex)) + output.write("$base: ({});\n".format(", ".join(c.css_hex for c in theme.base16_colors))) + output.write("$ansi: ({});\n".format(", ".join(c.css_hex for c in theme.ansi_colors))) + + +class ThemeGeneratorPrismJs(ThemeGenerator): + + def file_name(self) -> str: + return "prismjs-theme.css" + + def generate(self, theme: Theme, output: TextIO) -> None: + with open(os.path.join(__dir__, "prismjs-theme-src.css")) as src_file: + src_css = src_file.read() + for var_name, color in theme.css_variables.items(): + src_css = src_css.replace("var(--dotfiles-colorscheme-{})".format(var_name), color.css_hex) + output.write(src_css) + + +def main() -> None: + theme: Theme = MyTheme() + generators: List[ThemeGenerator] = [ + ThemeGeneratorKitty(), + ThemeGeneratorTermux(), + ThemeGeneratorZsh(), + ThemeGeneratorVim(), + ThemeGeneratorSetvtrgb(), + ThemeGeneratorXfceTerminal(), + ThemeGeneratorVscode(), + ThemeGeneratorIterm(), + ThemeGeneratorCssVariables(), + ThemeGeneratorScss(), + ThemeGeneratorPrismJs(), + ] + + out_dir = os.path.join(__dir__, "out") + os.makedirs(out_dir, exist_ok=True) + + for generator in generators: + with open(os.path.join(out_dir, generator.file_name()), "w") as output_file: + generator.generate(theme, output_file) + + +if __name__ == "__main__": + main() diff --git a/colorschemes/out/colorscheme.scss b/colorschemes/out/_colorscheme.scss similarity index 100% rename from colorschemes/out/colorscheme.scss rename to colorschemes/out/_colorscheme.scss diff --git a/colorschemes/out/prismjs-theme.css b/colorschemes/out/prismjs-theme.css index 010b18a..cbfd133 100644 --- a/colorschemes/out/prismjs-theme.css +++ b/colorschemes/out/prismjs-theme.css @@ -119,4 +119,3 @@ .token.rule { color: #cc99cc; } - diff --git a/colorschemes/prismjs-theme.css.py b/colorschemes/prismjs-theme.css.py deleted file mode 100755 index 924f81d..0000000 --- a/colorschemes/prismjs-theme.css.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 - -import _theme as theme -import os - -with open(os.path.join(os.path.dirname(__file__), "prismjs-theme-src.css")) as f: - css_src = f.read() - -for var_name, color in theme.css_variables.items(): - css_src = css_src.replace("var(--{}{})".format(theme.css_variables_prefix, var_name), color) - -print(css_src) diff --git a/colorschemes/setvtrgb.txt.py b/colorschemes/setvtrgb.txt.py deleted file mode 100755 index 9dfb27f..0000000 --- a/colorschemes/setvtrgb.txt.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env python3 - -import _theme as theme - -# default setvtrgb config: -# 0,170,0,170,0,170,0,170,85,255,85,255,85,255,85,255 -# 0,0,170,85,0,0,170,170,85,85,255,255,85,85,255,255 -# 0,0,0,0,170,170,170,170,85,85,85,85,255,255,255,255 - -for i in range(3): - print(",".join([str(int(color[2 * i + 1:2 * i + 3], 16)) for color in theme.ansi_colors[:16]])) diff --git a/colorschemes/termux.properties.py b/colorschemes/termux.properties.py deleted file mode 100755 index e6843ff..0000000 --- a/colorschemes/termux.properties.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 - -import _theme as theme - - -def print_color(key_name, color): - print("{}={}".format(key_name, color)) - - -print_color("background", theme.bg) -print_color("foreground", theme.fg) -print_color("cursor", theme.cursor_bg) -for index, color in enumerate(theme.ansi_colors[:16]): - print_color("color" + str(index), color) diff --git a/colorschemes/variables.css.py b/colorschemes/variables.css.py deleted file mode 100755 index 2338a6f..0000000 --- a/colorschemes/variables.css.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python3 - -import _theme as theme - - -print(":root {") -for var_name, color in theme.css_variables.items(): - print(" --{}{}: {};".format(theme.css_variables_prefix, var_name, color)) -print("}") diff --git a/colorschemes/vim.vim.py b/colorschemes/vim.vim.py deleted file mode 100755 index 38dfed0..0000000 --- a/colorschemes/vim.vim.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 - -import _theme as theme - - -print("let dotfiles_colorscheme_name = '{}'".format(theme.name)) -print("let dotfiles_colorscheme_base16_name = '{}'".format(theme.base16_name)) -print("let dotfiles_colorscheme_base16_colors = [") -gui_to_cterm_mapping = [0, 18, 19, 8, 20, 7, 21, 15, 1, 16, 3, 2, 6, 4, 5, 17] -for colors_pair in zip(theme.base16_colors[:16], gui_to_cterm_mapping): - print("\\ {{'gui': '{}', 'cterm': '{:>02}'}},".format(*colors_pair)) -print("\\ ]") - - -def print_terminal_color(key_name, color): - print("let terminal_color_{} = '{}'".format(key_name, color)) - - -print_terminal_color("background", theme.bg) -print_terminal_color("foreground", theme.fg) -for index, color in enumerate(theme.ansi_colors[:16]): - print_terminal_color(str(index), color) diff --git a/colorschemes/vscode-colorCustomizations.json.py b/colorschemes/vscode-colorCustomizations.json.py deleted file mode 100755 index ed1b1dc..0000000 --- a/colorschemes/vscode-colorCustomizations.json.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python3 - -import _theme as theme -import json - - -ANSI_COLOR_NAMES = [ - "Black", - "Red", - "Green", - "Yellow", - "Blue", - "Magenta", - "Cyan", - "White", -] - -colors = { - "terminal.background": theme.bg, - "terminal.foreground": theme.fg, - "terminal.selectionBackground": theme.selection_bg, - "terminalCursor.background": theme.cursor_fg, - "terminalCursor.foreground": theme.cursor_bg, -} - -for color_brightness in [False, True]: - for color_index, color_name in enumerate(ANSI_COLOR_NAMES): - color = theme.ansi_colors[color_index + int(color_brightness) * len(ANSI_COLOR_NAMES)] - colors["terminal.ansi" + ("Bright" if color_brightness else "") + color_name] = color - -print(json.dumps(colors, ensure_ascii=False, indent=2)) diff --git a/colorschemes/xfce4-terminal.theme.py b/colorschemes/xfce4-terminal.theme.py deleted file mode 100755 index 3b5f71e..0000000 --- a/colorschemes/xfce4-terminal.theme.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python3 - -import _theme as theme - - -print("[Scheme]") -print("Name=dmitmel's dotfiles colorscheme") -print("ColorForeground={}".format(theme.fg)) -print("ColorBackground={}".format(theme.bg)) -print("ColorCursorUseDefault=FALSE") -print("ColorCursorForeground={}".format(theme.cursor_fg)) -print("ColorCursor={}".format(theme.cursor_bg)) -print("ColorSelectionUseDefault=FALSE") -print("ColorSelection={}".format(theme.selection_fg)) -print("ColorSelectionBackground={}".format(theme.selection_bg)) -print("TabActivityColor={}".format(theme.ansi_colors[1])) -print("ColorBoldUseDefault=TRUE") -print("ColorPalette={}".format(";".join(theme.ansi_colors))) diff --git a/colorschemes/zsh.zsh.py b/colorschemes/zsh.zsh.py deleted file mode 100755 index 5a32295..0000000 --- a/colorschemes/zsh.zsh.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env python3 - -import _theme as theme - -for attr in [ - "bg", - "fg", - "cursor_bg", - "cursor_fg", - "selection_bg", - "selection_fg", - "link_color", -]: - color = getattr(theme, attr) - print("colorscheme_{}={}".format(attr, color[1:])) -print("colorscheme_ansi_colors=(") -for color in theme.ansi_colors: - print(" {}".format(color[1:])) -print(")") diff --git a/script-resources/markdown2htmldoc/themes-src/my.scss b/script-resources/markdown2htmldoc/themes-src/my.scss index 96fb6b6..4657f56 100644 --- a/script-resources/markdown2htmldoc/themes-src/my.scss +++ b/script-resources/markdown2htmldoc/themes-src/my.scss @@ -21,7 +21,7 @@ // @use '../node_modules/normalize.css/normalize.css'; -@use '../../../colorschemes/out/colorscheme.scss'; +@use '../../../colorschemes/out/_colorscheme.scss'; //////////////////////////////////////////////////////////////////////////////// // CONFIGURATION CONSTANTS AND FUNCTIONS From 1bb6dac6b3aa08c0e55b399e6c5452e29148a421 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 30 May 2021 18:06:37 +0300 Subject: [PATCH 631/713] [scripts/markdown2htmldoc] fix image transparency in my theme --- colorschemes/out/prismjs-theme.css | 4 +++- colorschemes/prismjs-theme-src.css | 4 +++- script-resources/markdown2htmldoc/themes-out/my.css | 2 +- script-resources/markdown2htmldoc/themes-src/my.scss | 7 ++++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/colorschemes/out/prismjs-theme.css b/colorschemes/out/prismjs-theme.css index cbfd133..fd4b76e 100644 --- a/colorschemes/out/prismjs-theme.css +++ b/colorschemes/out/prismjs-theme.css @@ -74,7 +74,9 @@ .token.unit, .token.attr-name, .token.color.hexcode, -.token.list { +.token.list, +.token.nil, +.token.nil.keyword { color: #f99157; } diff --git a/colorschemes/prismjs-theme-src.css b/colorschemes/prismjs-theme-src.css index 50733e4..7bdfd8b 100644 --- a/colorschemes/prismjs-theme-src.css +++ b/colorschemes/prismjs-theme-src.css @@ -74,7 +74,9 @@ .token.unit, .token.attr-name, .token.color.hexcode, -.token.list { +.token.list, +.token.nil, +.token.nil.keyword { color: var(--dotfiles-colorscheme-base-09); } diff --git a/script-resources/markdown2htmldoc/themes-out/my.css b/script-resources/markdown2htmldoc/themes-out/my.css index c6918ce..3074f23 100644 --- a/script-resources/markdown2htmldoc/themes-out/my.css +++ b/script-resources/markdown2htmldoc/themes-out/my.css @@ -1 +1 @@ -/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}*{box-sizing:border-box}body{color:#d3d0c8;background-color:#2d2d2d;font-family:"Ubuntu",sans-serif;font-size:16px;line-height:1.5;word-wrap:break-word;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body::-moz-selection,body::selection,body ::-moz-selection,body ::selection{color:#d3d0c8;background-color:#515151}article{min-width:200px;max-width:960px;margin:0 auto;padding:32px}@media(max-width: 767px){article{padding:24px}}article::after,article::before{display:table;content:""}article::after{clear:both}article>:first-child{margin-top:0 !important}article>:last-child{margin-bottom:0 !important}.octicon{display:inline-block;overflow:visible !important;vertical-align:text-bottom;fill:currentColor}a{color:#69c;text-decoration:none}a:hover,a:focus,a:active{text-decoration:underline}a:not([href]){color:unset;text-decoration:none}hr{margin-top:1.5em;margin-bottom:1.5em;border:.2em solid #515151}hr::after,hr::before{display:table;content:""}hr::after{clear:both}dl,details,table,blockquote,ul,ol,pre,p{margin-top:1em;margin-bottom:1em}blockquote{margin-left:0;margin-right:0;padding-left:1em;border-left:.25em solid #515151}blockquote>:first-child{margin-top:0 !important}blockquote>:last-child{margin-bottom:0 !important}summary{cursor:pointer}img{max-width:100%;box-sizing:content-box;background-color:#393939}img[align=left],img[align=right]{margin:.5em 1.25em}img[align=left]{margin-left:0}img[align=right]{margin-right:0}ins,del{text-decoration:none}ins{color:#9c9}del{color:#f2777a}mark{background-color:#fc6;color:#2d2d2d}h1,h2,h3,h4,h5,h6{margin-top:1.5em;margin-bottom:1em;padding-bottom:.3em;border-bottom:1px solid #515151;font-weight:600;line-height:1.25}h1 .anchor,h2 .anchor,h3 .anchor,h4 .anchor,h5 .anchor,h6 .anchor{float:left;padding-right:4px;margin-left:-20px;color:unset}h1 .anchor:hover,h2 .anchor:hover,h3 .anchor:hover,h4 .anchor:hover,h5 .anchor:hover,h6 .anchor:hover{text-decoration:none}h1 .anchor:focus,h2 .anchor:focus,h3 .anchor:focus,h4 .anchor:focus,h5 .anchor:focus,h6 .anchor:focus{outline:none}h1 .anchor>*,h2 .anchor>*,h3 .anchor>*,h4 .anchor>*,h5 .anchor>*,h6 .anchor>*{visibility:hidden;vertical-align:middle}h1:hover .anchor>*,h2:hover .anchor>*,h3:hover .anchor>*,h4:hover .anchor>*,h5:hover .anchor>*,h6:hover .anchor>*{visibility:visible}h1{font-size:2em}h2{font-size:1.5em}h3{font-size:1.25em}h4{font-size:1em}h5{font-size:.875em}h6{font-size:.85em}code,kbd,samp,pre{font-family:"Ubuntu Mono",monospace}code{padding:.2em .3em;background-color:rgba(116,115,105,.2);border-radius:4px}pre{padding:1em;overflow:auto;color:#d3d0c8;background-color:#2d2d2d;border:1px solid #515151;border-radius:4px;line-height:1.3;word-wrap:normal}pre code{padding:unset;background-color:unset;border:unset}kbd{display:inline-block;padding:.2em .3em;vertical-align:bottom;font:0.75em/0.8333333333 Ubuntu Mono, monospace;color:#d3d0c8;background-color:#1a1a1a;border:.1em solid #0d0d0d;border-bottom-width:.4em;border-radius:4px}table{display:block;width:100%;overflow:auto;border-spacing:0;border-collapse:collapse;width:max-content;max-width:100%}th{font-weight:600}td,th{padding:.4em .75em;border:1px solid #515151}tr:nth-child(2n){background-color:rgba(81,81,81,.1)}ol,ul{padding-left:2em}ol ol,ol ul,ul ol,ul ul{margin-top:0;margin-bottom:0}li{margin-top:.25em;margin-bottom:.25em}dt{margin-top:1em;font-weight:600;font-style:italic}dd{margin-bottom:1em;margin-left:0;padding-left:1em}ul>li.task-list-item{list-style-type:none}ul>li.task-list-item input[type=checkbox]:first-child{margin:0 .2em .25em -1.6em;vertical-align:middle} +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}*{box-sizing:border-box}body{color:#d3d0c8;background-color:#2d2d2d;font-family:"Ubuntu",sans-serif;font-size:16px;line-height:1.5;word-wrap:break-word;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body::-moz-selection,body::selection,body ::-moz-selection,body ::selection{color:#d3d0c8;background-color:#515151}article{min-width:200px;max-width:960px;margin:0 auto;padding:32px}@media(max-width: 767px){article{padding:24px}}article::after,article::before{display:table;content:""}article::after{clear:both}article>:first-child{margin-top:0 !important}article>:last-child{margin-bottom:0 !important}.octicon{display:inline-block;overflow:visible !important;vertical-align:text-bottom;fill:currentColor}a{color:#69c;text-decoration:none}a:hover,a:focus,a:active{text-decoration:underline}a:not([href]){color:unset;text-decoration:none}hr{margin-top:1.5em;margin-bottom:1.5em;border:.2em solid #515151}hr::after,hr::before{display:table;content:""}hr::after{clear:both}dl,details,table,blockquote,ul,ol,pre,p{margin-top:1em;margin-bottom:1em}blockquote{margin-left:0;margin-right:0;padding-left:1em;border-left:.25em solid #515151}blockquote>:first-child{margin-top:0 !important}blockquote>:last-child{margin-bottom:0 !important}summary{cursor:pointer}img{max-width:100%;box-sizing:content-box;background-color:#2d2d2d}img[align=left],img[align=right]{margin:.5em 1.25em}img[align=left]{margin-left:0}img[align=right]{margin-right:0}ins,del{text-decoration:none}ins{color:#9c9}del{color:#f2777a}mark{background-color:#fc6;color:#2d2d2d}h1,h2,h3,h4,h5,h6{margin-top:1.5em;margin-bottom:1em;padding-bottom:.3em;border-bottom:1px solid #515151;font-weight:600;line-height:1.25}h1 .anchor,h2 .anchor,h3 .anchor,h4 .anchor,h5 .anchor,h6 .anchor{float:left;padding-right:4px;margin-left:-20px;color:unset}h1 .anchor:hover,h2 .anchor:hover,h3 .anchor:hover,h4 .anchor:hover,h5 .anchor:hover,h6 .anchor:hover{text-decoration:none}h1 .anchor:focus,h2 .anchor:focus,h3 .anchor:focus,h4 .anchor:focus,h5 .anchor:focus,h6 .anchor:focus{outline:none}h1 .anchor>*,h2 .anchor>*,h3 .anchor>*,h4 .anchor>*,h5 .anchor>*,h6 .anchor>*{visibility:hidden;vertical-align:middle}h1:hover .anchor>*,h2:hover .anchor>*,h3:hover .anchor>*,h4:hover .anchor>*,h5:hover .anchor>*,h6:hover .anchor>*{visibility:visible}h1{font-size:2em}h2{font-size:1.5em}h3{font-size:1.25em}h4{font-size:1em}h5{font-size:.875em}h6{font-size:.85em}code,kbd,samp,pre{font-family:"Ubuntu Mono",monospace}code{padding:.2em .3em;background-color:rgba(116,115,105,.2);border-radius:4px}pre{padding:1em;overflow:auto;color:#d3d0c8;background-color:#2d2d2d;border:1px solid #515151;border-radius:4px;line-height:1.3;word-wrap:normal}pre code{padding:unset;background-color:unset;border:unset}kbd{display:inline-block;padding:.2em .3em;vertical-align:bottom;font:0.75em/0.8333333333 Ubuntu Mono, monospace;color:#d3d0c8;background-color:#1a1a1a;border:.1em solid #0d0d0d;border-bottom-width:.4em;border-radius:4px}table{display:block;width:100%;overflow:auto;border-spacing:0;border-collapse:collapse;width:max-content;max-width:100%}table img{background-color:transparent}th{font-weight:600}td,th{padding:.4em .75em;border:1px solid #515151}tr:nth-child(2n){background-color:rgba(81,81,81,.1)}ol,ul{padding-left:2em}ol ol,ol ul,ul ol,ul ul{margin-top:0;margin-bottom:0}li{margin-top:.25em;margin-bottom:.25em}dt{margin-top:1em;font-weight:600;font-style:italic}dd{margin-bottom:1em;margin-left:0;padding-left:1em}ul>li.task-list-item{list-style-type:none}ul>li.task-list-item input[type=checkbox]:first-child{margin:0 .2em .25em -1.6em;vertical-align:middle} diff --git a/script-resources/markdown2htmldoc/themes-src/my.scss b/script-resources/markdown2htmldoc/themes-src/my.scss index 4657f56..c51c7ce 100644 --- a/script-resources/markdown2htmldoc/themes-src/my.scss +++ b/script-resources/markdown2htmldoc/themes-src/my.scss @@ -188,7 +188,7 @@ img { max-width: 100%; // Fixes manually specified widths for images. box-sizing: content-box; - background-color: colorscheme.$base-01; + background-color: colorscheme.$bg; &[align='left'], &[align='right'] { @@ -383,6 +383,11 @@ table { // rules does differently from just `width: 100%`. width: max-content; max-width: 100%; + + // + img { + background-color: transparent; + } } th { From ffcd1456abafe264006a2022b03ff7b42afe2df0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 31 May 2021 00:21:06 +0300 Subject: [PATCH 632/713] [scripts/markdown2htmldoc] mark compiled themes --- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0ac8871 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +script-resources/markdown2htmldoc/themes-out/**/* linguist-generated From 5c975cbdc06de606fb328b5429ab9d7f1dcbdb3f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 31 May 2021 15:21:51 +0300 Subject: [PATCH 633/713] [nvim] add a language server for Vimscript --- nvim/coc-languages/c.vim | 4 +-- nvim/coc-languages/vim.vim | 52 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 nvim/coc-languages/vim.vim diff --git a/nvim/coc-languages/c.vim b/nvim/coc-languages/c.vim index dab445e..6b3e983 100644 --- a/nvim/coc-languages/c.vim +++ b/nvim/coc-languages/c.vim @@ -6,9 +6,7 @@ let g:coc_user_config['languageserver.ccls'] = { \ 'command': 'ccls', \ 'rootPatterns': ['.ccls', 'compile_commands.json', '.vim/', '.git/', '.hg/'], \ 'initializationOptions': { -\ 'cache': { -\ 'directory': '/tmp/ccls', -\ }, +\ 'cache.directory': tempname(), \ }, \ } diff --git a/nvim/coc-languages/vim.vim b/nvim/coc-languages/vim.vim new file mode 100644 index 0000000..c9c0898 --- /dev/null +++ b/nvim/coc-languages/vim.vim @@ -0,0 +1,52 @@ +let s:filetypes = ['vim'] +let g:coc_filetypes += s:filetypes + +let g:coc_global_extensions += ['coc-vimlsp'] +let g:coc_user_config['vimlsp'] = { +\ 'suggest.fromRuntimepath': v:true, +\ } + +" The coc-vimlsp plugin is basically reimplemented here because it doesn't do +" much beyond just wrapping the language server and passing some init options, +" but having two processes (plugin+LSP) almost doubles the memory usage. +" +" On a second thought... Apparently that's just how this extension works... +" Either way it spawns two processes (with the controller process having +" roughly the same memory usage regardless of being in a coc extension). And +" having updates through :CocUpdate is nice, so I'm gonna use the coc-vimlsp +" plugin itself. The janky reimplementation is left in this file for better +" times and bragging purposes. +finish + +" +" workspace.isNvim: +let g:coc_user_config['languageserver.vimls'] = { +\ 'filetypes': s:filetypes, +\ 'command': 'vim-language-server', +\ 'args': ['--stdio'], +\ 'initializationOptions': { +\ 'isNeovim': has('nvim'), +\ 'iskeyword': &iskeyword, +\ 'vimruntime': $VIMRUNTIME, +\ 'runtimepath': &runtimepath, +\ 'suggest.fromRuntimepath': v:true, +\ }, +\ } + +augroup dotfiles-coc-vimls + autocmd! + + " NOTE: Apparently delaying runtimepath initialization even until VimEnter + " is not enough, as coc-snippets adds its plugin to rtp during coc + " intialization phase which happens sometime after VimEnter[1]. Although, + " judging by the coc source code, custom language servers are initialized + " just before activation of extensions[2], and coc-snippets adds its plugin + " to rtp in the activation phase[3], so this might be reasonable for us. + " [1]: + " [2]: + " [3]: + autocmd VimEnter * let g:coc_user_config['languageserver.vimls.initializationOptions.runtimepath'] = &runtimepath + + autocmd User CocNvimInit call CocNotify('vimls', '$/change/iskeyword', &iskeyword) + autocmd OptionSet iskeyword call CocNotify('vimls', '$/change/iskeyword', v:option_new) +augroup END From f944dbe5e266649387589a3f65be6ac80c266bcf Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 31 May 2021 15:32:36 +0300 Subject: [PATCH 634/713] [nvim] increase textwidth just a little bit By default it was set to 78. --- nvim/plugin/editing.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 5a81cec..11d29c2 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -60,7 +60,7 @@ set commentstring=//%s " Wrapping {{{ - set nowrap colorcolumn=81,101,121 + set nowrap colorcolumn=81,101,121 textwidth=79 " }}} From 4694ecc6658fa25427abc2aad83d1bbf4abcae2c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 31 May 2021 16:00:43 +0300 Subject: [PATCH 635/713] [nvim] retract some hacks in response to vim-airline/vim-airline@1f94ec1556db36088897c85db62251b62b683ab3 --- nvim/autoload/airline/extensions/dotfiles_tweaks.vim | 10 +++------- nvim/plugin/interface.vim | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/nvim/autoload/airline/extensions/dotfiles_tweaks.vim b/nvim/autoload/airline/extensions/dotfiles_tweaks.vim index d1822a3..ee76228 100644 --- a/nvim/autoload/airline/extensions/dotfiles_tweaks.vim +++ b/nvim/autoload/airline/extensions/dotfiles_tweaks.vim @@ -1,11 +1,7 @@ function! airline#extensions#dotfiles_tweaks#init(ext) abort " Undo this commit a little bit: " - call airline#parts#define('maxlinenr', { - \ 'raw': trim(airline#parts#get('maxlinenr').raw), - \ }) - call airline#parts#define('colnr', { - \ 'raw': trim(airline#parts#get('colnr').raw), - \ 'accent': 'none', - \ }) + " Most of the hacks present here are not required anymore: + " + call airline#parts#define_accent('colnr', 'none') endfunction diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 975c079..082f3b4 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -92,8 +92,8 @@ endif let g:airline_symbols = { \ 'readonly': 'RO', \ 'whitespace': '', - \ 'colnr': '', - \ 'linenr': '', + \ 'colnr': ' :', + \ 'linenr': ' :', \ 'maxlinenr': ' ', \ 'branch': '', \ 'notexists': ' [?]', From 8534342632ea97770957bf86071b2d914b4b1256 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 31 May 2021 16:51:17 +0300 Subject: [PATCH 636/713] fixup! [nvim] increase textwidth just a little bit --- nvim/plugin/editing.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 11d29c2..a294e71 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -203,10 +203,12 @@ set commentstring=//%s " Formatting {{{ - " don't insert a comment after hitting 'o' or 'O' in the Normal mode + " -o: don't insert a comment after hitting 'o' or 'O' in the Normal mode + " -t: don't auto-wrap regular code while typing + " -c: don't auto-wrap comments while typing augroup vimrc-editing-formatting autocmd! - autocmd FileType * set formatoptions-=o + autocmd FileType * set formatoptions-=o | set formatoptions-=t | set formatoptions-=c augroup END " }}} From feee8016836e932dc8ea4d91883209212c159cfd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 1 Jun 2021 11:13:35 +0300 Subject: [PATCH 637/713] [nvim] disable the useless vimscript language server --- nvim/coc-languages/vim.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvim/coc-languages/vim.vim b/nvim/coc-languages/vim.vim index c9c0898..247de75 100644 --- a/nvim/coc-languages/vim.vim +++ b/nvim/coc-languages/vim.vim @@ -1,3 +1,6 @@ +" This plugin ended up being useless. +finish + let s:filetypes = ['vim'] let g:coc_filetypes += s:filetypes From 3dd5e39298a8f9cb8715007b5a42cf44247a46d3 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 1 Jun 2021 15:34:12 +0300 Subject: [PATCH 638/713] [scripts/playerctl-simple-menu] ensure process uniqueness --- python/flake8.ini | 4 + scripts/playerctl-simple-menu | 178 +++++++++++++++++++--------------- 2 files changed, 103 insertions(+), 79 deletions(-) diff --git a/python/flake8.ini b/python/flake8.ini index bbaa233..83c9332 100644 --- a/python/flake8.ini +++ b/python/flake8.ini @@ -6,10 +6,14 @@ ignore = E114 # Indent for continuation lines is smaller than expected E121 + # Hanging indent on a continuation line is unaligned + E131 # Import not at the top of the file E402 # Line too long E501 + # `except` without an exception type + E722 # Newline before a binary operator W503 # Newline after a binary operator diff --git a/scripts/playerctl-simple-menu b/scripts/playerctl-simple-menu index f351bb4..5791276 100755 --- a/scripts/playerctl-simple-menu +++ b/scripts/playerctl-simple-menu @@ -8,6 +8,7 @@ import math import gi +import sys gi.require_version("Playerctl", "2.0") @@ -167,95 +168,114 @@ def iter_actions_for_player(player): ) -root_menu = Gtk.Menu() +is_already_activated = False -player_names = Playerctl.list_players() -if len(player_names) > 0: - players = [] - for player_name in player_names: - player = Playerctl.Player.new_from_name(player_name) - players.append({ - "player": - player, - "player_name": - player_name, - "sorting_key": ( - player.props.playback_status != Playerctl.PlaybackStatus.PLAYING, - -PLAYER_NAME_PRIORITIES.get(player_name.name, 0), - player_name.instance, - ), - }) - players = sorted(players, key=lambda player_and_meta: player_and_meta["sorting_key"]) +def on_activate(application): + global is_already_activated + if is_already_activated: + # Ignore activations triggered by remote instances. See this: + # + return + is_already_activated = True - for player_and_meta in players: - player_name = player_and_meta["player_name"] - player = player_and_meta["player"] + root_menu = Gtk.Menu() - player_menu_item = Gtk.ImageMenuItem.new_with_label( - "{} [{}]".format( - player_name.instance, - PLAYER_PLAYBACK_STATUS_EMOJIS[player.props.playback_status], - ) - ) + player_names = Playerctl.list_players() - player_icon_name = PLAYER_ICON_NAME_FIXES.get(player_name.name, player_name.name) - player_icon = Gtk.Image.new_from_icon_name(player_icon_name, Gtk.IconSize.MENU) - player_menu_item.set_image(player_icon) + if len(player_names) > 0: + players = [] + for player_name in player_names: + player = Playerctl.Player.new_from_name(player_name) + players.append({ + "player": + player, + "player_name": + player_name, + "sorting_key": ( + player.props.playback_status != Playerctl.PlaybackStatus.PLAYING, + -PLAYER_NAME_PRIORITIES.get(player_name.name, 0), + player_name.instance, + ), + }) + players = sorted(players, key=lambda player_and_meta: player_and_meta["sorting_key"]) - actions_menu = Gtk.Menu() + for player_and_meta in players: + player_name = player_and_meta["player_name"] + player = player_and_meta["player"] - track_metadata = player.props.metadata - any_metadata_was_added = False - for meta_entry_text in iter_metadata_entries_for_player(player): - meta_menu_item = Gtk.MenuItem.new_with_label(meta_entry_text) - meta_menu_item.set_sensitive(False) - meta_menu_item_label = meta_menu_item.get_child() - meta_menu_item_label.set_ellipsize(Pango.EllipsizeMode.END) - meta_menu_item_label.set_max_width_chars(20) - - actions_menu.append(meta_menu_item) - any_metadata_was_added = True - - if any_metadata_was_added: - actions_menu.append(Gtk.SeparatorMenuItem.new()) - - for ( - action_name, - action_icon_name, - action_enabled, - action_fn, - *action_fn_args, - ) in iter_actions_for_player(player): - action_menu_item = Gtk.ImageMenuItem.new_with_mnemonic(action_name) - - if action_icon_name is not None: - action_icon = Gtk.Image.new_from_icon_name(action_icon_name, Gtk.IconSize.MENU) - action_menu_item.set_image(action_icon) - - action_menu_item.set_sensitive(action_enabled) - if action_fn is not None: - action_menu_item.connect( - "activate", - lambda _menu_item, action_fn, action_fn_args: action_fn(*action_fn_args), - action_fn, - action_fn_args, + player_menu_item = Gtk.ImageMenuItem.new_with_label( + "{} [{}]".format( + player_name.instance, + PLAYER_PLAYBACK_STATUS_EMOJIS[player.props.playback_status], ) + ) - actions_menu.append(action_menu_item) + player_icon_name = PLAYER_ICON_NAME_FIXES.get(player_name.name, player_name.name) + player_icon = Gtk.Image.new_from_icon_name(player_icon_name, Gtk.IconSize.MENU) + player_menu_item.set_image(player_icon) - player_menu_item.set_submenu(actions_menu) - root_menu.append(player_menu_item) -else: - menu_item = Gtk.MenuItem.new_with_label("No players were detected!") - menu_item.set_sensitive(False) - root_menu.append(menu_item) + actions_menu = Gtk.Menu() -root_menu.connect("selection-done", Gtk.main_quit) -root_menu.connect("deactivate", Gtk.main_quit) -root_menu.connect("destroy", Gtk.main_quit) + any_metadata_was_added = False + for meta_entry_text in iter_metadata_entries_for_player(player): + meta_menu_item = Gtk.MenuItem.new_with_label(meta_entry_text) + meta_menu_item.set_sensitive(False) + meta_menu_item_label = meta_menu_item.get_child() + meta_menu_item_label.set_ellipsize(Pango.EllipsizeMode.END) + meta_menu_item_label.set_max_width_chars(20) -root_menu.show_all() -root_menu.popup(None, None, None, None, 0, Gdk.CURRENT_TIME) + actions_menu.append(meta_menu_item) + any_metadata_was_added = True -Gtk.main() + if any_metadata_was_added: + actions_menu.append(Gtk.SeparatorMenuItem.new()) + + for ( + action_name, + action_icon_name, + action_enabled, + action_fn, + *action_fn_args, + ) in iter_actions_for_player(player): + action_menu_item = Gtk.ImageMenuItem.new_with_mnemonic(action_name) + + if action_icon_name is not None: + action_icon = Gtk.Image.new_from_icon_name(action_icon_name, Gtk.IconSize.MENU) + action_menu_item.set_image(action_icon) + + action_menu_item.set_sensitive(action_enabled) + if action_fn is not None: + action_menu_item.connect( + "activate", + lambda _target, action_fn, action_fn_args: action_fn(*action_fn_args), + action_fn, + action_fn_args, + ) + + actions_menu.append(action_menu_item) + + player_menu_item.set_submenu(actions_menu) + root_menu.append(player_menu_item) + else: + menu_item = Gtk.MenuItem.new_with_label("No players were detected!") + menu_item.set_sensitive(False) + root_menu.append(menu_item) + + root_menu.connect("selection-done", lambda _target: application.quit()) + root_menu.connect("deactivate", lambda _target: application.quit()) + root_menu.connect("destroy", lambda _target: application.quit()) + + root_menu.show_all() + root_menu.popup(None, None, None, None, 0, Gdk.CURRENT_TIME) + + Gdk.notify_startup_complete() + + # `hold` needs to be done last, so that if an exception occurs during the + # initialization the application doesn't hang. + application.hold() + + +application = Gtk.Application(application_id="com.github.dmitmel.dotfiles.playerctl-simple-menu") +application.connect("activate", on_activate) +sys.exit(application.run(sys.argv)) From d5b147564de69bb334995ce03374b9b8417cd12f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 1 Jun 2021 22:33:54 +0300 Subject: [PATCH 639/713] [python] throw in some flake8 plugins and adjust all Python scripts accordingly --- colorschemes/main.py | 44 +++++++++--------- pyrightconfig.json | 4 ++ python/flake8.ini | 34 +++++++++++++- python/yapf.ini | 1 - script-resources/common_script_utils.py | 2 +- script-resources/factorio/property_tree.py | 2 +- script-resources/pycalc_startup.py | 4 +- script-resources/welcome/colors.py | 17 ++++--- script-resources/welcome/humanize.py | 12 +++-- script-resources/welcome/main.py | 1 - script-resources/welcome/system_info.py | 52 ++++++++++++---------- scripts/copy-crosscode-emoji-url | 15 +++---- scripts/crosscode-saved | 27 ++++++----- scripts/discord-snowflake | 4 +- scripts/discord-stream-desktop-audio | 13 +++--- scripts/discord-whois | 27 +++++------ scripts/factorio-dump-mod-settings | 12 ++--- scripts/leveldb-dump | 12 ++--- scripts/mark-as-recently-used | 5 +-- scripts/mediawiki-preview | 23 ++++++---- scripts/onscreen-message | 10 ++--- scripts/playerctl-simple-menu | 6 +-- scripts/query-bookmarks | 11 +++-- 23 files changed, 197 insertions(+), 141 deletions(-) diff --git a/colorschemes/main.py b/colorschemes/main.py index 11e34ee..1c236e4 100755 --- a/colorschemes/main.py +++ b/colorschemes/main.py @@ -3,8 +3,7 @@ import json import os from abc import abstractmethod -from typing import Dict, Iterable, List, Protocol, TextIO, runtime_checkable - +from typing import Dict, Iterator, List, Protocol, TextIO, runtime_checkable __dir__ = os.path.dirname(__file__) @@ -12,16 +11,20 @@ __dir__ = os.path.dirname(__file__) class Color: def __init__(self, r: int, g: int, b: int) -> None: - assert 0 <= r <= 0xff - assert 0 <= g <= 0xff - assert 0 <= b <= 0xff + if not (0 <= r <= 0xff): + raise Exception("r component out of range") + if not (0 <= g <= 0xff): + raise Exception("g component out of range") + if not (0 <= b <= 0xff): + raise Exception("b component out of range") self.r = r self.g = g self.b = b @classmethod def from_hex(cls, s: str) -> "Color": - assert len(s) == 6 + if len(s) != 6: + raise Exception("hex color string must be 6 characters long") return Color(int(s[0:2], 16), int(s[2:4], 16), int(s[4:6], 16)) @property @@ -42,7 +45,7 @@ class Color: else: raise IndexError("color component index out of range") - def __iter__(self) -> Iterable[int]: + def __iter__(self) -> Iterator[int]: yield self.r yield self.g yield self.b @@ -296,20 +299,21 @@ class ThemeGeneratorXfceTerminal(ThemeGenerator): class ThemeGeneratorVscode(ThemeGenerator): + ANSI_COLOR_NAMES = [ + "Black", + "Red", + "Green", + "Yellow", + "Blue", + "Magenta", + "Cyan", + "White", + ] + def file_name(self) -> str: return "vscode-colorCustomizations.json" def generate(self, theme: Theme, output: TextIO) -> None: - ANSI_COLOR_NAMES = [ - "Black", - "Red", - "Green", - "Yellow", - "Blue", - "Magenta", - "Cyan", - "White", - ] colors: Dict[str, str] = { "terminal.background": theme.bg.css_hex, @@ -320,8 +324,8 @@ class ThemeGeneratorVscode(ThemeGenerator): } for is_bright in [False, True]: - for color_index, color_name in enumerate(ANSI_COLOR_NAMES): - color = theme.ansi_colors[color_index + int(is_bright) * len(ANSI_COLOR_NAMES)] + for color_index, color_name in enumerate(self.ANSI_COLOR_NAMES): + color = theme.ansi_colors[color_index + int(is_bright) * len(self.ANSI_COLOR_NAMES)] colors["terminal.ansi" + ("Bright" if is_bright else "") + color_name] = color.css_hex json.dump(colors, output, ensure_ascii=False, indent=2) @@ -341,7 +345,7 @@ class ThemeGeneratorIterm(ThemeGenerator): output.write('\n') output.write("\n") - def write_color(key_name, color): + def write_color(key_name: str, color: Color) -> None: r, g, b = (float(component) / 0xff for component in color) output.write(" {} Color\n".format(key_name)) output.write(" \n") diff --git a/pyrightconfig.json b/pyrightconfig.json index 741e0a1..4867c0b 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -3,6 +3,10 @@ { "root": "scripts", "extraPaths": ["script-resources"] + }, + { + "root": "script-resources/welcome", + "extraPaths": ["script-resources/welcome"] } ] } diff --git a/python/flake8.ini b/python/flake8.ini index 83c9332..041fdb7 100644 --- a/python/flake8.ini +++ b/python/flake8.ini @@ -1,4 +1,27 @@ [flake8] + +select = + # + E W + # + F + # + Q0 + # + ANN + # + N8 + # + I0 + # + C8 + # + S + + # Also see this: + # + # + ignore = # Indent is not a multiple of 4 E111 @@ -13,8 +36,17 @@ ignore = # Line too long E501 # `except` without an exception type - E722 + # NOTE: write `except Exception` (or `except BaseException` if absolutely + # necessary) instead + # E722 # Newline before a binary operator W503 # Newline after a binary operator W504 + + # Missing type annotations for `self` and `cls` respectively + ANN101 ANN102 + +inline-quotes = " +multiline-quotes = " +docstring-quotes = " diff --git a/python/yapf.ini b/python/yapf.ini index e4ceea7..1fdac8a 100644 --- a/python/yapf.ini +++ b/python/yapf.ini @@ -3,7 +3,6 @@ based_on_style = google column_limit = 99 indent_width = 2 continuation_indent_width = 2 -blank_lines_between_top_level_imports_and_variables = 2 dedent_closing_brackets = true coalesce_brackets = true spaces_around_power_operator = true diff --git a/script-resources/common_script_utils.py b/script-resources/common_script_utils.py index 4d13e50..4065d99 100644 --- a/script-resources/common_script_utils.py +++ b/script-resources/common_script_utils.py @@ -1,6 +1,6 @@ -import sys import os import subprocess +import sys from pathlib import Path from typing import Iterable, NoReturn diff --git a/script-resources/factorio/property_tree.py b/script-resources/factorio/property_tree.py index 24f921c..a960c49 100644 --- a/script-resources/factorio/property_tree.py +++ b/script-resources/factorio/property_tree.py @@ -5,7 +5,7 @@ # import struct -from typing import Any, IO +from typing import IO, Any def read_bool(buf: IO[bytes]) -> bool: diff --git a/script-resources/pycalc_startup.py b/script-resources/pycalc_startup.py index 1ffb1b2..269a1af 100644 --- a/script-resources/pycalc_startup.py +++ b/script-resources/pycalc_startup.py @@ -2,7 +2,7 @@ from math import * from fractions import Fraction -def factors(n): +def factors(n: int) -> "set[int]": result = set() for i in range(1, int(sqrt(n)) + 1): if n % i == 0: @@ -11,7 +11,7 @@ def factors(n): return result -def solve_quadratic(a, b, c): +def solve_quadratic(a: int, b: int, c: int) -> None: if a == 0: raise Exception("not a quadratic equation") else: diff --git a/script-resources/welcome/colors.py b/script-resources/welcome/colors.py index a835612..7d4cb76 100644 --- a/script-resources/welcome/colors.py +++ b/script-resources/welcome/colors.py @@ -1,22 +1,25 @@ +from typing import List + from colorama import Fore, Style, ansi - -COLORS = [ansi.code_to_chars(30 + color_index) for color_index in range(0, 8)] +COLORS: List[str] = [ansi.code_to_chars(30 + color_index) for color_index in range(0, 8)] -def colored(string, *colors): +def colored(string: str, *colors: str) -> str: return "".join(colors + (string, Style.RESET_ALL)) -def bright_colored(string, *colors): +def bright_colored(string: str, *colors: str) -> str: return "".join(colors + (Style.BRIGHT, string, Style.RESET_ALL)) -def colorize_percent(percent, warning, critical, inverse=False): - COLORS = [Fore.GREEN, Fore.YELLOW, Fore.RED] +def colorize_percent( + percent: float, warning: float, critical: float, inverse: bool = False +) -> str: + colors = [Fore.GREEN, Fore.YELLOW, Fore.RED] color_index = 0 if percent < warning else 1 if percent < critical else 2 if inverse: color_index = 2 - color_index - return colored("%.2f%%" % percent, COLORS[color_index]) + return colored("%.2f%%" % percent, colors[color_index]) diff --git a/script-resources/welcome/humanize.py b/script-resources/welcome/humanize.py index 9631a9c..901de70 100644 --- a/script-resources/welcome/humanize.py +++ b/script-resources/welcome/humanize.py @@ -1,11 +1,15 @@ -def humanize_timedelta(timedelta): - result = [] +from datetime import timedelta +from typing import List, Tuple + + +def humanize_timedelta(timedelta: timedelta) -> str: + result: List[str] = [] days = timedelta.days mm, ss = divmod(timedelta.seconds, 60) hh, mm = divmod(mm, 60) - def plural(n): + def plural(n: int) -> Tuple[int, str]: return n, "s" if abs(n) != 1 else "" if days > 0: @@ -20,7 +24,7 @@ def humanize_timedelta(timedelta): return ", ".join(result) -def humanize_bytes(bytes): +def humanize_bytes(bytes: int) -> str: units = ["B", "kB", "MB", "GB"] factor = 1 diff --git a/script-resources/welcome/main.py b/script-resources/welcome/main.py index 6eb37f7..c6473c1 100755 --- a/script-resources/welcome/main.py +++ b/script-resources/welcome/main.py @@ -5,7 +5,6 @@ import re from colors import COLORS, Style from system_info import get_system_info - print("") logo_lines, info_lines = get_system_info() diff --git a/script-resources/welcome/system_info.py b/script-resources/welcome/system_info.py index 9d72ded..24cda1b 100644 --- a/script-resources/welcome/system_info.py +++ b/script-resources/welcome/system_info.py @@ -3,17 +3,17 @@ import platform import socket from datetime import datetime, timedelta from getpass import getuser +from typing import Dict, List, Optional, Tuple, cast import psutil - from colors import Fore, Style, bright_colored, colored, colorize_percent from humanize import humanize_bytes, humanize_timedelta -def get_system_info(): - info_lines = [] +def get_system_info() -> Tuple[List[str], List[str]]: + info_lines: List[str] = [] - def info(name, value, *format_args): + def info(name: str, value: str, *format_args) -> None: line = bright_colored(name + ":", Fore.YELLOW) + " " + value if format_args: line = line % format_args @@ -66,27 +66,27 @@ def get_system_info(): return logo_lines, info_lines -def _get_hostname(): +def _get_hostname() -> str: hostname = socket.gethostname() return hostname -def _get_uptime(): +def _get_uptime() -> timedelta: return datetime.now() - datetime.fromtimestamp(psutil.boot_time()) -def _get_users(): - users = {} +def _get_users() -> str: + users: Dict[str, List[str]] = {} for user in psutil.users(): - name = user.name - terminal = user.terminal + name: str = user.name + terminal: str = user.terminal if name in users: users[name].append(terminal) else: users[name] = [terminal] - result = [] + result: List[str] = [] for name in users: terminals = users[name] @@ -102,13 +102,13 @@ def _get_users(): return ", ".join(result) -def _get_shell(): +def _get_shell() -> Optional[str]: return os.environ.get("SHELL") -def _get_cpu_usage(): +def _get_cpu_usage() -> Optional[str]: try: - percent = psutil.cpu_percent() + percent = cast(float, psutil.cpu_percent()) except Exception as e: print("Error in _get_cpu_usage:", e) return None @@ -116,7 +116,7 @@ def _get_cpu_usage(): return colorize_percent(percent, warning=60, critical=80) -def _get_memory(): +def _get_memory() -> Tuple[str, str, str]: memory = psutil.virtual_memory() return ( humanize_bytes(memory.used), @@ -125,8 +125,8 @@ def _get_memory(): ) -def _get_disks(): - result = [] +def _get_disks() -> List[Tuple[str, str, str, str]]: + result: List[Tuple[str, str, str, str]] = [] for disk in psutil.disk_partitions(all=False): if psutil.WINDOWS and ("cdrom" in disk.opts or disk.fstype == ""): @@ -146,7 +146,7 @@ def _get_disks(): return result -def _get_battery(): +def _get_battery() -> Optional[Tuple[str, str]]: if not hasattr(psutil, "sensors_battery"): return None @@ -167,8 +167,8 @@ def _get_battery(): return colorize_percent(percent, critical=10, warning=20, inverse=True), status -def _get_local_ipv4_addresses(): - result = [] +def _get_local_ipv4_addresses() -> List[Tuple[str, str]]: + result: List[Tuple[str, str]] = [] for interface, addresses in psutil.net_if_addrs().items(): for address in addresses: @@ -184,7 +184,7 @@ def _get_local_ipv4_addresses(): return result -def _get_distro_info(): +def _get_distro_info() -> Tuple[str, str, str, str]: if psutil.WINDOWS: return "windows", platform.system(), platform.release(), "" elif psutil.OSX: @@ -194,9 +194,13 @@ def _get_distro_info(): sw_vers = plistlib.load(f) return "mac", sw_vers["ProductName"], sw_vers["ProductVersion"], "" elif _is_android(): - from subprocess import check_output + import subprocess - android_version = check_output(["getprop", "ro.build.version.release"]) + android_version = subprocess.run( + ["getprop", "ro.build.version.release"], + check=True, + stdout=subprocess.PIPE, + ).stdout return "android", "Android", android_version.decode().strip(), "" elif psutil.LINUX: import distro @@ -206,5 +210,5 @@ def _get_distro_info(): raise NotImplementedError("unsupported OS") -def _is_android(): +def _is_android() -> bool: return os.path.isdir("/system/app") and os.path.isdir("/system/priv-app") diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index 45c6935..a26016c 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -1,19 +1,17 @@ #!/usr/bin/env python3 -import sys -import os -from pathlib import Path -from configparser import ConfigParser import json -from typing import Any, Generator, Optional, Union +import os +import sys import urllib.parse import urllib.request - +from configparser import ConfigParser +from pathlib import Path +from typing import Any, Generator, Optional, Union sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resources")) import common_script_utils - DEFAULT_REGISTRY_DUMP_URL = "https://stronghold.crosscode.ru/~ccbot/emote-registry.json" if os.name == "posix": @@ -49,7 +47,8 @@ def emote_downloader_and_iterator() -> Generator[str, None, None]: with urllib.request.urlopen(registry_dump_url, timeout=10) as response: emote_registry_data = json.load(response) - assert emote_registry_data["version"] == 1 + if emote_registry_data["version"] != 1: + raise Exception("unsupported emote registry version") allow_nsfw = config.getboolean("default", "allow_nsfw", fallback=False) emotes = [emote for emote in emote_registry_data["list"] if emote["safe"] or allow_nsfw] diff --git a/scripts/crosscode-saved b/scripts/crosscode-saved index 8e64e33..adb4229 100755 --- a/scripts/crosscode-saved +++ b/scripts/crosscode-saved @@ -1,19 +1,19 @@ #!/usr/bin/env python3 -import base64 import argparse +import base64 +import sys from hashlib import md5 from typing import IO -from Crypto.Cipher import AES -from Crypto import Random -import sys +from Crypto import Random +from Crypto.Cipher import AES CC_ENCRYPTION_MARKER_BYTES = b"[-!_0_!-]" CC_ENCRYPTION_PASSPHRASE = b":_.NaN0" -def main(): +def main() -> None: parser = argparse.ArgumentParser() # NOTE: Empty help strings are necessary for subparsers to show up in help. subparsers = parser.add_subparsers(required=True, metavar="COMMAND") @@ -34,14 +34,15 @@ def main(): def cmd_pipe_decrypt(args: argparse.Namespace) -> None: input_file: IO[bytes] = ( - sys.stdin.buffer if args.input_file == "-" else open(args.input_file, 'rb') + sys.stdin.buffer if args.input_file == "-" else open(args.input_file, "rb") ) output_file: IO[bytes] = ( - sys.stdout.buffer if args.output_file == "-" else open(args.output_file, 'wb') + sys.stdout.buffer if args.output_file == "-" else open(args.output_file, "wb") ) encrypted = input_file.read() - assert encrypted.startswith(CC_ENCRYPTION_MARKER_BYTES) + if not encrypted.startswith(CC_ENCRYPTION_MARKER_BYTES): + raise Exception() encrypted = encrypted[len(CC_ENCRYPTION_MARKER_BYTES):] decrypted = CryptoJsBridge.decrypt(encrypted, CC_ENCRYPTION_PASSPHRASE) output_file.write(decrypted) @@ -49,10 +50,10 @@ def cmd_pipe_decrypt(args: argparse.Namespace) -> None: def cmd_pipe_encrypt(args: argparse.Namespace) -> None: input_file: IO[bytes] = ( - sys.stdin.buffer if args.input_file == "-" else open(args.input_file, 'rb') + sys.stdin.buffer if args.input_file == "-" else open(args.input_file, "rb") ) output_file: IO[bytes] = ( - sys.stdout.buffer if args.output_file == "-" else open(args.output_file, 'wb') + sys.stdout.buffer if args.output_file == "-" else open(args.output_file, "wb") ) decrypted = input_file.read() @@ -87,7 +88,8 @@ class CryptoJsBridge: """ Extended from . """ - assert len(salt) == cls.SALT_SIZE + if len(salt) != cls.SALT_SIZE: + raise Exception("invalid salt length") data += salt key = md5(data).digest() final_key = key @@ -114,7 +116,8 @@ class CryptoJsBridge: Equivalent to `CryptoJS.AES.decrypt(encrypted, passphrase).toString(CryptoJS.enc.Utf8)`. """ encrypted = base64.b64decode(encrypted) - assert encrypted.startswith(cls.SALTED_MARKER) + if not encrypted.startswith(cls.SALTED_MARKER): + raise Exception("expected salt marker") encrypted = encrypted[len(cls.SALTED_MARKER):] salt, ciphertext = encrypted[:cls.SALT_SIZE], encrypted[cls.SALT_SIZE:] key_iv = cls.bytes_to_key(passphrase, salt, cls.KEY_SIZE + cls.IV_SIZE) diff --git a/scripts/discord-snowflake b/scripts/discord-snowflake index 85343ba..42bb7ac 100755 --- a/scripts/discord-snowflake +++ b/scripts/discord-snowflake @@ -3,16 +3,16 @@ # https://discord.com/developers/docs/reference#snowflakes import sys -import colorama import time +import colorama DISCORD_EPOCH = 1420070400000 # milliseconds user_snowflake = int(sys.argv[1]) -def print_field(name, value): +def print_field(name: str, value: object) -> None: print( "{}{}:{} {}".format(colorama.Style.BRIGHT, name.rjust(21), colorama.Style.RESET_ALL, value) ) diff --git a/scripts/discord-stream-desktop-audio b/scripts/discord-stream-desktop-audio index da925b4..c37e1e8 100755 --- a/scripts/discord-stream-desktop-audio +++ b/scripts/discord-stream-desktop-audio @@ -1,9 +1,10 @@ #!/usr/bin/env python3 -import discord -import sys import os +import sys +from typing import Optional, cast +import discord guild_id = int(sys.argv[1]) voice_channel_id = int(sys.argv[2]) @@ -16,17 +17,17 @@ bot = discord.Client() @bot.event -async def on_ready(): +async def on_ready() -> None: print("logged in as {0} ({0.id})".format(bot.user)) - guild: discord.Guild = bot.get_guild(guild_id) + guild: Optional[discord.Guild] = bot.get_guild(guild_id) if guild is None: raise Exception("guild not found") - voice_channel: discord.VoiceChannel = guild.get_channel(voice_channel_id) + voice_channel: Optional[discord.VoiceChannel] = guild.get_channel(voice_channel_id) if voice_channel is None: raise Exception("channel not found") - voice_client = await voice_channel.connect() + voice_client = cast(discord.voice_client.VoiceClient, await voice_channel.connect()) print("connected to {0} ({0.id}) in {1} ({1.id})".format(voice_channel, guild)) source = discord.FFmpegPCMAudio(pulseaudio_device, before_options="-f pulse") diff --git a/scripts/discord-whois b/scripts/discord-whois index 41403ee..c8b3b3d 100755 --- a/scripts/discord-whois +++ b/scripts/discord-whois @@ -4,15 +4,16 @@ # # -import sys -import os -import urllib.request -import urllib.error -import colorama -import time import argparse import json +import os +import sys +import time +import urllib.error +import urllib.request +from typing import Dict, List, Optional +import colorama DISCORD_EPOCH = 1420070400000 # milliseconds # https://discord.com/developers/docs/resources/user#user-object-user-flags @@ -37,17 +38,17 @@ parser.add_argument("user_snowflake", type=int) parser.add_argument("--bot-token", type=str) parser.add_argument("--image-size", type=int) parser.add_argument("--get-prop", type=str) -parser.add_argument("--api-response", action='store_true') +parser.add_argument("--api-response", action="store_true") cli_args = parser.parse_args() -user_snowflake = cli_args.user_snowflake +user_snowflake: int = cli_args.user_snowflake -bot_token = cli_args.bot_token +bot_token: Optional[str] = cli_args.bot_token if bot_token is None: with open(os.path.expanduser("~/.config/dotfiles/discord-tools-bot-token.txt")) as f: bot_token = f.read().strip() -image_size = cli_args.image_size +image_size: Optional[int] = cli_args.image_size if not (image_size is None or (image_size > 0 and image_size & (image_size - 1)) == 0): parser.error("image_size must be greater than zero and a power of two") @@ -70,10 +71,10 @@ except urllib.error.HTTPError as err: if cli_args.api_response: json.dump(raw_data, sys.stdout, ensure_ascii=False, indent=2) - sys.stdout.write('\n') + sys.stdout.write("\n") sys.exit() -data = {} +data: Dict[str, str] = {} data["ID"] = raw_data["id"] data["Name"] = "{}#{}".format(raw_data["username"], raw_data["discriminator"]) @@ -108,7 +109,7 @@ user_flags = raw_data["public_flags"] if user_flags == 0: data["Flags"] = "" else: - user_flag_names = [] + user_flag_names: List[str] = [] for flag_name, bitmask in DISCORD_FLAGS.items(): if user_flags & bitmask: user_flag_names.append(flag_name) diff --git a/scripts/factorio-dump-mod-settings b/scripts/factorio-dump-mod-settings index 8530465..b43446f 100755 --- a/scripts/factorio-dump-mod-settings +++ b/scripts/factorio-dump-mod-settings @@ -4,12 +4,11 @@ # # -import sys -import os -from pathlib import Path -import struct import json - +import os +import struct +import sys +from pathlib import Path sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resources")) import factorio.property_tree @@ -23,7 +22,8 @@ with open(Path.home() / ".factorio" / "mods" / "mod-settings.dat", "rb") as f: version_main, version_major, version_minor, version_developer = struct.unpack(" Union[str, list[int]]: elif encoding == "base85": return base64.b85encode(b).decode("ascii") else: - assert False + raise Exception("unreachable") key_encoding: str = cli_args.key_encoding or cli_args.encoding diff --git a/scripts/mark-as-recently-used b/scripts/mark-as-recently-used index c35e763..f151604 100755 --- a/scripts/mark-as-recently-used +++ b/scripts/mark-as-recently-used @@ -1,13 +1,12 @@ #!/usr/bin/env python3 # Taken from -import gi import sys +import gi gi.require_version("Gtk", "3.0") -from gi.repository import Gtk, Gio, GLib - +from gi.repository import Gio, GLib, Gtk rec_mgr = Gtk.RecentManager.get_default() for arg in sys.argv[1:]: diff --git a/scripts/mediawiki-preview b/scripts/mediawiki-preview index b2d978b..ed8e05a 100755 --- a/scripts/mediawiki-preview +++ b/scripts/mediawiki-preview @@ -39,12 +39,13 @@ # created by this script. import argparse -import mwclient -import json -from urllib.parse import urlencode import html +import json import re +from typing import Dict, List, cast +from urllib.parse import urlencode +import mwclient LANG = "en" LANG_TEXT_DIRECTION = "ltr" @@ -116,7 +117,7 @@ MODULES_PRELOAD_SCRIPTS = { # ported from -def escape_css_class(class_str): +def escape_css_class(class_str: str) -> str: class_str = re.sub( r"""(^[0-9\-])|[\x00-\x20!"#$%&'()*+,.\/:;<=>?@[\]^`{|}~]|\xA0""", "_", @@ -127,8 +128,8 @@ def escape_css_class(class_str): return class_str -def json_dumps_compact(data): - return json.dumps(data, indent=None, separators=(",", ":")) +def json_dumps_compact(data: object) -> str: + return json.dumps(data, indent=None, separators=(",", ":"), ensure_ascii=False) parser = argparse.ArgumentParser() @@ -147,7 +148,7 @@ cli_args = parser.parse_args() site = mwclient.Site(cli_args.site, scheme=cli_args.scheme) -def get_load_script_url(**args): +def get_load_script_url(**args: object) -> str: return "{path}load{ext}?{args}".format( path=site.path, ext=site.ext, @@ -177,7 +178,11 @@ result = site.post( )["parse"] -def get_modules(page_modules, added_modules_dict, blocked_modules_dict={}): +def get_modules( + page_modules: List[str], + added_modules_dict: Dict[str, List[str]], + blocked_modules_dict: Dict[str, List[str]] = {} +) -> List[str]: modules = page_modules + added_modules_dict[cli_args.skin] for blocked_module in blocked_modules_dict.get(cli_args.skin, []): try: @@ -272,7 +277,7 @@ rendered_html = """\ ), skin=html.escape(cli_args.skin), page_class=html.escape(escape_css_class(result["displaytitle"])), - title=html.escape(result["displaytitle"]), + title=html.escape(cast(str, result["displaytitle"])), indicators_html="\n".join([ '
{}
'.format( indicator["name"], indicator["*"] diff --git a/scripts/onscreen-message b/scripts/onscreen-message index 32c3b5a..d9d86e7 100755 --- a/scripts/onscreen-message +++ b/scripts/onscreen-message @@ -1,11 +1,11 @@ #!/usr/bin/env python3 -import gi import argparse +import gi gi.require_version("Gtk", "3.0") -from gi.repository import Gtk, Gdk, Pango - +gi.require_version("Gdk", "3.0") +from gi.repository import Gdk, Gtk, Pango parser = argparse.ArgumentParser() parser.add_argument("message", type=str, nargs="+") @@ -24,13 +24,13 @@ scrolled_window.add(label) window.add(scrolled_window) -def on_key_release(target, event): +def on_key_release(_target, event) -> None: key = event.keyval if key in [Gdk.KEY_Escape, Gdk.KEY_q, Gdk.KEY_Q]: window.close() -def on_configure(target, event): +def on_configure(target, event) -> None: if target != window or event.type != Gdk.EventType.CONFIGURE: return font_desc = Pango.FontDescription() diff --git a/scripts/playerctl-simple-menu b/scripts/playerctl-simple-menu index 5791276..17d6dd3 100755 --- a/scripts/playerctl-simple-menu +++ b/scripts/playerctl-simple-menu @@ -7,15 +7,15 @@ # TODO: Update the menu on player status changes. import math -import gi import sys +import gi gi.require_version("Playerctl", "2.0") gi.require_version("Gtk", "3.0") gi.require_version("Gdk", "3.0") gi.require_version("Pango", "1.0") -from gi.repository import Playerctl, Gtk, Gdk, GLib, Pango +from gi.repository import Gdk, GLib, Gtk, Pango, Playerctl # Larger priority values will make the player with this name appear higher in # the menu. The default priority is 0. @@ -39,7 +39,7 @@ PLAYER_PLAYBACK_STATUS_EMOJIS = { } -def humanize_duration(duration): +def humanize_duration(duration: float) -> str: minutes, seconds = divmod(math.floor(duration), 60) hours, minutes = divmod(minutes, 60) text = "{:02}:{:02}".format(minutes, seconds) diff --git a/scripts/query-bookmarks b/scripts/query-bookmarks index fa3867f..9281561 100755 --- a/scripts/query-bookmarks +++ b/scripts/query-bookmarks @@ -7,15 +7,14 @@ # # -import sys import os -from pathlib import Path -from configparser import ConfigParser -import tempfile import shutil import sqlite3 -from typing import Optional, Tuple, Generator - +import sys +import tempfile +from configparser import ConfigParser +from pathlib import Path +from typing import Generator, Optional, Tuple sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resources")) import common_script_utils From ebafd4010bbc2af3a6fd44018d5647e6dddcbf74 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 2 Jun 2021 12:32:43 +0300 Subject: [PATCH 640/713] [scripts/markdown2htmldoc] fix a little selector issue in my theme --- script-resources/markdown2htmldoc/themes-src/my.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script-resources/markdown2htmldoc/themes-src/my.scss b/script-resources/markdown2htmldoc/themes-src/my.scss index c51c7ce..8fcee58 100644 --- a/script-resources/markdown2htmldoc/themes-src/my.scss +++ b/script-resources/markdown2htmldoc/themes-src/my.scss @@ -448,7 +448,7 @@ dd { // ul > li.task-list-item { list-style-type: none; - input[type='checkbox']:first-child { + > input[type='checkbox']:first-child { margin: 0 0.2em 0.25em -1.6em; vertical-align: middle; } From 81e6fa8a4fe4d59107e202f085e192286fdf9227 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 2 Jun 2021 15:09:22 +0300 Subject: [PATCH 641/713] [firefox] increase the size of site buttons on the newtab screen --- web/firefox/userContent.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web/firefox/userContent.css b/web/firefox/userContent.css index 932f3e5..bd75684 100644 --- a/web/firefox/userContent.css +++ b/web/firefox/userContent.css @@ -12,3 +12,12 @@ } */ } + +@-moz-document url(about:home), url(about:newtab) { + /* */ + /* */ + .top-site-outer .tile .icon-wrapper { + width: 100% !important; + height: 100% !important; + } +} From 1a91687dd17f7f8b1f0667779de278ee6a17b0b4 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 3 Jun 2021 13:17:20 +0300 Subject: [PATCH 642/713] [scripts/markdown2htmldoc] always show header anchors on touchscreens --- script-resources/markdown2htmldoc/themes-out/my.css | 2 +- script-resources/markdown2htmldoc/themes-src/my.scss | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/script-resources/markdown2htmldoc/themes-out/my.css b/script-resources/markdown2htmldoc/themes-out/my.css index 3074f23..9b4f943 100644 --- a/script-resources/markdown2htmldoc/themes-out/my.css +++ b/script-resources/markdown2htmldoc/themes-out/my.css @@ -1 +1 @@ -/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}*{box-sizing:border-box}body{color:#d3d0c8;background-color:#2d2d2d;font-family:"Ubuntu",sans-serif;font-size:16px;line-height:1.5;word-wrap:break-word;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body::-moz-selection,body::selection,body ::-moz-selection,body ::selection{color:#d3d0c8;background-color:#515151}article{min-width:200px;max-width:960px;margin:0 auto;padding:32px}@media(max-width: 767px){article{padding:24px}}article::after,article::before{display:table;content:""}article::after{clear:both}article>:first-child{margin-top:0 !important}article>:last-child{margin-bottom:0 !important}.octicon{display:inline-block;overflow:visible !important;vertical-align:text-bottom;fill:currentColor}a{color:#69c;text-decoration:none}a:hover,a:focus,a:active{text-decoration:underline}a:not([href]){color:unset;text-decoration:none}hr{margin-top:1.5em;margin-bottom:1.5em;border:.2em solid #515151}hr::after,hr::before{display:table;content:""}hr::after{clear:both}dl,details,table,blockquote,ul,ol,pre,p{margin-top:1em;margin-bottom:1em}blockquote{margin-left:0;margin-right:0;padding-left:1em;border-left:.25em solid #515151}blockquote>:first-child{margin-top:0 !important}blockquote>:last-child{margin-bottom:0 !important}summary{cursor:pointer}img{max-width:100%;box-sizing:content-box;background-color:#2d2d2d}img[align=left],img[align=right]{margin:.5em 1.25em}img[align=left]{margin-left:0}img[align=right]{margin-right:0}ins,del{text-decoration:none}ins{color:#9c9}del{color:#f2777a}mark{background-color:#fc6;color:#2d2d2d}h1,h2,h3,h4,h5,h6{margin-top:1.5em;margin-bottom:1em;padding-bottom:.3em;border-bottom:1px solid #515151;font-weight:600;line-height:1.25}h1 .anchor,h2 .anchor,h3 .anchor,h4 .anchor,h5 .anchor,h6 .anchor{float:left;padding-right:4px;margin-left:-20px;color:unset}h1 .anchor:hover,h2 .anchor:hover,h3 .anchor:hover,h4 .anchor:hover,h5 .anchor:hover,h6 .anchor:hover{text-decoration:none}h1 .anchor:focus,h2 .anchor:focus,h3 .anchor:focus,h4 .anchor:focus,h5 .anchor:focus,h6 .anchor:focus{outline:none}h1 .anchor>*,h2 .anchor>*,h3 .anchor>*,h4 .anchor>*,h5 .anchor>*,h6 .anchor>*{visibility:hidden;vertical-align:middle}h1:hover .anchor>*,h2:hover .anchor>*,h3:hover .anchor>*,h4:hover .anchor>*,h5:hover .anchor>*,h6:hover .anchor>*{visibility:visible}h1{font-size:2em}h2{font-size:1.5em}h3{font-size:1.25em}h4{font-size:1em}h5{font-size:.875em}h6{font-size:.85em}code,kbd,samp,pre{font-family:"Ubuntu Mono",monospace}code{padding:.2em .3em;background-color:rgba(116,115,105,.2);border-radius:4px}pre{padding:1em;overflow:auto;color:#d3d0c8;background-color:#2d2d2d;border:1px solid #515151;border-radius:4px;line-height:1.3;word-wrap:normal}pre code{padding:unset;background-color:unset;border:unset}kbd{display:inline-block;padding:.2em .3em;vertical-align:bottom;font:0.75em/0.8333333333 Ubuntu Mono, monospace;color:#d3d0c8;background-color:#1a1a1a;border:.1em solid #0d0d0d;border-bottom-width:.4em;border-radius:4px}table{display:block;width:100%;overflow:auto;border-spacing:0;border-collapse:collapse;width:max-content;max-width:100%}table img{background-color:transparent}th{font-weight:600}td,th{padding:.4em .75em;border:1px solid #515151}tr:nth-child(2n){background-color:rgba(81,81,81,.1)}ol,ul{padding-left:2em}ol ol,ol ul,ul ol,ul ul{margin-top:0;margin-bottom:0}li{margin-top:.25em;margin-bottom:.25em}dt{margin-top:1em;font-weight:600;font-style:italic}dd{margin-bottom:1em;margin-left:0;padding-left:1em}ul>li.task-list-item{list-style-type:none}ul>li.task-list-item input[type=checkbox]:first-child{margin:0 .2em .25em -1.6em;vertical-align:middle} +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}*{box-sizing:border-box}body{color:#d3d0c8;background-color:#2d2d2d;font-family:"Ubuntu",sans-serif;font-size:16px;line-height:1.5;word-wrap:break-word;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body::-moz-selection,body::selection,body ::-moz-selection,body ::selection{color:#d3d0c8;background-color:#515151}article{min-width:200px;max-width:960px;margin:0 auto;padding:32px}@media(max-width: 767px){article{padding:24px}}article::after,article::before{display:table;content:""}article::after{clear:both}article>:first-child{margin-top:0 !important}article>:last-child{margin-bottom:0 !important}.octicon{display:inline-block;overflow:visible !important;vertical-align:text-bottom;fill:currentColor}a{color:#69c;text-decoration:none}a:hover,a:focus,a:active{text-decoration:underline}a:not([href]){color:unset;text-decoration:none}hr{margin-top:1.5em;margin-bottom:1.5em;border:.2em solid #515151}hr::after,hr::before{display:table;content:""}hr::after{clear:both}dl,details,table,blockquote,ul,ol,pre,p{margin-top:1em;margin-bottom:1em}blockquote{margin-left:0;margin-right:0;padding-left:1em;border-left:.25em solid #515151}blockquote>:first-child{margin-top:0 !important}blockquote>:last-child{margin-bottom:0 !important}summary{cursor:pointer}img{max-width:100%;box-sizing:content-box;background-color:#2d2d2d}img[align=left],img[align=right]{margin:.5em 1.25em}img[align=left]{margin-left:0}img[align=right]{margin-right:0}ins,del{text-decoration:none}ins{color:#9c9}del{color:#f2777a}mark{background-color:#fc6;color:#2d2d2d}h1,h2,h3,h4,h5,h6{margin-top:1.5em;margin-bottom:1em;padding-bottom:.3em;border-bottom:1px solid #515151;font-weight:600;line-height:1.25}h1 .anchor,h2 .anchor,h3 .anchor,h4 .anchor,h5 .anchor,h6 .anchor{float:left;padding-right:4px;margin-left:-20px;color:unset}h1 .anchor:hover,h2 .anchor:hover,h3 .anchor:hover,h4 .anchor:hover,h5 .anchor:hover,h6 .anchor:hover{text-decoration:none}h1 .anchor:focus,h2 .anchor:focus,h3 .anchor:focus,h4 .anchor:focus,h5 .anchor:focus,h6 .anchor:focus{outline:none}h1 .anchor>*,h2 .anchor>*,h3 .anchor>*,h4 .anchor>*,h5 .anchor>*,h6 .anchor>*{visibility:hidden;vertical-align:middle}h1:hover .anchor>*,h2:hover .anchor>*,h3:hover .anchor>*,h4:hover .anchor>*,h5:hover .anchor>*,h6:hover .anchor>*{visibility:visible}@media(hover: none){h1 .anchor>*,h2 .anchor>*,h3 .anchor>*,h4 .anchor>*,h5 .anchor>*,h6 .anchor>*{visibility:visible}}h1{font-size:2em}h2{font-size:1.5em}h3{font-size:1.25em}h4{font-size:1em}h5{font-size:.875em}h6{font-size:.85em}code,kbd,samp,pre{font-family:"Ubuntu Mono",monospace}code{padding:.2em .3em;background-color:rgba(116,115,105,.2);border-radius:4px}pre{padding:1em;overflow:auto;color:#d3d0c8;background-color:#2d2d2d;border:1px solid #515151;border-radius:4px;line-height:1.3;word-wrap:normal}pre code{padding:unset;background-color:unset;border:unset}kbd{display:inline-block;padding:.2em .3em;vertical-align:bottom;font:0.75em/0.8333333333 Ubuntu Mono, monospace;color:#d3d0c8;background-color:#1a1a1a;border:.1em solid #0d0d0d;border-bottom-width:.4em;border-radius:4px}table{display:block;width:100%;overflow:auto;border-spacing:0;border-collapse:collapse;width:max-content;max-width:100%}table img{background-color:transparent}th{font-weight:600}td,th{padding:.4em .75em;border:1px solid #515151}tr:nth-child(2n){background-color:rgba(81,81,81,.1)}ol,ul{padding-left:2em}ol ol,ol ul,ul ol,ul ul{margin-top:0;margin-bottom:0}li{margin-top:.25em;margin-bottom:.25em}dt{margin-top:1em;font-weight:600;font-style:italic}dd{margin-bottom:1em;margin-left:0;padding-left:1em}ul>li.task-list-item{list-style-type:none}ul>li.task-list-item>input[type=checkbox]:first-child{margin:0 .2em .25em -1.6em;vertical-align:middle} diff --git a/script-resources/markdown2htmldoc/themes-src/my.scss b/script-resources/markdown2htmldoc/themes-src/my.scss index 8fcee58..e69386e 100644 --- a/script-resources/markdown2htmldoc/themes-src/my.scss +++ b/script-resources/markdown2htmldoc/themes-src/my.scss @@ -265,8 +265,14 @@ h6 { } } - &:hover .anchor { - > * { + &:hover { + .anchor > * { + visibility: visible; + } + } + + @media (hover: none) { + .anchor > * { visibility: visible; } } From 39602c15f0654d745b7a4d03ab47b842543b7ad7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 3 Jun 2021 13:37:07 +0300 Subject: [PATCH 643/713] [scripts/markdown2htmldoc] add a title tag to the generated documents --- script-resources/markdown2htmldoc/main.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script-resources/markdown2htmldoc/main.js b/script-resources/markdown2htmldoc/main.js index 312896e..9a55da8 100755 --- a/script-resources/markdown2htmldoc/main.js +++ b/script-resources/markdown2htmldoc/main.js @@ -1,6 +1,7 @@ #!/usr/bin/env node const fs = require('fs'); +const pathM = require('path'); const argparse = require('argparse'); const markdownIt = require('markdown-it'); const markdownItTaskCheckbox = require('markdown-it-task-checkbox'); @@ -110,6 +111,7 @@ let renderedHtmlDocument = ` +${pathM.basename(args.INPUT_FILE || '<stdin>')} ${stylesheetsTexts.map((s) => ``).join('\n')} From fdffee61c7fba56702b3653688dc364f447a2747 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 3 Jun 2021 16:42:44 +0300 Subject: [PATCH 644/713] [nvim] automatically open folds when opening files --- nvim/plugin/editing.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index a294e71..f0af3ab 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -54,7 +54,11 @@ set commentstring=//%s " remember cursor position augroup vimrc-editing-remember-cursor-position autocmd! - autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exec "normal! g`\"" | endif + autocmd BufReadPost * + \ if line("'\"") > 1 && line("'\"") <= line("$") + \| exec "normal! g`\"" + \|endif + \|silent! .foldopen augroup END " }}} From 2bf31fc1c05402ce8ca870c6ef11ef4512d9755e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 3 Jun 2021 19:06:56 +0300 Subject: [PATCH 645/713] [zsh] don't crash when rustup isn't installed --- zsh/plugins.zsh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index b7fdafc..e28a17a 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -14,13 +14,16 @@ _plugin completions-rustc 'https://raw.githubusercontent.com/rust-lang/zsh-confi _plugin completions-cargo 'https://raw.githubusercontent.com/rust-lang/cargo/master/src/etc/_cargo' from=url \ after_load='plugin-cfg-path fpath prepend ""' -rustup_comp_path="${ZSH_CACHE_DIR}/site-functions/_rustup" -if [[ "${commands[rustup]}" -nt "$rustup_comp_path" || ! -s "$rustup_comp_path" ]]; then - _perf_timer_start "generate rustup completions" - rustup completions zsh >| "$rustup_comp_path" - _perf_timer_stop "generate rustup completions" +rustup_bin="${commands[rustup]}" +if [[ -n "$rustup_bin" ]]; then + rustup_comp_path="${ZSH_CACHE_DIR}/site-functions/_rustup" + if [[ "$rustup_bin" -nt "$rustup_comp_path" || ! -s "$rustup_comp_path" ]]; then + _perf_timer_start "generate rustup completions" + "$rustup_bin" completions zsh >| "$rustup_comp_path" + _perf_timer_stop "generate rustup completions" + fi + unset rustup_comp_path fi -unset rustup_comp_path # compinit {{{ _perf_timer_start "compinit" From 4c3f20a0ce2a14e86eef59255df5ac8268b5fbf3 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 3 Jun 2021 19:07:08 +0300 Subject: [PATCH 646/713] [zsh] use a proper theme for sharkdp/bat --- zsh/env.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zsh/env.zsh b/zsh/env.zsh index 34e23a0..895a982 100644 --- a/zsh/env.zsh +++ b/zsh/env.zsh @@ -34,3 +34,6 @@ export HOMEBREW_NO_AUTO_UPDATE=1 # https://github.com/junegunn/fzf/blob/764316a53d0eb60b315f0bbcd513de58ed57a876/src/tui/tui.go#L496-L515 export FZF_DEFAULT_OPTS="--color=16 --height=40% --reverse" + +# +export BAT_THEME="base16-256" From 20c3f3b5240ad522e5d88b3623e3ea7eae66dc24 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 3 Jun 2021 20:40:36 +0300 Subject: [PATCH 647/713] [nvim] redirect PutOutput into a preview window --- nvim/plugin/editing.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index f0af3ab..416d073 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -78,7 +78,13 @@ set commentstring=//%s nmap ] m'yygccp`'j nmap [ m'yygccP`'k - command! -nargs=+ -complete=command PutOutput execute 'put =execute(' . escape(string(), '|"') . ')' + function! PutOutput(cmd) + let output = execute(a:cmd) + execute "noswapfile pedit" "+" . fnameescape("setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile") fnameescape("preview://" . a:cmd) + wincmd P + call setline(1, split(output, "\n")) + endfunction + command! -nargs=+ -complete=command PutOutput silent call PutOutput() " ,c is easier to type than "+ because it doesn't require pressing Shift noremap c "+ From d466b3ce3017b784a93f2388c9bce5599890b191 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 4 Jun 2021 13:51:03 +0300 Subject: [PATCH 648/713] [python] enable strict typechecking --- colorschemes/main.py | 28 +++++++------------------ nvim/coc-languages/python.vim | 6 ++++-- script-resources/common_script_utils.py | 11 ++++++---- script-resources/pycalc_startup.py | 2 +- script-resources/welcome/colors.py | 2 +- script-resources/welcome/system_info.py | 2 +- 6 files changed, 21 insertions(+), 30 deletions(-) diff --git a/colorschemes/main.py b/colorschemes/main.py index 1c236e4..209a460 100755 --- a/colorschemes/main.py +++ b/colorschemes/main.py @@ -3,7 +3,7 @@ import json import os from abc import abstractmethod -from typing import Dict, Iterator, List, Protocol, TextIO, runtime_checkable +from typing import Dict, Iterator, List, Protocol, TextIO __dir__ = os.path.dirname(__file__) @@ -60,23 +60,10 @@ BASE16_TO_ANSI_MAPPING: List[int] = [ ANSI_TO_BASE16_MAPPING: List[int] = [BASE16_TO_ANSI_MAPPING.index(i) for i in range(16)] -@runtime_checkable class Theme(Protocol): - - @property - @abstractmethod - def base16_name(self) -> str: - raise NotImplementedError() - - @property - @abstractmethod - def is_dark(self) -> bool: - raise NotImplementedError() - - @property - @abstractmethod - def base16_colors(self) -> List[Color]: - raise NotImplementedError() + base16_name: str + is_dark: bool + base16_colors: List[Color] @property def name(self) -> str: @@ -152,7 +139,6 @@ class MyTheme(Theme): ] -@runtime_checkable class ThemeGenerator(Protocol): @abstractmethod @@ -248,7 +234,7 @@ class ThemeGeneratorVim(ThemeGenerator): output.write("let {}base16_colors = [\n".format(namespace)) for gui_color, cterm_color in zip(theme.base16_colors, ANSI_TO_BASE16_MAPPING): output.write( - "\\ {{'gui': '{}', 'cterm': '{:02}'}},\n".format(gui_color.css_hex, cterm_color) + "\\ {{'gui': '{}', 'cterm': '{:02}'}},\n".format(gui_color.css_hex, cterm_color), ) output.write("\\ ]\n") @@ -293,7 +279,7 @@ class ThemeGeneratorXfceTerminal(ThemeGenerator): output.write("TabActivityColor={}\n".format(theme.base16_colors[0x8].css_hex)) output.write("ColorBoldUseDefault=TRUE\n") output.write( - "ColorPalette={}\n".format(";".join(color.css_hex for color in theme.ansi_colors)) + "ColorPalette={}\n".format(";".join(color.css_hex for color in theme.ansi_colors)), ) @@ -340,7 +326,7 @@ class ThemeGeneratorIterm(ThemeGenerator): def generate(self, theme: Theme, output: TextIO) -> None: output.write('\n') output.write( - '\n' + '\n', ) output.write('\n') output.write("\n") diff --git a/nvim/coc-languages/python.vim b/nvim/coc-languages/python.vim index 49851ad..c6a7357 100644 --- a/nvim/coc-languages/python.vim +++ b/nvim/coc-languages/python.vim @@ -1,15 +1,17 @@ let g:coc_global_extensions += ['coc-pyright'] let g:coc_filetypes += ['python'] -" let g:coc_user_config['python.autocomplete.showAdvancedMembers'] = v:false let g:coc_user_config['python'] = { \ 'formatting': { \ 'provider': 'yapf', -\ 'yapfArgs': ['--style=' . simplify(g:dotfiles_dir.'/python/yapf.ini')] +\ 'yapfArgs': ['--style=' . simplify(g:dotfiles_dir.'/python/yapf.ini')], \ }, \ 'linting': { \ 'pylintEnabled': v:false, \ 'flake8Enabled': v:true, \ 'flake8Args': ['--config=' . simplify(g:dotfiles_dir.'/python/flake8.ini')], \ }, +\ 'analysis': { +\ 'typeCheckingMode': 'strict', +\ }, \ } diff --git a/script-resources/common_script_utils.py b/script-resources/common_script_utils.py index 4065d99..71bb093 100644 --- a/script-resources/common_script_utils.py +++ b/script-resources/common_script_utils.py @@ -2,7 +2,7 @@ import os import subprocess import sys from pathlib import Path -from typing import Iterable, NoReturn +from typing import Iterable, NoReturn, Optional if os.name == "posix": DOTFILES_CONFIG_DIR: Path = Path.home() / ".config" / "dotfiles" @@ -13,7 +13,7 @@ def platform_not_supported_error() -> NoReturn: raise Exception("platform '{}' is not supported!".format(sys.platform)) -def run_chooser(choices: Iterable[str], prompt: str = None, async_read: bool = False) -> int: +def run_chooser(choices: Iterable[str], prompt: Optional[str] = None, async_read: bool = False) -> int: supports_result_index = True if os.isatty(sys.stderr.fileno()): process_args = [ @@ -36,10 +36,13 @@ def run_chooser(choices: Iterable[str], prompt: str = None, async_read: bool = F platform_not_supported_error() chooser_process = subprocess.Popen(process_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + assert chooser_process.stdin is not None + assert chooser_process.stdout is not None with chooser_process.stdin as pipe: for index, choice in enumerate(choices): - assert "\n" not in choice + if "\n" not in choice: + raise Exception("choices can only span a single line") if not supports_result_index: pipe.write(str(index).encode()) pipe.write(b" ") @@ -54,7 +57,7 @@ def run_chooser(choices: Iterable[str], prompt: str = None, async_read: bool = F return chosen_index -def send_notification(title: str, message: str, url: str = None) -> None: +def send_notification(title: str, message: str, url: Optional[str] = None) -> None: if sys.platform == "darwin": process_args = [ "terminal-notifier", diff --git a/script-resources/pycalc_startup.py b/script-resources/pycalc_startup.py index 269a1af..f7b5dd7 100644 --- a/script-resources/pycalc_startup.py +++ b/script-resources/pycalc_startup.py @@ -3,7 +3,7 @@ from fractions import Fraction def factors(n: int) -> "set[int]": - result = set() + result: "set[int]" = set() for i in range(1, int(sqrt(n)) + 1): if n % i == 0: result.add(i) diff --git a/script-resources/welcome/colors.py b/script-resources/welcome/colors.py index 7d4cb76..91b9661 100644 --- a/script-resources/welcome/colors.py +++ b/script-resources/welcome/colors.py @@ -14,7 +14,7 @@ def bright_colored(string: str, *colors: str) -> str: def colorize_percent( - percent: float, warning: float, critical: float, inverse: bool = False + percent: float, warning: float, critical: float, inverse: bool = False, ) -> str: colors = [Fore.GREEN, Fore.YELLOW, Fore.RED] diff --git a/script-resources/welcome/system_info.py b/script-resources/welcome/system_info.py index 24cda1b..e1156c5 100644 --- a/script-resources/welcome/system_info.py +++ b/script-resources/welcome/system_info.py @@ -13,7 +13,7 @@ from humanize import humanize_bytes, humanize_timedelta def get_system_info() -> Tuple[List[str], List[str]]: info_lines: List[str] = [] - def info(name: str, value: str, *format_args) -> None: + def info(name: str, value: str, *format_args: object) -> None: line = bright_colored(name + ":", Fore.YELLOW) + " " + value if format_args: line = line % format_args From 173661a6199c3fa118102d7d642b385dbbf52cb4 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 4 Jun 2021 17:36:33 +0300 Subject: [PATCH 649/713] [nvim] add a few little tricks found in romainl's Gists --- nvim/plugin/editing.vim | 3 +++ nvim/plugin/interface.vim | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 416d073..00b283a 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -142,6 +142,9 @@ set commentstring=//%s xnoremap zL xnoremap zl + " Repeat the last edit n times, taken from + nnoremap . execute "normal!" repeat(".", v:count1) + " }}} diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 082f3b4..769871c 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -137,6 +137,17 @@ endif nmap [l (qf_loc_previous) nmap ]l (qf_loc_next) let g:qf_mapping_ack_style = 1 + + " Based on , inspired by + " . + " But apparently `vimgrep /pattern/ %` can be used instead? + function! s:CmdGlobal(pattern, bang) + let pattern = substitute(a:pattern, "/.*$", "", "") + let matches = [] + execute "g" . (a:bang ? "!" : "") . "/" . pattern . "/call add(matches, expand(\"%\").\":\".line(\".\").\":\".col(\".\").\":\".getline(\".\"))" + cexpr matches + endfunction + command! -bang -nargs=1 Global call CmdGlobal(, 0) " }}} From b0f730799911a69d4a0a59aefa772af864350273 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 4 Jun 2021 13:51:03 +0300 Subject: [PATCH 650/713] [python] enable strict typechecking --- colorschemes/main.py | 28 +++++++------------------ nvim/coc-languages/python.vim | 6 ++++-- script-resources/common_script_utils.py | 15 +++++++++---- script-resources/pycalc_startup.py | 2 +- script-resources/welcome/colors.py | 2 +- script-resources/welcome/system_info.py | 2 +- 6 files changed, 25 insertions(+), 30 deletions(-) diff --git a/colorschemes/main.py b/colorschemes/main.py index 1c236e4..209a460 100755 --- a/colorschemes/main.py +++ b/colorschemes/main.py @@ -3,7 +3,7 @@ import json import os from abc import abstractmethod -from typing import Dict, Iterator, List, Protocol, TextIO, runtime_checkable +from typing import Dict, Iterator, List, Protocol, TextIO __dir__ = os.path.dirname(__file__) @@ -60,23 +60,10 @@ BASE16_TO_ANSI_MAPPING: List[int] = [ ANSI_TO_BASE16_MAPPING: List[int] = [BASE16_TO_ANSI_MAPPING.index(i) for i in range(16)] -@runtime_checkable class Theme(Protocol): - - @property - @abstractmethod - def base16_name(self) -> str: - raise NotImplementedError() - - @property - @abstractmethod - def is_dark(self) -> bool: - raise NotImplementedError() - - @property - @abstractmethod - def base16_colors(self) -> List[Color]: - raise NotImplementedError() + base16_name: str + is_dark: bool + base16_colors: List[Color] @property def name(self) -> str: @@ -152,7 +139,6 @@ class MyTheme(Theme): ] -@runtime_checkable class ThemeGenerator(Protocol): @abstractmethod @@ -248,7 +234,7 @@ class ThemeGeneratorVim(ThemeGenerator): output.write("let {}base16_colors = [\n".format(namespace)) for gui_color, cterm_color in zip(theme.base16_colors, ANSI_TO_BASE16_MAPPING): output.write( - "\\ {{'gui': '{}', 'cterm': '{:02}'}},\n".format(gui_color.css_hex, cterm_color) + "\\ {{'gui': '{}', 'cterm': '{:02}'}},\n".format(gui_color.css_hex, cterm_color), ) output.write("\\ ]\n") @@ -293,7 +279,7 @@ class ThemeGeneratorXfceTerminal(ThemeGenerator): output.write("TabActivityColor={}\n".format(theme.base16_colors[0x8].css_hex)) output.write("ColorBoldUseDefault=TRUE\n") output.write( - "ColorPalette={}\n".format(";".join(color.css_hex for color in theme.ansi_colors)) + "ColorPalette={}\n".format(";".join(color.css_hex for color in theme.ansi_colors)), ) @@ -340,7 +326,7 @@ class ThemeGeneratorIterm(ThemeGenerator): def generate(self, theme: Theme, output: TextIO) -> None: output.write('\n') output.write( - '\n' + '\n', ) output.write('\n') output.write("\n") diff --git a/nvim/coc-languages/python.vim b/nvim/coc-languages/python.vim index 49851ad..c6a7357 100644 --- a/nvim/coc-languages/python.vim +++ b/nvim/coc-languages/python.vim @@ -1,15 +1,17 @@ let g:coc_global_extensions += ['coc-pyright'] let g:coc_filetypes += ['python'] -" let g:coc_user_config['python.autocomplete.showAdvancedMembers'] = v:false let g:coc_user_config['python'] = { \ 'formatting': { \ 'provider': 'yapf', -\ 'yapfArgs': ['--style=' . simplify(g:dotfiles_dir.'/python/yapf.ini')] +\ 'yapfArgs': ['--style=' . simplify(g:dotfiles_dir.'/python/yapf.ini')], \ }, \ 'linting': { \ 'pylintEnabled': v:false, \ 'flake8Enabled': v:true, \ 'flake8Args': ['--config=' . simplify(g:dotfiles_dir.'/python/flake8.ini')], \ }, +\ 'analysis': { +\ 'typeCheckingMode': 'strict', +\ }, \ } diff --git a/script-resources/common_script_utils.py b/script-resources/common_script_utils.py index 4065d99..8a4c6a9 100644 --- a/script-resources/common_script_utils.py +++ b/script-resources/common_script_utils.py @@ -2,7 +2,7 @@ import os import subprocess import sys from pathlib import Path -from typing import Iterable, NoReturn +from typing import Iterable, NoReturn, Optional if os.name == "posix": DOTFILES_CONFIG_DIR: Path = Path.home() / ".config" / "dotfiles" @@ -13,7 +13,11 @@ def platform_not_supported_error() -> NoReturn: raise Exception("platform '{}' is not supported!".format(sys.platform)) -def run_chooser(choices: Iterable[str], prompt: str = None, async_read: bool = False) -> int: +def run_chooser( + choices: Iterable[str], + prompt: Optional[str] = None, + async_read: bool = False, +) -> int: supports_result_index = True if os.isatty(sys.stderr.fileno()): process_args = [ @@ -36,10 +40,13 @@ def run_chooser(choices: Iterable[str], prompt: str = None, async_read: bool = F platform_not_supported_error() chooser_process = subprocess.Popen(process_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + assert chooser_process.stdin is not None + assert chooser_process.stdout is not None with chooser_process.stdin as pipe: for index, choice in enumerate(choices): - assert "\n" not in choice + if "\n" in choice: + raise Exception("choices can only span a single line") if not supports_result_index: pipe.write(str(index).encode()) pipe.write(b" ") @@ -54,7 +61,7 @@ def run_chooser(choices: Iterable[str], prompt: str = None, async_read: bool = F return chosen_index -def send_notification(title: str, message: str, url: str = None) -> None: +def send_notification(title: str, message: str, url: Optional[str] = None) -> None: if sys.platform == "darwin": process_args = [ "terminal-notifier", diff --git a/script-resources/pycalc_startup.py b/script-resources/pycalc_startup.py index 269a1af..f7b5dd7 100644 --- a/script-resources/pycalc_startup.py +++ b/script-resources/pycalc_startup.py @@ -3,7 +3,7 @@ from fractions import Fraction def factors(n: int) -> "set[int]": - result = set() + result: "set[int]" = set() for i in range(1, int(sqrt(n)) + 1): if n % i == 0: result.add(i) diff --git a/script-resources/welcome/colors.py b/script-resources/welcome/colors.py index 7d4cb76..91b9661 100644 --- a/script-resources/welcome/colors.py +++ b/script-resources/welcome/colors.py @@ -14,7 +14,7 @@ def bright_colored(string: str, *colors: str) -> str: def colorize_percent( - percent: float, warning: float, critical: float, inverse: bool = False + percent: float, warning: float, critical: float, inverse: bool = False, ) -> str: colors = [Fore.GREEN, Fore.YELLOW, Fore.RED] diff --git a/script-resources/welcome/system_info.py b/script-resources/welcome/system_info.py index 24cda1b..e1156c5 100644 --- a/script-resources/welcome/system_info.py +++ b/script-resources/welcome/system_info.py @@ -13,7 +13,7 @@ from humanize import humanize_bytes, humanize_timedelta def get_system_info() -> Tuple[List[str], List[str]]: info_lines: List[str] = [] - def info(name: str, value: str, *format_args) -> None: + def info(name: str, value: str, *format_args: object) -> None: line = bright_colored(name + ":", Fore.YELLOW) + " " + value if format_args: line = line % format_args From bf230c414ea5706c107e10b102cf580e600e2d63 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 4 Jun 2021 17:36:33 +0300 Subject: [PATCH 651/713] [nvim] add a few little tricks found in romainl's Gists --- nvim/plugin/editing.vim | 3 +++ nvim/plugin/interface.vim | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 416d073..00b283a 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -142,6 +142,9 @@ set commentstring=//%s xnoremap zL xnoremap zl + " Repeat the last edit n times, taken from + nnoremap . execute "normal!" repeat(".", v:count1) + " }}} diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 082f3b4..769871c 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -137,6 +137,17 @@ endif nmap [l (qf_loc_previous) nmap ]l (qf_loc_next) let g:qf_mapping_ack_style = 1 + + " Based on , inspired by + " . + " But apparently `vimgrep /pattern/ %` can be used instead? + function! s:CmdGlobal(pattern, bang) + let pattern = substitute(a:pattern, "/.*$", "", "") + let matches = [] + execute "g" . (a:bang ? "!" : "") . "/" . pattern . "/call add(matches, expand(\"%\").\":\".line(\".\").\":\".col(\".\").\":\".getline(\".\"))" + cexpr matches + endfunction + command! -bang -nargs=1 Global call CmdGlobal(, 0) " }}} From 6a46c28a10f600f75f2cf603c7cc5b916738fe8d Mon Sep 17 00:00:00 2001 From: Keanu Date: Fri, 4 Jun 2021 22:11:19 +0200 Subject: [PATCH 652/713] [scripts/category-count] Add script. --- scripts/category-count | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 scripts/category-count diff --git a/scripts/category-count b/scripts/category-count new file mode 100755 index 0000000..2c5d296 --- /dev/null +++ b/scripts/category-count @@ -0,0 +1,24 @@ +#!/usr/bin/env zsh +# Script to fetch commit messages and display the category frequencies. +# Example: +# 047c36c [Meta] Added README. +# 5b16912 [Init] Added scripts. +# +# Will output: +# Meta: 1 +# Init: 1 +# +# Authored by: +# Alyxia Sother +# Mijyuoon + +data=$(git log --oneline | awk -F '[][]' '{for (i=2; i<=NF; i+=2) {printf "%s ", $i}; print ""}') +keys=$(echo "$data" | sort -u | uniq) + +for type in $data; do + eval "count_$type="'$'"((count_$type+1))" +done + +for type in $keys; do + echo "$type: $(eval "echo "'$'"count_$type")" +done From 974c692ce015f83edd696268d01efaef494298d9 Mon Sep 17 00:00:00 2001 From: Keanu Date: Sat, 5 Jun 2021 12:08:15 +0200 Subject: [PATCH 653/713] [scripts/category-count] Use bash instead of ZSH. --- scripts/category-count | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/category-count b/scripts/category-count index 2c5d296..adad599 100755 --- a/scripts/category-count +++ b/scripts/category-count @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env bash # Script to fetch commit messages and display the category frequencies. # Example: # 047c36c [Meta] Added README. From 7999e5d9c2ae6813d224fe92de086bbbacefd718 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 5 Jun 2021 15:31:03 +0300 Subject: [PATCH 654/713] [zsh] fix a visual bug in the manpage finder widget --- zsh/zle.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/zle.zsh b/zsh/zle.zsh index 2d0ee56..098c40c 100644 --- a/zsh/zle.zsh +++ b/zsh/zle.zsh @@ -157,6 +157,7 @@ local manpage="" manpage="$(fzf-search-manpage "$cmd_name")" BUFFER="man $manpage" + zle redisplay zle accept-line } zle -N find-man-page _widget_find_man_page From ab278226ea3103ee748fed148e276a773d21a7ef Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 7 Jun 2021 14:26:09 +0300 Subject: [PATCH 655/713] fixup! [nvim] add surround.vim customization --- nvim/plugin/editing.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 00b283a..36d4220 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -233,6 +233,7 @@ set commentstring=//%s let g:delimitMate_expand_cr = 1 let g:surround_{char2nr('*')} = "**\r**" + let g:surround_{char2nr('~')} = "~~\r~~" let g:pencil#wrapModeDefault = 'soft' let g:pencil#conceallevel = 0 From e7a56e0e5b2aa11aecfc8bc3bb9604ca6604b138 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 7 Jun 2021 14:49:57 +0300 Subject: [PATCH 656/713] [scripts/playerctl-simple-menu] display the file path if it doesn't have metadata for title --- scripts/playerctl-simple-menu | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/playerctl-simple-menu b/scripts/playerctl-simple-menu index 17d6dd3..25e1ee4 100755 --- a/scripts/playerctl-simple-menu +++ b/scripts/playerctl-simple-menu @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +# type: ignore # A simple graphical menu to control MPRIS-compatible players through Playerctl. # @@ -7,7 +8,9 @@ # TODO: Update the menu on player status changes. import math +import posixpath import sys +import urllib.parse import gi @@ -59,6 +62,14 @@ def iter_metadata_entries_for_player(player): if album: yield album.get_string() + else: + url = metadata.lookup_value("xesam:url") + if url: + url_parsed = urllib.parse.urlparse(url.get_string()) + if url_parsed.scheme == "file": + filename = posixpath.basename(urllib.parse.unquote(url_parsed.path)) + yield filename + if player.props.can_seek: position_secs = player.props.position / 1e6 duration = metadata.lookup_value("mpris:length") From 656b1d74a31b7cbb8c96978aa4b3746b53d73de2 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 9 Jun 2021 17:42:34 +0300 Subject: [PATCH 657/713] [nvim] implement the A and I mappings for Visual mode --- nvim/plugin/editing.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 36d4220..e59bd3c 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -145,6 +145,9 @@ set commentstring=//%s " Repeat the last edit n times, taken from nnoremap . execute "normal!" repeat(".", v:count1) + xnoremap A :normal! A + xnoremap I :normal! I + " }}} From e5a5579a1085c7e5e5193e54740530d90be6bb4d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 9 Jun 2021 19:37:36 +0300 Subject: [PATCH 658/713] [python] disable some more whitespace-related lints --- python/flake8.ini | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/python/flake8.ini b/python/flake8.ini index 041fdb7..a1cbee9 100644 --- a/python/flake8.ini +++ b/python/flake8.ini @@ -31,6 +31,14 @@ ignore = E121 # Hanging indent on a continuation line is unaligned E131 + # Whitespace before a comma + E203 + # Multiple spaces before an operator + E221 + # Multiple spaces after an operator + E222 + # Whitespace after a comma + E241 # Import not at the top of the file E402 # Line too long From 7eeb36c136a9b1d16896f665b1d6df7a08d6850c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 12 Jun 2021 00:12:37 +0300 Subject: [PATCH 659/713] [nvim] show ModeMsg in bold ... --- nvim/colors/dotfiles.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index ec50d72..a9f7751 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -121,7 +121,7 @@ call s:hi('Search', 0x1, 0xA, '', '') hi! link Substitute Search - call s:hi('ModeMsg', 0xB, '', '', '') + call s:hi('ModeMsg', 0xB, '', 'bold', '') call s:hi('Question', 0xB, '', '', '') hi! link MoreMsg Question call s:hi('Visual', '', 0x2, '', '') From 1460f41211bfb4251bf36ad6cb37146881ec27dd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 14 Jun 2021 11:03:52 +0300 Subject: [PATCH 660/713] [nvim] adjust formatoptions (again) --- nvim/plugin/editing.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index e59bd3c..25a683e 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -220,11 +220,16 @@ set commentstring=//%s " Formatting {{{ " -o: don't insert a comment after hitting 'o' or 'O' in the Normal mode + " +r: however, insert a comment after pressing Enter in the Insert mode " -t: don't auto-wrap regular code while typing " -c: don't auto-wrap comments while typing augroup vimrc-editing-formatting autocmd! - autocmd FileType * set formatoptions-=o | set formatoptions-=t | set formatoptions-=c + autocmd FileType * + \ setlocal formatoptions-=o + \|setlocal formatoptions+=r + \|setlocal formatoptions-=t + \|setlocal formatoptions-=c augroup END " }}} From e01a13110dd49373dd338b736a822caf9fbf0221 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 14 Jun 2021 16:36:05 +0300 Subject: [PATCH 661/713] [zsh] make the default selection in the manpage finder widget smarter --- zsh/zle.zsh | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/zsh/zle.zsh b/zsh/zle.zsh index 098c40c..5ee805a 100644 --- a/zsh/zle.zsh +++ b/zsh/zle.zsh @@ -152,7 +152,35 @@ # find man page widget {{{ _widget_find_man_page() { local words=("${(@z)BUFFER}") - local cmd_name="${words[1]}" + + local cmd_name arg i is_subcommand + for (( i = 1; i <= ${#words}; i++ )); do + arg="${words[$i]}" + + # Skip flags + if [[ "$arg" == '-'* ]]; then + continue + fi + + # Skip command prefixes + if [[ -z "$is_subcommand" && "$arg" == (noglob|nocorrect|exec|command|builtin|nohup|disown|sudo|time|gtime|prime-run) ]]; then + continue + fi + + if [[ -z "$is_subcommand" ]]; then + cmd_name="${arg}" + else + cmd_name="${cmd_name}-${arg}" + fi + + if [[ -z "$is_subcommand" && "$arg" == (git|hub|npm|apt|docker|pip|perf) ]]; then + is_subcommand=1 + continue + fi + + break + done + zle push-line local manpage="" manpage="$(fzf-search-manpage "$cmd_name")" From bd096404725402027511ebcb5be6b1c243430eb1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 15 Jun 2021 19:28:38 +0300 Subject: [PATCH 662/713] [zsh] enable random greetings from IRC messages in PyPy --- zsh/env.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zsh/env.zsh b/zsh/env.zsh index 895a982..d8ae0f2 100644 --- a/zsh/env.zsh +++ b/zsh/env.zsh @@ -37,3 +37,8 @@ export FZF_DEFAULT_OPTS="--color=16 --height=40% --reverse" # export BAT_THEME="base16-256" + +# +# +# +export PYPY_IRC_TOPIC=1 From 31c148aad68d4665e5c42b1120a18289571542e0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 17 Jun 2021 00:36:13 +0300 Subject: [PATCH 663/713] [scripts/markdown2htmldoc] fix text color in the code tags This fix is speifically made for running the theme inside vscode via `markdown.styles`. Otherwise the theme behaves just fine. --- script-resources/markdown2htmldoc/themes-out/my.css | 2 +- script-resources/markdown2htmldoc/themes-src/my.scss | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/script-resources/markdown2htmldoc/themes-out/my.css b/script-resources/markdown2htmldoc/themes-out/my.css index 9b4f943..ca0dd35 100644 --- a/script-resources/markdown2htmldoc/themes-out/my.css +++ b/script-resources/markdown2htmldoc/themes-out/my.css @@ -1 +1 @@ -/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}*{box-sizing:border-box}body{color:#d3d0c8;background-color:#2d2d2d;font-family:"Ubuntu",sans-serif;font-size:16px;line-height:1.5;word-wrap:break-word;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body::-moz-selection,body::selection,body ::-moz-selection,body ::selection{color:#d3d0c8;background-color:#515151}article{min-width:200px;max-width:960px;margin:0 auto;padding:32px}@media(max-width: 767px){article{padding:24px}}article::after,article::before{display:table;content:""}article::after{clear:both}article>:first-child{margin-top:0 !important}article>:last-child{margin-bottom:0 !important}.octicon{display:inline-block;overflow:visible !important;vertical-align:text-bottom;fill:currentColor}a{color:#69c;text-decoration:none}a:hover,a:focus,a:active{text-decoration:underline}a:not([href]){color:unset;text-decoration:none}hr{margin-top:1.5em;margin-bottom:1.5em;border:.2em solid #515151}hr::after,hr::before{display:table;content:""}hr::after{clear:both}dl,details,table,blockquote,ul,ol,pre,p{margin-top:1em;margin-bottom:1em}blockquote{margin-left:0;margin-right:0;padding-left:1em;border-left:.25em solid #515151}blockquote>:first-child{margin-top:0 !important}blockquote>:last-child{margin-bottom:0 !important}summary{cursor:pointer}img{max-width:100%;box-sizing:content-box;background-color:#2d2d2d}img[align=left],img[align=right]{margin:.5em 1.25em}img[align=left]{margin-left:0}img[align=right]{margin-right:0}ins,del{text-decoration:none}ins{color:#9c9}del{color:#f2777a}mark{background-color:#fc6;color:#2d2d2d}h1,h2,h3,h4,h5,h6{margin-top:1.5em;margin-bottom:1em;padding-bottom:.3em;border-bottom:1px solid #515151;font-weight:600;line-height:1.25}h1 .anchor,h2 .anchor,h3 .anchor,h4 .anchor,h5 .anchor,h6 .anchor{float:left;padding-right:4px;margin-left:-20px;color:unset}h1 .anchor:hover,h2 .anchor:hover,h3 .anchor:hover,h4 .anchor:hover,h5 .anchor:hover,h6 .anchor:hover{text-decoration:none}h1 .anchor:focus,h2 .anchor:focus,h3 .anchor:focus,h4 .anchor:focus,h5 .anchor:focus,h6 .anchor:focus{outline:none}h1 .anchor>*,h2 .anchor>*,h3 .anchor>*,h4 .anchor>*,h5 .anchor>*,h6 .anchor>*{visibility:hidden;vertical-align:middle}h1:hover .anchor>*,h2:hover .anchor>*,h3:hover .anchor>*,h4:hover .anchor>*,h5:hover .anchor>*,h6:hover .anchor>*{visibility:visible}@media(hover: none){h1 .anchor>*,h2 .anchor>*,h3 .anchor>*,h4 .anchor>*,h5 .anchor>*,h6 .anchor>*{visibility:visible}}h1{font-size:2em}h2{font-size:1.5em}h3{font-size:1.25em}h4{font-size:1em}h5{font-size:.875em}h6{font-size:.85em}code,kbd,samp,pre{font-family:"Ubuntu Mono",monospace}code{padding:.2em .3em;background-color:rgba(116,115,105,.2);border-radius:4px}pre{padding:1em;overflow:auto;color:#d3d0c8;background-color:#2d2d2d;border:1px solid #515151;border-radius:4px;line-height:1.3;word-wrap:normal}pre code{padding:unset;background-color:unset;border:unset}kbd{display:inline-block;padding:.2em .3em;vertical-align:bottom;font:0.75em/0.8333333333 Ubuntu Mono, monospace;color:#d3d0c8;background-color:#1a1a1a;border:.1em solid #0d0d0d;border-bottom-width:.4em;border-radius:4px}table{display:block;width:100%;overflow:auto;border-spacing:0;border-collapse:collapse;width:max-content;max-width:100%}table img{background-color:transparent}th{font-weight:600}td,th{padding:.4em .75em;border:1px solid #515151}tr:nth-child(2n){background-color:rgba(81,81,81,.1)}ol,ul{padding-left:2em}ol ol,ol ul,ul ol,ul ul{margin-top:0;margin-bottom:0}li{margin-top:.25em;margin-bottom:.25em}dt{margin-top:1em;font-weight:600;font-style:italic}dd{margin-bottom:1em;margin-left:0;padding-left:1em}ul>li.task-list-item{list-style-type:none}ul>li.task-list-item>input[type=checkbox]:first-child{margin:0 .2em .25em -1.6em;vertical-align:middle} +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}*{box-sizing:border-box}body{color:#d3d0c8;background-color:#2d2d2d;font-family:"Ubuntu",sans-serif;font-size:16px;line-height:1.5;word-wrap:break-word;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body::-moz-selection,body::selection,body ::-moz-selection,body ::selection{color:#d3d0c8;background-color:#515151}article{min-width:200px;max-width:960px;margin:0 auto;padding:32px}@media(max-width: 767px){article{padding:24px}}article::after,article::before{display:table;content:""}article::after{clear:both}article>:first-child{margin-top:0 !important}article>:last-child{margin-bottom:0 !important}.octicon{display:inline-block;overflow:visible !important;vertical-align:text-bottom;fill:currentColor}a{color:#69c;text-decoration:none}a:hover,a:focus,a:active{text-decoration:underline}a:not([href]){color:unset;text-decoration:none}hr{margin-top:1.5em;margin-bottom:1.5em;border:.2em solid #515151}hr::after,hr::before{display:table;content:""}hr::after{clear:both}dl,details,table,blockquote,ul,ol,pre,p{margin-top:1em;margin-bottom:1em}blockquote{margin-left:0;margin-right:0;padding-left:1em;border-left:.25em solid #515151}blockquote>:first-child{margin-top:0 !important}blockquote>:last-child{margin-bottom:0 !important}summary{cursor:pointer}img{max-width:100%;box-sizing:content-box;background-color:#2d2d2d}img[align=left],img[align=right]{margin:.5em 1.25em}img[align=left]{margin-left:0}img[align=right]{margin-right:0}ins,del{text-decoration:none}ins{color:#9c9}del{color:#f2777a}mark{background-color:#fc6;color:#2d2d2d}h1,h2,h3,h4,h5,h6{margin-top:1.5em;margin-bottom:1em;padding-bottom:.3em;border-bottom:1px solid #515151;font-weight:600;line-height:1.25}h1 .anchor,h2 .anchor,h3 .anchor,h4 .anchor,h5 .anchor,h6 .anchor{float:left;padding-right:4px;margin-left:-20px;color:unset}h1 .anchor:hover,h2 .anchor:hover,h3 .anchor:hover,h4 .anchor:hover,h5 .anchor:hover,h6 .anchor:hover{text-decoration:none}h1 .anchor:focus,h2 .anchor:focus,h3 .anchor:focus,h4 .anchor:focus,h5 .anchor:focus,h6 .anchor:focus{outline:none}h1 .anchor>*,h2 .anchor>*,h3 .anchor>*,h4 .anchor>*,h5 .anchor>*,h6 .anchor>*{visibility:hidden;vertical-align:middle}h1:hover .anchor>*,h2:hover .anchor>*,h3:hover .anchor>*,h4:hover .anchor>*,h5:hover .anchor>*,h6:hover .anchor>*{visibility:visible}@media(hover: none){h1 .anchor>*,h2 .anchor>*,h3 .anchor>*,h4 .anchor>*,h5 .anchor>*,h6 .anchor>*{visibility:visible}}h1{font-size:2em}h2{font-size:1.5em}h3{font-size:1.25em}h4{font-size:1em}h5{font-size:.875em}h6{font-size:.85em}code,kbd,samp,pre{font-family:"Ubuntu Mono",monospace}code{padding:.2em .3em;color:inherit;background-color:rgba(116,115,105,.2);border-radius:4px}pre{padding:1em;overflow:auto;color:#d3d0c8;background-color:#2d2d2d;border:1px solid #515151;border-radius:4px;line-height:1.3;word-wrap:normal}pre code{padding:unset;background-color:unset;border:unset}kbd{display:inline-block;padding:.2em .3em;vertical-align:bottom;font:0.75em/0.8333333333 Ubuntu Mono, monospace;color:#d3d0c8;background-color:#1a1a1a;border:.1em solid #0d0d0d;border-bottom-width:.4em;border-radius:4px}table{display:block;width:100%;overflow:auto;border-spacing:0;border-collapse:collapse;width:max-content;max-width:100%}table img{background-color:transparent}th{font-weight:600}td,th{padding:.4em .75em;border:1px solid #515151}tr:nth-child(2n){background-color:rgba(81,81,81,.1)}ol,ul{padding-left:2em}ol ol,ol ul,ul ol,ul ul{margin-top:0;margin-bottom:0}li{margin-top:.25em;margin-bottom:.25em}dt{margin-top:1em;font-weight:600;font-style:italic}dd{margin-bottom:1em;margin-left:0;padding-left:1em}ul>li.task-list-item{list-style-type:none}ul>li.task-list-item>input[type=checkbox]:first-child{margin:0 .2em .25em -1.6em;vertical-align:middle} diff --git a/script-resources/markdown2htmldoc/themes-src/my.scss b/script-resources/markdown2htmldoc/themes-src/my.scss index e69386e..b11970a 100644 --- a/script-resources/markdown2htmldoc/themes-src/my.scss +++ b/script-resources/markdown2htmldoc/themes-src/my.scss @@ -318,6 +318,7 @@ pre { // Inline code snippets. code { padding: 0.2em 0.3em; + color: inherit; background-color: rgba(colorscheme.$base-03, 0.2); border-radius: $border-radius; } From 0597f8fde93b7734e1765ae15521562c79f2b175 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 17 Jun 2021 09:56:21 +0300 Subject: [PATCH 664/713] [nvim] use shellescape more carefully --- nvim/init.vim | 2 +- nvim/plugin/files.vim | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nvim/init.vim b/nvim/init.vim index fbbb72a..7a01761 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -13,7 +13,7 @@ let s:vim_plug_home = s:vim_config_dir . '/plugged' let s:just_installed_vim_plug = 0 if !filereadable(s:vim_plug_script) - execute '!curl -fL https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim --create-dirs -o' shellescape(s:vim_plug_script) + execute '!curl -fL https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim --create-dirs -o' shellescape(s:vim_plug_script, 1) autocmd VimEnter * PlugInstall --sync endif diff --git a/nvim/plugin/files.vim b/nvim/plugin/files.vim index da700db..2d8e228 100644 --- a/nvim/plugin/files.vim +++ b/nvim/plugin/files.vim @@ -13,11 +13,11 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" let s:rg_ignore = split(&wildignore, ',') + [ \ 'node_modules', 'target', 'build', 'dist', '.stack-work' \ ] - let s:rg_cmd .= " --glob '!{'" . shellescape(join(s:rg_ignore, ',')) . "'}'" + let s:rg_cmd .= " --glob '!{'" . shellescape(join(s:rg_ignore, ','), 1) . "'}'" let &grepprg = s:rg_cmd . ' --vimgrep' let $FZF_DEFAULT_COMMAND = s:rg_cmd . ' --files' - command! -bang -nargs=* Rg call fzf#vim#grep(s:rg_cmd . ' --column --line-number --no-heading --fixed-strings --smart-case --color always ' . shellescape(), 1, 0) + command! -bang -nargs=* Rg call fzf#vim#grep(s:rg_cmd . ' --column --line-number --no-heading --fixed-strings --smart-case --color always ' . shellescape(, 1), 1, 0) command! -bang -nargs=* Find Rg endif @@ -26,13 +26,13 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" function! s:grep_mapping_star_normal() let word = expand("") if !empty(word) - call feedkeys(":\grep " . shellescape('\b' . word . '\b'), 'n') + call feedkeys(":\grep " . shellescape('\b' . word . '\b', 1), 'n') endif endfunction function! s:grep_mapping_star_visual() let tmp = @" normal! y - call feedkeys(":\grep " . shellescape(@"), 'n') + call feedkeys(":\grep " . shellescape(@", 1), 'n') let @" = tmp endfunction nnoremap * call grep_mapping_star_normal() @@ -137,7 +137,7 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" echoerr "Please install for the DragOut command to work." return endif - execute '!dragon-drag-and-drop '.shellescape(a:path) + execute '!dragon-drag-and-drop' shellescape(a:path, 1) endfunction command -nargs=* -complete=file DragOut call s:DragOut(empty() ? expand('%') : ) " }}} From 9a1a338262caebd163bb90459e8014cb9108834b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 21 Jun 2021 19:00:00 +0300 Subject: [PATCH 665/713] [zsh] don't sync the cwd when a terminal is opened inside vscode (requested by @lexisother) --- zsh/zshrc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/zsh/zshrc b/zsh/zshrc index e8bf236..30832e9 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -65,6 +65,20 @@ if [[ -z "$DOTFILES_DISABLE_WELCOME" ]]; then welcome fi -if [[ -z "$DOTFILES_SYNC_LAST_WORKING_DIR" ]]; then +should_really_sync=0 +if [[ -v DOTFILES_SYNC_LAST_WORKING_DIR ]]; then + # Variable is defined + if [[ -n "$DOTFILES_SYNC_LAST_WORKING_DIR" ]]; then + # Variable is non-empty + should_really_sync=1 + fi +else + # Variable is undefined + if [[ "$TERM_PROGRAM" != "vscode" ]]; then + should_really_sync=1 + fi +fi +if (( should_really_sync )); then sync_working_dir_load fi +unset should_really_sync From 443f7aa32c3534e52c11f5e90d7913154e0da983 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 21 Jun 2021 19:26:58 +0300 Subject: [PATCH 666/713] [nvim] set the keymap globally in the switcher --- nvim/plugin/editing.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 25a683e..bf4ece6 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -159,7 +159,7 @@ set commentstring=//%s nnoremap DotfilesSwapKeymaps let g:dotfiles_prev_keymap = &keymap - command! -nargs=0 DotfilesSwapKeymaps let [g:dotfiles_prev_keymap, &keymap] = [&keymap, g:dotfiles_prev_keymap] + command! -nargs=0 DotfilesSwapKeymaps let [g:dotfiles_prev_keymap, &g:keymap] = [&g:keymap, g:dotfiles_prev_keymap] " }}} From 4e8fbb481a745eb2eef471e8ece4f29d0b6794b6 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 21 Jun 2021 19:36:49 +0300 Subject: [PATCH 667/713] [crosscode] move most of the code into https://github.com/dmitmel/crosscode-tweak-pack --- .../assets/data/lang/sc/gui.en_US.json.patch | 16 - crosscode/btw-i-use-arch-mod/ccmod.json | 3 + crosscode/btw-i-use-arch-mod/package.json | 3 + crosscode/btw-i-use-arch-mod/poststart.js | 299 ------------------ crosscode/btw-i-use-arch-mod/prestart.js | 161 ---------- 5 files changed, 6 insertions(+), 476 deletions(-) delete mode 100644 crosscode/btw-i-use-arch-mod/assets/data/lang/sc/gui.en_US.json.patch diff --git a/crosscode/btw-i-use-arch-mod/assets/data/lang/sc/gui.en_US.json.patch b/crosscode/btw-i-use-arch-mod/assets/data/lang/sc/gui.en_US.json.patch deleted file mode 100644 index cf12f73..0000000 --- a/crosscode/btw-i-use-arch-mod/assets/data/lang/sc/gui.en_US.json.patch +++ /dev/null @@ -1,16 +0,0 @@ -{ - "labels": { - "options": { - "headers": { - "btw-i-use-arch": "btw I use Arch" - }, - "controls": { - "keys": { - "btw-i-use-arch": { - "open-map-menu": "Open/Close Map Menu" - } - } - } - } - } -} diff --git a/crosscode/btw-i-use-arch-mod/ccmod.json b/crosscode/btw-i-use-arch-mod/ccmod.json index 10f2db2..f5a112b 100644 --- a/crosscode/btw-i-use-arch-mod/ccmod.json +++ b/crosscode/btw-i-use-arch-mod/ccmod.json @@ -5,6 +5,9 @@ "icons": { "24": "icon24.png" }, + "dependencies": { + "crosscode-tweak-pack": "*" + }, "prestart": "prestart.js", "poststart": "poststart.js" } diff --git a/crosscode/btw-i-use-arch-mod/package.json b/crosscode/btw-i-use-arch-mod/package.json index e6d5b2e..fee2c33 100644 --- a/crosscode/btw-i-use-arch-mod/package.json +++ b/crosscode/btw-i-use-arch-mod/package.json @@ -2,6 +2,9 @@ "name": "btw-i-use-arch", "ccmodHumanName": "btw I use Arch", "description": "A mod for masochists like myself", + "dependencies": { + "crosscode-tweak-pack": "*" + }, "prestart": "prestart.js", "main": "poststart.js", "module": true diff --git a/crosscode/btw-i-use-arch-mod/poststart.js b/crosscode/btw-i-use-arch-mod/poststart.js index 0c99876..bf661c6 100644 --- a/crosscode/btw-i-use-arch-mod/poststart.js +++ b/crosscode/btw-i-use-arch-mod/poststart.js @@ -1,303 +1,4 @@ -// ac2pic: NOOOOO YOU CAN'T JUST PUT EVERYTHING IN POSTSTART/MAIN -// dmitmel: haha text editor go brrrr - export {}; ig.input.bind(ig.KEY.J, 'aim'); ig.input.bind(ig.KEY.K, 'dash'); - -function findRootGuiElement(clazz) { - return ig.gui.guiHooks.find(({ gui }) => gui instanceof clazz).gui; -} - -const quickMenu = findRootGuiElement(sc.QuickMenu); - -const myAddon = { - name: 'btw I use Arch addon', - - onPostUpdate() { - if (ig.loading || sc.model.isPlayerControlBlocked()) return; - - if (ig.input.pressed('btw-i-use-arch.open-map-menu')) { - if ( - sc.model.isGame() && - sc.model.isMenu() && - sc.menu.currentMenu === sc.MENU_SUBMENU.MAP && - // check if the help screen or a dialog isn't opened, otherwise it will - // block the screen after switching back to the game - ig.interact.entries.last() === sc.menu.buttonInteract - ) { - closeMapMenu(); - sc.BUTTON_SOUND.back.play(); - } else if ( - sc.model.isGame() && - sc.model.isRunning() && - // check if the quick menu has been unlocked yet, the map menu becomes - // available at the same moment - sc.model.player.getCore(sc.PLAYER_CORE.QUICK_MENU) - ) { - let openedMapMenu = openMapMenu(); - sc.BUTTON_SOUND[openedMapMenu ? 'submit' : 'denied'].play(); - } - } - }, -}; - -ig.ENTITY.Crosshair.inject({ - // Normally the `this._getThrowerPos` method is used to calculate where the - // balls are thrown _from_ in almost screen coordinates, but we can repurpose - // it to calculate where the balls should be thrown _at_ to hit an entity. - _getThrowPosForEntity(outVec2, entity) { - let realThrower = this.thrower; - try { - this.thrower = entity; - return this._getThrowerPos(outVec2); - } finally { - this.thrower = realThrower; - } - }, -}); - -// these two constants will come in handy later, see `focusNextEntity` -const ENTITY_FOCUS_DIRECTION = { - FARTHER: 1, - CLOSER: -1, -}; - -// buffer vectors for calculations -let vec2a = Vec2.create(); -let vec2b = Vec2.create(); - -sc.PlayerCrossHairController.inject({ - focusedEntity: null, - prevMousePos: Vec2.createC(-1, -1), - - updatePos(...args) { - // gamepad mode is unsupported because I don't have one to test this code on - if (this.gamepadMode) { - this.parent(...args); - return; - } - - let [crosshair] = args; - - // focus the next available entity if this combatant is e.g. dead - if ( - this.focusedEntity != null && - !this.shouldEntityBeFocused(this.focusedEntity) - ) { - this.focusNextEntity(crosshair, ENTITY_FOCUS_DIRECTION.CLOSER); - } - - let mouseX = sc.control.getMouseX(); - let mouseY = sc.control.getMouseY(); - if ( - this.focusedEntity != null && - // unfocus if the mouse has been moved - (this.prevMousePos.x !== mouseX || this.prevMousePos.y !== mouseY) - ) { - this.focusedEntity = null; - } - Vec2.assignC(this.prevMousePos, mouseX, mouseY); - - // handle controls - let pressedFocusCloser = ig.input.pressed('circle-left'); - let pressedFocusFarther = ig.input.pressed('circle-right'); - if (pressedFocusCloser) { - this.focusNextEntity(crosshair, ENTITY_FOCUS_DIRECTION.CLOSER); - } - if (pressedFocusFarther) { - this.focusNextEntity(crosshair, ENTITY_FOCUS_DIRECTION.FARTHER); - } - if ( - (pressedFocusCloser || pressedFocusFarther) && - this.focusedEntity == null - ) { - sc.BUTTON_SOUND.denied.play(); - } - - if (this.focusedEntity != null) { - this.calculateCrosshairPos(crosshair); - } else { - this.parent(...args); - } - }, - - focusNextEntity(crosshair, direction) { - let throwerPos = crosshair._getThrowerPos(vec2a); - - function getSqrDistToEntity(entity) { - let entityPos = crosshair._getThrowPosForEntity(vec2b, entity); - return Vec2.squareDistance(throwerPos, entityPos); - } - - let prevFocusedEntity = this.focusedEntity; - let prevFocusedSqrDist = - prevFocusedEntity != null ? getSqrDistToEntity(prevFocusedEntity) : null; - this.focusedEntity = null; - - let closestNextEntitySqrDist = null; - for (let entity of this.findFocusingCandidateEntities()) { - if (entity === prevFocusedEntity) continue; - - let sqrDist = getSqrDistToEntity(entity); - if ( - // multiplication by `dirFactor` effectively inverts the comparison - // operator when it is negative, otherwise logically the expression - // stays the same - (prevFocusedSqrDist == null || - sqrDist * direction > prevFocusedSqrDist * direction) && - (closestNextEntitySqrDist == null || - sqrDist * direction < closestNextEntitySqrDist * direction) - ) { - closestNextEntitySqrDist = sqrDist; - - this.focusedEntity = entity; - } - } - }, - - shouldEntityBeFocused(combatant) { - return ( - !combatant.isDefeated() && - // `sc.ENEMY_AGGRESSION.TEMP_THREAT` exists, but to be honest I have no - // idea what it is supposed to do - combatant.aggression === sc.ENEMY_AGGRESSION.THREAT - ); - }, - - findFocusingCandidateEntities() { - let allCombatants = sc.combat.activeCombatants[sc.COMBATANT_PARTY.ENEMY]; - let candidates = allCombatants.filter((enemy) => - this.shouldEntityBeFocused(enemy), - ); - - if (candidates.length === 0) { - candidates = ig.game.shownEntities.filter( - (entity) => - entity != null && - !entity._killed && - entity instanceof ig.ENTITY.Enemy && - ig.CollTools.isInScreen(entity.coll) && - this.shouldEntityBeFocused(entity), - ); - } - - return candidates; - }, - - calculateCrosshairPos(crosshair) { - let { thrower } = crosshair; - let throwerPos = crosshair._getThrowerPos(vec2a); - let entityPos = crosshair._getThrowPosForEntity(vec2b, this.focusedEntity); - let entityVel = this.focusedEntity.coll.vel; - - let ballInfo = sc.PlayerConfig.getElementBall( - thrower, - thrower.model.currentElementMode, - // NOTE: This causes glitches when the ball speed affects the crosshair - // position too much, in which case it begins jumping back and forth - // because the charged status is reset due to the movement. I hope this - // isn't to much of a problem. - crosshair.isThrowCharged(), - ); - let ballSpeed = ballInfo.data.speed; - - let crosshairPos = crosshair.coll.pos; - Vec2.assign(crosshairPos, entityPos); - // perform entity movement prediction repeatedly to increase the precision - for (let i = 0; i < 3; i++) { - let t = Vec2.distance(throwerPos, crosshairPos) / ballSpeed; - crosshairPos.x = entityPos.x + Math.round(entityVel.x) * t; - crosshairPos.y = entityPos.y + Math.round(entityVel.y) * t; - } - }, -}); - -const PLAYER_LOCATION_IN_ROOM_ICON = { - x: 280, - y: 436, - w: 10, - h: 9, -}; - -sc.MapCurrentRoomWrapper.inject({ - updateDrawables(renderer) { - this.parent(renderer); - - let player = ig.game.playerEntity; - let x = player.coll.pos.x * (this.hook.size.x / ig.game.size.x); - let y = player.coll.pos.y * (this.hook.size.y / ig.game.size.y); - - let sprite = PLAYER_LOCATION_IN_ROOM_ICON; - renderer.addGfx( - this.gfx, - Math.round(x - sprite.w / 2), - Math.round(y - sprite.h / 2), - sprite.x, - sprite.y, - sprite.w, - sprite.h, - ); - }, -}); - -function openMapMenu() { - // Check for the common conditions upfront, because opening and then - // immediately closing the quick menu causes the element indicator in the top - // left corner to jump, which is, of course, undesirable. Other conditions may - // be present implicitly or added explicitely in the future, but these two are - // the obvious ones I could find. - if (!sc.model.isSaveAllowed() || sc.model.isTeleportBlocked()) return false; - - // User's actions required in order to open the map need to be carefully - // emulated here instead of directly calling methods of `sc.model` and - // `sc.menu` because of the model notifications sent during the intended user - // interaction path (which trigger changes to the UI all over the codebase) - // and potential (although unlikely) changes to the internals of the methods - // I'm using here. Also, I chose to use the quick menu instead of the main one - // because the main one is unlocked at the end of the rhombus dungeon which is - // a bit later than the quick one and the map menu in particular both become - // available. - let enteredQuickMenu = sc.model.enterQuickMenu(); - if (!enteredQuickMenu) return false; - // I wonder why this variable isn't set internally by `enteredQuickMenu`, but - // I have to do this here because not doing that creates a very annoying bug - // when the quick menu access method is set to "hold": the quick menu becomes - // impossible to close by pressing shift and to close it you have to open and - // close the map menu again manually. - sc.quickmodel.activeState = true; - - let quickRingMenu = quickMenu.ringmenu; - let mapButton = quickRingMenu.map; - if (!mapButton.active) { - // some additional conditions may be present as noted above, so in the case - // the button intended to be pressed by user is inactive we bail out safely - sc.quickmodel.activeState = false; - sc.model.enterRunning(); - return false; - } - - // And finally, press the "map" button! - quickRingMenu.buttongroup._invokePressCallbacks( - mapButton, - /* fromMouse */ false, - ); - return true; -} - -function closeMapMenu() { - // Let's exit the world map just in case, for the same reason as I emulate - // user interactions in the `openMapMenu` function. - if (sc.menu.mapWorldmapActive) sc.menu.exitWorldMap(); - - sc.model.enterPrevSubState(); -} - -{ - let globalInputAddonIdx = ig.game.addons.postUpdate.findIndex( - (addon) => addon instanceof sc.GlobalInput, - ); - console.assert(globalInputAddonIdx >= 0, 'inputPostUpdateIdx >= 0'); - ig.game.addons.postUpdate.splice(globalInputAddonIdx + 1, 0, myAddon); -} diff --git a/crosscode/btw-i-use-arch-mod/prestart.js b/crosscode/btw-i-use-arch-mod/prestart.js index 9be33fe..e69de29 100644 --- a/crosscode/btw-i-use-arch-mod/prestart.js +++ b/crosscode/btw-i-use-arch-mod/prestart.js @@ -1,161 +0,0 @@ -sc.OPTIONS_DEFINITION['keys-btw-i-use-arch.open-map-menu'] = { - type: 'CONTROLS', - cat: sc.OPTION_CATEGORY.CONTROLS, - init: { key1: ig.KEY.M }, - hasDivider: true, - header: 'btw-i-use-arch', -}; - -ig.KEY.MOUSE_LEFT = ig.KEY.MOUSE1; -ig.KEY.MOUSE_RIGHT = ig.KEY.MOUSE2; -ig.KEY.MOUSE_MIDDLE = -6; -ig.KEY.MOUSE_BACK = -7; -ig.KEY.MOUSE_FORWARD = -8; - -// As for the copied implementations of ig.Input#keydown and ig.Input#keyup: -// there is probably a way to avoid copying, most notably by abusing the logic -// of the keyCode check. See, in both methods it is basically the same, just -// with differing event names, but the logic is as follows: if the event is a -// keyboard event, get the `keyCode` property, otherwise check if -// `event.button` is 2, then assume the key is `ig.KEY.MOUSE2`, otherwise -// `ig.KEY.MOUSE1`. This means that I could replace the value of the `MOUSE1` -// constant to the keyCode determined with my custom logic, and so the fallback -// path will read my value, but ultimately I didn't do that because I figured -// there might be other parts of these functions which can use some -// refactoring. -ig.Input.inject({ - keydown(event) { - if ( - ig.system.crashed || - this.isInIframeAndUnfocused() || - (this.ignoreKeyboard && event.type !== 'mousedown') - ) { - return; - } - - if (ig.system.hasFocusLost()) { - if (event.type === 'mousedown') { - ig.system.regainFocus(); - } - return; - } - - if (event.type === 'mousedown') { - this.mouseGuiActive = true; - } - this.currentDevice = ig.INPUT_DEVICES.KEYBOARD_AND_MOUSE; - - if (event.target.type === 'text') { - return; - } - - let keyCode = this.getKeyCodeFromEvent(event); - - if ( - // It's quite interesting that the game kinda supports touch events, but - // they are never actually used in practice. - event.type === 'touchstart' || - event.type === 'mousedown' - ) { - this.mousemove(event); - } - - let action = this.bindings[keyCode]; - if (action != null) { - this.actions[action] = true; - // Not sure what are locks supposed to do. Oh wait, I figured it out: - // this is so that if a button is detected to be pressed in a frame, but - // if an un-press event is caught during the processing of the frame, the - // button... Hmmm, still not sure. Entirety of the game logic blocks the - // main thread, so it's impossible to catch two events during processing - // of the frame. - if (!this.locks[action]) { - this.presses[action] = true; - this.locks[action] = true; - } - event.stopPropagation(); - event.preventDefault(); - } - }, - - keyup(event) { - if ( - ig.system.crashed || - this.isInIframeAndUnfocused() || - (this.ignoreKeyboard && event.type !== 'mouseup') || - event.target.type === 'text' || - (ig.system.hasFocusLost() && event.type === 'mouseup') - ) { - return; - } - - this.currentDevice = ig.INPUT_DEVICES.KEYBOARD_AND_MOUSE; - - let keyCode = this.getKeyCodeFromEvent(event); - - let action = this.bindings[keyCode]; - if (action != null) { - this.keyups[action] = true; - this.delayedKeyup.push(action); - event.stopPropagation(); - event.preventDefault(); - } - }, - - getKeyCodeFromEvent(event) { - switch (event.type) { - case 'keyup': - case 'keydown': - return event.keyCode; - - case 'mouseup': - case 'mousedown': - switch (event.button) { - case 0: - return ig.KEY.MOUSE_LEFT; - case 1: - return ig.KEY.MOUSE_MIDDLE; - case 2: - return ig.KEY.MOUSE_RIGHT; - case 3: - return ig.KEY.MOUSE_BACK; - case 4: - return ig.KEY.MOUSE_FORWARD; - } - } - - // idk, fall back to the left mouse button. That's kind of what the default - // implementation does though. - return ig.KEY.MOUSE_LEFT; - }, -}); - -// Finally, some nice injection places. -sc.KeyBinderGui.inject({ - show(...args) { - this.parent(...args); - window.addEventListener('mousedown', this.bindedKeyCheck, false); - }, - - hide(...args) { - this.parent(...args); - window.removeEventListener('mousedown', this.bindedKeyCheck); - }, - - onKeyCheck(event) { - event.preventDefault(); - - let keyCode = ig.input.getKeyCodeFromEvent(event); - if (ig.interact.isBlocked() || this._isBlackedListed(keyCode)) return; - - // This call was added by me. Just in case. Because the `stopPropagation` - // call in `ig.Input` saved me from re-binds of left/right mouse buttons to - // whatever else other than interactions with menus. - event.stopPropagation(); - - if (this.finishCallback != null) { - this.finishCallback(keyCode, this.isAlternative, false); - } - this.hide(); - }, -}); From 0ae31f4b531a9754c23b2d8a71b746aca0c0c58b Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 21 Jun 2021 20:35:06 +0300 Subject: [PATCH 668/713] [scripts/markdown2htmldoc] disable the shortcuts for emojis because Github doesn't render them --- script-resources/markdown2htmldoc/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script-resources/markdown2htmldoc/main.js b/script-resources/markdown2htmldoc/main.js index 9a55da8..896d9c0 100755 --- a/script-resources/markdown2htmldoc/main.js +++ b/script-resources/markdown2htmldoc/main.js @@ -64,7 +64,7 @@ let md = markdownIt({ }, }); md.use(markdownItTaskCheckbox); -md.use(markdownItEmoji); +md.use(markdownItEmoji, { shortcuts: {} }); md.use(markdownItHeaderAnchors); let markdownDocument = fs.readFileSync(args.INPUT_FILE || 0, args.input_encoding); From 85ef26db77d90a9356900394b93668725991f00d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 21 Jun 2021 21:27:42 +0300 Subject: [PATCH 669/713] [nvim] add an ftdetect script for PatchSteps files --- nvim/ftdetect/crosscode.vim | 1 + 1 file changed, 1 insertion(+) create mode 100644 nvim/ftdetect/crosscode.vim diff --git a/nvim/ftdetect/crosscode.vim b/nvim/ftdetect/crosscode.vim new file mode 100644 index 0000000..c4d0d2b --- /dev/null +++ b/nvim/ftdetect/crosscode.vim @@ -0,0 +1 @@ +au BufNewFile,BufRead *.json.patch setf json From d0dd645e29f9f179350ce6b4063e758025c588d6 Mon Sep 17 00:00:00 2001 From: Keanu Date: Wed, 23 Jun 2021 11:34:31 +0200 Subject: [PATCH 670/713] Added Dima's dotfiles as a submoddule. --- .gitmodules | 3 +++ dmitmel-dotfiles | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 dmitmel-dotfiles diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..6b506b3 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "dmitmel-dotfiles"] + path = dmitmel-dotfiles + url = https://github.com/dmitmel/dotfiles diff --git a/dmitmel-dotfiles b/dmitmel-dotfiles new file mode 160000 index 0000000..85ef26d --- /dev/null +++ b/dmitmel-dotfiles @@ -0,0 +1 @@ +Subproject commit 85ef26db77d90a9356900394b93668725991f00d From cbaab0c3b6d6624b5510f803fb31b285b0906be3 Mon Sep 17 00:00:00 2001 From: Keanu Date: Wed, 23 Jun 2021 11:58:30 +0200 Subject: [PATCH 671/713] [zsh] Source Dima's zshrc from mine --- zsh/zshrc | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 zsh/zshrc diff --git a/zsh/zshrc b/zsh/zshrc new file mode 100644 index 0000000..5c19c7d --- /dev/null +++ b/zsh/zshrc @@ -0,0 +1,3 @@ +SCRIPT_DIR="$( dirname "$( readlink -f "$0" )" )" + +source $SCRIPT_DIR/../dmitmel-dotfiles/zsh/zshrc From 97427c27ee87662e7fbb4ec4fb6b2c458a1448a2 Mon Sep 17 00:00:00 2001 From: Keanu Date: Wed, 23 Jun 2021 12:05:59 +0200 Subject: [PATCH 672/713] [scripts] Added old scripts. --- scripts/category-count | 39 +++++++++++++++++++++++++++++++++++++++ scripts/copy-env-var | 11 +++++++++++ 2 files changed, 50 insertions(+) create mode 100755 scripts/category-count create mode 100755 scripts/copy-env-var diff --git a/scripts/category-count b/scripts/category-count new file mode 100755 index 0000000..d5ae6c6 --- /dev/null +++ b/scripts/category-count @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Script to fetch commit messages and display the category frequencies. +# Example: +# 047c36c [Meta] Added README. +# 5b16912 [Init] Added scripts. +# +# Will output: +# Meta: 1 +# Init: 1 +# +# Authored by: +# Dmytro Meleshko + +git log --format='%s' | gawk ' + match($0, /^\s*\[([^\]]+)\]/, groups) { + stats[groups[1]] += 1 + } + END { + for (key in stats) { + print stats[key] "\t" key + } + } +' | sort --key=1 --numeric-sort | column -t -s $'\t' + +# Hellish abonation {{{ + # Authored by: + # Mijyuoon: + + # data=$(git log --oneline | awk -F '[][]' '{for (i=2; i<=NF; i+=2) {printf "%s ", $i}; print ""}') + # keys=$(echo "$data" | sort -u | uniq) + # + # for type in $data; do + # eval "count_$type="'$'"((count_$type+1))" + # done + # + # for type in $keys; do + # echo "$type: $(eval "echo "'$'"count_$type")" + # done +# }}} diff --git a/scripts/copy-env-var b/scripts/copy-env-var new file mode 100755 index 0000000..9a4d88d --- /dev/null +++ b/scripts/copy-env-var @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -euo pipefail + +if variable="$(set -euo pipefail; { + awk 'BEGIN{for(v in ENVIRON) print v}' +} | rofi -dmenu)" && [[ -n $variable ]]; then + + variable="${variable%% *}" + + echo ${!variable} | xclip -sel clip +fi From a1409e44410da26deefc7870fded10a256337b14 Mon Sep 17 00:00:00 2001 From: Keanu Date: Wed, 23 Jun 2021 12:11:32 +0200 Subject: [PATCH 673/713] [zsh] Added loading of files next to zshrc. --- zsh/functions.zsh | 3 +++ zsh/zshrc | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 zsh/functions.zsh diff --git a/zsh/functions.zsh b/zsh/functions.zsh new file mode 100644 index 0000000..c47c5e6 --- /dev/null +++ b/zsh/functions.zsh @@ -0,0 +1,3 @@ +#!/usr/bin/env zsh +# +silence() { $1 &>/dev/null } diff --git a/zsh/zshrc b/zsh/zshrc index 5c19c7d..0c049bb 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -1,3 +1,11 @@ -SCRIPT_DIR="$( dirname "$( readlink -f "$0" )" )" +#!/usr/bin/env zsh +K_ZSH_DOTFILES="${0:h}" + +# Get this file's current directory and source Dima's zshrc from there +SCRIPT_DIR="$( dirname "$( readlink -f "$0" )" )" source $SCRIPT_DIR/../dmitmel-dotfiles/zsh/zshrc + +for script in functions; do + source "$K_ZSH_DOTFILES/$script.zsh" +done From 19d80233265629b33cf57daf05a928239b0c73a8 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 23 Jun 2021 13:12:05 +0300 Subject: [PATCH 674/713] [zsh] add stuff from my local zshrc's --- zsh/aliases.zsh | 8 ++++++++ zsh/functions.zsh | 17 ++++++++++++++++- zsh/plugins.zsh | 11 ++++++++--- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 1a40d6f..99883bd 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -114,3 +114,11 @@ fi alias bytefmt2="numfmt --to=iec-i --suffix=B" alias bytefmt10="numfmt --to=si --suffix=B" + +if command_exists dragon-drag-and-drop && ! command_exists dragon; then + alias dragon='dragon-drag-and-drop' +fi + +if gnu_time_path="$(command_locate time)" && [[ -n "$gnu_time_path" ]]; then + alias gtime="${(q)gnu_time_path} -v" +fi diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 9448bea..d954b1e 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -20,7 +20,11 @@ viscd() { } } -command_exists() { command -v "$1" &>/dev/null; } +# Checks if a word can be meaningfully executed as a command (aliases, +# functions and builtins also count). +command_exists() { whence -- "$@" &>/dev/null; } +# Searches the command binary in PATH. +command_locate() { whence -p -- "$@"; } lazy_load() { local command="$1" @@ -125,3 +129,14 @@ sync_working_dir_load() { fi } alias cds="sync_working_dir_load" + +discord-avatar() { + setopt local_options err_return + if (( $# != 1 )); then + print >&2 "Usage: $0 [user_snowflake]" + return 1 + fi + local avatar_url + avatar_url="$(discord-whois --image-size 4096 --get 'Avatar' "$1")" + open "$avatar_url" +} diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index e28a17a..9088bed 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -14,8 +14,7 @@ _plugin completions-rustc 'https://raw.githubusercontent.com/rust-lang/zsh-confi _plugin completions-cargo 'https://raw.githubusercontent.com/rust-lang/cargo/master/src/etc/_cargo' from=url \ after_load='plugin-cfg-path fpath prepend ""' -rustup_bin="${commands[rustup]}" -if [[ -n "$rustup_bin" ]]; then +if rustup_bin="$(command_locate rustup)" && [[ -n "$rustup_bin" ]]; then rustup_comp_path="${ZSH_CACHE_DIR}/site-functions/_rustup" if [[ "$rustup_bin" -nt "$rustup_comp_path" || ! -s "$rustup_comp_path" ]]; then _perf_timer_start "generate rustup completions" @@ -23,7 +22,7 @@ if [[ -n "$rustup_bin" ]]; then _perf_timer_stop "generate rustup completions" fi unset rustup_comp_path -fi +fi; unset rustup_bin # compinit {{{ _perf_timer_start "compinit" @@ -137,4 +136,10 @@ if [[ "$TERM" != "linux" ]]; then fi fi +if (( _is_macos )); then + plugin retina 'https://raw.githubusercontent.com/lunixbochs/meta/master/utils/retina/retina.m' from=url \ + build='mkdir -p bin && gcc retina.m -framework Foundation -framework AppKit -o bin/retina' \ + after_load='plugin-cfg-path path prepend "bin"' +fi + unset _checkout_latest_version From f7714020076913202359c80ed22df3a37725b6a7 Mon Sep 17 00:00:00 2001 From: Keanu Date: Wed, 23 Jun 2021 12:27:02 +0200 Subject: [PATCH 675/713] [zsh] Implement loading of custom scripts. --- zsh/.gitignore | 1 + zsh/zshrc | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 zsh/.gitignore diff --git a/zsh/.gitignore b/zsh/.gitignore new file mode 100644 index 0000000..0d82d79 --- /dev/null +++ b/zsh/.gitignore @@ -0,0 +1 @@ +custom diff --git a/zsh/zshrc b/zsh/zshrc index 0c049bb..49d327b 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -1,11 +1,15 @@ #!/usr/bin/env zsh -K_ZSH_DOTFILES="${0:h}" - # Get this file's current directory and source Dima's zshrc from there -SCRIPT_DIR="$( dirname "$( readlink -f "$0" )" )" -source $SCRIPT_DIR/../dmitmel-dotfiles/zsh/zshrc +K_ZSH_DOTFILES="$( dirname "$( readlink -f "$0" )" )" +source $K_ZSH_DOTFILES/../dmitmel-dotfiles/zsh/zshrc for script in functions; do source "$K_ZSH_DOTFILES/$script.zsh" done + +if [[ -d "$K_ZSH_DOTFILES/custom" ]]; then + for script in $K_ZSH_DOTFILES/custom/*.zsh; do + source "$script" + done +fi From dfb667f578b4a854a9361e10239e37fc631a75c7 Mon Sep 17 00:00:00 2001 From: Keanu Date: Wed, 23 Jun 2021 18:20:37 +0200 Subject: [PATCH 676/713] [dmitmel] Update submodule --- dmitmel-dotfiles | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dmitmel-dotfiles b/dmitmel-dotfiles index 85ef26d..19d8023 160000 --- a/dmitmel-dotfiles +++ b/dmitmel-dotfiles @@ -1 +1 @@ -Subproject commit 85ef26db77d90a9356900394b93668725991f00d +Subproject commit 19d80233265629b33cf57daf05a928239b0c73a8 From 9a2334f9206c983ddc479352ad12779811fb3b13 Mon Sep 17 00:00:00 2001 From: Keanu Date: Wed, 23 Jun 2021 18:30:46 +0200 Subject: [PATCH 677/713] [CD] Added submodule update workflow. --- .github/workflows/sync.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/sync.yml diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 0000000..5696d4b --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,24 @@ +name: Update submodules + +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' + +jobs: + update: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Pull & update submodules recursively + run: | + git submodule update --init --recursive + git submodule update --recursive --remote + - name: Commit & push changes + run: | + git config --global user.name GitHub + git config --global user.email actions@github.com + git commit -am "[dmitmel] Update submodule" | true + git push From eb50331c5c1e021f3c2001b0bb1e253d3c1dddee Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 23 Jun 2021 20:05:27 +0300 Subject: [PATCH 678/713] [zsh] simplify the gtime alias --- zsh/aliases.zsh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 99883bd..b2c5a0a 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -119,6 +119,4 @@ if command_exists dragon-drag-and-drop && ! command_exists dragon; then alias dragon='dragon-drag-and-drop' fi -if gnu_time_path="$(command_locate time)" && [[ -n "$gnu_time_path" ]]; then - alias gtime="${(q)gnu_time_path} -v" -fi +alias gtime="command time -v" From d57d743a14e6884c9f8f1a4609f1a51be89c0df9 Mon Sep 17 00:00:00 2001 From: Keanu Date: Wed, 23 Jun 2021 19:17:04 +0200 Subject: [PATCH 679/713] [zsh] Added plugins. --- zsh/plugins.zsh | 24 ++++++++++++++++++++++++ zsh/zshrc | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 zsh/plugins.zsh diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh new file mode 100755 index 0000000..096ee73 --- /dev/null +++ b/zsh/plugins.zsh @@ -0,0 +1,24 @@ +#!/usr/bin/env zsh + +_plugin() { + _perf_timer_start "plugin $1" + plugin "$@" + _perf_timer_stop "plugin $1" +} + +_plugin keybase-compl 'https://raw.githubusercontent.com/fnoris/keybase-zsh-completion/master/_keybase' from=url \ + after_load='plugin-cfg-path fpath prepend ""' + +_plugin gitio 'denysdovhan/gitio-zsh' + +# from Dima, assuming it's based off of: +# https://github.com/dmitmel/dotfiles/blob/19d80233265629b33cf57daf05a928239b0c73a8/zsh/plugins.zsh#L17-L25 +if gh_bin="$(command_locate gh)" && [[ -n "$gh_bin" ]]; then + gh_comp_path="${ZSH_CACHE_DIR}/site-functions/_gh" + if [[ "$gh_bin" -nt "$gh_comp_path" || ! -s "$gh_comp_path" ]]; then + _perf_timer_start "generate gh completions" + "$gh_bin" completion -s zsh >| "$gh_comp_path" + _perf_timer_stop "generate gh completions" + fi + unset gh_comp_path +fi; unset gh_bin diff --git a/zsh/zshrc b/zsh/zshrc index 49d327b..6bd099f 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -4,7 +4,7 @@ K_ZSH_DOTFILES="$( dirname "$( readlink -f "$0" )" )" source $K_ZSH_DOTFILES/../dmitmel-dotfiles/zsh/zshrc -for script in functions; do +for script in functions plugins; do source "$K_ZSH_DOTFILES/$script.zsh" done From 4d1703c0fe98680d961a148bb1e79efd96f1e990 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 23 Jun 2021 20:23:42 +0300 Subject: [PATCH 680/713] Revert "[nvim] enable automatic markdown text wrapping" This reverts commit 002cb0fca8b2fd510bf25b0b3a4c42006c6a782f. --- nvim/coc-languages/javascript.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/coc-languages/javascript.vim b/nvim/coc-languages/javascript.vim index 8ea16b3..0356ad9 100644 --- a/nvim/coc-languages/javascript.vim +++ b/nvim/coc-languages/javascript.vim @@ -18,6 +18,6 @@ let g:coc_user_config['prettier'] = { \ 'bracketSpacing': v:true, \ 'jsxBracketSameLine': v:true, \ 'arrowParens': 'always', +\ 'proseWrap': 'preserve', \ 'disableSuccessMessage': v:true, -\ 'proseWrap': 'always', \ } From d27aa86af0452ebe69453ef0d0aba4c3a5b4e2a9 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 24 Jun 2021 17:51:28 +0300 Subject: [PATCH 681/713] [nvim] add bangs and aborts to every Vimscript function --- nvim/autoload/airline/themes/dotfiles.vim | 2 +- nvim/colors/dotfiles.vim | 4 ++-- nvim/plugin/completion.vim | 6 +++--- nvim/plugin/editing.vim | 6 +++--- nvim/plugin/files.vim | 24 +++++++++++------------ nvim/plugin/interface.vim | 4 ++-- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/nvim/autoload/airline/themes/dotfiles.vim b/nvim/autoload/airline/themes/dotfiles.vim index 0f7805f..a1ebe81 100644 --- a/nvim/autoload/airline/themes/dotfiles.vim +++ b/nvim/autoload/airline/themes/dotfiles.vim @@ -9,7 +9,7 @@ let s:palette = { \ } let s:colors = g:dotfiles_colorscheme_base16_colors -function! s:base16_color(fg, bg) +function! s:base16_color(fg, bg) abort let fg = s:colors[a:fg] let bg = s:colors[a:bg] return [fg.gui, bg.gui, fg.cterm, bg.cterm] diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index a9f7751..22ada40 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -21,12 +21,12 @@ " }}} " The highlighting function {{{ - function s:is_number(value) + function! s:is_number(value) abort return type(a:value) == v:t_number endfunction let s:colors = g:dotfiles_colorscheme_base16_colors - function s:hi(group, fg, bg, attr, sp) + function! s:hi(group, fg, bg, attr, sp) abort let fg = {} let bg = {} let attr = 'NONE' diff --git a/nvim/plugin/completion.vim b/nvim/plugin/completion.vim index 2789e40..894e52c 100644 --- a/nvim/plugin/completion.vim +++ b/nvim/plugin/completion.vim @@ -6,7 +6,7 @@ " }}} if !g:vim_ide - function IsCocEnabled() + function! IsCocEnabled() abort return 0 endfunction finish @@ -17,7 +17,7 @@ endif " coc mappings are enabled let g:coc_filetypes = [] - function IsCocEnabled() + function! IsCocEnabled() abort return index(g:coc_filetypes, &filetype) >= 0 endfunction @@ -64,7 +64,7 @@ endif " }}} " CocFormat {{{ - function s:CocFormat(range, line1, line2) abort + function! s:CocFormat(range, line1, line2) abort if a:range == 0 call CocAction('format') else diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index bf4ece6..f5f5336 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -12,7 +12,7 @@ set commentstring=//%s " Indentination {{{ - function SetIndent(expandtab, shiftwidth) + function! SetIndent(expandtab, shiftwidth) abort let &l:expandtab = a:expandtab let &l:shiftwidth = str2nr(a:shiftwidth) let &l:tabstop = &l:shiftwidth @@ -78,7 +78,7 @@ set commentstring=//%s nmap ] m'yygccp`'j nmap [ m'yygccP`'k - function! PutOutput(cmd) + function! PutOutput(cmd) abort let output = execute(a:cmd) execute "noswapfile pedit" "+" . fnameescape("setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile") fnameescape("preview://" . a:cmd) wincmd P @@ -179,7 +179,7 @@ set commentstring=//%s xnoremap ? ?\%>=line("'<")-1l\%<=line("'>")+1l " * and # in the Visual mode will search the selected text - function! s:VisualStarSearch(search_cmd) + function! s:VisualStarSearch(search_cmd) abort let tmp = @" normal! y let @/ = '\V' . substitute(escape(@", a:search_cmd . '\'), '\n', '\\n', 'g') diff --git a/nvim/plugin/files.vim b/nvim/plugin/files.vim index 2d8e228..386d16c 100644 --- a/nvim/plugin/files.vim +++ b/nvim/plugin/files.vim @@ -23,13 +23,13 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" nnoremap / :grep - function! s:grep_mapping_star_normal() + function! s:grep_mapping_star_normal() abort let word = expand("") if !empty(word) call feedkeys(":\grep " . shellescape('\b' . word . '\b', 1), 'n') endif endfunction - function! s:grep_mapping_star_visual() + function! s:grep_mapping_star_visual() abort let tmp = @" normal! y call feedkeys(":\grep " . shellescape(@", 1), 'n') @@ -71,7 +71,7 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" " DiffWithSaved {{{ " Compare current buffer with the actual (saved) file on disk - function s:DiffWithSaved() + function! s:DiffWithSaved() abort let filetype = &filetype diffthis vnew | read # | normal! ggdd @@ -84,7 +84,7 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" " Reveal {{{ " Reveal file in the system file explorer - function s:Reveal(path) + function! s:Reveal(path) abort if has('macunix') " only macOS has functionality to really 'reveal' a file, that is, to open " its parent directory in Finder and select this file @@ -101,7 +101,7 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" " Open {{{ " opens file or URL with a system program - function s:Open(path) + function! s:Open(path) abort " HACK: 2nd parameter of this function is called 'remote', it tells " whether to open a remote (1) or local (0) file. However, it doesn't work " as expected in this context, because it uses the 'gf' command if it's @@ -119,7 +119,7 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" " Yes, I know about the existence of :args, however it modifies the " argument list, so it doesn't play well with Obsession.vim because it " saves the argument list in the session file. - function s:EditGlob(...) + function! s:EditGlob(...) abort for glob in a:000 for name in glob(glob, 0, 1) execute 'edit' fnameescape(name) @@ -131,7 +131,7 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" " DragOut {{{ " Shows a window for draging (-and-dropping) the currently opened file out. - function s:DragOut(path) + function! s:DragOut(path) abort if empty(a:path) | return | endif if !executable('dragon-drag-and-drop') echoerr "Please install for the DragOut command to work." @@ -148,13 +148,13 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" " on save (BufWritePre) {{{ - function s:IsUrl(str) + function! s:IsUrl(str) abort return a:str =~# '\v^\w+://' endfunction " create directory {{{ " Creates the parent directory of the file if it doesn't exist - function s:CreateDirOnSave() + function! s:CreateDirOnSave() abort let file = expand('') " check if this is a regular file and its path is not a URL if empty(&buftype) && !s:IsUrl(file) @@ -165,7 +165,7 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" " }}} " fix whitespace {{{ - function s:FixWhitespaceOnSave() + function! s:FixWhitespaceOnSave() abort let pos = getpos('.') " remove trailing whitespace keeppatterns %s/\s\+$//e @@ -177,7 +177,7 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" " auto-format with Coc.nvim {{{ let g:coc_format_on_save_ignore = [] - function s:FormatOnSave() + function! s:FormatOnSave() abort let file = expand('') if IsCocEnabled() && !s:IsUrl(file) && index(g:coc_format_on_save_ignore, &filetype) < 0 silent CocFormat @@ -185,7 +185,7 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" endfunction " }}} - function s:OnSave() + function! s:OnSave() abort call s:FixWhitespaceOnSave() call s:FormatOnSave() call s:CreateDirOnSave() diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 769871c..eceb3c3 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -40,7 +40,7 @@ endif set confirm " Bbye with confirmation, or fancy buffer closer {{{ - function s:CloseBuffer(cmd) abort + function! s:CloseBuffer(cmd) abort let cmd = a:cmd if &modified " @@ -141,7 +141,7 @@ endif " Based on , inspired by " . " But apparently `vimgrep /pattern/ %` can be used instead? - function! s:CmdGlobal(pattern, bang) + function! s:CmdGlobal(pattern, bang) abort let pattern = substitute(a:pattern, "/.*$", "", "") let matches = [] execute "g" . (a:bang ? "!" : "") . "/" . pattern . "/call add(matches, expand(\"%\").\":\".line(\".\").\":\".col(\".\").\":\".getline(\".\"))" From 14db5e1902f3d1200fb6effbfaac7b5bfda21c26 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 24 Jun 2021 18:45:47 +0300 Subject: [PATCH 682/713] [zsh] increase the size of the history file --- zsh/options.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zsh/options.zsh b/zsh/options.zsh index 3679194..c99bcbf 100644 --- a/zsh/options.zsh +++ b/zsh/options.zsh @@ -40,9 +40,9 @@ setopt complete_in_word # strangely enough, Zsh doesn't save command history by default HISTFILE="${HISTFILE:-$HOME/.zsh_history}" # max number of entries stored in memory -HISTSIZE=50000 +HISTSIZE=100000 # max number of entries in the HISTFILE -SAVEHIST=10000 +SAVEHIST=80000 # record timestamps in the history setopt extended_history # delete duplicates first when HISTFILE size exceeds HISTSIZE From c98d336b838643b2edbe28ee815fbc09ffb31385 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 24 Jun 2021 19:18:15 +0300 Subject: [PATCH 683/713] [zsh] add an alias for a colorized wdiff --- zsh/aliases.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index b2c5a0a..05f7d5f 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -120,3 +120,6 @@ if command_exists dragon-drag-and-drop && ! command_exists dragon; then fi alias gtime="command time -v" + +# Inspired by . +alias cwdiff='wdiff --start-delete="${fg[red]}[-" --end-delete="-]${reset_color}" --start-insert="${fg[green]}{+" --end-insert "+}${reset_color}"' From eb36ebe24415a00dc1d262f353dd36b35c6b7000 Mon Sep 17 00:00:00 2001 From: Keanu Date: Thu, 24 Jun 2021 18:52:31 +0200 Subject: [PATCH 684/713] [nvim] Add config. --- nvim/init.vim | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 nvim/init.vim diff --git a/nvim/init.vim b/nvim/init.vim new file mode 100644 index 0000000..5731ee5 --- /dev/null +++ b/nvim/init.vim @@ -0,0 +1,19 @@ +" Enable the clearly superior mode. +let g:vim_ide = 1 + +" Source Dima's config +source :p:h/../dmitmel-dotfiles/nvim/init.vim + +" Add keybind for coc-explorer +nmap m :CocCommand explorer + +" Give me that beautiful colorscheme +set termguicolors + +" Copy to clipboard register and paste from clipboard register {{{ + " Taken from https://unix.stackexchange.com/a/23437 + nnoremap "+y + vnoremap "+y + nnoremap "+gP + vnoremap "+gP +" }}} From 2518aef7d02618af5fa5058c16bafbe2bd60edcc Mon Sep 17 00:00:00 2001 From: Keanu Date: Thu, 24 Jun 2021 18:53:49 +0200 Subject: [PATCH 685/713] [kitty] Add config. --- kitty/kitty.conf | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 kitty/kitty.conf diff --git a/kitty/kitty.conf b/kitty/kitty.conf new file mode 100644 index 0000000..bf1e1bf --- /dev/null +++ b/kitty/kitty.conf @@ -0,0 +1,14 @@ +# Include Dima's config. +include ../dmitmel-dotfiles/kitty/kitty.conf + +# I sure do love ligatures. +font_family Fira Code + +# Remember previous window size. (which will probably always be maximized) +remember_window_size yes + +# Disable the stupid bell. +enable_audio_bell no + +# The block confuses me, shush. +cursor_shape beam From b5211af5f1858d6a5e8115576855e27f2d36d198 Mon Sep 17 00:00:00 2001 From: GitHub Date: Fri, 25 Jun 2021 00:25:45 +0000 Subject: [PATCH 686/713] [dmitmel] Update submodule --- dmitmel-dotfiles | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dmitmel-dotfiles b/dmitmel-dotfiles index 19d8023..c98d336 160000 --- a/dmitmel-dotfiles +++ b/dmitmel-dotfiles @@ -1 +1 @@ -Subproject commit 19d80233265629b33cf57daf05a928239b0c73a8 +Subproject commit c98d336b838643b2edbe28ee815fbc09ffb31385 From 79e161252a40bb8161ade568ceb524643e44b852 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 25 Jun 2021 23:40:25 +0300 Subject: [PATCH 687/713] [nvim] make tcomment respect my favorite comment marker for Assembly --- nvim/plugin/editing.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index f5f5336..7c24336 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -273,6 +273,8 @@ set commentstring=//%s " Make an alias for the comment text object omap gc ac + let g:tcomment#ignore_comment_def = ['asm'] + " }}} From 9c3d20a026f8935f7f245a106e499945c1bc3332 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 26 Jun 2021 00:21:56 +0000 Subject: [PATCH 688/713] [dmitmel] Update submodule --- dmitmel-dotfiles | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dmitmel-dotfiles b/dmitmel-dotfiles index c98d336..79e1612 160000 --- a/dmitmel-dotfiles +++ b/dmitmel-dotfiles @@ -1 +1 @@ -Subproject commit c98d336b838643b2edbe28ee815fbc09ffb31385 +Subproject commit 79e161252a40bb8161ade568ceb524643e44b852 From a30bc8553487bd77e05189d8e091c08b94053198 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 26 Jun 2021 17:58:59 +0300 Subject: [PATCH 689/713] fixup! [nvim] set the keymap globally in the switcher --- nvim/plugin/editing.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 7c24336..94cc5cf 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -158,8 +158,7 @@ set commentstring=//%s nnoremap ku set keymap=ukrainian-jcuken-custom nnoremap DotfilesSwapKeymaps - let g:dotfiles_prev_keymap = &keymap - command! -nargs=0 DotfilesSwapKeymaps let [g:dotfiles_prev_keymap, &g:keymap] = [&g:keymap, g:dotfiles_prev_keymap] + command! -nargs=0 DotfilesSwapKeymaps let [b:dotfiles_prev_keymap, &keymap] = [&keymap, get(b:, 'dotfiles_prev_keymap', '')] " }}} From 24125e5272f8c93e0a08da8c08ce3736fa6528c2 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sun, 27 Jun 2021 00:26:45 +0000 Subject: [PATCH 690/713] [dmitmel] Update submodule --- dmitmel-dotfiles | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dmitmel-dotfiles b/dmitmel-dotfiles index 79e1612..a30bc85 160000 --- a/dmitmel-dotfiles +++ b/dmitmel-dotfiles @@ -1 +1 @@ -Subproject commit 79e161252a40bb8161ade568ceb524643e44b852 +Subproject commit a30bc8553487bd77e05189d8e091c08b94053198 From 95cf74e4546eb1b8028fa00e97dc0299f5bf652e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 27 Jun 2021 14:50:04 +0300 Subject: [PATCH 691/713] [nvim] use inline comments for C by default --- nvim/plugin/editing.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 94cc5cf..5d796fa 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -273,6 +273,7 @@ set commentstring=//%s omap gc ac let g:tcomment#ignore_comment_def = ['asm'] + let g:tcomment#commentstring_c = '// %s' " }}} From 82c01ffdbed07238aa9bf046c370d2d0dda71bb6 Mon Sep 17 00:00:00 2001 From: Keanu Date: Sun, 27 Jun 2021 14:15:35 +0200 Subject: [PATCH 692/713] [nvim] Split config up into separate files. --- nvim/dotfiles/plugins-list.vim | 1 + nvim/init.vim | 8 +++++--- nvim/plugin/keybinds.vim | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 nvim/dotfiles/plugins-list.vim create mode 100644 nvim/plugin/keybinds.vim diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim new file mode 100644 index 0000000..248c550 --- /dev/null +++ b/nvim/dotfiles/plugins-list.vim @@ -0,0 +1 @@ +Plug 'weirongxu/coc-explorer' diff --git a/nvim/init.vim b/nvim/init.vim index 5731ee5..6d7e20e 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,12 +1,14 @@ +let g:k_nvim_dotfiles_dir = expand(':p:h') +let g:k_dotfiles_dir = expand(':p:h:h') + +let &runtimepath = g:k_nvim_dotfiles_dir.','.&runtimepath.','.g:k_nvim_dotfiles_dir.'/after' + " Enable the clearly superior mode. let g:vim_ide = 1 " Source Dima's config source :p:h/../dmitmel-dotfiles/nvim/init.vim -" Add keybind for coc-explorer -nmap m :CocCommand explorer - " Give me that beautiful colorscheme set termguicolors diff --git a/nvim/plugin/keybinds.vim b/nvim/plugin/keybinds.vim new file mode 100644 index 0000000..b3ac4c2 --- /dev/null +++ b/nvim/plugin/keybinds.vim @@ -0,0 +1,2 @@ +" Add keybind for coc-explorer +nmap m :CocCommand explorer From 89e0cd0745d079ebc47d4ffa20500a594b23befc Mon Sep 17 00:00:00 2001 From: Keanu Date: Sun, 27 Jun 2021 17:31:14 +0200 Subject: [PATCH 693/713] [zsh] Add the project management tool. --- zsh/plugins.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index 096ee73..bb8480d 100755 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -11,6 +11,11 @@ _plugin keybase-compl 'https://raw.githubusercontent.com/fnoris/keybase-zsh-comp _plugin gitio 'denysdovhan/gitio-zsh' +_plugin project 'https://git.sr.ht/~keanucode/scripts/blob/master/project/project.zsh' from=url \ + build="wget -O listbox.zsh https://raw.githubusercontent.com/gko/listbox/master/listbox.zsh" \ + load="listbox.zsh" \ + load="project.zsh" \ + # from Dima, assuming it's based off of: # https://github.com/dmitmel/dotfiles/blob/19d80233265629b33cf57daf05a928239b0c73a8/zsh/plugins.zsh#L17-L25 if gh_bin="$(command_locate gh)" && [[ -n "$gh_bin" ]]; then From 778984c705f4fbfc7a7a819d6ea092a7f00da576 Mon Sep 17 00:00:00 2001 From: GitHub Date: Mon, 28 Jun 2021 00:24:48 +0000 Subject: [PATCH 694/713] [dmitmel] Update submodule --- dmitmel-dotfiles | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dmitmel-dotfiles b/dmitmel-dotfiles index a30bc85..95cf74e 160000 --- a/dmitmel-dotfiles +++ b/dmitmel-dotfiles @@ -1 +1 @@ -Subproject commit a30bc8553487bd77e05189d8e091c08b94053198 +Subproject commit 95cf74e4546eb1b8028fa00e97dc0299f5bf652e From 701638fde37f2565396b4123105d94aa37e614cb Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 28 Jun 2021 13:07:26 +0300 Subject: [PATCH 695/713] [nvim] FINALLY add a plugin for RISC-V assembly --- nvim/colors/dotfiles.vim | 6 ++++++ nvim/dotfiles/plugins-list.vim | 1 + nvim/plugin/editing.vim | 4 +++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index 22ada40..a181605 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -419,3 +419,9 @@ hi! link zshFunction Function hi! link zshVariable Variable " }}} + +" Assembly {{{ + hi! def link riscvRegister Variable + hi! def link riscvCSRegister Special + hi! def link riscvLabel Function +" }}} diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index 0f3b104..2b989a6 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -58,6 +58,7 @@ Plug 'sheerun/vim-polyglot' Plug 'chikamichi/mediawiki.vim' Plug 'ron-rs/ron.vim' + Plug 'kylelaker/riscv.vim' if g:vim_ide Plug 'neoclide/coc.nvim', { 'branch': 'release' } Plug 'dag/vim2hs' diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 5d796fa..de0e614 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -272,9 +272,11 @@ set commentstring=//%s " Make an alias for the comment text object omap gc ac - let g:tcomment#ignore_comment_def = ['asm'] let g:tcomment#commentstring_c = '// %s' + call tcomment#type#Define('asm', '# %s') + call tcomment#type#Define('riscv', '# %s') + " }}} From e15d2f07519f80eea2d801b113a4cf639e42bc18 Mon Sep 17 00:00:00 2001 From: Keanu Date: Mon, 28 Jun 2021 17:38:18 +0200 Subject: [PATCH 696/713] [nvim] Added Nim plugin. --- nvim/dotfiles/plugins-list.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index 248c550..d2f64d1 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -1 +1,7 @@ +" Files {{{ Plug 'weirongxu/coc-explorer' +" }}} + +" Language specific {{{ +Plug 'alaviss/nim.nvim' +" }}} From 1ec88ffdc3c5f6ab689930e54f0b0520c95f1329 Mon Sep 17 00:00:00 2001 From: Keanu Date: Mon, 28 Jun 2021 18:24:10 +0200 Subject: [PATCH 697/713] [zsh] Add Nim completions. --- zsh/plugins.zsh | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index bb8480d..9d56fb2 100755 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -6,24 +6,30 @@ _plugin() { _perf_timer_stop "plugin $1" } -_plugin keybase-compl 'https://raw.githubusercontent.com/fnoris/keybase-zsh-completion/master/_keybase' from=url \ - after_load='plugin-cfg-path fpath prepend ""' - _plugin gitio 'denysdovhan/gitio-zsh' +# Load the brilliant project management tool. _plugin project 'https://git.sr.ht/~keanucode/scripts/blob/master/project/project.zsh' from=url \ build="wget -O listbox.zsh https://raw.githubusercontent.com/gko/listbox/master/listbox.zsh" \ load="listbox.zsh" \ load="project.zsh" \ -# from Dima, assuming it's based off of: -# https://github.com/dmitmel/dotfiles/blob/19d80233265629b33cf57daf05a928239b0c73a8/zsh/plugins.zsh#L17-L25 -if gh_bin="$(command_locate gh)" && [[ -n "$gh_bin" ]]; then - gh_comp_path="${ZSH_CACHE_DIR}/site-functions/_gh" - if [[ "$gh_bin" -nt "$gh_comp_path" || ! -s "$gh_comp_path" ]]; then - _perf_timer_start "generate gh completions" - "$gh_bin" completion -s zsh >| "$gh_comp_path" - _perf_timer_stop "generate gh completions" - fi - unset gh_comp_path -fi; unset gh_bin +# Completions {{{ + # from Dima, assuming it's based off of: + # https://github.com/dmitmel/dotfiles/blob/19d80233265629b33cf57daf05a928239b0c73a8/zsh/plugins.zsh#L17-L25 + if gh_bin="$(command_locate gh)" && [[ -n "$gh_bin" ]]; then + gh_comp_path="${ZSH_CACHE_DIR}/site-functions/_gh" + if [[ "$gh_bin" -nt "$gh_comp_path" || ! -s "$gh_comp_path" ]]; then + _perf_timer_start "generate gh completions" + "$gh_bin" completion -s zsh >| "$gh_comp_path" + _perf_timer_stop "generate gh completions" + fi + unset gh_comp_path + fi; unset gh_bin + + _plugin nim-compl 'https://raw.githubusercontent.com/nim-lang/Nim/devel/tools/nim.zsh-completion' from=url \ + after_load='plugin-cfg-path fpath prepend ""' + + _plugin keybase-compl 'https://raw.githubusercontent.com/fnoris/keybase-zsh-completion/master/_keybase' from=url \ + after_load='plugin-cfg-path fpath prepend ""' +# }}} From 010f46a283ef3723c33036b70ada6babad82acca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Jun 2021 19:33:34 +0000 Subject: [PATCH 698/713] Bump prismjs from 1.23.0 to 1.24.0 in /script-resources/markdown2htmldoc Bumps [prismjs](https://github.com/PrismJS/prism) from 1.23.0 to 1.24.0. - [Release notes](https://github.com/PrismJS/prism/releases) - [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md) - [Commits](https://github.com/PrismJS/prism/compare/v1.23.0...v1.24.0) --- updated-dependencies: - dependency-name: prismjs dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- .../markdown2htmldoc/package.json | 2 +- script-resources/markdown2htmldoc/yarn.lock | 41 ++----------------- 2 files changed, 5 insertions(+), 38 deletions(-) diff --git a/script-resources/markdown2htmldoc/package.json b/script-resources/markdown2htmldoc/package.json index d85fba2..03ca511 100644 --- a/script-resources/markdown2htmldoc/package.json +++ b/script-resources/markdown2htmldoc/package.json @@ -11,7 +11,7 @@ "markdown-it": "12.0.6", "markdown-it-emoji": "2.0.0", "markdown-it-task-checkbox": "*", - "prismjs": "^1.23.0" + "prismjs": "^1.24.0" }, "devDependencies": { "eslint": "7.26.0", diff --git a/script-resources/markdown2htmldoc/yarn.lock b/script-resources/markdown2htmldoc/yarn.lock index 1ef4184..85b35c2 100644 --- a/script-resources/markdown2htmldoc/yarn.lock +++ b/script-resources/markdown2htmldoc/yarn.lock @@ -179,15 +179,6 @@ chalk@^4.0.0: optionalDependencies: fsevents "~2.3.1" -clipboard@^2.0.0: - version "2.0.8" - resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.8.tgz#ffc6c103dd2967a83005f3f61976aa4655a4cdba" - integrity sha512-Y6WO0unAIQp5bLmk1zdThRhgJt/x3ks6f30s3oE3H1mgIEU33XyQjEf8gsf6DxC7NPX8Y1SsNWjUjL/ywLnnbQ== - dependencies: - good-listener "^1.2.2" - select "^1.1.2" - tiny-emitter "^2.0.0" - color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" @@ -238,11 +229,6 @@ deep-is@^0.1.3: resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= -delegate@^3.1.2: - version "3.2.0" - resolved "https://registry.yarnpkg.com/delegate/-/delegate-3.2.0.tgz#b66b71c3158522e8ab5744f720d8ca0c2af59166" - integrity sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw== - doctrine@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" @@ -536,13 +522,6 @@ globals@^13.6.0: dependencies: type-fest "^0.20.2" -good-listener@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/good-listener/-/good-listener-1.2.2.tgz#d53b30cdf9313dffb7dc9a0d477096aa6d145c50" - integrity sha1-1TswzfkxPf+33JoNR3CWqm0UXFA= - dependencies: - delegate "^3.1.2" - has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" @@ -818,12 +797,10 @@ prettier@2.2.1: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== -prismjs@^1.23.0: - version "1.23.0" - resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.23.0.tgz#d3b3967f7d72440690497652a9d40ff046067f33" - integrity sha512-c29LVsqOaLbBHuIbsTxaKENh1N2EQBOHaWv7gkHN4dgRbxSREqDnDbtFJYdpPauS4YCplMSNCABQ6Eeor69bAA== - optionalDependencies: - clipboard "^2.0.0" +prismjs@^1.24.0: + version "1.24.0" + resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.24.0.tgz#0409c30068a6c52c89ef7f1089b3ca4de56be2ac" + integrity sha512-SqV5GRsNqnzCL8k5dfAjCNhUrF3pR0A9lTDSCUZeh/LIshheXJEaP0hwLz2t4XHivd2J/v2HR+gRnigzeKe3cQ== progress@^2.0.0: version "2.0.3" @@ -879,11 +856,6 @@ sass@^1.33.0: dependencies: chokidar ">=3.0.0 <4.0.0" -select@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d" - integrity sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0= - semver@^6.1.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" @@ -974,11 +946,6 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= -tiny-emitter@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz#1d1a56edfc51c43e863cbb5382a72330e3555423" - integrity sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q== - to-regex-range@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" From 5558f4f8a03e8d11aa46c6b998fc910a09542a52 Mon Sep 17 00:00:00 2001 From: GitHub Date: Tue, 29 Jun 2021 00:23:48 +0000 Subject: [PATCH 699/713] [dmitmel] Update submodule --- dmitmel-dotfiles | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dmitmel-dotfiles b/dmitmel-dotfiles index 95cf74e..d8db349 160000 --- a/dmitmel-dotfiles +++ b/dmitmel-dotfiles @@ -1 +1 @@ -Subproject commit 95cf74e4546eb1b8028fa00e97dc0299f5bf652e +Subproject commit d8db3497101c6ec76259a4d9218721c2a355720d From b927660c2f687a00f9a146b5623c85f19cc73c5e Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 29 Jun 2021 10:23:43 +0300 Subject: [PATCH 700/713] [nvim] disable the default mode indicator when airline is active --- nvim/plugin/interface.vim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index eceb3c3..de8091a 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -88,6 +88,7 @@ endif " Airline (statusline) {{{ + let g:airline_theme = 'dotfiles' let g:airline_symbols = { \ 'readonly': 'RO', @@ -117,6 +118,13 @@ endif let g:airline#extensions#tabline#left_sep = ' ' let g:airline#extensions#tabline#left_alt_sep = '' let g:airline#extensions#dotfiles_filesize#update_delay = 2 + + augroup vimrc-airline + autocmd! + autocmd User AirlineToggledOff set showmode + autocmd User AirlineToggledOn set noshowmode + augroup END + " }}} From 9d5f7d136b95619a7c31fead95833e915db442dc Mon Sep 17 00:00:00 2001 From: GitHub Date: Wed, 30 Jun 2021 00:24:43 +0000 Subject: [PATCH 701/713] [dmitmel] Update submodule --- dmitmel-dotfiles | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dmitmel-dotfiles b/dmitmel-dotfiles index d8db349..b927660 160000 --- a/dmitmel-dotfiles +++ b/dmitmel-dotfiles @@ -1 +1 @@ -Subproject commit d8db3497101c6ec76259a4d9218721c2a355720d +Subproject commit b927660c2f687a00f9a146b5623c85f19cc73c5e From 8f933e667b4dc11fb1e8ea878cc943ce8781c816 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 1 Jul 2021 19:14:37 +0300 Subject: [PATCH 702/713] [git] add .ccls-cache to the global ignore list --- git/gitignore_global | 3 ++- nvim/plugin/files.vim | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/git/gitignore_global b/git/gitignore_global index d5cb4b8..61d9754 100644 --- a/git/gitignore_global +++ b/git/gitignore_global @@ -1,5 +1,6 @@ Session.vim .project.vim .DS_Store -.ropeproject +.ropeproject/ +.ccls-cache/ *~ diff --git a/nvim/plugin/files.vim b/nvim/plugin/files.vim index 386d16c..dfe6ee9 100644 --- a/nvim/plugin/files.vim +++ b/nvim/plugin/files.vim @@ -11,7 +11,7 @@ nnoremap empty(&buftype) ? ":writewall\" : "\" if executable('rg') let s:rg_cmd = "rg --hidden --follow" let s:rg_ignore = split(&wildignore, ',') + [ - \ 'node_modules', 'target', 'build', 'dist', '.stack-work' + \ 'node_modules', 'target', 'build', 'dist', '.stack-work', '.ccls-cache' \ ] let s:rg_cmd .= " --glob '!{'" . shellescape(join(s:rg_ignore, ','), 1) . "'}'" From ccdeb31204e7787b6998f69baeedcb612c4c4853 Mon Sep 17 00:00:00 2001 From: GitHub Date: Fri, 2 Jul 2021 00:23:19 +0000 Subject: [PATCH 703/713] [dmitmel] Update submodule --- dmitmel-dotfiles | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dmitmel-dotfiles b/dmitmel-dotfiles index b927660..8f933e6 160000 --- a/dmitmel-dotfiles +++ b/dmitmel-dotfiles @@ -1 +1 @@ -Subproject commit b927660c2f687a00f9a146b5623c85f19cc73c5e +Subproject commit 8f933e667b4dc11fb1e8ea878cc943ce8781c816 From 19ff535b2b46328b20f8b70679a859e14fe4d720 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 2 Jul 2021 08:40:07 +0300 Subject: [PATCH 704/713] [nvim] disable fugitive's deprecated commands --- nvim/plugin/git.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvim/plugin/git.vim b/nvim/plugin/git.vim index 9c3c0c8..580209b 100644 --- a/nvim/plugin/git.vim +++ b/nvim/plugin/git.vim @@ -1,3 +1,6 @@ +" Aggressive unlearning of commands: +let g:fugitive_legacy_commands = 0 + " mappings {{{ let g:gitgutter_map_keys = 0 nnoremap gg :G From 395ea4806dcd55cf6566c8e43bc05db26c317cd6 Mon Sep 17 00:00:00 2001 From: Alyxia Sother Date: Fri, 2 Jul 2021 17:37:48 +0200 Subject: [PATCH 705/713] [scripts/wastickers] Added stickerpack generator --- scripts/wastickers | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 scripts/wastickers diff --git a/scripts/wastickers b/scripts/wastickers new file mode 100755 index 0000000..94848a7 --- /dev/null +++ b/scripts/wastickers @@ -0,0 +1,54 @@ +#!/bin/env zsh +# +## Enable MAX STRICTNESS mode +set -euo pipefail +setopt nomatch nullglob + +# Make checking for command existence easier +command_exists() { whence -- "$@" &>/dev/null; } + +# Create a temporary folder for pack generation which will be +# deleted at the very end of the process +cwd=$(pwd) +mkdir -p $cwd/tmp + +# Make sure the webp processing tool is present +if ! command_exists cwebp; then + echo "cwebp not found; Make sure it is installed. Exiting." + exit 1 +fi + +if ! command_exists zip; then + echo "zip not found; Make sure it is installed. Exiting." + exit 1 +fi + +# Read the metadata we will pipe to `author.txt` and `title.txt` +# Seriously, why are these separate text file? At the very least +# store the metadata somewhere reasonable such as a JSON file. +vared -p 'Author: ' -c author +vared -p 'Pack name: ' -c pname +echo "$author" > "$cwd/tmp/author.txt" +echo "$pname" > "$cwd/tmp/title.txt" + +for image in *.png *.jpg *.jpeg; do + cp "$image" "$cwd/tmp/" +done + +cd "$cwd/tmp" + +# Every copy of the images we made above will be converted +# into a webp, then the copy will be deleted. +# To make sure all images get a separate timestamp, we wait +# one second for every image. +for image in *.png *.jpg *.jpeg; do + cwebp -q 60 $image -o "$(date +%s).webp" > /dev/null 2>&1 + rm -rf $image + sleep 1 +done + +# Finally, pack up our stickers and clean up the temp dir +zip -r -j "$pname.wastickers" "$cwd/tmp"; +mv "$cwd/tmp/$pname.wastickers" "$cwd"; +cd "$cwd"; +rm -rf "$cwd/tmp"; From 71a04af8d770235eb5369cd4a3749054a453f6af Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 2 Jul 2021 22:39:21 +0300 Subject: [PATCH 706/713] [nvim] crank up visual customizations of coc.nvim --- .../airline/extensions/dotfiles_coclist.vim | 126 ++++++++++++++++++ nvim/colors/dotfiles.vim | 23 +++- nvim/plugin/completion.vim | 1 + nvim/plugin/editing.vim | 1 + nvim/plugin/interface.vim | 1 + 5 files changed, 146 insertions(+), 6 deletions(-) create mode 100644 nvim/autoload/airline/extensions/dotfiles_coclist.vim diff --git a/nvim/autoload/airline/extensions/dotfiles_coclist.vim b/nvim/autoload/airline/extensions/dotfiles_coclist.vim new file mode 100644 index 0000000..0e355ae --- /dev/null +++ b/nvim/autoload/airline/extensions/dotfiles_coclist.vim @@ -0,0 +1,126 @@ +if !exists('g:did_coc_loaded') + finish +endif + +function! airline#extensions#dotfiles_coclist#init(ext) abort + let g:coc_user_config['list.statusLineSegments'] = v:null + + call a:ext.add_statusline_func('airline#extensions#dotfiles_coclist#apply') + call a:ext.add_inactive_statusline_func('airline#extensions#dotfiles_coclist#apply') + + call airline#parts#define('dotfiles_coclist_mode', { + \ 'function': 'airline#extensions#dotfiles_coclist#part_mode', + \ 'accent': 'bold', + \ }) + call airline#parts#define('dotfiles_coclist_args', { + \ 'function': 'airline#extensions#dotfiles_coclist#part_args', + \ }) + call airline#parts#define('dotfiles_coclist_name', { + \ 'function': 'airline#extensions#dotfiles_coclist#part_name', + \ }) + call airline#parts#define('dotfiles_coclist_cwd', { + \ 'function': 'airline#extensions#dotfiles_coclist#part_cwd', + \ }) + call airline#parts#define('dotfiles_coclist_loading', { + \ 'function': 'airline#extensions#dotfiles_coclist#part_loading', + \ }) + call airline#parts#define('dotfiles_coclist_total', { + \ 'function': 'airline#extensions#dotfiles_coclist#part_total', + \ }) + + " Default airline section setup: + " + " Beware that whitespaces in function expansions can cause some weirdness: + " + let s:section_a = airline#section#create_left(['dotfiles_coclist_mode']) + let s:section_b = airline#section#create(['dotfiles_coclist_name']) + let s:section_c = airline#section#create(['%<', 'dotfiles_coclist_args', ' ', 'dotfiles_coclist_loading']) + let s:section_x = airline#section#create(['dotfiles_coclist_cwd']) + let s:section_y = airline#section#create(['#%L/', 'dotfiles_coclist_total']) + let s:section_z = airline#section#create(['%p%%', 'linenr', 'maxlinenr']) +endfunction + +function! airline#extensions#dotfiles_coclist#statusline() abort + let context = { 'winnr': winnr(), 'active': 1, 'bufnr': bufnr() } + let builder = airline#builder#new(context) + call airline#extensions#dotfiles_coclist#apply(builder, context) + return builder.build() +endfunction + +function! airline#extensions#dotfiles_coclist#apply(builder, context) abort + if getbufvar(a:context.bufnr, '&filetype', '') !=# 'list' | return 0 | endif + let list_status = getbufvar(a:context.bufnr, 'list_status', 0) + if type(list_status) !=# v:t_dict | return 0 | endif + + " How b:list_status is populated: + " + " How the list buffer is created: + " + " The default statusline: + " + " How airline generates its actual statuslines: + " + " + " + + let spc = g:airline_symbols.space + if a:context.active || (!a:context.active && !g:airline_inactive_collapse) + call a:builder.add_section('airline_a', s:get_section('a')) + call a:builder.add_section('airline_b', s:get_section('b')) + endif + call a:builder.add_section('airline_c', s:get_section('c')) + call a:builder.split() + call a:builder.add_section('airline_x', s:get_section('x')) + call a:builder.add_section('airline_y', s:get_section('y')) + call a:builder.add_section('airline_z', s:get_section('z')) + + return 1 +endfunction + +" Copied from +let s:section_truncate_width = get(g:, 'airline#extensions#default#section_truncate_width', { +\ 'b': 79, +\ 'x': 60, +\ 'y': 88, +\ 'z': 45, +\ }) + +function! s:get_section(key) abort + if has_key(s:section_truncate_width, a:key) && airline#util#winwidth() < s:section_truncate_width[a:key] + return '' + endif + let spc = g:airline_symbols.space + let text = s:section_{a:key} + if empty(text) | return '' | endif + return '%(' . spc . text . spc . '%)' +endfunction + +" TODO: Is recoloring of the section A based on `b:list_status.mode` possible? +function! airline#extensions#dotfiles_coclist#part_mode() abort + if get(w:, 'airline_active', 1) + " + return airline#util#shorten(get(b:list_status, 'mode', ''), 79, 1) + else + return get(g:airline_mode_map, '__') + else +endfunction + +function! airline#extensions#dotfiles_coclist#part_args() abort + return get(b:list_status, 'args', '') +endfunction + +function! airline#extensions#dotfiles_coclist#part_name() abort + return get(b:list_status, 'name', '') +endfunction + +function! airline#extensions#dotfiles_coclist#part_loading() abort + return get(b:list_status, 'loading', '') +endfunction + +function! airline#extensions#dotfiles_coclist#part_total() abort + return get(b:list_status, 'total', '') +endfunction + +function! airline#extensions#dotfiles_coclist#part_cwd() abort + return pathshorten(fnamemodify(get(b:list_status, 'cwd', ''), ':~:.')) +endfunction diff --git a/nvim/colors/dotfiles.vim b/nvim/colors/dotfiles.vim index a181605..03db6bd 100644 --- a/nvim/colors/dotfiles.vim +++ b/nvim/colors/dotfiles.vim @@ -62,6 +62,7 @@ call s:hi('Title', 0xD, '', '', '') hi! link Directory Title call s:hi('Conceal', 0xC, '', '', '') + call s:hi('IndentLine', 0x2, '', '', '') call s:hi('NonText', 0x3, '', '', '') hi! link SpecialKey Special call s:hi('MatchParen', 'fg', 0x3, '', '') @@ -107,12 +108,22 @@ call s:hi('WarningMsg', 0x9, '', '', '') call s:hi('TooLong', 0x8, '', '', '') call s:hi('Debug', 0x8, '', '', '') - hi! link CocErrorSign Error - call s:hi('CocWarningSign', 'bg', 0xA, '', '') - call s:hi('CocInfoSign', 'bg', 0xD, '', '') - hi! link CocHintSign CocInfoSign - call s:hi('CocFadeOut', 0x3, '', '', '') - hi! link CocMarkdownLink Underlined + + call s:hi('CocErrorSign', 'bg', 0x8, '', '') + call s:hi('CocWarningSign', 'bg', 0xA, '', '') + call s:hi('CocInfoSign', 'bg', 0xD, '', '') + hi! link CocHintSign CocInfoSign + call s:hi('CocSelectedText', 0xE, 0x1, 'bold', '') + call s:hi('CocCodeLens', 0x4, '', '', '') + call s:hi('CocFadeOut', 0x3, '', '', '') + call s:hi('CocStrikeThrough', '', '', 'strikethrough', '') + hi! link CocMarkdownLink Underlined + hi! link CocDiagnosticsFile Directory + hi! link CocOutlineName NONE + hi! link CocExtensionsLoaded NONE + hi! link CocSymbolsName NONE + hi! link CocOutlineIndentLine IndentLine + hi! link CocSymbolsFile Directory call s:hi('FoldColumn', 0xC, 0x1, '', '') call s:hi('Folded', 0x3, 0x1, '', '') diff --git a/nvim/plugin/completion.vim b/nvim/plugin/completion.vim index 894e52c..bec2c0f 100644 --- a/nvim/plugin/completion.vim +++ b/nvim/plugin/completion.vim @@ -90,6 +90,7 @@ endif \ } let g:coc_user_config['suggest.floatEnable'] = v:false let g:coc_user_config['workspace.progressTarget'] = "statusline" + let g:coc_user_config['list.selectedSignText'] = '> ' runtime! coc-languages/*.vim diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index de0e614..658adf4 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -30,6 +30,7 @@ set commentstring=//%s let g:indentLine_first_char = g:indentLine_char let g:indentLine_showFirstIndentLevel = 1 let g:indentLine_fileTypeExclude = ['text', 'help', 'tutor', 'man'] + let g:indentLine_defaultGroup = 'IndentLine' augroup vimrc-indentlines-disable autocmd! diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index de8091a..183ec89 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -113,6 +113,7 @@ endif \ 'obsession', \ 'dotfiles_tweaks', \ 'dotfiles_filesize', + \ 'dotfiles_coclist', \ ] let g:airline_detect_iminsert = 1 let g:airline#extensions#tabline#left_sep = ' ' From 1675c8174a2582ab09c4ac79ee3f28c00b641e8d Mon Sep 17 00:00:00 2001 From: Alyxia Sother Date: Fri, 2 Jul 2021 22:20:57 +0200 Subject: [PATCH 707/713] [scripts/wastickers] Rewrote in Python This rewrite was nessecary, since, apparently, the format of the sticker packs that WhatsApp reads is a bit... weird. All files start with a leading slash, which the default `zip` program strips before packing. The `zipfile` module in Python does not have this check, so it was a nessecary sacrifice. --- scripts/wastickers | 91 +++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/scripts/wastickers b/scripts/wastickers index 94848a7..aaa058d 100755 --- a/scripts/wastickers +++ b/scripts/wastickers @@ -1,54 +1,55 @@ -#!/bin/env zsh -# -## Enable MAX STRICTNESS mode -set -euo pipefail -setopt nomatch nullglob +#!/bin/env python +import os +from shutil import copyfile, rmtree +import subprocess +from glob import glob +import time +import pathlib +from zipfile import ZipFile -# Make checking for command existence easier -command_exists() { whence -- "$@" &>/dev/null; } +cwd = os.getcwd() +pathlib.Path(f'./tmp').mkdir(parents=True, exist_ok=True) -# Create a temporary folder for pack generation which will be -# deleted at the very end of the process -cwd=$(pwd) -mkdir -p $cwd/tmp +# taken from https://stackoverflow.com/a/34177358 +def is_tool(name: str): + from shutil import which + return which(name) is not None -# Make sure the webp processing tool is present -if ! command_exists cwebp; then - echo "cwebp not found; Make sure it is installed. Exiting." - exit 1 -fi +if is_tool('cwebp') == False: + print('cwebp not found; Make sure it is installed. Exiting.') + exit(1) -if ! command_exists zip; then - echo "zip not found; Make sure it is installed. Exiting." - exit 1 -fi +if is_tool('zip') == False: + print('zip not found; Make sure it is installed. Exiting.') + exit(1) -# Read the metadata we will pipe to `author.txt` and `title.txt` -# Seriously, why are these separate text file? At the very least -# store the metadata somewhere reasonable such as a JSON file. -vared -p 'Author: ' -c author -vared -p 'Pack name: ' -c pname -echo "$author" > "$cwd/tmp/author.txt" -echo "$pname" > "$cwd/tmp/title.txt" +author = input('Author: ') +pname = input('Pack name: ') -for image in *.png *.jpg *.jpeg; do - cp "$image" "$cwd/tmp/" -done +with open(f'./tmp/title.txt', 'w') as f: + f.write(pname) +with open(f'./tmp/author.txt', 'w') as f: + f.write(author) -cd "$cwd/tmp" +files = glob(f'./*.png') + glob(f'./*.jpg') + glob(f'./*.jpeg') +for file in files: + copyfile(file, f'./tmp/{file}') -# Every copy of the images we made above will be converted -# into a webp, then the copy will be deleted. -# To make sure all images get a separate timestamp, we wait -# one second for every image. -for image in *.png *.jpg *.jpeg; do - cwebp -q 60 $image -o "$(date +%s).webp" > /dev/null 2>&1 - rm -rf $image - sleep 1 -done +os.chdir(f'{cwd}/tmp') -# Finally, pack up our stickers and clean up the temp dir -zip -r -j "$pname.wastickers" "$cwd/tmp"; -mv "$cwd/tmp/$pname.wastickers" "$cwd"; -cd "$cwd"; -rm -rf "$cwd/tmp"; +for file in files: + epoch = int(time.time()) + print(f"Converting {file}...") + subprocess.run(['cwebp', '-q', '60', file, '-o', str(epoch) + '.webp'], stdout=open(os.devnull, 'w'), stderr=subprocess.STDOUT) + os.remove(f'./{file}') + time.sleep(1) + +files = glob('./*') +with ZipFile(f'{pname}.wastickers', 'w') as zip: + for file in files: + with open(file, 'rb') as image_file: + zip.writestr(f"/{file}", image_file.read()) + +os.chdir(cwd) +copyfile(f'./tmp/{pname}.wastickers', f'./{pname}.wastickers') +rmtree('./tmp') From 6715440edc593d40ee100d0cf39227230e744ad6 Mon Sep 17 00:00:00 2001 From: Alyxia Sother Date: Fri, 2 Jul 2021 23:30:42 +0200 Subject: [PATCH 708/713] [scripts/wastickers] Fixed paths and enabled compression --- scripts/wastickers | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/wastickers b/scripts/wastickers index aaa058d..5ffbdae 100755 --- a/scripts/wastickers +++ b/scripts/wastickers @@ -5,7 +5,7 @@ import subprocess from glob import glob import time import pathlib -from zipfile import ZipFile +from zipfile import ZipFile, ZIP_STORED cwd = os.getcwd() pathlib.Path(f'./tmp').mkdir(parents=True, exist_ok=True) @@ -45,10 +45,11 @@ for file in files: time.sleep(1) files = glob('./*') -with ZipFile(f'{pname}.wastickers', 'w') as zip: +with ZipFile(f'{pname}.wastickers', 'w', ZIP_STORED) as zip: for file in files: + zipfilename = file.replace('./', '/') with open(file, 'rb') as image_file: - zip.writestr(f"/{file}", image_file.read()) + zip.writestr(f"{zipfilename}", image_file.read()) os.chdir(cwd) copyfile(f'./tmp/{pname}.wastickers', f'./{pname}.wastickers') From aa1c5d4c4b69c9b1771bc345cc810ad473a870e5 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 3 Jul 2021 00:26:42 +0000 Subject: [PATCH 709/713] [dmitmel] Update submodule --- dmitmel-dotfiles | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dmitmel-dotfiles b/dmitmel-dotfiles index 8f933e6..71a04af 160000 --- a/dmitmel-dotfiles +++ b/dmitmel-dotfiles @@ -1 +1 @@ -Subproject commit 8f933e667b4dc11fb1e8ea878cc943ce8781c816 +Subproject commit 71a04af8d770235eb5369cd4a3749054a453f6af From 2504ef1135bc660c7cbff02db7b44e396e572178 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 3 Jul 2021 10:06:54 +0300 Subject: [PATCH 710/713] Revert "[nvim] use wildmenu" This reverts commit 5ad510c830b799a26d5829f10eba31ffbc45d397. --- nvim/plugin/interface.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nvim/plugin/interface.vim b/nvim/plugin/interface.vim index 183ec89..0c188f1 100644 --- a/nvim/plugin/interface.vim +++ b/nvim/plugin/interface.vim @@ -1,3 +1,9 @@ +" Replicate the behavior of Zsh's complist module under my configuration. +" 1st - complete till the longest common prefix (longest). +" 2nd - list the matches, but don't select or complete anything yet (list). +" 3rd - start the selection menu (i.e. wildmenu), select and complete the first match (full). +set wildmenu wildmode=longest,list,full + " always show the sign column set signcolumn=yes From a4dc62e790d4a2bd0cd0d1d500df63a14ba04aed Mon Sep 17 00:00:00 2001 From: Alyxia Sother Date: Sat, 3 Jul 2021 12:41:01 +0200 Subject: [PATCH 711/713] [nvim] Use Powerline fonts for the statusline --- nvim/init.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/init.vim b/nvim/init.vim index 6d7e20e..68c72a2 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -11,6 +11,7 @@ source :p:h/../dmitmel-dotfiles/nvim/init.vim " Give me that beautiful colorscheme set termguicolors +let airline_powerline_fonts = 1 " Copy to clipboard register and paste from clipboard register {{{ " Taken from https://unix.stackexchange.com/a/23437 From 0b2a1cc0ea24530073614a4d4177de3a827d915d Mon Sep 17 00:00:00 2001 From: Keanu Date: Sat, 3 Jul 2021 12:45:22 +0200 Subject: [PATCH 712/713] [nvim] Added RPC plugin for 0.5.0. --- nvim/dotfiles/plugins-list.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index d2f64d1..061cedc 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -5,3 +5,9 @@ Plug 'weirongxu/coc-explorer' " Language specific {{{ Plug 'alaviss/nim.nvim' " }}} + +" Misc {{{ + if has('nvim-0.5.0') + Plug 'andweeb/presence.nvim' + endif +" }}} From 3702760f68dadfb6a102eb350a50363f88656726 Mon Sep 17 00:00:00 2001 From: Keanu Date: Sat, 3 Jul 2021 12:48:56 +0200 Subject: [PATCH 713/713] [nvim] Added coc plugin for Shell. --- nvim/coc-languages/sh.vim | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 nvim/coc-languages/sh.vim diff --git a/nvim/coc-languages/sh.vim b/nvim/coc-languages/sh.vim new file mode 100644 index 0000000..293dd51 --- /dev/null +++ b/nvim/coc-languages/sh.vim @@ -0,0 +1,2 @@ +let g:coc_global_extensions += ['coc-sh'] +let g:coc_filetypes += ['sh', 'zsh']