- update readme
- revert nonfunctional changes in term.lua
- promote log level for next and previous commands
- make env var more important than vim.g
This commit is contained in:
Raigo Jerva 2021-05-02 10:52:00 +03:00
parent c245041e21
commit a6e8a63520
No known key found for this signature in database
GPG Key ID: 2156679E782853EC
5 changed files with 19 additions and 17 deletions

View File

@ -176,5 +176,7 @@ require("harpoon").setup({
``` ```
## Debugging
Harpoon writes logs to a `harpoon.log` file that resides in Neovim's cache path. (`:echo stdpath("cache")` to find where that is for you.)
By default, logging is enabled for warnings and above. This can be changed by setting `vim.g.harpoon_log_level` variable to one of the following log levels: `trace`, `debug`, `info`, `warn`, `error`, or `fatal`. Note that this would have to be done **before** harpoon's `setup` call. Alternatively, it can be more convenient to launch Neovim with an environment variable, e.g. `> HARPOON_LOG=trace nvim`. In case both, `vim.g` and an environment variable are used, the log level set by the environment variable overrules. Supplying an invalid log level defaults back to warnings.

View File

@ -10,8 +10,8 @@ M.reload = function()
end end
local function set_log_level() local function set_log_level()
local log_levels = { "trace", "debug", "info", "warning", "error", "fatal" } local log_levels = { "trace", "debug", "info", "warn", "error", "fatal" }
local log_level = vim.g.harpoon_log_level or vim.env.HARPOON_LOG local log_level = vim.env.HARPOON_LOG or vim.g.harpoon_log_level
for _, level in pairs(log_levels) do for _, level in pairs(log_levels) do
if level == log_level then if level == log_level then

View File

@ -145,16 +145,14 @@ M.setup = function(config)
end end
local complete_config = local complete_config =
merge_tables({ merge_tables(
projects = {}, {projects = {} , global_settings = {
global_settings = {
["save_on_toggle"] = false, ["save_on_toggle"] = false,
["save_on_change"] = true, ["save_on_change"] = true,
}, }},
}, expand_dir(c_config),
expand_dir(c_config), expand_dir(u_config),
expand_dir(u_config), expand_dir(config))
expand_dir(config))
-- There was this issue where the vim.loop.cwd() didn't have marks or term, but had -- There was this issue where the vim.loop.cwd() didn't have marks or term, but had
-- an object for vim.loop.cwd() -- an object for vim.loop.cwd()
@ -193,3 +191,4 @@ end
M.setup() M.setup()
return M return M

View File

@ -1,4 +1,5 @@
local harpoon = require("harpoon") local harpoon = require('harpoon')
local Path = require("plenary.path")
local log = require("harpoon.dev").log local log = require("harpoon.dev").log
local M = {} local M = {}
@ -10,7 +11,7 @@ local function create_terminal()
vim.cmd(":terminal") vim.cmd(":terminal")
local buf_id = vim.fn.bufnr() local buf_id = vim.fn.bufnr()
local term_id = vim.b.terminal_job_id local term_id = vim.b.terminal_job_id
if term_id == nil then if term_id == nil then
log.error("_create_terminal(): term_id is nil") log.error("_create_terminal(): term_id is nil")
@ -20,7 +21,7 @@ local function create_terminal()
-- Make sure the term buffer has "hidden" set so it doesn't get thrown -- Make sure the term buffer has "hidden" set so it doesn't get thrown
-- away and cause an error -- away and cause an error
vim.api.nvim_buf_set_option(buf_id, "bufhidden", "hide") vim.api.nvim_buf_set_option(buf_id, 'bufhidden', 'hide')
-- Resets the buffer back to the old one -- Resets the buffer back to the old one
vim.api.nvim_set_current_buf(current_id) vim.api.nvim_set_current_buf(current_id)
@ -42,7 +43,7 @@ local function find_terminal(idx)
term_handle = { term_handle = {
buf_id = buf_id, buf_id = buf_id,
term_id = term_id, term_id = term_id
} }
terminals[idx] = term_handle terminals[idx] = term_handle
end end

View File

@ -169,7 +169,7 @@ function M.close_notification(bufnr)
end end
M.nav_next = function() M.nav_next = function()
log.debug("nav_next()") log.info("nav_next()")
local current_index = Marked.get_current_index() local current_index = Marked.get_current_index()
local number_of_items = Marked.get_length() local number_of_items = Marked.get_length()
@ -186,7 +186,7 @@ M.nav_next = function()
end end
M.nav_prev = function() M.nav_prev = function()
log.debug("nav_prev()") log.info("nav_prev()")
local current_index = Marked.get_current_index() local current_index = Marked.get_current_index()
local number_of_items = Marked.get_length() local number_of_items = Marked.get_length()