FEAT: Adding new dotfiles for nvchad v2
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
rm -r nvchad
|
||||
cp -r ~/.config/nvim/lua/custom ./nvchad
|
||||
rm -r nvchad/*
|
||||
cp -r ~/.config/nvim/lua/custom/* ./nvchad
|
||||
|
@ -1,14 +1,6 @@
|
||||
local M = {}
|
||||
|
||||
M.plugins = {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
require "plugins.configs.lspconfig"
|
||||
require "custom.plugins.lspconfig"
|
||||
end,
|
||||
},
|
||||
}
|
||||
M.plugins = "custom.plugins"
|
||||
|
||||
M.options = {
|
||||
user = function()
|
||||
|
19
nvchad/lspconfig.lua
Normal file
19
nvchad/lspconfig.lua
Normal file
@ -0,0 +1,19 @@
|
||||
local on_attach = require("plugins.configs.lspconfig").on_attach
|
||||
local capabilities = require("plugins.configs.lspconfig").capabilities
|
||||
|
||||
local lspconfig = require "lspconfig"
|
||||
local servers = { "tsserver", "tailwindcss", "cssls", "prismals", "gopls", "yamlls", "hls" }
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
lspconfig.tsserver.setup {
|
||||
on_attach = function(client)
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
end,
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ M.diffview = {
|
||||
},
|
||||
}
|
||||
|
||||
local lazyGitted = false
|
||||
|
||||
M.custom = {
|
||||
n = {
|
||||
["<Leader>fm"] = { ":lua vim.lsp.buf.format() <CR>", "Formats the current buffer using built in LSP" },
|
||||
@ -30,11 +32,36 @@ M.custom = {
|
||||
["<leader>rf"] = { ":lua require('refactoring').select_refactor()<CR>", "options" },
|
||||
["<leader>q"] = { ":lua require('harpoon.mark').add_file()<CR>" },
|
||||
["<leader>fp"] = { ":lua require('harpoon.ui').toggle_quick_menu()<CR>" },
|
||||
["<leader>lg"] = { ":LazyGit<CR>" },
|
||||
["<A-k>"] = {
|
||||
function()
|
||||
if lazyGitted then
|
||||
require("nvterm.terminal").toggle "float"
|
||||
else
|
||||
lazyGitted = true
|
||||
local term = require("nvterm.terminal").new "float"
|
||||
-- Work around to get lazygit to work.
|
||||
vim.api.nvim_chan_send(term.job_id, "lazygit\n")
|
||||
end
|
||||
end,
|
||||
"Toggle floating terminal",
|
||||
},
|
||||
},
|
||||
v = {
|
||||
["<leader>rf"] = { ":lua require('refactoring').select_refactor()<CR>", "options" },
|
||||
},
|
||||
t = {
|
||||
["<A-k>"] = {
|
||||
function()
|
||||
if lazyGitted then
|
||||
require("nvterm.terminal").toggle "float"
|
||||
else
|
||||
lazyGitted = true
|
||||
require("nvterm.terminal").toggle "float"
|
||||
end
|
||||
end,
|
||||
"Toggle floating terminal",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
|
24
nvchad/null-ls.lua
Normal file
24
nvchad/null-ls.lua
Normal file
@ -0,0 +1,24 @@
|
||||
local null_ls = require "null-ls"
|
||||
local formatting = null_ls.builtins.formatting
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
local code_action = null_ls.builtins.code_actions
|
||||
|
||||
local sources = {
|
||||
formatting.prettierd,
|
||||
formatting.stylua,
|
||||
|
||||
diagnostics.eslint_d,
|
||||
|
||||
code_action.eslint_d,
|
||||
}
|
||||
|
||||
null_ls.setup {
|
||||
debug = true,
|
||||
sources = sources,
|
||||
|
||||
on_attach = function(client)
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
vim.cmd "autocmd BufWritePre <buffer> lua vim.lsp.buf.format()"
|
||||
end
|
||||
end,
|
||||
}
|
49
nvchad/plugins.lua
Normal file
49
nvchad/plugins.lua
Normal file
@ -0,0 +1,49 @@
|
||||
return {
|
||||
{ "wakatime/vim-wakatime", lazy = false },
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
config = function()
|
||||
require "custom.null-ls"
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require "plugins.configs.lspconfig"
|
||||
require "custom.lspconfig"
|
||||
end,
|
||||
},
|
||||
{ "windwp/nvim-ts-autotag", lazy = false },
|
||||
{ "lervag/vimtex", lazy = false },
|
||||
{ "sindrets/diffview.nvim", lazy = false },
|
||||
{ "ThePrimeagen/harpoon" },
|
||||
{ "christoomey/vim-tmux-navigator", lazy = false },
|
||||
{ "jose-elias-alvarez/null-ls.nvim" },
|
||||
{
|
||||
"NvChad/nvterm",
|
||||
config = function()
|
||||
require("nvterm").setup {
|
||||
terminals = {
|
||||
shell = vim.o.shell,
|
||||
list = {},
|
||||
type_opts = {
|
||||
float = {
|
||||
row = 0.1,
|
||||
col = 0.1,
|
||||
width = 0.8,
|
||||
height = 0.8,
|
||||
border = "single",
|
||||
},
|
||||
horizontal = { location = "rightbelow", split_ratio = 0.3 },
|
||||
vertical = { location = "rightbelow", split_ratio = 0.5 },
|
||||
},
|
||||
},
|
||||
behavior = {
|
||||
auto_insert = true,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
return {
|
||||
["wakatime/vim-wakatime"] = {},
|
||||
["sbdchd/neoformat"] = {},
|
||||
["williamboman/mason-lspconfig.nvim"] = {},
|
||||
["neovim/nvim-lspconfig"] = {
|
||||
config = function()
|
||||
require "plugins.configs.lspconfig"
|
||||
require "custom.plugins.lspconfig"
|
||||
end,
|
||||
},
|
||||
["windwp/nvim-ts-autotag"] = {
|
||||
ft = { "html", "javascriptreact", "typescriptreact", "astro" },
|
||||
after = "nvim-treesitter",
|
||||
config = function()
|
||||
local present, autotag = pcall(require, "nvim-ts-autotag")
|
||||
|
||||
if present then
|
||||
autotag.setup()
|
||||
end
|
||||
end,
|
||||
},
|
||||
["lervag/vimtex"] = {},
|
||||
["sindrets/diffview.nvim"] = {},
|
||||
["ThePrimeagen/refactoring.nvim"] = {},
|
||||
["ThePrimeagen/harpoon"] = {},
|
||||
["christoomey/vim-tmux-navigator"] = {},
|
||||
["kdheepak/lazygit.nvim"] = {},
|
||||
["jose-elias-alvarez/null-ls.nvim"] = {
|
||||
config = function()
|
||||
require "null-ls-config"
|
||||
end,
|
||||
},
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
local on_attach = require("plugins.configs.lspconfig").on_attach
|
||||
local capabilities = require("plugins.configs.lspconfig").capabilities
|
||||
|
||||
local lspconfig = require "lspconfig"
|
||||
local servers = { "tsserver", "tailwindcss", "cssls", "prismals", "gopls", "yamlls", "hls" }
|
||||
|
||||
local null_ls = require "null-ls"
|
||||
local formatting = null_ls.builtins.formatting
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
local code_action = null_ls.builtins.code_actions
|
||||
|
||||
local sources = {
|
||||
formatting.prettierd,
|
||||
formatting.stylua,
|
||||
|
||||
diagnostics.eslint_d,
|
||||
|
||||
code_action.eslint_d,
|
||||
}
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
lspconfig.tsserver.setup {
|
||||
on_attach = function(client)
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
-- client.resolved_capabilities.document_formatting = false
|
||||
end,
|
||||
}
|
||||
|
||||
null_ls.setup {
|
||||
debug = true,
|
||||
sources = sources,
|
||||
|
||||
on_attach = function(client)
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
vim.cmd "autocmd BufWritePre <buffer> lua vim.lsp.buf.format()"
|
||||
end
|
||||
end,
|
||||
}
|
Reference in New Issue
Block a user