fix
This commit is contained in:
24
nvchad/custom/chadrc.lua
Normal file
24
nvchad/custom/chadrc.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
local M = {}
|
||||
|
||||
M.plugins = "custom.plugins"
|
||||
|
||||
M.options = {
|
||||
user = function()
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
end,
|
||||
}
|
||||
|
||||
M.ui = {
|
||||
theme = "everblush",
|
||||
theme_toggle = { "everblush", "everblush" },
|
||||
lazyload = false,
|
||||
}
|
||||
M.mappings = require "custom.mappings"
|
||||
|
||||
vim.cmd "autocmd BufRead,BufEnter *.astro set filetype=astro"
|
||||
vim.cmd "set rnu"
|
||||
vim.cmd "autocmd InsertLeave *.tex update"
|
||||
|
||||
return M
|
||||
62
nvchad/custom/lspconfig.lua
Normal file
62
nvchad/custom/lspconfig.lua
Normal file
@@ -0,0 +1,62 @@
|
||||
local on_attach = require("plugins.configs.lspconfig").on_attach
|
||||
local capabilities = require("plugins.configs.lspconfig").capabilities
|
||||
|
||||
local lspconfig = require "lspconfig"
|
||||
local servers = { "vtsls", "tailwindcss", "cssls", "prismals", "gopls", "yamlls", "hls", "metals", "zls", "pyright", "rust_analyzer" }
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
require("lspconfig").eslint.setup {
|
||||
-- Copied from nvim-lspconfig/lua/lspconfig/server_conigurations/eslint.js
|
||||
root_dir = lspconfig.util.root_pattern(
|
||||
".eslintrc",
|
||||
".eslintrc.js",
|
||||
".eslintrc.cjs",
|
||||
".eslintrc.yaml",
|
||||
".eslintrc.yml",
|
||||
".eslintrc.json"
|
||||
-- Disabled to prevent "No ESLint configuration found" exceptions
|
||||
-- 'package.json',
|
||||
),
|
||||
}
|
||||
|
||||
--[[
|
||||
|
||||
local function filter(arr, fn)
|
||||
if type(arr) ~= "table" then
|
||||
return arr
|
||||
end
|
||||
|
||||
local filtered = {}
|
||||
for k, v in pairs(arr) do
|
||||
if fn(v, k, arr) then
|
||||
table.insert(filtered, v)
|
||||
end
|
||||
end
|
||||
|
||||
return filtered
|
||||
end
|
||||
|
||||
local function filterReactDTS(value)
|
||||
return string.match(value.targetUri, 'node_modules/@types/react/ts5.0/index.d.ts') == nil
|
||||
end
|
||||
|
||||
lspconfig.vtsls.setup {
|
||||
-- other options
|
||||
handlers = {
|
||||
['textDocument/definition'] = function(err, result, method, ...)
|
||||
if vim.tbl_islist(result) and #result > 1 then
|
||||
local filtered_result = filter(result, filterReactDTS)
|
||||
return vim.lsp.handlers['textDocument/definition'](err, filtered_result, method, ...)
|
||||
end
|
||||
|
||||
vim.lsp.handlers['textDocument/definition'](err, result, method, ...)
|
||||
end
|
||||
}
|
||||
}
|
||||
]]--
|
||||
73
nvchad/custom/mappings.lua
Normal file
73
nvchad/custom/mappings.lua
Normal file
@@ -0,0 +1,73 @@
|
||||
local M = {}
|
||||
|
||||
M.formatter = {
|
||||
n = {
|
||||
["<Leader>b"] = { "<cmd> Gitsigns toggle_current_line_blame<CR>", "Toggled line blames" },
|
||||
["<Leader>bl"] = { "<cmd> Gitsigns blame_line<CR>", "Line blame" },
|
||||
},
|
||||
}
|
||||
|
||||
M.nvimtree = {
|
||||
n = {
|
||||
-- focus
|
||||
["<leader>e"] = { "<cmd> NvimTreeFocus <CR>", "focus nvimtree" },
|
||||
["<leader>co"] = { "<cmd> NvimTreeCollapse <CR>", "Collapse nvimtree" },
|
||||
},
|
||||
}
|
||||
|
||||
local lazyGitted = false
|
||||
|
||||
M.custom = {
|
||||
n = {
|
||||
["<Leader>fm"] = { ":lua vim.lsp.buf.format() <CR>", "Formats the current buffer using built in LSP" },
|
||||
["<leader>nt"] = { "<cmd> tabnew <CR>", "New tab" },
|
||||
["<leader>ct"] = { "<cmd> tabclose <CR>", "Close tab" },
|
||||
["<leader>rfr"] = { ":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>as"] = { ":lua require('harpoon.ui').nav_next()<CR>" },
|
||||
["<leader>sa"] = { ":lua require('harpoon.ui').nav_prev()<CR>" },
|
||||
|
||||
["<leader>dr"] = { ":lua require('dapui').open({ reset = true})<CR>" },
|
||||
|
||||
["<C-l>"] = {":TmuxNavigateRight<CR>"},
|
||||
["<C-h>"] = {":TmuxNavigateLeft<CR>"},
|
||||
["<C-j>"] = {":TmuxNavigateDown<CR>"},
|
||||
["<C-k>"] = {":TmuxNavigateUp<CR>"},
|
||||
|
||||
["<leader>gr"] = { ":lua require('telescope.builtin').lsp_references()<CR>" },
|
||||
|
||||
["<A-k>"] = {
|
||||
function()
|
||||
if lazyGitted then
|
||||
require("nvterm.terminal").toggle "float"
|
||||
vim.cmd "autocmd TermOpen * setlocal nonumber norelativenumber"
|
||||
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",
|
||||
},
|
||||
},
|
||||
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",
|
||||
},
|
||||
},
|
||||
v = {
|
||||
["<leader>rr"] = { ":lua require('refactoring').select_refactor()<CR>", "options" },
|
||||
}
|
||||
}
|
||||
|
||||
return M
|
||||
25
nvchad/custom/null-ls.lua
Normal file
25
nvchad/custom/null-ls.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
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,
|
||||
formatting.gofmt,
|
||||
formatting.rustfmt,
|
||||
|
||||
-- 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,
|
||||
}
|
||||
81
nvchad/custom/plugins.lua
Normal file
81
nvchad/custom/plugins.lua
Normal file
@@ -0,0 +1,81 @@
|
||||
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,
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
"windwp/nvim-ts-autotag",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("nvim-ts-autotag").setup()
|
||||
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" },
|
||||
{ "sainnhe/everforest", lazy = false },
|
||||
|
||||
{ "https://github.com/mfussenegger/nvim-dap", dependencies = {"rcarriga/nvim-dap-ui", "leoluz/nvim-dap-go", "nvim-neotest/nvim-nio"}, config = function ()
|
||||
local dap, dapui = require("dap"), require("dapui")
|
||||
|
||||
require('dap-go').setup()
|
||||
require('dapui').setup()
|
||||
|
||||
dap.listeners.before.attach.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.launch.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated.dapui_config = function()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited.dapui_config = function()
|
||||
dapui.close()
|
||||
end
|
||||
end },
|
||||
{
|
||||
"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,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user