aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErlend Fagerheim <erlendf80@gmail.com>2017-05-25 00:33:37 +0200
committerErlend Fagerheim <erlendf80@gmail.com>2017-05-25 00:33:37 +0200
commit620c2c4b1af1bfff771085b674ad8d7e0973f7ea (patch)
treeb7b32e7699c0ccc8a01e08a6e28b591970935446
parent3bf2b15eab7bfe94060446ec2fe60aea1923370f (diff)
downloadvis-cursors-620c2c4b1af1bfff771085b674ad8d7e0973f7ea.tar.gz
update README | rename cursors_path to path
-rw-r--r--README.md9
-rw-r--r--cursors.lua6
2 files changed, 7 insertions, 8 deletions
diff --git a/README.md b/README.md
index cd5ac20..4494892 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,7 @@
# vis-cursors
-Remembering cursor positions in the [vis editor](https://github.com/martanne/vis).
+Remember cursor position per file, for the [vis editor](https://github.com/martanne/vis).
-# How to
-1. `ln -s cursors.lua .config/vis/plugins`
-2. `require('plugins/cursors')` in `visrc.lua`
+# Usage
+Load `cursors.lua` in your `visrc.lua` file ( see [Plugins](https://github.com/martanne/vis/wiki/Plugins) ).
-`module.cursors_path` defaults to `~/.cursors`, and store your cursor positions. You can overwrite this variable.
+Cursor positions are stored in `$HOME/.cursors`, or you can set the `module.path` variable.
diff --git a/cursors.lua b/cursors.lua
index 90bddcf..664de42 100644
--- a/cursors.lua
+++ b/cursors.lua
@@ -1,6 +1,6 @@
local module = {}
local cursors = {}
-module.cursors_path = string.format('%s/.cursors', os.getenv('HOME'))
+module.path = string.format('%s/.cursors', os.getenv('HOME'))
function set_cursor_pos(win)
if win.file == nil or win.file.path == nil then return end
@@ -19,7 +19,7 @@ end
function load_cursors()
cursors = {}
- local f = io.open(module.cursors_path)
+ local f = io.open(module.path)
if f == nil then return end
for line in f:lines() do
for k, v in string.gmatch(line, '(.+)%s(%d+)') do
@@ -33,7 +33,7 @@ function load_cursors()
end
function save_cursors()
- local f = io.open(module.cursors_path, 'w+')
+ local f = io.open(module.path, 'w+')
if f == nil then return end
local a = {}
for k in pairs(cursors) do table.insert(a, k) end