9
dotfiles/nvim/lua/custom/chadrc.lua
Normal file
9
dotfiles/nvim/lua/custom/chadrc.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
---@type ChadrcConfig
|
||||
local M = {}
|
||||
|
||||
M.ui = { theme = 'catppuccin' }
|
||||
|
||||
M.mappings = require('custom.mappings')
|
||||
M.plugins = 'custom.plugins'
|
||||
|
||||
return M
|
||||
23
dotfiles/nvim/lua/custom/configs/dap.lua
Normal file
23
dotfiles/nvim/lua/custom/configs/dap.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
local dap = require("dap")
|
||||
|
||||
dap.adapters["pwa-node"] = {
|
||||
type = "server",
|
||||
host = "127.0.0.1",
|
||||
port = 8123,
|
||||
executable = {
|
||||
command = "js-debug-adapter",
|
||||
},
|
||||
}
|
||||
|
||||
for _, language in ipairs { "javascript", "typescript" } do
|
||||
dap.configurations[language] = {
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
program = "${file}",
|
||||
cwd = "${workspaceFolder}",
|
||||
runtimeExecutable = "node",
|
||||
},
|
||||
}
|
||||
end
|
||||
16
dotfiles/nvim/lua/custom/configs/formatter.lua
Normal file
16
dotfiles/nvim/lua/custom/configs/formatter.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
local M = {
|
||||
filetype = {
|
||||
javascript = {
|
||||
require("formatter.filetypes.javascript").prettier,
|
||||
},
|
||||
typescript = {
|
||||
require("formatter.filetypes.javascript").prettier,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
command = "FormatWriteLock",
|
||||
})
|
||||
|
||||
return M
|
||||
79
dotfiles/nvim/lua/custom/configs/lspconfig.lua
Normal file
79
dotfiles/nvim/lua/custom/configs/lspconfig.lua
Normal file
@@ -0,0 +1,79 @@
|
||||
local config = require("plugins.configs.lspconfig")
|
||||
local on_attach = config.on_attach
|
||||
local capabilities = config.capabilities
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
local function organize_imports()
|
||||
local params = {
|
||||
command = "_typescript.organizeImports",
|
||||
arguments = { vim.api.nvim_buf_get_name(0) },
|
||||
}
|
||||
vim.lsp.buf.execute_command(params)
|
||||
end
|
||||
|
||||
lspconfig.ts_ls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
init_options = {
|
||||
preferences = {
|
||||
disablesuggestions = true,
|
||||
}
|
||||
},
|
||||
commands = {
|
||||
OrganizeImports = {
|
||||
organize_imports,
|
||||
description = "Organize Imports",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
lspconfig.terraformls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
lspconfig.tflint.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
lspconfig.gopls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
cmd = { "gopls" },
|
||||
filetypes = { "go", "gomod", "gowork", "gotempl" },
|
||||
root_dir = lspconfig.util.root_pattern("go.mod", "go.work"),
|
||||
settings = {
|
||||
gopls = {
|
||||
completeUnimported = true,
|
||||
usePlaceholders = true,
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
lspconfig.pyright.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
filetypes = { "python" },
|
||||
}
|
||||
|
||||
lspconfig.gleam.setup({})
|
||||
|
||||
lspconfig.nil_ls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
autostart = true,
|
||||
cmd = { "nil" },
|
||||
filetypes = { "nix" },
|
||||
settings = {
|
||||
['nil'] = {
|
||||
testSetting = 42,
|
||||
formatting = {
|
||||
command = { "alejandra" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
28
dotfiles/nvim/lua/custom/configs/null-ls.lua
Normal file
28
dotfiles/nvim/lua/custom/configs/null-ls.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
local opts = {
|
||||
sources = {
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.diagnostics.mypy,
|
||||
null_ls.builtins.diagnostics.ruff,
|
||||
},
|
||||
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
|
||||
6
dotfiles/nvim/lua/custom/init.lua
Normal file
6
dotfiles/nvim/lua/custom/init.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
vim.g.maplocalleader = ","
|
||||
vim.opt.colorcolumn = "80"
|
||||
vim.g.copilot_no_tab_map = true
|
||||
vim.api.nvim_set_keymap("i", "<C-o>", 'copilot#Accept("<CR>")', { silent = true, expr = true, noremap = true, script = true })
|
||||
vim.wo.relativenumber = true
|
||||
vim.g.scrolloff = 8
|
||||
224
dotfiles/nvim/lua/custom/mappings.lua
Normal file
224
dotfiles/nvim/lua/custom/mappings.lua
Normal file
@@ -0,0 +1,224 @@
|
||||
local M = {}
|
||||
|
||||
M.disabled = {
|
||||
n = {
|
||||
["<tab>"] = "",
|
||||
["<S-tab>"] = "",
|
||||
["<C-n>"] = "",
|
||||
},
|
||||
}
|
||||
|
||||
M['rust-tools'] = {
|
||||
n = {
|
||||
["<C-space>"] = {
|
||||
function ()
|
||||
require("rust-tools.hover_actions").hover_actions()
|
||||
end,
|
||||
"Rust hover actions",
|
||||
},
|
||||
["<leader>a"] = {
|
||||
function ()
|
||||
require("rust-tools.code_action_group").code_action_group()
|
||||
end,
|
||||
"Rust code action group",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.dap = {
|
||||
n = {
|
||||
["<leader>dl"] = {
|
||||
function ()
|
||||
require("dap")
|
||||
end,
|
||||
"Load DAP",
|
||||
},
|
||||
["<leader>dt"] = {
|
||||
"<cmd> DapToggleBreakpoint <CR>",
|
||||
"Toggle breakpoint",
|
||||
},
|
||||
["<leader>dr"] = {
|
||||
"<cmd> DapContinue <CR>",
|
||||
"Continue Debugging",
|
||||
},
|
||||
["<leader>dc"] = {
|
||||
"<cmd> DapTerminate <CR>",
|
||||
"Close Debugger",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
M.dap_python = {
|
||||
plugin = true,
|
||||
|
||||
n = {
|
||||
["<leader>dpr"] = {
|
||||
function ()
|
||||
require("dap-python").test_method()
|
||||
end,
|
||||
"Debug test method",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
"Toggle breakpoint",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
M.lazygit = {
|
||||
n = {
|
||||
["<leader>gg"] = {
|
||||
"<cmd> LazyGit <CR>",
|
||||
"LazyGit",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.dadbodui = {
|
||||
n = {
|
||||
["<leader>db"] = {
|
||||
"<cmd> DBUIToggle <CR>",
|
||||
"Toggle DB UI",
|
||||
},
|
||||
["<leader>dn"] = {
|
||||
"<cmd> DBUIAddConnection <CR>",
|
||||
"Add new database connection",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.noice = {
|
||||
n = {
|
||||
["<leader>nl"] = {
|
||||
"<cmd> Noice last <CR>",
|
||||
"Show last message",
|
||||
},
|
||||
["<leader>nt"] ={
|
||||
"<cmd> Noice telescope <CR>",
|
||||
"Noice telescope mode",
|
||||
},
|
||||
["<leader>nd"] = {
|
||||
"<cmd> Noice dismiss <CR>",
|
||||
"Dismiss messages",
|
||||
},
|
||||
["<leader>ns"] = {
|
||||
"<cmd> Noice stats <CR>",
|
||||
"Show Noice stats",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.worktree = {
|
||||
n = {
|
||||
["<leader>gwv"] = {
|
||||
function ()
|
||||
local telescope = require("telescope")
|
||||
telescope.extensions.git_worktree.git_worktrees()
|
||||
end,
|
||||
"View Git Worktrees",
|
||||
},
|
||||
["<leader>gwn"] = {
|
||||
function ()
|
||||
local telescope = require("telescope")
|
||||
telescope.extensions.git_worktree.create_git_worktree()
|
||||
end,
|
||||
"New Git Worktree",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.neorg = {
|
||||
n = {
|
||||
["<leader>ni"] = {
|
||||
"<cmd> Neorg index <CR>",
|
||||
"Neorg index",
|
||||
},
|
||||
["<leader>nr"] = {
|
||||
"<cmd> Neorg return <CR>",
|
||||
"Return from index",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.general = {
|
||||
n = {
|
||||
["<C-q>"] = {
|
||||
"<cmd> wq <CR>",
|
||||
"Save and exit",
|
||||
},
|
||||
["<leader>q"] = {
|
||||
"<cmd> wq <CR>",
|
||||
"Save and exit",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.trouble = {
|
||||
n = {
|
||||
["<leader>tt"] = {
|
||||
"<cmd> Trouble diagnostics toggle <CR>",
|
||||
"Diagnostics (Trouble)",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
M.tabufline = {
|
||||
n = {
|
||||
["<S-h>"] = {
|
||||
function()
|
||||
require("nvchad.tabufline").tabuflinePrev()
|
||||
end,
|
||||
"Goto prev buffer",
|
||||
},
|
||||
["<S-l>"] = {
|
||||
function()
|
||||
require("nvchad.tabufline").tabuflineNext()
|
||||
end,
|
||||
"Goto next buffer",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.nvimtree = {
|
||||
n = {
|
||||
["<leader>e"] = {
|
||||
"<cmd> NvimTreeToggle <CR>",
|
||||
"Toggle nvimtree",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.lazydocker = {
|
||||
n = {
|
||||
["<leader>ld"] = {
|
||||
"<cmd> LazyDocker <CR>",
|
||||
"Lazy Docker",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.cloak = {
|
||||
n = {
|
||||
["<leader>k"] = {
|
||||
"<cmd> CloakToggle <CR>",
|
||||
"Toggle Cloak",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
270
dotfiles/nvim/lua/custom/plugins.lua
Normal file
270
dotfiles/nvim/lua/custom/plugins.lua
Normal file
@@ -0,0 +1,270 @@
|
||||
local cmp = require "cmp"
|
||||
|
||||
local plugins = {
|
||||
{ "nvim-neotest/nvim-nio" },
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap-python",
|
||||
ft = "python",
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
"rcarriga/nvim-dap-ui",
|
||||
"nvim-neotest/nvim-nio",
|
||||
},
|
||||
config = function (_, opts)
|
||||
local path = "~/.local/share/nvim/mason/packages/debugpy/venv/bin/python"
|
||||
require("dap-python").setup(path)
|
||||
end
|
||||
},
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
},
|
||||
config = function ()
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
|
||||
dapui.setup()
|
||||
dap.listeners.after.event_initialized["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,
|
||||
},
|
||||
{ "folke/neodev.nvim", opts = {} },
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
config = function ()
|
||||
require("telescope").load_extension("git_worktree")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"hudclark/grpc-nvim",
|
||||
dependencies = "nvim-lua/plenary.nvim",
|
||||
},
|
||||
{
|
||||
"ThePrimeagen/git-worktree.nvim",
|
||||
},
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
ft = { "python" },
|
||||
config = function ()
|
||||
require "custom.configs.null-ls"
|
||||
end,
|
||||
},
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
lsp = {
|
||||
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
},
|
||||
-- you can enable a preset for easier configuration
|
||||
presets = {
|
||||
bottom_search = true, -- use a classic bottom cmdline for search
|
||||
command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||
},
|
||||
messages = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
config = function (_, opts)
|
||||
require("noice").setup(opts)
|
||||
end,
|
||||
dependencies = {
|
||||
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
|
||||
"MunifTanjim/nui.nvim",
|
||||
-- OPTIONAL:
|
||||
-- `nvim-notify` is only needed, if you want to use the notification view.
|
||||
-- If not available, we use `mini` as the fallback
|
||||
"rcarriga/nvim-notify",
|
||||
},
|
||||
},
|
||||
{
|
||||
"kristijanhusak/vim-dadbod-ui",
|
||||
dependencies = {
|
||||
{
|
||||
"tpope/vim-dadbod",
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
"kristijanhusak/vim-dadbod-completion",
|
||||
ft = { "sql", "mysql", "plsql" },
|
||||
},
|
||||
},
|
||||
cmd = {
|
||||
"DBUI",
|
||||
"DBUIToggle",
|
||||
"DBUIAddConnection",
|
||||
"DBUIFindBuffer",
|
||||
},
|
||||
init = function()
|
||||
vim.g.db_ui_use_nerd_fonts = 1
|
||||
end,
|
||||
},
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
opts = {},
|
||||
cmd = "Trouble",
|
||||
},
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"rust-analyzer",
|
||||
"typescript-language-server",
|
||||
"prettier",
|
||||
"js-debug-adapter",
|
||||
"terraform-ls",
|
||||
"gopls",
|
||||
"pyright",
|
||||
"mypy",
|
||||
"ruff",
|
||||
"black",
|
||||
"debugpy",
|
||||
"lua-language-server",
|
||||
"nil",
|
||||
"phpactor",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function ()
|
||||
require("plugins.configs.lspconfig")
|
||||
require("custom.configs.lspconfig")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"github/copilot.vim",
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
"rust-lang/rust.vim",
|
||||
ft = "rust",
|
||||
init =function ()
|
||||
vim.g.rustfmt_autosave = 1
|
||||
end,
|
||||
},
|
||||
{
|
||||
"simrat39/rust-tools.nvim",
|
||||
ft = "rust",
|
||||
dependencies = { "neovim/nvim-lspconfig", "nvim-lua/plenary.nvim", "mfussenegger/nvim-dap" },
|
||||
opts = function ()
|
||||
local lspconfig = require("plugins.configs.lspconfig")
|
||||
-- local extension_path = vim.env.HOME .. "/.local/share/nvim/mason/packages/codelldb/extension/"
|
||||
-- local codelldb_path = extension_path .. 'adapter/codelldb'
|
||||
-- local liblldb_path = extension_path .. 'lldb/lib/liblldb.so'
|
||||
return {
|
||||
dap = {
|
||||
adapter = {
|
||||
type = "executable",
|
||||
command = "lldb",
|
||||
name = "rt_lldb",
|
||||
},
|
||||
},
|
||||
server = {
|
||||
tools = {
|
||||
hover_actions = {
|
||||
auto_focus = true,
|
||||
},
|
||||
},
|
||||
on_attach = lspconfig.on_attach,
|
||||
capabilities = lspconfig.capabilities,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
"kdheepak/lazygit.nvim",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
},
|
||||
{
|
||||
"crnvl96/lazydocker.nvim",
|
||||
opts = {}, -- automatically calls `require("lazydocker").setup()`
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
},
|
||||
{
|
||||
"saecki/crates.nvim",
|
||||
event = { "BufRead Cargo.toml" },
|
||||
config = function(_, opts)
|
||||
local crates = require("crates")
|
||||
crates.setup(opts)
|
||||
cmp.setup.buffer({
|
||||
sources = { { name = "crates" }}
|
||||
})
|
||||
crates.show()
|
||||
require("core.utils").load_mappings("crates")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
opts = function()
|
||||
local M = require "plugins.configs.cmp"
|
||||
M.completion.completeopt = "menu,menuone,noselect"
|
||||
M.mapping["<CR>"] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = false,
|
||||
}
|
||||
table.insert(M.sources, {name = "crates"})
|
||||
return M
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mhartington/formatter.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function ()
|
||||
return require("custom.configs.formatter")
|
||||
end
|
||||
},
|
||||
{
|
||||
"laytan/cloak.nvim",
|
||||
lazy = false,
|
||||
config = function ()
|
||||
require("cloak").setup({
|
||||
enabled = true,
|
||||
cloak_character = "*",
|
||||
-- The applied highlight group (colors) on the cloaking, see `:h highlight`.
|
||||
highlight_group = "Comment",
|
||||
patterns = {
|
||||
{
|
||||
-- Match any file starting with ".env".
|
||||
-- This can be a table to match multiple file patterns.
|
||||
file_pattern = {
|
||||
".env*",
|
||||
"wrangler.toml",
|
||||
".dev.vars",
|
||||
},
|
||||
-- Match an equals sign and any character after it.
|
||||
-- This can also be a table of patterns to cloak,
|
||||
-- example: cloak_pattern = { ":.+", "-.+" } for yaml files.
|
||||
cloak_pattern = "=.+"
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
return plugins
|
||||
Reference in New Issue
Block a user