diff options
author | Erlend Lind Madsen <erlendf80@gmail.com> | 2020-12-22 14:24:27 +0100 |
---|---|---|
committer | Erlend Lind Madsen <erlendf80@gmail.com> | 2020-12-22 14:24:27 +0100 |
commit | dba4bebb314f2cae111ac5dafcd84cf1be9943b9 (patch) | |
tree | 20645cf16a57d167b4abec9a52c81bc3e33de7cf | |
parent | c1c0d5b7c907c67bce967ae4193f2185d5b9e9a3 (diff) | |
download | vis-cursors-dba4bebb314f2cae111ac5dafcd84cf1be9943b9.tar.gz |
use csv format | save to .vis-cursors.csv
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | init.lua | 6 |
2 files changed, 4 insertions, 4 deletions
@@ -2,6 +2,6 @@ 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}/.vis-cursors` +Default save path is `{XDG_CACHE_HOME|HOME}/.vis-cursors.csv` Set a custom path with `M.path`
\ No newline at end of file @@ -5,7 +5,7 @@ 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 .. '/.vis-cursors' + return BASE .. '/.vis-cursors.csv' end M.path = get_default_cache_path() @@ -39,7 +39,7 @@ local read_cursors = function() end -- read positions per file path for line in f:lines() do - for path, pos in string.gmatch(line, '(.+)%s(%d+)') do + for path, pos in string.gmatch(line, '(.+)[,%s](%d+)') do cursors[path] = pos end end @@ -58,7 +58,7 @@ local write_cursors = function() -- buffer cursors string local t = {} for i, path in ipairs(paths) do - table.insert(t, string.format('%s %d', path, cursors[path])) + table.insert(t, string.format('%s,%d', path, cursors[path])) end local s = table.concat(t, '\n') f:write(s) |