From 3d0a0e53f70d3f9398f0ddc418df5fe31fe27c2e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 24 Sep 2021 09:30:20 +0000 Subject: [PATCH] chore: format source code --- lua/custom/example_chadrc.lua | 28 +++++++++++++--------------- lua/custom/example_init.lua | 10 +++------- lua/plugins/configs/lspconfig.lua | 9 ++++++--- lua/plugins/init.lua | 31 +++++++++++++++---------------- 4 files changed, 37 insertions(+), 41 deletions(-) diff --git a/lua/custom/example_chadrc.lua b/lua/custom/example_chadrc.lua index 881dc5e..24bff0d 100644 --- a/lua/custom/example_chadrc.lua +++ b/lua/custom/example_chadrc.lua @@ -21,21 +21,19 @@ M.options, M.ui, M.mappings, M.plugins = {}, {}, {}, {} -- NvChad included plugin options & overrides M.plugins = { - options = { - -- lspconfig = { - -- -- servers = {"html", "cssls"} - -- servers = {}, - -- }, - }, - -- To change the Packer `config` of a plugin that comes with NvChad, - -- add a table entry below matching the plugin github name - -- '-' -> '_', remove any '.lua', '.nvim' extensions - -- this string will be called in a `require` - -- use "(custom.configs).my_func()" to call a function - -- use "custom.blankline" to call a file - default_plugin_config_replace = { - - }, + options = { + -- lspconfig = { + -- -- servers = {"html", "cssls"} + -- servers = {}, + -- }, + }, + -- To change the Packer `config` of a plugin that comes with NvChad, + -- add a table entry below matching the plugin github name + -- '-' -> '_', remove any '.lua', '.nvim' extensions + -- this string will be called in a `require` + -- use "(custom.configs).my_func()" to call a function + -- use "custom.blankline" to call a file + default_plugin_config_replace = {}, } return M diff --git a/lua/custom/example_init.lua b/lua/custom/example_init.lua index 8b2aad4..28b8ccb 100644 --- a/lua/custom/example_init.lua +++ b/lua/custom/example_init.lua @@ -10,29 +10,25 @@ local hooks = require "core.hooks" -- To modify packaged plugin configs, use the overrides functionality -- if the override does not exist in the plugin config, make or request a PR, -- or you can override the whole plugin config with 'chadrc' -> M.plugins.default_plugin_config_replace{} - -- this will run your config instead of the NvChad config for the given plugin +-- this will run your config instead of the NvChad config for the given plugin -- hooks.override("lsp", "publish_diagnostics", function(current) -- current.virtual_text = false; -- return current; -- end) - - -- To add new mappings, use the "setup_mappings" hook, -- you can set one or many mappings -- example below: - + -- hooks.add("setup_mappings", function(map) -- map("n", "cc", "gg0vG$d", opt) -- example to delete the buffer -- .... many more mappings .... -- end) - - -- To add new plugins, use the "install_plugin" hook, -- NOTE: we heavily suggest using Packer's lazy loading (with the 'event' field) - -- see: https://github.com/wbthomason/packer.nvim +-- see: https://github.com/wbthomason/packer.nvim -- examples below: -- hooks.add("install_plugins", function(use) diff --git a/lua/plugins/configs/lspconfig.lua b/lua/plugins/configs/lspconfig.lua index 96017c8..145600c 100644 --- a/lua/plugins/configs/lspconfig.lua +++ b/lua/plugins/configs/lspconfig.lua @@ -1,5 +1,5 @@ local present1, nvim_lsp = pcall(require, "lspconfig") -local overrides = require("core.hooks").createOverrides("lsp") +local overrides = require("core.hooks").createOverrides "lsp" if not present1 then return @@ -82,7 +82,7 @@ lspSymbol("Information", "") lspSymbol("Hint", "") lspSymbol("Warning", "") -local lsp_publish_diagnostics_options = overrides.get('publish_diagnostics', { +local lsp_publish_diagnostics_options = overrides.get("publish_diagnostics", { virtual_text = { prefix = "", spacing = 0, @@ -91,7 +91,10 @@ local lsp_publish_diagnostics_options = overrides.get('publish_diagnostics', { underline = true, update_in_insert = false, -- update diagnostics insert mode }) -vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, lsp_publish_diagnostics_options) +vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, + lsp_publish_diagnostics_options +) vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "single", }) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index b9f6519..5363c96 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -14,22 +14,22 @@ return packer.startup(function() -- default_req = run this if 'name' does not exist in `default_config` / `chadrc` -- if override or default_req start with `(`, then strip that and assume override calls a function, not a whole file local override_req = function(name, default_req) - local override = require("core.utils").load_config().plugins.default_plugin_config_replace[name] - local result - - if override == nil then - result = default_req - else - result = override - end + local override = require("core.utils").load_config().plugins.default_plugin_config_replace[name] + local result - if string.match(result, '^%(') then - result = result:sub(2) - result = result:gsub("%)%.", "').", 1) - return "require('" .. result - else - return "require('" .. result .. "')" - end + if override == nil then + result = default_req + else + result = override + end + + if string.match(result, "^%(") then + result = result:sub(2) + result = result:gsub("%)%.", "').", 1) + return "require('" .. result + else + return "require('" .. result .. "')" + end end -- this is arranged on the basis of when a plugin starts @@ -79,7 +79,6 @@ return packer.startup(function() end, } - use { "lukas-reineke/indent-blankline.nvim", disable = not plugin_status.blankline,