Initial Commit
This commit is contained in:
commit
b268e041e9
34 files changed
+1502
No files matched your search
@@ -0,0 +1,64 @@
|
||||
local options = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
c = { "clang-format" },
|
||||
cpp = { "clang-format" },
|
||||
-- go = { "gofumpt", "goimports-reviser", "golines" },
|
||||
-- haskell = { "fourmolu", "stylish-haskell" },
|
||||
python = { "isort", "black" },
|
||||
},
|
||||
|
||||
formatters = {
|
||||
-- C & C++
|
||||
["clang-format"] = {
|
||||
prepend_args = {
|
||||
"-style={ \
|
||||
IndentWidth: 4, \
|
||||
TabWidth: 4, \
|
||||
UseTab: Never, \
|
||||
AccessModifierOffset: 0, \
|
||||
IndentAccessModifiers: true, \
|
||||
PackConstructorInitializers: Never}",
|
||||
},
|
||||
},
|
||||
-- -- Golang
|
||||
-- ["goimports-reviser"] = {
|
||||
-- prepend_args = { "-rm-unused" },
|
||||
-- },
|
||||
-- golines = {
|
||||
-- prepend_args = { "--max-len=80" },
|
||||
-- },
|
||||
-- -- Lua
|
||||
-- stylua = {
|
||||
-- prepend_args = {
|
||||
-- "--column-width", "80",
|
||||
-- "--line-endings", "Unix",
|
||||
-- "--indent-type", "Spaces",
|
||||
-- "--indent-width", "4",
|
||||
-- "--quote-style", "AutoPreferDouble",
|
||||
-- },
|
||||
-- },
|
||||
-- Python
|
||||
black = {
|
||||
prepend_args = {
|
||||
"--fast",
|
||||
"--line-length",
|
||||
"80",
|
||||
},
|
||||
},
|
||||
isort = {
|
||||
prepend_args = {
|
||||
"--profile",
|
||||
"black",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
format_on_save = {
|
||||
-- These options will be passed to conform.format()
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = true,
|
||||
},
|
||||
}
|
||||
|
||||
require("conform").setup(options)
|
||||
@@ -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",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
local lint = require("lint")
|
||||
|
||||
lint.linters_by_ft = {
|
||||
lua = { "luacheck" },
|
||||
-- haskell = { "hlint" },
|
||||
python = { "flake8" },
|
||||
}
|
||||
|
||||
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,
|
||||
})
|
||||
@@ -0,0 +1,101 @@
|
||||
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 = {
|
||||
"ansiblels",
|
||||
"lua_ls",
|
||||
"clangd",
|
||||
-- "gopls",
|
||||
-- "hls",
|
||||
"ols",
|
||||
"pyright",
|
||||
}
|
||||
|
||||
-- list of servers configured with default config.
|
||||
local default_servers = {
|
||||
"ols",
|
||||
"pyright",
|
||||
}
|
||||
|
||||
-- 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.hls.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.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,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,4 @@
|
||||
require("mason-conform").setup({
|
||||
-- List of formatters to ignore during install
|
||||
ignore_install = {},
|
||||
})
|
||||
@@ -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 = true,
|
||||
})
|
||||
@@ -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,
|
||||
})
|
||||
@@ -0,0 +1,35 @@
|
||||
local options = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"cmake",
|
||||
"cpp",
|
||||
"fish",
|
||||
-- "go",
|
||||
-- "gomod",
|
||||
-- "gosum",
|
||||
-- "gotmpl",
|
||||
-- "gowork",
|
||||
-- "haskell",
|
||||
"lua",
|
||||
"luadoc",
|
||||
"make",
|
||||
"markdown",
|
||||
"odin",
|
||||
"printf",
|
||||
"python",
|
||||
"toml",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"yaml",
|
||||
},
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
use_languagetree = true,
|
||||
},
|
||||
|
||||
indent = { enable = true },
|
||||
}
|
||||
|
||||
require("nvim-treesitter.configs").setup(options)
|
||||
Reference in new issue
Block a user