From 9257e68c05eff293ea15a484d994b83fd7c610d8 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Fri, 17 Sep 2021 08:29:35 +0200 Subject: fix: use the correct API for the log-viewer (#1564) --- lua/core/terminal.lua | 9 +++++---- lua/core/which-key.lua | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'lua') diff --git a/lua/core/terminal.lua b/lua/core/terminal.lua index 87053412..4525ca63 100644 --- a/lua/core/terminal.lua +++ b/lua/core/terminal.lua @@ -1,5 +1,6 @@ local M = {} local utils = require "utils" +local Log = require "core.log" M.config = function() lvim.builtin["terminal"] = { @@ -81,7 +82,6 @@ end M._exec_toggle = function(exec) local binary = M._split(exec)[1] if vim.fn.executable(binary) ~= 1 then - local Log = require "core.log" Log:error("Unable to run executable " .. binary .. ". Please make sure it is installed properly.") return end @@ -92,12 +92,13 @@ end local function get_log_path(name) --handle custom paths not managed by Plenary.log - local logger = require "core.log" local file if name == "nvim" then - file = utils.join_paths(get_cache_dir(), "log") + 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 = logger:new({ plugin = name }):get_path() + file = Log:get_path() end if utils.is_file(file) then return file diff --git a/lua/core/which-key.lua b/lua/core/which-key.lua index 3379100d..36949467 100644 --- a/lua/core/which-key.lua +++ b/lua/core/which-key.lua @@ -198,16 +198,16 @@ M.config = function() "lua require('core.terminal').toggle_log_view('lunarvim')", "view default log", }, - D = { "edit ~/.cache/nvim/lunarvim.log", "Open the default logfile" }, + D = { "exe 'edit '.stdpath('cache').'/lunarvim.log'", "Open the default logfile" }, n = { "lua require('core.terminal').toggle_log_view('lsp')", "view lsp log" }, - N = { "edit ~/.cache/nvim/log", "Open the Neovim logfile" }, + N = { "edit $NVIM_LOG_FILE", "Open the Neovim logfile" }, l = { "lua require('core.terminal').toggle_log_view('nvim')", "view neovim log" }, - L = { "edit ~/.cache/nvim/lsp.log", "Open the LSP logfile" }, + L = { "exe 'edit '.stdpath('cache').'/lsp.log'", "Open the LSP logfile" }, p = { "lua require('core.terminal').toggle_log_view('packer.nvim')", "view packer log", }, - P = { "edit ~/.cache/nvim/packer.nvim.log", "Open the Packer logfile" }, + P = { "exe 'edit '.stdpath('cache').'/packer.nvim.log'", "Open the Packer logfile" }, }, r = { "lua require('utils').reload_lv_config()", "Reload configurations" }, }, -- cgit v1.2.3