=various edits and improvments

This commit is contained in:
Gal Szkolnik 2022-09-21 01:54:10 -04:00
parent 71e8da7289
commit f38f61cc6d
6 changed files with 230 additions and 191 deletions

View File

@ -54,3 +54,32 @@
exact = true
refreshPeriod = "168h" # 7 days
[".config/Code/Dictionaries/English (American).dic"]
type = "file"
url = "https://raw.githubusercontent.com/titoBouzout/Dictionaries/master/English%20(American).dic"
refreshPeriod = "168h" # 7 days
[".config/Code/Dictionaries/English (American).aff"]
type = "file"
url = "https://raw.githubusercontent.com/titoBouzout/Dictionaries/master/English%20(American).aff"
refreshPeriod = "168h" # 7 days
[".config/Code/Dictionaries/English (American).txt"]
type = "file"
url = "https://raw.githubusercontent.com/titoBouzout/Dictionaries/master/English%20(American).txt"
refreshPeriod = "168h" # 7 days
[".config/Code/Dictionaries/Hebrew (Israel).dic"]
type = "file"
url = "https://raw.githubusercontent.com/titoBouzout/Dictionaries/master/Hebrew%20(Israel).dic"
refreshPeriod = "168h" # 7 days
[".config/Code/Dictionaries/Hebrew (Israel).aff"]
type = "file"
url = "https://raw.githubusercontent.com/titoBouzout/Dictionaries/master/Hebrew%20(Israel).aff"
refreshPeriod = "168h" # 7 days
[".config/Code/Dictionaries/Hebrew (Israel).txt"]
type = "file"
url = "https://raw.githubusercontent.com/titoBouzout/Dictionaries/master/Hebrew%20(Israel).txt"
refreshPeriod = "168h" # 7 days

View File

@ -11,6 +11,8 @@ alias sz-edshrc="ed ~/.sz.shrc.d ; exec $SHELL"
[[ -z "$(env inkscape 2> /dev/null)" && -n "$(flatpak info org.inkscape.Inkscape 2> /dev/null)" ]] && alias inkscape="flatpak run org.inkscape.Inkscape "
alias cdgit='cd $(git rev-parse --show-toplevel) '
function clip() {
xclip -i -sel clipboard
}

View File

