From 809cddb5330a8d6f5e6beee1259da5b7e14819a9 Mon Sep 17 00:00:00 2001
From: Oliver Davies <oliver@oliverdavies.dev>
Date: Tue, 18 Mar 2025 17:41:38 +0000
Subject: [PATCH] Move undodir directory

---
 nix/home/opdavies/default.nix | 1 +
 nvim/lua/opdavies/options.lua | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/nix/home/opdavies/default.nix b/nix/home/opdavies/default.nix
index da0a59f..ed478be 100644
--- a/nix/home/opdavies/default.nix
+++ b/nix/home/opdavies/default.nix
@@ -77,6 +77,7 @@ in
     XDG_DATA_HOME = "${config.xdg.dataHome}";
     XDG_DOCUMENTS_DIR = "$HOME/Documents";
     XDG_REPOS_DIR = "$HOME/Code";
+    XDG_STATE_HOME = config.xdg.stateHome;
   };
 
   xdg.configFile = {
diff --git a/nvim/lua/opdavies/options.lua b/nvim/lua/opdavies/options.lua
index 3bdd40d..5b94dff 100644
--- a/nvim/lua/opdavies/options.lua
+++ b/nvim/lua/opdavies/options.lua
@@ -35,7 +35,7 @@ local settings = {
   tabstop = 2,
   termguicolors = true,
   textwidth = 0,
-  undodir = os.getenv "HOME" .. "/.vim/undodir",
+  undodir = os.getenv "XDG_STATE_HOME" .. "/nvim/undodir",
   undofile = true,
   updatetime = 1000,
   wrap = false,