From 72de021374ec4af01ea672255395f6d4908cbbf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniele=20Vigan=C3=B2?= Date: Sun, 15 Sep 2024 22:20:50 +0200 Subject: [PATCH] Migrate to NvChad v2.5 --- .gitignore | 1 + .stylua.toml | 6 +++ LICENSE | 24 +++++++++ REAME.md => README.md | 4 +- init.lua | 57 +++++++++++++++------- chadrc.lua => lua/chadrc.lua | 4 +- lua/configs/conform.lua | 15 ++++++ lua/configs/lazy.lua | 47 ++++++++++++++++++ {configs => lua/configs}/lspconfig.lua | 0 mappings.lua => lua/mappings.lua | 1 + lua/myinit.lua | 19 ++++++++ lua/options.lua | 6 +++ lua/plugins/init.lua | 64 ++++++++++++++++++++++++ plugins.lua | 67 -------------------------- 14 files changed, 227 insertions(+), 88 deletions(-) create mode 100644 .gitignore create mode 100644 .stylua.toml create mode 100644 LICENSE rename REAME.md => README.md (52%) rename chadrc.lua => lua/chadrc.lua (53%) create mode 100644 lua/configs/conform.lua create mode 100644 lua/configs/lazy.lua rename {configs => lua/configs}/lspconfig.lua (100%) rename mappings.lua => lua/mappings.lua (91%) create mode 100644 lua/myinit.lua create mode 100644 lua/options.lua create mode 100644 lua/plugins/init.lua delete mode 100644 plugins.lua diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c223b3e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*lock.json diff --git a/.stylua.toml b/.stylua.toml new file mode 100644 index 0000000..ecb6dca --- /dev/null +++ b/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fdddb29 --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/REAME.md b/README.md similarity index 52% rename from REAME.md rename to README.md index b9e875f..6c52d99 100644 --- a/REAME.md +++ b/README.md @@ -1,5 +1,7 @@ ## Install +**Derived from [NvChad v2.5](https://github.com/NvChad/NvChad/tree/v2.5)** + ```bash -git clone https://daniele.vigano.me/git/dani/nvim.git ~/.config/nvim/lua/custom +git clone https://daniele.vigano.me/git/dani/nvim.git ~/.config/nvim ``` diff --git a/init.lua b/init.lua index 1b14e19..a11f713 100644 --- a/init.lua +++ b/init.lua @@ -1,19 +1,40 @@ -local autocmd = vim.api.nvim_create_autocmd +vim.g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/" +vim.g.mapleader = " " -vim.opt.fillchars = { } --- --- restore shift-y line copy -vim.keymap.set('n', 'Y', 'Y') --- --- enable nvim intro --- vim.opt.shortmess = "filnxtToO" -vim.opt.whichwrap:remove "<>[]hl" --- --- python max columns -autocmd("FileType", { - pattern = "python", - callback = function() - vim.opt.textwidth = 79 - vim.opt.colorcolumn = "80" - end, -}) +-- bootstrap lazy and all plugins +local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" + +if not vim.loop.fs_stat(lazypath) then + local repo = "https://github.com/folke/lazy.nvim.git" + vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath } +end + +vim.opt.rtp:prepend(lazypath) + +local lazy_config = require "configs.lazy" + +-- load plugins +require("lazy").setup({ + { + "NvChad/NvChad", + lazy = false, + branch = "v2.5", + import = "nvchad.plugins", + config = function() + require "options" + end, + }, + + { import = "plugins" }, +}, lazy_config) + +-- load theme +dofile(vim.g.base46_cache .. "defaults") +dofile(vim.g.base46_cache .. "statusline") + +require "nvchad.autocmds" + +vim.schedule(function() + require "mappings" +end) +require 'myinit' diff --git a/chadrc.lua b/lua/chadrc.lua similarity index 53% rename from chadrc.lua rename to lua/chadrc.lua index 9f1d3eb..07b33fb 100644 --- a/chadrc.lua +++ b/lua/chadrc.lua @@ -2,8 +2,8 @@ local M = {} M.ui = { theme = 'nightowl' } -M.plugins = "custom.plugins" -M.mappings = require "custom.mappings" +-- M.plugins = "plugins" +-- M.mappings = require "mappings" return M diff --git a/lua/configs/conform.lua b/lua/configs/conform.lua new file mode 100644 index 0000000..a000447 --- /dev/null +++ b/lua/configs/conform.lua @@ -0,0 +1,15 @@ +local options = { + formatters_by_ft = { + lua = { "stylua" }, + -- css = { "prettier" }, + -- html = { "prettier" }, + }, + + -- format_on_save = { + -- -- These options will be passed to conform.format() + -- timeout_ms = 500, + -- lsp_fallback = true, + -- }, +} + +require("conform").setup(options) diff --git a/lua/configs/lazy.lua b/lua/configs/lazy.lua new file mode 100644 index 0000000..cd170bd --- /dev/null +++ b/lua/configs/lazy.lua @@ -0,0 +1,47 @@ +return { + defaults = { lazy = true }, + install = { colorscheme = { "nvchad" } }, + + ui = { + icons = { + ft = "", + lazy = "󰂠 ", + loaded = "", + not_loaded = "", + }, + }, + + performance = { + rtp = { + disabled_plugins = { + "2html_plugin", + "tohtml", + "getscript", + "getscriptPlugin", + "gzip", + "logipat", + "netrw", + "netrwPlugin", + "netrwSettings", + "netrwFileHandlers", + "matchit", + "tar", + "tarPlugin", + "rrhelper", + "spellfile_plugin", + "vimball", + "vimballPlugin", + "zip", + "zipPlugin", + "tutor", + "rplugin", + "syntax", + "synmenu", + "optwin", + "compiler", + "bugreport", + "ftplugin", + }, + }, + }, +} diff --git a/configs/lspconfig.lua b/lua/configs/lspconfig.lua similarity index 100% rename from configs/lspconfig.lua rename to lua/configs/lspconfig.lua diff --git a/mappings.lua b/lua/mappings.lua similarity index 91% rename from mappings.lua rename to lua/mappings.lua index 5b431d7..24149a9 100644 --- a/mappings.lua +++ b/lua/mappings.lua @@ -1,3 +1,4 @@ +require "nvchad.mappings" local M = {} M.dap = { diff --git a/lua/myinit.lua b/lua/myinit.lua new file mode 100644 index 0000000..1b14e19 --- /dev/null +++ b/lua/myinit.lua @@ -0,0 +1,19 @@ +local autocmd = vim.api.nvim_create_autocmd + +vim.opt.fillchars = { } +-- +-- restore shift-y line copy +vim.keymap.set('n', 'Y', 'Y') +-- +-- enable nvim intro +-- vim.opt.shortmess = "filnxtToO" +vim.opt.whichwrap:remove "<>[]hl" +-- +-- python max columns +autocmd("FileType", { + pattern = "python", + callback = function() + vim.opt.textwidth = 79 + vim.opt.colorcolumn = "80" + end, +}) diff --git a/lua/options.lua b/lua/options.lua new file mode 100644 index 0000000..738f20b --- /dev/null +++ b/lua/options.lua @@ -0,0 +1,6 @@ +require "nvchad.options" + +-- add yours here! + +-- local o = vim.o +-- o.cursorlineopt ='both' -- to enable cursorline! diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua new file mode 100644 index 0000000..693c591 --- /dev/null +++ b/lua/plugins/init.lua @@ -0,0 +1,64 @@ +return { + { + "stevearc/conform.nvim", + -- event = 'BufWritePre', -- uncomment for format on save + config = function() + require "configs.conform" + end, + }, + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "python-lsp-server", + "debugpy", + }, + }, + }, + { + "Bekaboo/deadcolumn.nvim", + }, + { + "neovim/nvim-lspconfig", + config = function () + require "nvchad.configs.lspconfig" + require "configs.lspconfig" + end + }, + { + "stevearc/vim-arduino", + ft = {"arduino"}, + }, + { + "tpope/vim-fugitive", + lazy = false, + }, + -- These are some examples, uncomment them if you want to see them work! + -- { + -- "neovim/nvim-lspconfig", + -- config = function() + -- require("nvchad.configs.lspconfig").defaults() + -- require "configs.lspconfig" + -- end, + -- }, + -- + -- { + -- "williamboman/mason.nvim", + -- opts = { + -- ensure_installed = { + -- "lua-language-server", "stylua", + -- "html-lsp", "css-lsp" , "prettier" + -- }, + -- }, + -- }, + -- + -- { + -- "nvim-treesitter/nvim-treesitter", + -- opts = { + -- ensure_installed = { + -- "vim", "lua", "vimdoc", + -- "html", "css" + -- }, + -- }, + -- }, +} diff --git a/plugins.lua b/plugins.lua deleted file mode 100644 index 101f2a4..0000000 --- a/plugins.lua +++ /dev/null @@ -1,67 +0,0 @@ -local plugins = { - { - "williamboman/mason.nvim", - opts = { - ensure_installed = { - "python-lsp-server", - "debugpy", - }, - }, - }, - { - "Bekaboo/deadcolumn.nvim", - }, - { - "neovim/nvim-lspconfig", - config = function () - require "plugins.configs.lspconfig" - require "custom.configs.lspconfig" - end - }, - { - "stevearc/vim-arduino", - ft = {"arduino"}, - }, - { - "rcarriga/nvim-dap-ui", - dependencies = "mfussenegger/nvim-dap", - config = function() - local dap = require("dap") - local dapui = require("dapui") - dapui.setup() - dap.listeners.after.event_initialized["dapui_config"] = function() - dapui.open() - end - dap.listeners.before.event_terminated["dapui_config"] = function() - dapui.close() - end - dap.listeners.before.event_exited["dapui_config"] = function() - dapui.close() - end - end - }, - { - "mfussenegger/nvim-dap", - config = function(_, opts) - require("core.utils").load_mappings("dap") - end - }, - { - "mfussenegger/nvim-dap-python", - ft = "python", - dependencies = { - "mfussenegger/nvim-dap", - "rcarriga/nvim-dap-ui", - }, - config = function(_, opts) - local path = "~/.local/share/nvim/mason/packages/debugpy/venv/bin/python" - require("dap-python").setup(path) - require("core.utils").load_mappings("dap_python") - end, - }, - { - "tpope/vim-fugitive", - lazy = false, - }, -} -return plugins