Compare commits

...

15 Commits

Author SHA1 Message Date
ff6876a56d chore(bin): remove markdown-to-telegram.py 2025-02-25 20:32:29 +02:00
ccbd29fc40 chore(dotbot): remove dotbot-asdf 2025-02-25 20:31:57 +02:00
9251225d3e chore(bin): update x-env-list with skipping 2025-02-25 20:26:32 +02:00
241eed66f5 chore(config): update zed config 2025-02-25 20:25:24 +02:00
6de8e92968 chore(scripts): update install-cargo-packages.sh 2025-02-25 20:25:01 +02:00
2cdda605ef chore(config): tweak tmux.conf 2025-02-25 20:23:41 +02:00
87a4ec8ecf chore(config): clean up fish/exports.fish 2025-02-25 20:23:06 +02:00
87613d10ec chore(config): remove ehfive/fish-bash2env 2025-02-25 20:22:36 +02:00
f6dc193f6a feat(config): add vim config (#61)
* feat: vim config
* fix: nvim was getting vimrc config
* chore: cleanup, cr fix
* feat(config): add config/fish/alias.fish
2025-02-25 20:20:31 +02:00
4adbbdb47a chore(config): tmux tweaks 2025-02-25 10:46:01 +02:00
bdbe10f612 chore(config): aerospace sessions app
Signed-off-by: Ismo Vuorinen <ismo@ivuorinen.net>
2025-02-25 10:41:54 +02:00
531488001f chore(config): shared.sh tweak
Signed-off-by: Ismo Vuorinen <ismo@ivuorinen.net>
2025-02-25 10:41:39 +02:00
4f2b47d5c3 feat(asdf): removal of asdf
Signed-off-by: Ismo Vuorinen <ismo@ivuorinen.net>
2025-02-25 10:41:20 +02:00
github-actions[bot]
dfbdb89aca chore: update pre-commit hooks (#83) 2025-02-24 08:30:19 +02:00
ivuorinen
c9489ae50f chore(git): Update submodules (automated) 2025-02-24 05:03:01 +01:00
30 changed files with 3798 additions and 656 deletions

9
.gitmodules vendored
View File

@@ -74,18 +74,9 @@
url = https://github.com/erikw/tmux-dark-notify.git
ignore = dirty
[submodule "asdf"]
path = local/asdf
url = https://github.com/asdf-vm/asdf.git
ignore = dirty
[submodule "antidote"]
path = tools/antidote
url = https://github.com/mattmc3/antidote.git
shallow = true
ignore = dirty
[submodule "dotbot-asdf"]
path = tools/dotbot-asdf
url = https://github.com/sobolevn/dotbot-asdf
ignore = dirty

View File

@@ -49,7 +49,7 @@ repos:
- id: actionlint
- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 39.174.3
rev: 39.178.1
hooks:
- id: renovate-config-validator

View File

@@ -1,5 +1,7 @@
#!/usr/bin/env bash
git submodule sync --recursive
# dotbot and plugins
git submodule add --name dotbot \
-f https://github.com/anishathalye/dotbot.git tools/dotbot
@@ -17,8 +19,6 @@ git submodule add --name cheat-community \
-f https://github.com/cheat/cheatsheets.git config/cheat/cheatsheets/community
git submodule add --name cheat-tldr \
-f https://github.com/ivuorinen/cheatsheet-tldr.git config/cheat/cheatsheets/tldr
git submodule add --name asdf \
-f https://github.com/asdf-vm/asdf.git local/asdf
git submodule add --name antidote \
--depth 1 \
-f https://github.com/mattmc3/antidote.git tools/antidote
@@ -54,18 +54,20 @@ git config -f .gitmodules submodule.antidote.shallow true
# remove old submodules
folders=(
"config/tmux/plugins/tpm"
"config/tmux/plugins/tmux"
"config/tmux/plugins/tmux-menus"
"config/tmux/plugins/tmux-resurrect"
"tools/dotbot-crontab"
"tools/dotbot-snap"
"config/nvim-kickstart"
"local/bin/asdf"
"config/tmux/plugins/tpm"
"config/tmux/plugins/tmux"
"config/tmux/plugins/tmux-menus"
"config/tmux/plugins/tmux-resurrect"
"tools/dotbot-crontab"
"tools/dotbot-snap"
"config/nvim-kickstart"
"local/bin/asdf"
"local/asdf"
"tools/dotbot-asdf"
)
for folder in "${folders[@]}"; do
[ -d "$folder" ] && \
rm -rf "$folder" && \
msgr run_done "Removed old submodule $folder"
[ -d "$folder" ] \
&& rm -rf "$folder" \
&& msgr run_done "Removed old submodule $folder"
done

View File

@@ -1,2 +1 @@
use node
use asdf

View File

@@ -1,19 +0,0 @@
golang 1.23.4
rust 1.83.0
direnv 2.35.0
fd 10.2.0
1password-cli 2.30.3
age 1.2.1
dotenv-linter 3.3.0
editorconfig-checker 2.8.0
github-cli 2.64.0
hadolint 2.12.0
kubectl 1.32.0
pre-commit 4.0.1
ripgrep 14.1.1
shellcheck 0.10.0
shfmt 3.10.0
terragrunt 0.71.1
tf-summarize 0.3.14
yamllint 1.35.1
yq 4.44.6

View File

@@ -12,7 +12,6 @@ export PATH="$HOME/.local/bin:$DOTFILES/local/bin:$LOCAL_SHARE/nvim/mason/bin:$L
export SHARED_SCRIPTS_SOURCED=0
source "$DOTFILES/config/shared.sh"
source "${XDG_CONFIG_HOME:-$HOME/.config}/asdf-direnv/zshrc"
# zsh completions directory
[ -z "$ZSH_COMPLETIONS" ] && export ZSH_COMPLETIONS="$XDG_CONFIG_HOME/zsh/completion"
@@ -51,10 +50,6 @@ setup_tmux_window_name_plugin()
fi
}
if [[ -n $GHOSTTY_RESOURCES_DIR ]]; then
source "$GHOSTTY_RESOURCES_DIR"/shell-integration/zsh/ghostty-integration
fi
source_fzf_config
setup_tmux_window_name_plugin
x-have antidot && eval "$(antidot init)"

View File

@@ -115,6 +115,9 @@ run = ['layout floating']
if.app-id = 'com.apple.backup.launcher' # TimeMachine
run = ['layout floating']
[[on-window-detected]]
if.app-id = 'com.philipyoungg.session-setapp' # Session app (Setapp)
run = ['layout floating']
# Possible values: (qwerty|dvorak)
# See https://nikitabobko.github.io/AeroSpace/guide#key-mapping

View File

@@ -7,6 +7,8 @@ x-have eza && {
alias ls="eza -h -s=type --git --icons --group-directories-first"
}
alias vim='vim -u "$XDG_CONFIG_HOME/vim/vimrc"'
# Easier navigation: .., ..., ....
alias ..="cd .."
alias ...="cd ../.."

View File

@@ -1,3 +0,0 @@
### Do not edit. This was autogenerated by 'asdf direnv setup' ###
export ASDF_DIRENV_BIN="$(asdf where direnv)/bin/direnv"
eval "$($ASDF_DIRENV_BIN hook zsh)"

View File

@@ -291,35 +291,6 @@ hash shopt 2> /dev/null && shopt -s checkwinsize
# shellcheck disable=SC2155
export SHORT_HOST=$(hostname -s)
# asdf
# https://github.com/asdf-vm/asdf
msg "Setting up asdf configuration"
export ASDF_DIR="${HOME}/.local/asdf"
[[ -d $ASDF_DIR ]] && {
# [[ -d $ASDF_DIR/completions ]] && FPATH="$ASDF_DIR/completions:$FPATH"
# [[ -d $ASDF_DIR/plugins ]] && FPATH="$ASDF_DIR/plugins:$FPATH"
export ASDF_CONFIG_FILE="${XDG_CONFIG_HOME}/asdf/asdfrc"
export ASDF_DATA_DIR="${ASDF_DIR}"
export ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME="${XDG_CONFIG_HOME}/asdf/plugin-versions"
export ASDF_LOG_FILE="${XDG_CACHE_HOME}/asdf/asdf.log"
export ASDF_FORCE_PREPEND=yes
## Default package files
export ASDF_CRATE_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME}/asdf/cargo-packages"
export ASDF_GEM_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME}/asdf/gem-packages"
export ASDF_GOLANG_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME}/asdf/golang-packages"
export ASDF_NPM_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME}/asdf/npm-packages"
export ASDF_PYTHON_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME}/asdf/python-packages"
## Plugin configuration
export ASDF_DIRENV_IGNORE_MISSING_PLUGINS=1
export ASDF_GOLANG_MOD_VERSION_ENABLED=true
export ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY="latest_available"
## Add asdf to path
export PATH="${ASDF_DIR}/bin:${PATH}"
source "$ASDF_DIR/asdf.sh"
}
# Antidote configuration
# https://getantidote.github.io/
msg "Setting up Antidote configuration"

4
config/fish/alias.fish Normal file
View File

@@ -0,0 +1,4 @@
# Set aliases for fish shell
alias vim='vim -u "$XDG_CONFIG_HOME/vim/vimrc"'

View File

@@ -2,6 +2,9 @@
# │ fish/config.fish │
# ╰──────────────────────────────────────────────────────────╯
test -e "$HOME/.config/fish/alias.fish" &&
source "$HOME/.config/fish/alias.fish"
test -e "$HOME/.config/fish/exports.fish" &&
source "$HOME/.config/fish/exports.fish"

