mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-29 09:45:52 +00:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d30ae7e84 | |||
| 031e124663 | |||
| bb50c9fe18 | |||
| 8e608de501 | |||
|
|
8917b7736b | ||
| 18ff879f1d | |||
| c5a258d7be | |||
| 7525f1f71d | |||
| 3b665bdba0 | |||
| 99477364bd | |||
|
|
629fdf6d4c | ||
| 1288599b1f |
@@ -44,12 +44,12 @@ repos:
|
||||
- id: shfmt
|
||||
|
||||
- repo: https://github.com/rhysd/actionlint
|
||||
rev: v1.7.6
|
||||
rev: v1.7.7
|
||||
hooks:
|
||||
- id: actionlint
|
||||
|
||||
- repo: https://github.com/renovatebot/pre-commit-hooks
|
||||
rev: 39.100.1
|
||||
rev: 39.117.2
|
||||
hooks:
|
||||
- id: renovate-config-validator
|
||||
|
||||
|
||||
@@ -43,16 +43,28 @@ automatically-unhide-macos-hidden-apps = true
|
||||
if.app-name-regex-substring = 'settings' # All settings
|
||||
run = ['layout floating']
|
||||
|
||||
[[on-window-detected]]
|
||||
if.app-id = 'com.apple.systempreferences' # macOS System Preferences
|
||||
run = ['layout floating']
|
||||
|
||||
[[on-window-detected]]
|
||||
if.app-id = 'com.1password.1password' # 1Password
|
||||
run = ['layout floating']
|
||||
|
||||
[[on-window-detected]]
|
||||
if.app-id = 'org.ferdium.ferdium-app' # Ferdium, has WhatsApp etc.
|
||||
run = ['layout floating']
|
||||
|
||||
[[on-window-detected]]
|
||||
if.app-id = 'com.jetbrains.PhpStorm' # PhpStorm
|
||||
run = ['layout floating']
|
||||
|
||||
[[on-window-detected]]
|
||||
if.app-id = 'com.apple.finder' # Finder
|
||||
run = ['layout floating']
|
||||
|
||||
[[on-window-detected]]
|
||||
if.app-id = 'com.apple.Preview'
|
||||
if.app-id = 'com.apple.Preview' # Preview
|
||||
run = ['layout floating']
|
||||
|
||||
[[on-window-detected]]
|
||||
@@ -91,6 +103,19 @@ run = ['layout floating']
|
||||
if.app-id = 'com.tinyspeck.slackmacgap' # Slack
|
||||
run = ['layout floating']
|
||||
|
||||
[[on-window-detected]]
|
||||
if.app-id = 'md.obsidia' # Obsidian
|
||||
run = ['layout floating']
|
||||
|
||||
[[on-window-detected]]
|
||||
if.app-id = 'com.todoist.mac.Todoist' # Todoist
|
||||
run = ['layout floating']
|
||||
|
||||
[[on-window-detected]]
|
||||
if.app-id = 'com.apple.backup.launcher' # TimeMachine
|
||||
run = ['layout floating']
|
||||
|
||||
|
||||
# Possible values: (qwerty|dvorak)
|
||||
# See https://nikitabobko.github.io/AeroSpace/guide#key-mapping
|
||||
[key-mapping]
|
||||
@@ -117,6 +142,9 @@ outer.left = 0
|
||||
# Fallback value (if you omit the key): mode.main.binding = {}
|
||||
[mode.main.binding]
|
||||
|
||||
cmd-h = [] # Disable "hide application"
|
||||
cmd-alt-h = [] # Disable "hide others"
|
||||
|
||||
# All possible keys:
|
||||
# - Letters. a, b, c, ..., z
|
||||
# - Numbers. 0, 1, 2, ..., 9
|
||||
@@ -154,10 +182,10 @@ alt-l = 'focus right'
|
||||
# See: https://nikitabobko.github.io/AeroSpace/commands#workspace
|
||||
alt-shift-1 = 'workspace 1' # Main
|
||||
alt-shift-2 = 'workspace 2' # Media
|
||||
ctrl-shift-1 = 'move-node-to-workspace 1'
|
||||
ctrl-shift-2 = 'move-node-to-workspace 2'
|
||||
ctrl-shift-1 = 'move-node-to-workspace 1' # Move node to Main
|
||||
ctrl-shift-2 = 'move-node-to-workspace 2' # Move node to Media
|
||||
|
||||
alt-shift-tab = 'workspace-back-and-forth'
|
||||
alt-shift-tab = 'workspace-back-and-forth' # Switch between workspaces
|
||||
ctrl-shift-tab = 'move-workspace-to-monitor --wrap-around prev'
|
||||
|
||||
# See: https://nikitabobko.github.io/AeroSpace/commands#mode
|
||||
|
||||
@@ -104,8 +104,4 @@ autocmd({ 'BufRead', 'BufNewFile' }, {
|
||||
command = 'set filetype=sshconfig',
|
||||
})
|
||||
|
||||
autocmd('QuickFixCmdPost', {
|
||||
callback = function() vim.cmd [[Trouble qflist open]] end,
|
||||
})
|
||||
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
||||
@@ -42,12 +42,6 @@ local lsp_servers = {
|
||||
diagnostics = {
|
||||
globals = {
|
||||
'vim',
|
||||
-- busted
|
||||
'describe',
|
||||
'it',
|
||||
'before_each',
|
||||
'after_each',
|
||||
'assert',
|
||||
},
|
||||
disable = {
|
||||
-- Ignore lua_ls noisy `missing-fields` warnings
|
||||
@@ -55,7 +49,7 @@ local lsp_servers = {
|
||||
},
|
||||
},
|
||||
hint = {
|
||||
enable = false,
|
||||
enable = true,
|
||||
arrayIndex = 'Auto',
|
||||
await = true,
|
||||
paramName = 'All',
|
||||
|
||||
@@ -10,6 +10,28 @@ return {
|
||||
'~/Downloads',
|
||||
'~/Library',
|
||||
},
|
||||
bypass_save_filetypes = {
|
||||
'PlenaryTestPopup',
|
||||
'alpha',
|
||||
'checkhealth',
|
||||
'dashboard',
|
||||
'dbout',
|
||||
'gitsigns.blame',
|
||||
'grug-far',
|
||||
'help',
|
||||
'lspinfo',
|
||||
'man',
|
||||
'neo-tree',
|
||||
'neotest-output',
|
||||
'neotest-output-panel',
|
||||
'neotest-summary',
|
||||
'notify',
|
||||
'qf',
|
||||
'spectre_panel',
|
||||
'startuptime',
|
||||
'trouble',
|
||||
'tsplayground',
|
||||
},
|
||||
-- log_level = 'debug',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -2,4 +2,9 @@ default_session = "main"
|
||||
|
||||
[[search_dirs]]
|
||||
path = "~/Code"
|
||||
depth = 10
|
||||
depth = 3
|
||||
|
||||
[picker_colors]
|
||||
highlight_color = "#21202e"
|
||||
highlight_text_color = "#86e1fc"
|
||||
border_color = "#524f67"
|
||||
|
||||
66
docs/aerospace-keybindings.md
Normal file
66
docs/aerospace-keybindings.md
Normal file
@@ -0,0 +1,66 @@
|
||||
# aerospace keybindings
|
||||
|
||||
## main
|
||||
|
||||
| Key | Command(s) and actions |
|
||||
|-----------------|-----------------------------------------------|
|
||||
| alt-a | mode apps |
|
||||
| alt-h | focus left |
|
||||
| alt-j | focus down |
|
||||
| alt-k | focus up |
|
||||
| alt-l | focus right |
|
||||
| alt-m | mode move |
|
||||
| alt-s | mode service |
|
||||
| alt-shift-1 | workspace 1 |
|
||||
| alt-shift-2 | workspace 2 |
|
||||
| alt-shift-tab | workspace-back-and-forth |
|
||||
| ctrl-shift-1 | move-node-to-workspace 1 |
|
||||
| ctrl-shift-2 | move-node-to-workspace 2 |
|
||||
| ctrl-shift-tab | move-workspace-to-monitor --wrap-around prev |
|
||||
|
||||
## apps
|
||||
|
||||
| Key | Command(s) and actions |
|
||||
|------|----------------------------------------------------------------------|
|
||||
| b | exec-and-forget open -a /Applications/Brave Browser.app; mode main |
|
||||
| c | exec-and-forget open -a /Applications/Ferdium.app; mode main |
|
||||
| esc | reload-config; mode main |
|
||||
| g | exec-and-forget open -a /Applications/Ghostty.app; mode main |
|
||||
| o | exec-and-forget open -a /Applications/Obsidian.app; mode main |
|
||||
| s | exec-and-forget open -a /Applications/Slack.app; mode main |
|
||||
| t | exec-and-forget open -a /Applications/TIDAL.app; mode main |
|
||||
| w | exec-and-forget open -a /Applications/WezTerm.app; mode main |
|
||||
|
||||
## move
|
||||
|
||||
| Key | Command(s) and actions |
|
||||
|--------------|--------------------------------------------------|
|
||||
| 1 | move-node-to-workspace 1 --focus-follows-window |
|
||||
| 2 | move-node-to-workspace 2 --focus-follows-window |
|
||||
| ctrl-h | resize smart -70 |
|
||||
| ctrl-l | resize smart +70 |
|
||||
| esc | reload-config; mode main |
|
||||
| h | move left |
|
||||
| j | move down |
|
||||
| k | move up |
|
||||
| l | move right |
|
||||
| r | flatten-workspace-tree; mode main |
|
||||
| shift-h | join-with left |
|
||||
| shift-j | join-with down |
|
||||
| shift-k | join-with up |
|
||||
| shift-l | join-with right |
|
||||
| shift-left | resize smart +70 |
|
||||
| shift-right | resize smart -70 |
|
||||
|
||||
## service
|
||||
|
||||
| Key | Command(s) and actions |
|
||||
|------------|-------------------------------------------|
|
||||
| backspace | close-all-windows-but-current; mode main |
|
||||
| esc | reload-config; mode main |
|
||||
| f | layout floating tiling; mode main |
|
||||
| r | flatten-workspace-tree; mode main |
|
||||
|
||||
File generated: 2025-01-15 13:32:41
|
||||
|
||||
Config file: [config/aerospace/aerospace.toml](./../config/aerospace/aerospace.toml)
|
||||
52
docs/alias.md
Normal file
52
docs/alias.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# Alias Commands
|
||||
|
||||
This file lists all aliases defined in `config/alias`.
|
||||
|
||||
| Alias | Command |
|
||||
| ------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `....` | `cd ../../..` |
|
||||
| `...` | `cd ../..` |
|
||||
| `..` | `cd ..` |
|
||||
| `.` | `cd $HOME` |
|
||||
| `.b` | `cd $XDG_BIN_HOME` |
|
||||
| `.c` | `cd $HOME/Code` |
|
||||
| `.d` | `cd $DOTFILES` |
|
||||
| `.l` | `cd $HOME/.local` |
|
||||
| `.o` | `cd $HOME/Code/ivuorinen/obsidian/` |
|
||||
| `art` | `[ -f artisan ] && php artisan \|\| php vendor/bin/artisan` |
|
||||
| `cd..` | `cd ..` |
|
||||
| `cdgr` | `cd "$(get_git_root)"` |
|
||||
| `dn` | `du -chd1` |
|
||||
| `flush` | `dscacheutil -flushcache` |
|
||||
| `grep` | `grep --color` |
|
||||
| `hide` | `defaults write com.apple.finder AppleShowAllFiles -bool false; killall Finder` |
|
||||
| `ips` | `ifconfig -a \| grep -o 'inet6\? \(\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)\\|[a-fA-F0-9:]\+\)' \| sed -e 's/inet6* //' \| sort` |
|
||||
| `irssi` | `irssi --config=$XDG_CONFIG_HOME/irssi/config --home=$XDG_CONFIG_HOME/irssi` |
|
||||
| `isodate` | `date +'%Y-%m-%d'` |
|
||||
| `l` | `ls -a` |
|
||||
| `ll` | `ls -la` |
|
||||
| `localip` | `ipconfig getifaddr en1` |
|
||||
| `mirror_site` | `wget -m -k -K -E -e robots=off` |
|
||||
| `peek` | `tee >(cat 1>&2)` |
|
||||
| `pubkey` | `more ~/.ssh/id_rsa.pub \| pbcopy \| echo '=> Public key copied to pasteboard.'` |
|
||||
| `sail` | `[ -f sail ] && bash sail \|\| bash vendor/bin/sail` |
|
||||
| `show` | `defaults write com.apple.finder AppleShowAllFiles -bool true; killall Finder` |
|
||||
| `sl` | `ls` |
|
||||
| `svn` | `svn --config-dir $XDG_CONFIG_HOME/subversion` |
|
||||
| `trivy_scan` | `docker run -v /var/run/docker.sock:/var/run/docker.sock -v $HOME/Library/Caches:/root/.cache/ aquasec/trivy` |
|
||||
| `updatedb` | `sudo /usr/libexec/locate.updatedb` |
|
||||
| `vi` | `nvim` |
|
||||
| `vim` | `nvim` |
|
||||
| `watchx` | `watch -dpbc` |
|
||||
| `wget` | `wget --hsts-file=$XDG_DATA_HOME/wget-hsts` |
|
||||
| `x-datetime` | `date +'%Y-%m-%d %H:%M:%S'` |
|
||||
| `x-ip` | `dig +short myip.opendns.com @resolver1.opendns.com` |
|
||||
| `x-timestamp` | `date +'%s'` |
|
||||
| `xdg` | `xdg-ninja --skip-ok --skip-unsupported` |
|
||||
| `zapall` | `zapds && zappyc` |
|
||||
| `zapds` | `find . -name ".DS_Store" -print -delete` |
|
||||
| `zappyc` | `find . -type f -name '*.pyc' -ls -delete` |
|
||||
| `zedit` | `$EDITOR ~/.dotfiles` |
|
||||
|
||||
Total aliases: 43
|
||||
Last updated: Fri 17 Jan 2025 13:06:59 EET
|
||||
@@ -436,6 +436,7 @@ section_helpers()
|
||||
"colors:Show colors"
|
||||
"env:Show environment variables"
|
||||
"functions:Show functions"
|
||||
"aerospace:Show aerospace keybindings"
|
||||
"nvim:Show nvim keybindings"
|
||||
'path:Show $PATH dir by dir'
|
||||
"tmux:Show tmux keybindings"
|
||||
@@ -494,6 +495,7 @@ section_helpers()
|
||||
|
||||
"env") env | sort ;;
|
||||
"functions") declare -F ;;
|
||||
"aerospace") cat "$DOTFILES/docs/aerospace-keybindings.md" ;;
|
||||
"nvim") cat "$DOTFILES/docs/nvim-keybindings.md" ;;
|
||||
"tmux") cat "$DOTFILES/docs/tmux-keybindings.md" ;;
|
||||
"wezterm") cat "$DOTFILES/docs/wezterm-keybindings.md" ;;
|
||||
@@ -501,12 +503,76 @@ section_helpers()
|
||||
esac
|
||||
}
|
||||
|
||||
section_apt()
|
||||
{
|
||||
USAGE_PREFIX="$SCRIPT apt <command>"
|
||||
MENU=(
|
||||
"upkeep:Run update, upgrade, autoremove and clean"
|
||||
'install:Install packages from $DOTFILES/tools/apt.txt'
|
||||
"update:Update apt packages"
|
||||
"upgrade:Upgrade apt packages"
|
||||
"autoremove:Remove unused apt packages"
|
||||
"clean:Clean apt cache"
|
||||
)
|
||||
|
||||
x-have apt && {
|
||||
case "$1" in
|
||||
upkeep)
|
||||
sudo apt update \
|
||||
&& sudo apt upgrade -y \
|
||||
&& sudo apt autoremove -y \
|
||||
&& sudo apt clean
|
||||
;;
|
||||
|
||||
install)
|
||||
# if apt.txt is not found, exit
|
||||
[ ! -f "$DOTFILES/tools/apt.txt" ] && msgr err "apt.txt not found" && exit 0
|
||||
|
||||
# Load apt.txt, remove comments (even if trailing comment) and empty lines.
|
||||
#
|
||||
# Ignoring "Quote this to prevent word splitting."
|
||||
# shellcheck disable=SC2046
|
||||
sudo apt install \
|
||||
-y $(
|
||||
grep -vE '^\s*#' "$DOTFILES/tools/apt.txt" \
|
||||
| sed -e 's/#.*//' \
|
||||
| tr '\n' ' '
|
||||
)
|
||||
|
||||
# If there's a apt.txt file under hosts/$hostname/apt.txt,
|
||||
# run install on those lines too.
|
||||
HOSTNAME=$(hostname -s)
|
||||
HOST_APT="$DOTFILES/hosts/$HOSTNAME/apt.txt"
|
||||
[[ -f $HOST_APT ]] && {
|
||||
# shellcheck disable=SC2046
|
||||
sudo apt install -y $(
|
||||
grep -vE '^\s*#' "$HOST_APT" \
|
||||
| sed -e 's/#.*//' \
|
||||
| tr '\n' ' '
|
||||
)
|
||||
}
|
||||
|
||||
# Try this for an alternative way to install packages
|
||||
# xargs -a <(awk '! /^ *(#|$)/' "$packagelist") -r -- sudo apt-get install -y
|
||||
;;
|
||||
|
||||
update) sudo apt update ;;
|
||||
upgrade) sudo apt upgrade -y ;;
|
||||
autoremove) sudo apt autoremove -y ;;
|
||||
clean) sudo apt clean ;;
|
||||
*) menu_builder "$USAGE_PREFIX" "${MENU[@]}" ;;
|
||||
esac
|
||||
}
|
||||
! x-have apt && menu_builder "$USAGE_PREFIX" "apt not available on this system"
|
||||
}
|
||||
|
||||
section_docs()
|
||||
{
|
||||
USAGE_PREFIX="$SCRIPT docs <command>"
|
||||
|
||||
MENU=(
|
||||
"all:Update all keybindings documentations"
|
||||
"aerospace:Update aerospace keybindings documentation"
|
||||
"tmux:Update tmux keybindings documentation"
|
||||
"nvim:Update nvim keybindings documentation"
|
||||
"wezterm:Update wezterm keybindings documentation"
|
||||
@@ -514,10 +580,12 @@ section_docs()
|
||||
|
||||
case "$1" in
|
||||
all)
|
||||
$0 docs aerospace
|
||||
$0 docs tmux
|
||||
$0 docs nvim
|
||||
$0 docs wezterm
|
||||
;;
|
||||
aerospace) bash "$DOTFILES/scripts/create-aerospace-keymaps.php" ;;
|
||||
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" ;;
|
||||
@@ -708,6 +776,8 @@ usage()
|
||||
echo ""
|
||||
section_install
|
||||
echo ""
|
||||
section_apt
|
||||
echo ""
|
||||
section_asdf
|
||||
echo ""
|
||||
section_brew
|
||||
@@ -730,6 +800,7 @@ main()
|
||||
# The main loop. The first keyword after $0 triggers section, or help.
|
||||
case "$SECTION" in
|
||||
install) section_install "$@" ;;
|
||||
apt) section_apt "$@" ;;
|
||||
asdf) section_asdf "$@" ;;
|
||||
brew) section_brew "$@" ;;
|
||||
check) section_check "$@" ;;
|
||||
|
||||
31
local/bin/t
31
local/bin/t
@@ -21,7 +21,26 @@ get_directories()
|
||||
{
|
||||
local dirs=''
|
||||
dirs+='# Directories\n'
|
||||
dirs+=$(find "$T_ROOT" -maxdepth 2 -mindepth 1 -type d ! -name '.git' ! -name '.svn')
|
||||
dirs+=$(
|
||||
find "$T_ROOT" \
|
||||
-maxdepth 3 \
|
||||
-mindepth 1 \
|
||||
-type d \
|
||||
-not -path '*/dist/*' \
|
||||
-not -path '*/dist' \
|
||||
-not -path '*/node_modules/*' \
|
||||
-not -path '*/node_modules' \
|
||||
-not -path '*/vendor/*' \
|
||||
-not -path '*/vendor' \
|
||||
-not -path '*/.idea/*' \
|
||||
-not -path '*/.idea' \
|
||||
-not -path '*/.vscode/*' \
|
||||
-not -path '*/.vscode' \
|
||||
-not -path '*/.git/*' \
|
||||
-not -path '*/.git' \
|
||||
-not -path '*/.svn/*' \
|
||||
-not -path '*/.svn'
|
||||
)
|
||||
dirs+="$(printf "\n%s" "$DOTFILES")"
|
||||
|
||||
echo "$dirs"
|
||||
@@ -56,9 +75,9 @@ items=''
|
||||
if [[ $# -eq 1 ]]; then
|
||||
selected="$1"
|
||||
else
|
||||
items+=$(get_sessions)
|
||||
items+=$(get_sessions | sort)
|
||||
items+='\n'
|
||||
items+=$(get_directories)
|
||||
items+=$(get_directories | sort)
|
||||
|
||||
selected=$(echo -e "$items" | fzf) || exit 0 # Exit if no selection is made
|
||||
fi
|
||||
@@ -77,7 +96,11 @@ session_name=$(basename "$selected")
|
||||
session_name="${session_name//./}"
|
||||
|
||||
# Try to switch to the tmux session
|
||||
if tmux switch-client -t "=$session_name" 2> /dev/null; then
|
||||
tmux switch-client -t "=$session_name"
|
||||
|
||||
active_session=$(tmux display-message -p -F '#{session_name}' 2> /dev/null)
|
||||
# echo "active session: $active_session"
|
||||
if [ -n "$active_session" ] && [ "$active_session" == "$session_name" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
67
scripts/create-aerospace-keymaps.php
Executable file
67
scripts/create-aerospace-keymaps.php
Executable file
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
// @description Create file containing key mappings for aerospace
|
||||
// Usage: ./create-aerospace-keymaps.sh
|
||||
// vim: ft=php ts=4 sw=4 sts=4 sr et
|
||||
|
||||
$dotfiles_env = getenv("DOTFILES") ?? '~/.dotfiles';
|
||||
|
||||
$dest = "$dotfiles_env/docs/aerospace-keybindings.md";
|
||||
|
||||
exec("aerospace config --get mode --json", $output);
|
||||
$output = join(' ', $output);
|
||||
$config = json_decode($output, true);
|
||||
|
||||
$main = $config['main'];
|
||||
unset($config['main']);
|
||||
|
||||
function process_section(string $title, array $array)
|
||||
{
|
||||
$bindings = $array['binding'] ?? [];
|
||||
ksort($bindings);
|
||||
|
||||
$output = [];
|
||||
$output[] = sprintf("\n## %s\n", $title);
|
||||
|
||||
$k_len = max(array_map('strlen', array_keys($bindings)));
|
||||
$v_len = max(array_map('strlen', array_values($bindings)));
|
||||
|
||||
$output[] = sprintf(
|
||||
"| %s | %s |",
|
||||
str_pad('Key', $k_len + 1),
|
||||
str_pad('Command(s) and actions', $v_len + 1)
|
||||
);
|
||||
$output[] = sprintf(
|
||||
"|%s|%s|",
|
||||
str_repeat('-', $k_len + 3),
|
||||
str_repeat('-', $v_len + 3)
|
||||
);
|
||||
|
||||
foreach ($bindings as $key => $value) {
|
||||
$k = str_pad($key, $k_len + 1);
|
||||
$v = str_pad($value, $v_len + 1);
|
||||
$output[] = sprintf("| %s | %s |", $k, $v);
|
||||
}
|
||||
|
||||
return implode("\n", $output);
|
||||
}
|
||||
|
||||
$contents = [];
|
||||
$contents[] = "# aerospace keybindings";
|
||||
|
||||
$contents[] = process_section("main", $main);
|
||||
|
||||
ksort($config);
|
||||
|
||||
foreach ($config as $mode => $bindings) {
|
||||
$contents[] = process_section($mode, $bindings);
|
||||
}
|
||||
|
||||
$contents[] = "\nFile generated: " . date("Y-m-d H:i:s") . "\n";
|
||||
|
||||
$config_file_name = 'config/aerospace/aerospace.toml';
|
||||
$config_file_source = './../config/aerospace/aerospace.toml';
|
||||
$contents[] = "Config file: [$config_file_name]($config_file_source)\n";
|
||||
|
||||
$file = implode("\n", $contents);
|
||||
file_put_contents($dest, $file);
|
||||
@@ -26,7 +26,7 @@ msgr nested "Change user shell to zsh if it is available and not the current"
|
||||
|
||||
# Change user shell to zsh if not that already.
|
||||
if hash zsh 2> /dev/null; then
|
||||
[[ "$SHELL" != $(which zsh) ]] && chsh -s "$(which zsh)"
|
||||
[[ $SHELL != $(which zsh) ]] && chsh -s "$(which zsh)"
|
||||
fi
|
||||
|
||||
###############################################################################
|
||||
@@ -150,7 +150,7 @@ msgr nested "Settings for Finder"
|
||||
# Set Desktop as the default location for new Finder windows
|
||||
# For other paths, use `PfLo` and `file:///full/path/here/`
|
||||
defaults write com.apple.finder NewWindowTarget -string "PfDe"
|
||||
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/"
|
||||
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
|
||||
|
||||
# Show icons for external hard drives, servers, and removable media on the desktop
|
||||
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
|
||||
@@ -201,6 +201,10 @@ defaults write com.apple.finder FXInfoPanesExpanded -dict \
|
||||
OpenWith -bool true \
|
||||
Privileges -bool true
|
||||
|
||||
# Move windows by dragging any part of the window
|
||||
# From https://nikitabobko.github.io/AeroSpace/goodies
|
||||
defaults write -g NSWindowShouldDragOnGesture -bool true
|
||||
|
||||
###############################################################################
|
||||
# Screenshots #
|
||||
###############################################################################
|
||||
|
||||
86
scripts/update-readme-aliases.sh
Executable file
86
scripts/update-readme-aliases.sh
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env bash
|
||||
# update-readme-aliases.sh
|
||||
# @description Update alias documentation in $DOTFILES/docs/alias.md
|
||||
#
|
||||
# Author: Ismo Vuorinen <https://github.com/ivuorinen> 2025
|
||||
# License: MIT
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Paths
|
||||
ALIAS_FILE="$DOTFILES/config/alias"
|
||||
OUTPUT_FILE="$DOTFILES/docs/alias.md"
|
||||
|
||||
# Check if alias file exists
|
||||
if [[ ! -f $ALIAS_FILE ]]; then
|
||||
echo "Alias file not found: $ALIAS_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Declare associative array
|
||||
declare -a alias_table
|
||||
|
||||
echo "Parsing aliases..."
|
||||
while IFS= read -r line; do
|
||||
# Skip all lines that do not start with 'alias'
|
||||
if [[ ! $line =~ ^alias\ ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Split alias and command and handle both ' and "
|
||||
if [[ $line =~ ^alias\ ([^=]+)=[\'\"](.*)[\'\"]$ ]]; then
|
||||
alias_name="${BASH_REMATCH[1]}"
|
||||
alias_command="${BASH_REMATCH[2]//|/\\|}" # fix markdown table separator
|
||||
|
||||
# Save alias to table
|
||||
alias_table+=("\`$alias_name\`␟\`$alias_command\`")
|
||||
else
|
||||
echo "Warning: Could not parse line: $line"
|
||||
fi
|
||||
|
||||
done < "$ALIAS_FILE"
|
||||
|
||||
# Sort array by alias name
|
||||
# shellcheck disable=SC2207
|
||||
IFS=$'\n' sorted_aliases=($(sort <<< "${alias_table[*]}"))
|
||||
unset IFS
|
||||
|
||||
# Calculate cell max lengths
|
||||
max_alias_length=5 # "Alias" min length
|
||||
max_command_length=7 # "Command" min length
|
||||
|
||||
for entry in "${sorted_aliases[@]}"; do
|
||||
IFS=$'␟' read -r alias_name alias_command <<< "$entry"
|
||||
max_alias_length=$((${#alias_name} > max_alias_length ? ${#alias_name} : max_alias_length))
|
||||
max_command_length=$((${#alias_command} > max_command_length ? ${#alias_command} : max_command_length))
|
||||
done
|
||||
|
||||
# Empty the markdown file and add header
|
||||
printf "# Alias Commands\n\nThis file lists all aliases defined in \`config/alias\`.\n\n" > "$OUTPUT_FILE"
|
||||
|
||||
# Add table header
|
||||
printf "| %-*s | %-*s |\n" \
|
||||
"$max_alias_length" "Alias" \
|
||||
"$max_command_length" "Command" >> "$OUTPUT_FILE"
|
||||
|
||||
# Add table header separator
|
||||
printf "| %-*s | %-*s |\n" \
|
||||
"$max_alias_length" "$(printf '%0.s-' $(seq 1 $max_alias_length))" \
|
||||
"$max_command_length" "$(printf '%0.s-' $(seq 1 $max_command_length))" >> "$OUTPUT_FILE"
|
||||
|
||||
# Create table with max cell lengths
|
||||
for entry in "${sorted_aliases[@]}"; do
|
||||
IFS=$'␟' read -r alias_name alias_command <<< "$entry"
|
||||
printf "| %-*s | %-*s |\n" \
|
||||
"$max_alias_length" "$alias_name" \
|
||||
"$max_command_length" "$alias_command" >> "$OUTPUT_FILE"
|
||||
done
|
||||
|
||||
{
|
||||
printf "\n"
|
||||
printf "Total aliases: %d\n" "${#sorted_aliases[@]}"
|
||||
printf "Last updated: %s\n" "$(date)"
|
||||
} >> "$OUTPUT_FILE"
|
||||
|
||||
# Announce process completion
|
||||
echo "Alias documentation updated: $OUTPUT_FILE"
|
||||
@@ -1,3 +1,5 @@
|
||||
# vim: ft=sshconfig
|
||||
|
||||
Host t1
|
||||
User ubuntu
|
||||
HostName t1.home.antiprocess.net
|
||||
@@ -14,4 +16,3 @@ Host t4
|
||||
User ubuntu
|
||||
HostName t4.home.antiprocess.net
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
|
||||
|
||||
1
tools/apt.txt
Normal file
1
tools/apt.txt
Normal file
@@ -0,0 +1 @@
|
||||
# apt install list
|
||||
Reference in New Issue
Block a user