feat: add neovim config and tmux
This commit is contained in:
23
home-manager/dotfiles/nvim/lua/custom/configs/dap.lua
Normal file
23
home-manager/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
home-manager/dotfiles/nvim/lua/custom/configs/formatter.lua
Normal file
16
home-manager/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
|
||||
61
home-manager/dotfiles/nvim/lua/custom/configs/lspconfig.lua
Normal file
61
home-manager/dotfiles/nvim/lua/custom/configs/lspconfig.lua
Normal file
@@ -0,0 +1,61 @@
|
||||
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" },
|
||||
}
|
||||
28
home-manager/dotfiles/nvim/lua/custom/configs/null-ls.lua
Normal file
28
home-manager/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
|
||||
Reference in New Issue
Block a user