mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-03 08:48:30 +00:00
Compare commits
67 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1aca769ebf | ||
| 57df4edf6c | |||
| 240ac35aa8 | |||
| ad0ba59b67 | |||
| bbc26e66dd | |||
| 1803d41969 | |||
| 34d547433f | |||
| dff4b9a9c5 | |||
| c33404eb27 | |||
| 99e7578d60 | |||
| d8011728c7 | |||
| 2f67d4a2e2 | |||
|
|
ef37681087 | ||
|
|
0c014033d1 | ||
|
|
14635009d2 | ||
| 70118fee52 | |||
|
|
0dce28ea6a | ||
| ba15f82302 | |||
| d4972ea30d | |||
| ed7263dfee | |||
| 4cda063305 | |||
| d251ea9cdc | |||
| bc4e906ff6 | |||
| 75c36bacf9 | |||
| e7cda5ac0c | |||
| 41024b1eb5 | |||
| 74afeb61c8 | |||
| 104bc369bc | |||
| 57e63847ce | |||
| 2dc08e5e51 | |||
| 989b5b5111 | |||
| 24a5dd1ff6 | |||
| 5826e35853 | |||
| e329868568 | |||
| dc76fa8914 | |||
| 3413365d41 | |||
| 37299f4893 | |||
| 71a78c6e0c | |||
| 3f8a4deb05 | |||
| ffe288aba3 | |||
| 28a1fc2831 | |||
| 28aae89f70 | |||
| e8fe5c570b | |||
| 26f6024292 | |||
| 4e4692321b | |||
| 3ea221ccf9 | |||
| e7774c4ab1 | |||
| 1f2ca90ca5 | |||
| adecceda7a | |||
| 8a3b2e703c | |||
| 1ee726e30c | |||
| 9857c8eb00 | |||
| a919d9544e | |||
| 7bc7921a17 | |||
| 735807f245 | |||
| 6d531e2d40 | |||
| 77f89c0f48 | |||
| 7f3c7b7e1c | |||
| fc16b8231e | |||
| 64a626d5c4 | |||
| 54816c2ce9 | |||
| 3acaea5611 | |||
| e4a313abe7 | |||
| 0b1c75cbdd | |||
| cab0f4da49 | |||
| cef15eddce | |||
| f8987818b8 |
@@ -1 +1 @@
|
|||||||
extends @ivuorinen/browserslist-config
|
extends @ivuorinen/browserslist-config
|
||||||
|
|||||||
@@ -27,3 +27,9 @@ space_redirects = true
|
|||||||
keep_padding = false
|
keep_padding = false
|
||||||
function_next_line = true # --func-next-line
|
function_next_line = true # --func-next-line
|
||||||
|
|
||||||
|
# Ignore the entire "third_party" directory when calling shfmt on directories,
|
||||||
|
# such as "shfmt -l -w .". When formatting files directly,
|
||||||
|
# like "shfmt -w third_party/foo.sh" or "shfmt --filename=third_party/foo.sh",
|
||||||
|
# the ignore logic is applied only when the --apply-ignore flag is given.
|
||||||
|
[{tools/**,local/bin/asdf/**,config/cheat/cheatsheets/**}]
|
||||||
|
ignore = true
|
||||||
|
|||||||
58
.github/README.md
vendored
58
.github/README.md
vendored
@@ -8,6 +8,9 @@ this repository will live accordingly.
|
|||||||
Please for the love of everything good do not use these 1:1 as your own dotfiles,
|
Please for the love of everything good do not use these 1:1 as your own dotfiles,
|
||||||
fork or download the repo as a zip and go from there with your own configs.
|
fork or download the repo as a zip and go from there with your own configs.
|
||||||
|
|
||||||
|
It would be nice if you'd add an issue linking to your fork or repo so I can
|
||||||
|
see what interesing stuff you've done with it. Sharing is caring.
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
### First time setup
|
### First time setup
|
||||||
@@ -35,7 +38,7 @@ fork or download the repo as a zip and go from there with your own configs.
|
|||||||
|
|
||||||
| Path | Description |
|
| Path | Description |
|
||||||
| ------------------- | -------------------------------------------- |
|
| ------------------- | -------------------------------------------- |
|
||||||
| `.github` | GitHub Repository configuration files. |
|
| `.github` | GitHub Repository configuration files, meta. |
|
||||||
| `hosts/{hostname}/` | Configs that should apply to that host only. |
|
| `hosts/{hostname}/` | Configs that should apply to that host only. |
|
||||||
| `local/bin` | Helper scripts that I've collected or wrote. |
|
| `local/bin` | Helper scripts that I've collected or wrote. |
|
||||||
| `scripts` | Setup scripts. |
|
| `scripts` | Setup scripts. |
|
||||||
@@ -51,7 +54,9 @@ fork or download the repo as a zip and go from there with your own configs.
|
|||||||
|
|
||||||
### dfm - the dotfiles manager
|
### dfm - the dotfiles manager
|
||||||
|
|
||||||
`.local/bin/dfm` is a shell script that has some tools that help with dotfiles management.
|
[`.local/bin/dfm`][dfm] is a shell script that has some tools that help with dotfiles management.
|
||||||
|
|
||||||
|
Running `dfm` gives you a list of available commands.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
@@ -66,51 +71,8 @@ The folder structure follows [XDG Base Directory Specification][xdg] where possi
|
|||||||
| `$XDG_DATA_HOME` | `$HOME/.local/share` | User-specific data files |
|
| `$XDG_DATA_HOME` | `$HOME/.local/share` | User-specific data files |
|
||||||
| `$XDG_STATE_HOME` | `$HOME/.local/state` | App state that should persist between restarts |
|
| `$XDG_STATE_HOME` | `$HOME/.local/state` | App state that should persist between restarts |
|
||||||
|
|
||||||
#### XDG_BIN_HOME (`$HOME/.local/bin`)
|
Please see [docs/folders.md][docs-folders] for more information.
|
||||||
|
|
||||||
`$XDG_BIN_HOME` defines directory that contains local binaries.
|
|
||||||
|
|
||||||
User-specific executable files may be stored in `$HOME/.local/bin`.
|
|
||||||
Distributions should ensure this directory shows up in the UNIX `$PATH`
|
|
||||||
environment variable, at an appropriate place.
|
|
||||||
|
|
||||||
#### XDG_DATA_HOME (`$HOME/.local/share`)
|
|
||||||
|
|
||||||
`$XDG_DATA_HOME` defines the base directory relative to which
|
|
||||||
user-specific _data files_ should be stored.
|
|
||||||
|
|
||||||
If `$XDG_DATA_HOME` is either not set or empty,
|
|
||||||
a default equal to `$HOME/.local/share` should be used.
|
|
||||||
|
|
||||||
#### XDG_CONFIG_HOME (`$HOME/.config`)
|
|
||||||
|
|
||||||
`$XDG_CONFIG_HOME` defines the base directory relative to which
|
|
||||||
user-specific _configuration files_ should be stored.
|
|
||||||
|
|
||||||
If `$XDG_CONFIG_HOME` is either not set or empty,
|
|
||||||
a default equal to `$HOME/.config` should be used.
|
|
||||||
|
|
||||||
#### XDG_STATE_HOME (`$HOME/.local/state`)
|
|
||||||
|
|
||||||
`$XDG_STATE_HOME` defines the base directory relative to which
|
|
||||||
user-specific _state files_ should be stored.
|
|
||||||
|
|
||||||
If `$XDG_STATE_HOME` is either not set or empty,
|
|
||||||
a default equal to `$HOME/.local/state` should be used.
|
|
||||||
|
|
||||||
The `$XDG_STATE_HOME` contains _state data_ that should
|
|
||||||
_persist between (application) restarts_, but that is not important or
|
|
||||||
portable enough to the user that it should be stored in `$XDG_DATA_HOME`.
|
|
||||||
|
|
||||||
- It may contain:
|
|
||||||
- actions history (logs, history, recently used files, …)
|
|
||||||
- current state of the application that can be reused
|
|
||||||
on a restart (view, layout, open files, undo history, …)
|
|
||||||
|
|
||||||
#### XDG_DATA_DIRS
|
|
||||||
|
|
||||||
`$XDG_DATA_DIRS` defines the preference-ordered set of base directories
|
|
||||||
to search for data files in addition to the `$XDG_DATA_HOME` base directory.
|
|
||||||
The directories in `$XDG_DATA_DIRS` should be separated with a colon ':'.
|
|
||||||
|
|
||||||
|
[dfm]: https://github.com/ivuorinen/dotfiles/blob/main/local/bin/dfm
|
||||||
|
[docs-folders]: https://github.com/ivuorinen/dotfiles/blob/main/docs/folders.md
|
||||||
[xdg]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
[xdg]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||||
|
|||||||
2
.github/renovate.json
vendored
2
.github/renovate.json
vendored
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": ["local>ivuorinen/.github:renovate-config"]
|
"extends": ["local>ivuorinen/renovate-config"]
|
||||||
}
|
}
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -22,4 +22,7 @@ node_modules
|
|||||||
iTermServer-*
|
iTermServer-*
|
||||||
lock
|
lock
|
||||||
config/iterm2/AppSupport
|
config/iterm2/AppSupport
|
||||||
|
config/gnupg/S.*
|
||||||
|
config/gnupg/s
|
||||||
|
config/gnupg/private-keys-v1.d
|
||||||
|
|
||||||
|
|||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -64,3 +64,6 @@
|
|||||||
[submodule "tmux/tmux-dark-notify"]
|
[submodule "tmux/tmux-dark-notify"]
|
||||||
path = config/tmux/plugins/tmux-dark-notify
|
path = config/tmux/plugins/tmux-dark-notify
|
||||||
url = https://github.com/erikw/tmux-dark-notify.git
|
url = https://github.com/erikw/tmux-dark-notify.git
|
||||||
|
[submodule "asdf"]
|
||||||
|
path = local/bin/asdf
|
||||||
|
url = https://github.com/asdf-vm/asdf.git
|
||||||
|
|||||||
5
.luarc.json
Normal file
5
.luarc.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"diagnostics.globals": [
|
||||||
|
"vim"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
# only care about files that are under our control
|
# only care about files that are directly under our control
|
||||||
config/cheat/cheatsheets/community/*
|
config/cheat/cheatsheets/community/*
|
||||||
|
config/cheat/cheatsheets/tldr/*
|
||||||
config/tmux/plugins/*
|
config/tmux/plugins/*
|
||||||
|
local/bin/asdf/*
|
||||||
tools/*
|
tools/*
|
||||||
node_modules/*
|
node_modules/*
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
.mypy_cache/*
|
.mypy_cache/*
|
||||||
tools/dotbot*
|
|
||||||
local/bin/antigen.zsh
|
|
||||||
config/cheat/cheatsheets/community
|
|
||||||
config/tmux/plugins/*
|
|
||||||
lazy-lock.json
|
|
||||||
Brewfile.lock.json
|
Brewfile.lock.json
|
||||||
|
config/cheat/cheatsheets/community
|
||||||
|
config/cheat/cheatsheets/tldr
|
||||||
|
config/fzf/*
|
||||||
|
config/nvim-kickstart/*
|
||||||
|
config/tmux/plugins/*
|
||||||
|
config/zsh/*
|
||||||
|
lazy-lock.json
|
||||||
|
local/bin/antigen.zsh
|
||||||
|
local/bin/asdf
|
||||||
|
tools/dotbot*
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
|
plugins: ['prettier-plugin-sh'],
|
||||||
...require('@ivuorinen/prettier-config'),
|
...require('@ivuorinen/prettier-config'),
|
||||||
trailingComma: 'all',
|
trailingComma: 'all',
|
||||||
// Add custom options below:
|
// Add custom options below:
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
3.12
|
3.12.5
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ git submodule add --name cheat-community \
|
|||||||
-f https://github.com/cheat/cheatsheets.git config/cheat/cheatsheets/community
|
-f https://github.com/cheat/cheatsheets.git config/cheat/cheatsheets/community
|
||||||
git submodule add --name cheat-tldr \
|
git submodule add --name cheat-tldr \
|
||||||
-f https://github.com/ivuorinen/cheatsheet-tldr.git config/cheat/cheatsheets/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/bin/asdf
|
||||||
|
|
||||||
# tmux plugin manager and plugins
|
# tmux plugin manager and plugins
|
||||||
git submodule add --name tmux/tmux-continuum \
|
git submodule add --name tmux/tmux-continuum \
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
# this is my bashrc config. there are many like it, but this one is mine.
|
# this is my bashrc config. there are many like it, but this one is mine.
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
source "$HOME/.dotfiles/config/shared"
|
export DOTFILES="$HOME/.dotfiles"
|
||||||
|
export PATH="$HOME/.local/bin:$DOTFILES/local/bin:$PATH"
|
||||||
|
export SHARED_SCRIPTS_SOURCED=0
|
||||||
|
|
||||||
x-load-configs
|
source "$DOTFILES/config/shared.sh"
|
||||||
|
|
||||||
# shellcheck source=../config/fzf/fzf.bash
|
# shellcheck source=../config/fzf/fzf.bash
|
||||||
[ -f "${DOTFILES}/config/fzf/fzf.bash" ] &&
|
[ -f "${DOTFILES}/config/fzf/fzf.bash" ] &&
|
||||||
@@ -16,9 +18,6 @@ x-have oh-my-posh && {
|
|||||||
eval "$(oh-my-posh init bash --config "$DOTFILES/config/omp/own.toml")"
|
eval "$(oh-my-posh init bash --config "$DOTFILES/config/omp/own.toml")"
|
||||||
}
|
}
|
||||||
|
|
||||||
. "$HOME/.local/share/asdf/asdf.sh"
|
|
||||||
. "$HOME/.local/share/asdf/completions/asdf.bash"
|
|
||||||
|
|
||||||
x-have antidot && {
|
x-have antidot && {
|
||||||
eval "$(antidot init)"
|
eval "$(antidot init)"
|
||||||
}
|
}
|
||||||
|
|||||||
1
base/envrc
Normal file
1
base/envrc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
use asdf
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
#!/bin/env bash
|
#!/bin/env bash
|
||||||
|
|
||||||
[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.config/nvm"
|
[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.config/nvm"
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
|
||||||
|
|
||||||
|
|||||||
30
base/tool-versions
Normal file
30
base/tool-versions
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
1password-cli 2.30.0
|
||||||
|
age 1.2.0
|
||||||
|
asdf-plugin-manager 1.3.1
|
||||||
|
bottom 0.10.2
|
||||||
|
direnv 2.34.0
|
||||||
|
dotenv-linter 3.3.0
|
||||||
|
editorconfig-checker 2.8.0
|
||||||
|
eza 0.19.0
|
||||||
|
fd 10.2.0
|
||||||
|
github-cli 2.55.0
|
||||||
|
golang 1.23.0
|
||||||
|
hadolint 2.12.0
|
||||||
|
kubectl 1.31.0
|
||||||
|
lazygit 0.43.1
|
||||||
|
markdownlint-cli2 0.13.0
|
||||||
|
nodejs 22.7.0
|
||||||
|
pipx 1.7.1
|
||||||
|
pre-commit 3.8.0
|
||||||
|
python 3.12.5
|
||||||
|
ripgrep 14.1.0
|
||||||
|
ruby 3.3.4
|
||||||
|
rust 1.80.1
|
||||||
|
semgrep system
|
||||||
|
shellcheck 0.10.0
|
||||||
|
shfmt 3.9.0
|
||||||
|
terragrunt 0.67.0
|
||||||
|
tf-summarize 0.3.10
|
||||||
|
vault 1.17.4+ent
|
||||||
|
yamllint 1.35.1
|
||||||
|
yq 4.44.3
|
||||||
21
base/zshenv
21
base/zshenv
@@ -1,21 +0,0 @@
|
|||||||
# shellcheck shell=bash
|
|
||||||
# vim: filetype=zsh
|
|
||||||
|
|
||||||
export PATH="$HOME/.local/bin:$HOME/.dotfiles/local/bin:$HOME/.local/go/bin:$PATH"
|
|
||||||
|
|
||||||
export DOTFILES="$HOME/.dotfiles"
|
|
||||||
|
|
||||||
# Explicitly set XDG folders
|
|
||||||
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
|
||||||
export XDG_CONFIG_HOME="$HOME/.config"
|
|
||||||
export XDG_DATA_HOME="$HOME/.local/share"
|
|
||||||
export XDG_STATE_HOME="$HOME/.local/state"
|
|
||||||
|
|
||||||
# custom variables
|
|
||||||
export XDG_BIN_HOME="$HOME/.local/bin"
|
|
||||||
export XDG_CACHE_HOME="$HOME/.cache"
|
|
||||||
export XDG_RUNTIME_DIR="$HOME/.local/run"
|
|
||||||
|
|
||||||
source "$DOTFILES/config/exports"
|
|
||||||
source "$DOTFILES/config/alias"
|
|
||||||
|
|
||||||
181
base/zshrc
181
base/zshrc
@@ -1,102 +1,107 @@
|
|||||||
# this is my zsh config. there are many like it, but this one is mine.
|
# this is my zsh config. there are many like it, but this one is mine.
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
source "$HOME/.dotfiles/config/shared"
|
# export VERBOSE=1
|
||||||
|
# export DEBUG=1
|
||||||
|
|
||||||
export PATH="$XDG_BIN_HOME:$DOTFILES/local/bin:$HOME/.local/go/bin:$XDG_DATA_HOME/bob/nvim-bin:$XDG_DATA_HOME/cargo/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"
|
export DOTFILES="$HOME/.dotfiles"
|
||||||
|
LOCAL_SHARE="$HOME/.local/share"
|
||||||
|
export PATH="$HOME/.local/bin:$DOTFILES/local/bin:$LOCAL_SHARE/bob/nvim-bin:$LOCAL_SHARE/cargo/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"
|
||||||
|
export SHARED_SCRIPTS_SOURCED=0
|
||||||
|
|
||||||
x-load-configs
|
source "$DOTFILES/config/shared.sh"
|
||||||
|
|
||||||
x-have oh-my-posh && {
|
eval "$(oh-my-posh init zsh --config "$DOTFILES/config/omp/own.toml")"
|
||||||
eval "$(oh-my-posh init zsh --config "$DOTFILES/config/omp/own.toml")"
|
|
||||||
|
# Function to load antigen if available
|
||||||
|
load_antigen()
|
||||||
|
{
|
||||||
|
local antigen_zsh_path="$XDG_BIN_HOME/antigen.zsh"
|
||||||
|
# shellcheck source=../../.local/bin/antigen.zsh
|
||||||
|
if [[ -f "$antigen_zsh_path" ]]; then
|
||||||
|
source "$antigen_zsh_path"
|
||||||
|
|
||||||
|
antigen use oh-my-zsh
|
||||||
|
|
||||||
|
# Disable ls colors to avoid issues with eza
|
||||||
|
export DISABLE_LS_COLORS=true
|
||||||
|
|
||||||
|
export ZSH_TMUX_AUTOSTART=false
|
||||||
|
export ZSH_TMUX_CONFIG="$DOTFILES/config/tmux/tmux.conf"
|
||||||
|
export ZSH_TMUX_UNICODE=true
|
||||||
|
export ZSH_TMUX_AUTOQUIT=false
|
||||||
|
export ZSH_TMUX_DEFAULT_SESSION_NAME=main
|
||||||
|
|
||||||
|
zstyle ':omz:plugins:eza' 'dirs-first' yes
|
||||||
|
zstyle ':omz:plugins:eza' 'git-status' yes
|
||||||
|
zstyle ':omz:plugins:eza' 'icons' yes
|
||||||
|
zstyle ':omz:plugins:eza' 'ls' yes
|
||||||
|
zstyle ':omz:plugins:eza' 'prompt' yes
|
||||||
|
|
||||||
|
if [[ "$OSTYPE" == darwin* ]]; then
|
||||||
|
zstyle :omz:plugins:ssh-agent keychain yes
|
||||||
|
fi
|
||||||
|
zstyle :omz:plugins:ssh-agent lazy yes
|
||||||
|
zstyle :omz:plugins:ssh-agent quiet yes
|
||||||
|
|
||||||
|
# z, the zsh version
|
||||||
|
export ZSHZ_DATA="$XDG_STATE_HOME/z"
|
||||||
|
antigen bundle z
|
||||||
|
|
||||||
|
x-have python && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
|
||||||
|
|
||||||
|
# these should be always available
|
||||||
|
antigen bundle jreese/zsh-titles
|
||||||
|
antigen bundle gnu-utils
|
||||||
|
antigen bundle ssh-agent
|
||||||
|
antigen bundle gpg-agent
|
||||||
|
antigen bundle brew
|
||||||
|
# antigen bundle tmux
|
||||||
|
antigen bundle colored-man-pages
|
||||||
|
antigen bundle zsh-users/zsh-completions
|
||||||
|
antigen bundle eza
|
||||||
|
|
||||||
|
# this needs to be the last item
|
||||||
|
antigen bundle zsh-users/zsh-syntax-highlighting
|
||||||
|
antigen apply
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
export COMPLETION_WAITING_DOTS=true
|
# Function to source FZF configuration
|
||||||
|
source_fzf_config()
|
||||||
if type brew &> /dev/null; then
|
{
|
||||||
eval "$(brew shellenv)"
|
local fzf_config="${DOTFILES}/config/fzf/fzf.zsh"
|
||||||
FPATH="$HOMEBREW_PREFIX/share/zsh/site-functions:${FPATH}"
|
if [[ -f "$fzf_config" ]]; then
|
||||||
fi
|
# shellcheck source=config/fzf/fzf.zsh
|
||||||
|
source "$fzf_config"
|
||||||
export ZSH_CUSTOM_COMPLETION_PATH="$XDG_CONFIG_HOME/zsh/completion"
|
fi
|
||||||
x-dc "$ZSH_CUSTOM_COMPLETION_PATH"
|
|
||||||
|
|
||||||
# Add completion scripts to zsh path
|
|
||||||
FPATH="$ZSH_CUSTOM_COMPLETION_PATH:$FPATH"
|
|
||||||
|
|
||||||
# Try to load antigen, if present
|
|
||||||
ANTIGEN_ZSH_PATH="$XDG_BIN_HOME/antigen.zsh"
|
|
||||||
# shellcheck source=../../.local/bin/antigen.zsh
|
|
||||||
[[ -f "$ANTIGEN_ZSH_PATH" ]] && source "$ANTIGEN_ZSH_PATH"
|
|
||||||
|
|
||||||
# antigen is present
|
|
||||||
antigen use oh-my-zsh
|
|
||||||
|
|
||||||
export ZSH_TMUX_AUTOSTART=true
|
|
||||||
export ZSH_TMUX_CONFIG="$DOTFILES/config/tmux/tmux.conf"
|
|
||||||
export ZSH_TMUX_UNICODE=true
|
|
||||||
export ZSH_TMUX_AUTOQUIT=false
|
|
||||||
export ZSH_TMUX_DEFAULT_SESSION_NAME=main
|
|
||||||
|
|
||||||
export NVM_DIR="$XDG_CONFIG_HOME/nvm"
|
|
||||||
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc
|
|
||||||
|
|
||||||
# z, the zsh version
|
|
||||||
export ZSHZ_DATA="$XDG_STATE_HOME/z"
|
|
||||||
antigen bundle z
|
|
||||||
|
|
||||||
# these should be always available
|
|
||||||
antigen bundle asdf
|
|
||||||
antigen bundle tmux
|
|
||||||
antigen bundle colored-man-pages
|
|
||||||
antigen bundle ssh-agent
|
|
||||||
antigen bundle jreese/zsh-titles
|
|
||||||
antigen bundle zsh-users/zsh-completions
|
|
||||||
|
|
||||||
x-have python && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
|
|
||||||
|
|
||||||
# nvm is a strange beast
|
|
||||||
zstyle ':omz:plugins:nvm' autoload yes
|
|
||||||
antigen bundle nvm
|
|
||||||
|
|
||||||
# this needs to be the last item
|
|
||||||
antigen bundle zsh-users/zsh-syntax-highlighting
|
|
||||||
antigen apply
|
|
||||||
|
|
||||||
# shellcheck source=../config/fzf/fzf.zsh
|
|
||||||
[ -f "${DOTFILES}/config/fzf/fzf.zsh" ] \
|
|
||||||
&& source "${DOTFILES}/config/fzf/fzf.zsh"
|
|
||||||
|
|
||||||
x-have pyenv && {
|
|
||||||
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
|
||||||
eval "$(pyenv init -)"
|
|
||||||
eval "$(pyenv virtualenv-init -)"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run only if tmux is active
|
# Function to set up tmux window name plugin if tmux is active
|
||||||
[[ -n "$TMUX" ]] && {
|
setup_tmux_window_name_plugin()
|
||||||
# Autoupdate tmux window name
|
{
|
||||||
TMUX_WINDOW_NAME_PLUGIN="$DOTFILES/config/tmux/plugins/tmux-window-name/scripts/rename_session_windows.py"
|
if [[ -n "$TMUX" ]]; then
|
||||||
[ -f "$TMUX_WINDOW_NAME_PLUGIN" ] && {
|
local tmux_window_name_plugin="$DOTFILES/config/tmux/plugins/tmux-window-name/scripts/rename_session_windows.py"
|
||||||
tmux-window-name()
|
if [[ -f "$tmux_window_name_plugin" ]]; then
|
||||||
{
|
tmux_window_name()
|
||||||
($TMUX_WINDOW_NAME_PLUGIN &)
|
{
|
||||||
}
|
($tmux_window_name_plugin &)
|
||||||
add-zsh-hook chpwd tmux-window-name
|
}
|
||||||
tmux-window-name
|
add-zsh-hook chpwd tmux_window_name
|
||||||
}
|
tmux_window_name
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
x-have antidot && {
|
main()
|
||||||
eval "$(antidot init)"
|
{
|
||||||
|
load_antigen
|
||||||
|
source_fzf_config
|
||||||
|
setup_tmux_window_name_plugin
|
||||||
|
if x-have antidot; then
|
||||||
|
eval "$(antidot init)"
|
||||||
|
fi
|
||||||
|
source "${XDG_CONFIG_HOME:-$HOME/.config}/asdf-direnv/zshrc"
|
||||||
}
|
}
|
||||||
|
|
||||||
source "$DOTFILES/config/alias"
|
main "$@"
|
||||||
|
|
||||||
# Herd checks for a few environment variables to inject PHP binaries and configurations.
|
|
||||||
# Herd injected PHP binary.
|
|
||||||
# export PATH="/Users/ivuorinen/Library/Application Support/Herd/bin/":$PATH
|
|
||||||
# Herd injected PHP 8.3 configuration.
|
|
||||||
# export HERD_PHP_83_INI_SCAN_DIR="/Users/ivuorinen/Library/Application Support/Herd/config/php/83/"
|
|
||||||
# Herd injected PHP 7.4 configuration.
|
|
||||||
# export HERD_PHP_74_INI_SCAN_DIR="/Users/ivuorinen/Library/Application Support/Herd/config/php/74/"
|
|
||||||
|
|||||||
81
config/alias
81
config/alias
@@ -1,6 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck source="../scripts/shared.sh"
|
|
||||||
# shellcheck disable=1091,2139
|
|
||||||
|
|
||||||
# Color the grep output
|
# Color the grep output
|
||||||
alias grep="grep --color"
|
alias grep="grep --color"
|
||||||
@@ -17,6 +15,14 @@ alias ....="cd ../../.."
|
|||||||
# cd to git root directory
|
# cd to git root directory
|
||||||
alias cdgr='cd "$(git root)"'
|
alias cdgr='cd "$(git root)"'
|
||||||
|
|
||||||
|
# interesting folders, and shortcuts
|
||||||
|
alias .="cd $HOME"
|
||||||
|
alias .b="cd $XDG_BIN_HOME"
|
||||||
|
alias .c="cd $HOME/Code"
|
||||||
|
alias .d="cd $DOTFILES"
|
||||||
|
alias .dx="cd $DOTFILES;ks"
|
||||||
|
alias .l="cd $HOME/.local"
|
||||||
|
|
||||||
# Shortcuts for listing
|
# Shortcuts for listing
|
||||||
alias ll="ls -la"
|
alias ll="ls -la"
|
||||||
alias l="ls -a"
|
alias l="ls -a"
|
||||||
@@ -55,6 +61,9 @@ alias ta='tmux attach || tmux'
|
|||||||
alias nvim-ks='NVIM_APPNAME="nvim-kickstart" nvim'
|
alias nvim-ks='NVIM_APPNAME="nvim-kickstart" nvim'
|
||||||
alias ks='NVIM_APPNAME="nvim-kickstart" nvim'
|
alias ks='NVIM_APPNAME="nvim-kickstart" nvim'
|
||||||
|
|
||||||
|
# xdg-ninja aliases for better experience
|
||||||
|
alias xdg='xdg-ninja --skip-ok --skip-unsupported'
|
||||||
|
|
||||||
# watch with: differences, precise, beep and color
|
# watch with: differences, precise, beep and color
|
||||||
alias watchx='watch -dpbc'
|
alias watchx='watch -dpbc'
|
||||||
# delete .DS_Store files
|
# delete .DS_Store files
|
||||||
@@ -107,62 +116,12 @@ if [[ $(uname) == 'Darwin' ]]; then
|
|||||||
# x-set-php-aliases
|
# x-set-php-aliases
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Alacritty preexec hook to update dynamic title
|
X_ALIAS_FILES=(
|
||||||
preexec()
|
"$HOME/.config/alias-secret"
|
||||||
{
|
"$HOME/.config/alias-$(hostname)"
|
||||||
print -Pn "\e]0;$1%~\a"
|
"$HOME/.config/alias-$(hostname)-secret"
|
||||||
}
|
)
|
||||||
|
for aliasFile in "${X_ALIAS_FILES[@]}"; do
|
||||||
# Update dotfiles
|
[ -f "$aliasFile" ] && source "$aliasFile" && msg "Sourced $aliasFile"
|
||||||
dfu()
|
done
|
||||||
{
|
unset X_ALIAS_FILES
|
||||||
(
|
|
||||||
cd "$DOTFILES" && git pull --ff-only && ./install -q
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
# Weather in Tampere, or other city
|
|
||||||
weather()
|
|
||||||
{
|
|
||||||
# https://github.com/chubin/wttr.in#usage
|
|
||||||
local city="${1:-Tampere}"
|
|
||||||
curl "http://wttr.in/${city// /+}?2nFQM&lang=fi"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Docker
|
|
||||||
ssh-docker()
|
|
||||||
{
|
|
||||||
docker exec -it "$@" bash
|
|
||||||
}
|
|
||||||
|
|
||||||
# Rector project to php version 8.2 by default.
|
|
||||||
rector()
|
|
||||||
{
|
|
||||||
local php="${1:-82}"
|
|
||||||
docker run -v "$(pwd)":/project rector/rector:latest process \
|
|
||||||
"/project/$1" \
|
|
||||||
--set "php${php}" \
|
|
||||||
--autoload-file /project/vendor/autoload.php
|
|
||||||
}
|
|
||||||
|
|
||||||
# Commit everything
|
|
||||||
commit()
|
|
||||||
{
|
|
||||||
commitMessage="$*"
|
|
||||||
|
|
||||||
if [ "$commitMessage" = "" ]; then
|
|
||||||
commitMessage="Automated commit"
|
|
||||||
fi
|
|
||||||
|
|
||||||
git add .
|
|
||||||
eval "git commit -a -m '${commitMessage}'"
|
|
||||||
}
|
|
||||||
|
|
||||||
scheduler()
|
|
||||||
{
|
|
||||||
while :; do
|
|
||||||
php artisan schedule:run
|
|
||||||
echo "Sleeping 60 seconds..."
|
|
||||||
sleep 60
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
# See the docs for explanations: https://asdf-vm.com/manage/configuration.html
|
# See the docs for explanations: https://asdf-vm.com/manage/configuration.html
|
||||||
|
|
||||||
legacy_version_file = yes
|
legacy_version_file=yes
|
||||||
use_release_candidates = no
|
use_release_candidates=no
|
||||||
always_keep_download = no
|
concurrency=auto
|
||||||
plugin_repository_last_check_duration = 60
|
|
||||||
disable_plugin_short_name_repository = no
|
|
||||||
concurrency = auto
|
|
||||||
|
|||||||
21
config/asdf/cargo-packages
Normal file
21
config/asdf/cargo-packages
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
// A cargo subcommand for checking and applying
|
||||||
|
// updates to installed executables
|
||||||
|
cargo-update
|
||||||
|
// Cargo cache management utility
|
||||||
|
cargo-cache
|
||||||
|
// An incremental parsing system for programming tools
|
||||||
|
tree-sitter-cli
|
||||||
|
// a subprocess caching utility
|
||||||
|
bkt
|
||||||
|
// a structural diff that understands syntax
|
||||||
|
difftastic
|
||||||
|
// A simple, fast and user-friendly alternative to 'find'
|
||||||
|
fd-find
|
||||||
|
// recursively searches directories for a
|
||||||
|
// regex pattern while respecting your gitignore
|
||||||
|
ripgrep
|
||||||
|
// A version manager for neovim
|
||||||
|
bob-nvim
|
||||||
|
// bottom, btm - A cross-platform graphical process/system monitor with
|
||||||
|
// a customizable interface and a multitude of features.
|
||||||
|
bottom
|
||||||
1
config/asdf/gem-packages
Normal file
1
config/asdf/gem-packages
Normal file
@@ -0,0 +1 @@
|
|||||||
|
bundler
|
||||||
21
config/asdf/golang-packages
Normal file
21
config/asdf/golang-packages
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
// These are golang packages I use,
|
||||||
|
// so they should be available with all versions
|
||||||
|
|
||||||
|
// sysadmin/scripting utilities, distributed as a single binary
|
||||||
|
github.com/skx/sysbox@release-0.18.0
|
||||||
|
// Git Profile allows you to switch between user profiles in git repos
|
||||||
|
github.com/dotzero/git-profile@v1.4.0
|
||||||
|
// An extensible command line tool or library to format yaml files.
|
||||||
|
github.com/google/yamlfmt/cmd/yamlfmt@v0.13.0
|
||||||
|
// Parsing HTML at the command line
|
||||||
|
github.com/ericchiang/pup@v0.4.0
|
||||||
|
// HTML to Markdown converter
|
||||||
|
github.com/suntong/html2md@v1.5.0
|
||||||
|
// cheat allows you to create and view interactive cheatsheets on the cli.
|
||||||
|
github.com/cheat/cheat/cmd/cheat@4.4.2
|
||||||
|
// Render markdown on the CLI, with pizzazz! 💅
|
||||||
|
github.com/charmbracelet/glow@v1.5.1
|
||||||
|
// Static checker for GitHub Actions workflow files
|
||||||
|
github.com/rhysd/actionlint/cmd/actionlint@v1.7.1
|
||||||
|
// Cleans up your $HOME from those pesky dotfiles
|
||||||
|
github.com/doron-cohen/antidot@v0.6.3
|
||||||
@@ -1,27 +1,32 @@
|
|||||||
1password-cli https://github.com/NeoHsu/asdf-1password-cli.git f5d5aab
|
1password-cli https://github.com/NeoHsu/asdf-1password-cli.git f5d5aab
|
||||||
age https://github.com/threkk/asdf-age.git 4df80a0
|
age https://github.com/threkk/asdf-age.git 4df80a0
|
||||||
asdf-plugin-manager https://github.com/asdf-community/asdf-plugin-manager.git 50d2735
|
asdf-plugin-manager https://github.com/asdf-community/asdf-plugin-manager.git ecd1642
|
||||||
bottom https://github.com/carbonteq/asdf-btm.git fd8a55a
|
bottom https://github.com/carbonteq/asdf-btm.git fd8a55a
|
||||||
dotenv-linter https://github.com/wesleimp/asdf-dotenv-linter.git 1369f53
|
direnv https://github.com/asdf-community/asdf-direnv.git a2219c2
|
||||||
editorconfig-checker https://github.com/gabitchov/asdf-editorconfig-checker.git 585c1d5
|
dotenv-linter https://github.com/wesleimp/asdf-dotenv-linter.git 1369f53
|
||||||
eza https://github.com/lwiechec/asdf-eza.git 08c1b65
|
editorconfig-checker https://github.com/gabitchov/asdf-editorconfig-checker.git 585c1d5
|
||||||
fd https://gitlab.com/wt0f/asdf-fd.git 17d56e0
|
eza https://github.com/lwiechec/asdf-eza.git eee3d59
|
||||||
github-cli https://github.com/bartlomiejdanek/asdf-github-cli.git e0605b7
|
fd https://gitlab.com/wt0f/asdf-fd.git 17d56e0
|
||||||
hadolint https://github.com/devlincashman/asdf-hadolint.git 335e230
|
github-cli https://github.com/bartlomiejdanek/asdf-github-cli.git e0605b7
|
||||||
kubectl https://github.com/asdf-community/asdf-kubectl.git cbe6df4
|
golang https://github.com/asdf-community/asdf-golang.git 0e86b1d
|
||||||
lazygit https://github.com/nklmilojevic/asdf-lazygit.git 78e04f1
|
hadolint https://github.com/devlincashman/asdf-hadolint.git 335e230
|
||||||
neovim https://github.com/richin13/asdf-neovim d6118ad
|
kubectl https://github.com/asdf-community/asdf-kubectl.git cbe6df4
|
||||||
nodejs https://github.com/asdf-vm/asdf-nodejs.git c5b7c40
|
lazygit https://github.com/nklmilojevic/asdf-lazygit.git 78e04f1
|
||||||
pipx https://github.com/yozachar/asdf-pipx.git 31db618
|
markdownlint-cli2 https://github.com/paulo-ferraz-oliveira/asdf-markdownlint-cli2.git 6acd080
|
||||||
pre-commit https://github.com/jonathanmorley/asdf-pre-commit.git 26bfc42
|
nodejs https://github.com/asdf-vm/asdf-nodejs.git c5b7c40
|
||||||
ripgrep https://gitlab.com/wt0f/asdf-ripgrep.git e836665
|
pipx https://github.com/yozachar/asdf-pipx.git 31db618
|
||||||
semgrep https://github.com/brentjanderson/asdf-semgrep.git 13ff78b
|
pre-commit https://github.com/jonathanmorley/asdf-pre-commit.git 26bfc42
|
||||||
shellcheck https://github.com/luizm/asdf-shellcheck.git 780d78d
|
python https://github.com/asdf-community/asdf-python 7b0af87
|
||||||
shfmt https://github.com/luizm/asdf-shfmt.git a42c5ff
|
ripgrep https://gitlab.com/wt0f/asdf-ripgrep.git e836665
|
||||||
terraform-ls https://github.com/asdf-community/asdf-hashicorp.git f1602b6
|
ruby https://github.com/asdf-vm/asdf-ruby.git 27f78c9
|
||||||
terraform-lsp https://github.com/bartlomiejdanek/asdf-terraform-lsp.git bba7106
|
rust https://github.com/code-lever/asdf-rust.git 95acf4f
|
||||||
terragrunt https://github.com/ohmer/asdf-terragrunt 4a6651a
|
semgrep https://github.com/brentjanderson/asdf-semgrep.git 13ff78b
|
||||||
tf-summarize https://github.com/adamcrews/asdf-tf-summarize.git 880ad26
|
shellcheck https://github.com/luizm/asdf-shellcheck.git 780d78d
|
||||||
vault https://github.com/asdf-community/asdf-hashicorp.git f1602b6
|
shfmt https://github.com/luizm/asdf-shfmt.git a42c5ff
|
||||||
yamllint https://github.com/ericcornelissen/asdf-yamllint.git d5c3161
|
terraform-ls https://github.com/asdf-community/asdf-hashicorp.git f1602b6
|
||||||
yq https://github.com/sudermanjr/asdf-yq.git 772992f
|
terraform-lsp https://github.com/bartlomiejdanek/asdf-terraform-lsp.git bba7106
|
||||||
|
terragrunt https://github.com/ohmer/asdf-terragrunt.git 4a6651a
|
||||||
|
tf-summarize https://github.com/adamcrews/asdf-tf-summarize.git 880ad26
|
||||||
|
vault https://github.com/asdf-community/asdf-hashicorp.git f1602b6
|
||||||
|
yamllint https://github.com/ericcornelissen/asdf-yamllint.git 2f4fd4c
|
||||||
|
yq https://github.com/sudermanjr/asdf-yq.git 772992f
|
||||||
|
|||||||
2
config/asdf/python-packages
Normal file
2
config/asdf/python-packages
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
ansible
|
||||||
|
pipenv
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
1password-cli 2.29.0
|
|
||||||
age 1.2.0
|
|
||||||
bottom 0.9.6
|
|
||||||
eza 0.18.19
|
|
||||||
fd 10.1.0
|
|
||||||
hadolint 2.12.0
|
|
||||||
kubectl 1.30.2
|
|
||||||
lazygit 0.42.0
|
|
||||||
nodejs 22.3.0
|
|
||||||
pipx 1.6.0
|
|
||||||
tf-summarize 0.3.10
|
|
||||||
vault 1.17.0+ent
|
|
||||||
yamllint 1.35.1
|
|
||||||
yq 4.44.2
|
|
||||||
neovim system
|
|
||||||
asdf-plugin-manager 1.3.1
|
|
||||||
@@ -3,11 +3,11 @@
|
|||||||
# editor: $EDITOR
|
# editor: $EDITOR
|
||||||
|
|
||||||
# Should 'cheat' always colorize output?
|
# Should 'cheat' always colorize output?
|
||||||
colorize: true
|
colorize: false
|
||||||
# Which 'chroma' colorscheme should be applied to the output?
|
# Which 'chroma' colorscheme should be applied to the output?
|
||||||
# Options are available here:
|
# Options are available here:
|
||||||
# https://github.com/alecthomas/chroma/tree/master/styles
|
# https://github.com/alecthomas/chroma/tree/master/styles
|
||||||
style: 'catppuccin'
|
# style: 'tokyonight-day'
|
||||||
# Which 'chroma' "formatter" should be applied?
|
# Which 'chroma' "formatter" should be applied?
|
||||||
# One of: "terminal", "terminal256", "terminal16m"
|
# One of: "terminal", "terminal256", "terminal16m"
|
||||||
formatter: terminal256
|
formatter: terminal256
|
||||||
|
|||||||
11
config/direnv/direnv.toml
Normal file
11
config/direnv/direnv.toml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[global]
|
||||||
|
disable_stdin = true
|
||||||
|
|
||||||
|
[whitelist]
|
||||||
|
prefix = [
|
||||||
|
"~/Code/ivuorinen/"
|
||||||
|
]
|
||||||
|
exact = [
|
||||||
|
"~/.dotfiles/.envrc"
|
||||||
|
]
|
||||||
|
|
||||||
4
config/direnv/lib/use_asdf.sh
Normal file
4
config/direnv/lib/use_asdf.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
### Do not edit. This was autogenerated by 'asdf direnv setup' ###
|
||||||
|
use_asdf() {
|
||||||
|
source_env "$(asdf direnv envrc "$@")"
|
||||||
|
}
|
||||||
479
config/exports
479
config/exports
@@ -2,14 +2,53 @@
|
|||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# vim: filetype=zsh
|
# vim: filetype=zsh
|
||||||
|
|
||||||
|
# Set XDG directories if not already set
|
||||||
|
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||||
|
[ -z "$XDG_CONFIG_HOME" ] && export XDG_CONFIG_HOME="$HOME/.config"
|
||||||
|
[ -z "$XDG_DATA_HOME" ] && export XDG_DATA_HOME="$HOME/.local/share"
|
||||||
|
[ -z "$XDG_CACHE_HOME" ] && export XDG_CACHE_HOME="$HOME/.cache"
|
||||||
|
[ -z "$XDG_STATE_HOME" ] && export XDG_STATE_HOME="$HOME/.local/state"
|
||||||
|
[ -z "$XDG_BIN_HOME" ] && export XDG_BIN_HOME="$HOME/.local/bin"
|
||||||
|
|
||||||
|
# if DOTFILES is not set, set it to the default location
|
||||||
|
[ -z "$DOTFILES" ] && export DOTFILES="$HOME/.dotfiles"
|
||||||
|
|
||||||
|
export PATH="$XDG_BIN_HOME:$DOTFILES/local/bin:$XDG_DATA_HOME/bob/nvim-bin:$XDG_DATA_HOME/cargo/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"
|
||||||
|
|
||||||
|
# Load bash completions if available for zsh
|
||||||
|
if [[ -n "$ZSH_VERSION" ]]; then
|
||||||
|
autoload bashcompinit
|
||||||
|
bashcompinit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load asdf
|
||||||
|
export ASDF_DIR="$XDG_BIN_HOME/asdf"
|
||||||
|
if [[ -d $ASDF_DIR ]]; then
|
||||||
|
[[ -d $ASDF_DIR/bin ]] && x-path-prepend "$ASDF_DIR/bin"
|
||||||
|
[[ -d $ASDF_DIR/shims ]] && x-path-prepend "$ASDF_DIR/shims"
|
||||||
|
[[ -d $ASDF_DIR/completions ]] && fpath=("$ASDF_DIR/completions" $fpath)
|
||||||
|
[[ -d $ASDF_DIR/plugins ]] && fpath=("$ASDF_DIR/plugins" $fpath)
|
||||||
|
source "$ASDF_DIR/asdf.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! command -v msg &> /dev/null; then
|
||||||
|
# Function to print messages if VERBOSE is enabled
|
||||||
|
# $1 - message (string)
|
||||||
|
msg()
|
||||||
|
{
|
||||||
|
[[ "$VERBOSE" -eq 1 ]] && echo "-> $1"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
# Cache commands using bkt if installed
|
# Cache commands using bkt if installed
|
||||||
if command -v bkt >&/dev/null; then
|
if command -v bkt &> /dev/null; then
|
||||||
bkt()
|
bkt()
|
||||||
{
|
{
|
||||||
command bkt --cache-dir="$XDG_CACHE_HOME/bkt" "$@"
|
command bkt --cache-dir="$XDG_CACHE_HOME/bkt" "$@"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
# If bkt isn't installed skip its arguments and just execute directly.
|
# If bkt isn't installed, skip its arguments and just execute directly.
|
||||||
# Optionally write a msg to stderr suggesting users install bkt.
|
# Optionally write a msg to stderr suggesting users install bkt.
|
||||||
bkt()
|
bkt()
|
||||||
{
|
{
|
||||||
@@ -18,44 +57,55 @@ else
|
|||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# shorthand for checking if the system has the bin in path,
|
# Shorthand for checking if the system has the bin in path,
|
||||||
# this version does not use caching
|
# this version does not use caching.
|
||||||
# usage: have_command php && php -v
|
# Usage: have_command php && php -v
|
||||||
have_command()
|
have_command()
|
||||||
{
|
{
|
||||||
command -v "$1" >&/dev/null
|
[ -z "$1" ] && {
|
||||||
|
echo "Usage: have_command <command>"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
command -v "$1" &> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
# shorthand for checking if the system has the bin in path,
|
# Shorthand for checking if the system has the bin in path,
|
||||||
# this version uses caching
|
# this version uses caching.
|
||||||
# usage: have php && php -v
|
# Usage: have php && php -v
|
||||||
have()
|
have()
|
||||||
{
|
{
|
||||||
bkt -- which "$1" >&/dev/null
|
bkt -- which "$1" &> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
# function to run dark-notify and change alacritty theme
|
# Function to run dark-notify and change alacritty theme
|
||||||
# it uses flock to prevent running multiple instances
|
# It uses flock to prevent running multiple instances.
|
||||||
# install flock with `brew install flock` on macOS
|
# Install flock with `brew install flock` on macOS.
|
||||||
function darknotify-alacritty {
|
darknotify_alacritty()
|
||||||
have flock && [[ -f /tmp/dark-notify-alacritty.lock ]] && return
|
{
|
||||||
have dark-notify && {
|
x-have flock && [[ -f /tmp/dark-notify-alacritty.lock ]] && return
|
||||||
# true is used to prevent the command show it was backgrounded
|
x-have dark-notify && {
|
||||||
true & flock /tmp/dark-notify-alacritty.lock dark-notify -c "$HOME/.dotfiles/local/bin/x-change-alacritty-theme" &
|
# subprocess is used to prevent the command from showing it was backgrounded
|
||||||
|
(
|
||||||
|
flock /tmp/dark-notify-alacritty.lock dark-notify \
|
||||||
|
-c "$HOME/.dotfiles/local/bin/x-change-alacritty-theme" &
|
||||||
|
) &> /dev/null
|
||||||
}
|
}
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
darknotify-alacritty
|
darknotify_alacritty
|
||||||
|
|
||||||
|
# Function to list installed Homebrew packages using bkt caching
|
||||||
brew_installed()
|
brew_installed()
|
||||||
{
|
{
|
||||||
bkt -- brew list
|
bkt -- brew list
|
||||||
}
|
}
|
||||||
|
|
||||||
# shorthand for checking if brew package is installed
|
# Shorthand for checking if a Homebrew package is installed
|
||||||
# usage: have_brew php && php -v
|
# Usage: have_brew php && php -v
|
||||||
have_brew()
|
have_brew()
|
||||||
{
|
{
|
||||||
! x-have brew && return 125
|
! have brew && return 125
|
||||||
|
|
||||||
if bkt -- brew list "$1" &> /dev/null; then
|
if bkt -- brew list "$1" &> /dev/null; then
|
||||||
return 0
|
return 0
|
||||||
@@ -64,9 +114,384 @@ have_brew()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ -f "$DOTFILES/config/exports-secret" ]]; then
|
# Alacritty preexec hook to update dynamic title
|
||||||
source "$DOTFILES/config/exports-secret"
|
preexec()
|
||||||
fi
|
{
|
||||||
|
print -n -P "\e]0;$1%~\a"
|
||||||
|
}
|
||||||
|
|
||||||
source "$DOTFILES/config/exports-shell"
|
# Update dotfiles
|
||||||
source "$DOTFILES/config/exports-apps"
|
dfu()
|
||||||
|
{
|
||||||
|
(
|
||||||
|
cd "$DOTFILES" && git pull --ff-only && ./install
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Weather in Tampere, or other city
|
||||||
|
weather()
|
||||||
|
{
|
||||||
|
# https://github.com/chubin/wttr.in#usage
|
||||||
|
local city="${1:-Tampere}"
|
||||||
|
curl "http://wttr.in/${city// /+}?2nFQM&lang=fi"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
ssh_docker()
|
||||||
|
{
|
||||||
|
docker exec -it "$@" bash
|
||||||
|
}
|
||||||
|
|
||||||
|
# Rector project to php version 8.2 by default.
|
||||||
|
rector()
|
||||||
|
{
|
||||||
|
local php="${1:-82}"
|
||||||
|
docker run -v "$(pwd)":/project rector/rector:latest process \
|
||||||
|
"/project/$1" \
|
||||||
|
--set "php${php}" \
|
||||||
|
--autoload-file /project/vendor/autoload.php
|
||||||
|
}
|
||||||
|
|
||||||
|
# Commit everything
|
||||||
|
commit()
|
||||||
|
{
|
||||||
|
local commitMessage="$*"
|
||||||
|
|
||||||
|
if [ -z "$commitMessage" ]; then
|
||||||
|
commitMessage="Automated commit"
|
||||||
|
fi
|
||||||
|
|
||||||
|
git add .
|
||||||
|
git commit -a -m "$commitMessage"
|
||||||
|
}
|
||||||
|
|
||||||
|
scheduler()
|
||||||
|
{
|
||||||
|
while :; do
|
||||||
|
php artisan schedule:run
|
||||||
|
echo "Sleeping 60 seconds..."
|
||||||
|
sleep 60
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run command silently
|
||||||
|
# Usage: silent uptime
|
||||||
|
silent()
|
||||||
|
{
|
||||||
|
"$@" >&/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if a file contains non-ascii characters
|
||||||
|
nonascii()
|
||||||
|
{
|
||||||
|
LC_ALL=C grep -n '[^[:print:][:space:]]' "${@}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove non-ascii characters from string
|
||||||
|
# Usage: strip_nonascii "string"
|
||||||
|
strip_nonascii()
|
||||||
|
{
|
||||||
|
echo "$1" | LC_ALL=C sed 's/[^[:print:][:space:]]//g'
|
||||||
|
}
|
||||||
|
|
||||||
|
# Slugify a string
|
||||||
|
# Usage: slugify "string"
|
||||||
|
slugify()
|
||||||
|
{
|
||||||
|
echo "$1" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z
|
||||||
|
}
|
||||||
|
|
||||||
|
# https://stackoverflow.com/a/85932
|
||||||
|
fn_exists()
|
||||||
|
{
|
||||||
|
declare -f -F "$1" > /dev/null
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
# Creates a random string
|
||||||
|
rnd()
|
||||||
|
{
|
||||||
|
echo $RANDOM | md5sum | head -c 20
|
||||||
|
}
|
||||||
|
|
||||||
|
# return sha256sum for file
|
||||||
|
# $1 - filename (string)
|
||||||
|
get_sha256sum()
|
||||||
|
{
|
||||||
|
sha256sum "$1" | head -c 64
|
||||||
|
}
|
||||||
|
|
||||||
|
# Replaceable file
|
||||||
|
#
|
||||||
|
# $1 - filename (string)
|
||||||
|
# $2 - filename (string)
|
||||||
|
#
|
||||||
|
# Returns 1 when replaceable, 0 when not replaceable.
|
||||||
|
replacable()
|
||||||
|
{
|
||||||
|
FILE1="$1"
|
||||||
|
FILE2="$2"
|
||||||
|
|
||||||
|
[[ ! -r "$FILE1" ]] && {
|
||||||
|
[[ $VERBOSE -eq 1 ]] && msg_err "File 1 ($FILE1) does not exist"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
[[ ! -r "$FILE2" ]] && {
|
||||||
|
[[ $VERBOSE -eq 1 ]] && msg_err "File 2 ($FILE2) does not exist, replaceable"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE1_HASH=$(get_sha256sum "$FILE1")
|
||||||
|
FILE2_HASH=$(get_sha256sum "$FILE2")
|
||||||
|
|
||||||
|
[[ $FILE1_HASH = "" ]] && {
|
||||||
|
[[ $VERBOSE -eq 1 ]] && msg_err "Could not get hash for file 1 ($FILE1)"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
[[ $FILE2_HASH = "" ]] && {
|
||||||
|
[[ $VERBOSE -eq 1 ]] && msg_err "Could not get hash for file 2 ($FILE2), replaceable"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
[[ "$FILE1_HASH" == "$FILE2_HASH" ]] && {
|
||||||
|
[[ $VERBOSE -eq 1 ]] && msg_ok "Files match, not replaceable: $FILE1"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
[[ $VERBOSE -eq 1 ]] && msg_warn "Files do not match ($FILE1_HASH != $FILE2_HASH), replaceable"
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
export COMPLETION_WAITING_DOTS=true
|
||||||
|
|
||||||
|
# Bash completion file location
|
||||||
|
export BASH_COMPLETION_USER_FILE="${XDG_CONFIG_HOME}/bash-completion/bash_completion"
|
||||||
|
|
||||||
|
# History env variables
|
||||||
|
export HIST_STAMPS="yyyy-mm-dd"
|
||||||
|
# Larger bash history (allow 32³ entries; default is 500)
|
||||||
|
export HISTSIZE=32768
|
||||||
|
export HISTFILESIZE=$HISTSIZE
|
||||||
|
# don't put duplicate lines or lines starting with space in the history.
|
||||||
|
# See bash(1) for more options
|
||||||
|
export HISTCONTROL=ignoreboth
|
||||||
|
# Make some commands not show up in history
|
||||||
|
export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"
|
||||||
|
# And include the parameter for ZSH
|
||||||
|
export HISTORY_IGNORE="(ls|cd|cd -|pwd|exit|date|* --help)"
|
||||||
|
|
||||||
|
# Less history location
|
||||||
|
export LESSHISTFILE="$XDG_STATE_HOME"/less/history
|
||||||
|
|
||||||
|
# Highlight section titles in manual pages
|
||||||
|
# export LESS_TERMCAP_md="$ORANGE"
|
||||||
|
|
||||||
|
# zsh autoloaded terminfo
|
||||||
|
export TERMINFO="${XDG_DATA_HOME}/terminfo"
|
||||||
|
export TERMINFO_DIRS="${XDG_DATA_HOME}/terminfo":/usr/share/terminfo
|
||||||
|
|
||||||
|
# Don't clear the screen after quitting a manual page
|
||||||
|
export MANPAGER="less -X"
|
||||||
|
|
||||||
|
# Always enable colored `grep` output
|
||||||
|
export GREP_OPTIONS="--color=auto"
|
||||||
|
|
||||||
|
# check the window size after each command and, if necessary,
|
||||||
|
# update the values of LINES and COLUMNS.
|
||||||
|
hash shopt 2> /dev/null && shopt -s checkwinsize
|
||||||
|
|
||||||
|
export SHORT_HOST=$(hostname -s)
|
||||||
|
|
||||||
|
# Antigen configuration
|
||||||
|
# https://github.com/zsh-users/antigen/wiki/Configuration
|
||||||
|
msg "Setting up Antigen configuration"
|
||||||
|
export ADOTDIR="$XDG_DATA_HOME/antigen"
|
||||||
|
export ANTIGEN_CACHE="$XDG_CACHE_HOME/antigen"
|
||||||
|
export ANTIGEN_SYSTEM_RECEIPT_F=".local/share/antigen/antigen_system_lastupdate"
|
||||||
|
export ANTIGEN_PLUGIN_RECEIPT_F=".local/share/antigen/antigen_plugin_lastupdate"
|
||||||
|
|
||||||
|
# Ansible configuration
|
||||||
|
# https://docs.ansible.com/ansible/latest/reference_appendices/config.html
|
||||||
|
msg "Setting up Ansible configuration"
|
||||||
|
export ANSIBLE_HOME="$XDG_CONFIG_HOME/ansible"
|
||||||
|
export ANSIBLE_CONFIG="$XDG_CONFIG_HOME/ansible.cfg"
|
||||||
|
export ANSIBLE_GALAXY_CACHE_DIR="$XDG_CACHE_HOME/ansible/galaxy_cache"
|
||||||
|
x-dc "$ANSIBLE_HOME"
|
||||||
|
x-dc "$ANSIBLE_GALAXY_CACHE_DIR"
|
||||||
|
|
||||||
|
# asdf
|
||||||
|
# https://github.com/asdf-vm/asdf
|
||||||
|
msg "Setting up asdf configuration"
|
||||||
|
export ASDF_DIR="${XDG_BIN_HOME}/asdf"
|
||||||
|
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"
|
||||||
|
## 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}"
|
||||||
|
|
||||||
|
# bob manages nvim versions
|
||||||
|
msg "Setting up bob configuration"
|
||||||
|
x-path-prepend "$XDG_DATA_HOME/bob/nvim-bin"
|
||||||
|
|
||||||
|
# bkt (shell command caching tool) configuration
|
||||||
|
msg "Setting up bkt configuration"
|
||||||
|
export BKT_TTL=1m
|
||||||
|
|
||||||
|
# brew, https://docs.brew.sh/Manpage
|
||||||
|
msg "Setting up Homebrew configuration"
|
||||||
|
export HOMEBREW_NO_ANALYTICS=true
|
||||||
|
export HOMEBREW_NO_ENV_HINTS=true
|
||||||
|
export HOMEBREW_BUNDLE_MAS_SKIP=true
|
||||||
|
export HOMEBREW_BUNDLE_FILE="$XDG_CONFIG_HOME/homebrew/Brewfile"
|
||||||
|
x-have brew && {
|
||||||
|
# Add brew autocompletion to fpath
|
||||||
|
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
|
||||||
|
eval "$(brew shellenv)"
|
||||||
|
}
|
||||||
|
|
||||||
|
# composer, https://getcomposer.org/
|
||||||
|
msg "Setting up Composer configuration"
|
||||||
|
export COMPOSER_HOME="$XDG_STATE_HOME/composer"
|
||||||
|
export COMPOSER_BIN="$COMPOSER_HOME/vendor/bin"
|
||||||
|
export PATH="$COMPOSER_BIN:$PATH"
|
||||||
|
|
||||||
|
# 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'
|
||||||
|
|
||||||
|
# docker, https://docs.docker.com/engine/reference/commandline/cli/
|
||||||
|
msg "Setting up Docker configuration"
|
||||||
|
export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker"
|
||||||
|
x-dc "$DOCKER_CONFIG"
|
||||||
|
# Docker: Disable snyk ad
|
||||||
|
export DOCKER_SCAN_SUGGEST=false
|
||||||
|
|
||||||
|
# ffmpeg
|
||||||
|
# https://ffmpeg.org/ffmpeg.html
|
||||||
|
msg "Setting up FFmpeg configuration"
|
||||||
|
export FFMPEG_DATADIR="$XDG_CONFIG_HOME/ffmpeg"
|
||||||
|
x-have ffmpeg && x-dc "$FFMPEG_DATADIR"
|
||||||
|
|
||||||
|
# GnuPG
|
||||||
|
# https://gnupg.org/documentation/manuals/gnupg/Invoking-GPG.html
|
||||||
|
msg "Setting up GnuPG configuration"
|
||||||
|
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
|
||||||
|
|
||||||
|
# Go
|
||||||
|
# https://golang.org/doc/code.html
|
||||||
|
msg "Setting up Go configuration"
|
||||||
|
export GOPATH="$XDG_DATA_HOME/go"
|
||||||
|
export GOBIN="$XDG_BIN_HOME"
|
||||||
|
|
||||||
|
# nb, https://xwmx.github.io/nb/
|
||||||
|
msg "Setting up nb configuration"
|
||||||
|
export NBRC_PATH="$XDG_CONFIG_HOME/nbrc"
|
||||||
|
export NB_DIR="$XDG_STATE_HOME/nb"
|
||||||
|
|
||||||
|
# NPM: Add npm packages to path
|
||||||
|
msg "Setting up NPM configuration"
|
||||||
|
x-have node && {
|
||||||
|
NVM_NODE_BIN_DIR="$(dirname "$(which node)")"
|
||||||
|
export PATH="$NVM_NODE_BIN_DIR:$PATH"
|
||||||
|
}
|
||||||
|
|
||||||
|
# oh-my-posh (omp) configuration
|
||||||
|
msg "Setting up oh-my-posh configuration"
|
||||||
|
export OHMYPOSH_CFG="$DOTFILES/config/omp/own.toml"
|
||||||
|
|
||||||
|
# op (1Password cli) is present
|
||||||
|
msg "Setting up 1Password CLI configuration"
|
||||||
|
export OP_CACHE="$XDG_STATE_HOME/1password"
|
||||||
|
|
||||||
|
# Python
|
||||||
|
#
|
||||||
|
# pyenv, python environments
|
||||||
|
msg "Setting up Python configuration"
|
||||||
|
export WORKON_HOME="$XDG_DATA_HOME/virtualenvs"
|
||||||
|
export PYENV_ROOT="$XDG_STATE_HOME/pyenv"
|
||||||
|
## for MichaelAquilina/zsh-autoswitch-virtualenv
|
||||||
|
export AUTOSWITCH_VIRTUAL_ENV_DIR="$WORKON_HOME"
|
||||||
|
export PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
|
||||||
|
x-have pyenv && {
|
||||||
|
eval "$(pyenv init -)"
|
||||||
|
eval "$(pyenv virtualenv-init -)"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ruby
|
||||||
|
#
|
||||||
|
# including: bundler, rbenv
|
||||||
|
msg "Setting up Ruby configuration"
|
||||||
|
export GEM_HOME="${XDG_DATA_HOME}"/gem
|
||||||
|
export GEM_SPEC_CACHE="${XDG_CACHE_HOME}"/gem
|
||||||
|
export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME"/bundle
|
||||||
|
export BUNDLE_USER_CACHE="$XDG_CACHE_HOME"/bundle
|
||||||
|
export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME"/bundle
|
||||||
|
export RBENV_ROOT="$XDG_STATE_HOME/rbenv"
|
||||||
|
x-dc "$RBENV_ROOT"
|
||||||
|
x-have gem && export PATH="${GEM_HOME}/bin:$PATH"
|
||||||
|
|
||||||
|
# Rust / cargo
|
||||||
|
msg "Setting up Rust/Cargo configuration"
|
||||||
|
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
|
||||||
|
export CARGO_HOME="$XDG_DATA_HOME/cargo"
|
||||||
|
export PATH="$CARGO_HOME/bin:$PATH"
|
||||||
|
|
||||||
|
# screen
|
||||||
|
# https://www.gnu.org/software/screen/manual/screen.html
|
||||||
|
msg "Setting up screen configuration"
|
||||||
|
export SCREENRC="$XDG_CONFIG_HOME/misc/screenrc"
|
||||||
|
|
||||||
|
# sonarlint
|
||||||
|
# https://www.sonarlint.org/
|
||||||
|
msg "Setting up Sonarlint configuration"
|
||||||
|
export SONARLINT_USER_HOME="$XDG_DATA_HOME/sonarlint"
|
||||||
|
|
||||||
|
# terraform
|
||||||
|
# https://www.terraform.io/docs/cli/config/config-file.html
|
||||||
|
# https://www.terraform.io/docs/cli/config/environment-variables.html
|
||||||
|
msg "Setting up Terraform configuration"
|
||||||
|
export TF_DATA_DIR="$XDG_STATE_HOME/terraform"
|
||||||
|
export TF_CLI_CONFIG_FILE="$XDG_CONFIG_HOME/terraform/terraformrc"
|
||||||
|
export TF_PLUGIN_CACHE_DIR="$XDG_CACHE_HOME/terraform/plugin-cache"
|
||||||
|
|
||||||
|
# tldr / tealdeer
|
||||||
|
msg "Setting up tldr configuration"
|
||||||
|
export TEALDEER_CONFIG_DIR="$XDG_CONFIG_HOME/tealdeer/"
|
||||||
|
|
||||||
|
# tmux
|
||||||
|
# https://tmux.github.io/
|
||||||
|
msg "Setting up tmux configuration"
|
||||||
|
export TMUX_CONF="$XDG_CONFIG_HOME/tmux/tmux.conf"
|
||||||
|
|
||||||
|
# wakatime, https://github.com/wakatime/wakatime-cli
|
||||||
|
msg "Setting up Wakatime configuration"
|
||||||
|
export WAKATIME_HOME="$XDG_STATE_HOME/wakatime"
|
||||||
|
x-dc "$WAKATIME_HOME"
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
msg "Setting up miscellaneous configuration"
|
||||||
|
export CHEAT_USE_FZF=true
|
||||||
|
export SQLITE_HISTORY="${XDG_CACHE_HOME}/sqlite_history"
|
||||||
|
|
||||||
|
X_EXPORTS_FILES=(
|
||||||
|
"$HOME/.config/exports-secret"
|
||||||
|
"$HOME/.config/exports-$(hostname)"
|
||||||
|
"$HOME/.config/exports-$(hostname)-secret"
|
||||||
|
)
|
||||||
|
for exportFile in "${X_EXPORTS_FILES[@]}"; do
|
||||||
|
[ -f "$exportFile" ] && source "$exportFile" && msg "Sourced $exportFile"
|
||||||
|
done
|
||||||
|
unset X_EXPORTS_FILES
|
||||||
|
|||||||
@@ -1,147 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# shellcheck shell=bash
|
|
||||||
# shellcheck enable=external-sources
|
|
||||||
# shellcheck disable=1091,2139
|
|
||||||
# vim: filetype=bash
|
|
||||||
|
|
||||||
# Antigen configuration
|
|
||||||
# https://github.com/zsh-users/antigen/wiki/Configuration
|
|
||||||
export ADOTDIR="$XDG_DATA_HOME/antigen"
|
|
||||||
export ANTIGEN_CACHE="$XDG_CACHE_HOME/antigen"
|
|
||||||
export ANTIGEN_SYSTEM_RECEIPT_F=".local/share/antigen/antigen_system_lastupdate"
|
|
||||||
export ANTIGEN_PLUGIN_RECEIPT_F=".local/share/antigen/antigen_plugin_lastupdate"
|
|
||||||
|
|
||||||
# Ansible configuration
|
|
||||||
# https://docs.ansible.com/ansible/latest/reference_appendices/config.html
|
|
||||||
export ANSIBLE_HOME="$XDG_CONFIG_HOME/ansible"
|
|
||||||
export ANSIBLE_CONFIG="$XDG_CONFIG_HOME/ansible.cfg"
|
|
||||||
export ANSIBLE_GALAXY_CACHE_DIR="$XDG_CACHE_HOME/ansible/galaxy_cache"
|
|
||||||
x-dc "$ANSIBLE_HOME"
|
|
||||||
x-dc "$ANSIBLE_GALAXY_CACHE_DIR"
|
|
||||||
|
|
||||||
export ANDROID_HOME="$XDG_DATA_HOME/android"
|
|
||||||
|
|
||||||
# asdf
|
|
||||||
# https://github.com/asdf-vm/asdf
|
|
||||||
export ASDF_DIR="${XDG_DATA_HOME}/asdf"
|
|
||||||
export ASDF_CONFIG_FILE="${XDG_CONFIG_HOME}/asdf/asdfrc"
|
|
||||||
export ASDF_DATA_DIR="${ASDF_DIR}"
|
|
||||||
# This seems wrong, but `asdf info` and `versions.bash` differ on path resolution.
|
|
||||||
export ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=".config/asdf/tool-versions"
|
|
||||||
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_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY="latest_available"
|
|
||||||
export ASDF_NPM_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME}/asdf/npm-packages"
|
|
||||||
export PATH="${ASDF_DIR}/bin:${PATH}"
|
|
||||||
|
|
||||||
# bob manages nvim versions
|
|
||||||
export PATH="$XDG_DATA_HOME/bob/nvim-bin:$PATH"
|
|
||||||
|
|
||||||
# bkt (shell command caching tool) configuration
|
|
||||||
export BKT_TTL=1m
|
|
||||||
|
|
||||||
# brew, https://docs.brew.sh/Manpage
|
|
||||||
export HOMEBREW_NO_ENV_HINTS=true
|
|
||||||
export HOMEBREW_BUNDLE_MAS_SKIP=true
|
|
||||||
export HOMEBREW_BUNDLE_FILE="$XDG_CONFIG_HOME/homebrew/Brewfile"
|
|
||||||
|
|
||||||
# composer, https://getcomposer.org/
|
|
||||||
export COMPOSER_HOME="$XDG_STATE_HOME/composer"
|
|
||||||
export COMPOSER_BIN="$COMPOSER_HOME/vendor/bin"
|
|
||||||
export PATH="$COMPOSER_BIN:$PATH"
|
|
||||||
|
|
||||||
# docker, https://docs.docker.com/engine/reference/commandline/cli/
|
|
||||||
export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker"
|
|
||||||
x-dc "$DOCKER_CONFIG"
|
|
||||||
# Docker: Disable snyk ad
|
|
||||||
export DOCKER_SCAN_SUGGEST=false
|
|
||||||
|
|
||||||
# ffmpeg
|
|
||||||
export FFMPEG_DATADIR="$XDG_CONFIG_HOME/ffmpeg"
|
|
||||||
x-have ffmpeg && x-dc "$FFMPEG_DATADIR"
|
|
||||||
|
|
||||||
# GnuPG
|
|
||||||
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
|
|
||||||
|
|
||||||
# Go
|
|
||||||
export GOPATH="$XDG_DATA_HOME/go"
|
|
||||||
export GOBIN="$XDG_BIN_HOME"
|
|
||||||
|
|
||||||
# Herd, herd.laravel.com
|
|
||||||
# Herd injected PHP binary.
|
|
||||||
export PATH="$HOME/Library/Application Support/Herd/bin/":$PATH
|
|
||||||
|
|
||||||
x-have herd && {
|
|
||||||
# Herd injected PHP 8.3 configuration.
|
|
||||||
export HERD_PHP_83_INI_SCAN_DIR="$HOME/Library/Application Support/Herd/config/php/83/"
|
|
||||||
# Herd injected PHP 7.4 configuration.
|
|
||||||
export HERD_PHP_74_INI_SCAN_DIR="$HOME/Library/Application Support/Herd/config/php/74/"
|
|
||||||
}
|
|
||||||
|
|
||||||
# nb, https://xwmx.github.io/nb/
|
|
||||||
export NBRC_PATH="$XDG_CONFIG_HOME/nbrc"
|
|
||||||
export NB_DIR="$XDG_STATE_HOME/nb"
|
|
||||||
|
|
||||||
# NPM: Add npm packages to path
|
|
||||||
x-have node && {
|
|
||||||
NVM_NODE_BIN_DIR="$(dirname "$(which node)")"
|
|
||||||
export PATH="$NVM_NODE_BIN_DIR:$PATH"
|
|
||||||
}
|
|
||||||
|
|
||||||
# op (1Password cli) is present
|
|
||||||
export OP_CACHE="$XDG_STATE_HOME/1password"
|
|
||||||
|
|
||||||
# Python
|
|
||||||
#
|
|
||||||
# pyenv, python environments
|
|
||||||
export WORKON_HOME="$XDG_DATA_HOME/virtualenvs"
|
|
||||||
export PYENV_ROOT="$XDG_STATE_HOME/pyenv"
|
|
||||||
export PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
|
|
||||||
x-have pyenv && {
|
|
||||||
eval "$(pyenv init -)"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ruby
|
|
||||||
#
|
|
||||||
# including: bundler, rbenv
|
|
||||||
export GEM_HOME="${XDG_DATA_HOME}"/gem
|
|
||||||
export GEM_SPEC_CACHE="${XDG_CACHE_HOME}"/gem
|
|
||||||
export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME"/bundle
|
|
||||||
export BUNDLE_USER_CACHE="$XDG_CACHE_HOME"/bundle
|
|
||||||
export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME"/bundle
|
|
||||||
export RBENV_ROOT="$XDG_STATE_HOME/rbenv"
|
|
||||||
x-dc "$RBENV_ROOT"
|
|
||||||
x-have gem && export PATH="${GEM_HOME}/bin:$PATH"
|
|
||||||
|
|
||||||
# Rust / cargo
|
|
||||||
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
|
|
||||||
export CARGO_HOME="$XDG_DATA_HOME/cargo"
|
|
||||||
export PATH="$CARGO_HOME/bin:$PATH"
|
|
||||||
|
|
||||||
# screen
|
|
||||||
export SCREENRC="$XDG_CONFIG_HOME/misc/screenrc"
|
|
||||||
|
|
||||||
# sonarlint
|
|
||||||
export SONARLINT_USER_HOME="$XDG_DATA_HOME/sonarlint"
|
|
||||||
|
|
||||||
# terraform
|
|
||||||
# https://www.terraform.io/docs/cli/config/config-file.html
|
|
||||||
# https://www.terraform.io/docs/cli/config/environment-variables.html
|
|
||||||
export TF_DATA_DIR="$XDG_STATE_HOME/terraform"
|
|
||||||
export TF_CLI_CONFIG_FILE="$XDG_CONFIG_HOME/terraform/terraformrc"
|
|
||||||
export TF_PLUGIN_CACHE_DIR="$XDG_CACHE_HOME/terraform/plugin-cache"
|
|
||||||
|
|
||||||
# tldr / tealdeer
|
|
||||||
export TEALDEER_CONFIG_DIR="$XDG_CONFIG_HOME/tealdeer/"
|
|
||||||
|
|
||||||
# tmux
|
|
||||||
export TMUX_CONF="$XDG_CONFIG_HOME/tmux/tmux.conf"
|
|
||||||
|
|
||||||
# wakatime, https://github.com/wakatime/wakatime-cli
|
|
||||||
export WAKATIME_HOME="$XDG_STATE_HOME/wakatime"
|
|
||||||
x-dc "$WAKATIME_HOME"
|
|
||||||
|
|
||||||
# Misc
|
|
||||||
export BAT_THEME="ansi"
|
|
||||||
export CHEAT_USE_FZF=true
|
|
||||||
export SQLITE_HISTORY="$XDG_CACHE_HOME"/sqlite_history
|
|
||||||
@@ -1,19 +1,25 @@
|
|||||||
# lakka exports
|
# lakka exports
|
||||||
|
|
||||||
## LUA
|
## LUA
|
||||||
x-have luarocks && $(luarocks path --bin)
|
if command -v luarocks &> /dev/null; then
|
||||||
|
eval "$(luarocks path --bin)"
|
||||||
|
fi
|
||||||
|
|
||||||
export PATH="$HOME/.local/go/bin:$PATH"
|
export PATH="$HOME/.local/go/bin:$PATH"
|
||||||
|
|
||||||
alias logrotate='/usr/sbin/logrotate -s $HOME/logs/state'
|
alias logrotate='/usr/sbin/logrotate -s "$HOME/logs/state"'
|
||||||
alias nano='nano -wS -$'
|
alias nano='nano -wS -$'
|
||||||
alias gpg=gpg2
|
alias gpg=gpg2
|
||||||
|
|
||||||
ACME_PATH="$HOME/.acme.sh"
|
ACME_PATH="$HOME/.acme.sh"
|
||||||
# shellcheck source=$HOME/.acme.sh/acme.sh.env
|
# shellcheck source=$HOME/.acme.sh/acme.sh.env
|
||||||
[[ -s "$ACME_PATH/acme.sh.env" ]] && . "$ACME_PATH/acme.sh.env"
|
if [[ -s "$ACME_PATH/acme.sh.env" ]]; then
|
||||||
|
source "$ACME_PATH/acme.sh.env"
|
||||||
|
fi
|
||||||
|
|
||||||
export RVM_PATH="$HOME/.rvm"
|
export RVM_PATH="$HOME/.rvm"
|
||||||
export PATH="$RVM_PATH/bin:$PATH"
|
export PATH="$RVM_PATH/bin:$PATH"
|
||||||
# shellcheck source=$HOME/.rvm/scripts/rvm
|
# shellcheck source=$HOME/.rvm/scripts/rvm
|
||||||
[[ -s "$RVM_PATH/scripts/rvm" ]] && source "$RVM_PATH/scripts/rvm" # Load RVM into a shell session *as a function*
|
if [[ -s "$RVM_PATH/scripts/rvm" ]]; then
|
||||||
|
source "$RVM_PATH/scripts/rvm" # Load RVM into a shell session *as a function*
|
||||||
|
fi
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# shellcheck shell=bash
|
|
||||||
# shellcheck disable=1091,2046
|
|
||||||
# vim: filetype=bash
|
|
||||||
|
|
||||||
# Bash completion file location
|
|
||||||
export BASH_COMPLETION_USER_FILE="${XDG_CONFIG_HOME}/bash-completion/bash_completion"
|
|
||||||
|
|
||||||
# History env variables
|
|
||||||
export HIST_STAMPS="yyyy-mm-dd"
|
|
||||||
# Larger bash history (allow 32³ entries; default is 500)
|
|
||||||
export HISTSIZE=32768
|
|
||||||
export HISTFILESIZE=$HISTSIZE
|
|
||||||
# don't put duplicate lines or lines starting with space in the history.
|
|
||||||
# See bash(1) for more options
|
|
||||||
export HISTCONTROL=ignoreboth
|
|
||||||
# Make some commands not show up in history
|
|
||||||
export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"
|
|
||||||
# And include the parameter for ZSH
|
|
||||||
export HISTORY_IGNORE="(ls|cd|cd -|pwd|exit|date|* --help)"
|
|
||||||
|
|
||||||
# Less history location
|
|
||||||
export LESSHISTFILE="$XDG_STATE_HOME"/less/history
|
|
||||||
|
|
||||||
# Highlight section titles in manual pages
|
|
||||||
# export LESS_TERMCAP_md="$ORANGE"
|
|
||||||
|
|
||||||
# zsh autoloaded terminfo
|
|
||||||
export TERMINFO="${XDG_DATA_HOME}/terminfo"
|
|
||||||
export TERMINFO_DIRS="${XDG_DATA_HOME}/terminfo":/usr/share/terminfo
|
|
||||||
|
|
||||||
# Don't clear the screen after quitting a manual page
|
|
||||||
export MANPAGER="less -X"
|
|
||||||
|
|
||||||
# Always enable colored `grep` output
|
|
||||||
export GREP_OPTIONS="--color=auto"
|
|
||||||
|
|
||||||
# check the window size after each command and, if necessary,
|
|
||||||
# update the values of LINES and COLUMNS.
|
|
||||||
hash shopt 2> /dev/null && shopt -s checkwinsize
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# shell functions
|
|
||||||
@@ -19,3 +19,4 @@ wp_*.sh
|
|||||||
auth.json
|
auth.json
|
||||||
dfm.sh
|
dfm.sh
|
||||||
.scannerwork
|
.scannerwork
|
||||||
|
.phpactor.json
|
||||||
|
|||||||
2
config/gnupg/dirmngr.conf
Normal file
2
config/gnupg/dirmngr.conf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
disable-ipv6
|
||||||
|
enable-ssh-support
|
||||||
2
config/gnupg/gpg-agent.conf
Normal file
2
config/gnupg/gpg-agent.conf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
disable-ipv6
|
||||||
|
enable-ssh-support
|
||||||
@@ -8,7 +8,6 @@ tap "gesquive/tap"
|
|||||||
tap "github/gh"
|
tap "github/gh"
|
||||||
tap "homebrew/autoupdate"
|
tap "homebrew/autoupdate"
|
||||||
tap "homebrew/bundle"
|
tap "homebrew/bundle"
|
||||||
tap "homebrew/cask-fonts"
|
|
||||||
tap "homebrew/services"
|
tap "homebrew/services"
|
||||||
tap "jesseduffield/lazygit"
|
tap "jesseduffield/lazygit"
|
||||||
tap "k8sgpt-ai/k8sgpt"
|
tap "k8sgpt-ai/k8sgpt"
|
||||||
@@ -57,26 +56,28 @@ brew "apr"
|
|||||||
brew "apr-util"
|
brew "apr-util"
|
||||||
# Password hashing library and CLI utility
|
# Password hashing library and CLI utility
|
||||||
brew "argon2"
|
brew "argon2"
|
||||||
# Spell checker with better logic than ispell
|
|
||||||
brew "aspell"
|
|
||||||
# Automatic configure script builder
|
# Automatic configure script builder
|
||||||
brew "autoconf"
|
brew "autoconf"
|
||||||
# Collection of over 500 reusable autoconf macros
|
# Tool for generating GNU Standards-compliant Makefiles
|
||||||
brew "autoconf-archive"
|
brew "automake"
|
||||||
# GNU multiple precision arithmetic library
|
# GNU multiple precision arithmetic library
|
||||||
brew "gmp"
|
brew "gmp"
|
||||||
|
# GNU File, Shell, and Text utilities
|
||||||
|
brew "coreutils"
|
||||||
|
# Extendable version manager with support for Ruby, Node.js, Erlang & more
|
||||||
|
brew "asdf"
|
||||||
|
# Spell checker with better logic than ispell
|
||||||
|
brew "aspell"
|
||||||
|
# Collection of over 500 reusable autoconf macros
|
||||||
|
brew "autoconf-archive"
|
||||||
# Manage compile and link flags for libraries
|
# Manage compile and link flags for libraries
|
||||||
brew "pkg-config"
|
brew "pkg-config"
|
||||||
# Automated text file generator
|
# Automated text file generator
|
||||||
brew "autogen"
|
brew "autogen"
|
||||||
# Tool for generating GNU Standards-compliant Makefiles
|
|
||||||
brew "automake"
|
|
||||||
# Bourne-Again SHell, a UNIX command interpreter
|
# Bourne-Again SHell, a UNIX command interpreter
|
||||||
brew "bash"
|
brew "bash"
|
||||||
# Clone of cat(1) with syntax highlighting and Git integration
|
# Clone of cat(1) with syntax highlighting and Git integration
|
||||||
brew "bat"
|
brew "bat"
|
||||||
# Yet another cross-platform graphical process/system monitor
|
|
||||||
brew "bottom"
|
|
||||||
# Software library to render fonts
|
# Software library to render fonts
|
||||||
brew "freetype"
|
brew "freetype"
|
||||||
# XML-based font configuration API for X Windows
|
# XML-based font configuration API for X Windows
|
||||||
@@ -89,24 +90,18 @@ brew "glib"
|
|||||||
brew "choose-rust"
|
brew "choose-rust"
|
||||||
# Cross-platform make
|
# Cross-platform make
|
||||||
brew "cmake"
|
brew "cmake"
|
||||||
# GNU File, Shell, and Text utilities
|
|
||||||
brew "coreutils"
|
|
||||||
# Open source suite of directory software
|
|
||||||
brew "openldap"
|
|
||||||
# Get a file from an HTTP, HTTPS or FTP server
|
# Get a file from an HTTP, HTTPS or FTP server
|
||||||
brew "curl"
|
brew "curl"
|
||||||
# Lightweight DNS forwarder and DHCP server
|
# Lightweight DNS forwarder and DHCP server
|
||||||
brew "dnsmasq"
|
brew "dnsmasq"
|
||||||
# Lightning-fast linter for .env files written in Rust
|
|
||||||
brew "dotenv-linter"
|
|
||||||
# Spellchecker wrapping library
|
# Spellchecker wrapping library
|
||||||
brew "enchant"
|
brew "enchant"
|
||||||
# Perl lib for reading and writing EXIF metadata
|
# Perl lib for reading and writing EXIF metadata
|
||||||
brew "exiftool"
|
brew "exiftool"
|
||||||
# Simple, fast and user-friendly alternative to find
|
|
||||||
brew "fd"
|
|
||||||
# Banner-like program prints strings as ASCII art
|
# Banner-like program prints strings as ASCII art
|
||||||
brew "figlet"
|
brew "figlet"
|
||||||
|
# Lock file during command
|
||||||
|
brew "flock"
|
||||||
# Libraries to talk to Microsoft SQL Server and Sybase databases
|
# Libraries to talk to Microsoft SQL Server and Sybase databases
|
||||||
brew "freetds"
|
brew "freetds"
|
||||||
# Monitor a directory for changes and run a shell command
|
# Monitor a directory for changes and run a shell command
|
||||||
@@ -117,8 +112,6 @@ brew "fzf"
|
|||||||
brew "gd"
|
brew "gd"
|
||||||
# Disk usage analyzer with console interface written in Go
|
# Disk usage analyzer with console interface written in Go
|
||||||
brew "gdu"
|
brew "gdu"
|
||||||
# GitHub command-line tool
|
|
||||||
brew "gh"
|
|
||||||
# Distributed revision control system
|
# Distributed revision control system
|
||||||
brew "git"
|
brew "git"
|
||||||
# Enable transparent encryption/decryption of files in a git repo
|
# Enable transparent encryption/decryption of files in a git repo
|
||||||
@@ -137,10 +130,10 @@ brew "unbound"
|
|||||||
brew "gnutls"
|
brew "gnutls"
|
||||||
# GNU Pretty Good Privacy (PGP) package
|
# GNU Pretty Good Privacy (PGP) package
|
||||||
brew "gnupg"
|
brew "gnupg"
|
||||||
# Open source programming language to build simple/reliable/efficient software
|
|
||||||
brew "go"
|
|
||||||
# Library access to GnuPG
|
# Library access to GnuPG
|
||||||
brew "gpgme"
|
brew "gpgme"
|
||||||
|
# Open source suite of directory software
|
||||||
|
brew "openldap"
|
||||||
# Manage your GnuPG keys with ease!
|
# Manage your GnuPG keys with ease!
|
||||||
brew "gpg-tui"
|
brew "gpg-tui"
|
||||||
# Image manipulation
|
# Image manipulation
|
||||||
@@ -159,8 +152,6 @@ brew "graphviz"
|
|||||||
brew "grep"
|
brew "grep"
|
||||||
# Popular GNU data compression program
|
# Popular GNU data compression program
|
||||||
brew "gzip"
|
brew "gzip"
|
||||||
# Smarter Dockerfile linter to validate best practices
|
|
||||||
brew "hadolint"
|
|
||||||
# Improved top (interactive process viewer)
|
# Improved top (interactive process viewer)
|
||||||
brew "htop"
|
brew "htop"
|
||||||
# Portable abstraction of the hierarchical topology of modern architectures
|
# Portable abstraction of the hierarchical topology of modern architectures
|
||||||
@@ -177,8 +168,6 @@ brew "jq"
|
|||||||
brew "json-c"
|
brew "json-c"
|
||||||
# Scanning your k8s clusters, diagnosing, and triaging issues in simple English
|
# Scanning your k8s clusters, diagnosing, and triaging issues in simple English
|
||||||
brew "k8sgpt"
|
brew "k8sgpt"
|
||||||
# Network authentication protocol
|
|
||||||
brew "krb5"
|
|
||||||
# Tool to detect/remediate misconfig and security risks of GitHub/GitLab assets
|
# Tool to detect/remediate misconfig and security risks of GitHub/GitLab assets
|
||||||
brew "legitify"
|
brew "legitify"
|
||||||
# Secure hashing function
|
# Secure hashing function
|
||||||
@@ -205,8 +194,6 @@ brew "nginx"
|
|||||||
brew "nmap"
|
brew "nmap"
|
||||||
# ISO-C API and CLI for generating UUIDs
|
# ISO-C API and CLI for generating UUIDs
|
||||||
brew "ossp-uuid"
|
brew "ossp-uuid"
|
||||||
# General-purpose scripting language
|
|
||||||
brew "php"
|
|
||||||
# Coreutils progress viewer
|
# Coreutils progress viewer
|
||||||
brew "progress"
|
brew "progress"
|
||||||
# Python version management
|
# Python version management
|
||||||
@@ -221,22 +208,12 @@ brew "python@3.11"
|
|||||||
brew "ruby-build"
|
brew "ruby-build"
|
||||||
# Ruby version manager
|
# Ruby version manager
|
||||||
brew "rbenv"
|
brew "rbenv"
|
||||||
# Search tool like grep and The Silver Searcher
|
|
||||||
brew "ripgrep"
|
|
||||||
# Safe, concurrent, practical language
|
|
||||||
brew "rust"
|
|
||||||
# Static analysis and lint tool, for (ba)sh scripts
|
# Static analysis and lint tool, for (ba)sh scripts
|
||||||
brew "shellcheck"
|
brew "shellcheck"
|
||||||
# Autoformat shell script source code
|
|
||||||
brew "shfmt"
|
|
||||||
# Feature-rich console based todo list manager
|
# Feature-rich console based todo list manager
|
||||||
brew "task"
|
brew "task"
|
||||||
# Terminal user interface for taskwarrior
|
|
||||||
brew "taskwarrior-tui"
|
|
||||||
# Send macOS User Notifications from the command-line
|
# Send macOS User Notifications from the command-line
|
||||||
brew "terminal-notifier"
|
brew "terminal-notifier"
|
||||||
# Thin wrapper for Terraform e.g. for locking state
|
|
||||||
brew "terragrunt"
|
|
||||||
# Tool which checks for the support of TLS/SSL ciphers and flaws
|
# Tool which checks for the support of TLS/SSL ciphers and flaws
|
||||||
brew "testssl"
|
brew "testssl"
|
||||||
# Terraform version manager inspired by rbenv
|
# Terraform version manager inspired by rbenv
|
||||||
@@ -259,17 +236,32 @@ brew "watch"
|
|||||||
brew "wget"
|
brew "wget"
|
||||||
# Check your $HOME for unwanted files and directories
|
# Check your $HOME for unwanted files and directories
|
||||||
brew "xdg-ninja", args: ["HEAD"]
|
brew "xdg-ninja", args: ["HEAD"]
|
||||||
# JavaScript package manager
|
|
||||||
brew "yarn"
|
|
||||||
# Watcher for macOS 10.14+ light/dark mode changes
|
# Watcher for macOS 10.14+ light/dark mode changes
|
||||||
brew "cormacrelf/tap/dark-notify"
|
brew "cormacrelf/tap/dark-notify"
|
||||||
# Cleans up your $HOME from those pesky dotfiles
|
# Cleans up your $HOME from those pesky dotfiles
|
||||||
brew "doron-cohen/tap/antidot"
|
brew "doron-cohen/tap/antidot"
|
||||||
# lets you quickly switch between multiple git user profiles
|
# lets you quickly switch between multiple git user profiles
|
||||||
brew "gesquive/tap/git-user"
|
brew "gesquive/tap/git-user"
|
||||||
brew "keith/formulae/reminders-cli"
|
|
||||||
# Automated code review tool integrated with any code analysis tools regardless of programming language.
|
# Automated code review tool integrated with any code analysis tools regardless of programming language.
|
||||||
brew "reviewdog/tap/reviewdog"
|
brew "reviewdog/tap/reviewdog"
|
||||||
|
# Imagick PHP extension
|
||||||
|
brew "shivammathur/extensions/imagick@8.3"
|
||||||
|
# Mcrypt PHP extension
|
||||||
|
brew "shivammathur/extensions/mcrypt@8.3"
|
||||||
|
# Msgpack PHP extension
|
||||||
|
brew "shivammathur/extensions/msgpack@8.3"
|
||||||
|
# PCOV PHP extension
|
||||||
|
brew "shivammathur/extensions/pcov@8.3"
|
||||||
|
# Redis PHP extension
|
||||||
|
brew "shivammathur/extensions/redis@8.3"
|
||||||
|
# Uuid PHP extension
|
||||||
|
brew "shivammathur/extensions/uuid@8.3"
|
||||||
|
# Yaml PHP extension
|
||||||
|
brew "shivammathur/extensions/yaml@8.3"
|
||||||
|
# General-purpose scripting language
|
||||||
|
brew "shivammathur/php/php"
|
||||||
|
# General-purpose scripting language
|
||||||
|
brew "shivammathur/php/php-debug"
|
||||||
# Command-line interface for 1Password
|
# Command-line interface for 1Password
|
||||||
cask "1password-cli"
|
cask "1password-cli"
|
||||||
# GPU-accelerated terminal emulator
|
# GPU-accelerated terminal emulator
|
||||||
@@ -282,22 +274,6 @@ cask "dbeaver-community"
|
|||||||
cask "dbngin"
|
cask "dbngin"
|
||||||
# App to build and share containerised applications and microservices
|
# App to build and share containerised applications and microservices
|
||||||
cask "docker"
|
cask "docker"
|
||||||
# Unofficial overcast.fm podcast app
|
|
||||||
cask "fog"
|
|
||||||
# Typeface made for developers
|
|
||||||
cask "font-jetbrains-mono"
|
|
||||||
# Developer targeted fonts with a high number of glyphs
|
|
||||||
cask "font-jetbrains-mono-nerd-font"
|
|
||||||
cask "font-lato"
|
|
||||||
cask "font-open-sans"
|
|
||||||
# Font with a mechanical skeleton and the forms are largely geometric
|
|
||||||
cask "font-roboto"
|
|
||||||
cask "font-source-code-pro"
|
|
||||||
cask "font-source-code-pro-for-powerline"
|
|
||||||
cask "font-source-sans-pro"
|
|
||||||
cask "font-source-serif-pro"
|
|
||||||
# Open Source Webfont Converter
|
|
||||||
cask "fontplop"
|
|
||||||
# GIT client
|
# GIT client
|
||||||
cask "fork"
|
cask "fork"
|
||||||
# HTTP and GraphQL Client
|
# HTTP and GraphQL Client
|
||||||
@@ -348,6 +324,8 @@ cask "soundsource"
|
|||||||
cask "suspicious-package"
|
cask "suspicious-package"
|
||||||
# Quicklook extension for source files
|
# Quicklook extension for source files
|
||||||
cask "syntax-highlight"
|
cask "syntax-highlight"
|
||||||
|
# Python IDE for beginners
|
||||||
|
cask "thonny"
|
||||||
# Configuration application for the Ultimate Hacking Keyboard
|
# Configuration application for the Ultimate Hacking Keyboard
|
||||||
cask "uhk-agent"
|
cask "uhk-agent"
|
||||||
# Open-source code editor
|
# Open-source code editor
|
||||||
@@ -358,3 +336,5 @@ cask "vlc"
|
|||||||
cask "voikkospellservice"
|
cask "voikkospellservice"
|
||||||
# Application for generating TOTP and HOTP codes
|
# Application for generating TOTP and HOTP codes
|
||||||
cask "yubico-authenticator"
|
cask "yubico-authenticator"
|
||||||
|
# Multiplayer code editor
|
||||||
|
cask "zed"
|
||||||
|
|||||||
Submodule config/nvim-kickstart updated: 122c6938c1...f5aa89acb8
@@ -32,4 +32,4 @@
|
|||||||
"NEWS.md": "6077"
|
"NEWS.md": "6077"
|
||||||
},
|
},
|
||||||
"version": 6
|
"version": 6
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
|
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
|
||||||
"final_space": true,
|
"final_space": true,
|
||||||
"console_title_template": "{{.UserName}}@{{.HostName}} {{.Shell}} in {{.PWD}}",
|
"console_title_template": "{{.UserName}}@{{.HostName}} {{.Shell}} in {{.PWD}}",
|
||||||
|
"auto_upgrade": true,
|
||||||
"blocks": [
|
"blocks": [
|
||||||
{
|
{
|
||||||
"alignment": "left",
|
"alignment": "left",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
final_space = true
|
final_space = true
|
||||||
console_title_template = "{{.UserName}}@{{.HostName}} {{.Shell}} in {{.PWD}}"
|
console_title_template = "{{.UserName}}@{{.HostName}} {{.Shell}} in {{.PWD}}"
|
||||||
version = 2
|
version = 2
|
||||||
|
auto_upgrade = true
|
||||||
|
|
||||||
[[blocks]]
|
[[blocks]]
|
||||||
alignment = "left"
|
alignment = "left"
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
version = 2
|
version = 2
|
||||||
final_space = true
|
final_space = true
|
||||||
console_title_template = '{{ .Shell }} in {{ .Folder }}'
|
console_title_template = '{{ .Shell }} in {{ .Folder }}'
|
||||||
|
auto_upgrade = true
|
||||||
|
|
||||||
[[blocks]]
|
[[blocks]]
|
||||||
type = 'prompt'
|
type = 'prompt'
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
# shellcheck shell=bash
|
|
||||||
|
|
||||||
# Defaults
|
|
||||||
export DOTFILES="$HOME/.dotfiles"
|
|
||||||
|
|
||||||
# Explicitly set XDG folders
|
|
||||||
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
|
||||||
export XDG_CONFIG_HOME="$HOME/.config"
|
|
||||||
export XDG_DATA_HOME="$HOME/.local/share"
|
|
||||||
export XDG_STATE_HOME="$HOME/.local/state"
|
|
||||||
|
|
||||||
# custom variables
|
|
||||||
export XDG_BIN_HOME="$HOME/.local/bin"
|
|
||||||
export XDG_CACHE_HOME="$HOME/.cache"
|
|
||||||
export XDG_RUNTIME_DIR="$HOME/.local/run"
|
|
||||||
|
|
||||||
# Paths
|
|
||||||
export PATH="$XDG_BIN_HOME:$DOTFILES/local/bin:$HOME/.local/go/bin:$XDG_DATA_HOME/bob/nvim-bin:$XDG_DATA_HOME/cargo/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"
|
|
||||||
|
|
||||||
# Split config files
|
|
||||||
source "$DOTFILES/config/exports"
|
|
||||||
source "$DOTFILES/config/functions"
|
|
||||||
source "$DOTFILES/config/alias"
|
|
||||||
|
|
||||||
96
config/shared.sh
Executable file
96
config/shared.sh
Executable file
@@ -0,0 +1,96 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Shared configuration
|
||||||
|
#
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
# Defaults
|
||||||
|
[ -z "$DOTFILES" ] && export DOTFILES="$HOME/.dotfiles"
|
||||||
|
export DOTFILES_CURRENT_SHELL=$(basename "$SHELL")
|
||||||
|
|
||||||
|
# Enable verbosity with VERBOSE=1
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
# Enable debugging with DEBUG=1
|
||||||
|
DEBUG="${DEBUG:-0}"
|
||||||
|
|
||||||
|
# Enable debugging with DEBUG=1
|
||||||
|
[ "${DEBUG:-0}" -eq 1 ] && set -x
|
||||||
|
|
||||||
|
# Explicitly set XDG folders, if not already set
|
||||||
|
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||||
|
[ -z "$XDG_CONFIG_HOME" ] && export XDG_CONFIG_HOME="$HOME/.config"
|
||||||
|
[ -z "$XDG_DATA_HOME" ] && export XDG_DATA_HOME="$HOME/.local/share"
|
||||||
|
[ -z "$XDG_CACHE_HOME" ] && export XDG_CACHE_HOME="$HOME/.cache"
|
||||||
|
[ -z "$XDG_STATE_HOME" ] && export XDG_STATE_HOME="$HOME/.local/state"
|
||||||
|
[ -z "$XDG_BIN_HOME" ] && export XDG_BIN_HOME="$HOME/.local/bin"
|
||||||
|
|
||||||
|
# Paths
|
||||||
|
x-path-prepend "/usr/local/bin"
|
||||||
|
x-path-prepend "/opt/homebrew/bin"
|
||||||
|
x-path-prepend "$XDG_DATA_HOME/cargo/bin"
|
||||||
|
x-path-prepend "$XDG_DATA_HOME/bob/nvim-bin"
|
||||||
|
x-path-prepend "$DOTFILES/local/bin"
|
||||||
|
x-path-prepend "$XDG_BIN_HOME"
|
||||||
|
|
||||||
|
# Custom completion paths
|
||||||
|
[ -z "$ZSH_CUSTOM_COMPLETION_PATH" ] && export ZSH_CUSTOM_COMPLETION_PATH="$XDG_CONFIG_HOME/zsh/completion"
|
||||||
|
x-dc "$ZSH_CUSTOM_COMPLETION_PATH"
|
||||||
|
export FPATH="$ZSH_CUSTOM_COMPLETION_PATH:$FPATH"
|
||||||
|
|
||||||
|
if ! declare -f msg > /dev/null; then
|
||||||
|
# Function to print messages if VERBOSE is enabled
|
||||||
|
# $1 - message (string)
|
||||||
|
msg()
|
||||||
|
{
|
||||||
|
[ "$VERBOSE" -eq 1 ] && echo "$1"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
msg "msg was not defined, defined it now"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! declare -f msg_err > /dev/null; then
|
||||||
|
msg "msg_err was not defined, defined it now"
|
||||||
|
# Function to print error messages and exit
|
||||||
|
# $1 - error message (string)
|
||||||
|
msg_err()
|
||||||
|
{
|
||||||
|
echo "(!) ERROR: $1" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! declare -f msg_done > /dev/null; then
|
||||||
|
msg "msg_done was not defined, defined it now"
|
||||||
|
# Function to print done message
|
||||||
|
# $1 - message (string)
|
||||||
|
msg_done()
|
||||||
|
{
|
||||||
|
echo "✓ $1"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! declare -f msg_run > /dev/null; then
|
||||||
|
msg "msg_run was not defined, defined it now"
|
||||||
|
# Function to print running message
|
||||||
|
# $1 - message (string)
|
||||||
|
msg_run()
|
||||||
|
{
|
||||||
|
echo "→ $1"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! declare -f msg_ok > /dev/null; then
|
||||||
|
msg "msg_ok was not defined, defined it now"
|
||||||
|
# Function to print ok message
|
||||||
|
# $1 - message (string)
|
||||||
|
msg_ok()
|
||||||
|
{
|
||||||
|
echo "✓ $1"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "$DOTFILES/config/exports"
|
||||||
|
source "$DOTFILES/config/alias"
|
||||||
37
config/wezterm/wezterm.lua
Normal file
37
config/wezterm/wezterm.lua
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
local wezterm = require("wezterm")
|
||||||
|
local config = wezterm.config_builder()
|
||||||
|
|
||||||
|
-- Font and font size
|
||||||
|
config.font_size = 14.0
|
||||||
|
config.font = wezterm.font("JetBrainsMonoNL Nerd Font Mono")
|
||||||
|
|
||||||
|
-- Make the window a bit transparent
|
||||||
|
config.window_background_opacity = 0.97
|
||||||
|
|
||||||
|
-- Don't show tab bar
|
||||||
|
config.enable_tab_bar = false
|
||||||
|
|
||||||
|
config.send_composed_key_when_left_alt_is_pressed = true
|
||||||
|
|
||||||
|
-- Function to detect the theme based on appearance
|
||||||
|
function Scheme_for_appearance(appearance)
|
||||||
|
if appearance:find("Dark") then
|
||||||
|
return "Tokyo Night Storm"
|
||||||
|
else
|
||||||
|
return "Tokyo Night Day"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Set the color scheme based on appearance
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
|
wezterm.on("window-config-reloaded", function(window, pane)
|
||||||
|
local overrides = window:get_config_overrides() or {}
|
||||||
|
local appearance = window:get_appearance()
|
||||||
|
local scheme = Scheme_for_appearance(appearance)
|
||||||
|
if overrides.color_scheme ~= scheme then
|
||||||
|
overrides.color_scheme = scheme
|
||||||
|
window:set_config_overrides(overrides)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
return config
|
||||||
53
docs/folders.md
Normal file
53
docs/folders.md
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# Interesting folders
|
||||||
|
|
||||||
|
## XDG
|
||||||
|
|
||||||
|
XDG is a set of specifications that provide a standard for the organization
|
||||||
|
of user-specific files and directories. It is based on the _XDG Base Directory Specification_.
|
||||||
|
|
||||||
|
### XDG_BIN_HOME (`$HOME/.local/bin`)
|
||||||
|
|
||||||
|
`$XDG_BIN_HOME` defines directory that contains local binaries.
|
||||||
|
|
||||||
|
User-specific executable files may be stored in `$HOME/.local/bin`.
|
||||||
|
Distributions should ensure this directory shows up in the UNIX `$PATH`
|
||||||
|
environment variable, at an appropriate place.
|
||||||
|
|
||||||
|
### XDG_DATA_HOME (`$HOME/.local/share`)
|
||||||
|
|
||||||
|
`$XDG_DATA_HOME` defines the base directory relative to which
|
||||||
|
user-specific _data files_ should be stored.
|
||||||
|
|
||||||
|
If `$XDG_DATA_HOME` is either not set or empty,
|
||||||
|
a default equal to `$HOME/.local/share` should be used.
|
||||||
|
|
||||||
|
### XDG_CONFIG_HOME (`$HOME/.config`)
|
||||||
|
|
||||||
|
`$XDG_CONFIG_HOME` defines the base directory relative to which
|
||||||
|
user-specific _configuration files_ should be stored.
|
||||||
|
|
||||||
|
If `$XDG_CONFIG_HOME` is either not set or empty,
|
||||||
|
a default equal to `$HOME/.config` should be used.
|
||||||
|
|
||||||
|
### XDG_STATE_HOME (`$HOME/.local/state`)
|
||||||
|
|
||||||
|
`$XDG_STATE_HOME` defines the base directory relative to which
|
||||||
|
user-specific _state files_ should be stored.
|
||||||
|
|
||||||
|
If `$XDG_STATE_HOME` is either not set or empty,
|
||||||
|
a default equal to `$HOME/.local/state` should be used.
|
||||||
|
|
||||||
|
The `$XDG_STATE_HOME` contains _state data_ that should
|
||||||
|
_persist between (application) restarts_, but that is not important or
|
||||||
|
portable enough to the user that it should be stored in `$XDG_DATA_HOME`.
|
||||||
|
|
||||||
|
- It may contain:
|
||||||
|
- actions history (logs, history, recently used files, …)
|
||||||
|
- current state of the application that can be reused
|
||||||
|
on a restart (view, layout, open files, undo history, …)
|
||||||
|
|
||||||
|
### XDG_DATA_DIRS
|
||||||
|
|
||||||
|
`$XDG_DATA_DIRS` defines the preference-ordered set of base directories
|
||||||
|
to search for data files in addition to the `$XDG_DATA_HOME` base directory.
|
||||||
|
The directories in `$XDG_DATA_DIRS` should be separated with a colon ':'.
|
||||||
@@ -3,8 +3,6 @@
|
|||||||
```txt
|
```txt
|
||||||
|
|
||||||
n <Esc> * <Cmd>nohlsearch<CR>
|
n <Esc> * <Cmd>nohlsearch<CR>
|
||||||
n <Space>tc * <Cmd>CloakToggle<CR>
|
|
||||||
Toggle Cloak
|
|
||||||
n <Space>zg * :Rg<CR>
|
n <Space>zg * :Rg<CR>
|
||||||
FZF: search with rg (aka live grep).
|
FZF: search with rg (aka live grep).
|
||||||
n <Space>zm * :Maps<CR>
|
n <Space>zm * :Maps<CR>
|
||||||
@@ -19,34 +17,36 @@ n <Space>zc * :Commands<CR>
|
|||||||
FZF: search commands.
|
FZF: search commands.
|
||||||
n <Space>zf * :FZF<Space>
|
n <Space>zf * :FZF<Space>
|
||||||
FZF: search for files in given path.
|
FZF: search for files in given path.
|
||||||
<Space>f * <Lua 40: ~/.dotfiles/config/nvim-kickstart/init.lua:505>
|
n <Space>tc * <Cmd>CloakToggle<CR>
|
||||||
[F]ormat buffer
|
[tc] Toggle Cloak
|
||||||
n <Space>e * <Lua 80: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
n <Space>4 * <Lua 84: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||||
n <Space>tz * <Lua 60: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
|
||||||
Toggle ZenMode
|
|
||||||
n <Space>4 * <Lua 58: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
|
||||||
harpoon to file 4
|
harpoon to file 4
|
||||||
n <Space>3 * <Lua 57: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
n <Space>3 * <Lua 83: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||||
harpoon to file 3
|
harpoon to file 3
|
||||||
n <Space>2 * <Lua 56: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
n <Space>2 * <Lua 82: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||||
harpoon to file 2
|
harpoon to file 2
|
||||||
n <Space>1 * <Lua 55: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
n <Space>1 * <Lua 81: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||||
harpoon to file 1
|
harpoon to file 1
|
||||||
n <Space>xn * <Lua 54: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
n <Space>xn * <Lua 80: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||||
harpoon to next file
|
harpoon to next file
|
||||||
n <Space>xN * <Lua 53: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
n <Space>xa * <Lua 79: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||||
harpoon to previous file
|
|
||||||
n <Space>xa * <Lua 52: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
|
||||||
harpoon quick menu
|
harpoon quick menu
|
||||||
n <Space>xA * <Lua 51: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
n <Space>xN * <Lua 78: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||||
|
harpoon to previous file
|
||||||
|
n <Space>xA * <Lua 77: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||||
harpoon file
|
harpoon file
|
||||||
n <Space>5 * <Lua 49: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
n <Space>5 * <Lua 76: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||||
harpoon to file 5
|
harpoon to file 5
|
||||||
|
n <Space>tz * <Lua 51: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||||
|
[tz] Toggle ZenMode
|
||||||
|
n <Space>e * <Lua 47: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||||
|
<Space>f * <Lua 40: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||||
|
[f] Format buffer
|
||||||
n <Space>qq * <Cmd>wq!<CR>
|
n <Space>qq * <Cmd>wq!<CR>
|
||||||
Quickly Quit
|
Quickly Quit
|
||||||
n <Space>bq * <Lua 27: ~/.local/share/bob/v0.10.0/nvim-macos-arm64/share/nvim/runtime/lua/vim/diagnostic.lua:1984>
|
n <Space>bq * <Lua 28: ~/.local/share/bob/v0.10.0/nvim-macos-arm64/share/nvim/runtime/lua/vim/diagnostic.lua:1984>
|
||||||
Open diagnostic [Q]uickfix list
|
Open diagnostic [Q]uickfix list
|
||||||
n <Space>be * <Lua 26: ~/.local/share/bob/v0.10.0/nvim-macos-arm64/share/nvim/runtime/lua/vim/diagnostic.lua:1694>
|
n <Space>be * <Lua 27: ~/.local/share/bob/v0.10.0/nvim-macos-arm64/share/nvim/runtime/lua/vim/diagnostic.lua:1694>
|
||||||
Show diagnostic [E]rror messages
|
Show diagnostic [E]rror messages
|
||||||
x # * <Lua 7: vim/_defaults.lua:0>
|
x # * <Lua 7: vim/_defaults.lua:0>
|
||||||
:help v_#-default
|
:help v_#-default
|
||||||
@@ -74,108 +74,98 @@ n ]% <Plug>(MatchitNormalMultiForward)
|
|||||||
n ]d * <Lua 14: vim/_defaults.lua:0>
|
n ]d * <Lua 14: vim/_defaults.lua:0>
|
||||||
Jump to the next diagnostic
|
Jump to the next diagnostic
|
||||||
x a% <Plug>(MatchitVisualTextObject)
|
x a% <Plug>(MatchitVisualTextObject)
|
||||||
o al <Lua 322: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1145>
|
o al <Lua 247: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||||
Around last textobject
|
Around last textobject
|
||||||
o an <Lua 318: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1145>
|
o an <Lua 246: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||||
Around next textobject
|
Around next textobject
|
||||||
x al <Lua 292: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1145>
|
x al <Lua 243: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||||
Around last textobject
|
Around last textobject
|
||||||
x an <Lua 291: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1145>
|
x an <Lua 242: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||||
Around next textobject
|
Around next textobject
|
||||||
o a <Lua 288: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1145>
|
o a <Lua 240: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||||
Around textobject
|
Around textobject
|
||||||
x a <Lua 285: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1145>
|
x a <Lua 238: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||||
Around textobject
|
Around textobject
|
||||||
n dj * <Lua 25: ~/.local/share/bob/v0.10.0/nvim-macos-arm64/share/nvim/runtime/lua/vim/diagnostic.lua:1222>
|
n dj * <Lua 26: ~/.local/share/bob/v0.10.0/nvim-macos-arm64/share/nvim/runtime/lua/vim/diagnostic.lua:1222>
|
||||||
Go to next [D]iagnostic message
|
Go to next [D]iagnostic message
|
||||||
n dk * <Lua 23: ~/.local/share/bob/v0.10.0/nvim-macos-arm64/share/nvim/runtime/lua/vim/diagnostic.lua:1145>
|
n dk * <Lua 25: ~/.local/share/bob/v0.10.0/nvim-macos-arm64/share/nvim/runtime/lua/vim/diagnostic.lua:1145>
|
||||||
Go to previous [D]iagnostic message
|
Go to previous [D]iagnostic message
|
||||||
o g% <Plug>(MatchitOperationBackward)
|
o g% <Plug>(MatchitOperationBackward)
|
||||||
x g% <Plug>(MatchitVisualBackward)
|
x g% <Plug>(MatchitVisualBackward)
|
||||||
n g% <Plug>(MatchitNormalBackward)
|
n g% <Plug>(MatchitNormalBackward)
|
||||||
o g] <Lua 281: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1142>
|
n gR * :RegexplainerToggle<CR>
|
||||||
|
Toggle Regexplainer
|
||||||
|
o g] <Lua 237: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1169>
|
||||||
Move to right "around"
|
Move to right "around"
|
||||||
x g] <Lua 280: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1142>
|
x g] <Lua 236: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1169>
|
||||||
Move to right "around"
|
Move to right "around"
|
||||||
n g] <Lua 278: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1142>
|
n g] <Lua 235: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1169>
|
||||||
Move to right "around"
|
Move to right "around"
|
||||||
o g[ <Lua 277: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1141>
|
o g[ <Lua 234: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1168>
|
||||||
Move to left "around"
|
Move to left "around"
|
||||||
x g[ <Lua 273: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1141>
|
x g[ <Lua 233: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1168>
|
||||||
Move to left "around"
|
Move to left "around"
|
||||||
n g[ <Lua 266: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1141>
|
n g[ <Lua 232: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1168>
|
||||||
Move to left "around"
|
Move to left "around"
|
||||||
n gcA * <Lua 275: ~/.local/share/nvim-kickstart/lazy/Comment.nvim/lua/Comment/api.lua:218>
|
|
||||||
Comment insert end of line
|
|
||||||
n gcO * <Lua 274: ~/.local/share/nvim-kickstart/lazy/Comment.nvim/lua/Comment/api.lua:179>
|
|
||||||
Comment insert above
|
|
||||||
n gco * <Lua 11: ~/.local/share/nvim-kickstart/lazy/Comment.nvim/lua/Comment/api.lua:182>
|
|
||||||
Comment insert below
|
|
||||||
x gb * <Plug>(comment_toggle_blockwise_visual)
|
|
||||||
Comment toggle blockwise (visual)
|
|
||||||
n gbc * <Lua 12: ~/.local/share/nvim-kickstart/lazy/Comment.nvim/lua/Comment/init.lua:107>
|
|
||||||
Comment toggle current block
|
|
||||||
n gb * <Plug>(comment_toggle_blockwise)
|
|
||||||
Comment toggle blockwise
|
|
||||||
o gc * <Lua 13: vim/_defaults.lua:0>
|
o gc * <Lua 13: vim/_defaults.lua:0>
|
||||||
Comment textobject
|
Comment textobject
|
||||||
n gcc * <Lua 10: ~/.local/share/nvim-kickstart/lazy/Comment.nvim/lua/Comment/init.lua:103>
|
n gcc * <Lua 12: vim/_defaults.lua:0>
|
||||||
Comment toggle current line
|
Toggle comment line
|
||||||
x gc * <Plug>(comment_toggle_linewise_visual)
|
x gc * <Lua 11: vim/_defaults.lua:0>
|
||||||
Comment toggle linewise (visual)
|
Toggle comment
|
||||||
n gc * <Plug>(comment_toggle_linewise)
|
n gc * <Lua 10: vim/_defaults.lua:0>
|
||||||
Comment toggle linewise
|
Toggle comment
|
||||||
x gx * <Lua 9: vim/_defaults.lua:0>
|
x gx * <Lua 9: vim/_defaults.lua:0>
|
||||||
Opens filepath or URI under cursor with the system handler (file explorer, web browser, …)
|
Opens filepath or URI under cursor with the system handler (file explorer, web browser, …)
|
||||||
n gx * <Lua 8: vim/_defaults.lua:0>
|
n gx * <Lua 8: vim/_defaults.lua:0>
|
||||||
Opens filepath or URI under cursor with the system handler (file explorer, web browser, …)
|
Opens filepath or URI under cursor with the system handler (file explorer, web browser, …)
|
||||||
o il <Lua 325: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1145>
|
o il <Lua 249: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||||
Inside last textobject
|
Inside last textobject
|
||||||
o in <Lua 324: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1145>
|
o in <Lua 248: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||||
Inside next textobject
|
Inside next textobject
|
||||||
x il <Lua 296: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1145>
|
x il <Lua 245: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||||
Inside last textobject
|
Inside last textobject
|
||||||
x in <Lua 295: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1145>
|
x in <Lua 244: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||||
Inside next textobject
|
Inside next textobject
|
||||||
o i <Lua 289: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1145>
|
o i <Lua 241: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||||
Inside textobject
|
Inside textobject
|
||||||
x i <Lua 286: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1145>
|
x i <Lua 239: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/ai.lua:1172>
|
||||||
Inside textobject
|
Inside textobject
|
||||||
n shn * <Lua 428: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1220>
|
n shn * <Lua 266: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||||
Highlight next surrounding
|
Highlight next surrounding
|
||||||
n sFn * <Lua 427: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1220>
|
n sFn * <Lua 265: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||||
Find next left surrounding
|
Find next left surrounding
|
||||||
n sfn * <Lua 426: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1220>
|
n sfn * <Lua 264: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||||
Find next right surrounding
|
Find next right surrounding
|
||||||
n srn * <Lua 425: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1220>
|
n srn * <Lua 263: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||||
Replace next surrounding
|
Replace next surrounding
|
||||||
n sdn * <Lua 424: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1220>
|
n sdn * <Lua 262: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||||
Delete next surrounding
|
Delete next surrounding
|
||||||
n shl * <Lua 423: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1220>
|
n shl * <Lua 261: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||||
Highlight previous surrounding
|
Highlight previous surrounding
|
||||||
n sFl * <Lua 422: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1220>
|
n sFl * <Lua 260: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||||
Find previous left surrounding
|
Find previous left surrounding
|
||||||
n sfl * <Lua 421: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1220>
|
n sfl * <Lua 259: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||||
Find previous right surrounding
|
Find previous right surrounding
|
||||||
n srl * <Lua 386: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1220>
|
n srl * <Lua 258: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||||
Replace previous surrounding
|
Replace previous surrounding
|
||||||
n sdl * <Lua 371: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1220>
|
n sdl * <Lua 257: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||||
Delete previous surrounding
|
Delete previous surrounding
|
||||||
x sa * :<C-U>lua MiniSurround.add('visual')<CR>
|
x sa * :<C-U>lua MiniSurround.add('visual')<CR>
|
||||||
Add surrounding to selection
|
Add surrounding to selection
|
||||||
n sn * <Lua 370: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:861>
|
n sn * <Lua 256: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:892>
|
||||||
Update `MiniSurround.config.n_lines`
|
Update `MiniSurround.config.n_lines`
|
||||||
n sh * <Lua 351: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1220>
|
n sh * <Lua 255: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||||
Highlight surrounding
|
Highlight surrounding
|
||||||
n sF * <Lua 59: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1220>
|
n sF * <Lua 254: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||||
Find left surrounding
|
Find left surrounding
|
||||||
n sf * <Lua 331: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1220>
|
n sf * <Lua 253: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||||
Find right surrounding
|
Find right surrounding
|
||||||
n sr * <Lua 330: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1220>
|
n sr * <Lua 252: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||||
Replace surrounding
|
Replace surrounding
|
||||||
n sd * <Lua 328: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1220>
|
n sd * <Lua 251: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||||
Delete surrounding
|
Delete surrounding
|
||||||
n sa * <Lua 327: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1220>
|
n sa * <Lua 250: ~/.local/share/nvim-kickstart/lazy/mini.nvim/lua/mini/surround.lua:1252>
|
||||||
Add surrounding
|
Add surrounding
|
||||||
x <Plug>(MatchitVisualTextObject) <Plug>(MatchitVisualMultiBackward)o<Plug>(MatchitVisualMultiForward)
|
x <Plug>(MatchitVisualTextObject) <Plug>(MatchitVisualMultiBackward)o<Plug>(MatchitVisualMultiForward)
|
||||||
o <Plug>(MatchitOperationMultiForward) * :<C-U>call matchit#MultiMatch("W", "o")<CR>
|
o <Plug>(MatchitOperationMultiForward) * :<C-U>call matchit#MultiMatch("W", "o")<CR>
|
||||||
@@ -197,29 +187,12 @@ x <Plug>(fzf-maps-x) * :<C-U>call fzf#vim#maps('x', 0)<CR>
|
|||||||
n <Plug>(fzf-maps-n) * :<C-U>call fzf#vim#maps('n', 0)<CR>
|
n <Plug>(fzf-maps-n) * :<C-U>call fzf#vim#maps('n', 0)<CR>
|
||||||
n <Plug>(fzf-normal) * <Nop>
|
n <Plug>(fzf-normal) * <Nop>
|
||||||
n <Plug>(fzf-insert) * i
|
n <Plug>(fzf-insert) * i
|
||||||
n <Plug>PlenaryTestFile * :lua require('plenary.test_harness').test_file(vim.fn.expand("%:p"))<CR>
|
n <C-Bslash> * <Lua 60: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||||
x <Plug>(comment_toggle_blockwise_visual) * <Esc><Cmd>lua require("Comment.api").locked("toggle.blockwise")(vim.fn.visualmode())<CR>
|
|
||||||
Comment toggle blockwise (visual)
|
|
||||||
x <Plug>(comment_toggle_linewise_visual) * <Esc><Cmd>lua require("Comment.api").locked("toggle.linewise")(vim.fn.visualmode())<CR>
|
|
||||||
Comment toggle linewise (visual)
|
|
||||||
n <Plug>(comment_toggle_blockwise_count) * <Lua 272: ~/.local/share/nvim-kickstart/lazy/Comment.nvim/lua/Comment/api.lua:246>
|
|
||||||
Comment toggle blockwise with count
|
|
||||||
n <Plug>(comment_toggle_linewise_count) * <Lua 271: ~/.local/share/nvim-kickstart/lazy/Comment.nvim/lua/Comment/api.lua:246>
|
|
||||||
Comment toggle linewise with count
|
|
||||||
n <Plug>(comment_toggle_blockwise_current) * <Lua 270: ~/.local/share/nvim-kickstart/lazy/Comment.nvim/lua/Comment/api.lua:246>
|
|
||||||
Comment toggle current block
|
|
||||||
n <Plug>(comment_toggle_linewise_current) * <Lua 269: ~/.local/share/nvim-kickstart/lazy/Comment.nvim/lua/Comment/api.lua:246>
|
|
||||||
Comment toggle current line
|
|
||||||
n <Plug>(comment_toggle_blockwise) * <Lua 268: ~/.local/share/nvim-kickstart/lazy/Comment.nvim/lua/Comment/api.lua:246>
|
|
||||||
Comment toggle blockwise
|
|
||||||
n <Plug>(comment_toggle_linewise) * <Lua 267: ~/.local/share/nvim-kickstart/lazy/Comment.nvim/lua/Comment/api.lua:246>
|
|
||||||
Comment toggle linewise
|
|
||||||
n <C-Bslash> * <Lua 75: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
|
||||||
n <C-S> * <Cmd>w<CR>
|
n <C-S> * <Cmd>w<CR>
|
||||||
Save file
|
Save file
|
||||||
n <C-K> * <Lua 78: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
n <C-K> * <Lua 57: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||||
n <C-J> * <Lua 76: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
n <C-J> * <Lua 56: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||||
n <C-H> * <Lua 77: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
n <C-H> * <Lua 58: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||||
n <Down> * <Cmd>echo "Use j to move!!"<CR>
|
n <Down> * <Cmd>echo "Use j to move!!"<CR>
|
||||||
n <Up> * <Cmd>echo "Use k to move!!"<CR>
|
n <Up> * <Cmd>echo "Use k to move!!"<CR>
|
||||||
n <Right> * <Cmd>echo "Use l to move!!"<CR>
|
n <Right> * <Cmd>echo "Use l to move!!"<CR>
|
||||||
@@ -228,7 +201,7 @@ n <C-W><C-D> <C-W>d
|
|||||||
Show diagnostics under the cursor
|
Show diagnostics under the cursor
|
||||||
n <C-W>d * <Lua 16: vim/_defaults.lua:0>
|
n <C-W>d * <Lua 16: vim/_defaults.lua:0>
|
||||||
Show diagnostics under the cursor
|
Show diagnostics under the cursor
|
||||||
n <C-L> * <Lua 73: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
n <C-L> * <Lua 59: ~/.local/share/nvim-kickstart/lazy/lazy.nvim/lua/lazy/core/handler/keys.lua:121>
|
||||||
```
|
```
|
||||||
|
|
||||||
- Generated on Sun 30 Jun 2024 14:16:28 EEST
|
- Generated on Sat 10 Aug 2024 13:01:59 EEST
|
||||||
|
|||||||
@@ -79,4 +79,3 @@ Leader: `<ctrl><space>`
|
|||||||
S-Left Move the visible part of the window left
|
S-Left Move the visible part of the window left
|
||||||
S-Right Move the visible part of the window right
|
S-Right Move the visible part of the window right
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
280
docs/wezterm-keybindings.md
Normal file
280
docs/wezterm-keybindings.md
Normal file
@@ -0,0 +1,280 @@
|
|||||||
|
# wezterm keybindings
|
||||||
|
|
||||||
|
```txt
|
||||||
|
Default key table
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
CTRL Tab -> ActivateTabRelative(1)
|
||||||
|
SHIFT | CTRL Tab -> ActivateTabRelative(-1)
|
||||||
|
ALT Enter -> ToggleFullScreen
|
||||||
|
CTRL ! -> ActivateTab(0)
|
||||||
|
SHIFT | CTRL ! -> ActivateTab(0)
|
||||||
|
ALT | CTRL " -> SplitVertical(SpawnCommand domain=CurrentPaneDomain)
|
||||||
|
SHIFT | ALT | CTRL " -> SplitVertical(SpawnCommand domain=CurrentPaneDomain)
|
||||||
|
CTRL # -> ActivateTab(2)
|
||||||
|
SHIFT | CTRL # -> ActivateTab(2)
|
||||||
|
CTRL $ -> ActivateTab(3)
|
||||||
|
SHIFT | CTRL $ -> ActivateTab(3)
|
||||||
|
CTRL % -> ActivateTab(4)
|
||||||
|
SHIFT | CTRL % -> ActivateTab(4)
|
||||||
|
ALT | CTRL % -> SplitHorizontal(SpawnCommand domain=CurrentPaneDomain)
|
||||||
|
SHIFT | ALT | CTRL % -> SplitHorizontal(SpawnCommand domain=CurrentPaneDomain)
|
||||||
|
CTRL & -> ActivateTab(6)
|
||||||
|
SHIFT | CTRL & -> ActivateTab(6)
|
||||||
|
SHIFT | ALT | CTRL ' -> SplitVertical(SpawnCommand domain=CurrentPaneDomain)
|
||||||
|
CTRL ( -> ActivateTab(-1)
|
||||||
|
SHIFT | CTRL ( -> ActivateTab(-1)
|
||||||
|
CTRL ) -> ResetFontSize
|
||||||
|
SHIFT | CTRL ) -> ResetFontSize
|
||||||
|
CTRL * -> ActivateTab(7)
|
||||||
|
SHIFT | CTRL * -> ActivateTab(7)
|
||||||
|
CTRL + -> IncreaseFontSize
|
||||||
|
SHIFT | CTRL + -> IncreaseFontSize
|
||||||
|
CTRL - -> DecreaseFontSize
|
||||||
|
SHIFT | CTRL - -> DecreaseFontSize
|
||||||
|
SUPER - -> DecreaseFontSize
|
||||||
|
CTRL 0 -> ResetFontSize
|
||||||
|
SHIFT | CTRL 0 -> ResetFontSize
|
||||||
|
SUPER 0 -> ResetFontSize
|
||||||
|
SHIFT | CTRL 1 -> ActivateTab(0)
|
||||||
|
SUPER 1 -> ActivateTab(0)
|
||||||
|
SHIFT | CTRL 2 -> ActivateTab(1)
|
||||||
|
SUPER 2 -> ActivateTab(1)
|
||||||
|
SHIFT | CTRL 3 -> ActivateTab(2)
|
||||||
|
SUPER 3 -> ActivateTab(2)
|
||||||
|
SHIFT | CTRL 4 -> ActivateTab(3)
|
||||||
|
SUPER 4 -> ActivateTab(3)
|
||||||
|
SHIFT | CTRL 5 -> ActivateTab(4)
|
||||||
|
SHIFT | ALT | CTRL 5 -> SplitHorizontal(SpawnCommand domain=CurrentPaneDomain)
|
||||||
|
SUPER 5 -> ActivateTab(4)
|
||||||
|
SHIFT | CTRL 6 -> ActivateTab(5)
|
||||||
|
SUPER 6 -> ActivateTab(5)
|
||||||
|
SHIFT | CTRL 7 -> ActivateTab(6)
|
||||||
|
SUPER 7 -> ActivateTab(6)
|
||||||
|
SHIFT | CTRL 8 -> ActivateTab(7)
|
||||||
|
SUPER 8 -> ActivateTab(7)
|
||||||
|
SHIFT | CTRL 9 -> ActivateTab(-1)
|
||||||
|
SUPER 9 -> ActivateTab(-1)
|
||||||
|
CTRL = -> IncreaseFontSize
|
||||||
|
SHIFT | CTRL = -> IncreaseFontSize
|
||||||
|
SUPER = -> IncreaseFontSize
|
||||||
|
CTRL @ -> ActivateTab(1)
|
||||||
|
SHIFT | CTRL @ -> ActivateTab(1)
|
||||||
|
CTRL C -> CopyTo(Clipboard)
|
||||||
|
SHIFT | CTRL C -> CopyTo(Clipboard)
|
||||||
|
CTRL F -> Search(CurrentSelectionOrEmptyString)
|
||||||
|
SHIFT | CTRL F -> Search(CurrentSelectionOrEmptyString)
|
||||||
|
CTRL H -> HideApplication
|
||||||
|
SHIFT | CTRL H -> HideApplication
|
||||||
|
CTRL K -> ClearScrollback(ScrollbackOnly)
|
||||||
|
SHIFT | CTRL K -> ClearScrollback(ScrollbackOnly)
|
||||||
|
CTRL L -> ShowDebugOverlay
|
||||||
|
SHIFT | CTRL L -> ShowDebugOverlay
|
||||||
|
CTRL M -> Hide
|
||||||
|
SHIFT | CTRL M -> Hide
|
||||||
|
CTRL N -> SpawnWindow
|
||||||
|
SHIFT | CTRL N -> SpawnWindow
|
||||||
|
CTRL P -> ActivateCommandPalette
|
||||||
|
SHIFT | CTRL P -> ActivateCommandPalette
|
||||||
|
CTRL Q -> QuitApplication
|
||||||
|
SHIFT | CTRL Q -> QuitApplication
|
||||||
|
CTRL R -> ReloadConfiguration
|
||||||
|
SHIFT | CTRL R -> ReloadConfiguration
|
||||||
|
CTRL T -> SpawnTab(CurrentPaneDomain)
|
||||||
|
SHIFT | CTRL T -> SpawnTab(CurrentPaneDomain)
|
||||||
|
CTRL U -> CharSelect(CharSelectArguments { group: None, copy_on_select: true, copy_to: ClipboardAndPrimarySelection })
|
||||||
|
SHIFT | CTRL U -> CharSelect(CharSelectArguments { group: None, copy_on_select: true, copy_to: ClipboardAndPrimarySelection })
|
||||||
|
CTRL V -> PasteFrom(Clipboard)
|
||||||
|
SHIFT | CTRL V -> PasteFrom(Clipboard)
|
||||||
|
CTRL W -> CloseCurrentTab { confirm: true }
|
||||||
|
SHIFT | CTRL W -> CloseCurrentTab { confirm: true }
|
||||||
|
CTRL X -> ActivateCopyMode
|
||||||
|
SHIFT | CTRL X -> ActivateCopyMode
|
||||||
|
CTRL Z -> TogglePaneZoomState
|
||||||
|
SHIFT | CTRL Z -> TogglePaneZoomState
|
||||||
|
SHIFT | SUPER [ -> ActivateTabRelative(-1)
|
||||||
|
SHIFT | SUPER ] -> ActivateTabRelative(1)
|
||||||
|
CTRL ^ -> ActivateTab(5)
|
||||||
|
SHIFT | CTRL ^ -> ActivateTab(5)
|
||||||
|
CTRL _ -> DecreaseFontSize
|
||||||
|
SHIFT | CTRL _ -> DecreaseFontSize
|
||||||
|
SHIFT | CTRL c -> CopyTo(Clipboard)
|
||||||
|
SUPER c -> CopyTo(Clipboard)
|
||||||
|
SHIFT | CTRL f -> Search(CurrentSelectionOrEmptyString)
|
||||||
|
SUPER f -> Search(CurrentSelectionOrEmptyString)
|
||||||
|
SHIFT | CTRL h -> HideApplication
|
||||||
|
SUPER h -> HideApplication
|
||||||
|
SHIFT | CTRL k -> ClearScrollback(ScrollbackOnly)
|
||||||
|
SUPER k -> ClearScrollback(ScrollbackOnly)
|
||||||
|
SHIFT | CTRL l -> ShowDebugOverlay
|
||||||
|
SHIFT | CTRL m -> Hide
|
||||||
|
SUPER m -> Hide
|
||||||
|
SHIFT | CTRL n -> SpawnWindow
|
||||||
|
SUPER n -> SpawnWindow
|
||||||
|
SHIFT | CTRL p -> ActivateCommandPalette
|
||||||
|
SHIFT | CTRL q -> QuitApplication
|
||||||
|
SUPER q -> QuitApplication
|
||||||
|
SHIFT | CTRL r -> ReloadConfiguration
|
||||||
|
SUPER r -> ReloadConfiguration
|
||||||
|
SHIFT | CTRL t -> SpawnTab(CurrentPaneDomain)
|
||||||
|
SUPER t -> SpawnTab(CurrentPaneDomain)
|
||||||
|
SHIFT | CTRL u -> CharSelect(CharSelectArguments { group: None, copy_on_select: true, copy_to: ClipboardAndPrimarySelection })
|
||||||
|
SHIFT | CTRL v -> PasteFrom(Clipboard)
|
||||||
|
SUPER v -> PasteFrom(Clipboard)
|
||||||
|
SHIFT | CTRL w -> CloseCurrentTab { confirm: true }
|
||||||
|
SUPER w -> CloseCurrentTab { confirm: true }
|
||||||
|
SHIFT | CTRL x -> ActivateCopyMode
|
||||||
|
SHIFT | CTRL z -> TogglePaneZoomState
|
||||||
|
SUPER { -> ActivateTabRelative(-1)
|
||||||
|
SHIFT | SUPER { -> ActivateTabRelative(-1)
|
||||||
|
SUPER } -> ActivateTabRelative(1)
|
||||||
|
SHIFT | SUPER } -> ActivateTabRelative(1)
|
||||||
|
SHIFT | CTRL Space (Physical) -> QuickSelect
|
||||||
|
SHIFT PageUp -> ScrollByPage(NotNan(-1.0))
|
||||||
|
CTRL PageUp -> ActivateTabRelative(-1)
|
||||||
|
SHIFT | CTRL PageUp -> MoveTabRelative(-1)
|
||||||
|
SHIFT PageDown -> ScrollByPage(NotNan(1.0))
|
||||||
|
CTRL PageDown -> ActivateTabRelative(1)
|
||||||
|
SHIFT | CTRL PageDown -> MoveTabRelative(1)
|
||||||
|
SHIFT | CTRL LeftArrow -> ActivatePaneDirection(Left)
|
||||||
|
SHIFT | ALT | CTRL LeftArrow -> AdjustPaneSize(Left, 1)
|
||||||
|
SHIFT | CTRL RightArrow -> ActivatePaneDirection(Right)
|
||||||
|
SHIFT | ALT | CTRL RightArrow -> AdjustPaneSize(Right, 1)
|
||||||
|
SHIFT | CTRL UpArrow -> ActivatePaneDirection(Up)
|
||||||
|
SHIFT | ALT | CTRL UpArrow -> AdjustPaneSize(Up, 1)
|
||||||
|
SHIFT | CTRL DownArrow -> ActivatePaneDirection(Down)
|
||||||
|
SHIFT | ALT | CTRL DownArrow -> AdjustPaneSize(Down, 1)
|
||||||
|
Copy -> CopyTo(Clipboard)
|
||||||
|
Paste -> PasteFrom(Clipboard)
|
||||||
|
|
||||||
|
Key Table: copy_mode
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Tab -> CopyMode(MoveForwardWord)
|
||||||
|
SHIFT Tab -> CopyMode(MoveBackwardWord)
|
||||||
|
Enter -> CopyMode(MoveToStartOfNextLine)
|
||||||
|
Escape -> CopyMode(Close)
|
||||||
|
Space -> CopyMode(SetSelectionMode(Some(Cell)))
|
||||||
|
$ -> CopyMode(MoveToEndOfLineContent)
|
||||||
|
SHIFT $ -> CopyMode(MoveToEndOfLineContent)
|
||||||
|
, -> CopyMode(JumpReverse)
|
||||||
|
0 -> CopyMode(MoveToStartOfLine)
|
||||||
|
; -> CopyMode(JumpAgain)
|
||||||
|
F -> CopyMode(JumpBackward { prev_char: false })
|
||||||
|
SHIFT F -> CopyMode(JumpBackward { prev_char: false })
|
||||||
|
G -> CopyMode(MoveToScrollbackBottom)
|
||||||
|
SHIFT G -> CopyMode(MoveToScrollbackBottom)
|
||||||
|
H -> CopyMode(MoveToViewportTop)
|
||||||
|
SHIFT H -> CopyMode(MoveToViewportTop)
|
||||||
|
L -> CopyMode(MoveToViewportBottom)
|
||||||
|
SHIFT L -> CopyMode(MoveToViewportBottom)
|
||||||
|
M -> CopyMode(MoveToViewportMiddle)
|
||||||
|
SHIFT M -> CopyMode(MoveToViewportMiddle)
|
||||||
|
O -> CopyMode(MoveToSelectionOtherEndHoriz)
|
||||||
|
SHIFT O -> CopyMode(MoveToSelectionOtherEndHoriz)
|
||||||
|
T -> CopyMode(JumpBackward { prev_char: true })
|
||||||
|
SHIFT T -> CopyMode(JumpBackward { prev_char: true })
|
||||||
|
V -> CopyMode(SetSelectionMode(Some(Line)))
|
||||||
|
SHIFT V -> CopyMode(SetSelectionMode(Some(Line)))
|
||||||
|
^ -> CopyMode(MoveToStartOfLineContent)
|
||||||
|
SHIFT ^ -> CopyMode(MoveToStartOfLineContent)
|
||||||
|
b -> CopyMode(MoveBackwardWord)
|
||||||
|
ALT b -> CopyMode(MoveBackwardWord)
|
||||||
|
CTRL b -> CopyMode(PageUp)
|
||||||
|
CTRL c -> CopyMode(Close)
|
||||||
|
CTRL d -> CopyMode(MoveByPage(NotNan(0.5)))
|
||||||
|
e -> CopyMode(MoveForwardWordEnd)
|
||||||
|
f -> CopyMode(JumpForward { prev_char: false })
|
||||||
|
ALT f -> CopyMode(MoveForwardWord)
|
||||||
|
CTRL f -> CopyMode(PageDown)
|
||||||
|
g -> CopyMode(MoveToScrollbackTop)
|
||||||
|
CTRL g -> CopyMode(Close)
|
||||||
|
h -> CopyMode(MoveLeft)
|
||||||
|
j -> CopyMode(MoveDown)
|
||||||
|
k -> CopyMode(MoveUp)
|
||||||
|
l -> CopyMode(MoveRight)
|
||||||
|
ALT m -> CopyMode(MoveToStartOfLineContent)
|
||||||
|
o -> CopyMode(MoveToSelectionOtherEnd)
|
||||||
|
q -> CopyMode(Close)
|
||||||
|
t -> CopyMode(JumpForward { prev_char: true })
|
||||||
|
CTRL u -> CopyMode(MoveByPage(NotNan(-0.5)))
|
||||||
|
v -> CopyMode(SetSelectionMode(Some(Cell)))
|
||||||
|
CTRL v -> CopyMode(SetSelectionMode(Some(Block)))
|
||||||
|
w -> CopyMode(MoveForwardWord)
|
||||||
|
y -> Multiple([CopyTo(ClipboardAndPrimarySelection), CopyMode(Close)])
|
||||||
|
PageUp -> CopyMode(PageUp)
|
||||||
|
PageDown -> CopyMode(PageDown)
|
||||||
|
End -> CopyMode(MoveToEndOfLineContent)
|
||||||
|
Home -> CopyMode(MoveToStartOfLine)
|
||||||
|
LeftArrow -> CopyMode(MoveLeft)
|
||||||
|
ALT LeftArrow -> CopyMode(MoveBackwardWord)
|
||||||
|
RightArrow -> CopyMode(MoveRight)
|
||||||
|
ALT RightArrow -> CopyMode(MoveForwardWord)
|
||||||
|
UpArrow -> CopyMode(MoveUp)
|
||||||
|
DownArrow -> CopyMode(MoveDown)
|
||||||
|
|
||||||
|
Key Table: search_mode
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
Enter -> CopyMode(PriorMatch)
|
||||||
|
Escape -> CopyMode(Close)
|
||||||
|
CTRL n -> CopyMode(NextMatch)
|
||||||
|
CTRL p -> CopyMode(PriorMatch)
|
||||||
|
CTRL r -> CopyMode(CycleMatchType)
|
||||||
|
CTRL u -> CopyMode(ClearPattern)
|
||||||
|
PageUp -> CopyMode(PriorMatchPage)
|
||||||
|
PageDown -> CopyMode(NextMatchPage)
|
||||||
|
UpArrow -> CopyMode(PriorMatch)
|
||||||
|
DownArrow -> CopyMode(NextMatch)
|
||||||
|
|
||||||
|
Mouse
|
||||||
|
-----
|
||||||
|
|
||||||
|
Down { streak: 1, button: Left } -> SelectTextAtMouseCursor(Cell)
|
||||||
|
SHIFT Down { streak: 1, button: Left } -> ExtendSelectionToMouseCursor(Cell)
|
||||||
|
ALT Down { streak: 1, button: Left } -> SelectTextAtMouseCursor(Block)
|
||||||
|
SHIFT | ALT Down { streak: 1, button: Left } -> ExtendSelectionToMouseCursor(Block)
|
||||||
|
Down { streak: 1, button: Middle } -> PasteFrom(PrimarySelection)
|
||||||
|
Down { streak: 1, button: WheelUp(1) } -> ScrollByCurrentEventWheelDelta
|
||||||
|
Down { streak: 1, button: WheelDown(1) } -> ScrollByCurrentEventWheelDelta
|
||||||
|
Down { streak: 2, button: Left } -> SelectTextAtMouseCursor(Word)
|
||||||
|
Down { streak: 3, button: Left } -> SelectTextAtMouseCursor(Line)
|
||||||
|
Drag { streak: 1, button: Left } -> ExtendSelectionToMouseCursor(Cell)
|
||||||
|
ALT Drag { streak: 1, button: Left } -> ExtendSelectionToMouseCursor(Block)
|
||||||
|
SHIFT | CTRL Drag { streak: 1, button: Left } -> StartWindowDrag
|
||||||
|
SUPER Drag { streak: 1, button: Left } -> StartWindowDrag
|
||||||
|
Drag { streak: 2, button: Left } -> ExtendSelectionToMouseCursor(Word)
|
||||||
|
Drag { streak: 3, button: Left } -> ExtendSelectionToMouseCursor(Line)
|
||||||
|
Up { streak: 1, button: Left } -> CompleteSelectionOrOpenLinkAtMouseCursor(ClipboardAndPrimarySelection)
|
||||||
|
SHIFT Up { streak: 1, button: Left } -> CompleteSelectionOrOpenLinkAtMouseCursor(ClipboardAndPrimarySelection)
|
||||||
|
ALT Up { streak: 1, button: Left } -> CompleteSelection(ClipboardAndPrimarySelection)
|
||||||
|
SHIFT | ALT Up { streak: 1, button: Left } -> CompleteSelectionOrOpenLinkAtMouseCursor(PrimarySelection)
|
||||||
|
Up { streak: 2, button: Left } -> CompleteSelection(ClipboardAndPrimarySelection)
|
||||||
|
Up { streak: 3, button: Left } -> CompleteSelection(ClipboardAndPrimarySelection)
|
||||||
|
|
||||||
|
Mouse: alt_screen
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
Down { streak: 1, button: Left } -> SelectTextAtMouseCursor(Cell)
|
||||||
|
SHIFT Down { streak: 1, button: Left } -> ExtendSelectionToMouseCursor(Cell)
|
||||||
|
ALT Down { streak: 1, button: Left } -> SelectTextAtMouseCursor(Block)
|
||||||
|
SHIFT | ALT Down { streak: 1, button: Left } -> ExtendSelectionToMouseCursor(Block)
|
||||||
|
Down { streak: 1, button: Middle } -> PasteFrom(PrimarySelection)
|
||||||
|
Down { streak: 2, button: Left } -> SelectTextAtMouseCursor(Word)
|
||||||
|
Down { streak: 3, button: Left } -> SelectTextAtMouseCursor(Line)
|
||||||
|
Drag { streak: 1, button: Left } -> ExtendSelectionToMouseCursor(Cell)
|
||||||
|
ALT Drag { streak: 1, button: Left } -> ExtendSelectionToMouseCursor(Block)
|
||||||
|
SHIFT | CTRL Drag { streak: 1, button: Left } -> StartWindowDrag
|
||||||
|
SUPER Drag { streak: 1, button: Left } -> StartWindowDrag
|
||||||
|
Drag { streak: 2, button: Left } -> ExtendSelectionToMouseCursor(Word)
|
||||||
|
Drag { streak: 3, button: Left } -> ExtendSelectionToMouseCursor(Line)
|
||||||
|
Up { streak: 1, button: Left } -> CompleteSelectionOrOpenLinkAtMouseCursor(ClipboardAndPrimarySelection)
|
||||||
|
SHIFT Up { streak: 1, button: Left } -> CompleteSelectionOrOpenLinkAtMouseCursor(ClipboardAndPrimarySelection)
|
||||||
|
ALT Up { streak: 1, button: Left } -> CompleteSelection(ClipboardAndPrimarySelection)
|
||||||
|
SHIFT | ALT Up { streak: 1, button: Left } -> CompleteSelectionOrOpenLinkAtMouseCursor(PrimarySelection)
|
||||||
|
Up { streak: 2, button: Left } -> CompleteSelection(ClipboardAndPrimarySelection)
|
||||||
|
Up { streak: 3, button: Left } -> CompleteSelection(ClipboardAndPrimarySelection)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
- Generated on Sat 10 Aug 2024 13:01:59 EEST
|
||||||
BIN
hosts/air/config/wallpaper.jpg
Normal file
BIN
hosts/air/config/wallpaper.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
@@ -16,6 +16,8 @@
|
|||||||
~/.local/bin:
|
~/.local/bin:
|
||||||
~/.local/run:
|
~/.local/run:
|
||||||
~/.local/share:
|
~/.local/share:
|
||||||
|
~/.local/share/gnupg:
|
||||||
|
mode: 0700
|
||||||
~/.local/state:
|
~/.local/state:
|
||||||
~/.ssh:
|
~/.ssh:
|
||||||
mode: 0700
|
mode: 0700
|
||||||
|
|||||||
1
local/bin/asdf
Submodule
1
local/bin/asdf
Submodule
Submodule local/bin/asdf added at f00f759f3d
125
local/bin/dfm
125
local/bin/dfm
@@ -14,19 +14,92 @@
|
|||||||
|
|
||||||
SCRIPT=$(basename "$0")
|
SCRIPT=$(basename "$0")
|
||||||
|
|
||||||
|
if ! declare -f msg > /dev/null; then
|
||||||
|
# Function to print messages if VERBOSE is enabled
|
||||||
|
# $1 - message (string)
|
||||||
|
msg()
|
||||||
|
{
|
||||||
|
[ "$VERBOSE" -eq 1 ] && echo "$1"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! declare -f msg_err > /dev/null; then
|
||||||
|
# Function to print error messages and exit
|
||||||
|
# $1 - error message (string)
|
||||||
|
msg_err()
|
||||||
|
{
|
||||||
|
echo "(!) ERROR: $1" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! declare -f msg_done > /dev/null; then
|
||||||
|
# Function to print done message
|
||||||
|
# $1 - message (string)
|
||||||
|
msg_done()
|
||||||
|
{
|
||||||
|
echo "✓ $1"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
VERSION_NVM="v0.39.5"
|
VERSION_NVM="v0.39.5"
|
||||||
|
|
||||||
export DOTFILES="$HOME/.dotfiles"
|
|
||||||
# shellcheck source=./../../scripts/shared.sh
|
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
|
||||||
source "$DOTFILES/config/exports"
|
|
||||||
source "$DOTFILES/config/alias"
|
|
||||||
source "$DOTFILES/config/functions"
|
|
||||||
|
|
||||||
# Loads configs for better installation experience
|
# Loads configs for better installation experience
|
||||||
x-load-configs
|
source "$DOTFILES/config/shared.sh"
|
||||||
|
|
||||||
function section_install
|
source "${DOTFILES}/local/bin/msgr"
|
||||||
|
|
||||||
|
# -- Menu builder -- #
|
||||||
|
menu_section()
|
||||||
|
{
|
||||||
|
LINE=$(printf '%-18s [ %-15s ]\n' "$1" "$2")
|
||||||
|
echo -e " $(__log_marker) $LINE"
|
||||||
|
}
|
||||||
|
menu_item()
|
||||||
|
{
|
||||||
|
LINE=$(printf '%-15s %-30s\n' "$1" "$2")
|
||||||
|
echo -e "$(__log_indent)$(__log_marker) $LINE"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Takes a bash array ("cow:moo", "dinosaur:roar") and loops
|
||||||
|
# through the keys to build menu section listing.
|
||||||
|
menu_usage_header()
|
||||||
|
{
|
||||||
|
MENU_CMD="$1"
|
||||||
|
shift
|
||||||
|
MENU_ARRAY=("$@")
|
||||||
|
|
||||||
|
KEYS=""
|
||||||
|
for item in "${MENU_ARRAY[@]}"; do
|
||||||
|
CMD=$(echo "${item}" | awk -F ":" '{print $1}')
|
||||||
|
KEYS+="${CMD} | "
|
||||||
|
done
|
||||||
|
|
||||||
|
# "???" removes 3 last characters, being " | " from the end
|
||||||
|
menu_section "$MENU_CMD" "${KEYS%???}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Takes the usage command "$0 dotfiles" and a
|
||||||
|
# bash array ("cow:moo" "dinosaur:roar") and loops
|
||||||
|
# through in building a menu for dfm command usage listing.
|
||||||
|
menu_usage()
|
||||||
|
{
|
||||||
|
MENU_CMD="$1"
|
||||||
|
shift
|
||||||
|
MENU_ARRAY=("$@")
|
||||||
|
|
||||||
|
msg "$MENU_CMD"
|
||||||
|
|
||||||
|
for item in "${MENU_ARRAY[@]}"; do
|
||||||
|
CMD=$(echo "${item}" | awk -F ":" '{print $1}')
|
||||||
|
DESC=$(echo "${item}" | awk -F ":" '{print $2}')
|
||||||
|
menu_item "$CMD" "$DESC"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
section_install()
|
||||||
{
|
{
|
||||||
USAGE_PREFIX="$SCRIPT install <command>"
|
USAGE_PREFIX="$SCRIPT install <command>"
|
||||||
|
|
||||||
@@ -56,7 +129,6 @@ function section_install
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
all)
|
all)
|
||||||
msgr msg "Starting to install all and reloading configurations..."
|
msgr msg "Starting to install all and reloading configurations..."
|
||||||
x-load-configs
|
|
||||||
$0 install macos
|
$0 install macos
|
||||||
$0 install fonts
|
$0 install fonts
|
||||||
$0 install antigen
|
$0 install antigen
|
||||||
@@ -65,12 +137,12 @@ function section_install
|
|||||||
$0 install asdf
|
$0 install asdf
|
||||||
# $0 install ohmybash
|
# $0 install ohmybash
|
||||||
# $0 install pip
|
# $0 install pip
|
||||||
$0 install cargo
|
# $0 install cargo
|
||||||
$0 install composer
|
$0 install composer
|
||||||
# $0 install dotenv
|
# $0 install dotenv
|
||||||
$0 install fzf
|
$0 install fzf
|
||||||
# $0 install gh
|
# $0 install gh
|
||||||
$0 install go
|
# $0 install go
|
||||||
$0 install cheat-databases
|
$0 install cheat-databases
|
||||||
$0 install imagick
|
$0 install imagick
|
||||||
# $0 install neofetch
|
# $0 install neofetch
|
||||||
@@ -79,7 +151,7 @@ function section_install
|
|||||||
$0 install ntfy
|
$0 install ntfy
|
||||||
$0 install z
|
$0 install z
|
||||||
msgr msg "Reloading configurations again..."
|
msgr msg "Reloading configurations again..."
|
||||||
x-load-configs
|
source "$DOTFILES/config/shared.sh"
|
||||||
msgr yay "All done!"
|
msgr yay "All done!"
|
||||||
;;
|
;;
|
||||||
antigen)
|
antigen)
|
||||||
@@ -210,7 +282,7 @@ function section_install
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
function section_brew
|
section_brew()
|
||||||
{
|
{
|
||||||
USAGE_PREFIX="$SCRIPT brew <command>"
|
USAGE_PREFIX="$SCRIPT brew <command>"
|
||||||
|
|
||||||
@@ -258,7 +330,7 @@ function section_brew
|
|||||||
! x-have brew && menu_section "$USAGE_PREFIX" "brew not available on this system"
|
! x-have brew && menu_section "$USAGE_PREFIX" "brew not available on this system"
|
||||||
}
|
}
|
||||||
|
|
||||||
function section_helpers
|
section_helpers()
|
||||||
{
|
{
|
||||||
USAGE_PREFIX="$SCRIPT helpers <command>"
|
USAGE_PREFIX="$SCRIPT helpers <command>"
|
||||||
MENU=(
|
MENU=(
|
||||||
@@ -274,21 +346,31 @@ function section_helpers
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
function section_docs
|
section_docs()
|
||||||
{
|
{
|
||||||
USAGE_PREFIX="$SCRIPT docs <command>"
|
USAGE_PREFIX="$SCRIPT docs <command>"
|
||||||
|
|
||||||
MENU=(
|
MENU=(
|
||||||
|
"all:Update all keybindings documentations"
|
||||||
"tmux:Update tmux keybindings documentation"
|
"tmux:Update tmux keybindings documentation"
|
||||||
|
"nvim:Update nvim keybindings documentation"
|
||||||
|
"wezterm:Update wezterm keybindings documentation"
|
||||||
)
|
)
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
all)
|
||||||
|
$0 docs tmux
|
||||||
|
$0 docs nvim
|
||||||
|
$0 docs wezterm
|
||||||
|
;;
|
||||||
tmux) bash "$DOTFILES/local/bin/x-dfm-docs-xterm-keybindings" ;;
|
tmux) bash "$DOTFILES/local/bin/x-dfm-docs-xterm-keybindings" ;;
|
||||||
|
nvim) bash "$DOTFILES/scripts/create-nvim-keymaps.sh" ;;
|
||||||
|
wezterm) bash "$DOTFILES/scripts/create-wezterm-keymaps.sh" ;;
|
||||||
*) menu_usage "$USAGE_PREFIX" "${MENU[@]}" ;;
|
*) menu_usage "$USAGE_PREFIX" "${MENU[@]}" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
function section_dotfiles
|
section_dotfiles()
|
||||||
{
|
{
|
||||||
USAGE_PREFIX="$SCRIPT dotfiles <command>"
|
USAGE_PREFIX="$SCRIPT dotfiles <command>"
|
||||||
|
|
||||||
@@ -330,6 +412,9 @@ function section_dotfiles
|
|||||||
! x-have yamlfmt && msg_err "yamlfmt not found"
|
! x-have yamlfmt && msg_err "yamlfmt not found"
|
||||||
;;
|
;;
|
||||||
shfmt)
|
shfmt)
|
||||||
|
# If system doesn't have fd or shfmt installed, exit
|
||||||
|
! x-have fd && msg_err "fd not found, install with asdf"
|
||||||
|
! x-have shfmt && msg_err "shfmt not found, install with asdf"
|
||||||
# Format shell scripts according to following rules.
|
# Format shell scripts according to following rules.
|
||||||
fd --full-path "$DOTFILES" -tx \
|
fd --full-path "$DOTFILES" -tx \
|
||||||
-E '*.pl' -E '*.php' -E '*.py' -E '*.zsh' -E 'plugins' -E 'fzf' -E 'dotbot' \
|
-E '*.pl' -E '*.php' -E '*.py' -E '*.zsh' -E 'plugins' -E 'fzf' -E 'dotbot' \
|
||||||
@@ -344,7 +429,7 @@ function section_dotfiles
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
function section_check
|
section_check()
|
||||||
{
|
{
|
||||||
USAGE_PREFIX="$SCRIPT check <command>"
|
USAGE_PREFIX="$SCRIPT check <command>"
|
||||||
X_HOSTNAME=$(hostname)
|
X_HOSTNAME=$(hostname)
|
||||||
@@ -369,7 +454,7 @@ function section_check
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Secret menu for visual tests
|
# Secret menu for visual tests
|
||||||
function section_tests
|
section_tests()
|
||||||
{
|
{
|
||||||
USAGE_PREFIX="$SCRIPT tests <command>"
|
USAGE_PREFIX="$SCRIPT tests <command>"
|
||||||
|
|
||||||
@@ -398,7 +483,7 @@ function section_tests
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
function usage
|
usage()
|
||||||
{
|
{
|
||||||
echo ""
|
echo ""
|
||||||
msg_prompt "Usage: $SCRIPT <section> <command>"
|
msg_prompt "Usage: $SCRIPT <section> <command>"
|
||||||
|
|||||||
@@ -19,20 +19,28 @@
|
|||||||
# Default dir to check, can be overridden in env (.bashrc, .zshrc, ...)
|
# Default dir to check, can be overridden in env (.bashrc, .zshrc, ...)
|
||||||
: "${GIT_DIRTY_DIR:=$HOME/Code}"
|
: "${GIT_DIRTY_DIR:=$HOME/Code}"
|
||||||
|
|
||||||
# If user has provided folder as a first argument, use it.
|
# Enable verbosity with VERBOSE=1
|
||||||
if [ "$1" != "" ]; then
|
VERBOSE="${VERBOSE:-0}"
|
||||||
GIT_DIRTY_DIR="$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# UTF-8 ftw
|
# UTF-8 ftw
|
||||||
GITDIRTY="❌ "
|
GITDIRTY="❌ "
|
||||||
GITCLEAN="✅ "
|
GITCLEAN="✅ "
|
||||||
|
|
||||||
|
# Function to print messages if VERBOSE is enabled
|
||||||
|
# $1 - message (string)
|
||||||
|
msg()
|
||||||
|
{
|
||||||
|
[ "$VERBOSE" -eq 1 ] && echo "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to handle errors
|
||||||
catch()
|
catch()
|
||||||
{
|
{
|
||||||
echo "Error $1 occurred on $2"
|
echo "Error $1 occurred on $2"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to check the git status of a directory
|
||||||
|
# $1 - directory (string)
|
||||||
gitdirty()
|
gitdirty()
|
||||||
{
|
{
|
||||||
local d="$1"
|
local d="$1"
|
||||||
@@ -40,13 +48,13 @@ gitdirty()
|
|||||||
|
|
||||||
if [[ -d "$d" ]]; then
|
if [[ -d "$d" ]]; then
|
||||||
if [[ -e "$d/.ignore" ]]; then
|
if [[ -e "$d/.ignore" ]]; then
|
||||||
echo -e ""
|
msg "Skipping ignored directory: $d"
|
||||||
else
|
else
|
||||||
# Check that $d is not '--', 'vendor', or 'node_modules'
|
# Check that $d is not '--', 'vendor', or 'node_modules'
|
||||||
if [[ "${d:0:2}" == "--" ]] || [[ "$d" == "vendor" ]] || [[ "$d" == "node_modules" ]]; then
|
if [[ "${d:0:2}" == "--" ]] || [[ "$d" == "vendor" ]] || [[ "$d" == "node_modules" ]]; then
|
||||||
echo ""
|
msg "Skipping excluded directory: $d"
|
||||||
else
|
else
|
||||||
cd "$d"
|
cd "$d" || exit
|
||||||
|
|
||||||
# If we have `.git` folder, check it.
|
# If we have `.git` folder, check it.
|
||||||
if [[ -d ".git" ]]; then
|
if [[ -d ".git" ]]; then
|
||||||
@@ -60,12 +68,14 @@ gitdirty()
|
|||||||
# If it wasn't git repository, check subdirectories.
|
# If it wasn't git repository, check subdirectories.
|
||||||
gitdirtyrepos ./*
|
gitdirtyrepos ./*
|
||||||
fi
|
fi
|
||||||
|
cd - > /dev/null || exit
|
||||||
fi
|
fi
|
||||||
cd .. > /dev/null
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to check git status for multiple directories
|
||||||
|
# $@ - directories
|
||||||
gitdirtyrepos()
|
gitdirtyrepos()
|
||||||
{
|
{
|
||||||
for x in "$@"; do
|
for x in "$@"; do
|
||||||
@@ -73,10 +83,20 @@ gitdirtyrepos()
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
set -e
|
# Main function
|
||||||
trap 'case $? in
|
main()
|
||||||
139) echo "segfault occurred";;
|
{
|
||||||
11) echo "ssegfault occurred";;
|
# If user has provided folder as a first argument, use it.
|
||||||
esac' EXIT
|
if [ "${1:-}" != "" ]; then
|
||||||
|
GIT_DIRTY_DIR="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
gitdirtyrepos "$GIT_DIRTY_DIR"
|
trap 'case $? in
|
||||||
|
139) echo "segfault occurred";;
|
||||||
|
11) echo "segfault occurred";;
|
||||||
|
esac' EXIT
|
||||||
|
|
||||||
|
gitdirtyrepos "$GIT_DIRTY_DIR"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -6,18 +6,46 @@
|
|||||||
# Copyright 2023 Ismo Vuorinen. All Rights Reserved.
|
# Copyright 2023 Ismo Vuorinen. All Rights Reserved.
|
||||||
# License: MIT <https://opensource.org/license/mit/>
|
# License: MIT <https://opensource.org/license/mit/>
|
||||||
|
|
||||||
STARTING_PATH=${1:-$(pwd)}
|
set -euo pipefail
|
||||||
|
|
||||||
DIRS=$(find "$STARTING_PATH" -mindepth 1 -maxdepth 1 -type d)
|
# Enable verbosity with VERBOSE=1
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
for DIR in $DIRS; do
|
# Function to print messages if VERBOSE is enabled
|
||||||
echo "-> Processing dir: $DIR"
|
# $1 - message (string)
|
||||||
cd "$DIR" || exit 1
|
msg()
|
||||||
if [ -d "$DIR/.git" ]; then
|
{
|
||||||
git fsck --no-dangling --full --no-progress
|
[ "$VERBOSE" -eq 1 ] && echo "$1"
|
||||||
echo ""
|
}
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo ""
|
# Function to perform git fsck on a repository
|
||||||
echo "Done."
|
# $1 - directory (string)
|
||||||
|
fsck_repo()
|
||||||
|
{
|
||||||
|
local dir=$1
|
||||||
|
msg "Processing dir: $dir"
|
||||||
|
(
|
||||||
|
cd "$dir" || exit 1
|
||||||
|
if [ -d ".git" ]; then
|
||||||
|
git fsck --no-dangling --full --no-progress
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main function
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
local starting_path=${1:-$(pwd)}
|
||||||
|
local dirs
|
||||||
|
dirs=$(find "$starting_path" -mindepth 1 -maxdepth 1 -type d)
|
||||||
|
|
||||||
|
for dir in $dirs; do
|
||||||
|
fsck_repo "$dir"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Done."
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -8,7 +8,39 @@
|
|||||||
# Copyright (c) 2023 Ismo Vuorinen. All Rights Reserved.
|
# Copyright (c) 2023 Ismo Vuorinen. All Rights Reserved.
|
||||||
# License: MIT <https://opensource.org/license/mit/>
|
# License: MIT <https://opensource.org/license/mit/>
|
||||||
|
|
||||||
for f in */; do (cd "$f" && echo "-> $f" && git pull --rebase --autostash --prune); done
|
set -euo pipefail
|
||||||
|
|
||||||
echo "Done."
|
# Enable verbosity with VERBOSE=1
|
||||||
echo ""
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
|
# Function to print messages if VERBOSE is enabled
|
||||||
|
# $1 - message (string)
|
||||||
|
msg()
|
||||||
|
{
|
||||||
|
[ "$VERBOSE" -eq 1 ] && echo "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to update a git repository
|
||||||
|
# $1 - directory (string)
|
||||||
|
update_repo()
|
||||||
|
{
|
||||||
|
local dir=$1
|
||||||
|
(
|
||||||
|
cd "$dir" || exit
|
||||||
|
msg "Updating $dir"
|
||||||
|
git pull --rebase --autostash --prune
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main function to update all subfolder git repositories
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
for dir in */; do
|
||||||
|
update_repo "$dir"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Done."
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -3,33 +3,84 @@
|
|||||||
# Backup a folder with a timestamp
|
# Backup a folder with a timestamp
|
||||||
# Usage: x-backup-folder folder_to_backup [filename]
|
# Usage: x-backup-folder folder_to_backup [filename]
|
||||||
# If filename is not provided, folder_to_backup will be used
|
# If filename is not provided, folder_to_backup will be used
|
||||||
|
#
|
||||||
# Example: x-backup-folder ~/Documents/MyFolder
|
# Example: x-backup-folder ~/Documents/MyFolder
|
||||||
#
|
#
|
||||||
# Copyright (c) 2022 Ismo Vuorinen. All Rights Reserved.
|
# Copyright (c) 2022 Ismo Vuorinen. All Rights Reserved.
|
||||||
# Licensed under the MIT license.
|
# Licensed under the MIT license.
|
||||||
|
|
||||||
DIRECTORY=$1
|
set -euo pipefail
|
||||||
FILENAME=$2
|
|
||||||
|
|
||||||
if [ -z "${DIRECTORY}" ]; then
|
# Enable verbosity with VERBOSE=1
|
||||||
echo "DIRECTORY (first argument) is missing"
|
VERBOSE="${VERBOSE:-0}"
|
||||||
echo "Usage: $0 folder_to_backup"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${FILENAME}" ]; then
|
# Function to print usage information
|
||||||
FILENAME=$DIRECTORY
|
usage()
|
||||||
fi
|
{
|
||||||
|
echo "Usage: $0 folder_to_backup [filename]"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
FILENAME=$(
|
# Function to print messages if VERBOSE is enabled
|
||||||
${FILENAME} \
|
# $1 - message (string)
|
||||||
| tr '/' _ \
|
msg()
|
||||||
| iconv -t ascii//TRANSLIT \
|
{
|
||||||
| sed -r s/[^a-zA-Z0-9]+/_/g \
|
[[ "$VERBOSE" -eq 1 ]] && echo "$1"
|
||||||
| sed -r s/^_+\|-+$//g
|
}
|
||||||
)
|
|
||||||
|
|
||||||
TIMESTAMP=$(date "+%Y%m%d_%H%M%S")
|
# Function to print error messages and exit
|
||||||
FILENAME_TIMESTAMP="${FILENAME}_${TIMESTAMP}"
|
# $1 - error message (string)
|
||||||
|
msg_err()
|
||||||
|
{
|
||||||
|
echo "(!) ERROR: $1" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
tar cvzf "${FILENAME_TIMESTAMP}.tar.gz" "${DIRECTORY}/"
|
# Function to sanitize the filename
|
||||||
|
# $1 - filename (string)
|
||||||
|
sanitize_filename()
|
||||||
|
{
|
||||||
|
local filename=$1
|
||||||
|
echo "$filename" | tr '/' '_' | iconv -t ascii//TRANSLIT | sed -r 's/[^a-zA-Z0-9]+/_/g' | sed -r 's/^_+|_+$//g'
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to backup the directory
|
||||||
|
# $1 - directory to backup (string)
|
||||||
|
# $2 - filename prefix (string)
|
||||||
|
backup_directory()
|
||||||
|
{
|
||||||
|
local directory=$1
|
||||||
|
local filename=$2
|
||||||
|
|
||||||
|
local sanitized_filename
|
||||||
|
sanitized_filename=$(sanitize_filename "$filename")
|
||||||
|
|
||||||
|
local timestamp
|
||||||
|
timestamp=$(date "+%Y%m%d_%H%M%S")
|
||||||
|
local filename_timestamp="${sanitized_filename}_${timestamp}"
|
||||||
|
|
||||||
|
msg "Backing up directory '$directory' to '${filename_timestamp}.tar.gz'"
|
||||||
|
|
||||||
|
tar cvzf "${filename_timestamp}.tar.gz" "${directory}/"
|
||||||
|
|
||||||
|
msg "Backup completed and saved to '${filename_timestamp}.tar.gz'"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main function
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
local directory=$1
|
||||||
|
local filename=${2:-$directory}
|
||||||
|
|
||||||
|
if [ -z "$directory" ]; then
|
||||||
|
msg_err "DIRECTORY (first argument) is missing"
|
||||||
|
fi
|
||||||
|
|
||||||
|
backup_directory "$directory" "$filename"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -1,43 +1,91 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# Backup local MySQL Database tables with certain prefix.
|
# Backup local MySQL Database tables with a certain prefix.
|
||||||
# Ismo Vuorinen <https://github.com/ivuorinen> 2018
|
# Ismo Vuorinen <https://github.com/ivuorinen> 2018
|
||||||
# License: MIT
|
# License: MIT
|
||||||
|
|
||||||
SCRIPT=$(basename "$0")
|
set -euo pipefail
|
||||||
PREFIX=$1
|
|
||||||
FILENAME=$2
|
|
||||||
DATABASE=$3
|
|
||||||
|
|
||||||
: "${VERBOSE:=0}"
|
# Enable verbosity with VERBOSE=1
|
||||||
: "${DEFAULT_DATABASE:="wordpress"}"
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
# Default database
|
||||||
|
DEFAULT_DATABASE="wordpress"
|
||||||
|
|
||||||
if [ -z "${PREFIX}" ]; then
|
# Function to print usage information
|
||||||
echo "(!) TABLE_PREFIX (first argument) is missing"
|
usage()
|
||||||
|
{
|
||||||
echo "(>) Usage: $SCRIPT <TABLE_PREFIX> <FILENAME_PREFIX> [<DATABASE>]"
|
echo "(>) Usage: $SCRIPT <TABLE_PREFIX> <FILENAME_PREFIX> [<DATABASE>]"
|
||||||
echo " * <TABLE_PREFIX> = database table prefix, e.g. 'wp_'"
|
echo " * <TABLE_PREFIX> = database table prefix, e.g. 'wp_'"
|
||||||
echo " * <FILENAME_PREFIX> = FILENAME prefix, defaults to table prefix. Use something descriptive e.g. 'wordpress'"
|
echo " * <FILENAME_PREFIX> = FILENAME prefix, defaults to table prefix. Use something descriptive e.g. 'wordpress'"
|
||||||
echo " * <DATABASE> = [optional] Third argument DATABASE, defaults to '$DEFAULT_DATABASE'."
|
echo " * <DATABASE> = [optional] Third argument DATABASE, defaults to '$DEFAULT_DATABASE'."
|
||||||
exit 0
|
exit 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
if [ -z "${FILENAME}" ]; then
|
# Function to print messages if VERBOSE is enabled
|
||||||
# echo "FILENAME (second argument) is missing, using PREFIX ($PREFIX)"
|
# $1 - message (string)
|
||||||
FILENAME=$PREFIX
|
msg()
|
||||||
fi
|
{
|
||||||
|
[[ "$VERBOSE" -eq 1 ]] && echo "$1"
|
||||||
|
}
|
||||||
|
|
||||||
if [ -z "${DATABASE}" ]; then
|
# Function to print error messages and exit
|
||||||
# echo "DATABASE (third argument) is missing, using default ($DEFAULT_DATABASE)"
|
# $1 - error message (string)
|
||||||
DATABASE=$DEFAULT_DATABASE
|
msg_err()
|
||||||
fi
|
{
|
||||||
|
echo "(!) ERROR: $1" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
TIMESTAMP=$(date "+%Y%m%d_%H%M%S")
|
# Function to backup MySQL tables with a certain prefix
|
||||||
FILENAME_TIMESTAMP="${DATABASE}_${FILENAME}_${TIMESTAMP}.sql"
|
# $1 - table prefix (string)
|
||||||
|
# $2 - filename prefix (string)
|
||||||
|
# $3 - database name (string)
|
||||||
|
backup_mysql_tables()
|
||||||
|
{
|
||||||
|
local prefix=$1
|
||||||
|
local filename=$2
|
||||||
|
local database=$3
|
||||||
|
|
||||||
mysqldump \
|
local timestamp
|
||||||
"${DATABASE}" \
|
timestamp=$(date "+%Y%m%d_%H%M%S")
|
||||||
"$(
|
local filename_timestamp="${database}_${filename}_${timestamp}.sql"
|
||||||
echo "show tables like '${PREFIX}%';" \
|
|
||||||
| mysql "${DATABASE}" \
|
msg "Backing up tables with prefix '$prefix' from database '$database' to file '$filename_timestamp'"
|
||||||
| sed '/Tables_in/d'
|
|
||||||
)" > "${FILENAME_TIMESTAMP}"
|
mysqldump \
|
||||||
|
"${database}" \
|
||||||
|
"$(
|
||||||
|
echo "show tables like '${prefix}%';" \
|
||||||
|
| mysql "${database}" \
|
||||||
|
| sed '/Tables_in/d'
|
||||||
|
)" > "${filename_timestamp}"
|
||||||
|
|
||||||
|
msg "Backup completed and saved to '$filename_timestamp'"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main function
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
if [ "$#" -lt 2 ] || [ "$#" -gt 3 ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
local prefix=$1
|
||||||
|
local filename=$2
|
||||||
|
local database=${3:-$DEFAULT_DATABASE}
|
||||||
|
|
||||||
|
if [ -z "$prefix" ]; then
|
||||||
|
msg_err "TABLE_PREFIX (first argument) is missing"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$filename" ]; then
|
||||||
|
filename=$prefix
|
||||||
|
fi
|
||||||
|
|
||||||
|
backup_mysql_tables "$prefix" "$filename" "$database"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Script name for usage information
|
||||||
|
SCRIPT=$(basename "$0")
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -1,19 +1,71 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
# Adapted from https://gist.github.com/xqm32/17777d035930d622d0ff7530bfab61fd
|
# Adapted from https://gist.github.com/xqm32/17777d035930d622d0ff7530bfab61fd
|
||||||
#
|
#
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Enable verbosity with VERBOSE=1
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
A_DIR="$HOME/.config/alacritty"
|
A_DIR="$HOME/.config/alacritty"
|
||||||
|
|
||||||
set_alacritty_theme() {
|
# Function to print usage information
|
||||||
cp -f "$A_DIR/theme-$1.toml" "$A_DIR/theme-active.toml"
|
usage()
|
||||||
|
{
|
||||||
|
echo "Usage: $0 <theme>"
|
||||||
|
echo "Available themes: (dark|night) to turn dark mode on, (day|light) to turn off"
|
||||||
|
exit 1
|
||||||
}
|
}
|
||||||
ALACRITTY_THEME=$1
|
|
||||||
if [ "$ALACRITTY_THEME" = "dark" ] || [ "$ALACRITTY_THEME" = "night" ]; then
|
|
||||||
set_alacritty_theme "night"
|
|
||||||
else
|
|
||||||
set_alacritty_theme "day"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Notify alacritty about the changes
|
# Function to print messages if VERBOSE is enabled
|
||||||
touch "$A_DIR/alacritty.toml"
|
# $1 - message (string)
|
||||||
|
msg()
|
||||||
|
{
|
||||||
|
[[ "$VERBOSE" -eq 1 ]] && echo "$1"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to set the alacritty theme
|
||||||
|
# $1 - theme (string)
|
||||||
|
set_alacritty_theme()
|
||||||
|
{
|
||||||
|
local theme=$1
|
||||||
|
local theme_file="$A_DIR/theme-$theme.toml"
|
||||||
|
msg "Setting alacritty theme to $theme ($theme_file)"
|
||||||
|
cp -f "$theme_file" "$A_DIR/theme-active.toml"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to notify alacritty about the changes
|
||||||
|
notify_alacritty()
|
||||||
|
{
|
||||||
|
msg "Notifying alacritty about the changes"
|
||||||
|
touch "$A_DIR/alacritty.toml"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main function
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
local alacritty_theme=$1
|
||||||
|
|
||||||
|
case "$alacritty_theme" in
|
||||||
|
day | light)
|
||||||
|
set_alacritty_theme "day"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
set_alacritty_theme "night"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
notify_alacritty
|
||||||
|
msg "Theme set successfully!"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -1,19 +1,41 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# Check git repo's files .gitattributes and are all of them mapped.
|
# Check git repo's files .gitattributes and ensure all of them are mapped.
|
||||||
# Ismo Vuorinen <https://github.com/ivuorinen> 2022
|
# Ismo Vuorinen <https://github.com/ivuorinen> 2022
|
||||||
#
|
source "${DOTFILES}/config/shared.sh"
|
||||||
|
|
||||||
if ! command -v git &> /dev/null; then
|
set -euo pipefail
|
||||||
echo "git could not be found, please install it first"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
missing_attributes=$(git ls-files | git check-attr -a --stdin | grep "text: auto")
|
# Enable verbosity with VERBOSE=1
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
if [[ "$missing_attributes" ]]; then
|
# Function to check if git is installed
|
||||||
echo ".gitattributes rule missing for the following files:"
|
check_git_installed()
|
||||||
echo "$missing_attributes"
|
{
|
||||||
else
|
if ! command -v git &> /dev/null; then
|
||||||
echo "All files have a corresponding rule in .gitattributes"
|
msg_err "git could not be found, please install it first"
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to check for missing .gitattributes
|
||||||
|
check_gitattributes()
|
||||||
|
{
|
||||||
|
local missing_attributes
|
||||||
|
missing_attributes=$(git ls-files | git check-attr -a --stdin | grep "text: auto" || true)
|
||||||
|
|
||||||
|
if [[ -n "$missing_attributes" ]]; then
|
||||||
|
echo ".gitattributes rule missing for the following files:"
|
||||||
|
echo "$missing_attributes"
|
||||||
|
else
|
||||||
|
echo "All files have a corresponding rule in .gitattributes"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main function
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
check_git_installed
|
||||||
|
check_gitattributes
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -4,13 +4,49 @@
|
|||||||
# Copyright (c) 2023 Ismo Vuorinen. All Rights Reserved.
|
# Copyright (c) 2023 Ismo Vuorinen. All Rights Reserved.
|
||||||
# Licensed under MIT License. http://www.opensource.org/licenses/mit-license.
|
# Licensed under MIT License. http://www.opensource.org/licenses/mit-license.
|
||||||
|
|
||||||
dir="$1"
|
# Enable verbosity with VERBOSE=1
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
[ $# -eq 0 ] && {
|
# Function to print usage information
|
||||||
|
usage()
|
||||||
|
{
|
||||||
echo "Usage: $0 full/path/to/dir/to/create"
|
echo "Usage: $0 full/path/to/dir/to/create"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ ! -d "$dir" ]; then
|
# Function to print messages if VERBOSE is enabled
|
||||||
mkdir -p "$dir" && exit 0
|
# $1 - message (string)
|
||||||
fi
|
msg()
|
||||||
|
{
|
||||||
|
[[ "$VERBOSE" -eq 1 ]] && echo "$1"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to create a directory if it doesn't exist
|
||||||
|
# $1 - directory to create (string)
|
||||||
|
create_directory()
|
||||||
|
{
|
||||||
|
local dir=$1
|
||||||
|
|
||||||
|
if [ ! -d "$dir" ]; then
|
||||||
|
msg "Creating directory: $dir"
|
||||||
|
mkdir -p "$dir"
|
||||||
|
msg "Directory created: $dir"
|
||||||
|
else
|
||||||
|
msg "Directory already exists: $dir"
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main function
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
create_directory "$1"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -2,24 +2,48 @@
|
|||||||
#
|
#
|
||||||
# x-xterm-update-keybindings
|
# x-xterm-update-keybindings
|
||||||
# Updates $HOME/.dotfiles/docs/tmux.md with my keybindings.
|
# Updates $HOME/.dotfiles/docs/tmux.md with my keybindings.
|
||||||
|
# Usage: x-xterm-update-keybindings
|
||||||
|
# Author: Ismo Vuorinen <https://github.com/ivuorinen> 2024
|
||||||
|
# shellcheck source=./../../config/shared.sh
|
||||||
|
source "${DOTFILES}/config/shared.sh"
|
||||||
|
|
||||||
# shellcheck source=./../../scripts/shared.sh
|
# Enable verbosity with VERBOSE=1
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
x-have tmux || {
|
# Check if tmux is installed
|
||||||
msg_err "tmux not found" && exit 0
|
check_tmux_installed()
|
||||||
|
{
|
||||||
|
if ! x-have tmux; then
|
||||||
|
msg_err "tmux not found"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
TMUX_KEYBINDINGS_DOCS="$DOTFILES/docs/tmux-keybindings.md"
|
# Generate tmux keybindings documentation
|
||||||
|
generate_tmux_keybindings()
|
||||||
|
{
|
||||||
|
local tmux_keybindings_docs="$1"
|
||||||
|
|
||||||
CB="\n\`\`\`\n"
|
local cb="\n\`\`\`\n"
|
||||||
KB=$(tmux lsk -Tprefix -N | sed -e 's/^/ /;')
|
local kb
|
||||||
H="# tmux keybindings\n"
|
kb=$(tmux lsk -Tprefix -N | sed -e 's/^/ /;')
|
||||||
L="\nLeader: \`<ctrl><space>\`\n"
|
local h="# tmux keybindings\n"
|
||||||
|
local l="\nLeader: \`<ctrl><space>\`\n"
|
||||||
|
|
||||||
# Generalize expanded $HOME to "$HOME"
|
# Generalize expanded $HOME to "$HOME"
|
||||||
KB="${KB//$HOME/\$HOME}"
|
kb="${kb//$HOME/\$HOME}"
|
||||||
|
|
||||||
msg "Outputting tmux keybindings to $TMUX_KEYBINDINGS_DOCS"
|
msg "Outputting tmux keybindings to $tmux_keybindings_docs"
|
||||||
echo -e "${H}${L}${CB}${KB}${CB}" > "$TMUX_KEYBINDINGS_DOCS"
|
echo -e "${h}${l}${cb}${kb}${cb}" > "$tmux_keybindings_docs"
|
||||||
msg_done "Done!"
|
msg "Done!"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main function
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
check_tmux_installed
|
||||||
|
|
||||||
|
local tmux_keybindings_docs="$DOTFILES/docs/tmux-keybindings.md"
|
||||||
|
generate_tmux_keybindings "$tmux_keybindings_docs"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -1,17 +1,102 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Fetch the latest release version of a GitHub repository in tar.gz format (e.g. v1.0.0.tar.gz)
|
||||||
|
# Usage: x-gh-get-latest-release-targ <repo> [--get]
|
||||||
|
# Author: Ismo Vuorinen <https://github.com/ivuorinen> 2024
|
||||||
|
|
||||||
REPO=$1
|
set -euo pipefail
|
||||||
|
|
||||||
if [ -z "$REPO" ]; then
|
# Enable verbosity with VERBOSE=1
|
||||||
echo "Usage: $0 <repo> (e.g. ivuorinen/dotfiles)"
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
|
# Function to print usage information
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
echo "Usage: $0 <github repo> [--get] (e.g. ivuorinen/dotfiles)"
|
||||||
|
echo " --get: Download and extract the tarball"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
LOCATION=$(curl -s "https://api.github.com/repos/${REPO}/releases/latest" \
|
# Function to print messages if VERBOSE is enabled
|
||||||
| sed -Ene '/^[[:blank:]]+"tarball_url":[[:blank:]]"(https:[^"]+)",/s//\1/p')
|
# $1 - message (string)
|
||||||
|
msg()
|
||||||
|
{
|
||||||
|
[[ "$VERBOSE" -eq 1 ]] && echo "$1"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
echo "Downloading and extracting from: $LOCATION"
|
# Function to fetch the tarball URL of the latest release from GitHub
|
||||||
|
# $1 - GitHub repository (string)
|
||||||
|
get_latest_tarball_url()
|
||||||
|
{
|
||||||
|
local repo=$1
|
||||||
|
|
||||||
curl --location --silent "$LOCATION" | tar --extract --gzip --file=-
|
local tarball_url
|
||||||
|
tarball_url=$(curl -s "https://api.github.com/repos/${repo}/releases/latest" \
|
||||||
|
| sed -Ene '/^[[:blank:]]+"tarball_url":[[:blank:]]"(https:[^"]+)",/s//\1/p')
|
||||||
|
|
||||||
|
if [ -z "$tarball_url" ]; then
|
||||||
|
echo "(!) Failed to fetch the tarball URL for repository: $repo"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$tarball_url"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to download and extract the tarball
|
||||||
|
# $1 - tarball URL (string)
|
||||||
|
download_and_extract()
|
||||||
|
{
|
||||||
|
local url="$1"
|
||||||
|
|
||||||
|
msg "Downloading and extracting from: $url"
|
||||||
|
curl --location --silent "$url" | tar --extract --gzip --file=- || {
|
||||||
|
echo "(!) Failed to download or extract the tarball."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main function
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
local repo=$1
|
||||||
|
local get_tarball=false
|
||||||
|
|
||||||
|
if [ "$#" -eq 2 ]; then
|
||||||
|
# Check if the first or second argument is --get
|
||||||
|
if [ "$1" == "--get" ] || [ "$2" == "--get" ]; then
|
||||||
|
get_tarball=true
|
||||||
|
else
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the first argument is --get
|
||||||
|
if [ "$1" == "--get" ]; then
|
||||||
|
repo="$2"
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg "Fetching the tarball URL for the latest release of repository: $repo"
|
||||||
|
|
||||||
|
local location
|
||||||
|
location=$(get_latest_tarball_url "$repo")
|
||||||
|
|
||||||
|
if $get_tarball; then
|
||||||
|
download_and_extract "$location"
|
||||||
|
else
|
||||||
|
echo "$location"
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|
||||||
# vim: set ts=2 sw=2 ft=sh et:
|
# vim: set ts=2 sw=2 ft=sh et:
|
||||||
|
|||||||
@@ -1,18 +1,68 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Get latest release version from GitHub
|
||||||
|
# Usage: x-gh-get-latest-version <repo>
|
||||||
|
# Author: Ismo Vuorinen <https://github.com/ivuorinen> 2024
|
||||||
|
|
||||||
REPO=$1
|
set -euo pipefail
|
||||||
|
|
||||||
if [ -z "$REPO" ]; then
|
# Enable verbosity with VERBOSE=1
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
|
# Function to print usage information
|
||||||
|
usage()
|
||||||
|
{
|
||||||
echo "Usage: $0 <repo> (e.g. ivuorinen/dotfiles)"
|
echo "Usage: $0 <repo> (e.g. ivuorinen/dotfiles)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
VERSION=$(
|
# Function to print messages if VERBOSE is enabled
|
||||||
curl -s "https://api.github.com/repos/${REPO}/releases/latest" \
|
# $1 - message (string)
|
||||||
|
msg()
|
||||||
|
{
|
||||||
|
[[ "$VERBOSE" -eq 1 ]] && echo "$1"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to fetch the latest release version from GitHub
|
||||||
|
# $1 - GitHub repository (string)
|
||||||
|
get_latest_release()
|
||||||
|
{
|
||||||
|
local repo=$1
|
||||||
|
|
||||||
|
local version
|
||||||
|
version=$(curl -s "https://api.github.com/repos/${repo}/releases/latest" \
|
||||||
| grep "tag_name" \
|
| grep "tag_name" \
|
||||||
| awk '{print substr($2, 2, length($2)-3)}'
|
| awk -F '"' '{print $4}')
|
||||||
)
|
|
||||||
|
|
||||||
echo "$VERSION"
|
if [ -z "$version" ]; then
|
||||||
|
msg "Failed to fetch the latest release version for repository: $repo"
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$version"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main function
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
local repo=$1
|
||||||
|
|
||||||
|
msg "Fetching the latest release version for repository: $repo"
|
||||||
|
|
||||||
|
local version
|
||||||
|
version=$(get_latest_release "$repo")
|
||||||
|
|
||||||
|
echo "$version"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|
||||||
# vim: set ts=2 sw=2 ft=sh et:
|
# vim: set ts=2 sw=2 ft=sh et:
|
||||||
|
|||||||
@@ -1,9 +1,47 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Returns which status
|
# Returns which status
|
||||||
which "$1" >&/dev/null
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
# Enable verbosity with VERBOSE=1
|
||||||
exit 0
|
VERBOSE="${VERBOSE:-0}"
|
||||||
else
|
|
||||||
|
# Function to print usage information
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
echo "Usage: $0 <command>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
|
# Function to print messages if VERBOSE is enabled
|
||||||
|
# $1 - message (string)
|
||||||
|
msg()
|
||||||
|
{
|
||||||
|
[[ "$VERBOSE" -eq 1 ]] && echo "$1"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to check if a command exists
|
||||||
|
# $1 - command to check (string)
|
||||||
|
check_command()
|
||||||
|
{
|
||||||
|
local cmd=$1
|
||||||
|
|
||||||
|
if command -v "$cmd" > /dev/null 2>&1; then
|
||||||
|
msg "(*) '$cmd' is available on the system."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
msg "(!) '$cmd' is NOT available on the system."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main function
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
check_command "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -2,76 +2,96 @@
|
|||||||
# Load our configuration files
|
# Load our configuration files
|
||||||
# Copyright (c) 2023 Ismo Vuorinen. All Rights Reserved.
|
# Copyright (c) 2023 Ismo Vuorinen. All Rights Reserved.
|
||||||
|
|
||||||
set -euo pipefail
|
DOTFILES="${DOTFILES:-$HOME/.dotfiles}"
|
||||||
|
|
||||||
# Set verbosity with VERBOSE=1 x-load-configs
|
source "$DOTFILES/config/shared.sh"
|
||||||
VERBOSE="${VERBOSE:=0}"
|
|
||||||
|
|
||||||
[ "$VERBOSE" = "1" ] && {
|
# Enable verbosity with VERBOSE=1 x-load-configs
|
||||||
set -x
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
# Enable debugging with DEBUG=1 x-load-configs
|
||||||
|
DEBUG="${DEBUG:-0}"
|
||||||
|
|
||||||
|
# Get the hostname
|
||||||
|
CONFIG_HOST="$(hostname -s)"
|
||||||
|
|
||||||
|
# Enable debugging if requested
|
||||||
|
[ "$DEBUG" = "1" ] && set -x
|
||||||
|
|
||||||
|
CONFIG_PATH="${HOME}/.config"
|
||||||
|
|
||||||
|
[ -d "$DOTFILES" ] || {
|
||||||
|
msg_err "Error: DOTFILES is not set or $DOTFILES does not exist"
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIG_PATH="$DOTFILES/config"
|
# Function to print messages if VERBOSE is enabled
|
||||||
|
# $1 - message type (string)
|
||||||
|
# $2 - message content (string)
|
||||||
|
config_msg()
|
||||||
|
{
|
||||||
|
# if $1 is empty, return
|
||||||
|
[ -z "$1" ] && return
|
||||||
|
[ -z "$2" ] && $2=""
|
||||||
|
|
||||||
# Load the shell dotfiles, and then some:
|
local msg_type="$1"
|
||||||
HOST="$(hostname -s)"
|
local msg_content="$2"
|
||||||
[ "$VERBOSE" = "1" ] && {
|
[[ "$VERBOSE" -eq 1 ]] && printf 'x-load-configs: %s %s\n' "$msg_type" "$msg_content"
|
||||||
echo "x-load-configs: VERBOSE=1"
|
return 0
|
||||||
echo "x-load-configs: HOST: $HOST"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configFile()
|
# Function to get the full path of a config file
|
||||||
|
# $1 - filename (string)
|
||||||
|
config_file_path()
|
||||||
{
|
{
|
||||||
echo "$CONFIG_PATH/$1"
|
echo "$CONFIG_PATH/$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
configMsg()
|
# Function to source configuration files
|
||||||
|
source_config()
|
||||||
{
|
{
|
||||||
printf 'x-load-configs: %s %s\n' "$1" "$2"
|
local config_file=$1
|
||||||
|
if [ -f "$config_file" ]; then
|
||||||
|
eval "$config_file"
|
||||||
|
config_msg "Sourced" "$config_file"
|
||||||
|
else
|
||||||
|
msg "Config file $config_file not found"
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
loadConfigFiles()
|
# Function to load a configuration file
|
||||||
|
# $1 - base config file name (string)
|
||||||
|
load_config_files()
|
||||||
{
|
{
|
||||||
CONFIG_FILE=$1
|
local config_file="$1"
|
||||||
SECRET_FILE=$CONFIG_FILE-secret
|
local secret_file="${config_file}-secret"
|
||||||
HOST_FILE=$CONFIG_FILE-$HOST
|
local host_file="${config_file}-${CONFIG_HOST}"
|
||||||
SECRET_HOST=$HOST_FILE-secret
|
local secret_host_file="${host_file}-secret"
|
||||||
|
|
||||||
[ "$VERBOSE" = "1" ] && configMsg "?" "$CONFIG_FILE"
|
config_msg "Looking for" "$config_file"
|
||||||
|
[ -r "$config_file" ] && {
|
||||||
# global (exports|alias|functions) FILENAME for all hosts
|
source_config "$config_file"
|
||||||
# shellcheck source=../config/exports
|
|
||||||
[ -r "$CONFIG_FILE" ] && {
|
|
||||||
source "$CONFIG_FILE" && [ "$VERBOSE" = "1" ] && configMsg "Found" "$CONFIG_FILE"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# global secret FILENAME, git ignored
|
config_msg "Looking for" "$secret_file"
|
||||||
# shellcheck source=../config/exports-secret
|
[ -r "$secret_file" ] && {
|
||||||
[ "$VERBOSE" = "1" ] && configMsg "?" "$SECRET_FILE"
|
source_config "$secret_file"
|
||||||
[ -r "$SECRET_FILE" ] && {
|
|
||||||
source "$SECRET_FILE" && [ "$VERBOSE" = "1" ] && configMsg "Found" "$SECRET_FILE"
|
|
||||||
}
|
}
|
||||||
# host specific (exports|alias|functions) FILENAME
|
|
||||||
# shellcheck source=../config/exports
|
config_msg "Looking for" "$host_file"
|
||||||
[ "$VERBOSE" = "1" ] && configMsg "?" "$HOST_FILE"
|
[ -r "$host_file" ] && {
|
||||||
[ -r "$HOST_FILE" ] && {
|
source_config "$host_file"
|
||||||
source "$HOST_FILE" && [ "$VERBOSE" = "1" ] && configMsg "Found" "$HOST_FILE"
|
|
||||||
}
|
}
|
||||||
# host specific (exports|alias|functions) FILENAME, git ignored
|
|
||||||
# shellcheck source=../config/exports
|
config_msg "Looking for" "$secret_host_file"
|
||||||
[ "$VERBOSE" = "1" ] && configMsg "?" "$SECRET_HOST"
|
[ -r "$secret_host_file" ] && {
|
||||||
[ -r "$SECRET_HOST" ] && {
|
source_config "$secret_host_file"
|
||||||
source "$SECRET_HOST" \
|
|
||||||
&& [ "$VERBOSE" = "1" ] && configMsg "Found" "$SECRET_HOST"
|
|
||||||
}
|
}
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE_EXPORTS=$(configFile "exports")
|
config_msg "VERBOSE=1" "Verbose mode enabled"
|
||||||
FILE_FUNCTIONS=$(configFile "functions")
|
config_msg "HOST" "$CONFIG_HOST"
|
||||||
FILE_ALIAS=$(configFile "alias")
|
|
||||||
|
|
||||||
loadConfigFiles "$FILE_EXPORTS"
|
|
||||||
loadConfigFiles "$FILE_FUNCTIONS"
|
|
||||||
loadConfigFiles "$FILE_ALIAS"
|
|
||||||
|
|
||||||
|
load_config_files "$(config_file_path "exports")"
|
||||||
|
load_config_files "$(config_file_path "alias")"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -1,4 +1,50 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
# Create a directory and cd into it
|
# Create a directory and cd into it
|
||||||
|
# Usage: mkcd <dir>
|
||||||
|
|
||||||
mkdir -p "$@" && cd "$@" || exit
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Set verbosity with VERBOSE=1
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
|
# Function to print usage information
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
echo "Usage: $0 <dir>"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to print messages if VERBOSE is enabled
|
||||||
|
# $1 - message (string)
|
||||||
|
msg()
|
||||||
|
{
|
||||||
|
[[ "$VERBOSE" -eq 1 ]] && echo "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to create a directory and cd into it
|
||||||
|
# $1 - directory to create and cd into (string)
|
||||||
|
mkcd()
|
||||||
|
{
|
||||||
|
local dir=$1
|
||||||
|
|
||||||
|
mkdir -p "$dir" && msg "Directory $dir created"
|
||||||
|
|
||||||
|
cd "$dir" || {
|
||||||
|
msg "Failed to cd into $dir"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
msg "Changed directory to $dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main function
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkcd "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -6,16 +6,34 @@
|
|||||||
# Modified by: Ismo Vuorinen <https://github.com/ivuorinen> 2020
|
# Modified by: Ismo Vuorinen <https://github.com/ivuorinen> 2020
|
||||||
# Originally from: https://www.commandlinefu.com/commands/view/8951
|
# Originally from: https://www.commandlinefu.com/commands/view/8951
|
||||||
# Original author: https://www.commandlinefu.com/commands/by/wickedcpj
|
# Original author: https://www.commandlinefu.com/commands/by/wickedcpj
|
||||||
#
|
|
||||||
echo 'User: Command: PID: Port:'
|
|
||||||
echo '========================================================='
|
|
||||||
|
|
||||||
lsof -i 4 -P -n +c 0 \
|
set -euo pipefail
|
||||||
| grep -i 'listen' \
|
|
||||||
| awk '{print $3, $1, $2, $9}' \
|
|
||||||
| sed 's/ [a-z0-9\.\*]*:/ /' \
|
|
||||||
| sort -k 3 -n \
|
|
||||||
| xargs printf '%-15s %-25s %-8s %-5s\n' \
|
|
||||||
| uniq
|
|
||||||
|
|
||||||
echo ""
|
# Function to print the header
|
||||||
|
print_header()
|
||||||
|
{
|
||||||
|
echo 'User: Command: PID: Port:'
|
||||||
|
echo '========================================================='
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to list open ports
|
||||||
|
list_open_ports()
|
||||||
|
{
|
||||||
|
lsof -i 4 -P -n +c 0 \
|
||||||
|
| grep -i 'listen' \
|
||||||
|
| awk '{print $3, $1, $2, $9}' \
|
||||||
|
| sed 's/ [a-z0-9\.\*]*:/ /' \
|
||||||
|
| sort -k 3 -n \
|
||||||
|
| xargs printf '%-15s %-25s %-8s %-5s\n' \
|
||||||
|
| uniq
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main function
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
print_header
|
||||||
|
list_open_ports
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -3,5 +3,38 @@
|
|||||||
# Add a directory to the beginning of the PATH if it's not already there.
|
# Add a directory to the beginning of the PATH if it's not already there.
|
||||||
# Usage: x-path-append <dir>
|
# Usage: x-path-append <dir>
|
||||||
|
|
||||||
x-path-remove "$1"
|
# Set verbosity with VERBOSE=1
|
||||||
export PATH="${PATH:+"$PATH:"}$1"
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
|
# Function to print messages if VERBOSE is enabled
|
||||||
|
# $1 - message (string)
|
||||||
|
msg()
|
||||||
|
{
|
||||||
|
[[ "$VERBOSE" -eq 1 ]] && echo "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "Usage: $0 <dir>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
dir="$1"
|
||||||
|
|
||||||
|
if echo "$PATH" | grep -qE "(^|:)$dir($|:)"; then
|
||||||
|
export PATH=$(echo -n "$PATH" | awk -v RS=: -v ORS=: "\$0 != \"$dir\"" | sed 's/:$//')
|
||||||
|
msg "Directory $dir has been removed from PATH"
|
||||||
|
else
|
||||||
|
msg "Directory $dir is not in PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$dir" ]; then
|
||||||
|
msg "(?) Directory $dir does not exist"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if echo "$PATH" | grep -qE "(^|:)$dir($|:)"; then
|
||||||
|
msg "(!) Directory $dir is already in PATH"
|
||||||
|
else
|
||||||
|
export PATH="${PATH:+"$PATH:"}$dir"
|
||||||
|
msg "(!) Directory $dir has been added to the end of PATH"
|
||||||
|
fi
|
||||||
|
|||||||
@@ -3,4 +3,31 @@
|
|||||||
# Add a directory to the front of the PATH if it exists and is not already there
|
# Add a directory to the front of the PATH if it exists and is not already there
|
||||||
# Usage: x-path-prepend <dir>
|
# Usage: x-path-prepend <dir>
|
||||||
|
|
||||||
export PATH="$1${PATH:+":$PATH"}"
|
# Set verbosity with VERBOSE=1
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
|
# Function to print messages if VERBOSE is enabled
|
||||||
|
# $1 - message (string)
|
||||||
|
msg()
|
||||||
|
{
|
||||||
|
[[ "$VERBOSE" -eq 1 ]] && echo "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "Usage: $0 <dir>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
dir="$1"
|
||||||
|
|
||||||
|
if [ ! -d "$dir" ]; then
|
||||||
|
msg "(?) Directory $dir does not exist"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if echo "$PATH" | grep -qE "(^|:)$dir($|:)"; then
|
||||||
|
msg "(!) Directory $dir is already in PATH"
|
||||||
|
else
|
||||||
|
export PATH="$dir${PATH:+":$PATH"}"
|
||||||
|
msg "(!) Directory $dir has been added to the front of PATH"
|
||||||
|
fi
|
||||||
|
|||||||
@@ -3,4 +3,27 @@
|
|||||||
# Remove a directory from the PATH
|
# Remove a directory from the PATH
|
||||||
# Usage: x-path-remove <dir>
|
# Usage: x-path-remove <dir>
|
||||||
|
|
||||||
export PATH=$(echo -n "$PATH" | awk -v RS=: -v ORS=: "\$0 != \"$1\"" | sed 's/:$//')
|
# Set verbosity with VERBOSE=1
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
|
# Function to print messages if VERBOSE is enabled
|
||||||
|
# $1 - message (string)
|
||||||
|
msg()
|
||||||
|
{
|
||||||
|
[[ "$VERBOSE" -eq 1 ]] && echo "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "Usage: $0 <dir>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
dir="$1"
|
||||||
|
|
||||||
|
if ! echo "$PATH" | grep -qE "(^|:)$dir($|:)"; then
|
||||||
|
msg "(?) Directory $dir is not in PATH"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
export PATH=$(echo -n "$PATH" | awk -v RS=: -v ORS=: "\$0 != \"$dir\"" | sed 's/:$//')
|
||||||
|
msg "(!) Directory $dir has been removed from PATH"
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
#!/usr/bin/env php
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Quota usage
|
||||||
|
* Show quota usage
|
||||||
|
*
|
||||||
|
* @package x-quota-usage
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://github.com/ivuorinen/dotfiles/blob/main/local/bin/x-quota-usage.php
|
||||||
|
* @license MIT
|
||||||
|
* @author Ismo Vuorinen <https://github.com/ivuorinen>
|
||||||
|
*/
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
$debug = false;
|
$debug = false;
|
||||||
|
|||||||
@@ -14,168 +14,119 @@
|
|||||||
# pkill (coreutils)
|
# pkill (coreutils)
|
||||||
#
|
#
|
||||||
# 2021-2022 : João F. © BeyondMagic <koetemagie@gmail.com>
|
# 2021-2022 : João F. © BeyondMagic <koetemagie@gmail.com>
|
||||||
|
# 2024- : Ismo Vuorinen <https://github.com/ivuorinen>
|
||||||
|
|
||||||
# 1. Variables.
|
# Enable verbosity with VERBOSE=1
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
frame_rate=30
|
||||||
|
name='camera'
|
||||||
|
path_recordings="$HOME/.cache/recording"
|
||||||
|
replace_id="$HOME/.cache/recording.id"
|
||||||
|
|
||||||
|
# Function to print messages if VERBOSE is enabled
|
||||||
|
# $1 - message (string)
|
||||||
|
msg()
|
||||||
{
|
{
|
||||||
# A. Indepedent of variables.
|
[ "$VERBOSE" -eq 1 ] && echo "$1"
|
||||||
frame_rate=30
|
|
||||||
time=10
|
|
||||||
name='カメラ'
|
|
||||||
|
|
||||||
# B. Depedent of variables.
|
|
||||||
path_recordings="$HOME/.cache/recording"
|
|
||||||
icons="$HOME/.local/share/icons"
|
|
||||||
replace_id="$HOME/.cache/recording.id"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# 2. Functions to minise code.
|
# Notify function
|
||||||
#{
|
|
||||||
|
|
||||||
# I.
|
|
||||||
notify()
|
notify()
|
||||||
{
|
{
|
||||||
|
notify-call --replace-file "$replace_id" "$@"
|
||||||
notify-call \
|
|
||||||
--replace-file "$replace_id" \
|
|
||||||
"$@"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# II.
|
# Stop recording function
|
||||||
stop()
|
stop()
|
||||||
{
|
{
|
||||||
|
|
||||||
# A.
|
|
||||||
#pkill -INT -f 'ffmpeg -f alsa -ac 1 -i pulse -f x11grab -r 30 -s '
|
|
||||||
giph --stop
|
giph --stop
|
||||||
|
|
||||||
# C.
|
|
||||||
eww update record_menu=false
|
eww update record_menu=false
|
||||||
|
|
||||||
}
|
|
||||||
#}
|
|
||||||
|
|
||||||
# #. Kill previous giph process.
|
|
||||||
if [ "$(pgrep -f 'bash.+giph')" ]; then
|
|
||||||
|
|
||||||
# A. Let the user decide.
|
|
||||||
next=$(notify \
|
|
||||||
-d 'echo yes' \
|
|
||||||
"$name" \
|
|
||||||
'Do you want to stop current recording?')
|
|
||||||
|
|
||||||
# A. End with previous giph session.
|
|
||||||
[ "$next" = 'yes' ] && stop
|
|
||||||
|
|
||||||
# B. Just exit cleanly.
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 2. To see if current fyletype is supported.
|
|
||||||
{
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
|
|
||||||
# A. Supported.
|
|
||||||
'mkv' | 'gif' | 'webm' | 'mp4') ;;
|
|
||||||
|
|
||||||
# B. Not supported.
|
|
||||||
*)
|
|
||||||
|
|
||||||
# I. Let the user decide.
|
|
||||||
format=$(notify \
|
|
||||||
-o 'echo mkv:MKV' \
|
|
||||||
-o 'echo webm:WEBM' \
|
|
||||||
-o 'echo mp4:MP4' \
|
|
||||||
-o 'echo gif:GIF' \
|
|
||||||
"$name" \
|
|
||||||
'What is the filetype you want to record?')
|
|
||||||
|
|
||||||
# II. Execute itself.
|
|
||||||
exec $0 $format $2
|
|
||||||
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# 3. Whether to choose fullscreen recording or sizeable one.
|
# Function to check for required applications
|
||||||
|
check_dependencies()
|
||||||
{
|
{
|
||||||
if [ "$2" = 'fullscreen' ]; then
|
for cmd in ffmpeg notify-send.sh pkill eww giph slop; do
|
||||||
|
if ! command -v "$cmd" &> /dev/null; then
|
||||||
# A. From <WxH+X+Y> monitor.
|
echo "Required command '$cmd' not found. Please install it before running this script."
|
||||||
geometry="$(xrandr | awk '/ primary/{print $4}')"
|
exit 1
|
||||||
|
fi
|
||||||
elif [ "$2" = 'set' ]; then
|
done
|
||||||
|
}
|
||||||
# A. To get size & position of the recording set.
|
|
||||||
geometry="$(slop -f "%wx%h+%x+%y")"
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
# I. Let the user decide.
|
|
||||||
next=$(notify \
|
|
||||||
-o 'echo fullscreen:The whole_screen!' \
|
|
||||||
-o 'echo set:Let me set.' \
|
|
||||||
"$name" \
|
|
||||||
'How exactly do you want to record?')
|
|
||||||
|
|
||||||
# II. Execute itself.
|
|
||||||
exec $0 $1 $next
|
|
||||||
|
|
||||||
|
# Function to kill previous giph process if running
|
||||||
|
kill_previous_process()
|
||||||
|
{
|
||||||
|
if pgrep -f 'bash.+giph' > /dev/null; then
|
||||||
|
next=$(notify -d 'echo yes' "$name" 'Do you want to stop current recording?')
|
||||||
|
[ "$next" = 'yes' ] && stop
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# 4. Start recording.
|
# Function to check if the current file type is supported
|
||||||
|
check_file_type()
|
||||||
{
|
{
|
||||||
|
case "$1" in
|
||||||
|
'mkv' | 'gif' | 'webm' | 'mp4') ;;
|
||||||
|
*)
|
||||||
|
format=$(
|
||||||
|
notify \
|
||||||
|
-o 'echo mkv:MKV' \
|
||||||
|
-o 'echo webm:WEBM' \
|
||||||
|
-o 'echo mp4:MP4' \
|
||||||
|
-o 'echo gif:GIF' \
|
||||||
|
"$name" \
|
||||||
|
'What is the filetype you want to record?'
|
||||||
|
)
|
||||||
|
exec "$0" "$format" "$2"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to determine recording scope
|
||||||
|
determine_scope()
|
||||||
|
{
|
||||||
|
if [ "$2" = 'fullscreen' ]; then
|
||||||
|
geometry=$(xrandr | awk '/ primary/{print $4}')
|
||||||
|
elif [ "$2" = 'set' ]; then
|
||||||
|
geometry=$(slop -f "%wx%h+%x+%y")
|
||||||
|
else
|
||||||
|
next=$(notify -o 'echo fullscreen:The whole_screen!' -o 'echo set:Let me set.' "$name" 'How exactly do you want to record?')
|
||||||
|
exec "$0" "$1" "$next"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to start recording
|
||||||
|
start_recording()
|
||||||
|
{
|
||||||
mkdir -p "$path_recordings"
|
mkdir -p "$path_recordings"
|
||||||
name_file="$path_recordings/$2-$(date +'%a_%b_%d_%H:%M:%S').$1"
|
name_file="$path_recordings/$2-$(date +'%a_%b_%d_%H:%M:%S').$1"
|
||||||
|
|
||||||
# A. Timer.
|
|
||||||
#for i in {1..$time}; do
|
|
||||||
|
|
||||||
# # I.
|
|
||||||
# notify "Starting in $i seconds."
|
|
||||||
|
|
||||||
# # II. Wait for next second.
|
|
||||||
# sleep ${i}s
|
|
||||||
|
|
||||||
#done
|
|
||||||
|
|
||||||
# B. Send a sign of recording to lemonbar so that you know it is being recorded.
|
|
||||||
eww update record_menu=true
|
eww update record_menu=true
|
||||||
|
|
||||||
# C. Start recording.
|
giph -g "$geometry" -f "$frame_rate" "$name_file"
|
||||||
giph \
|
|
||||||
-g "$geometry" \
|
|
||||||
-f "$frame_rate" \
|
|
||||||
"$name_file"
|
|
||||||
|
|
||||||
# D.
|
|
||||||
stop
|
stop
|
||||||
|
|
||||||
# E.
|
responder=$(notify -o 'echo open:See file?' -o 'echo none:Hell no' "$name" 'Recording has finished.')
|
||||||
responder="$(notify \
|
|
||||||
-o 'echo open:See file?' \
|
|
||||||
-o 'echo none:Hell no' \
|
|
||||||
"$name" \
|
|
||||||
'Recording has finished.')"
|
|
||||||
|
|
||||||
# F. For action-driven response.
|
|
||||||
if [ "$responder" = 'open' ]; then
|
if [ "$responder" = 'open' ]; then
|
||||||
|
nohup gtk-launch "$(xdg-mime query default inode/directory)" "$path_recordings/" > /dev/null 2>&1 &
|
||||||
# I.
|
|
||||||
nohup \
|
|
||||||
gtk-launch \
|
|
||||||
"$(xdg-mime query default inode/directory)" \
|
|
||||||
"$path_recordings/" \
|
|
||||||
> /dev/null 2>&1 &
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -f "$replace_id"
|
||||||
}
|
}
|
||||||
|
|
||||||
rm -f "$replace_id"
|
main()
|
||||||
|
{
|
||||||
|
check_dependencies
|
||||||
|
kill_previous_process "$@"
|
||||||
|
check_file_type "$@"
|
||||||
|
determine_scope "$@"
|
||||||
|
start_recording "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -1,50 +1,71 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Check which php versions are installed with brew, and create aliases for each installation.
|
# Check which PHP versions are installed with brew, and create aliases for each installation.
|
||||||
# Copyright (c) 2023 Ismo Vuorinen. All Rights Reserved.
|
# Copyright (c) 2023 Ismo Vuorinen. All Rights Reserved.
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Set verbosity with VERBOSE=1 x-load-configs
|
# Set verbosity with VERBOSE=1 x-set-php-aliases
|
||||||
VERBOSE="${VERBOSE:=0}"
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
[ "$VERBOSE" = "2" ] && {
|
# Enable debugging if verbosity is set to 2
|
||||||
set -x
|
[ "$VERBOSE" = "2" ] && set -x
|
||||||
}
|
|
||||||
|
|
||||||
! x-have brew && {
|
# Check if brew is installed, if not exit.
|
||||||
|
if ! command -v brew &> /dev/null; then
|
||||||
exit 0
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Function to read installed PHP versions using brew
|
||||||
|
get_php_versions()
|
||||||
|
{
|
||||||
|
local versions=()
|
||||||
|
while IFS="" read -r line; do
|
||||||
|
versions+=("$line")
|
||||||
|
done < <(bkt -- brew list | grep '^php')
|
||||||
|
echo "${versions[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get installed php versions from brew and setup aliases
|
# Function to create aliases for each PHP version
|
||||||
php_versions=()
|
create_aliases()
|
||||||
while IFS="" read -r line; do php_versions+=("$line"); done < <(bkt -- brew list | grep '^php')
|
{
|
||||||
|
local php_versions=("$@")
|
||||||
|
local php_error_reporting='-d error_reporting=22527'
|
||||||
|
|
||||||
php_error_reporting='-d error_reporting=22527'
|
for version in "${php_versions[@]}"; do
|
||||||
|
[ "$VERBOSE" = "1" ] && echo "Setting aliases for $version"
|
||||||
|
|
||||||
for version in "${php_versions[@]}"; do
|
# Drop the dot from version (e.g., 8.0 -> 80)
|
||||||
[ "$VERBOSE" = "1" ] && echo "Setting aliases for $version"
|
local php_abbr="${version//\./}"
|
||||||
# drop the dot from version (8.0 -> 80)
|
# Replace "php@" with "p" so "php@80" becomes "p80"
|
||||||
php_abbr="${version//\./}"
|
local php_alias="${php_abbr//php@/p}"
|
||||||
# replace "php@" with "p" so "php@80" becomes "p80"
|
|
||||||
php_alias="${php_abbr//php@/p}"
|
|
||||||
|
|
||||||
# Fetch the exec path once
|
# Fetch the exec path once
|
||||||
php_exec="$HOMEBREW_PREFIX/opt/$version/bin/php"
|
local php_exec="$HOMEBREW_PREFIX/opt/$version/bin/php"
|
||||||
|
|
||||||
[ -f "$php_exec" ] && {
|
if [ -f "$php_exec" ]; then
|
||||||
[ "$VERBOSE" = "1" ] && echo "-> php_exec $php_exec"
|
[ "$VERBOSE" = "1" ] && echo "-> php_exec $php_exec"
|
||||||
|
|
||||||
# Raw PHP without error_reporting flag.
|
# Raw PHP without error_reporting flag.
|
||||||
# shellcheck disable=SC2139
|
alias "${php_alias}r"="$php_exec"
|
||||||
alias "${php_alias}"r="$php_exec"
|
|
||||||
# PHP with error_reporting flag.
|
# PHP with error_reporting flag.
|
||||||
# shellcheck disable=SC2139,SC2140
|
alias "$php_alias"="$php_exec $php_error_reporting"
|
||||||
alias "$php_alias"="$php_exec $php_error_reporting"
|
|
||||||
# Local PHP Server.
|
# Local PHP Server.
|
||||||
# shellcheck disable=SC2139,SC2140
|
alias "${php_alias}s"="$php_exec -S localhost:9000"
|
||||||
alias "${php_alias}s"="$php_exec -S localhost:9000"
|
|
||||||
# Use composer with specific PHP and error_reporting flag on.
|
# Use composer with specific PHP and error_reporting flag on.
|
||||||
# shellcheck disable=SC2139,SC2140
|
alias "${php_alias}c"="$php_exec $php_error_reporting $(which composer)"
|
||||||
alias "${php_alias}c"="$php_exec $php_error_reporting $(which composer)"
|
fi
|
||||||
}
|
done
|
||||||
done
|
}
|
||||||
|
|
||||||
|
# Main function
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
local php_versions
|
||||||
|
php_versions=($(get_php_versions))
|
||||||
|
create_aliases "${php_versions[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -6,47 +6,73 @@
|
|||||||
# Ismo Vuorinen <https://github.com/ivuorinen> 2023
|
# Ismo Vuorinen <https://github.com/ivuorinen> 2023
|
||||||
# MIT License
|
# MIT License
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
# ENV Variables
|
# ENV Variables
|
||||||
: "${VERBOSE:=0}" # VERBOSE=1 x-sha256sum-matcher file1 file2
|
: "${VERBOSE:=0}" # VERBOSE=1 x-sha256sum-matcher file1 file2
|
||||||
|
|
||||||
file_1="$1"
|
# Return sha256sum for file
|
||||||
file_2="$2"
|
|
||||||
|
|
||||||
# return sha256sum for file
|
|
||||||
# $1 - filename (string)
|
# $1 - filename (string)
|
||||||
get_sha256sum()
|
get_sha256sum()
|
||||||
{
|
{
|
||||||
sha256sum "$1" | head -c 64
|
sha256sum "$1" | head -c 64
|
||||||
}
|
}
|
||||||
|
|
||||||
[ $# -eq 0 ] && {
|
# Print message if VERBOSE is enabled
|
||||||
echo "Usage: $0 file1.sh file2.sh" && exit 1
|
# $1 - message (string)
|
||||||
}
|
|
||||||
|
|
||||||
msg()
|
msg()
|
||||||
{
|
{
|
||||||
[[ "$VERBOSE" -eq 1 ]] && echo "$1"
|
[[ "$VERBOSE" -eq 1 ]] && echo "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Print error message and exit
|
||||||
|
# $1 - error message (string)
|
||||||
error()
|
error()
|
||||||
{
|
{
|
||||||
msg "(!) ERROR: $1" && exit 1
|
msg "(!) ERROR: $1"
|
||||||
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ ! -f "$file_1" ]; then
|
# Validate input arguments
|
||||||
error "File 1 does not exist: $file_1"
|
validate_inputs()
|
||||||
fi
|
{
|
||||||
|
if [ "$#" -ne 2 ]; then
|
||||||
|
echo "Usage: $0 file1 file2"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [ ! -f "$file_2" ]; then
|
# Check if file exists
|
||||||
error "File 2 does not exist: $file_2"
|
# $1 - filename (string)
|
||||||
fi
|
check_file_exists()
|
||||||
|
{
|
||||||
|
local filename=$1
|
||||||
|
if [ ! -f "$filename" ]; then
|
||||||
|
error "File does not exist: $filename"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
file_1_hash=$(get_sha256sum "$file_1")
|
# Main function
|
||||||
file_2_hash=$(get_sha256sum "$file_2")
|
main()
|
||||||
|
{
|
||||||
|
local file_1=$1
|
||||||
|
local file_2=$2
|
||||||
|
|
||||||
if [ "$file_1_hash" != "$file_2_hash" ]; then
|
validate_inputs "$file_1" "$file_2"
|
||||||
error "Files do not match"
|
check_file_exists "$file_1"
|
||||||
else
|
check_file_exists "$file_2"
|
||||||
msg "(*) Success: Files do match"
|
|
||||||
exit 0
|
local file_1_hash
|
||||||
fi
|
local file_2_hash
|
||||||
|
|
||||||
|
file_1_hash=$(get_sha256sum "$file_1")
|
||||||
|
file_2_hash=$(get_sha256sum "$file_2")
|
||||||
|
|
||||||
|
if [ "$file_1_hash" != "$file_2_hash" ]; then
|
||||||
|
error "Files do not match"
|
||||||
|
else
|
||||||
|
msg "(*) Success: Files do match"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -1,39 +1,69 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Generate thumbnails using magick
|
# Generate thumbnails using ImageMagick (magick)
|
||||||
# https://imagemagick.org/script/download.php
|
# https://imagemagick.org/script/download.php
|
||||||
#
|
#
|
||||||
# Defaults to current directory creating thumbs with 1000x1000
|
# Defaults to current directory creating thumbnails with 1000x1000
|
||||||
# images with 200px white borders around the original image.
|
# dimensions and 200px white borders around the original image.
|
||||||
#
|
#
|
||||||
# Defaults can be overridden with ENV variables like this:
|
# Defaults can be overridden with ENV variables like this:
|
||||||
# $ THMB_BACKGROUND=black x-thumbgen ~/images/
|
# $ THMB_BACKGROUND=black x-thumbgen ~/images/
|
||||||
#
|
#
|
||||||
# Created by: Ismo Vuorinen <https://github.com/ivuorinen> 2015
|
# Created by: Ismo Vuorinen <https://github.com/ivuorinen> 2015
|
||||||
|
|
||||||
: "${THMB_SOURCE:=$1}"
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Default values
|
||||||
|
: "${THMB_SOURCE:=${1:-}}"
|
||||||
: "${THMB_BACKGROUND:=white}"
|
: "${THMB_BACKGROUND:=white}"
|
||||||
: "${THMB_RESIZE:=800x800}"
|
: "${THMB_RESIZE:=800x800}"
|
||||||
: "${THMB_EXTENT:=1000x1000}"
|
: "${THMB_EXTENT:=1000x1000}"
|
||||||
|
|
||||||
[ $# -eq 0 ] && {
|
# Print usage information
|
||||||
|
usage()
|
||||||
|
{
|
||||||
echo "Usage: $0 /full/path/to/image/folder"
|
echo "Usage: $0 /full/path/to/image/folder"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$THMB_SOURCE" == "" ] || [ ! -d "$THMB_SOURCE" ]; then
|
# Check if ImageMagick is installed
|
||||||
THMB_SOURCE=$(pwd)
|
check_magick_installed()
|
||||||
fi
|
{
|
||||||
|
if ! command -v magick &> /dev/null; then
|
||||||
|
echo "magick not found in PATH, https://imagemagick.org/script/download.php"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if command -v magick &> /dev/null; then
|
# Generate thumbnails
|
||||||
|
generate_thumbnails()
|
||||||
|
{
|
||||||
|
local source=$1
|
||||||
|
|
||||||
magick \
|
magick \
|
||||||
"$THMB_SOURCE/*" \
|
"${source}/*" \
|
||||||
-resize "$THMB_RESIZE" \
|
-resize "$THMB_RESIZE" \
|
||||||
-background "$THMB_BACKGROUND" \
|
-background "$THMB_BACKGROUND" \
|
||||||
-gravity center \
|
-gravity center \
|
||||||
-extent "$THMB_EXTENT" \
|
-extent "$THMB_EXTENT" \
|
||||||
-set filename:fname '%t_thumb.%e' +adjoin '%[filename:fname]'
|
-set filename:fname '%t_thumb.%e' +adjoin '%[filename:fname]'
|
||||||
|
}
|
||||||
|
|
||||||
else
|
# Main function
|
||||||
echo "magick not found in PATH, https://imagemagick.org/script/download.php"
|
main()
|
||||||
fi
|
{
|
||||||
|
# Validate input
|
||||||
|
if [ -z "$THMB_SOURCE" ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the source directory is valid
|
||||||
|
if [ ! -d "$THMB_SOURCE" ]; then
|
||||||
|
echo "Invalid directory: $THMB_SOURCE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
check_magick_installed
|
||||||
|
generate_thumbnails "$THMB_SOURCE"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
##
|
#
|
||||||
# This script contains helper for sha256 validating your downloads
|
# This script contains a helper for sha256 validating your downloads
|
||||||
#
|
#
|
||||||
# Source: https://gist.github.com/onnimonni/b49779ebc96216771a6be3de46449fa1
|
# Source: https://gist.github.com/onnimonni/b49779ebc96216771a6be3de46449fa1
|
||||||
# Author: Onni Hakala
|
# Author: Onni Hakala
|
||||||
@@ -9,44 +9,60 @@
|
|||||||
# Updated by Ismo Vuorinen <https://github.com/ivuorinen> 2022
|
# Updated by Ismo Vuorinen <https://github.com/ivuorinen> 2022
|
||||||
##
|
##
|
||||||
|
|
||||||
if ! command -v sha256 &> /dev/null; then
|
set -euo pipefail
|
||||||
echo "git could not be found, please install it first"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Stop program and give error message
|
# Stop program and give error message
|
||||||
# $1 - error message (string)
|
# $1 - error message (string)
|
||||||
function error
|
error()
|
||||||
{
|
{
|
||||||
echo "(!) ERROR: $1"
|
echo "(!) ERROR: $1" >&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# return sha256sum for file
|
# Check for sha256sum command
|
||||||
|
if ! command -v sha256sum &> /dev/null; then
|
||||||
|
error "sha256sum could not be found, please install it first"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Return sha256sum for file
|
||||||
# $1 - filename (string)
|
# $1 - filename (string)
|
||||||
function get_sha256sum
|
get_sha256sum()
|
||||||
{
|
{
|
||||||
sha256sum "$1" | head -c 64
|
sha256sum "$1" | head -c 64
|
||||||
}
|
}
|
||||||
|
|
||||||
# Good variable names pls
|
# Validate input arguments
|
||||||
filename=$1
|
validate_inputs()
|
||||||
file_hash=$2
|
{
|
||||||
|
if [ -z "${filename:-}" ]; then
|
||||||
|
error "You need to provide filename as the first parameter"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check input
|
if [ -z "${file_hash:-}" ]; then
|
||||||
if [ -z "$filename" ]; then
|
error "You need to provide sha256sum as the second parameter"
|
||||||
error "You need to provide filename in first parameter"
|
fi
|
||||||
fi
|
}
|
||||||
|
|
||||||
if [ -z "$file_hash" ]; then
|
# Main validation logic
|
||||||
error "You need to provide sha256sum in second parameter"
|
validate_file()
|
||||||
fi
|
{
|
||||||
|
if [ ! -f "$filename" ]; then
|
||||||
|
error "File $filename doesn't exist"
|
||||||
|
elif [ "$(get_sha256sum "$filename")" = "$file_hash" ]; then
|
||||||
|
echo "(*) Success: $filename matches provided sha256sum"
|
||||||
|
else
|
||||||
|
error "$filename doesn't match provided sha256sum"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Check if the file is valid
|
# Main function
|
||||||
if [ ! -f "$filename" ]; then
|
main()
|
||||||
error "File $filename doesn't exist"
|
{
|
||||||
elif [ "$(get_sha256sum "$filename")" = "$file_hash" ]; then
|
filename=$1
|
||||||
echo "(*) Success: $filename matches provided sha256sum"
|
file_hash=$2
|
||||||
else
|
|
||||||
error "$filename doesn't match provided sha256sum"
|
validate_inputs
|
||||||
fi
|
validate_file
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -10,23 +10,31 @@
|
|||||||
# ./when-down 1.2.3.4 ssh 1.2.3.4
|
# ./when-down 1.2.3.4 ssh 1.2.3.4
|
||||||
#
|
#
|
||||||
|
|
||||||
#
|
# Ensure we received the correct number of arguments.
|
||||||
# Ensure we received the correct number of arguments.
|
if [ "$#" -lt 2 ]; then
|
||||||
#
|
|
||||||
if [ $# -lt 2 ]; then
|
|
||||||
echo "Usage: $0 HOST COMMAND..."
|
echo "Usage: $0 HOST COMMAND..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
HOST=$1
|
wait_for_host_down()
|
||||||
|
{
|
||||||
|
local host=$1
|
||||||
|
|
||||||
echo "Waiting for $HOST to get down..."
|
echo "Waiting for $host to go down..."
|
||||||
|
|
||||||
true
|
while ping -c 1 -W 1 "$host" > /dev/null 2>&1; do
|
||||||
while [ $? -ne 1 ]; do
|
sleep 1
|
||||||
ping -c 1 -W 1 "$HOST" > /dev/null
|
done
|
||||||
done
|
}
|
||||||
|
|
||||||
shift
|
main()
|
||||||
|
{
|
||||||
|
local host=$1
|
||||||
|
shift
|
||||||
|
|
||||||
"$@"
|
wait_for_host_down "$host"
|
||||||
|
|
||||||
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -14,32 +14,46 @@
|
|||||||
# ./when-up ssh 1.2.3.4
|
# ./when-up ssh 1.2.3.4
|
||||||
#
|
#
|
||||||
|
|
||||||
#
|
# Ensure we received the correct number of arguments.
|
||||||
# Ensure we received the correct number of arguments.
|
if [ "$#" -lt 2 ]; then
|
||||||
#
|
|
||||||
if [ $# -lt 2 ]; then
|
|
||||||
echo "Usage: $0 HOST COMMAND..."
|
echo "Usage: $0 HOST COMMAND..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "ssh" ]; then
|
get_host()
|
||||||
HOST=$2
|
{
|
||||||
else
|
if [ "$1" = "ssh" ]; then
|
||||||
HOST=$1
|
echo "$2"
|
||||||
fi
|
else
|
||||||
|
echo "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
echo "Waiting for $HOST to come online..."
|
wait_for_host()
|
||||||
|
{
|
||||||
|
local host=$1
|
||||||
|
|
||||||
ping -c 1 -W 1 "$HOST" > /dev/null
|
echo "Waiting for $host to come online..."
|
||||||
while [ $? -ne 0 ]; do
|
|
||||||
sleep 1
|
|
||||||
ping -c 1 -W 1 "$HOST" > /dev/null
|
|
||||||
done
|
|
||||||
|
|
||||||
# By the time we reach here the ping-command has completed successfully
|
while ! ping -c 1 -W 1 "$host" > /dev/null 2>&1; do
|
||||||
# so we can launch the command we were given - along with any arguments.
|
sleep 1
|
||||||
if [ "$1" != "ssh" ]; then
|
done
|
||||||
shift
|
}
|
||||||
fi
|
|
||||||
|
|
||||||
"$@"
|
main()
|
||||||
|
{
|
||||||
|
local host
|
||||||
|
|
||||||
|
host=$(get_host "$@")
|
||||||
|
wait_for_host "$host"
|
||||||
|
|
||||||
|
if [ "$1" = "ssh" ]; then
|
||||||
|
shift 1
|
||||||
|
else
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -28,7 +28,8 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/ivuorinen/dotfiles#readme",
|
"homepage": "https://github.com/ivuorinen/dotfiles#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ivuorinen/base-configs": "^1.1.0"
|
"@ivuorinen/base-configs": "^2.0.0",
|
||||||
|
"prettier-plugin-sh": "^0.14.0"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@1.22.22"
|
"packageManager": "yarn@1.22.22"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,28 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Create file containing key mappings for Neovim
|
# Create file containing key mappings for Neovim
|
||||||
# Usage: ./create-nvim-keymaps.sh
|
# Usage: ./create-nvim-keymaps.sh
|
||||||
|
#
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
# shellcheck source=shared.sh
|
||||||
source "$HOME/.dotfiles/config/exports"
|
source "${DOTFILES}/config/shared.sh"
|
||||||
source "$HOME/.dotfiles/config/alias"
|
|
||||||
source "$HOME/.dotfiles/config/functions"
|
|
||||||
|
|
||||||
DEST="$HOME/.dotfiles/docs/nvim-keybindings.md"
|
DEST="$HOME/.dotfiles/docs/nvim-keybindings.md"
|
||||||
|
|
||||||
|
main()
|
||||||
{
|
{
|
||||||
printf "# nvim keybindings\n";
|
msg "Generating Neovim keybindings documentation"
|
||||||
printf "\n";
|
|
||||||
printf "\`\`\`txt";
|
|
||||||
} > "$DEST"
|
|
||||||
|
|
||||||
NVIM_APPNAME="nvim-kickstart" nvim -c "redir! >> $DEST" -c 'silent verbose map' -c 'redir END' -c 'q'
|
{
|
||||||
|
printf "# nvim keybindings\n\n"
|
||||||
|
printf "\`\`\`txt"
|
||||||
|
} > "$DEST"
|
||||||
|
|
||||||
printf "\n\`\`\`\n\n- Generated on %s\n" "$(date)" >> "$DEST"
|
NVIM_APPNAME="nvim-kickstart" nvim -c "redir! >> $DEST" -c 'silent verbose map' -c 'redir END' -c 'q'
|
||||||
|
|
||||||
# Remove lines with "Last set from" from the file
|
printf "\n\`\`\`\n\n- Generated on %s\n" "$(date)" >> "$DEST"
|
||||||
sed -e '/^ Last set from/d' "$DEST" > "$DEST.tmp" && mv "$DEST.tmp" "$DEST"
|
|
||||||
|
# Remove lines with "Last set from" from the file
|
||||||
|
sed -e '/^ Last set from/d' "$DEST" > "${DEST}.tmp" && mv "${DEST}.tmp" "$DEST"
|
||||||
|
|
||||||
|
msg "Neovim keybindings documentation generated at $DEST"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
|
# Export oh-my-posh configuration as an image
|
||||||
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
source "${DOTFILES}/config/shared.sh"
|
||||||
set -e
|
|
||||||
|
|
||||||
cd "$DOTFILES" || exit
|
main()
|
||||||
oh-my-posh config export image \
|
{
|
||||||
--config "$OHMYPOSH_CFG" \
|
cd "$DOTFILES" || msg_err "Failed to change directory to $DOTFILES"
|
||||||
--output "$HOME/.dotfiles/.github/screenshots/oh-my-posh.png" \
|
|
||||||
--author "Ismo Vuorinen"
|
oh-my-posh config export image \
|
||||||
|
--config "$OHMYPOSH_CFG" \
|
||||||
|
--output "$HOME/.dotfiles/.github/screenshots/oh-my-posh.png" \
|
||||||
|
--author "Ismo Vuorinen"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
25
scripts/create-wezterm-keymaps.sh
Executable file
25
scripts/create-wezterm-keymaps.sh
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Create file containing key mappings for wezterm
|
||||||
|
# Usage: ./create-wezterm-keymaps.sh
|
||||||
|
#
|
||||||
|
# shellcheck source=shared.sh
|
||||||
|
source "${DOTFILES}/config/shared.sh"
|
||||||
|
DEST="$HOME/.dotfiles/docs/wezterm-keybindings.md"
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
msg "Generating wezterm keybindings documentation"
|
||||||
|
|
||||||
|
{
|
||||||
|
printf "# wezterm keybindings\n\n"
|
||||||
|
printf "\`\`\`txt\n"
|
||||||
|
} > "$DEST"
|
||||||
|
|
||||||
|
wezterm show-keys >> "$DEST"
|
||||||
|
|
||||||
|
printf "\`\`\`\n\n- Generated on %s\n" "$(date)" >> "$DEST"
|
||||||
|
|
||||||
|
msg "wezterm keybindings documentation generated at $DEST"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
@@ -1,78 +1,107 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# Install asdf
|
# Install asdf
|
||||||
|
source "${DOTFILES}/config/shared.sh"
|
||||||
|
|
||||||
source "${XDG_CONFIG_HOME}/exports"
|
export ASDF_DIR="${XDG_BIN_HOME}/asdf"
|
||||||
source "${XDG_CONFIG_HOME}/alias"
|
export PATH="${ASDF_DIR}/bin:$PATH"
|
||||||
source "${XDG_CONFIG_HOME}/functions"
|
|
||||||
source "${DOTFILES}/scripts/shared.sh"
|
|
||||||
|
|
||||||
# Installation variables
|
|
||||||
ASDF_GIT="https://github.com/asdf-vm/asdf.git"
|
|
||||||
ASDF_PATH="${XDG_DATA_HOME}/asdf"
|
|
||||||
|
|
||||||
if [ ! -d "$ASDF_PATH" ]; then
|
|
||||||
git clone --depth 1 "$ASDF_GIT" "$ASDF_PATH" \
|
|
||||||
--branch v0.14.0
|
|
||||||
|
|
||||||
msg_done "asdf ($ASDF_PATH/) installed"
|
|
||||||
else
|
|
||||||
msg_done "asdf ($ASDF_PATH/) already installed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
export PATH="${ASDF_PATH}/bin:$PATH"
|
|
||||||
|
|
||||||
msg "Sourcing asdf in your shell"
|
msg "Sourcing asdf in your shell"
|
||||||
. "$ASDF_PATH/asdf.sh"
|
. "$ASDF_DIR/asdf.sh"
|
||||||
|
|
||||||
# Update asdf, and plugins
|
# Function to update asdf and plugins
|
||||||
asdf update
|
update_asdf()
|
||||||
|
{
|
||||||
|
asdf plugin add asdf-plugin-manager https://github.com/asdf-community/asdf-plugin-manager.git
|
||||||
|
asdf install asdf-plugin-manager latest
|
||||||
|
asdf global asdf-plugin-manager "$(asdf latest asdf-plugin-manager)"
|
||||||
|
asdf-plugin-manager version
|
||||||
|
asdf-plugin-manager add-all
|
||||||
|
|
||||||
asdf plugin add asdf-plugin-manager https://github.com/asdf-community/asdf-plugin-manager.git
|
asdf install
|
||||||
asdf install asdf-plugin-manager latest
|
|
||||||
asdf global asdf-plugin-manager "$(asdf latest asdf-plugin-manager)"
|
|
||||||
asdf-plugin-manager version
|
|
||||||
asdf-plugin-manager export > "${ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME}"
|
|
||||||
asdf-plugin-manager add-all
|
|
||||||
|
|
||||||
asdf install
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
# ASDF_INSTALLABLES=(
|
# Function to install asdf plugins
|
||||||
# "nodejs:github.com/asdf-vm/asdf-nodejs.git"
|
install_asdf_plugins()
|
||||||
# "1password-cli:github.com/NeoHsu/asdf-1password-cli.git"
|
{
|
||||||
# "age:github.com/threkk/asdf-age.git"
|
ASDF_INSTALLABLES=(
|
||||||
# "bottom:github.com/carbonteq/asdf-btm.git"
|
"1password-cli:github.com/NeoHsu/asdf-1password-cli.git"
|
||||||
# "dotenv-linter:github.com/wesleimp/asdf-dotenv-linter.git"
|
"age:github.com/threkk/asdf-age.git"
|
||||||
# "editorconfig-checker:github.com/gabitchov/asdf-editorconfig-checker.git"
|
"bottom:github.com/carbonteq/asdf-btm.git"
|
||||||
# "eza:github.com/lwiechec/asdf-eza.git"
|
"direnv:github.com/asdf-community/asdf-direnv.git"
|
||||||
# "fd:gitlab.com/wt0f/asdf-fd.git"
|
"dotenv-linter:github.com/wesleimp/asdf-dotenv-linter.git"
|
||||||
# "github-cli:github.com/bartlomiejdanek/asdf-github-cli.git"
|
"editorconfig-checker:github.com/gabitchov/asdf-editorconfig-checker.git"
|
||||||
# "hadolint:github.com/devlincashman/asdf-hadolint.git"
|
"eza:github.com/lwiechec/asdf-eza.git"
|
||||||
# "kubectl:github.com/asdf-community/asdf-kubectl.git"
|
"fd:gitlab.com/wt0f/asdf-fd.git"
|
||||||
# "lazygit:github.com/nklmilojevic/asdf-lazygit.git"
|
"github-cli:github.com/bartlomiejdanek/asdf-github-cli.git"
|
||||||
# "pipx:github.com/yozachar/asdf-pipx.git"
|
"golang:github.com/asdf-community/asdf-golang.git"
|
||||||
# "pre-commit:github.com/jonathanmorley/asdf-pre-commit.git"
|
"hadolint:github.com/devlincashman/asdf-hadolint.git"
|
||||||
# "ripgrep:gitlab.com/wt0f/asdf-ripgrep.git"
|
"kubectl:github.com/asdf-community/asdf-kubectl.git"
|
||||||
# "semgrep:github.com/brentjanderson/asdf-semgrep.git"
|
"lazygit:github.com/nklmilojevic/asdf-lazygit.git"
|
||||||
# "terraform-ls:github.com/asdf-community/asdf-hashicorp.git"
|
"markdownlint-cli2:github.com/paulo-ferraz-oliveira/asdf-markdownlint-cli2.git"
|
||||||
# "vault:github.com/asdf-community/asdf-hashicorp.git"
|
"nodejs:github.com/asdf-vm/asdf-nodejs.git"
|
||||||
# "shellcheck:github.com/luizm/asdf-shellcheck.git"
|
"pipx:github.com/yozachar/asdf-pipx.git"
|
||||||
# "shfmt:github.com/luizm/asdf-shfmt.git"
|
"pre-commit:github.com/jonathanmorley/asdf-pre-commit.git"
|
||||||
# "terraform-lsp:github.com/bartlomiejdanek/asdf-terraform-lsp.git"
|
"python:github.com/asdf-community/asdf-python.git"
|
||||||
# "terragrunt:github.com/ohmer/asdf-terragrunt.git"
|
"ripgrep:gitlab.com/wt0f/asdf-ripgrep.git"
|
||||||
# "tf-summarize:github.com/adamcrews/asdf-tf-summarize.git"
|
"rust:github.com/code-lever/asdf-rust.git"
|
||||||
# "yamllint:github.com/ericcornelissen/asdf-yamllint.git"
|
"semgrep:github.com/brentjanderson/asdf-semgrep.git"
|
||||||
# "yq:github.com/sudermanjr/asdf-yq.git"
|
"shellcheck:github.com/luizm/asdf-shellcheck.git"
|
||||||
# )
|
"shfmt:github.com/luizm/asdf-shfmt.git"
|
||||||
#
|
"terragrunt:github.com/ohmer/asdf-terragrunt.git"
|
||||||
# msg "Installing asdf plugins, if not already installed"
|
"tf-summarize:github.com/adamcrews/asdf-tf-summarize.git"
|
||||||
# for item in "${ASDF_INSTALLABLES[@]}"; do
|
"vault:github.com/asdf-community/asdf-hashicorp.git"
|
||||||
# CMD=$(echo "${item}" | awk -F ":" '{print $1}')
|
"yamllint:github.com/ericcornelissen/asdf-yamllint.git"
|
||||||
# URL=$(echo "${item}" | awk -F ":" '{print $2}')
|
"yq:github.com/sudermanjr/asdf-yq.git"
|
||||||
# asdf plugin add "${CMD}" "https://${URL}"
|
)
|
||||||
# asdf install "${CMD}" latest
|
|
||||||
# asdf global "${CMD}" "$(asdf latest "${CMD}")"
|
|
||||||
# done
|
|
||||||
|
|
||||||
msg "Reshim asdf"
|
msg "Installing asdf plugins"
|
||||||
asdf reshim
|
for item in "${ASDF_INSTALLABLES[@]}"; do
|
||||||
|
CMD=$(echo "${item}" | awk -F ":" '{print $1}')
|
||||||
|
URL=$(echo "${item}" | awk -F ":" '{print $2}')
|
||||||
|
|
||||||
|
asdf plugin add "${CMD}" "https://${URL}"
|
||||||
|
asdf install "${CMD}" latest
|
||||||
|
asdf global "${CMD}" "$(asdf latest "${CMD}")"
|
||||||
|
done
|
||||||
|
|
||||||
|
msg "Exporting asdf plugin versions"
|
||||||
|
asdf-plugin-manager export > "${XDG_CONFIG_HOME}/asdf/plugin-versions"
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
reshim()
|
||||||
|
{
|
||||||
|
msg "Reshim asdf"
|
||||||
|
asdf reshim
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# create usage function
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
echo "Usage: $0 [install|add_plugins]"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
case $1 in
|
||||||
|
"install")
|
||||||
|
update_asdf
|
||||||
|
reshim
|
||||||
|
;;
|
||||||
|
"add_plugins")
|
||||||
|
install_asdf_plugins
|
||||||
|
reshim
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -2,33 +2,18 @@
|
|||||||
# Install cargo/rust packages.
|
# Install cargo/rust packages.
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "$HOME/.dotfiles/config/exports"
|
eval "$HOME/.dotfiles/config/shared.sh"
|
||||||
source "$HOME/.dotfiles/config/alias"
|
|
||||||
source "$HOME/.dotfiles/config/functions"
|
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
|
||||||
|
|
||||||
msg "Starting to install rust/cargo packages"
|
msg "Starting to install rust/cargo packages"
|
||||||
|
|
||||||
! x-have cargo && {
|
|
||||||
msg "cargo could not be found. installing cargo with rustup.rs"
|
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path -y
|
|
||||||
}
|
|
||||||
|
|
||||||
source "$CARGO_HOME/env"
|
source "$CARGO_HOME/env"
|
||||||
|
|
||||||
! x-have rustup && {
|
|
||||||
msg_err "rustup could not be found. Aborting..."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
rustup default stable
|
|
||||||
|
|
||||||
# If we have cargo install-update, use it first
|
# If we have cargo install-update, use it first
|
||||||
x-have cargo-install-update && {
|
if command -v cargo-install-update &> /dev/null; then
|
||||||
msg_run "Updating cargo packages with cargo install-update"
|
msg_run "Updating cargo packages with cargo install-update"
|
||||||
cargo install-update -a
|
cargo install-update -a
|
||||||
msg_done "Done with cargo install-update"
|
msg_done "Done with cargo install-update"
|
||||||
}
|
fi
|
||||||
|
|
||||||
packages=(
|
packages=(
|
||||||
# A cargo subcommand for checking and applying
|
# A cargo subcommand for checking and applying
|
||||||
@@ -57,28 +42,41 @@ packages=(
|
|||||||
# Number of jobs to run in parallel, this helps to keep the system responsive
|
# Number of jobs to run in parallel, this helps to keep the system responsive
|
||||||
BUILD_JOBS=$(nproc --ignore=2)
|
BUILD_JOBS=$(nproc --ignore=2)
|
||||||
|
|
||||||
for pkg in "${packages[@]}"; do
|
# Function to install cargo packages
|
||||||
# Trim spaces
|
install_packages()
|
||||||
pkg=${pkg// /}
|
{
|
||||||
# Skip comments
|
for pkg in "${packages[@]}"; do
|
||||||
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
|
# Trim spaces
|
||||||
|
pkg=${pkg// /}
|
||||||
|
# Skip comments
|
||||||
|
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
|
||||||
|
|
||||||
msg_run "Installing cargo package $pkg"
|
msg_run "Installing cargo package $pkg"
|
||||||
cargo install --jobs $BUILD_JOBS "$pkg"
|
cargo install --jobs $BUILD_JOBS "$pkg"
|
||||||
|
echo ""
|
||||||
echo ""
|
done
|
||||||
done
|
|
||||||
|
|
||||||
msg_done "Installed cargo packages!"
|
|
||||||
|
|
||||||
msg_run "Now doing the next steps for cargo packages"
|
|
||||||
|
|
||||||
# use bob to install latest stable nvim
|
|
||||||
x-have bob && {
|
|
||||||
bob use stable && x-path-append "$XDG_DATA_HOME/bob/nvim-bin"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_run "Removing cargo cache"
|
# Function to perform additional steps for installed cargo packages
|
||||||
cargo cache --autoclean
|
post_install_steps()
|
||||||
msg_done "Done removing cargo cache"
|
{
|
||||||
|
msg_run "Now doing the next steps for cargo packages"
|
||||||
|
|
||||||
|
# use bob to install latest stable nvim
|
||||||
|
if command -v bob &> /dev/null; then
|
||||||
|
bob use stable && x-path-append "$XDG_DATA_HOME/bob/nvim-bin"
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg_run "Removing cargo cache"
|
||||||
|
cargo cache --autoclean
|
||||||
|
msg_done "Done removing cargo cache"
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
install_packages
|
||||||
|
msg_done "Installed cargo packages!"
|
||||||
|
post_install_steps
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -1,58 +1,83 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck disable=SC2231,SC2034,SC2181,SC2068
|
# shellcheck disable=SC2231,SC2034,SC2181,SC2068
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
source "${DOTFILES}/config/shared.sh"
|
||||||
|
|
||||||
PBB_REQUIRED_TOOLS=(git cheat)
|
PBB_REQUIRED_TOOLS=(git cheat)
|
||||||
for t in ${PBB_REQUIRED_TOOLS[@]}; do
|
|
||||||
! x-have "$t" && echo "(!) $t is missing, can't continue..." && exit 1
|
|
||||||
done
|
|
||||||
|
|
||||||
PBB_GIT="https://github.com/dylanaraps/pure-bash-bible.git"
|
PBB_GIT="https://github.com/dylanaraps/pure-bash-bible.git"
|
||||||
PBB_SOURCE="source: $PBB_GIT"
|
PBB_SOURCE="source: $PBB_GIT"
|
||||||
PBB_SYNTAX="syntax: bash"
|
PBB_SYNTAX="syntax: bash"
|
||||||
PBB_TAGS="tags: [bash]"
|
PBB_TAGS="tags: [bash]"
|
||||||
|
PBB_TEMP_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/cheat/pbb"
|
||||||
|
|
||||||
PBB_TEMP_PREFIX=$(basename "$0")
|
check_required_tools()
|
||||||
PBB_TEMP_DIR="$XDG_CACHE_HOME/cheat/pbb"
|
{
|
||||||
|
for t in "${PBB_REQUIRED_TOOLS[@]}"; do
|
||||||
|
if ! x-have "$t"; then
|
||||||
|
echo "(!) $t is missing, can't continue..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# If there's no .git, clone the folder
|
clone_or_update_repo()
|
||||||
if [ ! -d "$PBB_TEMP_DIR/.git" ]; then
|
{
|
||||||
msg_run "Starting to clone $PBB_GIT"
|
if [ ! -d "$PBB_TEMP_DIR/.git" ]; then
|
||||||
git clone --depth 1 --single-branch -q "$PBB_GIT" "$PBB_TEMP_DIR" \
|
msg_run "Starting to clone $PBB_GIT"
|
||||||
&& msg_yay "Cloned $PBB_GIT"
|
git clone --depth 1 --single-branch -q "$PBB_GIT" "$PBB_TEMP_DIR" \
|
||||||
else
|
&& msg_yay "Cloned $PBB_GIT"
|
||||||
# Update the repo
|
else
|
||||||
msg_run "Starting to update $PBB_GIT"
|
msg_run "Starting to update $PBB_GIT"
|
||||||
git -C "$PBB_TEMP_DIR" reset --hard origin/master
|
git -C "$PBB_TEMP_DIR" reset --hard origin/master
|
||||||
git -C "$PBB_TEMP_DIR" pull -q \
|
git -C "$PBB_TEMP_DIR" pull -q \
|
||||||
&& msg_yay "Updated $PBB_GIT"
|
&& msg_yay "Updated $PBB_GIT"
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
PBB_CHAPTERS=$(ls -1v "$PBB_TEMP_DIR"/manuscript/chapter*)
|
prepare_cheat_dest()
|
||||||
CHEAT_DEST="$(cheat -d | grep pure-bash-bible | head -1 | awk '{print $2}')"
|
{
|
||||||
|
local cheat_dest
|
||||||
|
cheat_dest="$(cheat -d | grep pure-bash-bible | head -1 | awk '{print $2}')"
|
||||||
|
|
||||||
if [ ! -d "$CHEAT_DEST" ]; then
|
if [ ! -d "$cheat_dest" ]; then
|
||||||
mkdir -p "$CHEAT_DEST"
|
mkdir -p "$cheat_dest"
|
||||||
fi
|
|
||||||
|
|
||||||
for f in ${PBB_CHAPTERS[@]}; do
|
|
||||||
# get all headers, take the first one, strip the # and return the first word in lowercase
|
|
||||||
HEADER=$(grep -e '^[#] ' "$f" | head -1 | awk '{print tolower($2)}')
|
|
||||||
CHEAT_FILE="$CHEAT_DEST/${HEADER}"
|
|
||||||
|
|
||||||
replacable "$f" "$CHEAT_FILE"
|
|
||||||
override=$?
|
|
||||||
if [ "$override" -ne 1 ]; then
|
|
||||||
cp "$f" "$CHEAT_FILE" && msg_run "Updated: $CHEAT_FILE"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LC_ALL=C perl -pi.bak -e 's/\<\!-- CHAPTER END --\>//' "$CHEAT_FILE"
|
echo "$cheat_dest"
|
||||||
rm "$CHEAT_FILE.bak"
|
}
|
||||||
|
|
||||||
# add tags if the file doesn't have them
|
process_chapters()
|
||||||
if [ '---' != "$(head -1 < "$CHEAT_FILE")" ]; then
|
{
|
||||||
T="$PBB_SYNTAX\n$PBB_TAGS\n$PBB_SOURCE\n"
|
local cheat_dest
|
||||||
echo -e "---\n$T---\n$(cat "$CHEAT_FILE")" > "$CHEAT_FILE"
|
cheat_dest=$(prepare_cheat_dest)
|
||||||
fi
|
|
||||||
done
|
mapfile -t PBB_CHAPTERS < <(ls -1v "$PBB_TEMP_DIR"/manuscript/chapter*)
|
||||||
|
|
||||||
|
for f in "${PBB_CHAPTERS[@]}"; do
|
||||||
|
local header cheat_file
|
||||||
|
header=$(grep -e '^[#] ' "$f" | head -1 | awk '{print tolower($2)}')
|
||||||
|
cheat_file="$cheat_dest/$header"
|
||||||
|
|
||||||
|
if ! replacable "$f" "$cheat_file"; then
|
||||||
|
cp "$f" "$cheat_file" && msg_run "Updated: $cheat_file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
LC_ALL=C perl -pi.bak -e 's/\<\!-- CHAPTER END --\>//' "$cheat_file"
|
||||||
|
rm "$cheat_file.bak"
|
||||||
|
|
||||||
|
if [ '---' != "$(head -1 < "$cheat_file")" ]; then
|
||||||
|
local metadata
|
||||||
|
metadata="$PBB_SYNTAX\n$PBB_TAGS\n$PBB_SOURCE\n"
|
||||||
|
echo -e "---\n$metadata---\n$(cat "$cheat_file")" > "$cheat_file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
check_required_tools
|
||||||
|
clone_or_update_repo
|
||||||
|
process_chapters
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -2,9 +2,12 @@
|
|||||||
# Install PHP Package Manager Composer
|
# Install PHP Package Manager Composer
|
||||||
#
|
#
|
||||||
# shellcheck source="shared.sh"
|
# shellcheck source="shared.sh"
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
eval "$HOME/.dotfiles/config/shared.sh"
|
||||||
|
|
||||||
! x-have "php" && msg_err "PHP Not Available, cannot install composer" && exit 0
|
if ! command -v php &> /dev/null; then
|
||||||
|
msg_err "PHP Not Available, cannot install composer"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
|
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
|
||||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Install NerdFonts
|
# Install NerdFonts
|
||||||
#
|
#
|
||||||
# shellcheck source="shared.sh"
|
# shellcheck source="shared.sh"
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
source "$DOTFILES/config/shared.sh"
|
||||||
|
|
||||||
GIT_REPO="https://github.com/ryanoasis/nerd-fonts.git"
|
GIT_REPO="https://github.com/ryanoasis/nerd-fonts.git"
|
||||||
TMP_PATH="$XDG_CACHE_HOME/nerd-fonts"
|
TMP_PATH="$XDG_CACHE_HOME/nerd-fonts"
|
||||||
@@ -17,28 +17,50 @@ fonts=(
|
|||||||
SpaceMono
|
SpaceMono
|
||||||
)
|
)
|
||||||
|
|
||||||
if [ ! -d "$TMP_PATH" ]; then
|
# Function to clone or update the NerdFonts repository
|
||||||
git clone --filter=blob:none --sparse "$GIT_REPO" "$TMP_PATH"
|
clone_or_update_repo()
|
||||||
fi
|
{
|
||||||
|
if [ ! -d "$TMP_PATH" ]; then
|
||||||
|
git clone --quiet --filter=blob:none --sparse "$GIT_REPO" "$TMP_PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
cd "$TMP_PATH" || {
|
cd "$TMP_PATH" || msg_err "No such folder $TMP_PATH"
|
||||||
msg_err "No such folder $TMP_PATH"
|
|
||||||
exit 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for ext in "${fonts[@]}"; do
|
# Function to add fonts to sparse-checkout
|
||||||
# Trim spaces
|
add_fonts_to_sparse_checkout()
|
||||||
ext=${ext// /}
|
{
|
||||||
# Skip comments
|
for font in "${fonts[@]}"; do
|
||||||
if [[ ${ext:0:1} == "#" ]]; then continue; fi
|
# Trim spaces
|
||||||
|
font=${font// /}
|
||||||
|
# Skip comments
|
||||||
|
if [[ ${font:0:1} == "#" ]]; then continue; fi
|
||||||
|
|
||||||
msg_run "Adding $ext to sparse-checkout"
|
msg_run "Adding $font to sparse-checkout"
|
||||||
git sparse-checkout add "patched-fonts/$ext"
|
git sparse-checkout add "patched-fonts/$font"
|
||||||
echo ""
|
echo ""
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
msg "Starting to install NerdFonts..."
|
# Function to install NerdFonts
|
||||||
|
install_fonts()
|
||||||
|
{
|
||||||
|
msg "Starting to install NerdFonts..."
|
||||||
|
./install.sh -q -s ${fonts[*]}
|
||||||
|
msg_ok "Done"
|
||||||
|
}
|
||||||
|
|
||||||
./install.sh -s ${fonts[*]}
|
remove_tmp_path()
|
||||||
|
{
|
||||||
|
rm -rf "$TMP_PATH"
|
||||||
|
}
|
||||||
|
|
||||||
msg_ok "Done"
|
main()
|
||||||
|
{
|
||||||
|
clone_or_update_repo
|
||||||
|
add_fonts_to_sparse_checkout
|
||||||
|
install_fonts
|
||||||
|
remove_tmp_path
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -3,17 +3,23 @@
|
|||||||
# Install fzf
|
# Install fzf
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
eval "$DOTFILES/config/shared.sh"
|
||||||
|
|
||||||
FZF_GIT="https://github.com/junegunn/fzf.git"
|
FZF_GIT="https://github.com/junegunn/fzf.git"
|
||||||
FZF_PATH="${XDG_CONFIG_HOME}/fzf"
|
FZF_PATH="${XDG_CONFIG_HOME}/fzf"
|
||||||
FZF_BUILD="/tmp/fzf"
|
FZF_BUILD="/tmp/fzf"
|
||||||
|
|
||||||
if [ ! -d "$FZF_BUILD" ]; then
|
main()
|
||||||
git clone --depth 1 "$FZF_GIT" "$FZF_BUILD"
|
{
|
||||||
"$FZF_BUILD/install" \
|
if [ ! -d "$FZF_BUILD" ]; then
|
||||||
--xdg \
|
git clone --depth 1 "$FZF_GIT" "$FZF_BUILD"
|
||||||
--bin
|
"$FZF_BUILD/install" \
|
||||||
else
|
--xdg \
|
||||||
msg_done "fzf ($FZF_PATH/) already installed"
|
--bin
|
||||||
fi
|
msg_done "fzf installed"
|
||||||
|
else
|
||||||
|
msg_done "fzf ($FZF_PATH/) already installed"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -2,13 +2,17 @@
|
|||||||
# Install GitHub CLI extensions
|
# Install GitHub CLI extensions
|
||||||
#
|
#
|
||||||
# shellcheck source="shared.sh"
|
# shellcheck source="shared.sh"
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
source "${DOTFILES}/config/shared.sh"
|
||||||
|
|
||||||
|
# Enable verbosity with VERBOSE=1
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
msg_run "Installing gh (GitHub Client) extensions"
|
msg_run "Installing gh (GitHub Client) extensions"
|
||||||
|
|
||||||
! x-have "gh" \
|
if ! command -v gh &> /dev/null; then
|
||||||
&& msg_err "gh (GitHub Client) could not be found, please install it first" \
|
msg_err "gh (GitHub Client) could not be found, please install it first"
|
||||||
&& exit 0
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
extensions=(
|
extensions=(
|
||||||
# GitHub CLI extension for generating a report on repository dependencies.
|
# GitHub CLI extension for generating a report on repository dependencies.
|
||||||
@@ -30,15 +34,25 @@ extensions=(
|
|||||||
rsese/gh-actions-status
|
rsese/gh-actions-status
|
||||||
)
|
)
|
||||||
|
|
||||||
for ext in "${extensions[@]}"; do
|
# Function to install GitHub CLI extensions
|
||||||
# Trim spaces
|
install_extensions()
|
||||||
ext=${ext// /}
|
{
|
||||||
# Skip comments
|
for ext in "${extensions[@]}"; do
|
||||||
if [[ ${ext:0:1} == "#" ]]; then continue; fi
|
# Trim spaces
|
||||||
|
ext=${ext// /}
|
||||||
|
# Skip comments
|
||||||
|
if [[ ${ext:0:1} == "#" ]]; then continue; fi
|
||||||
|
|
||||||
msg_nested "Installing $ext"
|
msg_nested "Installing $ext"
|
||||||
gh extensions install "$ext"
|
gh extension install "$ext"
|
||||||
echo ""
|
echo ""
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
msg_ok "Done"
|
main()
|
||||||
|
{
|
||||||
|
install_extensions
|
||||||
|
msg_ok "Done"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -4,12 +4,14 @@
|
|||||||
# NOTE: Experimental, wip
|
# NOTE: Experimental, wip
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
source "${DOTFILES}/config/shared.sh"
|
||||||
|
|
||||||
|
# Enable verbosity with VERBOSE=1
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
msg_run "Installing git-crypt"
|
msg_run "Installing git-crypt"
|
||||||
|
|
||||||
x-have "git-crypt" || {
|
if ! command -v git-crypt &> /dev/null; then
|
||||||
|
|
||||||
REPO_URL="https://github.com/AGWA/git-crypt.git"
|
REPO_URL="https://github.com/AGWA/git-crypt.git"
|
||||||
CHECK_PATH="${XDG_BIN_HOME}/git-crypt"
|
CHECK_PATH="${XDG_BIN_HOME}/git-crypt"
|
||||||
BUILD_PATH="/tmp/git-crypt"
|
BUILD_PATH="/tmp/git-crypt"
|
||||||
@@ -23,5 +25,6 @@ x-have "git-crypt" || {
|
|||||||
else
|
else
|
||||||
msg_done "git-crypt ($CHECK_PATH) already installed"
|
msg_done "git-crypt ($CHECK_PATH) already installed"
|
||||||
fi
|
fi
|
||||||
}
|
fi
|
||||||
|
|
||||||
msg_done "Done installing git-crypt"
|
msg_done "Done installing git-crypt"
|
||||||
|
|||||||
@@ -2,7 +2,10 @@
|
|||||||
# Install Go packages
|
# Install Go packages
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
eval "$DOTFILES/config/shared.sh"
|
||||||
|
|
||||||
|
# Enable verbosity with VERBOSE=1
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
msg_run "Installing go packages"
|
msg_run "Installing go packages"
|
||||||
|
|
||||||
@@ -33,32 +36,50 @@ packages=(
|
|||||||
github.com/doron-cohen/antidot@latest
|
github.com/doron-cohen/antidot@latest
|
||||||
)
|
)
|
||||||
|
|
||||||
for pkg in "${packages[@]}"; do
|
# Function to install go packages
|
||||||
# Trim spaces
|
install_packages()
|
||||||
pkg=${pkg// /}
|
{
|
||||||
# Skip comments
|
for pkg in "${packages[@]}"; do
|
||||||
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
|
# Trim spaces
|
||||||
|
pkg=${pkg// /}
|
||||||
|
# Skip comments
|
||||||
|
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
|
||||||
|
|
||||||
msg_nested "Installing go package: $pkg"
|
msg_nested "Installing go package: $pkg"
|
||||||
go install "$pkg"
|
go install "$pkg"
|
||||||
echo ""
|
echo ""
|
||||||
done
|
done
|
||||||
|
|
||||||
msg_run "Installing completions for selected packages"
|
|
||||||
|
|
||||||
x-have git-profile && {
|
|
||||||
git-profile completion zsh > "$ZSH_CUSTOM_COMPLETION_PATH/_git-profile" \
|
|
||||||
&& msg_ok "Installed completions for git-profile"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
x-have antidot && {
|
# Function to install completions and run actions for selected packages
|
||||||
antidot update \
|
post_install()
|
||||||
&& msg_ok "Updated antidot database"
|
{
|
||||||
|
msg_run "Installing completions for selected packages"
|
||||||
|
|
||||||
|
if command -v git-profile &> /dev/null; then
|
||||||
|
git-profile completion zsh > "$ZSH_CUSTOM_COMPLETION_PATH/_git-profile" \
|
||||||
|
&& msg_ok "Installed completions for git-profile"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v antidot &> /dev/null; then
|
||||||
|
antidot update \
|
||||||
|
&& msg_ok "Updated antidot database"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
echo ""
|
# Function to clear go cache
|
||||||
|
clear_go_cache()
|
||||||
|
{
|
||||||
|
msg_run "Clearing go cache"
|
||||||
|
go clean -cache -modcache
|
||||||
|
}
|
||||||
|
|
||||||
msg_run "Clearing go cache"
|
main()
|
||||||
go clean -cache -modcache
|
{
|
||||||
|
install_packages
|
||||||
|
post_install
|
||||||
|
clear_go_cache
|
||||||
|
msg_ok "Done"
|
||||||
|
}
|
||||||
|
|
||||||
msg_ok "Done"
|
main "$@"
|
||||||
|
|||||||
@@ -3,23 +3,71 @@
|
|||||||
# Install neofetch from source
|
# Install neofetch from source
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
source "$DOTFILES/config/shared.sh"
|
||||||
|
|
||||||
NEOFETCH_VERSION="7.1.0"
|
if ! declare -f msg > /dev/null; then
|
||||||
|
# Function to print messages if VERBOSE is enabled
|
||||||
|
# $1 - message (string)
|
||||||
|
msg()
|
||||||
|
{
|
||||||
|
[ "$VERBOSE" -eq 1 ] && echo "$1"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! declare -f msg_err > /dev/null; then
|
||||||
|
# Function to print error messages and exit
|
||||||
|
# $1 - error message (string)
|
||||||
|
msg_err()
|
||||||
|
{
|
||||||
|
echo "(!) ERROR: $1" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! declare -f msg_done > /dev/null; then
|
||||||
|
# Function to print done message
|
||||||
|
# $1 - message (string)
|
||||||
|
msg_done()
|
||||||
|
{
|
||||||
|
echo "✓ $1"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
NEOFETCH_VERSION="$(x-gh-get-latest-version dylanaraps/neofetch)"
|
||||||
NEOFETCH_REPO="https://github.com/dylanaraps/neofetch"
|
NEOFETCH_REPO="https://github.com/dylanaraps/neofetch"
|
||||||
NEOFETCH_URL="${NEOFETCH_REPO}/archive/refs/tags/${NEOFETCH_VERSION}.tar.gz"
|
NEOFETCH_URL="${NEOFETCH_REPO}/archive/refs/tags/${NEOFETCH_VERSION}.tar.gz"
|
||||||
NEOFETCH_TEMP="/tmp/neofetch"
|
NEOFETCH_TEMP="/tmp/neofetch"
|
||||||
NEOFETCH_INSTALL_PREFIX="$HOME/.local"
|
NEOFETCH_INSTALL_PREFIX="$HOME/.local"
|
||||||
|
|
||||||
x-have "neofetch" || {
|
# Enable verbosity with VERBOSE=1
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
|
# Function to install neofetch from source
|
||||||
|
install_neofetch()
|
||||||
|
{
|
||||||
LC_ALL=C
|
LC_ALL=C
|
||||||
|
|
||||||
mkdir -p "$NEOFETCH_TEMP" "$NEOFETCH_INSTALL_PREFIX"
|
mkdir -p "$NEOFETCH_TEMP" "$NEOFETCH_INSTALL_PREFIX"
|
||||||
|
|
||||||
curl -L "$NEOFETCH_URL" > "$NEOFETCH_TEMP.tar.gz"
|
curl -L "$NEOFETCH_URL" -o "$NEOFETCH_TEMP.tar.gz"
|
||||||
tar zxvf "$NEOFETCH_TEMP.tar.gz" --directory="$NEOFETCH_TEMP"
|
tar zxvf "$NEOFETCH_TEMP.tar.gz" --directory="$NEOFETCH_TEMP"
|
||||||
cd "$NEOFETCH_TEMP/neofetch-$NEOFETCH_VERSION" \
|
cd "$NEOFETCH_TEMP/neofetch-$NEOFETCH_VERSION" \
|
||||||
&& make PREFIX="${NEOFETCH_INSTALL_PREFIX}" install \
|
&& make PREFIX="${NEOFETCH_INSTALL_PREFIX}" install \
|
||||||
&& rm -rf "$NEOFETCH_TEMP*" \
|
&& rm -rf "$NEOFETCH_TEMP*" \
|
||||||
&& msg_yay "neofetch installed!"
|
&& msg_yay "neofetch installed!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
if ! command -v neofetch &> /dev/null; then
|
||||||
|
install_neofetch
|
||||||
|
elif [ "$NEOFETCH_VERSION" != "$(neofetch --version | awk '{print $2}')" ]; then
|
||||||
|
install_neofetch
|
||||||
|
else
|
||||||
|
msg_done "neofetch v.${NEOFETCH_VERSION} already installed"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -2,11 +2,17 @@
|
|||||||
# Install npm packages globally.
|
# Install npm packages globally.
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
eval "$DOTFILES/config/shared.sh"
|
||||||
|
|
||||||
|
# Enable verbosity with VERBOSE=1
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
msg "Starting to install npm packages"
|
msg "Starting to install npm packages"
|
||||||
|
|
||||||
! x-have "npm" && msg_err "npm could not be found." && exit 0
|
if ! command -v npm &> /dev/null; then
|
||||||
|
msg_err "npm could not be found."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
packages=(
|
packages=(
|
||||||
# This is a tool to check if your files consider your .editorconfig rules.
|
# This is a tool to check if your files consider your .editorconfig rules.
|
||||||
@@ -18,27 +24,48 @@ packages=(
|
|||||||
"corepack"
|
"corepack"
|
||||||
)
|
)
|
||||||
|
|
||||||
for pkg in "${packages[@]}"; do
|
# Function to install npm packages
|
||||||
# Trim spaces
|
install_packages()
|
||||||
pkg=${pkg// /}
|
{
|
||||||
# Skip comments
|
for pkg in "${packages[@]}"; do
|
||||||
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
|
# Trim spaces
|
||||||
|
pkg=${pkg// /}
|
||||||
|
# Skip comments
|
||||||
|
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
|
||||||
|
|
||||||
if [[ $(npm ls -g -p "$pkg") != "" ]]; then
|
if npm ls -g -p "$pkg" &> /dev/null; then
|
||||||
msg_run_done "$pkg" "already installed"
|
msg_run_done "$pkg" "already installed"
|
||||||
else
|
else
|
||||||
msg_run "Installing npm package:" "$pkg"
|
msg_run "Installing npm package:" "$pkg"
|
||||||
npm install -g --no-fund --no-progress --no-timing "$pkg"
|
npm install -g --no-fund --no-progress --no-timing "$pkg"
|
||||||
fi
|
fi
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
echo ""
|
# Function to upgrade all global npm packages
|
||||||
done
|
upgrade_global_packages()
|
||||||
|
{
|
||||||
|
msg_run "Upgrading all global packages"
|
||||||
|
npm -g --no-progress --no-timing --no-fund outdated
|
||||||
|
npm -g --no-timing --no-fund upgrade
|
||||||
|
}
|
||||||
|
|
||||||
msg_run "Upgrading all global packages"
|
# Function to clean npm cache
|
||||||
npm -g --no-progress --no-timing --no-fund outdated
|
clean_npm_cache()
|
||||||
npm -g --no-timing --no-fund upgrade
|
{
|
||||||
|
msg_run "Cleaning up npm cache"
|
||||||
|
npm cache verify
|
||||||
|
npm cache clean --force
|
||||||
|
npm cache verify
|
||||||
|
}
|
||||||
|
|
||||||
msg_run "Cleaning up npm cache"
|
main()
|
||||||
npm cache verify
|
{
|
||||||
npm cache clean --force
|
install_packages
|
||||||
npm cache verify
|
upgrade_global_packages
|
||||||
|
clean_npm_cache
|
||||||
|
msg_yay "npm package installations complete"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -3,11 +3,18 @@
|
|||||||
# Install ntfy
|
# Install ntfy
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
eval "$DOTFILES/config/shared.sh"
|
||||||
set -e
|
|
||||||
|
|
||||||
x-have "ntfy" && msg "ntfy already installed" && exit 0
|
# Enable verbosity with VERBOSE=1
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
|
# Check if ntfy is already installed
|
||||||
|
if x-have "ntfy"; then
|
||||||
|
msg "ntfy already installed"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Determine the architecture
|
||||||
case $(dfm check arch) in
|
case $(dfm check arch) in
|
||||||
Linux)
|
Linux)
|
||||||
NTFY_ARCH="linux_$(arch)"
|
NTFY_ARCH="linux_$(arch)"
|
||||||
@@ -15,21 +22,36 @@ case $(dfm check arch) in
|
|||||||
Darwin)
|
Darwin)
|
||||||
NTFY_ARCH="macOS_all"
|
NTFY_ARCH="macOS_all"
|
||||||
;;
|
;;
|
||||||
|
*)
|
||||||
|
msg_err "Unsupported OS"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
NTFY_VERSION=2.2.0
|
NTFY_VERSION="$(x-gh-get-latest-version binwiederhier/ntfy)"
|
||||||
NTFY_URL="https://github.com/binwiederhier/ntfy"
|
NTFY_URL="https://github.com/binwiederhier/ntfy"
|
||||||
NTFY_DEST="/tmp/ntfy_${NTFY_VERSION}_${NTFY_ARCH}"
|
NTFY_DEST="/tmp/ntfy_${NTFY_VERSION}_${NTFY_ARCH}"
|
||||||
|
|
||||||
curl -L "$NTFY_URL/releases/download/v${NTFY_VERSION}/${NTFY_DEST}.tar.gz" \
|
# Download and extract ntfy
|
||||||
> "${NTFY_DEST}.tar.gz"
|
install_ntfy()
|
||||||
tar zxvf "${NTFY_DEST}.tar.gz"
|
{
|
||||||
cp -a "${NTFY_DEST}/ntfy" ~/.local/bin/ntfy
|
curl -L "$NTFY_URL/releases/download/v${NTFY_VERSION}/${NTFY_DEST}.tar.gz" -o "${NTFY_DEST}.tar.gz"
|
||||||
mkdir -p ~/.config/ntfy
|
tar zxvf "${NTFY_DEST}.tar.gz"
|
||||||
|
cp -a "${NTFY_DEST}/ntfy" ~/.local/bin/ntfy
|
||||||
|
mkdir -p ~/.config/ntfy
|
||||||
|
|
||||||
# copy config only if it does not exist
|
# Copy config only if it does not exist
|
||||||
if [ ! -f "$HOME/.config/ntfy/client.yml" ]; then
|
if [ ! -f "$HOME/.config/ntfy/client.yml" ]; then
|
||||||
cp "${NTFY_DEST}/client/client.yml" ~/.config/ntfy/client.yml
|
cp "${NTFY_DEST}/client/client.yml" ~/.config/ntfy/client.yml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf "${NTFY_DEST}" "${NTFY_DEST}.tar.gz"
|
# Clean up
|
||||||
|
rm -rf "${NTFY_DEST}" "${NTFY_DEST}.tar.gz"
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
install_ntfy
|
||||||
|
msg "ntfy installation complete"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -3,14 +3,31 @@
|
|||||||
# Install oh-my-bash
|
# Install oh-my-bash
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
source "${DOTFILES}/config/shared.sh"
|
||||||
|
|
||||||
export OSH="$HOME/.local/share/oh-my-bash"
|
set -euo pipefail
|
||||||
|
|
||||||
if [ ! -d "$OSH" ]; then
|
# Enable verbosity with VERBOSE=1
|
||||||
[ -f "$HOME/.bashrc" ] && mv "$HOME/.bashrc" "$HOME/.bashrc.temp"
|
VERBOSE="${VERBOSE:-0}"
|
||||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)" --unattended
|
|
||||||
[ -f "$HOME/.bashrc.temp" ] && mv "$HOME/.bashrc.temp" "$HOME/.bashrc"
|
OSH="$HOME/.local/share/oh-my-bash"
|
||||||
else
|
|
||||||
msg_done "oh-my-bash ($OSH) already installed"
|
# Function to install oh-my-bash
|
||||||
fi
|
install_oh_my_bash()
|
||||||
|
{
|
||||||
|
if [ ! -d "$OSH" ]; then
|
||||||
|
[ -f "$HOME/.bashrc" ] && mv "$HOME/.bashrc" "$HOME/.bashrc.temp"
|
||||||
|
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)" --unattended
|
||||||
|
[ -f "$HOME/.bashrc.temp" ] && mv "$HOME/.bashrc.temp" "$HOME/.bashrc"
|
||||||
|
msg "oh-my-bash installed to $OSH"
|
||||||
|
else
|
||||||
|
msg_done "oh-my-bash ($OSH) already installed"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
install_oh_my_bash
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
@@ -3,9 +3,31 @@
|
|||||||
# Install oh-my-posh
|
# Install oh-my-posh
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
source "${DOTFILES}/config/shared.sh"
|
||||||
|
|
||||||
curl -s https://ohmyposh.dev/install.sh | bash -s -- -d ~/.local/bin
|
# Enable verbosity with VERBOSE=1
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
eval "$(oh-my-posh init zsh --config $OHMYPOSH_CFG)"
|
msg "Starting to install oh-my-posh"
|
||||||
|
|
||||||
|
# Install oh-my-posh
|
||||||
|
install_oh_my_posh()
|
||||||
|
{
|
||||||
|
curl -s https://ohmyposh.dev/install.sh | bash -s -- -d ~/.local/bin
|
||||||
|
msg "oh-my-posh installed to ~/.local/bin"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Initialize oh-my-posh
|
||||||
|
init_oh_my_posh()
|
||||||
|
{
|
||||||
|
eval "$(oh-my-posh init zsh --config $OHMYPOSH_CFG)"
|
||||||
|
msg "oh-my-posh initialized with config $OHMYPOSH_CFG"
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
install_oh_my_posh
|
||||||
|
init_oh_my_posh
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user