move to one folder
This commit is contained in:
6
.config/nvim/lua/custom/chadrc.lua
Normal file
6
.config/nvim/lua/custom/chadrc.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
---@type ChadrcConfig
|
||||
local M = {}
|
||||
M.ui = {theme = 'catppuccin'}
|
||||
M.plugins = "custom.plugins"
|
||||
M.mappings = require "custom.mappings"
|
||||
return M
|
||||
19
.config/nvim/lua/custom/configs/formatter.lua
Normal file
19
.config/nvim/lua/custom/configs/formatter.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
local M = {
|
||||
filetype = {
|
||||
javascript = {
|
||||
require("formatter.filetypes.javascript").prettier
|
||||
},
|
||||
typescript = {
|
||||
require("formatter.filetypes.typescript").prettier
|
||||
},
|
||||
["*"] = {
|
||||
require("formatter.filetypes.any").remove_trailing_whitespace
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
command = "FormatWriteLock"
|
||||
})
|
||||
|
||||
return M
|
||||
58
.config/nvim/lua/custom/configs/lspconfig.lua
Normal file
58
.config/nvim/lua/custom/configs/lspconfig.lua
Normal file
@@ -0,0 +1,58 @@
|
||||
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"
|
||||
|
||||
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.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 = {
|
||||
gopls = {
|
||||
completeUnimported = true,
|
||||
usePlaceholders = true,
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
lspconfig.pyright.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
filetypes = {"python"},
|
||||
})
|
||||
lspconfig.powershell_es.setup({
|
||||
bundle_path = vim.fn.stdpath("data") .. "/mason/packages/powershell-editor-services/",
|
||||
settings = { powershell = { codeFormatting = { Preset = 'OTBS' } } }
|
||||
})
|
||||
|
||||
lspconfig.bashls.setup({})
|
||||
|
||||
lspconfig.tsserver.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
init_options = {
|
||||
preferences = {
|
||||
disableSuggestions = true,
|
||||
}
|
||||
},
|
||||
commands = {
|
||||
OrganizeImports = {
|
||||
organize_imports,
|
||||
description = "Organize Imports",
|
||||
}
|
||||
}
|
||||
}
|
||||
31
.config/nvim/lua/custom/configs/null-ls.lua
Normal file
31
.config/nvim/lua/custom/configs/null-ls.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
local null_ls = require("null-ls")
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
|
||||
local opts = {
|
||||
sources = {
|
||||
null_ls.builtins.formatting.gofumpt,
|
||||
null_ls.builtins.formatting.goimports_reviser,
|
||||
null_ls.builtins.formatting.golines,
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.diagnostics.mypy,
|
||||
null_ls.builtins.diagnostics.ruff,
|
||||
null_ls.builtins.diagnostics.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
|
||||
11
.config/nvim/lua/custom/configs/rust-tools.lua
Normal file
11
.config/nvim/lua/custom/configs/rust-tools.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
local on_attach = require("plugins.configs.lspconfig").on_attach
|
||||
local capabilities = require("plugins.configs.lspconfig").capabilities
|
||||
|
||||
local options = {
|
||||
server = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
}
|
||||
|
||||
return options
|
||||
11
.config/nvim/lua/custom/configs/treesitter.lua
Normal file
11
.config/nvim/lua/custom/configs/treesitter.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
local parser_config = require 'nvim-treesitter.parsers'.get_parser_configs()
|
||||
--parser_config.powershell_es = {
|
||||
-- install_info = {
|
||||
-- url = "/home/user/.local/share/tree-sitter-PowerShell",
|
||||
-- files = { "src/parser.c" },
|
||||
-- generate_requires_npm = false,
|
||||
-- requires_generate_from_grammar = false,
|
||||
-- },
|
||||
-- filetype = "ps1",
|
||||
--}
|
||||
return parser_config
|
||||
10
.config/nvim/lua/custom/init.lua
Normal file
10
.config/nvim/lua/custom/init.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
vim.opt.guicursor = ""
|
||||
|
||||
vim.opt.nu = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.api.nvim_set_keymap('n', '<C-d>', '<C-d>zz', {noremap = true})
|
||||
vim.api.nvim_set_keymap('n', '<C-u>', '<C-u>zz', {noremap = true})
|
||||
vim.api.nvim_set_keymap('n', 'n', 'nzzzv', {noremap = true})
|
||||
vim.api.nvim_set_keymap('n', 'N', 'Nzzzv', {noremap = true})
|
||||
vim.api.nvim_set_option("clipboard","unnamedplus")
|
||||
|
||||
96
.config/nvim/lua/custom/mappings.lua
Normal file
96
.config/nvim/lua/custom/mappings.lua
Normal file
@@ -0,0 +1,96 @@
|
||||
local M = {}
|
||||
|
||||
M.general = {
|
||||
n = {
|
||||
["<C-h>"] = {"<cmd> TmuxNavigateLeft<CR>", "window left"},
|
||||
["<C-l>"] = {"<cmd> TmuxNavigateRight<CR>", "window right"},
|
||||
["<C-j>"] = {"<cmd> TmuxNavigateDown<CR>", "window down"},
|
||||
["<C-k>"] = {"<cmd> TmuxNavigateUp<CR>", "window up"},
|
||||
}
|
||||
}
|
||||
|
||||
M.dap = {
|
||||
plugin = true,
|
||||
n = {
|
||||
["<leader>db"] = {
|
||||
"<cmd> DapToggleBreakpoint <CR>",
|
||||
"Add breakpoint at line"
|
||||
},
|
||||
["<F5>"] = {
|
||||
"<cmd> DapContinue <CR>",
|
||||
"Start Debugging"
|
||||
},
|
||||
["<F6>"] = {
|
||||
"<cmd> DapTerminate <CR>",
|
||||
"Stop Debugging"
|
||||
},
|
||||
["<F10>"] = {
|
||||
"<cmd> DapStepOver <CR>",
|
||||
"Step Over"
|
||||
},
|
||||
["<F11>"] = {
|
||||
"<cmd> DapStepInto <CR>",
|
||||
"Step Into"
|
||||
},
|
||||
["<F12>"] = {
|
||||
"<cmd> DapStepOut <CR>",
|
||||
"Stop Out"
|
||||
},
|
||||
["<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>dgt"] = {
|
||||
function()
|
||||
require('dap-go').debug_test()
|
||||
end,
|
||||
"Debug go test"
|
||||
},
|
||||
["<leader>dgl"] = {
|
||||
function()
|
||||
require('dap-go').debug_last()
|
||||
end,
|
||||
"Debug last go test"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
M.gopher = {
|
||||
plugin = true,
|
||||
n = {
|
||||
["<leader>gsj"] = {
|
||||
"<cmd> GoTagAdd json <CR>",
|
||||
"Add json struct tags"
|
||||
},
|
||||
["<leader>gse"] = {
|
||||
"<cmd> GoTagAdd env <CR>",
|
||||
"Add env struct tags"
|
||||
},
|
||||
["<leader>gsy"] = {
|
||||
"<cmd> GoTagAdd yaml <CR>",
|
||||
"Add yaml struct tags"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
M.crates = {
|
||||
n = {
|
||||
["<leader>rcu"] = {
|
||||
function ()
|
||||
require('crates').upgrade_all_crates()
|
||||
end,
|
||||
"update crates"
|
||||
}
|
||||
}
|
||||
}
|
||||
return M
|
||||
175
.config/nvim/lua/custom/plugins.lua
Normal file
175
.config/nvim/lua/custom/plugins.lua
Normal file
@@ -0,0 +1,175 @@
|
||||
local plugins = {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"gopls",
|
||||
"rust-analyzer",
|
||||
"pyright",
|
||||
"mypy",
|
||||
"ruff",
|
||||
"black",
|
||||
"debugpy",
|
||||
"powershell-editor-services",
|
||||
"bash-language-server",
|
||||
"eslint-lsp",
|
||||
"js-debug-adapter",
|
||||
"prettier",
|
||||
"typescript-language-server"
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"christoomey/vim-tmux-navigator",
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
init = function()
|
||||
require("core.utils").load_mappings("dap")
|
||||
require('dap.ext.vscode').load_launchjs('.vscode/launch.json', {})
|
||||
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
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
require "plugins.configs.lspconfig"
|
||||
require "custom.configs.lspconfig"
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
ft = "go, python",
|
||||
opts = function()
|
||||
return require "custom.configs.null-ls"
|
||||
end,
|
||||
},
|
||||
-- Golang
|
||||
{
|
||||
"dreamsofcode-io/nvim-dap-go",
|
||||
ft = "go",
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
"rcarriga/nvim-dap-ui",
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("dap-go").setup(opts)
|
||||
require("core.utils").load_mappings("dap_go")
|
||||
end
|
||||
},
|
||||
{
|
||||
"olexsmir/gopher.nvim",
|
||||
ft = "go",
|
||||
config = function(_, opts)
|
||||
require("gopher").setup(opts)
|
||||
require("core.utils").load_mappings("gopher")
|
||||
end,
|
||||
build = function()
|
||||
vim.cmd [[silent! GoInstallDeps]]
|
||||
end,
|
||||
},
|
||||
--Rust
|
||||
{
|
||||
"rust-lang/rust.vim",
|
||||
ft = "rust",
|
||||
init = function ()
|
||||
vim.g.rustfmt_autosave = 1
|
||||
end
|
||||
},
|
||||
{
|
||||
"simrat39/rust-tools.nvim",
|
||||
ft = "rust",
|
||||
dependencies = "neovim/nvim-lspconfig",
|
||||
opts = function ()
|
||||
return require "custom.configs.rust-tools"
|
||||
end,
|
||||
config = function (_, opts)
|
||||
require('rust-tools').setup(opts)
|
||||
end
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
},
|
||||
{
|
||||
'saecki/crates.nvim',
|
||||
ft = {"rust","toml"},
|
||||
config = function (_, opts)
|
||||
local crates = require('crates')
|
||||
crates.setup(opts)
|
||||
crates.show()
|
||||
end
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
opts = function ()
|
||||
local M = require "plugins.configs.cmp"
|
||||
table.insert(M.sources, {name= "crates"})
|
||||
end
|
||||
},
|
||||
--python
|
||||
{
|
||||
"mfussenegger/nvim-dap-python",
|
||||
ft = "python",
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
"rcarriga/nvim-dap-ui",
|
||||
},
|
||||
config = function(_, opts)
|
||||
local path = "~/.local/share/nvim/mason/packages/debugpy/venv/bin/python"
|
||||
require("dap-python").setup(path)
|
||||
end,
|
||||
},
|
||||
--ChatGPT
|
||||
--{
|
||||
-- "dreamsofcode-io/ChatGPT.nvim",
|
||||
-- event = "VeryLazy",
|
||||
-- dependencies = {
|
||||
-- "MunifTanjim/nui.nvim",
|
||||
-- "nvim-lua/plenary.nvim",
|
||||
-- "nvim-telescope/telescope.nvim"
|
||||
-- },
|
||||
-- config = function()
|
||||
-- require("chatgpt").setup({
|
||||
-- async_api_key_cmd = "bw get password ChatGPT-APIKey",
|
||||
-- })
|
||||
-- end,
|
||||
--},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function()
|
||||
local opts = require "plugins.configs.treesitter"
|
||||
require "custom.configs.treesitter"
|
||||
require'nvim-treesitter.install'.prefer_git = true
|
||||
opts.ensure_installed = {
|
||||
"lua",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"tsx",
|
||||
"go",
|
||||
"terraform",
|
||||
"c_sharp",
|
||||
"bash",
|
||||
}
|
||||
return opts
|
||||
end,
|
||||
}
|
||||
}
|
||||
return plugins
|
||||
Reference in New Issue
Block a user