Init commit NVChad settings
This commit is contained in:
commit
7e5a4b053e
6
.stylua.toml
Normal file
6
.stylua.toml
Normal file
@ -0,0 +1,6 @@
|
||||
column_width = 120
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 4
|
||||
quote_style = "AutoPreferDouble"
|
||||
# call_parentheses = "None"
|
24
LICENSE
Normal file
24
LICENSE
Normal file
@ -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 <https://unlicense.org>
|
9
README.md
Normal file
9
README.md
Normal file
@ -0,0 +1,9 @@
|
||||
**This repo is supposed to used as config by NvChad users!**
|
||||
|
||||
- The main nvchad repo (NvChad/NvChad) is used as a plugin by this repo.
|
||||
- So you just import its modules , like `require "nvchad.options" , require "nvchad.mappings"`
|
||||
- So you can delete the .git from this repo ( when you clone it locally ) or fork it :)
|
||||
|
||||
# Credits
|
||||
|
||||
1) Lazyvim starter https://github.com/LazyVim/starter as nvchad's starter was inspired by Lazyvim's . It made a lot of things easier!
|
37
init.lua
Normal file
37
init.lua
Normal file
@ -0,0 +1,37 @@
|
||||
vim.g.base46_cache = vim.fn.stdpath "data" .. "/base46/"
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- bootstrap lazy and all plugins
|
||||
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
|
||||
|
||||
if not vim.uv.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",
|
||||
},
|
||||
|
||||
{ import = "plugins" },
|
||||
}, lazy_config)
|
||||
|
||||
-- load theme
|
||||
dofile(vim.g.base46_cache .. "defaults")
|
||||
dofile(vim.g.base46_cache .. "statusline")
|
||||
|
||||
require "options"
|
||||
require "nvchad.autocmds"
|
||||
|
||||
vim.schedule(function()
|
||||
require "mappings"
|
||||
end)
|
17
lua/chadrc.lua
Normal file
17
lua/chadrc.lua
Normal file
@ -0,0 +1,17 @@
|
||||
-- This file needs to have same structure as nvconfig.lua
|
||||
-- https://github.com/NvChad/ui/blob/v3.0/lua/nvconfig.lua
|
||||
-- Please read that file to know all available options :(
|
||||
|
||||
---@type ChadrcConfig
|
||||
local M = {}
|
||||
|
||||
M.base46 = {
|
||||
theme = "catppuccin",
|
||||
|
||||
-- hl_override = {
|
||||
-- Comment = { italic = true },
|
||||
-- ["@comment"] = { italic = true },
|
||||
-- },
|
||||
}
|
||||
|
||||
return M
|
53
lua/configs/conform.lua
Normal file
53
lua/configs/conform.lua
Normal file
@ -0,0 +1,53 @@
|
||||
local options = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
c_cpp = { "clang-format" },
|
||||
c = { "clang_format" },
|
||||
cpp = { "clang_format" },
|
||||
go = { "gofumpt", "goimports-reviser", "golines" },
|
||||
python = { "isort", "black" },
|
||||
bash = { "shfmt" },
|
||||
rust = { "rustfmt" },
|
||||
},
|
||||
|
||||
-- Format files style
|
||||
formatters = {
|
||||
clang_format = {
|
||||
prepend_args = {
|
||||
"-style={ \
|
||||
IndentWidth: 4, \
|
||||
TabWidth: 4, \
|
||||
UseTab: Never, \
|
||||
AccessModifierOffset: 0, \
|
||||
IndentAccessModifiers: true, \
|
||||
PackConstructorInitializers: Never}",
|
||||
},
|
||||
},
|
||||
["goimports-reviser"] = {
|
||||
prepend_args = { "-rm-unused" },
|
||||
},
|
||||
golines = {
|
||||
prepend_args = { "--max-len=80" },
|
||||
},
|
||||
black = {
|
||||
prepend_args = {
|
||||
"--fast",
|
||||
"--line-length",
|
||||
"80",
|
||||
},
|
||||
},
|
||||
isort = {
|
||||
prepend_args = {
|
||||
"--profile",
|
||||
"black",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
format_on_save = {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = true,
|
||||
},
|
||||
}
|
||||
|
||||
require("conform").setup(options)
|
47
lua/configs/lazy.lua
Normal file
47
lua/configs/lazy.lua
Normal file
@ -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",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
22
lua/configs/lint.lua
Normal file
22
lua/configs/lint.lua
Normal file
@ -0,0 +1,22 @@
|
||||
local lint = require("lint")
|
||||
|
||||
lint.linters_by_ft = {
|
||||
lua = { "luacheck" },
|
||||
python = { "flake8" },
|
||||
bash = { "shellcheck" },
|
||||
html = { "htmlhint" },
|
||||
docker = { "hadolint" },
|
||||
}
|
||||
|
||||
lint.linters.luacheck.args = {
|
||||
unpack(lint.linters.luacheck.args),
|
||||
"--globals",
|
||||
"love",
|
||||
"vim",
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
106
lua/configs/lspconfig.lua
Normal file
106
lua/configs/lspconfig.lua
Normal file
@ -0,0 +1,106 @@
|
||||
local on_attach = require("nvchad.configs.lspconfig").on_attach
|
||||
local on_init = require("nvchad.configs.lspconfig").on_init
|
||||
local capabilities = require("nvchad.configs.lspconfig").capabilities
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
-- list of all servers configured.
|
||||
lspconfig.servers = {
|
||||
"lua_ls",
|
||||
"clangd",
|
||||
"gopls",
|
||||
"pyright",
|
||||
"bashls",
|
||||
"html",
|
||||
"rust_analyzer",
|
||||
"dockerls",
|
||||
"docker_compose_language_service",
|
||||
}
|
||||
|
||||
-- list of servers configured with default config.
|
||||
local default_servers = {
|
||||
"pyright",
|
||||
"bashls",
|
||||
"html",
|
||||
"dockerls",
|
||||
"docker_compose_language_service",
|
||||
}
|
||||
|
||||
-- lsps with default config
|
||||
for _, lsp in ipairs(default_servers) do
|
||||
lspconfig[lsp].setup({
|
||||
on_attach = on_attach,
|
||||
on_init = on_init,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end
|
||||
|
||||
lspconfig.clangd.setup({
|
||||
on_attach = function(client, bufnr)
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
client.server_capabilities.documentRangeFormattingProvider = false
|
||||
on_attach(client, bufnr)
|
||||
end,
|
||||
on_init = on_init,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
lspconfig.gopls.setup({
|
||||
on_attach = function(client, bufnr)
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
client.server_capabilities.documentRangeFormattingProvider = false
|
||||
on_attach(client, bufnr)
|
||||
end,
|
||||
on_init = on_init,
|
||||
capabilities = capabilities,
|
||||
cmd = { "gopls" },
|
||||
filetypes = { "go", "gomod", "gotmpl", "gowork" },
|
||||
root_dir = lspconfig.util.root_pattern("go.work", "go.mod", ".git"),
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
},
|
||||
completeUnimported = true,
|
||||
usePlaceholders = true,
|
||||
staticcheck = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lspconfig.rust_analyzer.setup({
|
||||
tools = {
|
||||
autoSetHints = true,
|
||||
hover_with_actions = true,
|
||||
},
|
||||
server = {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
},
|
||||
})
|
||||
|
||||
lspconfig.lua_ls.setup({
|
||||
on_attach = on_attach,
|
||||
on_init = on_init,
|
||||
capabilities = capabilities,
|
||||
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
enable = false, -- Disable all diagnostics from lua_ls
|
||||
-- globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
vim.fn.expand("$VIMRUNTIME/lua"),
|
||||
vim.fn.expand("$VIMRUNTIME/lua/vim/lsp"),
|
||||
vim.fn.stdpath("data") .. "/lazy/ui/nvchad_types",
|
||||
vim.fn.stdpath("data") .. "/lazy/lazy.nvim/lua/lazy",
|
||||
"${3rd}/love2d/library",
|
||||
},
|
||||
maxPreload = 100000,
|
||||
preloadFileSize = 10000,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
4
lua/configs/mason-conform.lua
Normal file
4
lua/configs/mason-conform.lua
Normal file
@ -0,0 +1,4 @@
|
||||
require("mason-conform").setup({
|
||||
-- List of formatters to ignore during install
|
||||
ignore_install = {},
|
||||
})
|
29
lua/configs/mason-lint.lua
Normal file
29
lua/configs/mason-lint.lua
Normal file
@ -0,0 +1,29 @@
|
||||
local lint = package.loaded["lint"]
|
||||
|
||||
-- List of linters to ignore during install
|
||||
local ignore_install = {}
|
||||
|
||||
-- Helper function to find if value is in table.
|
||||
local function table_contains(table, value)
|
||||
for _, v in ipairs(table) do
|
||||
if v == value then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Build a list of linters to install minus the ignored list.
|
||||
local all_linters = {}
|
||||
for _, v in pairs(lint.linters_by_ft) do
|
||||
for _, linter in ipairs(v) do
|
||||
if not table_contains(ignore_install, linter) then
|
||||
table.insert(all_linters, linter)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
require("mason-nvim-lint").setup({
|
||||
ensure_installed = all_linters,
|
||||
automatic_installation = false,
|
||||
})
|
27
lua/configs/mason-lspconfig.lua
Normal file
27
lua/configs/mason-lspconfig.lua
Normal file
@ -0,0 +1,27 @@
|
||||
local lspconfig = package.loaded["lspconfig"]
|
||||
|
||||
-- List of servers to ignore during install
|
||||
local ignore_install = {}
|
||||
|
||||
-- Helper function to find if value is in table.
|
||||
local function table_contains(table, value)
|
||||
for _, v in ipairs(table) do
|
||||
if v == value then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Build a list of lsp servers to install minus the ignored list.
|
||||
local all_servers = {}
|
||||
for _, s in ipairs(lspconfig.servers) do
|
||||
if not table_contains(ignore_install, s) then
|
||||
table.insert(all_servers, s)
|
||||
end
|
||||
end
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = all_servers,
|
||||
automatic_installation = false,
|
||||
})
|
33
lua/configs/treesitter.lua
Normal file
33
lua/configs/treesitter.lua
Normal file
@ -0,0 +1,33 @@
|
||||
local options = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"cmake",
|
||||
"cpp",
|
||||
"fish",
|
||||
"go",
|
||||
"gomod",
|
||||
"gosum",
|
||||
"gotmpl",
|
||||
"gowork",
|
||||
"lua",
|
||||
"luadoc",
|
||||
"make",
|
||||
"markdown",
|
||||
"printf",
|
||||
"python",
|
||||
"toml",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"yaml",
|
||||
},
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
use_languagetree = true,
|
||||
},
|
||||
|
||||
indent = { enable = true },
|
||||
}
|
||||
|
||||
require("nvim-treesitter.configs").setup(options)
|
10
lua/mappings.lua
Normal file
10
lua/mappings.lua
Normal file
@ -0,0 +1,10 @@
|
||||
require "nvchad.mappings"
|
||||
|
||||
-- add yours here
|
||||
|
||||
local map = vim.keymap.set
|
||||
|
||||
map("n", ";", ":", { desc = "CMD enter command mode" })
|
||||
map("i", "jk", "<ESC>")
|
||||
|
||||
-- map({ "n", "i", "v" }, "<C-s>", "<cmd> w <cr>")
|
8
lua/options.lua
Normal file
8
lua/options.lua
Normal file
@ -0,0 +1,8 @@
|
||||
require "nvchad.options"
|
||||
|
||||
local o = vim.o
|
||||
|
||||
-- Indenting
|
||||
o.shiftwidth = 4
|
||||
o.tabstop = 4
|
||||
o.softtabstop = 4
|
62
lua/plugins/init.lua
Normal file
62
lua/plugins/init.lua
Normal file
@ -0,0 +1,62 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
require("configs.treesitter")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
event = "BufWritePre",
|
||||
config = function()
|
||||
require("configs.conform")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
require("nvchad.configs.lspconfig").defaults()
|
||||
require("configs.lspconfig")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
require("configs.lint")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"zapling/mason-conform.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = { "conform.nvim" },
|
||||
config = function()
|
||||
require("configs.mason-conform")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = { "nvim-lspconfig" },
|
||||
config = function()
|
||||
require("configs.mason-lspconfig")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"rshkarin/mason-nvim-lint",
|
||||
event = "VeryLazy",
|
||||
dependencies = { "nvim-lint" },
|
||||
config = function()
|
||||
require("configs.mason-lint")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"simrat39/rust-tools.nvim",
|
||||
ft = "rust",
|
||||
config = function()
|
||||
require("rust-tools").setup({})
|
||||
end,
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue
Block a user