From ab7320297f5aaade4fb40d440b6f65a12286c7e3 Mon Sep 17 00:00:00 2001 From: Keanu Date: Thu, 31 Dec 2020 16:02:00 +0000 Subject: [PATCH 01/60] [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 02/60] [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 03/60] [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 04/60] [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 05/60] 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 62611bb01e4a87a7f00b5d1dec9729127f8aec2e Mon Sep 17 00:00:00 2001 From: Keanu Date: Sun, 17 Jan 2021 12:07:14 +0100 Subject: [PATCH 06/60] [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 07/60] 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 08/60] 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 09/60] 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 3d7078d8a14d4a282e0251ef41e08b76a9233133 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 18 Jan 2021 11:18:34 +0200 Subject: [PATCH 10/60] [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 819e5e5a33d70eea8dc7c79365d17eeb3dc58517 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 20 Jan 2021 10:45:30 +0200 Subject: [PATCH 11/60] 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 4cc4389455b9d885ebe615dab2108c49085e07f5 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 20 Jan 2021 17:37:55 +0200 Subject: [PATCH 12/60] [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 06ff96bf30dd53c3331fa633326e699a5e45d04d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 21 Jan 2021 12:49:13 +0200 Subject: [PATCH 13/60] [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 4b6cf8c56a7492bbb7715a06b40a9831677fc7e7 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 25 Jan 2021 11:04:02 +0200 Subject: [PATCH 14/60] [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 e277f19ed3af53372af0aae719731e34edeb4e86 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 25 Jan 2021 18:37:50 +0200 Subject: [PATCH 15/60] [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 16/60] [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 1e50762fcbd7244678d15f6d95d55715c13798e0 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 29 Jan 2021 01:37:49 +0200 Subject: [PATCH 17/60] [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 b45d969f0cd9779d303b309947318c35925a90a8 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 29 Jan 2021 12:34:26 +0200 Subject: [PATCH 18/60] [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 19/60] [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 57f0e01b511f459a43f792723c8948f0746b5165 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 1 Feb 2021 12:44:49 +0200 Subject: [PATCH 20/60] [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 ed93c816f90795828bfe45c2c3db1d97e899254f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 2 Feb 2021 22:28:48 +0200 Subject: [PATCH 21/60] [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 22/60] [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 18700a8198434b63961b0a9afbccd9d3a69d8516 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 4 Feb 2021 14:52:53 +0200 Subject: [PATCH 23/60] [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 bcf58ced93a261e941809095073fabd7264c0714 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 4 Feb 2021 19:29:41 +0200 Subject: [PATCH 24/60] [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 25/60] [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 a27c05856a790e268a323a8be9f317204f38fc4f Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 5 Feb 2021 11:13:25 +0200 Subject: [PATCH 26/60] [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 27/60] [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 28/60] [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 a59a693e98a56e93a9d26855abc40f397da72824 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 7 Feb 2021 19:49:38 +0200 Subject: [PATCH 29/60] [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 33ed3720c813d9623ceaea2c1c84315746932606 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 8 Feb 2021 20:07:02 +0200 Subject: [PATCH 30/60] [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 31/60] [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 851a494eb0b6be7bc6f48f6d6e3c7d358dd53b40 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 8 Feb 2021 21:51:59 +0200 Subject: [PATCH 32/60] [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 6bd741c2368af99ddfcf9d74eda95ce0f7b104e6 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 9 Feb 2021 12:29:15 +0200 Subject: [PATCH 33/60] [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 2a0ffb0cf59554bbfa981e17cd91f8507b2c6e0d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 12 Feb 2021 10:21:53 +0200 Subject: [PATCH 34/60] [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 35/60] [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 36/60] [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 9555e5f7068ee579f723080bc43d9a7abd665c20 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 12 Feb 2021 15:27:03 +0200 Subject: [PATCH 37/60] [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 f9051aff76bdf2c3e9a0ebd862db6b7d48df2ca7 Mon Sep 17 00:00:00 2001 From: Keanu Date: Fri, 19 Feb 2021 21:47:22 +0100 Subject: [PATCH 38/60] 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 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 39/60] 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 40/60] [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 9253cb6a08f17bd1a2613bfbbe40975429e94dd6 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 5 Apr 2021 02:06:23 +0300 Subject: [PATCH 41/60] [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: Tue, 27 Apr 2021 14:48:16 +0300 Subject: [PATCH 42/60] [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 fcf01bf6a9b439a5d903d86fc0947804f9946292 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Thu, 6 May 2021 15:34:09 +0300 Subject: [PATCH 43/60] 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 44/60] [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 45/60] [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 46/60] [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 47/60] [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 48/60] [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 49/60] [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 84ad770f3df25ee0068d5dd8a7c624361fb9bbe2 Mon Sep 17 00:00:00 2001 From: Keanu Date: Mon, 10 May 2021 12:52:04 +0200 Subject: [PATCH 50/60] [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 51/60] [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 52/60] [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 53/60] [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 54/60] [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 55/60] [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 7eb8ac07728f2f026a09790466881e2bb147aaab Mon Sep 17 00:00:00 2001 From: Keanu Date: Fri, 14 May 2021 10:05:35 +0200 Subject: [PATCH 56/60] [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 030c018bb4a1c51ffa6895b2840c578d37db1053 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 16 May 2021 15:55:17 +0300 Subject: [PATCH 57/60] [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 85b179e60dda2ba2b7b90bd96d7d7e9ade148612 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 29 May 2021 14:55:41 +0300 Subject: [PATCH 58/60] [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 59/60] [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 60/60] [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 {{{