progress
This commit is contained in:
parent
42a3ec0172
commit
66c32e98f5
9 changed files with 230 additions and 96 deletions
3
TODO.md
3
TODO.md
|
@ -1,3 +0,0 @@
|
|||
from https://stackoverflow.com/a/676619
|
||||
- `vnoremap <C-R> "hy:%s/<C-r>h//gc<left><left><left>` with confirm
|
||||
- `vnoremap <C-r> "hy:%s/<C-r>h//g<left><left><left>` without confirm
|
|
@ -5,26 +5,30 @@
|
|||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
|
||||
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "49ca2a0e0e26427b550b1f64272d7fe7e4d7d51b" },
|
||||
"glow.nvim": { "branch": "advanced_window", "commit": "bbd0473d72a45094495ee5600b5577823543eefe" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "d1b02c2dda88422ca573f2a1ebdfb213ce0124d6" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6b2311a46a3808e366bb251270f4cc04afb421ed" },
|
||||
"lsp-zero.nvim": { "branch": "v2.x", "commit": "8fda9a849d6ab4196ecf129905764ddefdfb64b5" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "5230617372e656d4a2e1e236e03bf7e7b4b97273" },
|
||||
"mason.nvim": { "branch": "main", "commit": "7d7efc738e08fc5bee822857db45cb6103f0b0c1" },
|
||||
"mason.nvim": { "branch": "main", "commit": "02767937fc2e1b214c854a8fdde26ae1d3529dd6" },
|
||||
"material.nvim": { "branch": "main", "commit": "0c725897bc3d22c45fbf25a602002ee02f06f619" },
|
||||
"neo-tree.nvim": { "branch": "v2.x", "commit": "20c2f2f5ba083bbb1e37b8bc3d590621434f31e9" },
|
||||
"nui.nvim": { "branch": "main", "commit": "062e366afcdf2bc1e9d28313a1df4ff14f05cb4e" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "a138b14099e9623832027ea12b4631ddd2a49256" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b5a636d46c69bb371995c22d7a10ee1544004879" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "0f598b9ab9f2a6d7e137074be99c8d89af44b990" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "f2778bd1a28b74adf5b1aa51aa57da85adfa3d16" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "59df87a84c80a357ca8d8fe86e451b93ac476ccc" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b8c2a62b3bd3827aa059b43be3dd4b5c45037d65" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "fefba589c56a5568a089299e36a4c8242502faaa" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "0ae494269acd469fbd896cf5d5a430dbbf4d4e95" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "40615e96075c743ef47aaf9de966dc348bec6459" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "0bf8fbc2ca8f8cdb6efbd0a9e32740d7a991e4c3" },
|
||||
"openingh.nvim": { "branch": "main", "commit": "374c081409dc238018cd986410f16190d8f9f680" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "9ac3e9541bbabd9d73663d757e4fe48a675bb054" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "36aaceb6e93addd20b1b18f94d86aecc552f30c4" },
|
||||
"rest.nvim": { "branch": "main", "commit": "d8dc204e9f6fd930d9d1d709f0d19138f804431a" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "c1a2af0af69e80e14e6b226d3957a064cd080805" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "00cf15074a2997487813672a75f946d2ead95eb0" },
|
||||
"undotree": { "branch": "master", "commit": "485f01efde4e22cb1ce547b9e8c9238f36566f21" }
|
||||
}
|
|
@ -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,76 +1,154 @@
|
|||
return {
|
||||
'VonHeikemen/lsp-zero.nvim',
|
||||
branch = 'v2.x',
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
branch = "v2.x",
|
||||
dependencies = {
|
||||
-- LSP Support
|
||||
{ 'neovim/nvim-lspconfig' },
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
{
|
||||
'williamboman/mason.nvim',
|
||||
build = function()
|
||||
pcall(vim.cmd, 'MasonUpdate')
|
||||
"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,
|
||||
},
|
||||
{ 'williamboman/mason-lspconfig.nvim' },
|
||||
-- Autocompletion
|
||||
{ 'hrsh7th/nvim-cmp' },
|
||||
{ 'hrsh7th/cmp-nvim-lsp' },
|
||||
{ 'hrsh7th/cmp-buffer' },
|
||||
{ 'hrsh7th/cmp-path' },
|
||||
{ 'hrsh7th/cmp-cmdline' },
|
||||
-- Snips
|
||||
{ 'L3MON4D3/LuaSnip' },
|
||||
{ "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 cmp = require 'cmp'
|
||||
local cmp_action = require('lsp-zero').cmp_action()
|
||||
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)
|
||||
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",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
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)
|
||||
lsp.ensure_installed({
|
||||
local servers = {
|
||||
-- -- https://github.com/williamboman/mason-lspconfig.nvim#available-lsp-servers
|
||||
-- lua
|
||||
"lua_ls",
|
||||
-- rust
|
||||
"rust_analyzer",
|
||||
-- ts/js | web
|
||||
"tsserver",
|
||||
"html",
|
||||
"eslint",
|
||||
"cssls",
|
||||
"cssmodules_ls",
|
||||
|
||||
-- python
|
||||
"pyright",
|
||||
"prettierd",
|
||||
"html",
|
||||
"emmet_ls",
|
||||
"sqlls",
|
||||
|
||||
-- docker
|
||||
"dockerls",
|
||||
"docker_compose_language_service",
|
||||
})
|
||||
}
|
||||
lsp.ensure_installed(servers)
|
||||
|
||||
config.lua_ls.setup(lsp.nvim_lua_ls())
|
||||
|
||||
config.rust_analyzer.setup {}
|
||||
|
||||
config.tsserver.setup {
|
||||
local default = require('util').spread {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
root_dir = nvim_lsp.util.root_pattern("tsconfig.json", ".git"),
|
||||
|
||||
}
|
||||
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 {})
|
||||
|
||||
config.rust_analyzer.setup(default {})
|
||||
|
||||
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 {})
|
||||
|
||||
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(),
|
||||
|
@ -79,18 +157,20 @@ return {
|
|||
{ name = "nvim_lsp", priority = 1000 },
|
||||
{ name = "luasnip", priority = 750, keyword_length = 2 },
|
||||
{ name = "buffer", priority = 500, keyword_length = 3 },
|
||||
{ name = "path", priority = 250 },
|
||||
{ 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(),
|
||||
["<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-Space>"] = cmp.mapping.complete(),
|
||||
|
||||
['<C-f>'] = cmp_action.luasnip_jump_forward(),
|
||||
['<C-b>'] = cmp_action.luasnip_jump_backward(),
|
||||
}
|
||||
["<C-f>"] = cmp_action.luasnip_jump_forward(),
|
||||
["<C-b>"] = cmp_action.luasnip_jump_backward(),
|
||||
},
|
||||
})
|
||||
end,
|
||||
-- keys = {
|
||||
|
|
|
@ -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",
|
||||
|
|
26
lua/util.lua
26
lua/util.lua
|
@ -20,5 +20,31 @@ function M.keymaps(mappings)
|
|||
end
|
||||
end
|
||||
|
||||
function M.spread(template)
|
||||
local result = {}
|
||||
for key, value in pairs(template) do
|
||||
result[key] = value
|
||||
end
|
||||
|
||||
return function(table)
|
||||
for key, value in pairs(table) do
|
||||
result[key] = value
|
||||
end
|
||||
return result
|
||||
end
|
||||
end
|
||||
|
||||
function M.ensure_installed_mason(items)
|
||||
local registry = require 'mason-registry'
|
||||
for _, item in ipairs(items) do
|
||||
if not registry.is_installed(item) then
|
||||
if registry.has_package(item) then
|
||||
registry.get_package(item).install()
|
||||
end
|
||||
end
|
||||
end
|
||||
registry.refresh()
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue