mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 01:50:27 +00:00
Merge remote-tracking branch 'upstream/master' into logging-and-various
This commit is contained in:
commit
0b61951167
@ -67,10 +67,11 @@ local function get_buf_name(id)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function create_mark(filename)
|
local function create_mark(filename)
|
||||||
|
local cursor_pos = vim.fn.getcurpos()
|
||||||
return {
|
return {
|
||||||
filename = filename,
|
filename = filename,
|
||||||
row = 0,
|
row = cursor_pos[2],
|
||||||
col = 0,
|
col = cursor_pos[3],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -196,9 +197,10 @@ M.store_offset = function()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local line = vim.fn.line(".")
|
local cursor_pos = vim.fn.getcurpos()
|
||||||
harpoon.get_mark_config().marks[idx].row = line
|
log.debug(string.format("store_offset(): Stored row: %d, col: %d", cursor_pos[2], cursor_pos[3]))
|
||||||
log.debug("store_offset(): Stored line:", line)
|
harpoon.get_mark_config().marks[idx].row = cursor_pos[2]
|
||||||
|
harpoon.get_mark_config().marks[idx].col = cursor_pos[3]
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if not ok then
|
if not ok then
|
||||||
|
@ -108,9 +108,12 @@ M.nav_file = function(id)
|
|||||||
|
|
||||||
vim.api.nvim_set_current_buf(buf_id)
|
vim.api.nvim_set_current_buf(buf_id)
|
||||||
if set_row and mark.row then
|
if set_row and mark.row then
|
||||||
local ok, err = pcall(vim.cmd, string.format(":%d", mark.row))
|
local ok, err = pcall(vim.cmd, string.format(":call cursor(%d, %d)", mark.row, mark.col))
|
||||||
if not ok then
|
if not ok then
|
||||||
log.warn("nav_file(): Could not set row to", mark.row, err)
|
log.warn(
|
||||||
|
string.format("nav_file(): Could not set cursor to row: %d, col: %d", mark.row, mark.col),
|
||||||
|
err
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user