From a3690ed8ca90823787fbaddb72f0a1874f1e999d Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Wed, 17 Nov 2021 22:24:43 +0100 Subject: Add lunarvim update to lsp/general --- .config/nvim/lua/utils/init.lua | 60 ----------------------------------------- 1 file changed, 60 deletions(-) (limited to '.config/nvim/lua/utils/init.lua') 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) -- cgit v1.2.3-70-g09d2