You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
705 B

  1. _G.dump = function(...)
  2. print(vim.inspect(...))
  3. end
  4. _G.prequire = function(...)
  5. local status, lib = pcall(require, ...)
  6. if status then
  7. return lib
  8. end
  9. return nil
  10. end
  11. local M = {}
  12. function M.t(str)
  13. return vim.api.nvim_replace_termcodes(str, true, true, true)
  14. end
  15. function M.log(msg, hl, name)
  16. name = name or "Neovim"
  17. hl = hl or "Todo"
  18. vim.api.nvim_echo({ { name .. ": ", hl }, { msg } }, true, {})
  19. end
  20. function M.warn(msg, name)
  21. vim.notify(msg, vim.log.levels.WARN, { title = name })
  22. end
  23. function M.error(msg, name)
  24. vim.notify(msg, vim.log.levels.ERROR, { title = name })
  25. end
  26. function M.info(msg, name)
  27. vim.notify(msg, vim.log.levels.INFO, { title = name })
  28. end
  29. return M