From e782ba2e6b163fecbaf3ec583cdb94a8649f72f3 Mon Sep 17 00:00:00 2001 From: Xevion Date: Fri, 23 Jan 2026 14:44:52 -0600 Subject: [PATCH] config: add IntelliJ keymap management and enable EXA for OpenCode --- home/.managed/intellij/keymaps/Primary.xml | 21 ++++++++++ home/dot_bashrc.tmpl | 3 ++ home/dot_config/fish/config.fish.tmpl | 3 ++ ...ange_before_setup-intellij-keymaps.ts.tmpl | 41 +++++++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 home/.managed/intellij/keymaps/Primary.xml create mode 100755 home/run_onchange_before_setup-intellij-keymaps.ts.tmpl diff --git a/home/.managed/intellij/keymaps/Primary.xml b/home/.managed/intellij/keymaps/Primary.xml new file mode 100644 index 0000000..0c735ea --- /dev/null +++ b/home/.managed/intellij/keymaps/Primary.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/home/dot_bashrc.tmpl b/home/dot_bashrc.tmpl index b9fb571..e93618f 100644 --- a/home/dot_bashrc.tmpl +++ b/home/dot_bashrc.tmpl @@ -97,6 +97,9 @@ fi # colored GCC warnings and errors #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' +# Enable EXA for OpenCode +export OPENCODE_ENABLE_EXA=true + # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). diff --git a/home/dot_config/fish/config.fish.tmpl b/home/dot_config/fish/config.fish.tmpl index 87dd6ab..86f92c2 100644 --- a/home/dot_config/fish/config.fish.tmpl +++ b/home/dot_config/fish/config.fish.tmpl @@ -16,6 +16,9 @@ if status is-login end {{- end }} +# Enable EXA for OpenCode +set -gx OPENCODE_ENABLE_EXA true + # Common shared configuration (environment variables, PATH, tool setup) {{ template "scripts/commonrc.fish.tmpl" dict "data" . }} diff --git a/home/run_onchange_before_setup-intellij-keymaps.ts.tmpl b/home/run_onchange_before_setup-intellij-keymaps.ts.tmpl new file mode 100755 index 0000000..3e56370 --- /dev/null +++ b/home/run_onchange_before_setup-intellij-keymaps.ts.tmpl @@ -0,0 +1,41 @@ +{{ if eq .chezmoi.os "linux" -}} +#!/usr/bin/env bun +// Hash: {{ include ".managed/intellij/keymaps/Primary.xml" | sha256sum }} + +import { readdirSync, existsSync, mkdirSync, lstatSync, readlinkSync, unlinkSync, symlinkSync } from "node:fs"; +import { join } from "node:path"; + +const JETBRAINS_DIR = join(process.env.HOME!, ".config/JetBrains"); +const SOURCE = "{{ .chezmoi.sourceDir }}/.managed/intellij/keymaps/Primary.xml"; +const IDE_PATTERNS = [/^IntelliJIdea/, /^IdeaIC/]; + +const log = (msg: string) => console.log(`[intellij-keymaps] ${msg}`); + +if (!existsSync(JETBRAINS_DIR)) { + log("No JetBrains directory found"); + process.exit(0); +} + +for (const entry of readdirSync(JETBRAINS_DIR)) { + if (!IDE_PATTERNS.some((p) => p.test(entry))) continue; + + const keymapsDir = join(JETBRAINS_DIR, entry, "keymaps"); + const target = join(keymapsDir, "Primary.xml"); + + mkdirSync(keymapsDir, { recursive: true }); + + // Check if already correctly symlinked + if (existsSync(target)) { + try { + if (lstatSync(target).isSymbolicLink() && readlinkSync(target) === SOURCE) { + log(`${entry}: already linked`); + continue; + } + } catch {} + unlinkSync(target); + } + + symlinkSync(SOURCE, target); + log(`${entry}: linked`); +} +{{ end -}}