Parcourir la source

fix: can't open lvim log file cause by `lvim.log.viewer.cmd` (#1638)

Xavier Young il y a 3 ans
Parent
commit
35d5615ecc
1 fichiers modifiés avec 7 ajouts et 1 suppressions
  1. 7 1
      lua/core/terminal.lua

+ 7 - 1
lua/core/terminal.lua

@@ -112,8 +112,14 @@ M.toggle_log_view = function(name)
   if not logfile then
     return
   end
+
+  local log_viewer = lvim.log.viewer.cmd
+  if vim.fn.executable(log_viewer) ~= 1 then
+    log_viewer = "less +F"
+  end
+  log_viewer = log_viewer .. " " .. logfile
   local term_opts = vim.tbl_deep_extend("force", lvim.builtin.terminal, {
-    cmd = lvim.log.viewer.cmd .. " " .. logfile,
+    cmd = log_viewer,
     open_mapping = lvim.log.viewer.layout_config.open_mapping,
     direction = lvim.log.viewer.layout_config.direction,
     -- TODO: this might not be working as expected