Compare commits

11 Commits

Author SHA1 Message Date
Jason Swank
18dc802e2c add vis config 2026-06-26 13:11:08 -04:00
Jason Swank
4f71113416 zsh: prompt 2026-05-06 23:55:52 -04:00
Jason Swank
6c0c8863b7 zsh: prompt 2026-05-06 23:39:40 -04:00
Jason Swank
3c778a0878 import secrets as env vars 2026-05-06 23:36:14 -04:00
Jason Swank
af195f2c1e add ai inference aliases 2026-04-28 09:58:20 -04:00
Jason Swank
ef81373d07 prompt 2026-03-24 01:53:20 +00:00
Jason Swank
0d462adef6 softwrap prose 2026-03-23 21:29:29 -04:00
Jason Swank
b9801c8daa refactor .zshrc 2026-03-22 14:52:53 -04:00
Jason Swank
8ef76de5a1 zsh func updates 2026-03-13 09:19:28 -04:00
Jason Swank
def08842a2 zk: add meeting template 2026-02-06 08:39:32 -05:00
Jason Swank
2983694971 vim: add \yq 2026-02-06 08:39:12 -05:00
13 changed files with 320 additions and 36 deletions

View File

@@ -21,7 +21,7 @@ set showbreak=↪\
augroup filetype_wrapping augroup filetype_wrapping
autocmd! autocmd!
" Enable soft wrap for prose " Enable soft wrap for prose
autocmd FileType markdown,text,gitcommit setlocal wrap linebreak breakindent autocmd FileType markdown,text,gitcommit setlocal wrap linebreak breakindent textwidth=0
" Maintain no wrap for code and structured data " Maintain no wrap for code and structured data
autocmd FileType go,python,sh,yaml,json setlocal nowrap autocmd FileType go,python,sh,yaml,json setlocal nowrap
augroup END augroup END
@@ -49,7 +49,6 @@ colorscheme theunixzoo
" arrows could be: → » " arrows could be: → »
set listchars=tab:→\ ,trail set listchars=tab:→\ ,trail
"source /home/jswank/.config/nvim/colors-now "source /home/jswank/.config/nvim/colors-now
"set gfn=Droid\ Sans\ Mono\ 10 "set gfn=Droid\ Sans\ Mono\ 10
@@ -64,7 +63,7 @@ filetype indent on
set ofu=syntaxcomplete#Complete# set ofu=syntaxcomplete#Complete#
" au FileType python setlocal tabstop=4 expandtab shiftwidth=4 softtabstop=4 " au FileType python setlocal tabstop=4 expandtab shiftwidth=4 softtabstop=4
au FileType markdown setlocal tabstop=4 expandtab shiftwidth=4 softtabstop=4 wrap au FileType markdown setlocal tabstop=4 expandtab shiftwidth=4 softtabstop=4 wrap textwidth=0
" typing idate inserts the current date " typing idate inserts the current date
iab idate <c-r>=strftime("%Y-%m-%d")<cr> iab idate <c-r>=strftime("%Y-%m-%d")<cr>
@@ -85,6 +84,8 @@ nmap <leader>jn <cmd>% !jsonnetfmt -<cr>
" use \ js to format a buffer as JSON " use \ js to format a buffer as JSON
nmap <leader>js <cmd>% !jq . -<cr> nmap <leader>js <cmd>% !jq . -<cr>
nmap <leader>yq <cmd>% !yq . -<cr>
set lazyredraw " redraw only when req'd set lazyredraw " redraw only when req'd
set wildmenu " visual auto-complete set wildmenu " visual auto-complete

View File

