Skip to content

Commit

Permalink
fix: option to save last position before jump
Browse files Browse the repository at this point in the history
  • Loading branch information
phanen committed May 20, 2024
1 parent 1d378c6 commit d64cbee
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lua/various-textobjs/blockwise-textobjs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local M = {}
local fn = vim.fn
local bo = vim.bo
local getCursor = vim.api.nvim_win_get_cursor
local config = require("various-textobjs.config").config

--------------------------------------------------------------------------------

Expand All @@ -24,6 +25,8 @@ function M.column()
until hitsIndent or shorterLine
local linesDown = nextLnum - 1 - startRow

u.normal("m`")

-- start visual block mode
-- INFO requires special character `^V`
if not (fn.mode() == "") then vim.cmd.execute([["normal! \<C-v>"]]) end
Expand Down
1 change: 1 addition & 0 deletions lua/various-textobjs/charwise-textobjs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ end
---@param startPos pos
---@param endPos pos
function M.setSelection(startPos, endPos)
u.normal("m`")
vim.api.nvim_win_set_cursor(0, startPos)
if isVisualMode() then
u.normal("o")
Expand Down
1 change: 1 addition & 0 deletions lua/various-textobjs/linewise-textobjs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ end
---@param startline integer
---@param endline integer
local function setLinewiseSelection(startline, endline)
u.normal("m`")
a.nvim_win_set_cursor(0, { startline, 0 })
if not isVisualLineMode() then u.normal("V") end
u.normal("o")
Expand Down

0 comments on commit d64cbee

Please sign in to comment.