diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-11-17 22:24:43 +0100 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-11-17 22:24:43 +0100 |
commit | a3690ed8ca90823787fbaddb72f0a1874f1e999d (patch) | |
tree | 1b79521fdf10c133aa643e6b2e46522ab6b79097 /.config/nvim/lua/utils | |
parent | e953e2ee53503dcf070a7763743e4a76abb4518d (diff) |
Add lunarvim update to lsp/general
Diffstat (limited to '.config/nvim/lua/utils')
-rw-r--r-- | .config/nvim/lua/utils/init.lua | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/.config/nvim/lua/utils/init.lua b/.config/nvim/lua/utils/init.lua index e86b798..0d06b1f 100644 --- a/.config/nvim/lua/utils/init.lua +++ b/.config/nvim/lua/utils/init.lua @@ -1,5 +1,4 @@ local utils = {} -local Log = require "core.log" local uv = vim.loop -- recursive Print (structure, limit, separator) @@ -58,53 +57,6 @@ function utils.generate_settings() io.close(file) end --- autoformat -function utils.toggle_autoformat() - if options.format_on_save then - require("core.autocmds").define_augroups { - autoformat = { - { - "BufWritePre", - "*", - ":silent lua vim.lsp.buf.formatting_sync()", - }, - }, - } - Log:debug "Format on save active" - end - - if not options.format_on_save then - vim.cmd [[ - if exists('#autoformat#BufWritePre') - :autocmd! autoformat - endif - ]] - Log:debug "Format on save off" - end -end - -function utils.reload_config() - require("core.lualine").config() - - local config = require "config" - config:load() - - require("keymappings").setup() -- this should be done before loading the plugins - vim.cmd( - "source " .. utils.join_paths(get_runtime_dir(), "lua", "plugins.lua") - ) - local plugins = require "plugins" - utils.toggle_autoformat() - local plugin_loader = require "plugin-loader" - plugin_loader:cache_reset() - plugin_loader:load { plugins, options.plugins } - vim.cmd ":PackerInstall" - vim.cmd ":PackerCompile" - -- vim.cmd ":PackerClean" - require("lsp").setup() - Log:info "Reloaded configuration" -end - function utils.unrequire(m) package.loaded[m] = nil _G[m] = nil @@ -149,18 +101,6 @@ function utils.is_directory(path) return stat and stat.type == "directory" or false end -function utils.write_file(path, txt, flag) - uv.fs_open(path, flag, 438, function(open_err, fd) - assert(not open_err, open_err) - uv.fs_write(fd, txt, -1, function(write_err) - assert(not write_err, write_err) - uv.fs_close(fd, function(close_err) - assert(not close_err, close_err) - end) - end) - end) -end - utils.join_paths = _G.join_paths function utils.write_file(path, txt, flag) |