diff options
Diffstat (limited to 'lua/plugins')
| -rw-r--r-- | lua/plugins/complete-filename.lua | 12 | ||||
| -rw-r--r-- | lua/plugins/complete-word.lua | 6 | ||||
| -rw-r--r-- | lua/plugins/number-inc-dec.lua | 6 |
3 files changed, 12 insertions, 12 deletions
diff --git a/lua/plugins/complete-filename.lua b/lua/plugins/complete-filename.lua index 3648efe..cb5b361 100644 --- a/lua/plugins/complete-filename.lua +++ b/lua/plugins/complete-filename.lua @@ -1,9 +1,9 @@ --- complete file path at primary cursor location using vis-complete(1) +-- complete file path at primary selection location using vis-complete(1) vis:map(vis.modes.INSERT, "<C-x><C-f>", 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 -- TODO do something clever here local range = file:text_object_word(pos > 0 and pos-1 or pos); @@ -19,15 +19,15 @@ vis:map(vis.modes.INSERT, "<C-x><C-f>", function() return end file:insert(pos, out) - win.cursor.pos = pos + #out + win.selection.pos = pos + #out end, "Complete file path") --- complete file path at primary cursor location using vis-open(1) +-- complete file path at primary selection location using vis-open(1) vis:map(vis.modes.INSERT, "<C-x><C-o>", 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 @@ -48,5 +48,5 @@ vis:map(vis.modes.INSERT, "<C-x><C-o>", function() out = out:gsub("\n$", "") file:delete(range) file:insert(range.start, out) - win.cursor.pos = range.start + #out + win.selection.pos = range.start + #out end, "Complete file name") 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, "<C-n>", 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, "<C-n>", function() return end file:insert(pos, out) - win.cursor.pos = pos + #out + win.selection.pos = pos + #out end, "Complete word in file") diff --git a/lua/plugins/number-inc-dec.lua b/lua/plugins/number-inc-dec.lua index e1142ef..26a8825 100644 --- a/lua/plugins/number-inc-dec.lua +++ b/lua/plugins/number-inc-dec.lua @@ -15,8 +15,8 @@ local change = function(delta) if not count then count = 1 end vis.count = nil -- reset count, otherwise it affects next motion - for cursor in win:cursors_iterator() do - local pos = cursor.pos + for selection in win:selections_iterator() do + local pos = selection.pos if not pos then goto continue end local word = file:text_object_word(pos); if not word then goto continue end @@ -50,7 +50,7 @@ local change = function(delta) end file:delete(s, e - s) file:insert(s, number) - cursor.pos = s + selection.pos = s ::continue:: end end |
