nvim config
This commit is contained in:
parent
cdfac4d089
commit
9051320319
13 changed files with 399 additions and 0 deletions
4
.dotfiles/nvchad/custom/configs/auto-dark-mode.lua
Normal file
4
.dotfiles/nvchad/custom/configs/auto-dark-mode.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
light_theme = "ayu_light",
|
||||
dark_theme = "ayu_dark",
|
||||
}
|
24
.dotfiles/nvchad/custom/configs/conform.lua
Normal file
24
.dotfiles/nvchad/custom/configs/conform.lua
Normal file
|
@ -0,0 +1,24 @@
|
|||
local options = {
|
||||
lsp_fallback = true,
|
||||
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
|
||||
javascript = { "prettier" },
|
||||
css = { "prettier" },
|
||||
html = { "prettier" },
|
||||
|
||||
sh = { "shfmt" },
|
||||
},
|
||||
|
||||
-- adding same formatter for multiple filetypes can look too much work for some
|
||||
-- instead of the above code you could just use a loop! the config is just a table after all!
|
||||
|
||||
-- format_on_save = {
|
||||
-- -- These options will be passed to conform.format()
|
||||
-- timeout_ms = 500,
|
||||
-- lsp_fallback = true,
|
||||
-- },
|
||||
}
|
||||
|
||||
require("conform").setup(options)
|
12
.dotfiles/nvchad/custom/configs/copilot.lua
Normal file
12
.dotfiles/nvchad/custom/configs/copilot.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
-- local copilot = require "copilot"
|
||||
|
||||
local opts = {
|
||||
suggestion = {
|
||||
auto_trigger = true,
|
||||
keymap = {
|
||||
accept = "<TAB>",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return opts
|
40
.dotfiles/nvchad/custom/configs/lspconfig.lua
Normal file
40
.dotfiles/nvchad/custom/configs/lspconfig.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
local on_attach = require("plugins.configs.lspconfig").on_attach
|
||||
local capabilities = require("plugins.configs.lspconfig").capabilities
|
||||
|
||||
local lspconfig = require "lspconfig"
|
||||
local util = require "lspconfig/util"
|
||||
|
||||
-- if you just want default config for the servers then put them in a table
|
||||
local servers = { "html", "cssls", "tsserver", "clangd", "lua_ls"}
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
-- setup gopls manually
|
||||
lspconfig.gopls.setup {
|
||||
-- use defaults from lspconfig
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
-- server to use
|
||||
cmd = {"gopls"},
|
||||
-- files to run this server on
|
||||
filetypes = {"go", "gomod", "gowork", "gotmpl"},
|
||||
-- how to define the root directory
|
||||
root_dir = util.root_pattern("go.work", "go.mod", ".git"),
|
||||
-- settings
|
||||
settings = {
|
||||
gopls = {
|
||||
-- complete imports automatically
|
||||
completeUnimported = true,
|
||||
-- use placeholders during autocompletion
|
||||
usePlaceholders = true,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
--
|
||||
-- lspconfig.pyright.setup { blabla}
|
34
.dotfiles/nvchad/custom/configs/none-ls.lua
Normal file
34
.dotfiles/nvchad/custom/configs/none-ls.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
local none_ls = require("null-ls")
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
|
||||
local opts = {
|
||||
sources = {
|
||||
-- gomft
|
||||
none_ls.builtins.formatting.gofmt,
|
||||
-- goimports-reviser (https://github.com/incu6us/goimports-reviser)
|
||||
none_ls.builtins.formatting.goimports_reviser,
|
||||
-- golangci-lint
|
||||
none_ls.builtins.diagnostics.golangci_lint,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
-- check if there's any commands pre-running on the current buffer,
|
||||
-- clear those and then run out own format command
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function ()
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
end,
|
||||
}
|
||||
|
||||
return opts
|
62
.dotfiles/nvchad/custom/configs/overrides.lua
Normal file
62
.dotfiles/nvchad/custom/configs/overrides.lua
Normal file
|
@ -0,0 +1,62 @@
|
|||
local M = {}
|
||||
|
||||
M.treesitter = {
|
||||
ensure_installed = {
|
||||
"vim",
|
||||
"lua",
|
||||
"html",
|
||||
"css",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"tsx",
|
||||
"c",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
-- disable = {
|
||||
-- "python"
|
||||
-- },
|
||||
},
|
||||
}
|
||||
|
||||
M.mason = {
|
||||
ensure_installed = {
|
||||
-- lua stuff
|
||||
"lua-language-server",
|
||||
"stylua",
|
||||
|
||||
-- web dev stuff
|
||||
"css-lsp",
|
||||
"html-lsp",
|
||||
"typescript-language-server",
|
||||
"deno",
|
||||
"prettier",
|
||||
|
||||
-- c/cpp stuff
|
||||
"clangd",
|
||||
"clang-format",
|
||||
|
||||
-- golang
|
||||
"gopls",
|
||||
},
|
||||
}
|
||||
|
||||
-- git support in nvimtree
|
||||
M.nvimtree = {
|
||||
git = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
renderer = {
|
||||
highlight_git = true,
|
||||
icons = {
|
||||
show = {
|
||||
git = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
Loading…
Add table
Add a link
Reference in a new issue