|
@@ -1,5 +1,4 @@
|
|
local M = {}
|
|
local M = {}
|
|
-local utils = require "utils"
|
|
|
|
local Log = require "core.log"
|
|
local Log = require "core.log"
|
|
|
|
|
|
M.config = function()
|
|
M.config = function()
|
|
@@ -90,29 +89,9 @@ M._exec_toggle = function(exec)
|
|
exec_term:toggle()
|
|
exec_term:toggle()
|
|
end
|
|
end
|
|
|
|
|
|
-local function get_log_path(name)
|
|
|
|
- --handle custom paths not managed by Plenary.log
|
|
|
|
- local file
|
|
|
|
- if name == "nvim" then
|
|
|
|
- file = utils.join_paths(vim.fn.stdpath "cache", "log")
|
|
|
|
- elseif name == "packer.nvim" then
|
|
|
|
- file = utils.join_paths(vim.fn.stdpath "cache", "packer.nvim.log")
|
|
|
|
- else
|
|
|
|
- file = Log:get_path()
|
|
|
|
- end
|
|
|
|
- if utils.is_file(file) then
|
|
|
|
- return file
|
|
|
|
- end
|
|
|
|
-end
|
|
|
|
-
|
|
|
|
---Toggles a log viewer according to log.viewer.layout_config
|
|
---Toggles a log viewer according to log.viewer.layout_config
|
|
----@param name can be the name of any of the managed logs, e,g. "lunarvim" or the default ones {"nvim", "lsp", "packer.nvim"}
|
|
|
|
-M.toggle_log_view = function(name)
|
|
|
|
- local logfile = get_log_path(name)
|
|
|
|
- if not logfile then
|
|
|
|
- return
|
|
|
|
- end
|
|
|
|
-
|
|
|
|
|
|
+---@param logfile string the fullpath to the logfile
|
|
|
|
+M.toggle_log_view = function(logfile)
|
|
local log_viewer = lvim.log.viewer.cmd
|
|
local log_viewer = lvim.log.viewer.cmd
|
|
if vim.fn.executable(log_viewer) ~= 1 then
|
|
if vim.fn.executable(log_viewer) ~= 1 then
|
|
log_viewer = "less +F"
|
|
log_viewer = "less +F"
|
|
@@ -129,7 +108,6 @@ M.toggle_log_view = function(name)
|
|
|
|
|
|
local Terminal = require("toggleterm.terminal").Terminal
|
|
local Terminal = require("toggleterm.terminal").Terminal
|
|
local log_view = Terminal:new(term_opts)
|
|
local log_view = Terminal:new(term_opts)
|
|
- -- require("core.log"):debug("term", vim.inspect(term_opts))
|
|
|
|
log_view:toggle()
|
|
log_view:toggle()
|
|
end
|
|
end
|
|
|
|
|