mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 01:50:27 +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()]
|
local proj = projects[vim.loop.cwd()]
|
||||||
if proj.mark == nil then
|
if proj.mark == nil then
|
||||||
log.trace("ensure_correct_config(): No marks found for", vim.loop.cwd())
|
log.trace("ensure_correct_config(): No marks found for", vim.loop.cwd())
|
||||||
proj.mark = { marks = {} }
|
proj.mark = {marks = {}}
|
||||||
end
|
end
|
||||||
|
|
||||||
if proj.term == nil then
|
if proj.term == nil then
|
||||||
log.trace("ensure_correct_config(): No terminal commands found for", vim.loop.cwd())
|
log.trace("ensure_correct_config(): No terminal commands found for", vim.loop.cwd())
|
||||||
proj.term = { cmds = {} }
|
proj.term = {cmds = {}}
|
||||||
end
|
end
|
||||||
|
|
||||||
local marks = proj.mark.marks
|
local marks = proj.mark.marks
|
||||||
|
@ -100,6 +100,7 @@ local function validate_buf_name(buf_name)
|
|||||||
log.trace("_validate_buf_name():", buf_name)
|
log.trace("_validate_buf_name():", buf_name)
|
||||||
if buf_name == "" or buf_name == nil then
|
if buf_name == "" or buf_name == nil then
|
||||||
log.error("_validate_buf_name(): Not a valid name for a mark,", buf_name)
|
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
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -107,7 +108,8 @@ end
|
|||||||
M.get_index_of = function(item)
|
M.get_index_of = function(item)
|
||||||
log.debug("get_index_of():", item)
|
log.debug("get_index_of():", item)
|
||||||
if item == nil then
|
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
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -111,14 +111,9 @@ M.nav_file = function(id)
|
|||||||
local set_row = not vim.api.nvim_buf_is_loaded(buf_id)
|
local set_row = not vim.api.nvim_buf_is_loaded(buf_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 and mark.col then
|
||||||
local ok, err = pcall(vim.cmd, string.format(":call cursor(%d, %d)", mark.row, mark.col))
|
vim.cmd(string.format(":call cursor(%d, %d)", mark.row, mark.col))
|
||||||
if not ok then
|
log.trace(string.format("nav_file(): Setting cursor to row: %d, col: %d", mark.row, mark.col))
|
||||||
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
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user