aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErlend Lind Madsen <erlendf80@gmail.com>2020-12-22 14:20:14 +0100
committerErlend Lind Madsen <erlendf80@gmail.com>2020-12-22 14:20:14 +0100
commit979aadf40b84b0e6d5d24b5248b2ed64b170045d (patch)
tree070b30bca2f0c435a0a9647ea214b51e01432634
parent59d1e307a65cf8dce3401aa2c8bab67c29630ff7 (diff)
downloadvis-cursors-979aadf40b84b0e6d5d24b5248b2ed64b170045d.tar.gz
add get_default_cache_path function
-rw-r--r--README.md1
-rw-r--r--init.lua12
2 files changed, 8 insertions, 5 deletions
diff --git a/README.md b/README.md
index 30bcf7a..f73c546 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,5 @@
# vis-cursors ✍️
-
A [vis](https://github.com/martanne/vis) [plugin](https://github.com/martanne/vis/wiki/Plugins) for saving cursor position per file.
Default save path is `{XDG_CACHE_HOME|HOME}/.cursors`
diff --git a/init.lua b/init.lua
index 816bf6a..2895a8b 100644
--- a/init.lua
+++ b/init.lua
@@ -1,10 +1,14 @@
local M = {}
local cursors = {}
-local HOME = os.getenv('HOME')
-local XDG_CACHE_HOME = os.getenv('XDG_CACHE_HOME')
-local BASE = XDG_CACHE_HOME or HOME
-M.path = BASE .. '/.cursors'
+local get_default_cache_path = function()
+ local HOME = os.getenv('HOME')
+ local XDG_CACHE_HOME = os.getenv('XDG_CACHE_HOME')
+ local BASE = XDG_CACHE_HOME or HOME
+ return BASE .. '/.cursors'
+end
+
+M.path = get_default_cache_path()
local apply_cursor_pos = function(win)
if win.file == nil or win.file.path == nil then