@@ -0,0 +1,43 @@
-- ~/.config/vis/lexers/terraform.lua
-- HCL/Terraform LPeg lexer for the vis editor.
-- Uses the modern Scintillua style for robust syntax highlighting.
local lexer = lexer
local P, S = lpeg.P, lpeg.S
local lex = lexer.new('terraform', {fold_by_indentation = true})
-- Comments (# or // or /* */)
local line_comment = lexer.to_eol('#') + lexer.to_eol('//')
local block_comment = lexer.range('/*', '*/')
lex:add_rule('comment', lex:tag(lexer.COMMENT, line_comment + block_comment))
-- Strings (double-quoted and heredoc)
local dq_str = lexer.range('"', true)
-- Basic heredoc pattern: '<<' (optionally with '-') followed by identifier, up to matching newline-identifier-newline
local heredoc = '<<' * P('-')^-1 * lexer.word
lex:add_rule('string', lex:tag(lexer.STRING, dq_str + heredoc))
-- Keywords
lex:add_rule('keyword', lex:tag(lexer.KEYWORD, lexer.word_match[[
resource data provider variable output locals module terraform
required_providers required_version source version for_each count
if else for in true false null
]]))
-- Numbers
lex:add_rule('number', lex:tag(lexer.NUMBER, lexer.number))
-- Identifiers / function names
lex:add_rule('identifier', lex:tag(lexer.IDENTIFIER, lexer.word))
-- Operators
lex:add_rule('operator', lex:tag(lexer.OPERATOR, S('={}[]().,;:<+-*/&|!?@')))
-- Fold points
lex:add_fold_point(lexer.OPERATOR, '[', ']')
lex:add_fold_point(lexer.OPERATOR, '{', '}')
lexer.property['scintillua.comment'] = '#'
return lex

148
vis/.config/vis/visrc.lua Normal file
View File

@@ -0,0 +1,148 @@
-- ~/.config/vis/visrc.lua
-- Sourced by the vis editor during startup.
-- Highly customized based on your .vimrc configuration.
-- Load standard vis runtime files (must be done first)
require('vis')
-- Register HCL/Terraform file extensions to the terraform lexer
vis.ftdetect = vis.ftdetect or {}
vis.ftdetect.filetypes = vis.ftdetect.filetypes or {}
vis.ftdetect.filetypes.terraform = {
ext = { "%.tf$", "%.tfvars$", "%.hcl$" }
}
vis.events.subscribe(vis.events.INIT, function()
-- Enable 256 colors themes
-- vis:command('set theme default-256') -- or base-16 / default-256
end)
-- Global Editor Options (ported from vimrc)
vis.events.subscribe(vis.events.WIN_OPEN, function(win)
-- Filetype-specific indentation and soft-wrapping
if syntax == "markdown" or syntax == "text" or syntax == "gitcommit" then
vis:command("set tabwidth 4")
vis:command("set expandtab on")
vis:command("set autoindent on")
-- In vis, wrapping occurs at the minimum of window width and wrapcolumn.
-- Setting wrapcolumn to a large number (e.g., 1000) acts as soft-wrap.
vis:command("set wrapcolumn 1000")
else
-- Default options for code and structured data (go, python, sh, yaml, json, etc.)
vis:command("set tabwidth 2")
vis:command("set expandtab on")
vis:command("set autoindent on")
vis:command("set wrapcolumn 0") -- No wrap for code/config
end
-- Highlight current cursor line
vis:command("set cursorline on")
end)
-------------------------------------------------------------------------------
-- Key Mappings (ported from vimrc)
-------------------------------------------------------------------------------
-- Use semicolon as colon for commands
vis:map(vis.modes.NORMAL, ";", ":")
-- Navigate visual display lines instead of logical lines (gj/gk mapping)
vis:map(vis.modes.NORMAL, "j", "gj")
vis:map(vis.modes.NORMAL, "k", "gk")
vis:map(vis.modes.VISUAL, "j", "gj")
vis:map(vis.modes.VISUAL, "k", "gk")
-- Optional list/hidden characters toggle commands (commented like in vimrc)
-- vis:command('set showtabs on')
-- vis:command('set shownewlines on')
-- vis:command('set showspaces on')
-------------------------------------------------------------------------------
-- Insert Mode Helpers (ported from vimrc)
-------------------------------------------------------------------------------
-- Insert markdown triple backticks code block with Ctrl-b in insert mode
vis:map(vis.modes.INSERT, "<C-b>", function()
local win = vis.win
local file = win.file
local pos = win.selection.pos
-- Insert "```\n\n```" and place cursor inside
file:insert(pos, "```\n\n```")
win.selection.pos = pos + 4 -- Position cursor in the empty middle line
end, "Insert markdown triple backticks code block")
-- typing idate inserts the current date (insert-mode abbreviation equivalent)
vis:map(vis.modes.INSERT, "idate", function()
local win = vis.win
local date_str = os.date("%Y-%m-%d")
win.file:insert(win.selection.pos, date_str)
end, "Insert current date")
-------------------------------------------------------------------------------
-- External Formatter Pipelines (ported from vimrc leader bindings)
-------------------------------------------------------------------------------
-- Helper function to pipe full buffer to external formatting commands
local function format_buffer(cmd)
local win = vis.win
local file = win.file
local pos = win.selection.pos -- save cursor pos
-- Pipe entire file range to formatter in fullscreen=false mode
local status, out, err = vis:pipe(file, {start = 0, finish = file.size}, cmd)
if status ~= 0 then
vis:info(err or "Format failed")
else
file:delete({start = 0, finish = file.size})
file:insert(0, out)
-- Restore cursor position safely
if pos < file.size then
win.selection.pos = pos
else
win.selection.pos = file.size
end
end
end
-- Key bindings using standard backslash prefix (\)
vis:map(vis.modes.NORMAL, "\\tf", function() format_buffer("tofu fmt -no-color -") end, "Format buffer as Terraform/Tofu")
vis:map(vis.modes.NORMAL, "\\js", function() format_buffer("jq .") end, "Format buffer as JSON")
vis:map(vis.modes.NORMAL, "\\jn", function() format_buffer("jsonnetfmt -") end, "Format buffer as Jsonnet")
vis:map(vis.modes.NORMAL, "\\yq", function() format_buffer("yq .") end, "Format buffer as YAML")
-------------------------------------------------------------------------------
-- Fuzzy Finder Integration (ported from vimrc fzf shortcuts)
-------------------------------------------------------------------------------
-- Define fuzzy finder function using fzf via io.popen
local function fzf_find()
-- Run fzf using io.popen so it inherits the terminal's stdin/stderr
local file = io.popen("fzf")
if not file then return end
local output = file:read("*l") -- Read the selected file path
local success, msg, status = file:close()
if output and output ~= "" then
-- Strip any trailing spaces or newlines
output = output:gsub("%s+$", "")
if output ~= "" then
vis:command("e '" .. output .. "'")
end
end
-- Redraw the editor screen since fzf drew over the terminal
vis:feedkeys("<vis-redraw>")
end
-- Register ':fzf' command to trigger the fuzzy finder
vis:command_register("fzf", function(argv, force, win, selection, range)
fzf_find()
return true
end)
vis:map(vis.modes.NORMAL, "<C-p>", function()
fzf_find()
end, "Fuzzy finder file selection using fzf")

View File

@@ -78,6 +78,14 @@ template = "default.md"
#[group."<NAME>".extra] #[group."<NAME>".extra]
#key = "value" #key = "value"
[group.meeting]
paths = ["meeting"]
[group.meeting.note]
filename = "{{slug title}}-{{format-date now '%Y%m%d'}}"
extension = "md"
template = "meeting.md"
[group.daily] [group.daily]
paths = ["daily"] paths = ["daily"]
@@ -192,7 +200,8 @@ edit = 'zk edit --interactive "$@"'
# This alias doesn't take any argument, so we don't use $@. # This alias doesn't take any argument, so we don't use $@.
recent = "zk edit --sort created- --created-after 'last two weeks' --interactive" recent = "zk edit --sort created- --created-after 'last two weeks' --interactive"
daily = 'zk new daily "$@"' daily = 'zk new "$@" daily'
meeting = 'zk new --title "$@" meeting'
# Print paths separated with colons for the notes found with the given # Print paths separated with colons for the notes found with the given
# arguments. This can be useful to expand a complex search query into a flag # arguments. This can be useful to expand a complex search query into a flag

View File

@@ -8,6 +8,7 @@
- another bullet - another bullet
## tracking ## tracking
- [ ] 1hr GCP training
- [ ] harvest time sheet - [ ] harvest time sheet
- [ ] exercise - [ ] exercise
- [ ] dinner / logistics - [ ] dinner / logistics

View File

@@ -0,0 +1,12 @@
# {{ title }}
Date: {{format-date now '%a, %b %d @ %H%M'}}
Description:
Attendees:
## Agenda
## Notes
## Action Items
- [ ] Item
- [ ] Item

3
zsh/.aliasrc Normal file
View File

@@ -0,0 +1,3 @@
alias ls='ls --color=auto'
alias grep='grep --color'
alias pichat='pi --provider google --model gemini-3.1-flash-lite-preview --prompt-template ~/.pi/agent/prompts/cloudops.md'

View File

@@ -1,10 +1,10 @@
aws-get-bedrock-profile () { aws-get-bedrock-profile () {
profile_arn=$(aws bedrock list-inference-profiles \ profile_id=$(aws bedrock list-inference-profiles \
| jq -r '.inferenceProfileSummaries | jq -r '.inferenceProfileSummaries
| map(select(.inferenceProfileId | startswith("us."))) | map(select(.inferenceProfileId | startswith("us.")))
| sort_by(.inferenceProfileName) | sort_by(.inferenceProfileName)
| .[] | .[]
| [.inferenceProfileArn, .inferenceProfileName, .description] | [.inferenceProfileId, .inferenceProfileName, .description]
| @tsv' \ | @tsv' \
| fzf \ | fzf \
--header="$(printf '%-30s\t%s\n' 'NAME' 'DESCRIPTION')" \ --header="$(printf '%-30s\t%s\n' 'NAME' 'DESCRIPTION')" \
@@ -12,6 +12,6 @@ aws-get-bedrock-profile () {
--delimiter='\t' \ --delimiter='\t' \
--with-nth=2,3 \ --with-nth=2,3 \
| awk '{print $1}') | awk '{print $1}')
[[ -z "$profile_arn" ]] && return 1 [[ -z "$profile_id" ]] && return 1
echo "$profile_arn" echo "$profile_id"
} }

View File

@@ -0,0 +1,3 @@
gcloud-login() {
gcloud auth login --update-adc
}

View File

@@ -0,0 +1,33 @@
use-bedrock() {
local force=0
while getopts "f" opt; do
case $opt in
f) force=1 ;;
*) echo "Usage: use-bedrock [-f]" >&2; return 1 ;;
esac
done
OPTIND=1
if [[ "$force" -eq 0 ]] && [[ -n "$AWS_ACCESS_KEY_ID" ]] && [[ -n "$AWS_SECRET_ACCESS_KEY" ]]; then
echo "AWS credentials already set. Skipping Bedrock setup. Use -f to force re-authentication." >&2
return
fi
aws sso login --use-device-code || return 1
local creds
creds=$(aws configure export-credentials --format env) || return 1
eval "$creds"
export CLAUDE_CODE_USE_BEDROCK=1
export CLAUDE_BEDROCK_AWS_REGION="${AWS_REGION:-us-east-2}"
export ANTHROPIC_DEFAULT_OPUS_MODEL="${BEDROCK_OPUS_MODEL:-us.anthropic.claude-opus-4-7-v1}"
export ANTHROPIC_DEFAULT_SONNET_MODEL="${BEDROCK_SONNET_MODEL:-us.anthropic.claude-sonnet-4-6}"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="${BEDROCK_HAIKU_MODEL:-us.anthropic.claude-haiku-4-5-20251001-v1:0}"
unset CLAUDE_CODE_USE_VERTEX
printf 'Bedrock environment set.\n\tOpus: %s\n\tSonnet: %s\n\tHaiku: %s\n' \
"$ANTHROPIC_DEFAULT_OPUS_MODEL" "$ANTHROPIC_DEFAULT_SONNET_MODEL" "$ANTHROPIC_DEFAULT_HAIKU_MODEL" >&2
}

