From 4417eb0a77892f4b24eeb5adc97b8890f14187fb Mon Sep 17 00:00:00 2001 From: Luca Matei Pintilie Date: Fri, 11 Feb 2022 17:33:32 +0100 Subject: Update NvChad config --- .config/nvim/lua/custom/chadrc.lua | 17 +++++++++---- .config/nvim/lua/custom/init.lua | 23 ++++++++++------- .config/nvim/lua/custom/plugins/init.lua | 42 ++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 14 deletions(-) create mode 100644 .config/nvim/lua/custom/plugins/init.lua diff --git a/.config/nvim/lua/custom/chadrc.lua b/.config/nvim/lua/custom/chadrc.lua index bc4b88e..a5de99c 100644 --- a/.config/nvim/lua/custom/chadrc.lua +++ b/.config/nvim/lua/custom/chadrc.lua @@ -1,8 +1,9 @@ -- IMPORTANT NOTE : This is the user config, can be edited. Will be preserved if updated with internal updater -- This file is for NvChad options & tools, custom settings are split between here and 'lua/custom/init.lua' +local userPlugins = require "custom.plugins" local M = {} -M.options, M.ui, M.mappings, M.plugins = {}, {}, {}, {} +-- M.options, M.ui, M.mappings, M.plugins = {}, {}, {}, {} -- NOTE: To use this, make a copy with `cp example_chadrc.lua chadrc.lua` @@ -11,16 +12,22 @@ M.options, M.ui, M.mappings, M.plugins = {}, {}, {}, {} -- To use this file, copy the structure of `core/default_config.lua`, -- examples of setting relative number & changing theme: --- M.options = { --- relativenumber = true, --- } +M.options = { + relativenumber = true, + expandtab = false, + shiftwidth = 4, + smartindent = false, + tabstop = 4, +} M.ui = { - theme = "chadracula" + theme = "chadracula", + transparency = true, } -- NvChad included plugin options & overrides M.plugins = { + install = userPlugins, options = { -- lspconfig = { -- path of file containing setups of different lsps (ex : "custom.plugins.lspconfig"), read the docs for more info diff --git a/.config/nvim/lua/custom/init.lua b/.config/nvim/lua/custom/init.lua index 473ff84..6d1f5fb 100644 --- a/.config/nvim/lua/custom/init.lua +++ b/.config/nvim/lua/custom/init.lua @@ -1,6 +1,7 @@ -- This is where your custom modules and plugins go. -- See the wiki for a guide on how to extend NvChad -local hooks = require "core.hooks" +--local customPlugins = require "core.customPlugins" + vim.api.nvim_command("nnoremap :m .+1==") vim.api.nvim_command("nnoremap :m .-2==") vim.api.nvim_command("inoremap :m .+1==gi") @@ -17,7 +18,7 @@ vim.api.nvim_command("vnoremap :m '<-2gv=gv") -- 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 --- hooks.override("lsp", "publish_diagnostics", function(current) +-- customPlugins.override("lsp", "publish_diagnostics", function(current) -- current.virtual_text = false; -- return current; -- end) @@ -26,7 +27,7 @@ vim.api.nvim_command("vnoremap :m '<-2gv=gv") -- you can set one or many mappings -- example below: --- hooks.add("setup_mappings", function(map) +-- customPlugins.add("setup_mappings", function(map) -- map("n", "cc", "gg0vG$d", opt) -- example to delete the buffer -- .... many more mappings .... -- end) @@ -36,7 +37,8 @@ vim.api.nvim_command("vnoremap :m '<-2gv=gv") -- see: https://github.com/wbthomason/packer.nvim -- examples below: -hooks.add("install_plugins", function(use) +--[[ +customPlugins.add("install_plugins", function(use) use { "williamboman/nvim-lsp-installer", config = function() @@ -51,11 +53,14 @@ hooks.add("install_plugins", function(use) server:setup(opts) vim.cmd [[ do User LspAttachBuffers ]] - end) - end, - } +-- end) +-- end, +-- } + --]] -- Custom stuff - use { "nathom/filetype.nvim" } + -- use { "nathom/filetype.nvim" } + --[[ + use { "karb94/neoscroll.nvim", @@ -77,7 +82,7 @@ hooks.add("install_plugins", function(use) "editorconfig/editorconfig-vim", } end) - +--]] -- alternatively, put this in a sub-folder like "lua/custom/plugins/mkdir" -- then source it with diff --git a/.config/nvim/lua/custom/plugins/init.lua b/.config/nvim/lua/custom/plugins/init.lua new file mode 100644 index 0000000..5b40def --- /dev/null +++ b/.config/nvim/lua/custom/plugins/init.lua @@ -0,0 +1,42 @@ + return { +{ + "williamboman/nvim-lsp-installer", + config = function() + local lsp_installer = require "nvim-lsp-installer" + + lsp_installer.on_server_ready(function(server) + local opts = {} + + if server.name == "denols" then + opts.root_dir = vim.loop.cwd + end + + server:setup(opts) + vim.cmd [[ do User LspAttachBuffers ]] + end) + end, + } + -- Custom stuff + ,{ "nathom/filetype.nvim" } + + ,{ + "karb94/neoscroll.nvim", + opt = true, + config = function() + require("neoscroll").setup() + end, + + -- lazy loading + setup = function() + require("core.utils").packer_lazy_load "neoscroll.nvim" + end, + } + + ,{ + "prettier/vim-prettier", + } + ,{ + "editorconfig/editorconfig-vim", + } + +} -- cgit v1.2.3