summaryrefslogtreecommitdiff
path: root/lua/utils/init.lua
diff options
context:
space:
mode:
authorkylo252 <[email protected]>2021-08-09 19:02:37 +0200
committerGitHub <[email protected]>2021-08-09 19:02:37 +0200
commit405423108fc31981c40116a827e845a1179c9053 (patch)
tree41a7cb23536c982ccdc3402ab9d4602f2538eb40 /lua/utils/init.lua
parent625df947dcacf3804f4ec7335478535ecd8219af (diff)
feat: Add an async logger using plenary (#1207)
Co-authored-by: rebuilt <[email protected]>
Diffstat (limited to 'lua/utils/init.lua')
-rw-r--r--lua/utils/init.lua19
1 files changed, 15 insertions, 4 deletions
diff --git a/lua/utils/init.lua b/lua/utils/init.lua
index df472c66..208871bf 100644
--- a/lua/utils/init.lua
+++ b/lua/utils/init.lua
@@ -1,4 +1,6 @@
local utils = {}
+local Log = require "core.log"
+local uv = vim.loop
-- recursive Print (structure, limit, separator)
local function r_inspect_settings(structure, limit, separator)
@@ -68,6 +70,9 @@ function utils.toggle_autoformat()
},
},
}
+ if Log:get_default() then
+ Log:get_default().info "Format on save active"
+ end
end
if not lvim.format_on_save then
@@ -76,6 +81,9 @@ function utils.toggle_autoformat()
:autocmd! autoformat
endif
]]
+ if Log:get_default() then
+ Log:get_default().info "Format on save off"
+ end
end
end
@@ -91,6 +99,7 @@ function utils.reload_lv_config()
vim.cmd ":PackerInstall"
require("keymappings").setup()
-- vim.cmd ":PackerClean"
+ Log:get_default().info "Reloaded configuration"
end
function utils.check_lsp_client_active(name)
@@ -157,10 +166,12 @@ function utils.gsub_args(args)
return args
end
-function utils.lvim_log(msg)
- if lvim.debug then
- vim.notify(msg, vim.log.levels.DEBUG)
- end
+--- Checks whether a given path exists and is a file.
+--@param filename (string) path to check
+--@returns (bool)
+function utils.is_file(filename)
+ local stat = uv.fs_stat(filename)
+ return stat and stat.type == "file" or false
end
return utils