diff options
author | Erlend Fagerheim <erlendf80@gmail.com> | 2020-04-23 19:58:24 +0200 |
---|---|---|
committer | Erlend Fagerheim <erlendf80@gmail.com> | 2020-04-23 20:00:22 +0200 |
commit | f36f51f60070298bb19fb92f58acc06e8dc6a0c6 (patch) | |
tree | 19b72de48a08b8d827893cec48a24926fe298a73 | |
parent | 4d6a01f3c476fd38b716faabe20e422b0c65bfb8 (diff) | |
download | vis-cursors-f36f51f60070298bb19fb92f58acc06e8dc6a0c6.tar.gz |
support XDG_CACHE_HOME
-rw-r--r-- | README.md | 9 | ||||
-rw-r--r-- | init.lua | 7 |
2 files changed, 11 insertions, 5 deletions
@@ -1,7 +1,8 @@ # vis-cursors -Remember cursor positions per file. A plugin for the [vis editor](https://github.com/martanne/vis). -# Usage -Require `vis-cursors` in your `visrc.lua` file ( see [Plugins](https://github.com/martanne/vis/wiki/Plugins) ). +Remember cursor positions per file. + +Cursors are stored in `XDG_CACHE_HOME/cursors`, `$HOME/.cursors` or set via `M.path`. + +A [plugin](https://github.com/martanne/vis/wiki/Plugins) for the [vis](https://github.com/martanne/vis) text editor. -Cursor positions are stored in `$HOME/.cursors`, or set another path using `M.path`. @@ -1,6 +1,11 @@ local M = {} local cursors = {} -M.path = os.getenv('HOME') .. '/.cursors' +local XDG_CACHE_HOME = os.getenv('XDG_CACHE_HOME') +if XDG_CACHE_HOME then + M.path = XDG_CACHE_HOME .. '/cursors' +else + M.path = os.getenv('HOME') .. '/.cursors' +end function apply_cursor_pos(win) if win.file == nil or win.file.path == nil then return end |