diff options
author | Erlend Lind Madsen <erlendf80@gmail.com> | 2020-12-22 14:20:14 +0100 |
---|---|---|
committer | Erlend Lind Madsen <erlendf80@gmail.com> | 2020-12-22 14:20:14 +0100 |
commit | 979aadf40b84b0e6d5d24b5248b2ed64b170045d (patch) | |
tree | 070b30bca2f0c435a0a9647ea214b51e01432634 | |
parent | 59d1e307a65cf8dce3401aa2c8bab67c29630ff7 (diff) | |
download | vis-cursors-979aadf40b84b0e6d5d24b5248b2ed64b170045d.tar.gz |
add get_default_cache_path function
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | init.lua | 12 |
2 files changed, 8 insertions, 5 deletions
@@ -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` @@ -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 |