From 386eac2063bdda79279bbdea2fffcd7fc0ff682a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 12 Jul 2017 19:05:03 +0200 Subject: vis-lua: make selection first class primitives in Lua API --- lua/plugins/complete-word.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lua/plugins/complete-word.lua') diff --git a/lua/plugins/complete-word.lua b/lua/plugins/complete-word.lua index 68ce385..41d112c 100644 --- a/lua/plugins/complete-word.lua +++ b/lua/plugins/complete-word.lua @@ -1,9 +1,9 @@ --- complete word at primary cursor location using vis-complete(1) +-- complete word at primary selection location using vis-complete(1) vis:map(vis.modes.INSERT, "", function() local win = vis.win local file = win.file - local pos = win.cursor.pos + local pos = win.selection.pos if not pos then return end local range = file:text_object_word(pos > 0 and pos-1 or pos); if not range then return end @@ -18,5 +18,5 @@ vis:map(vis.modes.INSERT, "", function() return end file:insert(pos, out) - win.cursor.pos = pos + #out + win.selection.pos = pos + #out end, "Complete word in file") -- cgit v1.2.3