progress
This commit is contained in:
parent
42a3ec0172
commit
66c32e98f5
9 changed files with 230 additions and 96 deletions
|
@ -17,3 +17,8 @@
|
|||
- https://github.com/folke/noice.nvim
|
||||
- greg's: https://github.com/gblock0/dotfiles/blob/master/nvim/.config/nvim/lua/gb/plugins.lua
|
||||
- others: https://nvimluau.dev/
|
||||
- https://github.com/NvChad/nvim-colorizer.lua
|
||||
- https://github.com/numToStr/Comment.nvim
|
||||
- https://github.com/windwp/nvim-autopairs
|
||||
- https://github.com/lukas-reineke/indent-blankline.nvim
|
||||
|
||||
|
|
|
@ -2,4 +2,15 @@ return {
|
|||
"Pocco81/auto-save.nvim",
|
||||
commit = "979b6c82f60cfa80f4cf437d77446d0ded0addf0", -- May 22, 2023
|
||||
event = "BufEnter",
|
||||
opts = {
|
||||
trigger_events = { "InsertLeave", "TextChanged", "TextChangedI", "BufLeave" },
|
||||
condition = function (buf)
|
||||
local disallowed_filetypes = {"TelescopePrompt"}
|
||||
local utils = require('auto-save.utils.data')
|
||||
if vim.fn.getbufvar(buf, "&modifiable") == 1 and utils.not_in(vim.fn.getbufvar(buf, "&filetype"), disallowed_filetypes) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,99 +1,179 @@
|
|||
return {
|
||||
'VonHeikemen/lsp-zero.nvim',
|
||||
branch = 'v2.x',
|
||||
dependencies = {
|
||||
-- LSP Support
|
||||
{ 'neovim/nvim-lspconfig' },
|
||||
{
|
||||
'williamboman/mason.nvim',
|
||||
build = function()
|
||||
pcall(vim.cmd, 'MasonUpdate')
|
||||
end,
|
||||
},
|
||||
{ 'williamboman/mason-lspconfig.nvim' },
|
||||
-- Autocompletion
|
||||
{ 'hrsh7th/nvim-cmp' },
|
||||
{ 'hrsh7th/cmp-nvim-lsp' },
|
||||
{ 'hrsh7th/cmp-buffer' },
|
||||
{ 'hrsh7th/cmp-path' },
|
||||
{ 'hrsh7th/cmp-cmdline' },
|
||||
-- Snips
|
||||
{ 'L3MON4D3/LuaSnip' },
|
||||
},
|
||||
config = function()
|
||||
local lsp = require('lsp-zero').preset({})
|
||||
local config = require 'lspconfig'
|
||||
local util = require 'lspconfig/util'
|
||||
local cmp = require 'cmp'
|
||||
local cmp_action = require('lsp-zero').cmp_action()
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
branch = "v2.x",
|
||||
dependencies = {
|
||||
-- LSP Support
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
cmd = {
|
||||
"Mason",
|
||||
"MasonUpdate",
|
||||
"MasonInstall",
|
||||
"MasonInstallAll",
|
||||
"MasonUninstall",
|
||||
"MasonUninstallAll",
|
||||
"MasonLog",
|
||||
},
|
||||
build = ":MasonUpdate",
|
||||
event = "BufRead",
|
||||
},
|
||||
{ "williamboman/mason-lspconfig.nvim" },
|
||||
-- Autocompletion
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
-- Snips
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = "rafamadriz/friendly-snippets",
|
||||
opts = {
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
-- config? -- https://github.com/NvChad/NvChad/blob/v2.0/lua/plugins/configs/others.lua#L25-L50
|
||||
},
|
||||
},
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
opts = {
|
||||
fast_wrap = {},
|
||||
disable_filetype = { "TelescopePrompt", "vim" },
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("nvim-autopairs").setup(opts)
|
||||
-- setup cmp for autopairs
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
},
|
||||
{ "saadparwaiz1/cmp_luasnip" },
|
||||
{ "hrsh7th/cmp-nvim-lua" },
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "hrsh7th/cmp-buffer" },
|
||||
{ "hrsh7th/cmp-path" },
|
||||
{ "hrsh7th/cmp-cmdline" },
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local lsp = require("lsp-zero").preset({})
|
||||
local config = require("lspconfig")
|
||||
local util = require("lspconfig/util")
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
capabilities = vim.tbl_deep_extend("keep", capabilities, vim.lsp.protocol.make_client_capabilities());
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
local on_attach = function(_, bufnr)
|
||||
lsp.default_keymaps({ buffer = bufnr })
|
||||
end
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
capabilities = vim.tbl_deep_extend("keep", capabilities, vim.lsp.protocol.make_client_capabilities())
|
||||
capabilities.textDocument.completion.completionItem = {
|
||||
documentationFormat = { "markdown", "plaintext" },
|
||||
snippetSupport = true,
|
||||
preselectSupport = true,
|
||||
insertReplaceSupport = true,
|
||||
labelDetailsSupport = true,
|
||||
deprecatedSupport = true,
|
||||
commitCharactersSupport = true,
|
||||
tagSupport = { valueSet = { 1 } },
|
||||
resolveSupport = {
|
||||
properties = {
|
||||
"documentation",
|
||||
"detail",
|
||||
"additionalTextEdits",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
lsp.on_attach(on_attach)
|
||||
lsp.ensure_installed({
|
||||
-- -- https://github.com/williamboman/mason-lspconfig.nvim#available-lsp-servers
|
||||
"lua_ls",
|
||||
"rust_analyzer",
|
||||
"tsserver",
|
||||
"eslint",
|
||||
"cssls",
|
||||
"cssmodules_ls",
|
||||
"pyright",
|
||||
"prettierd",
|
||||
local on_attach = function(client, bufnr)
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
client.server_capabilities.documentRangeFormattingProvider = false
|
||||
|
||||
lsp.default_keymaps({ buffer = bufnr })
|
||||
|
||||
local opts = { buffer = bufnr }
|
||||
local bind = function(map, cmd, mode) vim.keymap.set('n', map, cmd, opts) end
|
||||
|
||||
-- diagnostics
|
||||
bind("<leader>ld", "<cmd>lua vim.diagnostic.open_float()<CR>")
|
||||
bind("<leader>[d", "<cmd>lua vim.diagnostic.goto_prev()<CR>")
|
||||
bind("<leader>]d", "<cmd>lua vim.diagnostic.goto_next()<CR>")
|
||||
|
||||
bind("<leader>la", "<cmd>lua vim.lsp.buf.code_action()<CR>")
|
||||
end
|
||||
|
||||
lsp.on_attach(on_attach)
|
||||
local servers = {
|
||||
-- -- https://github.com/williamboman/mason-lspconfig.nvim#available-lsp-servers
|
||||
-- lua
|
||||
"lua_ls",
|
||||
-- rust
|
||||
"rust_analyzer",
|
||||
-- ts/js | web
|
||||
"tsserver",
|
||||
"html",
|
||||
"emmet_ls",
|
||||
"sqlls",
|
||||
"dockerls",
|
||||
"docker_compose_language_service",
|
||||
})
|
||||
"eslint",
|
||||
"cssls",
|
||||
"cssmodules_ls",
|
||||
|
||||
config.lua_ls.setup(lsp.nvim_lua_ls())
|
||||
-- python
|
||||
"pyright",
|
||||
|
||||
config.rust_analyzer.setup {}
|
||||
-- docker
|
||||
"dockerls",
|
||||
"docker_compose_language_service",
|
||||
}
|
||||
lsp.ensure_installed(servers)
|
||||
|
||||
config.tsserver.setup {
|
||||
local default = require('util').spread {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
root_dir = nvim_lsp.util.root_pattern("tsconfig.json", ".git"),
|
||||
|
||||
capabilities = capabilities,
|
||||
}
|
||||
config.eslint.setup {}
|
||||
config.cssls.setup {}
|
||||
config.cssmodules_ls.setup {}
|
||||
|
||||
config.pyright.setup {}
|
||||
config.lua_ls.setup(lsp.nvim_lua_ls())
|
||||
config.stylua.setup(default {})
|
||||
|
||||
lsp.setup()
|
||||
config.rust_analyzer.setup(default {})
|
||||
|
||||
cmp.setup({
|
||||
window = {
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp", priority = 1000 },
|
||||
{ name = "luasnip", priority = 750, keyword_length = 2 },
|
||||
{ name = "buffer", priority = 500, keyword_length = 3 },
|
||||
{ name = "path", priority = 250 },
|
||||
},
|
||||
mapping = {
|
||||
['<CR>'] = cmp.mapping.confirm({ select = false }),
|
||||
['<Tab>'] = cmp_action.tab_complete(),
|
||||
['<S-Tab>'] = cmp_action.select_prev_or_fallback(),
|
||||
-- Ctrl+Space to trigger completion menu
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
config.tsserver.setup(default {
|
||||
root_dir = util.root_pattern("tsconfig.json", ".git"),
|
||||
})
|
||||
config.html.setup(default {})
|
||||
config.eslint.setup(default {})
|
||||
config.deno.setup(default {})
|
||||
config.cssls.setup(default {})
|
||||
config.cssmodules_ls.setup(default {})
|
||||
config.prettier.setup(default {})
|
||||
|
||||
['<C-f>'] = cmp_action.luasnip_jump_forward(),
|
||||
['<C-b>'] = cmp_action.luasnip_jump_backward(),
|
||||
}
|
||||
})
|
||||
end,
|
||||
-- keys = {
|
||||
-- { "<leader>l", "<Nop>", desc = "LSP" },
|
||||
-- },
|
||||
config.pyright.setup(default {})
|
||||
|
||||
lsp.setup()
|
||||
|
||||
local cmp = require("cmp")
|
||||
local cmp_action = require("lsp-zero").cmp_action()
|
||||
|
||||
cmp.setup({
|
||||
window = {
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp", priority = 1000 },
|
||||
{ name = "luasnip", priority = 750, keyword_length = 2 },
|
||||
{ name = "buffer", priority = 500, keyword_length = 3 },
|
||||
{ nane = "nvim_lua", print = 250, keyword_length = 3 },
|
||||
{ name = "path", priority = 150, keyword_length = 3 },
|
||||
-- { name = "cmdline", priority = 50, keyword_length = 5 },
|
||||
},
|
||||
mapping = {
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
["<Tab>"] = cmp_action.tab_complete(),
|
||||
["<S-Tab>"] = cmp_action.select_prev_or_fallback(),
|
||||
-- Ctrl+Space to trigger completion menu
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
|
||||
["<C-f>"] = cmp_action.luasnip_jump_forward(),
|
||||
["<C-b>"] = cmp_action.luasnip_jump_backward(),
|
||||
},
|
||||
})
|
||||
end,
|
||||
-- keys = {
|
||||
-- { "<leader>l", "<Nop>", desc = "LSP" },
|
||||
-- },
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ return {
|
|||
},
|
||||
nesting_rules = {
|
||||
["ts"] = { ".cjs", ".cjs.map", ".d.ts", ".d.ts.map", ".js", ".js.map", ".mjs", ".mjs.map", ".test.ts" },
|
||||
["js"] = { ".cjs", ".cjs.map", ".d.js", ".d.js.map", ".js", ".js.map", ".mjs", ".mjs.map", ".test.js" },
|
||||
["tsx"] = { ".d.ts", ".d.ts.map", ".js;", ".js.map;", ".jsx;", ".jsx.map;", ".module.scss;", ".svg" },
|
||||
["scss"] = { ".css", ".css.map" },
|
||||
},
|
||||
|
@ -39,3 +40,4 @@ return {
|
|||
end , desc = "Toggle Explorer Focus" },
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,14 @@ end
|
|||
|
||||
return {
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
dependencies = "williamboman/mason.nvim",
|
||||
opts = function(_, config)
|
||||
require('util').ensure_installed_mason({
|
||||
"stylua",
|
||||
"prettier",
|
||||
"rustfmt",
|
||||
})
|
||||
|
||||
-- config variable is the default definitions table for the setup function call
|
||||
local null_ls = require "null-ls"
|
||||
|
||||
|
@ -25,9 +32,10 @@ return {
|
|||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||
config.sources = {
|
||||
-- Set a formatter
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.prettier,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.rustfmt,
|
||||
null_ls.builtins.formatting.python,
|
||||
-- null_ls.builtins.code_actions.proselint, -- TODO looks interesting
|
||||
null_ls.builtins.code_actions.cspell.with {
|
||||
config = {
|
||||
|
@ -40,6 +48,7 @@ return {
|
|||
}
|
||||
|
||||
config.update_in_insert = true
|
||||
config.debug = true
|
||||
|
||||
return config
|
||||
end,
|
||||
|
|
|
@ -3,7 +3,7 @@ return {
|
|||
dependencies = { "windwp/nvim-ts-autotag", "JoosepAlviste/nvim-ts-context-commentstring" },
|
||||
commit = "f2778bd1a28b74adf5b1aa51aa57da85adfa3d16",
|
||||
build = ":TSUpdate",
|
||||
event = "BufEnter",
|
||||
event = "BufRead",
|
||||
cmd = {
|
||||
"TSBufDisable",
|
||||
"TSBufEnable",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue