Merge remote-tracking branch 'upstream/master' into logging-and-various

This commit is contained in:
Raigo Jerva 2021-04-28 12:44:16 +03:00
commit 0b61951167
No known key found for this signature in database
GPG Key ID: 2156679E782853EC
2 changed files with 12 additions and 7 deletions

View File

@ -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

View File

@ -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