feat: Added nvim without git confusion
This commit is contained in:
9
nvim/.config/nvim/lua/custom/chadrc.lua
Normal file
9
nvim/.config/nvim/lua/custom/chadrc.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.ui = { theme = 'catppuccin', tabufline= {enabled= false} }
|
||||||
|
M.plugins = "custom.plugins"
|
||||||
|
M.mappings = require "custom.configs.mappings"
|
||||||
|
vim.opt.spelllang = 'en_gb'
|
||||||
|
vim.opt.spell = true
|
||||||
|
|
||||||
|
return M
|
36
nvim/.config/nvim/lua/custom/configs/lspconfig.lua
Normal file
36
nvim/.config/nvim/lua/custom/configs/lspconfig.lua
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
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"
|
||||||
|
|
||||||
|
lspconfig.gopls.setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
cmd= {"gopls"},
|
||||||
|
filetypes = { "go", "gomod", "gowork", "gotmpl" },
|
||||||
|
root_dir = util.root_pattern("go.work", "go.mod", ".git"),
|
||||||
|
settings = {
|
||||||
|
completeUnimported = true,
|
||||||
|
usePlaceholders = true,
|
||||||
|
analyses = {
|
||||||
|
unusedparams = true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lspconfig.tsserver.setup{
|
||||||
|
on_attach=on_attach,
|
||||||
|
capabilities=capabilities,
|
||||||
|
init_options = {
|
||||||
|
preferences = {
|
||||||
|
disableSuggestions = true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lspconfig.pyright.setup({
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
filetypes= {"python"},
|
||||||
|
})
|
48
nvim/.config/nvim/lua/custom/configs/mappings.lua
Normal file
48
nvim/.config/nvim/lua/custom/configs/mappings.lua
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.dap = {
|
||||||
|
plugin = true,
|
||||||
|
n = {
|
||||||
|
["<leader>db"] = {
|
||||||
|
"<cmd> DapToggleBreakpoint <CR>",
|
||||||
|
"Add breakpoint at line"
|
||||||
|
},
|
||||||
|
["<leader>dus"] = {
|
||||||
|
function ()
|
||||||
|
local widgets = require("dap.ui.widgets");
|
||||||
|
local sidebar = widgets.sidebar(widgets.scopes);
|
||||||
|
sidebar.open();
|
||||||
|
end,
|
||||||
|
"open debugging sidebar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
M.dap_go = {
|
||||||
|
plugin=true,
|
||||||
|
n = {
|
||||||
|
["<leader>gdt"] = {
|
||||||
|
function()
|
||||||
|
require("dap-go").debug_test()
|
||||||
|
end,
|
||||||
|
"Debug go test"
|
||||||
|
},
|
||||||
|
["<leader>gdl"] = {
|
||||||
|
function()
|
||||||
|
require("dap-go").debug_last()
|
||||||
|
end,
|
||||||
|
"Debug last go test"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
M.dapui = {
|
||||||
|
n = {
|
||||||
|
["<leader>dui"] = {
|
||||||
|
function()
|
||||||
|
require("dapui").toggle()
|
||||||
|
end,
|
||||||
|
"Open debuging ui"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return M
|
29
nvim/.config/nvim/lua/custom/configs/null-ls-go.lua
Normal file
29
nvim/.config/nvim/lua/custom/configs/null-ls-go.lua
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
local null_ls = require("null-ls")
|
||||||
|
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||||
|
|
||||||
|
local opts = {
|
||||||
|
sources = {
|
||||||
|
null_ls.builtins.formatting.gofmt,
|
||||||
|
null_ls.builtins.formatting.goimports,
|
||||||
|
null_ls.builtins.diagnostics.mypy,
|
||||||
|
null_ls.builtins.diagnostics.ruff,
|
||||||
|
null_ls.builtins.formatting.eslint,
|
||||||
|
null_ls.builtins.formatting.prettier,
|
||||||
|
},
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
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
|
9
nvim/.config/nvim/lua/custom/configs/null-ls-py.lua
Normal file
9
nvim/.config/nvim/lua/custom/configs/null-ls-py.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
local null_ls = require("null-ls")
|
||||||
|
local opts = {
|
||||||
|
sources = {
|
||||||
|
null_ls.builtins.diagnostics.mypy,
|
||||||
|
null_ls.builtins.diagnostics.ruff,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return opts
|
25
nvim/.config/nvim/lua/custom/configs/null-ls-ts.lua
Normal file
25
nvim/.config/nvim/lua/custom/configs/null-ls-ts.lua
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
local null_ls = require("null-ls")
|
||||||
|
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||||
|
|
||||||
|
local opts = {
|
||||||
|
sources = {
|
||||||
|
null_ls.builtins.formatting.eslint,
|
||||||
|
null_ls.builtins.formatting.prettier,
|
||||||
|
},
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
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
|
80
nvim/.config/nvim/lua/custom/plugins.lua
Normal file
80
nvim/.config/nvim/lua/custom/plugins.lua
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
local plugins = {
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = {
|
||||||
|
ensure_installed = {
|
||||||
|
"typescript-language-server",
|
||||||
|
"eslint-lsp",
|
||||||
|
"lua-language-server",
|
||||||
|
"html-lsp",
|
||||||
|
"pyright",
|
||||||
|
"mypy",
|
||||||
|
"ruff",
|
||||||
|
"gopls",
|
||||||
|
"goimports",
|
||||||
|
"debugpy",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
config=function ()
|
||||||
|
require "plugins.configs.lspconfig"
|
||||||
|
require "custom.configs.lspconfig"
|
||||||
|
end,
|
||||||
|
},{
|
||||||
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
|
ft = "go",
|
||||||
|
opts = function()
|
||||||
|
return require "custom.configs.null-ls-go"
|
||||||
|
end,
|
||||||
|
}, {
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
init = function()
|
||||||
|
require("core.utils").load_mappings("dap")
|
||||||
|
end
|
||||||
|
}, {
|
||||||
|
"leoluz/nvim-dap-go",
|
||||||
|
ft = "go",
|
||||||
|
dependencies = "mfussenegger/nvim-dap",
|
||||||
|
config = function (_, opts)
|
||||||
|
require("dap-go").setup(opts)
|
||||||
|
require("core.utils").load_mappings("dap_go")
|
||||||
|
require('dap.ext.vscode').load_launchjs(nil, {})
|
||||||
|
end
|
||||||
|
},{
|
||||||
|
"mfussenegger/nvim-dap-python",
|
||||||
|
ft = "python",
|
||||||
|
dependencies = "mfussenegger/nvim-dap",
|
||||||
|
config = function (_, opts)
|
||||||
|
local path = "~/.local/share/nvim/mason/packages/debugpy/venv/bin/python"
|
||||||
|
require("dap-python").setup(path)
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"NVChad/nvim-autopairs",
|
||||||
|
enabled = false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rcarriga/nvim-dap-ui",
|
||||||
|
init = function()
|
||||||
|
require("dapui").setup()
|
||||||
|
vim.fn.sign_define('DapBreakpoint', { text = '🐞' })
|
||||||
|
vim.fn.sign_define('DapBreakpointRejected', { text = '🐞' })
|
||||||
|
local dap, dapui = require("dap"), require("dapui")
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return plugins
|
Reference in New Issue
Block a user