mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-13 17:40:25 +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
|
||||
|
||||
local function create_mark(filename)
|
||||
local cursor_pos = vim.fn.getcurpos()
|
||||
return {
|
||||
filename = filename,
|
||||
row = 0,
|
||||
col = 0,
|
||||
row = cursor_pos[2],
|
||||
col = cursor_pos[3],
|
||||
}
|
||||
end
|
||||
|
||||
@ -196,9 +197,10 @@ M.store_offset = function()
|
||||
return
|
||||
end
|
||||
|
||||
local line = vim.fn.line(".")
|
||||
harpoon.get_mark_config().marks[idx].row = line
|
||||
log.debug("store_offset(): Stored line:", line)
|
||||
local cursor_pos = vim.fn.getcurpos()
|
||||
log.debug(string.format("store_offset(): Stored row: %d, col: %d", cursor_pos[2], cursor_pos[3]))
|
||||
harpoon.get_mark_config().marks[idx].row = cursor_pos[2]
|
||||
harpoon.get_mark_config().marks[idx].col = cursor_pos[3]
|
||||
end)
|
||||
|
||||
if not ok then
|
||||
|
@ -108,9 +108,12 @@ M.nav_file = function(id)
|
||||
|
||||
vim.api.nvim_set_current_buf(buf_id)
|
||||
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
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user