View File

@@ -1,69 +1,36 @@
#!/usr/bin/env fish
# Set XDG environment variables
test -z "$XDG_CONFIG_HOME" && set -x XDG_CONFIG_HOME "$HOME/.config"
test -z "$XDG_DATA_HOME" && set -x XDG_DATA_HOME "$HOME/.local/share"
test -z "$XDG_CACHE_HOME" && set -x XDG_CACHE_HOME "$HOME/.cache"
test -z "$XDG_STATE_HOME" && set -x XDG_STATE_HOME "$HOME/.local/state"
test -z "$XDG_BIN_HOME" && set -x XDG_BIN_HOME "$HOME/.local/bin"
test -z "$XDG_RUNTIME_DIR" && set -x XDG_RUNTIME_DIR "$HOME/.local/run"
# XDG Base Directory Specification
set -q XDG_CONFIG_HOME; or set -x XDG_CONFIG_HOME "$HOME/.config"
set -q XDG_DATA_HOME; or set -x XDG_DATA_HOME "$HOME/.local/share"
set -q XDG_CACHE_HOME; or set -x XDG_CACHE_HOME "$HOME/.cache"
set -q XDG_STATE_HOME; or set -x XDG_STATE_HOME "$HOME/.local/state"
set -q XDG_BIN_HOME; or set -x XDG_BIN_HOME "$HOME/.local/bin"
set -q XDG_RUNTIME_DIR; or set -x XDG_RUNTIME_DIR "$HOME/.local/run"
# Set dotfiles directory
test -z "$DOTFILES" && set -x DOTFILES "$HOME/.dotfiles"
# Dotfiles directory
set -q DOTFILES; or set -x DOTFILES "$HOME/.dotfiles"
# Set other environment variables
test -z "$EDITOR" && set -x EDITOR "nvim"
test -z "$VISUAL" && set -x VISUAL "code"
test -z "$HOSTNAME" && set -x HOSTNAME (hostname -s)
# Editor settings
set -q EDITOR; or set -x EDITOR "nvim"
set -q VISUAL; or set -x VISUAL "code"
set -q HOSTNAME; or set -x HOSTNAME (hostname -s)
# Add local bin to path
fish_add_path "$XDG_BIN_HOME"
# Set npm environment variables
test -z "$NPM_CONFIG_PREFIX" && set -x NPM_CONFIG_PREFIX "$XDG_DATA_HOME/npm"
# NPM configuration
set -q NPM_CONFIG_PREFIX; or set -x NPM_CONFIG_PREFIX "$XDG_DATA_HOME/npm"
fish_add_path "$NPM_CONFIG_PREFIX/bin"
# Set yarn environment variables
test -z "$YARN_GLOBAL_FOLDER" && set -x YARN_GLOBAL_FOLDER "$XDG_DATA_HOME/yarn"
# Yarn configuration
set -q YARN_GLOBAL_FOLDER; or set -x YARN_GLOBAL_FOLDER "$XDG_DATA_HOME/yarn"
fish_add_path "$YARN_GLOBAL_FOLDER/bin"
# Set mason environment variables
test -z "$MASON_HOME" && set -x MASON_HOME "$XDG_DATA_HOME/nvim/mason"
# Mason configuration
set -q MASON_HOME; or set -x MASON_HOME "$XDG_DATA_HOME/nvim/mason"
fish_add_path "$MASON_HOME/bin"
# Set ASDF environment variables
test -z "$ASDF_DATA_DIR" && set -x ASDF_DATA_DIR "$XDG_DATA_HOME/asdf"
test -z "$ASDF_LOG_PATH" && set -x ASDF_LOG_PATH "$XDG_STATE_HOME/asdf/log"
test -z "$ASDF_CONFIG_DIR" && set -x ASDF_CONFIG_DIR "$XDG_CONFIG_HOME/asdf"
test -z "$ASDF_CONFIG_FILE" && set -x ASDF_CONFIG_FILE "$ASDF_CONFIG_DIR/asdfrc"
## Default package files
test -z "$ASDF_CRATE_DEFAULT_PACKAGES_FILE" && set -x ASDF_CRATE_DEFAULT_PACKAGES_FILE "$ASDF_CONFIG_DIR/cargo-packages"
test -z "$ASDF_GEM_DEFAULT_PACKAGES_FILE" && set -x ASDF_GEM_DEFAULT_PACKAGES_FILE "$ASDF_CONFIG_DIR/gem-packages"
test -z "$ASDF_GOLANG_DEFAULT_PACKAGES_FILE" && set -x ASDF_GOLANG_DEFAULT_PACKAGES_FILE "$ASDF_CONFIG_DIR/golang-packages"
test -z "$ASDF_NPM_DEFAULT_PACKAGES_FILE" && set -x ASDF_NPM_DEFAULT_PACKAGES_FILE "$ASDF_CONFIG_DIR/npm-packages"
test -z "$ASDF_PYTHON_DEFAULT_PACKAGES_FILE" && set -x ASDF_PYTHON_DEFAULT_PACKAGES_FILE "$ASDF_CONFIG_DIR/python-packages"
## Plugin configuration
set -x ASDF_DIRENV_IGNORE_MISSING_PLUGINS "1"
set -x ASDF_GOLANG_MOD_VERSION_ENABLED "true"
set -x ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY "latest_available"
test -z "$ASDF_GOLANG_MOD_VERSION_ENABLED" && set -x ASDF_GOLANG_MOD_VERSION_ENABLED "true"
## Load ASDF, if it exists
test -f "$HOME/.local/asdf/asdf.fish" &&
source "$HOME/.local/asdf/asdf.fish" &&
asdf reshim &&
fish_add_path "$ASDF_DIR/shims"
## If $HOME/.local/asdf/asdf.fish does not exist, show error message
test -e "$HOME/.local/asdf/asdf.fish" || echo "ASDF not found"
# Load ASDF completions
test -d "$XDG_CONFIG_HOME/fish/completions" ||
mkdir -p "$XDG_CONFIG_HOME/fish/completions";
test -e "$XDG_CONFIG_HOME/fish/completions/asdf.fish" ||
and ln -s "$ASDF_DIR/completions/asdf.fish" "$XDG_CONFIG_HOME/fish/completions/asdf.fish"
# Set Neovim environment variables
test -z "$NVIM_STATE" && set -x NVIM_STATE "$XDG_STATE_HOME/nvim"
test -z "$NVIM_CONFIG_HOME" && set -x NVIM_CONFIG_HOME "$XDG_CONFIG_HOME/nvim"
@@ -75,136 +42,129 @@ test -z "$NVIM_SHADA_PATH" && set -x NVIM_SHADA_PATH "$NVIM_STATE/shada"
test -z "$NVIM_UNDO_PATH" && set -x NVIM_UNDO_PATH "$NVIM_STATE/undo"
# Ansible configuration
# https://docs.ansible.com/ansible/latest/reference_appendices/config.html
test -z "$ANSIBLE_HOME" && set -x ANSIBLE_HOME "$XDG_CONFIG_HOME/ansible"
test -z "$ANSIBLE_CONFIG" && set -x ANSIBLE_CONFIG "$ANSIBLE_HOME/ansible.cfg"
test -z "$ANSIBLE_GALAXY_CACHE_DIR" && set -x ANSIBLE_GALAXY_CACHE_DIR "$XDG_CACHE_HOME/ansible/galaxy_cache"
set -q ANSIBLE_HOME; or set -x ANSIBLE_HOME "$XDG_CONFIG_HOME/ansible"
set -q ANSIBLE_CONFIG; or set -x ANSIBLE_CONFIG "$ANSIBLE_HOME/ansible.cfg"
set -q ANSIBLE_GALAXY_CACHE_DIR; or set -x ANSIBLE_GALAXY_CACHE_DIR "$XDG_CACHE_HOME/ansible/galaxy_cache"
x-dc "$ANSIBLE_HOME"
x-dc "$ANSIBLE_GALAXY_CACHE_DIR"
# AWS configuration
test -z "$AWS_CONFIG_FILE" && set -x AWS_CONFIG_FILE "$XDG_STATE_HOME/aws/config"
test -z "$AWS_SHARED_CREDENTIALS_FILE" && set -x AWS_SHARED_CREDENTIALS_FILE "$XDG_STATE_HOME/aws/credentials"
test -z "$AWS_SESSION_TOKEN" && set -x AWS_SESSION_TOKEN "$XDG_STATE_HOME/aws/session_token"
test -z "$AWS_DATA_PATH" && set -x AWS_DATA_PATH "$XDG_DATA_HOME/aws"
test -z "$AWS_DEFAULT_OUTPUT" && set -x AWS_DEFAULT_OUTPUT "table"
test -z "$AWS_CONFIGURE_KEYS" && set -x AWS_CONFIGURE_KEYS "true"
test -z "$AWS_CONFIGURE_SESSION" && set -x AWS_CONFIGURE_SESSION "true"
test -z "$AWS_CONFIGURE_SESSION_DURATION" && set -x AWS_CONFIGURE_SESSION_DURATION "7200"
test -z "$AWS_CONFIGURE_SESSION_MFA" && set -x AWS_CONFIGURE_SESSION_MFA "true"
test -z "$AWS_CONFIGURE_PROFILE" && set -x AWS_CONFIGURE_PROFILE "true"
test -z "$AWS_CONFIGURE_PROMPT" && set -x AWS_CONFIGURE_PROMPT "true"
test -z "$AWS_CONFIGURE_PROMPT_DEFAULT" && set -x AWS_CONFIGURE_PROMPT_DEFAULT "true"
set -q AWS_CONFIG_FILE; or set -x AWS_CONFIG_FILE "$XDG_STATE_HOME/aws/config"
set -q AWS_SHARED_CREDENTIALS_FILE; or set -x AWS_SHARED_CREDENTIALS_FILE "$XDG_STATE_HOME/aws/credentials"
set -q AWS_SESSION_TOKEN; or set -x AWS_SESSION_TOKEN "$XDG_STATE_HOME/aws/session_token"
set -q AWS_DATA_PATH; or set -x AWS_DATA_PATH "$XDG_DATA_HOME/aws"
set -q AWS_DEFAULT_OUTPUT; or set -x AWS_DEFAULT_OUTPUT "table"
set -q AWS_CONFIGURE_KEYS; or set -x AWS_CONFIGURE_KEYS "true"
set -q AWS_CONFIGURE_SESSION; or set -x AWS_CONFIGURE_SESSION "true"
set -q AWS_CONFIGURE_SESSION_DURATION; or set -x AWS_CONFIGURE_SESSION_DURATION "7200"
set -q AWS_CONFIGURE_SESSION_MFA; or set -x AWS_CONFIGURE_SESSION_MFA "true"
set -q AWS_CONFIGURE_PROFILE; or set -x AWS_CONFIGURE_PROFILE "true"
set -q AWS_CONFIGURE_PROMPT; or set -x AWS_CONFIGURE_PROMPT "true"
set -q AWS_CONFIGURE_PROMPT_DEFAULT; or set -x AWS_CONFIGURE_PROMPT_DEFAULT "true"
# Brew configuration
test -z "$HOMEBREW_NO_ANALYTICS" && set -x HOMEBREW_NO_ANALYTICS "true"
test -z "$HOMEBREW_NO_ENV_HINTS" && set -x HOMEBREW_NO_ENV_HINTS "true"
test -z "$HOMEBREW_BUNDLE_MAS_SKIP" && set -x HOMEBREW_BUNDLE_MAS_SKIP "true"
test -z "$HOMEBREW_BUNDLE_FILE" && set -x HOMEBREW_BUNDLE_FILE "$XDG_CONFIG_HOME/homebrew/Brewfile"
set -q HOMEBREW_NO_ANALYTICS; or set -x HOMEBREW_NO_ANALYTICS "true"
set -q HOMEBREW_NO_ENV_HINTS; or set -x HOMEBREW_NO_ENV_HINTS "true"
set -q HOMEBREW_BUNDLE_MAS_SKIP; or set -x HOMEBREW_BUNDLE_MAS_SKIP "true"
set -q HOMEBREW_BUNDLE_FILE; or set -x HOMEBREW_BUNDLE_FILE "$XDG_CONFIG_HOME/homebrew/Brewfile"
# Set composer environment variables
test -z "$COMPOSER_HOME" && set -x COMPOSER_HOME "$XDG_STATE_HOME/composer"
test -z "$COMPOSER_BIN" && set -x COMPOSER_BIN "$COMPOSER_HOME/vendor/bin"
# Composer configuration
set -q COMPOSER_HOME; or set -x COMPOSER_HOME "$XDG_STATE_HOME/composer"
set -q COMPOSER_BIN; or set -x COMPOSER_BIN "$COMPOSER_HOME/vendor/bin"
fish_add_path "$COMPOSER_BIN"
# direnv, https://direnv.net/
# https://direnv.net/docs/hook.html
# Set the hook to show the direnv message in a different color
# export DIRENV_LOG_FORMAT=$'\033[2mdirenv: %s\033[0m'
test -z "$DIRENV_LOG_FORMAT" && set -x DIRENV_LOG_FORMAT ''
# direnv configuration
set -q DIRENV_LOG_FORMAT; or set -x DIRENV_LOG_FORMAT ''
# docker, https://docs.docker.com/engine/reference/commandline/cli/
test -z "$DOCKER_CONFIG" && set -x DOCKER_CONFIG "$XDG_CONFIG_HOME/docker"
# Docker configuration
set -q DOCKER_CONFIG; or set -x DOCKER_CONFIG "$XDG_CONFIG_HOME/docker"
x-dc "$DOCKER_CONFIG"
test -z "$DOCKER_HIDE_LEGACY_COMMANDS" && set -x DOCKER_HIDE_LEGACY_COMMANDS "true"
# Docke: Disable snyk ad
test -z "$DOCKER_SCAN_SUGGEST" && set -x DOCKER_SCAN_SUGGEST "false"
set -q DOCKER_HIDE_LEGACY_COMMANDS; or set -x DOCKER_HIDE_LEGACY_COMMANDS "true"
set -q DOCKER_SCAN_SUGGEST; or set -x DOCKER_SCAN_SUGGEST "false"
# fzf
test -z "$FZF_BASE" && set -x FZF_BASE "$XDG_CONFIG_HOME/fzf"
test -z "$FZF_DEFAULT_OPTS" && set -x FZF_DEFAULT_OPTS '--height 40% --tmux bottom,40% --layout reverse --border top'
# fzf configuration
set -q FZF_BASE; or set -x FZF_BASE "$XDG_CONFIG_HOME/fzf"
set -q FZF_DEFAULT_OPTS; or set -x FZF_DEFAULT_OPTS '--height 40% --tmux bottom,40% --layout reverse --border top'
# GnuPG
# https://gnupg.org/documentation/manuals/gnupg/Invoking-GPG.html
test -z "$GNUPGHOME" && set -x GNUPGHOME "$XDG_DATA_HOME/gnupg"
# GnuPG configuration
set -q GNUPGHOME; or set -x GNUPGHOME "$XDG_DATA_HOME/gnupg"
# Go
test -z "$GOPATH" && set -x GOPATH "$XDG_DATA_HOME/go"
test -z "$GOBIN" && set -x GOBIN "$XDG_BIN_HOME"
# Go configuration
set -q GOPATH; or set -x GOPATH "$XDG_DATA_HOME/go"
set -q GOBIN; or set -x GOBIN "$XDG_BIN_HOME"
fish_add_path "$GOBIN"
# NPM: Add npm packages to path
if x-have node;
set -x NVM_NODE_BIN_DIR $(dirname $(which node))
set -x NVM_NODE_BIN_DIR (dirname (which node))
fish_add_path "$NVM_NODE_BIN_DIR"
end
# 1Password
test -z "$OP_CACHE" && set -x OP_CACHE "$XDG_STATE_HOME/1password"
# 1Password configuration
set -q OP_CACHE; or set -x OP_CACHE "$XDG_STATE_HOME/1password"
# Python
test -z "$WORKON_HOME" && set -x WORKON_HOME "$XDG_DATA_HOME/virtualenvs"
test -z "$PYENV_ROOT" && set -x PYENV_ROOT "$XDG_DATA_HOME/pyenv"
# Python configuration
set -q WORKON_HOME; or set -x WORKON_HOME "$XDG_DATA_HOME/virtualenvs"
set -q PYENV_ROOT; or set -x PYENV_ROOT "$XDG_DATA_HOME/pyenv"
fish_add_path "$PYENV_ROOT/bin"
## Set poetry environment variables
test -z "$POETRY_HOME" && set -x POETRY_HOME "$XDG_DATA_HOME/poetry"
# Poetry configuration
set -q POETRY_HOME; or set -x POETRY_HOME "$XDG_DATA_HOME/poetry"
fish_add_path "$POETRY_HOME/bin"
# Rust / cargo
test -z "$CARGO_HOME" && set -x CARGO_HOME "$XDG_DATA_HOME/cargo"
test -z "$CARGO_BIN_HOME" && set -x CARGO_BIN_HOME "$XDG_BIN_HOME"
test -z "$RUSTUP_HOME" && set -x RUSTUP_HOME "$XDG_DATA_HOME/rustup"
# Rust / cargo configuration
set -q CARGO_HOME; or set -x CARGO_HOME "$XDG_DATA_HOME/cargo"
set -q CARGO_BIN_HOME; or set -x CARGO_BIN_HOME "$XDG_BIN_HOME"
set -q RUSTUP_HOME; or set -x RUSTUP_HOME "$XDG_DATA_HOME/rustup"
set -x RUST_WITHOUT "clippy,docs,rls"
fish_add_path "$CARGO_BIN_HOME"
fish_add_path "$XDG_SHARE_HOME/bob/nvim-bin"
# screen
# https://www.gnu.org/software/screen/manual/screen.html
test -z "$SCREENRC" && set -x SCREENRC "$XDG_CONFIG_HOME/misc/screenrc"
# screen configuration
set -q SCREENRC; or set -x SCREENRC "$XDG_CONFIG_HOME/misc/screenrc"
# Sonarlint
test -z "$SONARLINT_HOME" && set -x SONARLINT_HOME "$XDG_DATA_HOME/sonarlint"
test -z "$SONARLINT_BIN" && set -x SONARLINT_BIN "$XDG_BIN_HOME"
test -z "$SONARLINT_USER_HOME" && set -x SONARLINT_USER_HOME "$XDG_DATA_HOME/sonarlint"
# Sonarlint configuration
set -q SONARLINT_HOME; or set -x SONARLINT_HOME "$XDG_DATA_HOME/sonarlint"
set -q SONARLINT_BIN; or set -x SONARLINT_BIN "$XDG_BIN_HOME"
set -q SONARLINT_USER_HOME; or set -x SONARLINT_USER_HOME "$XDG_DATA_HOME/sonarlint"
# Terraform
test -z "$TF_DATA_DIR" && set -x TF_DATA_DIR "$XDG_STATE_HOME/terraform"
test -z "$TF_CLI_CONFIG_FILE" && set -x TF_CLI_CONFIG_FILE "$XDG_CONFIG_HOME/terraform/terraformrc"
test -z "$TF_PLUGIN_CACHE_DIR" && set -x TF_PLUGIN_CACHE_DIR "$XDG_CACHE_HOME/terraform/plugin-cache"
# Terraform configuration
set -q TF_DATA_DIR; or set -x TF_DATA_DIR "$XDG_STATE_HOME/terraform"
set -q TF_CLI_CONFIG_FILE; or set -x TF_CLI_CONFIG_FILE "$XDG_CONFIG_HOME/terraform/terraformrc"
set -q TF_PLUGIN_CACHE_DIR; or set -x TF_PLUGIN_CACHE_DIR "$XDG_CACHE_HOME/terraform/plugin-cache"
# tmux
# https://tmux.github.io/
test -z "$TMUX_TMPDIR" && set -x TMUX_TMPDIR "$XDG_STATE_HOME/tmux"
test -z "$TMUX_CONF_DIR" && set -x TMUX_CONF_DIR "$XDG_CONFIG_HOME/tmux"
test -z "$TMUX_PLUGINS" && set -x TMUX_PLUGINS "$TMUX_CONF_DIR/plugins"
test -z "$TMUX_CONF" && set -x TMUX_CONF "$TMUX_CONF_DIR/tmux.conf"
test -z "$TMUX_PLUGIN_MANAGER_PATH" && set -x TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGINS"
# tmux configuration
set -q TMUX_TMPDIR; or set -x TMUX_TMPDIR "$XDG_STATE_HOME/tmux"
set -q TMUX_CONF_DIR; or set -x TMUX_CONF_DIR "$XDG_CONFIG_HOME/tmux"
set -q TMUX_PLUGINS; or set -x TMUX_PLUGINS "$TMUX_CONF_DIR/plugins"
set -q TMUX_CONF; or set -x TMUX_CONF "$TMUX_CONF_DIR/tmux.conf"
set -q TMUX_PLUGIN_MANAGER_PATH; or set -x TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGINS"
# tms
# https://github.com/jrmoulton/tmux-sessionizer
test -z "$TMS_CONFIG_FILE" && set -x TMS_CONFIG_FILE "$XDG_CONFIG_HOME/tms/config.toml"
# Source tmux theme activation script for Fish shell
if test -f "$DOTFILES/config/tmux/theme-activate.fish"
source "$DOTFILES/config/tmux/theme-activate.fish"
end
# wakatime
# https://github.com/wakatime/wakatime-cli
test -z "$WAKATIME_HOME" && set -x WAKATIME_HOME "$XDG_STATE_HOME/wakatime"
# tms configuration
set -q TMS_CONFIG_FILE; or set -x TMS_CONFIG_FILE "$XDG_CONFIG_HOME/tms/config.toml"
# wakatime configuration
set -q WAKATIME_HOME; or set -x WAKATIME_HOME "$XDG_STATE_HOME/wakatime"
x-dc "$WAKATIME_HOME"
# misc
test -z "$CHEAT_USE_FZF" && set -x CHEAT_USE_FZF "true"
test -z "$SQLITE_HISTORY" && set -x SQLITE_HISTORY "$XDG_CACHE_HOME/sqlite/sqlite_history"
# Miscellaneous configuration
set -q CHEAT_USE_FZF; or set -x CHEAT_USE_FZF "true"
set -q SQLITE_HISTORY; or set -x SQLITE_HISTORY "$XDG_CACHE_HOME/sqlite/sqlite_history"
# Source exports-secret.fish if it exists
# Source additional configuration files if they exist
if test -f "$DOTFILES/config/fish/exports-secret.fish"
source "$DOTFILES/config/fish/exports-secret.fish"
end
# Source $DOTFILES/hosts/$HOSTNAME/config/fish/exports.fish if it exists
if test -f "$DOTFILES/hosts/$HOSTNAME/config/fish/exports.fish"
source "$DOTFILES/hosts/$HOSTNAME/config/fish/exports.fish"
end
# Source $DOTFILES/hosts/$HOSTNAME/config/fish/exports-secret.fish if it exists
if test -f "$DOTFILES/hosts/$HOSTNAME/config/fish/exports-secret.fish"
source "$DOTFILES/hosts/$HOSTNAME/config/fish/exports-secret.fish"
end

