finish josean martinez tutorial
This commit is contained in:
@@ -1,16 +1,39 @@
|
|||||||
{
|
{
|
||||||
|
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||||
|
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
||||||
|
"auto-session": { "branch": "main", "commit": "00334ee24b9a05001ad50221c8daffbeedaa0842" },
|
||||||
|
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||||
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
||||||
|
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
|
||||||
|
"cmp-treesitter": { "branch": "master", "commit": "958fcfa0d8ce46d215e19cc3992c542f576c4123" },
|
||||||
|
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||||
|
"conform.nvim": { "branch": "master", "commit": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" },
|
||||||
|
"friendly-snippets": { "branch": "main", "commit": "fc8f183479a472df60aa86f00e295462f2308178" },
|
||||||
|
"gitsigns.nvim": { "branch": "main", "commit": "ee7e50dfbdf49e3acfa416fd3ad3abbdb658582c" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||||
"lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
"lazygit.nvim": { "branch": "main", "commit": "b9eae3badab982e71abab96d3ee1d258f0c07961" },
|
||||||
|
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
||||||
|
"lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" },
|
||||||
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
|
||||||
|
"mason-tool-installer.nvim": { "branch": "main", "commit": "1255518cb067e038a4755f5cb3e980f79b6ab89c" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
|
||||||
|
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||||
|
"nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||||
|
"nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" },
|
||||||
|
"nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "8b0f47d851ee5343d38fe194a06ad16b9b9bd086" },
|
||||||
"nvim-tree.lua": { "branch": "master", "commit": "be5b788f2dc1522c73fb7afad9092331c8aebe80" },
|
"nvim-tree.lua": { "branch": "master", "commit": "be5b788f2dc1522c73fb7afad9092331c8aebe80" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "684eeac91ed8e297685a97ef70031d19ac1de25a" },
|
"nvim-treesitter": { "branch": "master", "commit": "684eeac91ed8e297685a97ef70031d19ac1de25a" },
|
||||||
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
|
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "855c97005c8eebcdd19846f2e54706bffd40ee96" },
|
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
|
||||||
|
"nvim-web-devicons": { "branch": "master", "commit": "68f70df44652d310d2adedf181b174c33a693665" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" },
|
"telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" },
|
||||||
|
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
|
||||||
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
|
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
|
||||||
|
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
|
||||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,19 @@ if not vim.loop.fs_stat(lazypath) then
|
|||||||
"clone",
|
"clone",
|
||||||
"--filter=blob:none",
|
"--filter=blob:none",
|
||||||
"https://github.com/folke/lazy.nvim.git",
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
"--branch=stable",
|
"--branch=stable", -- latest stable release
|
||||||
lazypath,
|
lazypath,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
require("lazy").setup("dkelly.plugins")
|
require("lazy").setup({ { import = "dkelly.plugins" }, { import = "dkelly.plugins.lsp" } }, {
|
||||||
|
checker = {
|
||||||
|
enabled = true,
|
||||||
|
notify = false,
|
||||||
|
},
|
||||||
|
change_detection = {
|
||||||
|
notify = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|||||||
16
lua/dkelly/plugins/auto-session.lua
Normal file
16
lua/dkelly/plugins/auto-session.lua
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
return {
|
||||||
|
"rmagatti/auto-session",
|
||||||
|
config = function()
|
||||||
|
local auto_session = require("auto-session")
|
||||||
|
|
||||||
|
auto_session.setup({
|
||||||
|
auto_restore_enabled = false,
|
||||||
|
auto_session_suppress_dirs = { "~/", "~/Dev/", "~/Downloads", "~/Documents", "~/Desktop/" },
|
||||||
|
})
|
||||||
|
|
||||||
|
local keymap = vim.keymap
|
||||||
|
|
||||||
|
keymap.set("n", "<leader>wr", "<cmd>SessionRestore<CR>", { desc = "Restore session for cwd" }) -- restore last workspace session for current directory
|
||||||
|
keymap.set("n", "<leader>ws", "<cmd>SessionSave<CR>", { desc = "Save session for auto session root dir" }) -- save workspace session for current working directory
|
||||||
|
end,
|
||||||
|
}
|
||||||
30
lua/dkelly/plugins/autopair.lua
Normal file
30
lua/dkelly/plugins/autopair.lua
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
return {
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
event = { "InsertEnter" },
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
-- import nvim-autopairs
|
||||||
|
local autopairs = require("nvim-autopairs")
|
||||||
|
|
||||||
|
-- configure autopairs
|
||||||
|
autopairs.setup({
|
||||||
|
check_ts = true, -- enable treesitter
|
||||||
|
ts_config = {
|
||||||
|
lua = { "string" }, -- don't add pairs in lua string treesitter nodes
|
||||||
|
javascript = { "template_string" }, -- don't add pairs in javscript template_string treesitter nodes
|
||||||
|
java = false, -- don't check treesitter on java
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- import nvim-autopairs completion functionality
|
||||||
|
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||||
|
|
||||||
|
-- import nvim-cmp plugin (completions plugin)
|
||||||
|
local cmp = require("cmp")
|
||||||
|
|
||||||
|
-- make autopairs and completion work together
|
||||||
|
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||||
|
end,
|
||||||
|
}
|
||||||
19
lua/dkelly/plugins/comment.lua
Normal file
19
lua/dkelly/plugins/comment.lua
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
return {
|
||||||
|
"numToStr/Comment.nvim",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
dependencies = {
|
||||||
|
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
-- import comment plugin safely
|
||||||
|
local comment = require("Comment")
|
||||||
|
|
||||||
|
local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim")
|
||||||
|
|
||||||
|
-- enable comment
|
||||||
|
comment.setup({
|
||||||
|
-- for commenting tsx, jsx, svelte, html files
|
||||||
|
pre_hook = ts_context_commentstring.create_pre_hook(),
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
40
lua/dkelly/plugins/conform.lua
Normal file
40
lua/dkelly/plugins/conform.lua
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
return {
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
config = function()
|
||||||
|
local conform = require("conform")
|
||||||
|
|
||||||
|
conform.setup({
|
||||||
|
formatters_by_ft = {
|
||||||
|
javascript = { "prettier" },
|
||||||
|
typescript = { "prettier" },
|
||||||
|
javascriptreact = { "prettier" },
|
||||||
|
typescriptreact = { "prettier" },
|
||||||
|
svelte = { "prettier" },
|
||||||
|
css = { "prettier" },
|
||||||
|
html = { "prettier" },
|
||||||
|
json = { "prettier" },
|
||||||
|
yaml = { "prettier" },
|
||||||
|
markdown = { "prettier" },
|
||||||
|
graphql = { "prettier" },
|
||||||
|
liquid = { "prettier" },
|
||||||
|
lua = { "stylua" },
|
||||||
|
python = { "isort", "black" },
|
||||||
|
go = { "goimports", "gofmt" },
|
||||||
|
},
|
||||||
|
format_on_save = {
|
||||||
|
lsp_fallback = true,
|
||||||
|
async = false,
|
||||||
|
timeout_ms = 1000,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set({ "n", "v" }, "<leader>mp", function()
|
||||||
|
conform.format({
|
||||||
|
lsp_fallback = true,
|
||||||
|
async = false,
|
||||||
|
timeout_ms = 1000,
|
||||||
|
})
|
||||||
|
end, { desc = "Format file or range (in visual mode)" })
|
||||||
|
end,
|
||||||
|
}
|
||||||
47
lua/dkelly/plugins/gitsigns.lua
Normal file
47
lua/dkelly/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
return {
|
||||||
|
"lewis6991/gitsigns.nvim",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
opts = {
|
||||||
|
on_attach = function(bufnr)
|
||||||
|
local gs = package.loaded.gitsigns
|
||||||
|
|
||||||
|
local function map(mode, l, r, desc)
|
||||||
|
vim.keymap.set(mode, l, r, { buffer = bufnr, desc = desc })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Navigation
|
||||||
|
map("n", "]h", gs.next_hunk, "Next Hunk")
|
||||||
|
map("n", "[h", gs.prev_hunk, "Prev Hunk")
|
||||||
|
|
||||||
|
-- Actions
|
||||||
|
map("n", "<leader>hs", gs.stage_hunk, "Stage hunk")
|
||||||
|
map("n", "<leader>hr", gs.reset_hunk, "Reset hunk")
|
||||||
|
map("v", "<leader>hs", function()
|
||||||
|
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||||
|
end, "Stage hunk")
|
||||||
|
map("v", "<leader>hr", function()
|
||||||
|
gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||||
|
end, "Reset hunk")
|
||||||
|
|
||||||
|
map("n", "<leader>hS", gs.stage_buffer, "Stage buffer")
|
||||||
|
map("n", "<leader>hR", gs.reset_buffer, "Reset buffer")
|
||||||
|
|
||||||
|
map("n", "<leader>hu", gs.undo_stage_hunk, "Undo stage hunk")
|
||||||
|
|
||||||
|
map("n", "<leader>hp", gs.preview_hunk, "Preview hunk")
|
||||||
|
|
||||||
|
map("n", "<leader>hb", function()
|
||||||
|
gs.blame_line({ full = true })
|
||||||
|
end, "Blame line")
|
||||||
|
map("n", "<leader>hB", gs.toggle_current_line_blame, "Toggle line blame")
|
||||||
|
|
||||||
|
map("n", "<leader>hd", gs.diffthis, "Diff this")
|
||||||
|
map("n", "<leader>hD", function()
|
||||||
|
gs.diffthis("~")
|
||||||
|
end, "Diff this ~")
|
||||||
|
|
||||||
|
-- Text object
|
||||||
|
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "Gitsigns select hunk")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
19
lua/dkelly/plugins/lazygit.lua
Normal file
19
lua/dkelly/plugins/lazygit.lua
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
return {
|
||||||
|
"kdheepak/lazygit.nvim",
|
||||||
|
cmd = {
|
||||||
|
"LazyGit",
|
||||||
|
"LazyGitConfig",
|
||||||
|
"LazyGitCurrentFile",
|
||||||
|
"LazyGitFilter",
|
||||||
|
"LazyGitFilterCurrentFile",
|
||||||
|
},
|
||||||
|
-- optional for floating window border decoration
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
},
|
||||||
|
-- setting the keybinding for LazyGit with 'keys' is recommended in
|
||||||
|
-- order to load the plugin when the command is run for the first time
|
||||||
|
keys = {
|
||||||
|
{ "<leader>lg", "<cmd>LazyGit<cr>", desc = "Open lazy git" },
|
||||||
|
},
|
||||||
|
}
|
||||||
30
lua/dkelly/plugins/linter.lua
Normal file
30
lua/dkelly/plugins/linter.lua
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
return {
|
||||||
|
"mfussenegger/nvim-lint",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
config = function()
|
||||||
|
local lint = require("lint")
|
||||||
|
|
||||||
|
lint.linters_by_ft = {
|
||||||
|
javascript = { "eslint_d" },
|
||||||
|
typescript = { "eslint_d" },
|
||||||
|
javascriptreact = { "eslint_d" },
|
||||||
|
typescriptreact = { "eslint_d" },
|
||||||
|
svelte = { "eslint_d" },
|
||||||
|
python = { "pylint" },
|
||||||
|
go = { "golangci-lint" },
|
||||||
|
}
|
||||||
|
|
||||||
|
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||||
|
group = lint_augroup,
|
||||||
|
callback = function()
|
||||||
|
lint.try_lint()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>l", function()
|
||||||
|
lint.try_lint()
|
||||||
|
end, { desc = "Trigger linting for current file" })
|
||||||
|
end,
|
||||||
|
}
|
||||||
107
lua/dkelly/plugins/lsp/lspconfig.lua
Normal file
107
lua/dkelly/plugins/lsp/lspconfig.lua
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
return {
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
{ "antosha417/nvim-lsp-file-operations", config = true },
|
||||||
|
{ "folke/neodev.nvim", opts = {} },
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
-- import lspconfig plugin
|
||||||
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
|
-- import mason_lspconfig plugin
|
||||||
|
local mason_lspconfig = require("mason-lspconfig")
|
||||||
|
|
||||||
|
-- import cmp-nvim-lsp plugin
|
||||||
|
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||||
|
|
||||||
|
local keymap = vim.keymap -- for conciseness
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||||
|
callback = function(ev)
|
||||||
|
-- Buffer local mappings.
|
||||||
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
|
local opts = { buffer = ev.buf, silent = true }
|
||||||
|
|
||||||
|
-- set keybinds
|
||||||
|
opts.desc = "Show LSP references"
|
||||||
|
keymap.set("n", "gR", "<cmd>Telescope lsp_references<CR>", opts) -- show definition, references
|
||||||
|
|
||||||
|
opts.desc = "Go to declaration"
|
||||||
|
keymap.set("n", "gD", vim.lsp.buf.declaration, opts) -- go to declaration
|
||||||
|
|
||||||
|
opts.desc = "Show LSP definitions"
|
||||||
|
keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts) -- show lsp definitions
|
||||||
|
|
||||||
|
opts.desc = "Show LSP implementations"
|
||||||
|
keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts) -- show lsp implementations
|
||||||
|
|
||||||
|
opts.desc = "Show LSP type definitions"
|
||||||
|
keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts) -- show lsp type definitions
|
||||||
|
|
||||||
|
opts.desc = "See available code actions"
|
||||||
|
keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection
|
||||||
|
|
||||||
|
opts.desc = "Smart rename"
|
||||||
|
keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts) -- smart rename
|
||||||
|
|
||||||
|
opts.desc = "Show buffer diagnostics"
|
||||||
|
keymap.set("n", "<leader>D", "<cmd>Telescope diagnostics bufnr=0<CR>", opts) -- show diagnostics for file
|
||||||
|
|
||||||
|
opts.desc = "Show line diagnostics"
|
||||||
|
keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts) -- show diagnostics for line
|
||||||
|
|
||||||
|
opts.desc = "Go to previous diagnostic"
|
||||||
|
keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -- jump to previous diagnostic in buffer
|
||||||
|
|
||||||
|
opts.desc = "Go to next diagnostic"
|
||||||
|
keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -- jump to next diagnostic in buffer
|
||||||
|
|
||||||
|
opts.desc = "Show documentation for what is under cursor"
|
||||||
|
keymap.set("n", "K", vim.lsp.buf.hover, opts) -- show documentation for what is under cursor
|
||||||
|
|
||||||
|
opts.desc = "Restart LSP"
|
||||||
|
keymap.set("n", "<leader>rs", ":LspRestart<CR>", opts) -- mapping to restart lsp if necessary
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- used to enable autocompletion (assign to every lsp server config)
|
||||||
|
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||||
|
|
||||||
|
-- Change the Diagnostic symbols in the sign column (gutter)
|
||||||
|
-- (not in youtube nvim video)
|
||||||
|
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||||
|
for type, icon in pairs(signs) do
|
||||||
|
local hl = "DiagnosticSign" .. type
|
||||||
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||||
|
end
|
||||||
|
|
||||||
|
mason_lspconfig.setup_handlers({
|
||||||
|
-- default handler for installed servers
|
||||||
|
function(server_name)
|
||||||
|
lspconfig[server_name].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
["lua_ls"] = function()
|
||||||
|
-- configure lua server (with special settings)
|
||||||
|
lspconfig["lua_ls"].setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
-- make the language server recognize "vim" global
|
||||||
|
diagnostics = {
|
||||||
|
globals = { "vim" },
|
||||||
|
},
|
||||||
|
completion = {
|
||||||
|
callSnippet = "Replace",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
69
lua/dkelly/plugins/lsp/mason.lua
Normal file
69
lua/dkelly/plugins/lsp/mason.lua
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
return {
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
-- import mason
|
||||||
|
local mason = require("mason")
|
||||||
|
|
||||||
|
-- import mason-lspconfig
|
||||||
|
local mason_lspconfig = require("mason-lspconfig")
|
||||||
|
|
||||||
|
local mason_tool_installer = require("mason-tool-installer")
|
||||||
|
-- enable mason and configure icons
|
||||||
|
mason.setup({
|
||||||
|
ui = {
|
||||||
|
icons = {
|
||||||
|
package_installed = "✓",
|
||||||
|
package_pending = "➜",
|
||||||
|
package_uninstalled = "✗",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
mason_lspconfig.setup({
|
||||||
|
ensure_installed = {
|
||||||
|
-- LSP server names only
|
||||||
|
"bashls", -- Bash
|
||||||
|
"clangd", -- C/C++
|
||||||
|
"cssls", -- CSS
|
||||||
|
"gopls", -- Go
|
||||||
|
"html", -- HTML
|
||||||
|
"tsserver", -- TypeScript/JavaScript
|
||||||
|
"jsonls", -- JSON
|
||||||
|
"lua_ls", -- Lua
|
||||||
|
"marksman", -- Markdown
|
||||||
|
"pyright", -- Python
|
||||||
|
"ruby_ls", -- Ruby
|
||||||
|
"rust_analyzer", -- Rust
|
||||||
|
"taplo", -- TOML
|
||||||
|
"yamlls", -- YAML
|
||||||
|
"dockerls", -- Docker
|
||||||
|
"graphql", -- GraphQL
|
||||||
|
"sqlls", -- SQL (or try "sqls")
|
||||||
|
"powershell_es", -- PowerShell
|
||||||
|
"perlnavigator", -- Perl
|
||||||
|
"vimls", -- Vim
|
||||||
|
"lemminx", -- XML
|
||||||
|
"cmake", -- CMake
|
||||||
|
-- Add others you use!
|
||||||
|
},
|
||||||
|
automatic_installation = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
mason_tool_installer.setup({
|
||||||
|
ensure_installed = {
|
||||||
|
"prettier", -- prettier formatter
|
||||||
|
"stylua", -- lua formatter
|
||||||
|
"isort", -- python formatter
|
||||||
|
"black", -- python formatter
|
||||||
|
"goimports", -- golang formatter
|
||||||
|
"pylint", -- python linter
|
||||||
|
"eslint_d", -- js linter
|
||||||
|
"golangci-lint", -- golang linter
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
71
lua/dkelly/plugins/lualine.lua
Normal file
71
lua/dkelly/plugins/lualine.lua
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
return {
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
|
config = function()
|
||||||
|
local lualine = require("lualine")
|
||||||
|
local lazy_status = require("lazy.status") -- to configure lazy pending updates count
|
||||||
|
|
||||||
|
local colors = {
|
||||||
|
blue = "#65D1FF",
|
||||||
|
green = "#3EFFDC",
|
||||||
|
violet = "#FF61EF",
|
||||||
|
yellow = "#FFDA7B",
|
||||||
|
red = "#FF4A4A",
|
||||||
|
fg = "#c3ccdc",
|
||||||
|
bg = "#112638",
|
||||||
|
inactive_bg = "#2c3043",
|
||||||
|
}
|
||||||
|
|
||||||
|
local my_lualine_theme = {
|
||||||
|
normal = {
|
||||||
|
a = { bg = colors.blue, fg = colors.bg, gui = "bold" },
|
||||||
|
b = { bg = colors.bg, fg = colors.fg },
|
||||||
|
c = { bg = colors.bg, fg = colors.fg },
|
||||||
|
},
|
||||||
|
insert = {
|
||||||
|
a = { bg = colors.green, fg = colors.bg, gui = "bold" },
|
||||||
|
b = { bg = colors.bg, fg = colors.fg },
|
||||||
|
c = { bg = colors.bg, fg = colors.fg },
|
||||||
|
},
|
||||||
|
visual = {
|
||||||
|
a = { bg = colors.violet, fg = colors.bg, gui = "bold" },
|
||||||
|
b = { bg = colors.bg, fg = colors.fg },
|
||||||
|
c = { bg = colors.bg, fg = colors.fg },
|
||||||
|
},
|
||||||
|
command = {
|
||||||
|
a = { bg = colors.yellow, fg = colors.bg, gui = "bold" },
|
||||||
|
b = { bg = colors.bg, fg = colors.fg },
|
||||||
|
c = { bg = colors.bg, fg = colors.fg },
|
||||||
|
},
|
||||||
|
replace = {
|
||||||
|
a = { bg = colors.red, fg = colors.bg, gui = "bold" },
|
||||||
|
b = { bg = colors.bg, fg = colors.fg },
|
||||||
|
c = { bg = colors.bg, fg = colors.fg },
|
||||||
|
},
|
||||||
|
inactive = {
|
||||||
|
a = { bg = colors.inactive_bg, fg = colors.semilightgray, gui = "bold" },
|
||||||
|
b = { bg = colors.inactive_bg, fg = colors.semilightgray },
|
||||||
|
c = { bg = colors.inactive_bg, fg = colors.semilightgray },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- configure lualine with modified theme
|
||||||
|
lualine.setup({
|
||||||
|
options = {
|
||||||
|
theme = my_lualine_theme,
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_x = {
|
||||||
|
{
|
||||||
|
lazy_status.updates,
|
||||||
|
cond = lazy_status.has_updates,
|
||||||
|
color = { fg = "#ff9e64" },
|
||||||
|
},
|
||||||
|
{ "encoding" },
|
||||||
|
{ "fileformat" },
|
||||||
|
{ "filetype" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -1,84 +1,86 @@
|
|||||||
return {
|
return {
|
||||||
'hrsh7th/nvim-cmp',
|
"hrsh7th/nvim-cmp",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- Core completion sources
|
-- basic sources
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
"hrsh7th/cmp-buffer",
|
||||||
-- 'hrsh7th/cmp-treesitter', -- Uncomment if you have a cmp-treesitter source
|
"hrsh7th/cmp-path",
|
||||||
-- Cmdline support
|
-- cmdline completion for `:` and `/`
|
||||||
'hrsh7th/cmp-cmdline',
|
"hrsh7th/cmp-cmdline", -- :contentReference[oaicite:0]{index=0}
|
||||||
-- Icons
|
-- LSP
|
||||||
'onsails/lspkind-nvim',
|
"hrsh7th/cmp-nvim-lsp", -- :contentReference[oaicite:1]{index=1}
|
||||||
|
-- Treesitter source
|
||||||
|
"ray-x/cmp-treesitter", -- :contentReference[oaicite:2]{index=2}
|
||||||
|
|
||||||
-- Extras you can enable later:
|
-- snippet engine & integration (optional)
|
||||||
-- 'windwp/nvim-autopairs', -- autopairs integration
|
{
|
||||||
-- 'lukas-reineke/cmp-under-comparator', -- fuzzy sorting
|
"L3MON4D3/LuaSnip",
|
||||||
|
version = "v2.*",
|
||||||
|
build = "make install_jsregexp",
|
||||||
|
},
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
"rafamadriz/friendly-snippets",
|
||||||
|
|
||||||
|
-- icons
|
||||||
|
"onsails/lspkind.nvim",
|
||||||
},
|
},
|
||||||
|
|
||||||
config = function()
|
config = function()
|
||||||
local cmp = require('cmp')
|
local cmp = require("cmp")
|
||||||
local lspkind = require('lspkind')
|
local luasnip = require("luasnip")
|
||||||
|
local lspkind = require("lspkind")
|
||||||
|
|
||||||
|
-- load friendly-snippets
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
|
||||||
|
-- nicer completions menu
|
||||||
|
vim.opt.completeopt = "menu,menuone,preview,noselect"
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
formatting = {
|
|
||||||
format = lspkind.cmp_format({
|
|
||||||
mode = "symbol_text", -- or "symbol" for just icons, "text" for just text
|
|
||||||
maxwidth = 50,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
|
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
-- no-op, snippet engine not installed
|
luasnip.lsp_expand(args.body)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
mapping = {
|
["<C-k>"] = cmp.mapping.select_prev_item(),
|
||||||
['<C-n>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
["<C-j>"] = cmp.mapping.select_next_item(),
|
||||||
['<C-p>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
['<C-e>'] = cmp.mapping.abort(),
|
["<C-e>"] = cmp.mapping.abort(),
|
||||||
|
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "luasnip" },
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "treesitter" },
|
||||||
|
{ name = "buffer" },
|
||||||
|
{ name = "path" },
|
||||||
|
}),
|
||||||
|
formatting = {
|
||||||
|
format = lspkind.cmp_format({
|
||||||
|
maxwidth = 50,
|
||||||
|
ellipsis_char = "...",
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
-- { name = 'treesitter' }, -- Uncomment if you actually have cmp-treesitter
|
|
||||||
}),
|
|
||||||
|
|
||||||
-- Extras you can enable later:
|
|
||||||
-- window = {
|
|
||||||
-- completion = cmp.config.window.bordered(),
|
|
||||||
-- documentation = cmp.config.window.bordered(),
|
|
||||||
-- },
|
|
||||||
|
|
||||||
-- experimental = {
|
|
||||||
-- ghost_text = true,
|
|
||||||
-- },
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Cmdline completion for : (commands & paths)
|
-- Command‐line “:” → cmdline + path
|
||||||
cmp.setup.cmdline(':', {
|
cmp.setup.cmdline(":", {
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'path' },
|
|
||||||
{ name = 'cmdline' },
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Search completion for / (buffer)
|
|
||||||
cmp.setup.cmdline('/', {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
sources = {
|
sources = {
|
||||||
{ name = 'buffer' },
|
{ name = "path" },
|
||||||
|
{ name = "cmdline" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Autopairs integration (uncomment when you install nvim-autopairs)
|
-- Search “/” → buffer
|
||||||
-- require('nvim-autopairs').setup{}
|
cmp.setup.cmdline("/", {
|
||||||
-- local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
-- cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
sources = {
|
||||||
|
{ name = "buffer" },
|
||||||
-- Fuzzy sorting (uncomment when you install cmp-under-comparator)
|
},
|
||||||
-- table.insert(cmp.config.sorting.comparators, require('cmp-under-comparator').under)
|
})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ return {
|
|||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
'nvim-lua/plenary.nvim',
|
||||||
{'nvim-telescope/telescope-fzf-native.nvim', build = 'make'},
|
{'nvim-telescope/telescope-fzf-native.nvim', build = 'make'},
|
||||||
'nvim-tree-/nvim-web-devicons',
|
'nvim-tree/nvim-web-devicons',
|
||||||
},
|
},
|
||||||
config = function ()
|
config = function ()
|
||||||
local telescope = require("telescope")
|
local telescope = require("telescope")
|
||||||
|
|||||||
21
lua/dkelly/plugins/todo-comments.lua
Normal file
21
lua/dkelly/plugins/todo-comments.lua
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
return {
|
||||||
|
"folke/todo-comments.nvim",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
config = function()
|
||||||
|
local todo_comments = require("todo-comments")
|
||||||
|
|
||||||
|
-- set keymaps
|
||||||
|
local keymap = vim.keymap -- for conciseness
|
||||||
|
|
||||||
|
keymap.set("n", "]t", function()
|
||||||
|
todo_comments.jump_next()
|
||||||
|
end, { desc = "Next todo comment" })
|
||||||
|
|
||||||
|
keymap.set("n", "[t", function()
|
||||||
|
todo_comments.jump_prev()
|
||||||
|
end, { desc = "Previous todo comment" })
|
||||||
|
|
||||||
|
todo_comments.setup()
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -23,8 +23,6 @@ return {
|
|||||||
"terraform", "hcl",
|
"terraform", "hcl",
|
||||||
-- Scripting/misc
|
-- Scripting/misc
|
||||||
"perl", "r", "powershell", "fish",
|
"perl", "r", "powershell", "fish",
|
||||||
-- Documentation & web
|
|
||||||
"latex", "scss",
|
|
||||||
-- System
|
-- System
|
||||||
"cmake", "nix",
|
"cmake", "nix",
|
||||||
-- Other Neovim-related
|
-- Other Neovim-related
|
||||||
|
|||||||
15
lua/dkelly/plugins/trouble.lua
Normal file
15
lua/dkelly/plugins/trouble.lua
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
return {
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons", "folke/todo-comments.nvim" },
|
||||||
|
opts = {
|
||||||
|
focus = true,
|
||||||
|
},
|
||||||
|
cmd = "Trouble",
|
||||||
|
keys = {
|
||||||
|
{ "<leader>xw", "<cmd>Trouble diagnostics toggle<CR>", desc = "Open trouble workspace diagnostics" },
|
||||||
|
{ "<leader>xd", "<cmd>Trouble diagnostics toggle filter.buf=0<CR>", desc = "Open trouble document diagnostics" },
|
||||||
|
{ "<leader>xq", "<cmd>Trouble quickfix toggle<CR>", desc = "Open trouble quickfix list" },
|
||||||
|
{ "<leader>xl", "<cmd>Trouble loclist toggle<CR>", desc = "Open trouble location list" },
|
||||||
|
{ "<leader>xt", "<cmd>Trouble todo toggle<CR>", desc = "Open todos in trouble" },
|
||||||
|
},
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user