View File

@@ -0,0 +1,25 @@
use-vertex() {
local project="${ANTHROPIC_VERTEX_PROJECT_ID:-sandbox-jason-7023}"
local region="${CLOUD_ML_REGION:-us-east5}"
# Probe/refresh ADC
if ! gcloud auth application-default print-access-token >/dev/null 2>&1; then
gcloud auth login --update-adc || return 1
fi
export CLAUDE_CODE_USE_VERTEX=1
export ANTHROPIC_VERTEX_PROJECT_ID="$project"
export CLOUD_ML_REGION="$region"
export ANTHROPIC_DEFAULT_OPUS_MODEL="${VERTEX_OPUS_MODEL:-claude-opus-4-7}"
export ANTHROPIC_DEFAULT_SONNET_MODEL="${VERTEX_SONNET_MODEL:-claude-sonnet-4-6}"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="${VERTEX_HAIKU_MODEL:-claude-haiku-4-5-20251001}"
# pi google-vertex provider auto-activates with all three present
export GOOGLE_CLOUD_PROJECT="$project"
export GOOGLE_CLOUD_LOCATION="$region"
unset CLAUDE_CODE_USE_BEDROCK CLAUDE_BEDROCK_AWS_REGION
printf 'Vertex AI environment set.\n\tOpus: %s\n\tSonnet: %s\n\tHaiku: %s\n' \
"$ANTHROPIC_DEFAULT_OPUS_MODEL" "$ANTHROPIC_DEFAULT_SONNET_MODEL" "$ANTHROPIC_DEFAULT_HAIKU_MODEL" >&2
}