View File

@@ -3,7 +3,6 @@ jorgebucaran/nvm.fish
ilancosman/tide@v6
jethrokuan/z
halostatue/fish-macos@v7
ehfive/fish-bash2env
jgusta/paths
danhper/fish-ssh-agent
halostatue/fish-brew@v3

View File

@@ -1,56 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2022 Huang-Huang Bao
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
# shellcheck disable=SC2076
set -e
disallowd_vars_arr=(
_
fish_kill_signal
fish_killring
fish_pid
history
hostname
PWD
pipestatus
SHLVL
status
status_generation
version
)
disallowd_vars=" ${disallowd_vars_arr[*]} "
fish_escape() {
value="${1//\\/\\\\}"
value="${value//\'/\\\'}"
echo "'${value}'"
}
flag_impure="$__FISH_BASH2ENV_IMPURE"
unset __FISH_BASH2ENV_IMPURE
if [[ -z "$flag_impure" ]]; then
old_env=" $(env -0 | tr '\0' ' ') "
fi
eval_status=
eval "$*" 1>&2 || eval_status=$?
env -0 | while IFS= read -rs -d $'\0' line; do
if [[ -z "$flag_impure" && "${old_env}" =~ " ${line} " ]]; then
continue
fi
name="${line%%=*}"
if [[ "${disallowd_vars}" =~ " ${name} " ]]; then
continue
fi
value="$(fish_escape "${line#*=}")"
echo "set -gx ${name} ${value}"
done
exit $eval_status

View File

@@ -1,39 +0,0 @@
# Copyright (c) 2022 Huang-Huang Bao
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
function bash2env -d "Import environment variables modified by given bash command"
argparse --stop-nonopt h/help i/impure -- $argv
or set argv
function _print_usage
echo 'Usage:' \
(set_color $fish_color_command)'bash2env' \
(set_color $fish_color_normal)'[-i/--impure]' \
(set_color $fish_color_param)"<bash command>"
end
if test -n "$_flag_help"
_print_usage
return
end
if test (count $argv) -eq 0
_print_usage
return 22
end
if test -n "$_flag_impure"
set _flag_impure 1
end
set -l DIR (dirname (status -f))
__FISH_BASH2ENV_IMPURE=$_flag_impure command \
bash $DIR/__bash2env.sh $argv | source
for code in $pipestatus
if test $code != 0
return $code
end
end
end

View File

@@ -6,7 +6,8 @@
# Defaults
[ -z "$DOTFILES" ] && export DOTFILES="$HOME/.dotfiles"
export DOTFILES_CURRENT_SHELL=$(basename "$SHELL")
DOTFILES_CURRENT_SHELL=$(basename "$SHELL")
export DOTFILES_CURRENT_SHELL
# Enable verbosity with VERBOSE=1
VERBOSE="${VERBOSE:-0}"

View File

@@ -16,13 +16,13 @@
# -u : Unset the specified option.
set -g default-terminal "tmux-256color" # Set default terminal to 256 colors
set -g detach-on-destroy off # don't detach tmux when killing a session
set -g display-time 0 # Hide clock
set -g focus-events on # Focus events enabled for terminals that support them
set -g mouse on # Mouse support
set -g set-titles on # Allow tmux to set the terminal title
set -g status on # Setting status on
set -g status-keys vi # vi keys to move between panes
set -g detach-on-destroy off # don't detach tmux when killing a session
set -g display-time 0 # Hide clock
set -g focus-events on # Focus events enabled for terminals that support them
set -g mouse on # Mouse support
set -g set-titles on # Allow tmux to set the terminal title
set -g status on # Setting status on
set -g status-keys vi # vi keys to move between panes
# Activity Monitoring (for when something happens in another pain)
set -g monitor-activity on
@@ -43,7 +43,6 @@ set -g renumber-windows on
# Activate with `DEBUG=1 tmux -vv`
if-shell '[ "$DEBUG" = "1" ]' 'set -g debug-file ~/.cache/tmux-debug.log'
# ╭──────────────────────────────────────────────────────────╮
# │ Theme │
# ╰──────────────────────────────────────────────────────────╯
@@ -73,10 +72,10 @@ set -g prefix C-Space
bind C-Space send-prefix
# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Easier switching between window
bind C-n next-window
@@ -125,7 +124,7 @@ set -g @tmux_window_name_use_tilde "True"
# https://github.com/erikw/tmux-dark-notify
set -g @dark-notify-theme-path-light "$HOME/.dotfiles/config/tmux/theme-light.conf"
set -g @dark-notify-theme-path-dark "$HOME/.dotfiles/config/tmux/theme-dark.conf"
set -g @dark-notify-theme-path-dark "$HOME/.dotfiles/config/tmux/theme-dark.conf"
## https://github.com/MunifTanjim/tmux-mode-indicator
set -g @mode_indicator_copy_mode_style 'bg=default,fg=yellow'
@@ -145,7 +144,7 @@ run-shell "$HOME/.dotfiles/config/tmux/rename-session.sh"
# Load theme based on tmux-dark-notify state.
# This script helps states where dark-notify is not available,
# and we want to have light or dark state constantly available.
run-shell "$HOME/.dotfiles/config/tmux/theme-activate.sh"
# run-shell "$HOME/.dotfiles/config/tmux/theme-activate.sh"
# ── Sourcing the plugins ──────────────────────────────────────────────
@@ -159,4 +158,4 @@ run-shell "$HOME/.dotfiles/config/tmux/plugins/tmux-yank/yank.tmux"
run-shell "$HOME/.dotfiles/config/tmux/plugins/tmux-current-pane-hostname/current_pane_hostname.tmux"
run-shell "$HOME/.dotfiles/config/tmux/plugins/tmux-fzf-url/fzf-url.tmux"
run-shell "$HOME/.dotfiles/config/tmux/plugins/tmux-dark-notify/main.tmux"
# run-shell "$HOME/.dotfiles/config/tmux/plugins/tmux-dark-notify/main.tmux"

1
config/vim/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
plugged

2887
config/vim/autoload/plug.vim Normal file

File diff suppressed because it is too large Load Diff

697
config/vim/vimrc Normal file
View File

@@ -0,0 +1,697 @@
" vim-bootstrap 2024-04-26 07:50:42
" https://tlvince.com/vim-respect-xdg
set directory=$XDG_CACHE_HOME/vim,~/,/tmp
set backupdir=$XDG_CACHE_HOME/vim,~/,/tmp
set viminfo+=n$XDG_CACHE_HOME/vim/viminfo
set runtimepath=$XDG_CONFIG_HOME/vim,$XDG_CONFIG_HOME/vim/after,$VIM,$VIMRUNTIME
let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc"
set v=$XDG_CONFIG_HOME/vim
"*****************************************************************************
"" Vim-Plug core
"*****************************************************************************
let vimplug_exists=expand(v . '/autoload/plug.vim')
if has('win32')&&!has('win64')
let curl_exists=expand('C:\Windows\Sysnative\curl.exe')
else
let curl_exists=expand('curl')
endif
let g:vim_bootstrap_langs = "go,html,javascript,lua,php,python,typescript"
let g:vim_bootstrap_editor = "vim" " nvim or vim
let g:vim_bootstrap_theme = "material"
let g:vim_bootstrap_frams = "vuejs"
if !filereadable(vimplug_exists)
if !executable(curl_exists)
echoerr "You have to install curl or first install vim-plug yourself!"
execute "q!"
endif
echo "Installing Vim-Plug..."
echo ""
silent exec "!"curl_exists" -fLo " . shellescape(vimplug_exists) . " --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
let g:not_finish_vimplug = "yes"
autocmd VimEnter * PlugInstall
endif
" Required:
call plug#begin(expand(v . '/plugged'))
"*****************************************************************************
"" Plug install packages
"*****************************************************************************
Plug 'scrooloose/nerdtree'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'airblade/vim-gitgutter'
Plug 'vim-scripts/grep.vim'
Plug 'vim-scripts/CSApprox'
Plug 'Raimondi/delimitMate'
Plug 'majutsushi/tagbar'
Plug 'dense-analysis/ale'
Plug 'Yggdroot/indentLine'
Plug 'editor-bootstrap/vim-bootstrap-updater'
Plug 'tpope/vim-rhubarb' " required by fugitive to :GBrowse
Plug 'kaicataldo/material.vim'
if isdirectory('~/.local/bin/fzf')
Plug '~/.local/bin/fzf' | Plug 'junegunn/fzf.vim'
else
Plug 'junegunn/fzf', { 'dir': '~/.local/bin/fzf', 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
endif
let g:make = 'gmake'
if exists('make')
let g:make = 'make'
endif
Plug 'Shougo/vimproc.vim', {'do': g:make}
"" Vim-Session
Plug 'xolox/vim-misc'
Plug 'xolox/vim-session'
"" Snippets
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
"*****************************************************************************
"" Custom bundles
"*****************************************************************************
" go
"" Go Lang Bundle
Plug 'fatih/vim-go', {'do': ':GoInstallBinaries'}
" html
"" HTML Bundle
Plug 'hail2u/vim-css3-syntax'
Plug 'gko/vim-coloresque'
Plug 'tpope/vim-haml'
Plug 'mattn/emmet-vim'
" javascript
"" Javascript Bundle
Plug 'jelera/vim-javascript-syntax'
" lua
"" Lua Bundle
Plug 'xolox/vim-lua-ftplugin'
Plug 'xolox/vim-lua-inspect'
" php
"" PHP Bundle
Plug 'phpactor/phpactor', {'for': 'php', 'do': 'composer install --no-dev -o'}
Plug 'stephpy/vim-php-cs-fixer'
" python
"" Python Bundle
Plug 'davidhalter/jedi-vim'
Plug 'raimon49/requirements.txt.vim', {'for': 'requirements'}
" typescript
Plug 'leafgarland/typescript-vim'
Plug 'HerringtonDarkholme/yats.vim'
" vuejs
Plug 'posva/vim-vue'
Plug 'leafOfTree/vim-vue-plugin'
"*****************************************************************************
"*****************************************************************************
"" Include user's extra bundle
if filereadable(expand("~/.config/vim/vimrc.local.bundles"))
source ~/.config/vim/vimrc.local.bundles
endif
call plug#end()
" Required:
filetype plugin indent on
"*****************************************************************************
"" Basic Setup
"*****************************************************************************"
"" Encoding
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8
set ttyfast
"" Fix backspace indent
set backspace=indent,eol,start
"" Tabs. May be overridden by autocmd rules
set tabstop=4
set softtabstop=0
set shiftwidth=4
set expandtab
"" Map leader to <space>
let mapleader=' '
"" Enable hidden buffers
set hidden
"" Searching
set hlsearch
set incsearch
set ignorecase
set smartcase
set fileformats=unix,dos,mac
if exists('$SHELL')
set shell=$SHELL
else
set shell=/bin/sh
endif
" session management
let g:session_directory = "~/.local/state/vim/session"
let g:session_autoload = "no"
let g:session_autosave = "yes"
let g:session_command_aliases = 1
"*****************************************************************************
"" Visual Settings
"*****************************************************************************
syntax on
set ruler
set number
let no_buffers_menu=1
colorscheme material
" Better command line completion
set wildmenu
" mouse support
set mouse=a
set mousemodel=popup
set t_Co=256
set guioptions=egmrti
set gfn=Monospace\ 13
if has("gui_running")
if has("gui_mac") || has("gui_macvim")
set guifont=Menlo:h14
set transparency=7
endif
else
let g:CSApprox_loaded = 1
" IndentLine
let g:indentLine_enabled = 1
let g:indentLine_concealcursor = ''
let g:indentLine_char = '┆'
let g:indentLine_faster = 1
if $COLORTERM == 'gnome-terminal'
set term=gnome-256color
else
if $TERM == 'xterm'
set term=xterm-256color
endif
endif
endif
if &term =~ '256color'
set t_ut=
endif
"" Disable the blinking cursor.
set gcr=a:blinkon0
set scrolloff=3
"" Status bar
set laststatus=2
"" Use modeline overrides
set modeline
set modelines=10
set title
set titleold="Terminal"
set titlestring=%F
set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\
" Search mappings: These will make it so that going to the next one in a
" search will center on the line it's found in.
nnoremap n nzzzv
nnoremap N Nzzzv
if exists("*fugitive#statusline")
set statusline+=%{fugitive#statusline()}
endif
" vim-airline
let g:airline_theme = 'powerlineish'
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#ale#enabled = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tagbar#enabled = 1
let g:airline_skip_empty_sections = 1
"*****************************************************************************
"" Abbreviations
"*****************************************************************************
"" no one is really happy until you have this shortcuts
cnoreabbrev W! w!
cnoreabbrev Q! q!
cnoreabbrev Qall! qall!
cnoreabbrev Wq wq
cnoreabbrev Wa wa
cnoreabbrev wQ wq
cnoreabbrev WQ wq
cnoreabbrev W w
cnoreabbrev Q q
cnoreabbrev Qall qall
"" NERDTree configuration
let g:NERDTreeChDirMode=2
let g:NERDTreeIgnore=['node_modules','vendor','\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '__pycache__']
let g:NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$']
let g:NERDTreeShowBookmarks=1
let g:nerdtree_tabs_focus_on_files=1
let g:NERDTreeMapOpenInTabSilent = '<RightMouse>'
let g:NERDTreeWinSize = 50
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.db,*.sqlite,*node_modules/,*vendor/
nnoremap <silent> <F2> :NERDTreeFind<CR>
nnoremap <silent> <F3> :NERDTreeToggle<CR>
" grep.vim
nnoremap <silent> <leader>f :Rgrep<CR>
let Grep_Default_Options = '-IR'
let Grep_Skip_Files = '*.log *.db .DS_Store'
let Grep_Skip_Dirs = '.git node_modules vendor plugged'
" terminal emulation
nnoremap <silent> <leader>sh :terminal<CR>
"*****************************************************************************
"" Commands
"*****************************************************************************
" remove trailing whitespaces
command! FixWhitespace :%s/\s\+$//e
"*****************************************************************************
"" Functions
"*****************************************************************************
if !exists('*s:setupWrapping')
function s:setupWrapping()
set wrap
set wm=2
set textwidth=79
endfunction
endif
"*****************************************************************************
"" Autocmd Rules
"*****************************************************************************
"" The PC is fast enough, do syntax highlight syncing from start unless 200 lines
augroup vimrc-sync-fromstart
autocmd!
autocmd BufEnter * :syntax sync maxlines=200
augroup END
"" Remember cursor position
augroup vimrc-remember-cursor-position
autocmd!
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
augroup END
"" txt
augroup vimrc-wrapping
autocmd!
autocmd BufRead,BufNewFile *.txt call s:setupWrapping()
augroup END
"" make/cmake
augroup vimrc-make-cmake
autocmd!
autocmd FileType make setlocal noexpandtab
autocmd BufNewFile,BufRead CMakeLists.txt setlocal filetype=cmake
augroup END
set autoread
"*****************************************************************************
"" Mappings
"*****************************************************************************
"" Split
noremap <Leader>h :<C-u>split<CR>
noremap <Leader>v :<C-u>vsplit<CR>
"" Git
noremap <Leader>ga :Gwrite<CR>
noremap <Leader>gc :Git commit --verbose<CR>
noremap <Leader>gsh :Git push<CR>
noremap <Leader>gll :Git pull<CR>
noremap <Leader>gs :Git<CR>
noremap <Leader>gb :Git blame<CR>
noremap <Leader>gd :Gvdiffsplit<CR>
noremap <Leader>gr :GRemove<CR>
" session management
nnoremap <leader>so :OpenSession<Space>
nnoremap <leader>ss :SaveSession<Space>
nnoremap <leader>sd :DeleteSession<CR>
nnoremap <leader>sc :CloseSession<CR>
"" Tabs
nnoremap <Tab> gt
nnoremap <S-Tab> gT
nnoremap <silent> <S-t> :tabnew<CR>
"" Set working directory
nnoremap <leader>. :lcd %:p:h<CR>
"" Opens an edit command with the path of the currently edited file filled in
noremap <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
"" Opens a tab edit command with the path of the currently edited file filled
noremap <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR>
"" fzf.vim
set wildmode=list:longest,list:full
set wildignore+=*.o,*.obj,.git,*.rbc,*.pyc,__pycache__,vendor
let $FZF_DEFAULT_COMMAND = "find * -path '*/\.*' -prune -o -path 'node_modules/**' -prune -o -path 'target/**' -prune -o -path 'vendor/**' -prune -o -path 'dist/**' -prune -o -type f -print -o -type l -print 2> /dev/null"
" The Silver Searcher
if executable('ag')
let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""'
set grepprg=ag\ --nogroup\ --nocolor
endif
" ripgrep
if executable('rg')
let $FZF_DEFAULT_COMMAND = 'rg --files --hidden --follow --glob "!.git/*"'
set grepprg=rg\ --vimgrep
command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --hidden --follow --glob "!.git/*" --color "always" '.shellescape(<q-args>).'| tr -d "\017"', 1, <bang>0)
endif
cnoremap <C-P> <C-R>=expand("%:p:h") . "/" <CR>
nnoremap <silent> <leader>b :Buffers<CR>
nnoremap <silent> <leader>e :FZF -m<CR>
"Recovery commands from history through FZF
nmap <leader>y :History:<CR>
" snippets
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<c-b>"
let g:UltiSnipsEditSplit="vertical"
" ale
let g:ale_linters = {}
" Tagbar
nmap <silent> <F4> :TagbarToggle<CR>
let g:tagbar_autofocus = 1
" Disable visualbell
set noerrorbells visualbell t_vb=
if has('autocmd')
autocmd GUIEnter * set visualbell t_vb=
endif
"" Copy/Paste/Cut
if has('unnamedplus')
set clipboard=unnamed,unnamedplus
endif
noremap YY "+y<CR>
noremap <leader>p "+gP<CR>
noremap XX "+x<CR>
if has('macunix')
" pbcopy for OSX copy/paste
vmap <C-x> :!pbcopy<CR>
vmap <C-c> :w !pbcopy<CR><CR>
endif
"" Buffer nav
noremap <leader>z :bp<CR>
noremap <leader>q :bp<CR>
noremap <leader>x :bn<CR>
noremap <leader>w :bn<CR>
"" Close buffer
noremap <leader>c :bd<CR>
"" Clean search (highlight)
nnoremap <silent> <leader><space> :noh<cr>
"" Switching windows
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-l> <C-w>l
noremap <C-h> <C-w>h
"" Vmap for maintain Visual Mode after shifting > and <
vmap < <gv
vmap > >gv
"" Move visual block
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
"" Open current line on GitHub
nnoremap <Leader>o :.GBrowse<CR>
"*****************************************************************************
"" Custom configs
"*****************************************************************************
" go
" vim-go
" run :GoBuild or :GoTestCompile based on the go file
function! s:build_go_files()
let l:file = expand('%')
if l:file =~# '^\f\+_test\.go$'
call go#test#Test(0, 1)
elseif l:file =~# '^\f\+\.go$'
call go#cmd#Build(0)
endif
endfunction
let g:go_list_type = "quickfix"
let g:go_fmt_command = "goimports"
let g:go_fmt_fail_silently = 1
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_structs = 1
let g:go_highlight_generate_tags = 1
let g:go_highlight_space_tab_error = 0
let g:go_highlight_array_whitespace_error = 0
let g:go_highlight_trailing_whitespace_error = 0
let g:go_highlight_extra_types = 1
autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 softtabstop=4
augroup completion_preview_close
autocmd!
if v:version > 703 || v:version == 703 && has('patch598')
autocmd CompleteDone * if !&previewwindow && &completeopt =~ 'preview' | silent! pclose | endif
endif
augroup END
augroup go
au!
au Filetype go command! -bang A call go#alternate#Switch(<bang>0, 'edit')
au Filetype go command! -bang AV call go#alternate#Switch(<bang>0, 'vsplit')
au Filetype go command! -bang AS call go#alternate#Switch(<bang>0, 'split')
au Filetype go command! -bang AT call go#alternate#Switch(<bang>0, 'tabe')
au FileType go nmap <Leader>dd <Plug>(go-def-vertical)
au FileType go nmap <Leader>dv <Plug>(go-doc-vertical)
au FileType go nmap <Leader>db <Plug>(go-doc-browser)
au FileType go nmap <leader>r <Plug>(go-run)
au FileType go nmap <leader>t <Plug>(go-test)
au FileType go nmap <Leader>gt <Plug>(go-coverage-toggle)
au FileType go nmap <Leader>i <Plug>(go-info)
au FileType go nmap <silent> <Leader>l <Plug>(go-metalinter)
au FileType go nmap <C-g> :GoDecls<cr>
au FileType go nmap <leader>dr :GoDeclsDir<cr>
au FileType go imap <C-g> <esc>:<C-u>GoDecls<cr>
au FileType go imap <leader>dr <esc>:<C-u>GoDeclsDir<cr>
au FileType go nmap <leader>rb :<C-u>call <SID>build_go_files()<CR>
augroup END
" ale
:call extend(g:ale_linters, {
\"go": ['golint', 'go vet'], })
" html
" for html files, 2 spaces
autocmd Filetype html setlocal ts=2 sw=2 expandtab
" javascript
let g:javascript_enable_domhtmlcss = 1
" vim-javascript
augroup vimrc-javascript
autocmd!
autocmd FileType javascript setl tabstop=4|setl shiftwidth=4|setl expandtab softtabstop=4
augroup END
" lua
" php
" Phpactor plugin
" Include use statement
nmap <Leader>u :call phpactor#UseAdd()<CR>
" Invoke the context menu
nmap <Leader>mm :call phpactor#ContextMenu()<CR>
" Invoke the navigation menu
nmap <Leader>nn :call phpactor#Navigate()<CR>
" Goto definition of class or class member under the cursor
nmap <Leader>oo :call phpactor#GotoDefinition()<CR>
nmap <Leader>oh :call phpactor#GotoDefinition('hsplit')<CR>
nmap <Leader>ov :call phpactor#GotoDefinition('vsplit')<CR>
nmap <Leader>ot :call phpactor#GotoDefinition('tabnew')<CR>
" Show brief information about the symbol under the cursor
nmap <Leader>K :call phpactor#Hover()<CR>
" Transform the classes in the current file
nmap <Leader>tt :call phpactor#Transform()<CR>
" Generate a new class (replacing the current file)
nmap <Leader>cc :call phpactor#ClassNew()<CR>
" Extract expression (normal mode)
nmap <silent><Leader>ee :call phpactor#ExtractExpression(v:false)<CR>
" Extract expression from selection
vmap <silent><Leader>ee :<C-U>call phpactor#ExtractExpression(v:true)<CR>
" Extract method from selection
vmap <silent><Leader>em :<C-U>call phpactor#ExtractMethod()<CR>
" python
" vim-python
augroup vimrc-python
autocmd!
autocmd FileType python setlocal expandtab
\ shiftwidth=4 tabstop=8 colorcolumn=79
\ formatoptions+=croq softtabstop=4
\ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
augroup END
" jedi-vim
let g:jedi#popup_on_dot = 0
let g:jedi#goto_assignments_command = "<leader>g"
let g:jedi#goto_definitions_command = "<leader>d"
let g:jedi#documentation_command = "K"
let g:jedi#usages_command = "<leader>n"
let g:jedi#rename_command = "<leader>r"
let g:jedi#show_call_signatures = "0"
let g:jedi#completions_command = "<C-Space>"
let g:jedi#smart_auto_mappings = 0
" ale
:call extend(g:ale_linters, {
\'python': ['flake8'], })
" vim-airline
let g:airline#extensions#virtualenv#enabled = 1
" Syntax highlight
let python_highlight_all = 1
" typescript
let g:yats_host_keyword = 1
" vuejs
" vim vue
let g:vue_disable_pre_processors=1
" vim vue plugin
let g:vim_vue_plugin_load_full_syntax = 1
"*****************************************************************************
"*****************************************************************************
"" Include user's local vim config
if filereadable(expand("~/.config/vimrc.local"))
source ~/.config/vimrc.local
endif
"*****************************************************************************
"" Convenience variables
"*****************************************************************************
" vim-airline
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
if !exists('g:airline_powerline_fonts')
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline_left_sep = '▶'
let g:airline_left_alt_sep = '»'
let g:airline_right_sep = '◀'
let g:airline_right_alt_sep = '«'
let g:airline#extensions#branch#prefix = '⤴' "➔, ➥, ⎇
let g:airline#extensions#readonly#symbol = '⊘'
let g:airline#extensions#linecolumn#prefix = '¶'
let g:airline#extensions#paste#symbol = 'ρ'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
else
let g:airline#extensions#tabline#left_sep = ''
let g:airline#extensions#tabline#left_alt_sep = ''
" powerline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''
endif

View File

@@ -11,7 +11,7 @@
},
"formatter": {
"external": {
"command": "node_modules/.bin/prettier",
"command": "prettier",
"arguments": [
"--stdin-filepath",
"{buffer_path}"
@@ -69,7 +69,7 @@
"buffer_font_fallbacks": [
"JetBrainsMono Nerd Font"
],
"inline_completions": {
"edit_predictions": {
"disabled_globs": [
".env"
]

View File

@@ -40,9 +40,6 @@
relink: true
path: config/*
exclude: [config/nvm, config/fzf]
~/.local/asdf:
glob: true
path: local/asdf/*
~/.local/bin:
glob: true
path: local/bin/*
@@ -65,46 +62,6 @@
- bash add-submodules.sh || true
- git submodule update --init --recursive --force
- asdf:
- plugin: 1password-cli
url: https://github.com/NeoHsu/asdf-1password-cli.git
- plugin: age
url: https://github.com/threkk/asdf-age.git
- plugin: direnv
url: https://github.com/asdf-community/asdf-direnv.git
- plugin: dotenv-linter
url: https://github.com/wesleimp/asdf-dotenv-linter.git
- plugin: editorconfig-checker
url: https://github.com/gabitchov/asdf-editorconfig-checker.git
- plugin: fd
url: https://gitlab.com/wt0f/asdf-fd.git
- plugin: github-cli
url: https://github.com/bartlomiejdanek/asdf-github-cli.git
- plugin: golang
url: https://github.com/asdf-community/asdf-golang.git
- plugin: hadolint
url: https://github.com/devlincashman/asdf-hadolint.git
- plugin: kubectl
url: https://github.com/asdf-community/asdf-kubectl.git
- plugin: pre-commit
url: https://github.com/jonathanmorley/asdf-pre-commit.git
- plugin: ripgrep
url: https://gitlab.com/wt0f/asdf-ripgrep.git
- plugin: rust
url: https://github.com/code-lever/asdf-rust.git
- plugin: shellcheck
url: https://github.com/luizm/asdf-shellcheck.git
- plugin: shfmt
url: https://github.com/luizm/asdf-shfmt.git
- plugin: terragrunt
url: https://github.com/ohmer/asdf-terragrunt.git
- plugin: tf-summarize
url: https://github.com/adamcrews/asdf-tf-summarize.git
- plugin: yamllint
url: https://github.com/ericcornelissen/asdf-yamllint.git
- plugin: yq
url: https://github.com/sudermanjr/asdf-yq.git
- shell:
- bash local/bin/dfm install all

Submodule local/asdf deleted from 31e8c93004

View File

@@ -43,7 +43,6 @@ section_install()
MENU=(
"all:Installs everything in the correct order"
"asdf:Install asdf plugins"
"cargo:Install rust/cargo packages"
"cheat-databases:Install cheat external cheatsheet databases"
"composer:Install composer"
@@ -65,7 +64,6 @@ section_install()
$0 install macos
$0 install fonts
$0 brew install
$0 install asdf
$0 install composer
$0 install fzf
$0 install cheat-databases
@@ -77,12 +75,6 @@ section_install()
msgr yay "All done!"
;;
asdf)
msgr run "Installing asdf..."
$0 asdf plugins-install \
&& msgr yay "asdf plugins installed!"
;;
cargo)
msgr run "Installing cargo packages..."
bash "$DOTFILES/scripts/install-cargo-packages.sh" \
@@ -270,164 +262,6 @@ section_brew()
! x-have brew && menu_builder "$USAGE_PREFIX" "brew not available on this system"
}
section_asdf()
{
USAGE_PREFIX="$SCRIPT asdf <command>"
MENU=(
"current:Show asdf current versions"
"global:Show asdf global versions"
"installed:Show asdf installed versions"
"plugins-update:Update all asdf plugins"
"plugins-install:Install plugins from configuration"
"plugins-remove:Remove installed plugins"
"reset:Reset asdf plugins"
"fix-tool-versions:Remove uninstalled plugins from .tool-versions"
"versions:Show asdf versions"
"where:Show asdf where"
"which:Show asdf which"
)
case "$1" in
plugins-update)
msgr run "Updating all asdf plugins"
asdf plugin update --all
msgr run_done "Updated all plugins"
;;
plugins-install)
msgr run "Installing plugins from configuration"
# First install direnv if it's not installed
if ! asdf plugin list | grep -q "^direnv$"; then
msgr nested "Installing direnv plugin"
asdf plugin add direnv https://github.com/asdf-community/asdf-direnv.git
# Install latest direnv
local latest_direnv
latest_direnv=$(asdf latest direnv)
asdf install direnv "$latest_direnv"
asdf global direnv "$latest_direnv"
fi
# Check that all plugins are installed
local installed_plugins
installed_plugins=$(asdf plugin list)
while IFS= read -r line; do
# Skip empty lines and comments
[[ -z $line || $line =~ ^# ]] && continue
local plugin
plugin=$(echo "$line" | awk '{print $1}')
# Skip direnv, it's already installed
[[ $plugin == "direnv" ]] && continue
if ! echo "$installed_plugins" | grep -q "^${plugin}$"; then
msgr nested "Installing $plugin plugin"
asdf plugin add "$plugin"
fi
done < "$DOTFILES/base/tool-versions"
msgr run_done "All plugins installed"
;;
plugins-remove)
msgr run "Remove installed plugins"
local installed_plugins
installed_plugins=$(asdf plugin list | grep -v "^direnv$")
for plugin in $installed_plugins; do
msgr nested "Removing $plugin"
asdf plugin remove "$plugin"
done
msgr run_done "Remove plugins done!"
;;
reset)
msgr run "Resetting asdf environment"
$0 asdf plugins-remove
$0 asdf plugins-install
asdf reshim
msgr yay "Reset asdf plugins done!"
;;
fix-tool-versions)
local tool_versions_file="$DOTFILES/base/tool-versions"
local temp_file
temp_file=$(mktemp)
msgr run "Fixing tool-versions file"
# Check that .tool-versions file exists
if [[ ! -f $tool_versions_file ]]; then
msgr error "tool-versions file not found: $tool_versions_file"
rm -f "$temp_file"
return 1
fi
# Check that asdf can be found in the path
if ! command -v asdf > /dev/null; then
msgr error "asdf not found"
rm -f "$temp_file"
return 1
fi
# Read installed plugins
msgr nested "Reading installed plugins"
local installed_plugins
installed_plugins=$(asdf plugin list | sort)
# Compare .tool-versions and installed plugins,
# remove unknown plugins from .tool-versions
msgr nested "Updating tool-versions file"
while IFS= read -r line; do
# Keep comments and empty lines
if [[ -z $line || $line =~ ^[[:space:]]*# ]]; then
echo "$line" >> "$temp_file"
continue
fi
local plugin
plugin=$(echo "$line" | awk '{print $1}')
if echo "$installed_plugins" | grep -q "^${plugin}$"; then
echo "$line" >> "$temp_file"
else
msgr nested "Removing $plugin - not installed"
fi
done < "$tool_versions_file"
# Check that the temp file is valid
if [[ ! -s $temp_file ]] || ! grep -v '^[[:space:]]*#' "$temp_file" | grep -q .; then
msgr error "Generated file is empty or contains only comments, keeping original"
rm -f "$temp_file"
return 1
fi
# Backup the original .tool-versions
cp "$tool_versions_file" "${tool_versions_file}.bak"
# Overwrite .tool-versions with the generated file
mv "$temp_file" "$tool_versions_file"
msgr run_done "Updated $tool_versions_file"
msgr nested "Backup saved as ${tool_versions_file}.bak"
return 0
;;
current) asdf current ;;
global) asdf global ;;
installed) asdf list ;;
versions) asdf list all ;;
where) asdf where ;;
which) asdf which ;;
*) menu_builder "$USAGE_PREFIX" "${MENU[@]}" ;;
esac
}
section_helpers()
{
USAGE_PREFIX="$SCRIPT helpers <command>"
@@ -647,7 +481,7 @@ section_dotfiles()
fd --full-path "$DOTFILES" -tx \
--hidden \
-E '*.pl' -E '*.php' -E '*.py' -E '*.zsh' -E 'plugins' -E 'fzf' -E 'dotbot' \
-E 'test' -E '**/bin/asdf/**' -E '**/tldr/*' \
-E 'test' -E '**/tldr/*' \
-x shfmt \
--language-dialect bash \
--func-next-line --list --write \
@@ -778,8 +612,6 @@ usage()
echo ""
section_apt
echo ""
section_asdf
echo ""
section_brew
echo ""
section_check
@@ -801,7 +633,6 @@ main()
case "$SECTION" in
install) section_install "$@" ;;
apt) section_apt "$@" ;;
asdf) section_asdf "$@" ;;
brew) section_brew "$@" ;;
check) section_check "$@" ;;
dotfiles) section_dotfiles "$@" ;;

View File

@@ -1,100 +0,0 @@
#!/usr/bin/env python3
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Convert Markdown to Telegram Format
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🔄
# @raycast.packageName Conversions
# @raycast.description Convert Markdown formatting to Telegram format, excluding processing inside code blocks or quotes
# Documentation:
# @raycast.author Maxim Borzov
# @raycast.authorURL https://github.com/borzov
import re
import subprocess
# Set environment variables and encoding
env_vars = {'LANG': 'en_US.UTF-8'}
encoding = 'utf-8'
def paste():
"""Read text from the clipboard."""
return subprocess.check_output('pbpaste', env=env_vars).decode(encoding)
def copy(text):
"""Write text to the clipboard."""
process = subprocess.Popen('pbcopy', env=env_vars, stdin=subprocess.PIPE)
process.communicate(text.encode(encoding))
def convert_markdown(text):
"""Convert Markdown formatting to Telegram format."""
lines = text.split('\n')
converted_lines = []
in_code_block = False
for line in lines:
# Check if the line is a code block delimiter
if line.startswith('```'):
in_code_block = not in_code_block
converted_lines.append(line)
continue
# Skip quotes and only format if not in a code block
if not in_code_block and not line.startswith('>'):
# Format headers with emojis and bold text
if line.startswith('# '):
line = f"⚫️ **{line[2:].strip()}**\n"
elif line.startswith('## '):
line = f"◾️ **{line[3:].strip()}**\n"
elif line.startswith('### '):
line = f"▪️ **{line[4:].strip()}**\n"
elif line.startswith('#### '):
line = f"🔹 **{line[5:].strip()}**\n"
elif line.startswith('##### '):
line = f"📌 **{line[6:].strip()}**\n"
elif line.startswith('###### '):
line = f"🔰 **{line[7:].strip()}**\n"
else:
# Format bold text
line = re.sub(r'(?<!\\)\*{2}(.*?)\*{2}', r'**\1**', line)
line = re.sub(r'(?<!\\)_{2}(.*?)_{2}', r'**\1**', line)
# Format italic text
line = re.sub(r'(?<!\\|\*)\*(?!\*)(.+?)(?<!\*)\*(?![\*_])', r'__\1__', line)
line = re.sub(r'(?<!\\|_)_(?!_)(.+?)(?<!_)_(?![\*_])', r'__\1__', line)
# Format strikethrough text
line = re.sub(r'(?<!\\)~{2}(.*?)~{2}', r'~~\1~~', line)
# Format spoilers
line = re.sub(r'(?<!\\)\|\|(.*?)\|\|', r'||\1||', line)
# Format underline text
line = re.sub(r'(?<!\\)-{2}(.*?)-{2}', r'--\1--', line)
# Format links
line = re.sub(r'(?<!\\)\[(.*?)\]\((.*?)\)', r'[\1](\2)', line)
# Format inline code
line = re.sub(r'(?<!\\)`(.*?)`', r'`\1`', line)
converted_lines.append(line)
# Add empty lines between paragraphs
result = []
for i in range(len(converted_lines)):
result.append(converted_lines[i])
if i < len(converted_lines) - 1:
cur = converted_lines[i].strip()
next = converted_lines[i+1].strip()
if cur and next and not cur.startswith(('*', '-', '```', '|', '>')) and not next.startswith(('*', '-', '```', '|', '>')):
result.append('')
return '\n'.join(result)
if __name__ == "__main__":
try:
markdown_text = paste()
converted_text = convert_markdown(markdown_text)
copy(converted_text)
print("✅ Markdown converted and copied to clipboard")
except Exception as e:
print(f"❌ Error during conversion: {str(e)}")

View File

@@ -14,7 +14,7 @@
# Define protected keywords. Values of these keys are displayed as [protected value].
# The keys are case-insensitive and are matched as substrings.
PROTECTED_KEYS=("*TOKEN*" "*SECRET*" "DIRENV_DIFF" "DIRENV_WATCHES" "PATH" "FPATH")
PROTECTED_KEYS=("*TOKEN*" "*SECRET*" "DIRENV_DIFF" "DIRENV_WATCHES")
# Default grouping is based on the first part before underscore, but can be overridden
# either by custom grouping file or by the get_custom_group function.
@@ -49,17 +49,50 @@ DEFINED_GROUPS=(
"PYENV_ROOT=PYTHON"
"PYENV_SHELL=PYTHON"
"PYTHONPATH=PYTHON"
"POETRY_HOME=PYTHON"
"RUSTUP_HOME=RUST"
"RUST_WITHOUT=RUST"
"SHELL=SHELL"
"TMPDIR=SHELL"
"USER=SHELL"
"SECURITYSESSIONID=SHELL"
"SHLVL=SHELL"
"WORKON_HOME=PYTHON"
"ZSH=ZSH"
"LANG=SHELL"
"EDITOR=SHELL"
"VISUAL=SHELL"
"COMMAND_MODE=SHELL"
"COLORTERM=SHELL"
"CARGO_BIN_HOME=RUST"
"CARGO_HOME=RUST"
"LaunchInstanceID=SHELL"
"SECURITYSESSIONID=SHELL"
"TERM=SHELL"
"TERM_PROGRAM=SHELL"
"TERM_PROGRAM_VERSION=SHELL"
"XPC_FLAGS=SHELL"
"XPC_SERVICE_NAME=SHELL"
"NPM_CONFIG_PREFIX=NODE"
"YARN_GLOBAL_FOLDER=NODE"
"MASON_HOME=NVIM"
"asdf_data_dir=ASDF"
"nvm_current_version=NODE"
"NVM_NODE_BIN_DIR=NODE"
"_=SHELL"
"npm_config_cache=NPM"
)
SKIPPED_KEYS=(
"_tide*"
"__FISH_*"
"___paths_plugin_colors"
"__CFBundleIdentifier"
"__CF_USER_TEXT_ENCODING"
"PATH"
"FPATH"
)
CONFIG_FILE="$X_ENV_GROUPING"
# If we have configuration file, run extra checks so we can process it.
@@ -93,6 +126,12 @@ if [[ -f "$CONFIG_FILE" ]]; then
PROTECTED_KEYS+=("$key")
done <<< "$CUSTOM_KEYS"
SKIPPED+=("$(yq '.skipped_keys[]' "$CONFIG_FILE")")
while IFS= read -r key; do
# Add to default_skipped_keys
SKIPPED_KEYS+=("$key")
done <<< "$SKIPPED"
CUSTOM_GROUPS=$(yq '.custom_grouping[]' "$CONFIG_FILE")
while IFS= read -r group; do
group_name=$(echo "$group" | yq 'keys[0]')
@@ -150,6 +189,22 @@ get_custom_group()
return 1
}
is_skipped()
{
local key=$1
for skipped_key in "${SKIPPED_KEYS[@]}"; do
# Direct match
if [[ "$key" == "$skipped_key" ]]; then
return 0
fi
# Wildcard match (skipped_key contains '*')
if [[ "$skipped_key" == *"*"* ]] && [[ "$key" == $skipped_key ]]; then
return 0
fi
done
return 1
}
# Create arrays to store all groups, group data and max lengths for each group
all_groups=()
group_data=()
@@ -157,6 +212,15 @@ group_max_lengths=()
# Get environment variables and group them
while IFS='=' read -r key value; do
# Skip keys that are in the skipped list
if is_skipped "$key"; then
continue
fi
if is_skipped "$value"; then
continue
fi
# Check for custom group
group=$(get_custom_group "$key")

View File

@@ -1,13 +1,8 @@
#!/usr/bin/env bash
# @description Install cargo/rust packages.
#
# shellcheck source=shared.sh
source "$HOME/.dotfiles/config/shared.sh"
msgr run "Starting to install rust/cargo packages"
source "$CARGO_HOME/env"
# If we have cargo install-update, use it first
if command -v cargo-install-update &> /dev/null; then
msgr run "Updating cargo packages with cargo install-update"
@@ -15,8 +10,8 @@ if command -v cargo-install-update &> /dev/null; then
msgr run_done "Done with cargo install-update"
fi
[[ -z "$ASDF_CRATE_DEFAULT_PACKAGES_FILE" ]] && \
ASDF_CRATE_DEFAULT_PACKAGES_FILE="$DOTFILES/config/asdf/cargo-packages"
[[ -z "$ASDF_CRATE_DEFAULT_PACKAGES_FILE" ]] \
&& ASDF_CRATE_DEFAULT_PACKAGES_FILE="$DOTFILES/config/asdf/cargo-packages"
# Packages are defined in $DOTFILES/config/asdf/cargo-packages, one per line
# Skip comments and empty lines
@@ -31,7 +26,7 @@ while IFS= read -r line; do
done < "$ASDF_CRATE_DEFAULT_PACKAGES_FILE"
# Number of jobs to run in parallel, this helps to keep the system responsive
BUILD_JOBS=$(nproc --ignore=2)
BUILD_JOBS=$(nproc --ignore=2 2> /dev/null || sysctl -n hw.ncpu 2> /dev/null || echo 1)
# Function to install cargo packages
install_packages()
@@ -61,13 +56,13 @@ post_install_steps()
msgr run "Removing cargo cache"
cargo cache --autoclean
msg_done "Done removing cargo cache"
msgr done "Done removing cargo cache"
}
main()
{
install_packages
msg_done "Installed cargo packages!"
msgr done "Installed cargo packages!"
post_install_steps
}