mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-13 17:40:25 +00:00
address various comments
This commit is contained in:
parent
a6e8a63520
commit
1d65f6a888
@ -72,12 +72,12 @@ local function ensure_correct_config(config)
|
||||
local proj = projects[vim.loop.cwd()]
|
||||
if proj.mark == nil then
|
||||
log.trace("ensure_correct_config(): No marks found for", vim.loop.cwd())
|
||||
proj.mark = { marks = {} }
|
||||
proj.mark = {marks = {}}
|
||||
end
|
||||
|
||||
if proj.term == nil then
|
||||
log.trace("ensure_correct_config(): No terminal commands found for", vim.loop.cwd())
|
||||
proj.term = { cmds = {} }
|
||||
proj.term = {cmds = {}}
|
||||
end
|
||||
|
||||
local marks = proj.mark.marks
|
||||
|
@ -100,6 +100,7 @@ local function validate_buf_name(buf_name)
|
||||
log.trace("_validate_buf_name():", buf_name)
|
||||
if buf_name == "" or buf_name == nil then
|
||||
log.error("_validate_buf_name(): Not a valid name for a mark,", buf_name)
|
||||
error("Couldn't find a valid file name to mark, sorry.")
|
||||
return
|
||||
end
|
||||
end
|
||||
@ -107,7 +108,8 @@ end
|
||||
M.get_index_of = function(item)
|
||||
log.debug("get_index_of():", item)
|
||||
if item == nil then
|
||||
log.error("get_index_of(): You have provided a nil value to Harpoon, please provide a string rep of the file or the file idx.")
|
||||
log.error("get_index_of(): Function has been supplied with a nil value.")
|
||||
error("You have provided a nil value to Harpoon, please provide a string rep of the file or the file idx.")
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -111,14 +111,9 @@ M.nav_file = function(id)
|
||||
local set_row = not vim.api.nvim_buf_is_loaded(buf_id)
|
||||
|
||||
vim.api.nvim_set_current_buf(buf_id)
|
||||
if set_row and mark.row then
|
||||
local ok, err = pcall(vim.cmd, string.format(":call cursor(%d, %d)", mark.row, mark.col))
|
||||
if not ok then
|
||||
log.warn(
|
||||
string.format("nav_file(): Could not set cursor to row: %d, col: %d", mark.row, mark.col),
|
||||
err
|
||||
)
|
||||
end
|
||||
if set_row and mark.row and mark.col then
|
||||
vim.cmd(string.format(":call cursor(%d, %d)", mark.row, mark.col))
|
||||
log.trace(string.format("nav_file(): Setting cursor to row: %d, col: %d", mark.row, mark.col))
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user