View File

@@ -15,6 +15,9 @@ export GOPATH=~/go
export TZ=America/Kentucky/Louisville export TZ=America/Kentucky/Louisville
export AWS_REGION=us-west-2
export REPO_OVERLAY_DIR=~/repos/repo-overlays/overlays
# doesn't work on arch for tmux # doesn't work on arch for tmux
#path+=(~/bin) #path+=(~/bin)
#path+=(~/.local/bin) #path+=(~/.local/bin)
@@ -24,7 +27,6 @@ export TZ=America/Kentucky/Louisville
export TMPDIR=/var/tmp export TMPDIR=/var/tmp
export BROWSER=open_browser.sh export BROWSER=open_browser.sh
export TF_PLUGIN_CACHE_DIR=~/.local/state/tofu
# With ghostty + tmux + nvim, having this autoset to 'truecolor' has a weird effect # With ghostty + tmux + nvim, having this autoset to 'truecolor' has a weird effect
# unset COLORTERM # unset COLORTERM

View File

@@ -1,8 +1,12 @@
alias ls='ls --color=auto'
alias grep='grep --color' # aliases are stored in ~/.aliasrc
if [ -f ~/.aliasrc ]; then
source ~/.aliasrc
fi
fpath+=~/.local/share/zsh/functions fpath+=~/.local/share/zsh/functions
typeset -U path
path+=(~/bin) path+=(~/bin)
path+=(~/.local/bin) path+=(~/.local/bin)
path+=($GOPATH/bin) path+=($GOPATH/bin)
@@ -56,9 +60,10 @@ function set_prompt() {
aws_prompt="" aws_prompt=""
fi fi
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
PROMPT=$aws_prompt"%B${vcs_info_msg_0_} %b" PROMPT=$aws_prompt"%B${vcs_info_msg_0_}▶ %b "
else else
PROMPT=$aws_prompt"%B%m:%~▶ %b" # PROMPT=$aws_prompt"%B%m:%~▶%b "
PROMPT=$aws_prompt"%B%m:%2~▶ %b "
fi fi
} }
precmd_functions+=( set_prompt ) precmd_functions+=( set_prompt )
@@ -76,7 +81,7 @@ precmd_functions+=( set_prompt )
# setup SSH keys # setup SSH keys
if [ -e /usr/bin/keychain ]; then if [ -e /usr/bin/keychain ]; then
eval $(/usr/bin/keychain --eval -Q --quiet id_ed25519) eval $(/usr/bin/keychain --quick --eval --quiet id_ed25519)
fi fi
# ctrl-x opens up the command line in $EDITOR # ctrl-x opens up the command line in $EDITOR
@@ -87,20 +92,24 @@ bindkey "^X" edit-command-line
# direnv setup # direnv setup
whence -p direnv &>/dev/null && eval "$(direnv hook zsh)" whence -p direnv &>/dev/null && eval "$(direnv hook zsh)"
# secrets # secrets are individual files in /run/secrets - export them as environment variables
if [ -r "$HOME/.env_secrets" ]; then if [ -d "/run/secrets" ]; then
set -a for secret in /run/secrets/*; do
source "$HOME/.env_secrets" if [ -f "$secret" ]; then
set +a name=$(basename "$secret")
value=$(head -n1 "$secret" | sed 's/[ \t]*$//' | tr '\0' '\n')
export "${name}=${value}"
fi
done
fi fi
# command line completion # command line completion
autoload -U +X bashcompinit && bashcompinit autoload -U +X bashcompinit && bashcompinit
autoload -Uz compinit && compinit autoload -Uz compinit && compinit -C
# gcloud # gcloud
if [ -f '/home/cli/google-cloud-sdk/path.zsh.inc' ]; then . '/home/cli/google-cloud-sdk/path.zsh.inc'; fi if [ -f "$HOME/google-cloud-sdk/path.zsh.inc" ]; then . "$HOME/google-cloud-sdk/path.zsh.inc"; fi
if [ -f '/home/cli/google-cloud-sdk/completion.zsh.inc' ]; then . '/home/cli/google-cloud-sdk/completion.zsh.inc'; fi if [ -f "$HOME/google-cloud-sdk/completion.zsh.inc" ]; then . "$HOME/google-cloud-sdk/completion.zsh.inc"; fi
# kubectl # kubectl
[[ $commands[kubectl] ]] && source <(kubectl completion zsh) [[ $commands[kubectl] ]] && source <(kubectl completion zsh)
@@ -118,20 +127,15 @@ fi
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
# command line completion for ssh # command line completion for ssh
h=() #h=()
if [[ -r ~/.ssh/config ]]; then #if [[ -r ~/.ssh/config ]]; then
h=($h ${${${(@M)${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*}) h=($h ${${${(@M)${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*})
fi #fi
if [[ -r ~/.ssh/known_hosts ]]; then #if [[ -r ~/.ssh/known_hosts ]]; then
h=($h ${${${(f)"$(cat ~/.ssh/known_hosts{,2} || true)"}%%\ *}%%,*}) 2>/dev/null # h=($h ${${${(f)"$(cat ~/.ssh/known_hosts{,2} || true)"}%%\ *}%%,*}) 2>/dev/null
fi #fi
if [[ $#h -gt 0 ]]; then #if [[ $#h -gt 0 ]]; then
zstyle ':completion:*:(ssh|scp|slogin|sftp):*' hosts $h # zstyle ':completion:*:(ssh|scp|slogin|sftp):*' hosts $h
fi #fi
zstyle :compinstall filename '~/.zshrc' zstyle :compinstall filename '~/.zshrc'
#zstyle ':completion:*' completer _complete _ignored
#zstyle :compinstall filename '~/.zshrc'
#compinit