@ -1,127 +0,0 @@
TERRAFORM_BIN=$(which-command terraform | head -1)
if [[ -x $TERRAFORM_BIN ]]; then
function tfcontext() {
[[ -n $(find $PWD -name '*.tf') ]] || return -1
[[ -d _logs ]] || mkdir _logs
TF_VAR_FILE_NAME=${TF_VAR_FILE_CLI-:$(basename $PWD).tfvars}
[[ -r $TF_VAR_FILE_NAME ]] || unset TF_VAR_FILE_NAME
TF_VAR_FILE_CLI=${TF_VAR_FILE_CLI-:-var-file='$TF_VAR_FILE_NAME'}
basename $PWD
}
function _tf_sedFullStop() {
sed --unbuffered '/^===FULLSTOP===$/q' | sed --unbuffered '/^===FULLSTOP===$/d'
}
function less-tf() {
local _TF_LOG_FILE=${1-_logs/0_0_lastrun.log}
[[ "$1" == "-" ]] && _TF_LOG_FILE='_logs/0_0_lastrun.log'
[[ -z "$SZ_DEBUG" ]] || echo "lessts: ${@} | LESS_NO_WAIT = '${LESS_NO_WAIT}'"
[[ "$1" == "-" ]] && {
[[ -z "$SZ_DEBUG" ]] || echo "tailing..."
trap : INT;
tail -f $_TF_LOG_FILE | _tf_sedFullStop;
} \
|| { [[ -z "${LESS_NO_WAIT}" ]] \
&& {
[[ -z "$SZ_DEBUG" ]] || echo "Invoking less..."
less \
--no-init \
--raw-control-chars \
--line-numbers \
--quiet \
--hilite-unread \
--incsearch \
--ignore-case \
--force \
"${@:2}" -- \
"$_TF_LOG_FILE"
#\
#'+G?([^\w\W][\[0-9m+])Plan:' \
#'+3k'
}
}
}
function _tfSetLogTS() {
export TF_LOG_TS=$(date -d "today" +"%Y%m%d%H%M%S")
}
function tf() {
[[ -z "$TF_LOG_TS" ]] && _tfSetLogTS
local NAME=$1
[[ "${@}" =~ "-destroy" ]] && NAME="$1-destroy"
echo "===_logs/0_$NAME.log===" > _logs/0_0_lastrun.log
echo "===_logs/${TF_LOG_TS}_$NAME.log===" \
| tee --append _logs/0_0_lastrun.log \
> _logs/0_$NAME.log
[[ -z "$SZ_DEBUG" ]] || echo "Executing: terraform ${@}"
{
terraform "${@}" 2>&1 \
| tee _logs/${TF_LOG_TS}_$NAME.log \
| awk 'BEGIN {p=1}; /<<\W*EOT/ {print; p=0}; /^\W*EOT/ {p=1}; p; fflush();' \
| tee --append _logs/0_0_lastrun.log \
>> _logs/0_$NAME.log
echo "===FULLSTOP===" >> _logs/0_0_lastrun.log
} &
less-tf -
}
function tf0() {
_tfSetLogTS
[ $# -eq 0 ] && return
tf "$@"
}
function tf-plan() {
[[ -z "$SZ_DEBUG" ]] || echo "DEBUG: tfplan ${@}"
local _TF_TARGET=""
[[ ${#TF_TARGET} -gt 0 ]] && _TF_TARGET="$(printf -- '--target=%s ' ${TF_TARGET[@]})"
[[ "${@}" =~ "-destroy" ]] && [[ ${#TF_DESTROY_TARGET} -gt 0 ]] && _TF_TARGET="$(printf -- '--target=%s ' ${TF_DESTROY_TARGET[@]})"
tf plan ${_TF_TARGET} "${@}"
}
alias 'tf0-plan'='_tfSetLogTS; tf-plan '
function get-tf-env() {
local PATTERN="${1-}"
compgen -v | grep "^TF_${PATTERN}"
}
function clear-tf-env() {
local PATTERN="${1}"
local TOCLEAR=$(get-tf-env "${PATTERN}")
[[ -z "$TOCLEAR" ]] && {
echo "Could not find environment variables matching: $(echo "^TF_${PATTERN}")"
} || {
unset $TOCLEAR
echo "Cleared the following vars: $(echo "$TOCLEAR" | xargs echo)"
}
}
function get-tf-env-plan() {
set | grep '^TF\(_\(VAR_[a-z]\)\|\([A-Z_]*TARGET=\)\)' | grep '\b='
}
function clear-tf-env-vars() {
clear-tf-env 'VAR_[a-z]'
}
function clear-tf-env-targets() {
clear-tf-env '[A-Z_]*TARGET$'
}
alias tf-plan-destroy='tf0-plan --destroy '
alias tf-apply='tf apply '
alias tfp='tf-plan '
alias tfpd='tf-plan-destroy '
alias tfa='tf-apply '
fi

View File

@ -1,5 +1,3 @@
set background=dark
if !has("compatible")
" Install vim-plug if not found
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
@ -21,4 +19,59 @@ if !has("compatible")
call plug#end()
endif
" length of an actual \t character:
set tabstop=4
" length to use when editing text (eg. TAB and BS keys)
" (0 for tabstop, -1 for shiftwidth):
set softtabstop=-1
" length to use when shifting text (eg. <<, >> and == commands)
" (0 for tabstop):
set shiftwidth=0
" round indentation to multiples of 'shiftwidth' when shifting text
" (so that it behaves like Ctrl-D / Ctrl-T):
set shiftround
" if set, only insert spaces; otherwise insert \t and complete with spaces:
set expandtab
" reproduce the indentation of the previous line:
set autoindent
" keep indentation produced by 'autoindent' if leaving the line blank:
set cpoptions+=I
" try to be smart (increase the indenting level after {,
" decrease it after }, and so on):
"set smartindent
" a stricter alternative which works better for the C language:
"set cindent
" use languagespecific plugins for indenting (better):
filetype plugin indent on
syntax on
set bg=dark
set tabpagemax=100
nnoremap j jzz
nnoremap k kzz
nnoremap <Down> jzz
nnoremap <Up> kzz
" highlight Cursor ctermbg=blue guibg=blue
" highlight CursorLine cterm=NONE ctermbg=grey ctermfg=darkgrey guibg=grey guifg=darkgrey
" highlight CursorColumn cterm=NONE ctermbg=darkgrey guibg=darkgrey
highlight Visual cterm=reverse ctermbg=NONE
" nnoremap <Leader>c :set cursorline! cursorcolumn!
"
" augroup CourorLine
" au!
" au VimEnter,WinEnter,BufWinEnter * setlocal cursorcolumn
" au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
" au WinLeave * setlocal nocursorcolumn
" au WinLeave * setlocal nocursorline
" augroup END
" let &t_ti.="\e[1 q"
" let &t_SI.="\e[5 q"
" let &t_EI.="\e[1 q"
" let &t_te.="\e[0 q"
autocmd FileType yaml setlocal tabstop=2 softtabstop=-1 shiftwidth=0 expandtab

View File

@ -0,0 +1,16 @@
#! /usr/bin/env bash
pushd . > /dev/null
cd $(git rev-parse --show-toplevel)
ARCHIVE=${1:-/tmp/$(basename $PWD .git)-$(git branch --show-current).git}
[[ -d "$ARCHIVE" || "$ARCHIVE" != "${ARCHIVE%/}" ]] \
&& ARCHIVE=${1%/}/$(basename $PWD .git)-$(git branch --show-current).git
DIRNAME=$(dirname $ARCHIVE)
[[ ! -d "$DIRNAME" ]] \
&& echo "Directory $DIRNAME is missing, creating it..." \
&& mkdir -p $DIRNAME
ARCHIVE=$DIRNAME/$(basename $ARCHIVE .tgz).tgz
printf "Archiving into %s...\n\n" "$ARCHIVE"
tar czvf $ARCHIVE $(git diff --diff-filter=ACMRT --name-only "${@:2}") \
&& printf "\nDone.\n\n"
popd > /dev/null

View File

@ -15,23 +15,45 @@
],
"foreground": "#000000",
"style": "diamond",
"leading_diamond": "\ue0c7\u2593",
"leading_diamond": "▓",
"properties": {
"branch_icon": "\uf126 ",
"branch_icon": " ",
"fetch_stash_count": true,
"fetch_status": true,
"fetch_upstream_icon": true
},
"template": " {{ .UpstreamIcon }}{{ .HEAD }}{{ .BranchStatus }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \uf692 {{ .StashCount }}{{ end }}",
"template": " {{ .UpstreamIcon }}{{ .HEAD }}",
"type": "git"
},
{
"background": "#4e9a06",
"background_templates": [
"{{ if or (.Working.Changed) (.Staging.Changed) }}#c4a000{{ end }}",
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}#f26d50{{ end }}",
"{{ if gt .Ahead 0 }}#89d1dc{{ end }}",
"{{ if gt .Behind 0 }}#4e9a06{{ end }}"
],
"foreground": "#000000",
"powerline_symbol": "",
"style": "powerline",
"leading_diamond": "▓",
"trailing_diamond": "|",
"properties": {
"branch_icon": " ",
"fetch_stash_count": true,
"fetch_status": true,
"fetch_upstream_icon": true
},
"template": "{{ .BranchStatus }}{{ if .Working.Changed }}  {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }}  {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }}  {{ .StashCount }}{{ end }} ",
"type": "git"
},
{
"background": "#d3d7cf",
"foreground": "#000000",
"powerline_symbol": "\ue0b0",
"powerline_symbol": "",
"style": "powerline",
"type": "text",
"template": "{{ if .Env.CLOUDSDK_ACTIVE_CONFIG_NAME }} \ue7b2 {{ .Env.CLOUDSDK_ACTIVE_CONFIG_NAME }} {{ end }}"
"template": "{{ if .Env.CLOUDSDK_ACTIVE_CONFIG_NAME }}  {{ .Env.CLOUDSDK_ACTIVE_CONFIG_NAME }} {{ end }}"
},
{
"style": "plain",
@ -40,6 +62,50 @@
}
]
},
{
"type": "prompt",
"alignment": "right",
"segments": [
{
"type": "command",
"foreground": "#d3d7cf",
"foreground_templates": [
"{{ if contains \"true\" .Output }}#000000{{ end }}"
],
"background": "red",
"background_templates": [
"{{ if contains \"true\" .Output }}#DD7700{{ end }}"
],
"powerline_symbol": "",
"invert_powerline": true,
"style": "powerline",
"properties": {
"shell": "bash",
"command": "type -t direnv *>/dev/null && { direnv status *>&1 || true; } | grep \"Found RC allowed\"; true"
},
"template": "."
},
{
"type": "command",
"foreground": "#d3d7cf",
"foreground_templates": [
"{{ if contains \"true\" .Output }}#000000{{ end }}"
],
"background": "red",
"background_templates": [
"{{ if contains \"true\" .Output }}#DD7700{{ end }}"
],
"invert_powerline": true,
"style": "diamond",
"trailing_diamond": "▓",
"properties": {
"shell": "bash",
"command": "type -t direnv *>/dev/null && { direnv status *>&1 || true; } | grep \"Found RC allowed\"; true"
},
"template": "envrc"
}
]
},
{
"alignment": "left",
"newline": true,
@ -48,7 +114,7 @@
"background": "#d3d7cf",
"foreground": "#000000",
"style": "diamond",
"leading_diamond": "\ue0c7\u2593",
"leading_diamond": "▓",
"template": " {{ if .WSL }}WSL at {{ end }}{{.Icon}} ",
"type": "os"
},
@ -59,7 +125,7 @@
"background_templates": [
"{{ if contains \"running\" .Output }}#FFA400{{ end }}"
],
"powerline_symbol": "\ue0b0",
"powerline_symbol": "",
"style": "powerline",
"properties": {
"shell": "bash",
@ -70,26 +136,26 @@
{
"background": "#3465a4",
"foreground": "#e4e4e4",
"powerline_symbol": "\ue0b0",
"powerline_symbol": "",
"properties": {
"home_icon": "\ufd24",
"home_icon": "",
"mixed_threshold": 3,
"style": "agnoster_full",
"folder_separator_icon": "\ue0b5",
"folder_separator_icon": "",
"folder_separator_template": "",
"mapped_locations": {
"/": "\ue299/",
"/srv": "\uf98a",
"/srv/containeriszed/docker-compose": "\uf308",
"~/_pqb": "\ufab4",
"~/_pqb/code": "\ufab4\ue796",
"~/_pqb/code/slurm/moe-access": "\ue3bf\uf2c2",
"~/_pqb/code/slurm": "\uf1b0",
"~/_pqb/code/slurm/pqb-terraform": "\uf1b0\ufa08"
"/": "/",
"/srv": "力",
"/srv/containeriszed/docker-compose": "",
"~/_pqb": "華",
"~/_pqb/code": "華",
"~/_pqb/code/slurm/moe-access": "",
"~/_pqb/code/slurm": "",
"~/_pqb/code/slurm/pqb-terraform": "行"
}
},
"style": "powerline",
"template": " \uf07c {{ .Path }} ",
"template": " {{ .Path }} ",
"type": "path"
}
],
@ -102,75 +168,75 @@
"background": "#689f63",
"foreground": "#ffffff",
"invert_powerline": true,
"powerline_symbol": "\ue0b2",
"powerline_symbol": "",
"properties": {
"fetch_version": true
},
"style": "powerline",
"template": "{{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} \uf898 ",
"template": "{{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} ",
"type": "node"
},
{
"background": "#00acd7",
"foreground": "#111111",
"invert_powerline": true,
"powerline_symbol": "\ue0b2",
"powerline_symbol": "",
"properties": {
"fetch_version": true
},
"style": "powerline",
"template": "{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \ue627 ",
"template": "{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "go"
},
{
"background": "#4063D8",
"foreground": "#111111",
"invert_powerline": true,
"powerline_symbol": "\ue0b2",
"powerline_symbol": "",
"properties": {
"fetch_version": true
},
"style": "powerline",
"template": "{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \ue624 ",
"template": "{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "julia"
},
{
"background": "#FFDE57",
"foreground": "#111111",
"invert_powerline": true,
"powerline_symbol": "\ue0b2",
"powerline_symbol": "",
"properties": {
"display_mode": "files",
"fetch_virtual_env": false
},
"style": "powerline",
"template": "{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \ue235 ",
"template": "{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "python"
},
{
"background": "#AE1401",
"foreground": "#ffffff",
"invert_powerline": true,
"powerline_symbol": "\ue0b2",
"powerline_symbol": "",
"properties": {
"display_mode": "files",
"fetch_version": true
},
"style": "powerline",
"template": "{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \ue791 ",
"template": "{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "ruby"
},
{
"background": "#FEAC19",
"foreground": "#ffffff",
"invert_powerline": true,
"powerline_symbol": "\ue0b2",
"powerline_symbol": "",
"properties": {
"display_mode": "files",
"fetch_version": false
},
"style": "powerline",
"template": "{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \uf0e7",
"template": "{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "azfunc"
},
{
@ -180,30 +246,30 @@
],
"foreground": "#ffffff",
"invert_powerline": true,
"powerline_symbol": "\ue0b2",
"powerline_symbol": "",
"properties": {
"display_default": false
},
"style": "powerline",
"template": "{{ .Profile }}{{ if .Region }}@{{ .Region }}{{ end }} \ue7ad ",
"template": "{{ .Profile }}{{ if .Region }}@{{ .Region }}{{ end }} ",
"type": "aws"
},
{
"background": "#ffff66",
"foreground": "#111111",
"invert_powerline": true,
"powerline_symbol": "\ue0b2",
"powerline_symbol": "",
"style": "powerline",
"template": "\uf0ad ",
"template": " ",
"type": "root"
},
{
"background": "#c4a000",
"foreground": "#000000",
"invert_powerline": true,
"powerline_symbol": "\ue0b2",
"powerline_symbol": "",
"style": "powerline",
"template": "{{ .FormattedMs }} \uf252 ",
"template": "{{ .FormattedMs }} ",
"type": "executiontime"
},
{
@ -213,12 +279,12 @@
],
"foreground": "#d3d7cf",
"invert_powerline": true,
"powerline_symbol": "\ue0b2",
"powerline_symbol": "",
"properties": {
"always_enabled": true
},
"style": "powerline",
"template": "{{ if gt .Code 0 }}{{ .Meaning }}{{ else }}\u2714{{ end }} ",
"template": "{{ if gt .Code 0 }}{{ .Meaning }}{{ else }}{{ end }} ",
"type": "exit"
},
{
@ -232,9 +298,9 @@
},
"invert_powerline": true,
"style": "powerline",
"powerline_symbol": "\ue0b2",
"template": "<{{ if .Root }}lightBlue{{ else }}green{{ end }}></>{{ .UserName }}{{ if .Root }}!{{ else }}@{{ end }}{{ .HostName }}<{{ if .Root }}lightBlue{{ else }}green{{ end }}></> \uf2bd ",
"trailing_diamond": "\ue0b0\u2500\u256e",
"powerline_symbol": "",
"template": "<{{ if .Root }}lightBlue{{ else }}green{{ end }}></>{{ .UserName }}{{ if .Root }}!{{ else }}@{{ end }}{{ .HostName }}<{{ if .Root }}lightBlue{{ else }}green{{ end }}></> ",
"trailing_diamond": "─╮",
"type": "session"
},
{
@ -248,7 +314,7 @@
],
"invert_powerline": true,
"style": "powerline",
"powerline_symbol": "\ue0b2",
"powerline_symbol": "",
"template": "sw{{ printf \"%.0f%%\" .SwapPercentUsed }}",
"type": "sysinfo"
},
@ -257,8 +323,8 @@
"foreground": "#000000",
"invert_powerline": true,
"style": "diamond",
"template": " {{ .CurrentDate | date .Format }} \uf017 ",
"trailing_diamond": "\u2593\ue0c6",
"template": " {{ .CurrentDate | date .Format }} ",
"trailing_diamond": "▓",
"type": "time"
}
],
@ -271,22 +337,22 @@
{
"type": "shell",
"style": "diamond",
"leading_diamond": "\ue0c7",
"trailing_diamond": "\uE0B0",
"leading_diamond": "",
"trailing_diamond": "",
"template": "{{ .Name }}",
"foreground": "#ffffff",
"background": "#000000",
"background_templates": [
"{{ if contains \"z\ue7a2\" .Name }}#29315a{{ end }}",
"{{ if contains \"b\ue7a2\" .Name }}#424242{{ end }}",
"{{ if contains \"\uf489\" .Name }}#0037da{{ end }}"
"{{ if contains \"z\" .Name }}#29315a{{ end }}",
"{{ if contains \"b\" .Name }}#424242{{ end }}",
"{{ if contains \"\" .Name }}#0037da{{ end }}"
],
"properties": {
"mapped_shell_names": {
"powershell": " \uf489",
"pwsh": " \uf489",
"bash": "b\ue7a2",
"zsh": "z\ue7a2"
"powershell": " ",
"pwsh": " ",
"bash": "b",
"zsh": "z"
}
}
}