refactor: Plugin configuration lives with the lazy plugin spec files
now.
This commit is contained in:
parent
9c5bb03003
commit
e23246622c
|
|
@ -1,72 +0,0 @@
|
||||||
local cmp = require("cmp")
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
snippet = {
|
|
||||||
-- REQUIRED - you must specify a snippet engine
|
|
||||||
expand = function(args)
|
|
||||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
|
||||||
--vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
window = {
|
|
||||||
-- completion = cmp.config.window.bordered(),
|
|
||||||
-- documentation = cmp.config.window.bordered(),
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
|
||||||
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
|
||||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
|
||||||
}),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
{ name = 'luasnip' }, -- For luasnip users.
|
|
||||||
{ name = 'buffer' },
|
|
||||||
{
|
|
||||||
name = 'path',
|
|
||||||
option = {
|
|
||||||
pathMappings = {
|
|
||||||
['@'] = '${folder}/src',
|
|
||||||
-- ['/'] = '${folder}/src/public/',
|
|
||||||
-- ['~@'] = '${folder}/src',
|
|
||||||
-- ['/images'] = '${folder}/src/images',
|
|
||||||
-- ['/components'] = '${folder}/src/components',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
completion = {
|
|
||||||
completeopt = 'menu,menuone,noinsert',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
|
||||||
cmp.setup.cmdline({ '/', '?' }, {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = {
|
|
||||||
{ name = 'buffer' }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
cmp.setup.cmdline(':', {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = cmp.config.sources(
|
|
||||||
{
|
|
||||||
{ name = 'path' }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
{
|
|
||||||
name = 'cmdline',
|
|
||||||
option = {
|
|
||||||
ignore_cmds = { 'Man', '!' }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Set up lspconfig.
|
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
|
||||||
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
|
|
||||||
--require('lspconfig')['<YOUR_LSP_SERVER>'].setup {
|
|
||||||
-- capabilities = capabilities
|
|
||||||
--}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
function applyColor(color)
|
|
||||||
color = color or "tokyonight"
|
|
||||||
vim.cmd.colorscheme(color)
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
|
||||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
|
||||||
end
|
|
||||||
|
|
||||||
applyColor()
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
vim.keymap.set("n", "<leader>gs", vim.cmd.Git, { desc = "Show git summary" } )
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
local mark = require("harpoon.mark")
|
|
||||||
local ui = require("harpoon.ui")
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>a", mark.add_file)
|
|
||||||
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<C-h>", function() ui.nav_file(1) end)
|
|
||||||
vim.keymap.set("n", "<C-j>", function() ui.nav_file(2) end)
|
|
||||||
vim.keymap.set("n", "<C-k>", function() ui.nav_file(3) end)
|
|
||||||
vim.keymap.set("n", "<C-l>", function() ui.nav_file(4) end)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
require("mason").setup()
|
|
||||||
|
|
||||||
vim.lsp.enable("lua_ls")
|
|
||||||
vim.lsp.config("lua_ls", {
|
|
||||||
on_init = function(client)
|
|
||||||
if client.workspace_folders then
|
|
||||||
local path = client.workspace_folders[1].name
|
|
||||||
if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
|
||||||
runtime = {
|
|
||||||
version = 'LuaJIT'
|
|
||||||
},
|
|
||||||
workspace = {
|
|
||||||
checkThirdParty = false,
|
|
||||||
library = {
|
|
||||||
vim.env.VIMRUNTIME
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
settings = {
|
|
||||||
Lua = {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.lsp.enable("clangd")
|
|
||||||
|
|
||||||
vim.lsp.enable("rust_analyzer")
|
|
||||||
|
|
||||||
vim.lsp.enable("pyright")
|
|
||||||
|
|
||||||
vim.lsp.enable("html")
|
|
||||||
|
|
||||||
vim.lsp.enable("vtsls")
|
|
||||||
|
|
||||||
vim.lsp.enable("svelte")
|
|
||||||
|
|
||||||
vim.lsp.enable("tailwindcss")
|
|
||||||
|
|
||||||
vim.lsp.enable("jdtls")
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
local null_ls = require("null-ls")
|
|
||||||
|
|
||||||
null_ls.setup({
|
|
||||||
sources = {
|
|
||||||
null_ls.builtins.formatting.stylua,
|
|
||||||
null_ls.builtins.completion.spell,
|
|
||||||
--require("none-ls.diagnostics.eslint"), -- requires none-ls-extras.nvim
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
require("telescope").setup({
|
|
||||||
defaults = {
|
|
||||||
file_ignore_patterns = {
|
|
||||||
"%.svg$",
|
|
||||||
"%.png$",
|
|
||||||
"%.jpg$",
|
|
||||||
"%.jpeg$",
|
|
||||||
"%.webp$",
|
|
||||||
"%.gif$",
|
|
||||||
"%.ico$",
|
|
||||||
"%.pdf$",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
local builtin = require('telescope.builtin')
|
|
||||||
vim.keymap.set('n', '<leader>pf', builtin.find_files, { desc = 'Telescope find files' })
|
|
||||||
vim.keymap.set('n', '<C-p>', builtin.git_files, { desc = 'Telescope find files (git)' })
|
|
||||||
vim.keymap.set('n', '<leader>ps', builtin.live_grep, { desc = 'Telescope live grep' })
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
require("nvim-treesitter").setup()
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle, { desc = "Toggle undo tree" })
|
|
||||||
|
|
@ -1,4 +1,78 @@
|
||||||
return {
|
return {
|
||||||
-- Code completion
|
-- Code completion
|
||||||
'hrsh7th/nvim-cmp'
|
'hrsh7th/nvim-cmp',
|
||||||
|
config = function() {
|
||||||
|
local cmp = require("cmp")
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
-- REQUIRED - you must specify a snippet engine
|
||||||
|
expand = function(args)
|
||||||
|
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||||
|
--vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
-- completion = cmp.config.window.bordered(),
|
||||||
|
-- documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||||
|
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
||||||
|
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||||
|
['<C-Space>'] = cmp.mapping.complete(),
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'luasnip' }, -- For luasnip users.
|
||||||
|
{ name = 'buffer' },
|
||||||
|
{
|
||||||
|
name = 'path',
|
||||||
|
option = {
|
||||||
|
pathMappings = {
|
||||||
|
['@'] = '${folder}/src',
|
||||||
|
-- ['/'] = '${folder}/src/public/',
|
||||||
|
-- ['~@'] = '${folder}/src',
|
||||||
|
-- ['/images'] = '${folder}/src/images',
|
||||||
|
-- ['/components'] = '${folder}/src/components',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
completion = {
|
||||||
|
completeopt = 'menu,menuone,noinsert',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline({ '/', '?' }, {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = {
|
||||||
|
{ name = 'buffer' }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
cmp.setup.cmdline(':', {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources(
|
||||||
|
{
|
||||||
|
{ name = 'path' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{
|
||||||
|
name = 'cmdline',
|
||||||
|
option = {
|
||||||
|
ignore_cmds = { 'Man', '!' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Set up lspconfig.
|
||||||
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
|
||||||
|
--require('lspconfig')['<YOUR_LSP_SERVER>'].setup {
|
||||||
|
-- capabilities = capabilities
|
||||||
|
--}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
return {
|
return {
|
||||||
-- Git utility
|
-- Git utility
|
||||||
'tpope/vim-fugitive'
|
'tpope/vim-fugitive',
|
||||||
|
config = function() {
|
||||||
|
vim.keymap.set("n", "<leader>gs", vim.cmd.Git, { desc = "Show git summary" } )
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,16 @@
|
||||||
return {
|
return {
|
||||||
-- File navigation utility
|
-- File navigation utility
|
||||||
'ThePrimeagen/harpoon'
|
'ThePrimeagen/harpoon',
|
||||||
|
config = function() {
|
||||||
|
local mark = require("harpoon.mark")
|
||||||
|
local ui = require("harpoon.ui")
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>a", mark.add_file)
|
||||||
|
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<C-h>", function() ui.nav_file(1) end)
|
||||||
|
vim.keymap.set("n", "<C-j>", function() ui.nav_file(2) end)
|
||||||
|
vim.keymap.set("n", "<C-k>", function() ui.nav_file(3) end)
|
||||||
|
vim.keymap.set("n", "<C-l>", function() ui.nav_file(4) end)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,50 @@
|
||||||
return {
|
return {
|
||||||
-- Packager Manager (LSPs)
|
-- Packager Manager (LSPs)
|
||||||
'williamboman/mason.nvim'
|
'williamboman/mason.nvim',
|
||||||
|
config = function() {
|
||||||
|
require("mason").setup()
|
||||||
|
|
||||||
|
vim.lsp.enable("lua_ls")
|
||||||
|
vim.lsp.config("lua_ls", {
|
||||||
|
on_init = function(client)
|
||||||
|
if client.workspace_folders then
|
||||||
|
local path = client.workspace_folders[1].name
|
||||||
|
if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
||||||
|
runtime = {
|
||||||
|
version = 'LuaJIT'
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
checkThirdParty = false,
|
||||||
|
library = {
|
||||||
|
vim.env.VIMRUNTIME
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
settings = {
|
||||||
|
Lua = {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.lsp.enable("clangd")
|
||||||
|
|
||||||
|
vim.lsp.enable("rust_analyzer")
|
||||||
|
|
||||||
|
vim.lsp.enable("pyright")
|
||||||
|
|
||||||
|
vim.lsp.enable("html")
|
||||||
|
|
||||||
|
vim.lsp.enable("vtsls")
|
||||||
|
|
||||||
|
vim.lsp.enable("svelte")
|
||||||
|
|
||||||
|
vim.lsp.enable("tailwindcss")
|
||||||
|
|
||||||
|
vim.lsp.enable("jdtls")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,15 @@
|
||||||
return {
|
return {
|
||||||
-- Formatter, Linter, etc bridge??
|
-- Formatter, Linter, etc bridge??
|
||||||
'nvimtools/none-ls.nvim'
|
'nvimtools/none-ls.nvim',
|
||||||
|
config = function() {
|
||||||
|
local null_ls = require("null-ls")
|
||||||
|
|
||||||
|
null_ls.setup({
|
||||||
|
sources = {
|
||||||
|
null_ls.builtins.formatting.stylua,
|
||||||
|
null_ls.builtins.completion.spell,
|
||||||
|
--require("none-ls.diagnostics.eslint"), -- requires none-ls-extras.nvim
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,26 @@ return {
|
||||||
'nvim-lua/plenary.nvim',
|
'nvim-lua/plenary.nvim',
|
||||||
-- optional but recommended
|
-- optional but recommended
|
||||||
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
|
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
|
||||||
|
},
|
||||||
|
config = function() {
|
||||||
|
require("telescope").setup({
|
||||||
|
defaults = {
|
||||||
|
file_ignore_patterns = {
|
||||||
|
"%.svg$",
|
||||||
|
"%.png$",
|
||||||
|
"%.jpg$",
|
||||||
|
"%.jpeg$",
|
||||||
|
"%.webp$",
|
||||||
|
"%.gif$",
|
||||||
|
"%.ico$",
|
||||||
|
"%.pdf$",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
vim.keymap.set('n', '<leader>pf', builtin.find_files, { desc = 'Telescope find files' })
|
||||||
|
vim.keymap.set('n', '<C-p>', builtin.git_files, { desc = 'Telescope find files (git)' })
|
||||||
|
vim.keymap.set('n', '<leader>ps', builtin.live_grep, { desc = 'Telescope live grep' })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,11 @@
|
||||||
return {
|
return {
|
||||||
-- Color Scheme
|
-- Color Scheme
|
||||||
'folke/tokyonight.nvim'
|
'folke/tokyonight.nvim',
|
||||||
|
config = function() {
|
||||||
|
color = color or "tokyonight"
|
||||||
|
vim.cmd.colorscheme(color)
|
||||||
|
|
||||||
|
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||||
|
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
return {
|
return {
|
||||||
-- Undo.. tree
|
-- Undo.. tree
|
||||||
'mbbill/undotree'
|
'mbbill/undotree',
|
||||||
|
config = function() {
|
||||||
|
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle, { desc = "Toggle undo tree" })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue