Skip to content

Commit

Permalink
migrate to NvChad 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
le4ker committed Apr 15, 2024
1 parent fd40170 commit 6fc7029
Show file tree
Hide file tree
Showing 51 changed files with 286 additions and 1,967 deletions.
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
plugin
spell
ftplugin
syntax
coc-settings.json
.luarc.json
after
**/.DS_Store
File renamed without changes.
67 changes: 33 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,55 +50,54 @@ rm -rf ~/.config/nvim
rm -rf ~/.local/share/nvim
```

Install config:
Download the config and install the dependencies:

```sh
git clone https://github.com/le4ker/NvMegaChad ~/.config/nvim/
nvim
git clone https://github.com/le4ker/NvMegaChad ~/.config/nvim && nvim
```

## Language Servers

- bash-language-server
- clangd
- css-lsp
- dockerfile-language-server
- gopls
- html-lsp
- lua-language-server
- marksman
- pyright
- ruby-lsp
- taplo
- terraform-ls
- typescript-language-server
- vim-language-server
- yaml-language-server
- [bash-language-server](https://github.com/bash-lsp/bash-language-server)
- [clangd](https://clangd.llvm.org)
- [css-lsp](https://github.com/microsoft/vscode-css-languageservice)
- [dockerfile-language-server](https://github.com/rcjsuen/dockerfile-language-server-nodejs)
- [gopls](https://pkg.go.dev/golang.org/x/tools/gopls)
- [html-lsp](https://github.com/microsoft/vscode-html-languageservice)
- [lua-language-server](https://github.com/LuaLS/lua-language-server)
- [marksman](https://github.com/artempyanykh/marksman)
- [pyright](https://github.com/microsoft/pyright)
- [ruby-lsp](https://github.com/Shopify/ruby-lsp)
- [taplo](https://taplo.tamasfe.dev/)
- [terraform-ls](https://github.com/hashicorp/terraform-ls)
- [typescript-language-server](https://github.com/typescript-language-server/typescript-language-server)
- [vim-language-server](https://github.com/iamcco/vim-language-server)
- [yaml-language-server](https://github.com/redhat-developer/yaml-language-server)

## Formatters

- black
- clang-format
- gofmt
- isort
- prettier
- rubocop
- shfmt
- stylua
- terraform_fmt
- [black](https://github.com/psf/black)
- [clang-format](https://www.kernel.org/doc/html/latest/process/clang-format.html)
- [gofmt](https://pkg.go.dev/cmd/gofmt)
- [isort](https://github.com/PyCQA/isort)
- [prettier](https://github.com/prettier/prettier)
- [rubocop](https://github.com/rubocop/rubocop)
- [shfmt](https://github.com/mvdan/sh)
- [stylua](https://github.com/JohnnyMorganz/StyLua)
- [terraform_fmt](https://developer.hashicorp.com/terraform/cli/commands/fmt)

## Linters

- golangci-lint
- markdownlint
- pylint
- rubocop
- tflint
- [golangci-lint](https://golangci-lint.run/)
- [markdownlint](https://github.com/DavidAnson/markdownlint)
- [pylint](https://pylint.org/)
- [rubocop](https://github.com/rubocop/rubocop)
- [tflint](https://github.com/terraform-linters/tflint)

## Debuggers

- delve
- debugpy
- [delve](https://github.com/go-delve/delve)
- [debugpy](https://github.com/microsoft/debugpy)

## Fetching upstream changes

Expand Down
4 changes: 0 additions & 4 deletions configs/markdownlint.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions configs/prettier.yaml

This file was deleted.

44 changes: 31 additions & 13 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
require "core"
vim.g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
vim.g.mapleader = " "

local custom_init_path = vim.api.nvim_get_runtime_file("lua/custom/init.lua", false)[1]
-- bootstrap lazy and all plugins
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"

if custom_init_path then
dofile(custom_init_path)
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

require("core.utils").load_mappings()
vim.opt.rtp:prepend(lazypath)

local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
local lazy_config = require "configs.lazy"

-- bootstrap lazy.nvim!
if not vim.loop.fs_stat(lazypath) then
require("core.bootstrap").gen_chadrc_template()
require("core.bootstrap").lazy(lazypath)
end
-- 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")
vim.opt.rtp:prepend(lazypath)
require "plugins"
dofile(vim.g.base46_cache .. "statusline")

require "nvchad.autocmds"

vim.schedule(function()
require "mappings"
end)
23 changes: 12 additions & 11 deletions lazy-lock.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "be7be2ca7f55bb881a7ffc16b2efa5af034ab06b" },
"base46": { "branch": "v2.0", "commit": "36a44bf1c712a42b46479540ee89e296c6c63cdc" },
"NvChad": { "branch": "v2.5", "commit": "0b1f669caa312ca11be79b3833296d1271bf4c75" },
"base46": { "branch": "v2.5", "commit": "adb64a6ae70f8c61c5ab8892f07d29dafd4d47ad" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "820eec990d5f332d30cf939954c8672a43a0459e" },
"copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" },
"copilot.lua": { "branch": "master", "commit": "f7612f5af4a7d7615babf43ab1e67a2d790c13a6" },
"friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" },
"gitsigns.nvim": { "branch": "main", "commit": "1a50b94066def8591d5f65bd60a4233902e9def4" },
"indent-blankline.nvim": { "branch": "master", "commit": "b7aa0aed55887edfaece23f7b46ab22232fc8741" },
"gitsigns.nvim": { "branch": "main", "commit": "d96ef3bbff0bdbc3916a220f5c74a04c4db033f2" },
"indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
"lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
"none-ls.nvim": { "branch": "main", "commit": "dca7ddec321a102ec9e792b1b29193702aff5fbb" },
"nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" },
"nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
"nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" },
"nvim-dap-go": { "branch": "main", "commit": "36abe1d320cb61bfdf094d4e0fe815ef58f2302a" },
"nvim-dap-python": { "branch": "master", "commit": "66560f0ebddf96604f7037e1efad3ba6942761e6" },
"nvim-dap-python": { "branch": "master", "commit": "3dffa58541d1f52c121fe58ced046268c838d802" },
"nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" },
"nvim-lspconfig": { "branch": "master", "commit": "b94a4c2ff309e232cfacdf8fc7658bd93919a770" },
"nvim-lint": { "branch": "master", "commit": "4055dc856d5ac8f6b85748006fd8fa6457e086e8" },
"nvim-lspconfig": { "branch": "master", "commit": "9266dc26862d8f3556c2ca77602e811472b4c5b8" },
"nvim-nio": { "branch": "master", "commit": "5800f585def265d52f1d8848133217c800bcb25d" },
"nvim-tree.lua": { "branch": "master", "commit": "81eb8d519233c105f30dc0a278607e62b20502fd" },
"nvim-treesitter": { "branch": "master", "commit": "e9321bb914b3a5a88b7dff5392f0f5f8d83bee67" },
"nvim-web-devicons": { "branch": "master", "commit": "fd4abfc5237246670977972c6f518186b621a32d" },
"nvterm": { "branch": "main", "commit": "9d7ba3b6e368243175d38e1ec956e0476fd86ed9" },
"nvim-treesitter": { "branch": "master", "commit": "2a95ff14764af20d32ec1edb27e11c38a84b9478" },
"nvim-web-devicons": { "branch": "master", "commit": "b3468391470034353f0e5110c70babb5c62967d3" },
"plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
"telescope.nvim": { "branch": "master", "commit": "d26b666b45e5dde23332e4bde1227677f2d92e31" },
"ui": { "branch": "v2.0", "commit": "7b3225264af17a9e0aff0b4fd2a0fac90b73db53" },
"telescope.nvim": { "branch": "master", "commit": "4d4ade7f2b8f403e8816ca50c05ed16e259b21fb" },
"ui": { "branch": "v2.5", "commit": "e1af69426b3c4b55c88bd1c81790c1c73b30bfa8" },
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
}
22 changes: 9 additions & 13 deletions lua/custom/chadrc.lua → lua/chadrc.lua
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
---@type ChadrcConfig
local M = {}

local function LSP_status()
local function lsp()
if rawget(vim, "lsp") then
for _, client in ipairs(vim.lsp.get_active_clients()) do
local stbufnr = vim.api.nvim_win_get_buf(vim.g.statusline_winid)

-- ignore copilot and null-ls clients
if client.attached_buffers[stbufnr] and client.name ~= "copilot" and client.name ~= "null-ls" then
-- ignore copilot
if client.attached_buffers[stbufnr] and client.name ~= "copilot" then
return (vim.o.columns > 100 and "%#St_LspStatus#" .. "  LSP ~ " .. client.name .. " ") or "  LSP "
end
end
end
end

M.ui = {
theme = "everforest",
theme = "everforest_light",
tabufline = {
overriden_modules = function(modules)
table.remove(modules, 4)
end,
order = { "treeOffset", "buffers", "tabs" },
},
statusline = {
theme = "minimal",
separator_style = "block",
overriden_modules = function(modules)
modules[8] = LSP_status() or ""
end,
modules = {
lsp = lsp,
},
},
}

M.plugins = "custom.plugins"
M.mappings = require "custom.mappings"

return M
33 changes: 33 additions & 0 deletions lua/configs/conform.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
local options = {
formatters_by_ft = {
c = { "clangd-format" },
cpp = { "clangd-format" },
css = { "prettier" },
go = { "goimports", "gofmt" },
graphql = { "prettier" },
html = { "prettier" },
javascript = { "prettier" },
javascriptreact = { "prettier" },
json = { "prettier" },
lua = { "stylua" },
markdown = { "prettier" },
python = { "isort", "black" },
scss = { "prettier" },
sh = { "shfmt" },
ruby = { "rubocop" },
terraform = { "terraform_fmt" },
toml = { "taplo" },
typescript = { "prettier" },
typercriptreact = { "prettier" },
yaml = { "prettier" },
zsh = { "shfmt" },
},

format_on_save = {
lsp_fallback = true,
async = false,
timeout_ms = 500,
},
}

require("conform").setup(options)
File renamed without changes.
17 changes: 17 additions & 0 deletions lua/configs/lint.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local lint = require "lint"

lint.linters_by_ft = {
go = { "golangcilint" },
markdown = { "markdownlint" },
python = { "pylint" },
ruby = { "rubocop" },
terraform = { "tflint" },
}

local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave", "TextChanged" }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
15 changes: 5 additions & 10 deletions lua/custom/configs/lspconfig.lua → lua/configs/lspconfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,26 @@ local default_servers = {
"dockerls",
"html",
"marksman",
"ruby_ls",
"ruby_lsp",
"taplo",
"terraformls",
"tflint",
"tsserver",
"vimls",
}

local lspconfig = require "lspconfig"
local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities
local on_attach = require("nvchad.configs.lspconfig").on_attach
local capabilities = require("nvchad.configs.lspconfig").capabilities

for _, lsp in ipairs(default_servers) do
---@diagnostic disable-next-line: undefined-field
lspconfig[lsp].setup {
on_attach = on_attach,
capabilities = capabilities,
}
end

local format_on_save = require("custom.configs.utils").format_on_save

lspconfig.taplo.setup {
on_attach = lspconfig.util.add_hook_after(on_attach, format_on_save),
capabilities = capabilities,
}

lspconfig.gopls.setup {
on_attach = on_attach,
capabilities = capabilities,
Expand Down
Loading

0 comments on commit 6fc7029

Please sign in to comment.