From 8d19e640872bdaffa6225475edf721da5e015cf8 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Wed, 14 Aug 2024 22:49:22 -0400 Subject: [PATCH] chezmoi: windows symlink for config --- src/dot_config/nvim/lua/snippets.lua | 2 +- ...run_after__symlink-config_windows.ps1.tmpl | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/run_after__symlink-config_windows.ps1.tmpl diff --git a/src/dot_config/nvim/lua/snippets.lua b/src/dot_config/nvim/lua/snippets.lua index 1480949..af86f85 100644 --- a/src/dot_config/nvim/lua/snippets.lua +++ b/src/dot_config/nvim/lua/snippets.lua @@ -27,4 +27,4 @@ keymap("", "luasnip-next-choice", { mode = { "s", "i" } }) -- snippets -------------------------------- -require("luasnip.loaders.from_lua").load({paths = vim.env.XDG_CONFIG_HOME .. "/nvim/snippets"}) +require("luasnip.loaders.from_lua").load({paths = vim.fn.stdpath("config") .. "/snippets"}) diff --git a/src/run_after__symlink-config_windows.ps1.tmpl b/src/run_after__symlink-config_windows.ps1.tmpl new file mode 100644 index 0000000..c4ef15d --- /dev/null +++ b/src/run_after__symlink-config_windows.ps1.tmpl @@ -0,0 +1,27 @@ +{{- /* symlink into ~/.config and ~/.local/share/ on windows */ -}} + +{{- $roamingconfdirs := list "alacritty" "nushell" -}} +{{- $localconfdirs := list "nvim" -}} + +{{- if eq .chezmoi.os "windows" -}} +$userdir = ([Environment]::GetFolderPath("UserProfile")) +$roamingconfdir = ([Environment]::GetFolderPath("ApplicationData")) +$localconfdir = ([Environment]::GetFolderPath("LocalApplicationData")) + +{{ range $roamingconfdirs }} +If (-Not (Test-Path $roamingconfdir\{{ . }})) { + New-Item -Path $roamingconfdir\{{ . }} -ItemType Junction -Value $userdir\.config\{{ . }} +} +{{ end }} + +{{ range $localconfdirs }} +If (-Not (Test-Path $localconfdir\{{ . }})) { + New-Item -Path $localconfdir\{{ . }} -ItemType Junction -Value $userdir\.config\{{ . }} +} +{{ end }} + +If (-Not (Test-Path $localconfdir\nvim-data\site)) { + New-Item -Path $localconfdir\nvim-data\site -ItemType Junction -Value $userdir\.local\share\nvim\site +} + +{{- end -}}