aboutsummaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorPolesznyák Márk <contact@pml68.dev>2026-04-04 03:16:27 +0200
committerPolesznyák Márk <contact@pml68.dev>2026-04-04 10:12:16 +0200
commit8bb513a86e8bea07fdb8cea71d254d46ffc7806b (patch)
tree745bd411d173e4da9355b214dc74edde08f42692 /lua
parentfeat: enable ui2, add back LspLog command (diff)
downloadnvim-8bb513a86e8bea07fdb8cea71d254d46ffc7806b.tar.gz
feat!: migrate to vim.pack
Diffstat (limited to '')
-rw-r--r--lua/pml68/lazy.lua47
-rw-r--r--lua/pml68/plugins/colors.lua31
-rw-r--r--lua/pml68/plugins/completion.lua35
-rw-r--r--lua/pml68/plugins/git.lua22
-rw-r--r--lua/pml68/plugins/guard.lua25
-rw-r--r--lua/pml68/plugins/lang-specific.lua62
-rw-r--r--lua/pml68/plugins/lsp.lua22
-rw-r--r--lua/pml68/plugins/misc.lua19
-rw-r--r--lua/pml68/plugins/oil.lua29
-rw-r--r--lua/pml68/plugins/other.lua26
-rw-r--r--lua/pml68/plugins/telescope.lua17
-rw-r--r--lua/pml68/plugins/treesitter.lua68
-rw-r--r--plugin/00-settings.lua (renamed from lua/pml68/settings.lua)54
-rw-r--r--plugin/10-remap.lua (renamed from lua/pml68/remap.lua)94
-rw-r--r--plugin/30-lspconfig.lua (renamed from lua/pml68/lsp.lua)22
-rw-r--r--plugin/40-lsp.lua (renamed from lua/pml68/configs/mason.lua)25
16 files changed, 143 insertions, 455 deletions
diff --git a/lua/pml68/lazy.lua b/lua/pml68/lazy.lua
deleted file mode 100644
index 32500fa..0000000
--- a/lua/pml68/lazy.lua
+++ /dev/null
@@ -1,47 +0,0 @@
-local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
-if not (vim.uv or vim.loop).fs_stat(lazypath) then
- local out = vim.fn.system({
- "git",
- "clone",
- "--filter=blob:none",
- "https://github.com/folke/lazy.nvim.git",
- "--branch=stable", -- latest stable release
- lazypath,
- })
- if vim.v.shell_error ~= 0 then
- vim.api.nvim_echo({
- { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
- { out, "WarningMsg" },
- { "\nPress any key to exit..." },
- }, true, {})
- vim.fn.getchar()
- os.exit(1)
- end
-end
-vim.opt.rtp:prepend(lazypath)
-
-require("lazy").setup("pml68.plugins", {
- defaults = { lazy = true },
- change_detection = {
- notify = false,
- },
- performance = {
- cache = {
- enabled = true,
- },
- rtp = {
- disabled_plugins = {
- "gzip",
- "tarPlugin",
- "tohtml",
- "tutor",
- "zipPlugin",
- "osc52",
- "netrwPlugin",
- },
- },
- },
- ui = {
- border = "rounded"
- },
-})
diff --git a/lua/pml68/plugins/colors.lua b/lua/pml68/plugins/colors.lua
deleted file mode 100644
index 17a1ca1..0000000
--- a/lua/pml68/plugins/colors.lua
+++ /dev/null
@@ -1,31 +0,0 @@
-return {
- {
- "uga-rosa/ccc.nvim",
- event = { "BufReadPost", "BufNewFile" },
- opts = {
- highlighter = {
- auto_enable = true,
- lsp = true,
- },
- },
- },
- {
- "pml68/rosepine-tmuxed",
- name = "rose-pine",
- priority = 1000,
- lazy = false,
- config = function()
- require("rose-pine").setup({
- styles = {
- transparency = true,
- italic = false,
- },
- highlight_groups = {
- StatusLine = { fg = "iris", bg = "iris", blend = 25 },
- StatusLineNC = { fg = "subtle", bg = "surface" },
- },
- })
- vim.cmd("colorscheme rose-pine")
- end
- },
-}
diff --git a/lua/pml68/plugins/completion.lua b/lua/pml68/plugins/completion.lua
deleted file mode 100644
index 596b1af..0000000
--- a/lua/pml68/plugins/completion.lua
+++ /dev/null
@@ -1,35 +0,0 @@
-return {
- {
- "saghen/blink.compat",
- version = "2.*",
- opts = {}
- },
- {
- "saghen/blink.cmp",
- lazy = false,
- version = "1.*",
- opts = {
- keymap = { preset = "default" },
- appearance = {
- nerd_font_variant = "normal",
- },
- completion = {
- documentation = {
- auto_show = true,
- auto_show_delay_ms = 150,
- },
- },
- sources = {
- default = { "lsp", "path", "vimtex", "buffer" },
- providers = {
- vimtex = {
- name = "vimtex",
- module = "blink.compat.source",
- },
- },
- },
- cmdline = { enabled = false },
- signature = { enabled = true },
- },
- },
-}
diff --git a/lua/pml68/plugins/git.lua b/lua/pml68/plugins/git.lua
deleted file mode 100644
index e94c230..0000000
--- a/lua/pml68/plugins/git.lua
+++ /dev/null
@@ -1,22 +0,0 @@
-return {
- "lewis6991/gitsigns.nvim",
- event = { "BufReadPost", "BufNewFile" },
- config = function()
- require("gitsigns").setup({
- signs = {
- add = { text = "│" },
- change = { text = "│" },
- delete = { text = "󰍵" },
- topdelete = { text = "‾" },
- changedelete = { text = "~" },
- untracked = { text = "│" },
- },
- on_attach = function(bufnr)
- local gs = package.loaded.gitsigns
-
- vim.keymap.set("n", "<leader>gb", gs.blame_line, { buffer = bufnr })
- vim.keymap.set("n", "<leader>gr", gs.reset_hunk, { buffer = bufnr })
- end,
- })
- end
-}
diff --git a/lua/pml68/plugins/guard.lua b/lua/pml68/plugins/guard.lua
deleted file mode 100644
index 7f609de..0000000
--- a/lua/pml68/plugins/guard.lua
+++ /dev/null
@@ -1,25 +0,0 @@
-return {
- "nvimdev/guard.nvim",
- dependencies = {
- "nvimdev/guard-collection"
- },
- ft = { "c", "cpp", "h", "toml", "json", "go", "lua" },
- config = function()
- local ft = require("guard.filetype")
-
- ft("c,cpp,h"):fmt("clang-format")
- ft("toml"):fmt("taplo")
- ft("json"):fmt("jq")
-
- ft("go"):fmt({
- cmd = "golines",
- args = { "--max-len=80", "--base-formatter=gofumpt" },
- stdin = true,
- })
-
- vim.g.guard_config = {
- fmt_on_save = true,
- lsp_as_default_formatter = true,
- }
- end
-}
diff --git a/lua/pml68/plugins/lang-specific.lua b/lua/pml68/plugins/lang-specific.lua
deleted file mode 100644
index b1eff88..0000000
--- a/lua/pml68/plugins/lang-specific.lua
+++ /dev/null
@@ -1,62 +0,0 @@
-return {
- -- JSON
- {
- "b0o/schemastore.nvim",
- lazy = false,
- },
- -- Java
- {
- "mfussenegger/nvim-jdtls"
- },
- -- Go
- {
- "olexsmir/gopher.nvim",
- ft = "go",
- build = ":GoInstallDeps",
- },
- -- Rust
- {
- "rust-lang/rust.vim",
- ft = "rust",
- init = function()
- vim.g.rustfmt_autosave = 1
- end,
- config = function()
- vim.keymap.set("n", "<leader>rts", "<cmd>RustTest<CR>")
- vim.keymap.set("n", "<leader>rta", "<cmd>RustTest!<CR>")
- end
- },
- {
- "saecki/crates.nvim",
- event = { "BufRead Cargo.toml", "BufWrite Cargo.toml" },
- config = function()
- local crates = require("crates")
- crates.setup({
- lsp = {
- enabled = true,
- actions = true,
- completion = true,
- hover = true,
- },
- })
-
- vim.keymap.set("n", "<leader>rcu", function()
- crates.upgrade_all_crates()
- end)
- end
- },
- -- LaTeX
- {
- "lervag/vimtex",
- dependencies = "micangl/cmp-vimtex",
- ft = "tex",
- init = function()
- vim.g.vimtex_view_method = 'mupdf'
- end,
- },
- -- Hare
- {
- url = "git://git.pml68.dev/vim-haredoc",
- ft = "hare",
- },
-}
diff --git a/lua/pml68/plugins/lsp.lua b/lua/pml68/plugins/lsp.lua
deleted file mode 100644
index 999320e..0000000
--- a/lua/pml68/plugins/lsp.lua
+++ /dev/null
@@ -1,22 +0,0 @@
-return {
- {
- "neovim/nvim-lspconfig",
- event = { "BufReadPost", "BufNewFile" },
- },
- {
- "mason-org/mason.nvim",
- cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonUpdate", "MasonLog" },
- opts = function()
- return require("pml68.configs.mason")
- end,
- config = function(_, opts)
- require("mason").setup(opts)
- vim.api.nvim_create_user_command("MasonInstallAll", function()
- if opts.ensure_installed and #opts.ensure_installed > 0 then
- vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " "))
- end
- end, {})
- end,
- build = ":MasonInstallAll",
- },
-}
diff --git a/lua/pml68/plugins/misc.lua b/lua/pml68/plugins/misc.lua
deleted file mode 100644
index 1e0aec3..0000000
--- a/lua/pml68/plugins/misc.lua
+++ /dev/null
@@ -1,19 +0,0 @@
-return {
- {
- "andweeb/presence.nvim",
- event = { "BufReadPost", "BufNewFile" },
- opts = {
- main_image = "file",
- },
- },
- {
- "NStefan002/screenkey.nvim",
- cmd = "Screenkey",
- version = "*",
- config = true
- },
- {
- "eandrju/cellular-automaton.nvim",
- cmd = "CellularAutomaton",
- },
-}
diff --git a/lua/pml68/plugins/oil.lua b/lua/pml68/plugins/oil.lua
deleted file mode 100644
index 974f94f..0000000
--- a/lua/pml68/plugins/oil.lua
+++ /dev/null
@@ -1,29 +0,0 @@
-return {
- "stevearc/oil.nvim",
- cmd = "Oil",
- config = function()
- require("oil").setup({
- keymaps = {
- ["<C-h>"] = false,
- },
- view_options = {
- show_hidden = true,
- natural_order = true,
- is_always_hidden = function(name, _)
- return name == '.git' or name == "node_modules" or name == "target"
- end
- },
- float = {
- padding = 2,
- max_width = 50,
- max_height = 0,
- border = "single",
- win_options = {
- winblend = 0,
- },
- },
- skip_confirm_for_simple_edits = true,
- default_file_explorer = true,
- })
- end
-}
diff --git a/lua/pml68/plugins/other.lua b/lua/pml68/plugins/other.lua
deleted file mode 100644
index d415f0b..0000000
--- a/lua/pml68/plugins/other.lua
+++ /dev/null
@@ -1,26 +0,0 @@
-return {
- {
- "NStefan002/visual-surround.nvim",
- event = { "BufReadPost", "BufNewFile" },
- config = true,
- },
- {
- "christoomey/vim-tmux-navigator",
- lazy = false,
- },
- {
- "artemave/workspace-diagnostics.nvim",
- },
- {
- "lukas-reineke/indent-blankline.nvim",
- main = "ibl",
- event = { "BufReadPost", "BufNewFile" },
- config = function()
- require("ibl").setup()
- end
- },
- {
- "stevearc/dressing.nvim",
- event = "VeryLazy",
- },
-}
diff --git a/lua/pml68/plugins/telescope.lua b/lua/pml68/plugins/telescope.lua
deleted file mode 100644
index ccc0488..0000000
--- a/lua/pml68/plugins/telescope.lua
+++ /dev/null
@@ -1,17 +0,0 @@
-return {
- "nvim-telescope/telescope.nvim",
- tag = "v0.2.1",
- cmd = "Telescope",
- dependencies = {
- "nvim-lua/plenary.nvim",
- "nvim-telescope/telescope-fzf-native.nvim",
- },
- opts = {
- pickers = {
- find_files = {
- hidden = true,
- find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/**" },
- },
- },
- },
-}
diff --git a/lua/pml68/plugins/treesitter.lua b/lua/pml68/plugins/treesitter.lua
deleted file mode 100644
index 6416f1f..0000000
--- a/lua/pml68/plugins/treesitter.lua
+++ /dev/null
@@ -1,68 +0,0 @@
-return {
- "nvim-treesitter/nvim-treesitter",
- lazy = false,
- build = ":TSUpdate",
- config = function()
- local ts = require("nvim-treesitter")
-
- local ensure_installed = {
- "asm",
- "bash",
- "c",
- "c_sharp",
- "cpp",
- "css",
- "git_config",
- "gitattributes",
- "gitcommit",
- "gitignore",
- "glsl",
- "go",
- "gomod",
- "gosum",
- "gotmpl",
- "gowork",
- "hare",
- "html",
- "java",
- "javascript",
- "json",
- "kotlin",
- "lua",
- "make",
- "markdown",
- "markdown_inline",
- "python",
- "rust",
- "scss",
- "svelte",
- "typescript",
- "vim",
- "vimdoc",
- "yaml",
- }
-
- ts.install(ensure_installed, {
- max_jobs = 12,
- summary = false,
- })
-
- local ignore = {
- "checkhealth",
- "lazy",
- "mason",
- "TelescopePrompt",
- }
-
- vim.api.nvim_create_autocmd("FileType", {
- group = vim.api.nvim_create_augroup("EnableTreesitterHighlighting", { clear = true }),
- callback = function(event)
- if vim.tbl_contains(ignore, event.match) then
- return
- end
-
- pcall(function() vim.treesitter.start(event.buf) end)
- end
- })
- end
-}
diff --git a/lua/pml68/settings.lua b/plugin/00-settings.lua
index 071d139..fba8771 100644
--- a/lua/pml68/settings.lua
+++ b/plugin/00-settings.lua
@@ -7,14 +7,15 @@ vim.o.laststatus = 3
vim.o.winborder = "rounded"
-local function branch_name()
- local branch = vim.fn.system("git branch --show-current 2> /dev/null | tr -d '\n'")
- if branch ~= "" then
- return " " .. branch
- else
- return ""
- end
-end
+-- Plugin specific
+vim.g.rustfmt_autosave = 1
+vim.g.vimtex_view_method = 'mupdf'
+vim.g.guard_config = {
+ fmt_on_save = true,
+ lsp_as_default_formatter = true,
+}
+
+vim.g.mason_path = vim.fn.stdpath("data") .. "/mason/bin"
vim.diagnostic.config({ virtual_lines = true })
@@ -55,27 +56,48 @@ local function get_attached_clients()
return language_servers
end
-vim.api.nvim_create_autocmd({ "FileType", "BufEnter", "FocusGained" }, {
- callback = function()
- vim.b.branch_name = branch_name()
- end
-})
-
vim.api.nvim_create_user_command("LspLog", function(_)
vim.cmd("edit " .. vim.fn.stdpath("state") .. "/lsp.log")
end, {
desc = "Show LSP log",
})
+vim.api.nvim_create_user_command("PackUpdate", function(_)
+ vim.pack.update()
+end, {
+ desc = "Update vim.pack plugins",
+})
+
+vim.api.nvim_create_user_command("PackList", function(_)
+ vim.pack.update(nil, { offline = true })
+end, {
+ desc = "List vim.pack plugins",
+})
+
require("vim._core.ui2").enable({
enable = true,
})
+local function branch_name()
+ local branch = vim.fn.system("git branch --show-current 2> /dev/null | tr -d '\n'")
+ if branch ~= "" then
+ return " " .. branch
+ else
+ return ""
+ end
+end
+
+vim.api.nvim_create_autocmd({ "FileType", "BufEnter", "FocusGained" }, {
+ callback = function()
+ vim.b.branch_name = branch_name()
+ end
+})
+
function Status_Line()
return " "
.. "%<"
.. " %f "
- .. vim.b.branch_name
+ .. (vim.b.branch_name or "")
.. " %m"
.. " %= "
.. diagnostics()
@@ -115,4 +137,4 @@ vim.o.foldmethod = "expr"
vim.o.foldenable = false
vim.o.foldexpr = "v:lua.vim.treesitter.foldexpr()"
-vim.env.PATH = vim.fn.stdpath "data" .. "/mason/bin" .. ":" .. vim.env.PATH
+vim.env.PATH = vim.g.mason_path .. ":" .. vim.env.PATH
diff --git a/lua/pml68/remap.lua b/plugin/10-remap.lua
index 0af8323..a30d6a8 100644
--- a/lua/pml68/remap.lua
+++ b/plugin/10-remap.lua
@@ -21,10 +21,10 @@ vim.keymap.set("n", "<leader>sl", "<cmd>exec \"normal i\".nr2char(getchar()).\"\
vim.keymap.set("n", "<leader>sc", "<cmd>exec \"normal a\".nr2char(getchar()).\"\\e\"<CR>")
-- u/soer9459
-vim.keymap.set('n', '<leader>,',
+vim.keymap.set("n", "<leader>,",
function()
local cursor = vim.api.nvim_win_get_cursor(0)
- vim.cmd('norm A;')
+ vim.cmd("norm A;")
vim.api.nvim_win_set_cursor(0, cursor)
end,
{ noremap = true, silent = true })
@@ -43,9 +43,6 @@ vim.keymap.set("n", "<C-l>", "<cmd>TmuxNavigateRight<CR>")
vim.keymap.set("n", "<C-j>", "<cmd>TmuxNavigateDown<CR>")
vim.keymap.set("n", "<C-k>", "<cmd>TmuxNavigateUp<CR>")
--- Cellular Automaton
-vim.keymap.set("n", "<leader>gol", "<cmd>CellularAutomaton game_of_life<CR>")
-
-- Color picker
vim.keymap.set("n", "<leader>cc", "<cmd>CccPick<CR>")
@@ -53,12 +50,6 @@ vim.keymap.set("n", "<leader>cc", "<cmd>CccPick<CR>")
vim.keymap.set("n", "<leader>ll", "<cmd>VimtexCompile<CR>")
vim.keymap.set("n", "<leader>vl", "<cmd>VimtexView<CR>")
--- Go
-vim.keymap.set("n", "<leader>gj", "<cmd>GoTagAdd json<CR>")
-vim.keymap.set("n", "<leader>gy", "<cmd>GoTagAdd yaml<CR>")
-vim.keymap.set("n", "<leader>ge", "<cmd>GoIfErr<CR>")
-vim.keymap.set("n", "<leader>gt", "<cmd>GoMod tidy<CR>")
-
-- Screenkey
vim.keymap.set("n", "<leader>sk", "<cmd>Screenkey<CR>")
@@ -67,16 +58,58 @@ vim.cmd("packadd nvim.undotree")
vim.keymap.set("n", "<leader>u", require("undotree").open)
-- Telescope
-vim.keymap.set('n', '<leader>ff', "<cmd>Telescope find_files<CR>", {})
-vim.keymap.set('n', '<leader>fw', "<cmd>Telescope live_grep<CR>", {})
-vim.keymap.set('n', '<leader>fo', "<cmd>Telescope buffers<CR>", {})
-vim.keymap.set('n', '<leader>fh', "<cmd>Telescope help_tags<CR>", {})
-vim.keymap.set('n', '<leader>fz', "<cmd>Telescope current_buffer_fuzzy_find<CR>", {})
-vim.keymap.set('n', '<leader>fg', "<cmd>Telescope git_files<CR>", {})
-vim.keymap.set('n', '<leader>fd', "<cmd>Telescope diagnostics<CR>", {})
-vim.keymap.set('n', '<leader>ft', function()
+local lazy_telescope = function()
+ vim.pack.add({
+ "https://github.com/nvim-lua/plenary.nvim",
+ {
+ src = "https://github.com/nvim-telescope/telescope.nvim",
+ version = "v0.2.2"
+ },
+ })
+
+ require("telescope").setup({
+ pickers = {
+ find_files = {
+ hidden = true,
+ find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/**" },
+ },
+ },
+ })
+end
+
+vim.keymap.set("n", "<leader>ff", function()
+ lazy_telescope()
+ vim.cmd("Telescope find_files")
+end, {})
+vim.keymap.set("n", "<leader>fw", function()
+ lazy_telescope()
+ vim.cmd("Telescope live_grep")
+end, {})
+vim.keymap.set("n", "<leader>fo", function()
+ lazy_telescope()
+ vim.cmd("Telescope buffers")
+end, {})
+vim.keymap.set("n", "<leader>fh", function()
+ lazy_telescope()
+ vim.cmd("Telescope help_tags")
+end, {})
+vim.keymap.set("n", "<leader>fz", function()
+ lazy_telescope()
+ vim.cmd("Telescope current_buffer_fuzzy_find")
+end, {})
+vim.keymap.set("n", "<leader>fg", function()
+ lazy_telescope()
+ vim.cmd("Telescope git_files")
+end, {})
+vim.keymap.set("n", "<leader>fd", function()
+ lazy_telescope()
+ vim.cmd("Telescope diagnostics")
+end, {})
+vim.keymap.set("n", "<leader>ft", function()
+ lazy_telescope()
local telescope = require("telescope.builtin")
local handle = io.popen("rg 'TODO'")
+ if handle == nil then return end
local result = handle:read("*a")
handle:close()
@@ -84,6 +117,7 @@ vim.keymap.set('n', '<leader>ft', function()
local todo_files = {}
local files_handle = io.popen("rg --files -g 'TODO.{md,txt}'")
+ if files_handle == nil then return end
local files_result = files_handle:read("*a")
files_handle:close()
@@ -106,22 +140,22 @@ vim.keymap.set('n', '<leader>ft', function()
end, { noremap = true, silent = true })
-- Diagnostics, LSP
-vim.keymap.set('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<CR>')
-vim.keymap.set('n', 'gp', '<cmd>lua vim.diagnostic.goto_prev()<CR>')
-vim.keymap.set('n', 'gn', '<cmd>lua vim.diagnostic.goto_next()<CR>')
+vim.keymap.set("n", "gl", "<cmd>lua vim.diagnostic.open_float()<CR>")
+vim.keymap.set("n", "gp", "<cmd>lua vim.diagnostic.jump({ count = -1 })<CR>")
+vim.keymap.set("n", "gn", "<cmd>lua vim.diagnostic.jump({ count = 1 })<CR>")
-vim.api.nvim_create_autocmd('LspAttach', {
- desc = 'LSP actions',
+vim.api.nvim_create_autocmd("LspAttach", {
+ desc = "LSP actions",
callback = function(event)
local opts = { buffer = event.buf }
- vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
- vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
- vim.keymap.set('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
- vim.keymap.set('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
- vim.keymap.set({ 'n', 'x' }, '<S-f>', '<cmd>lua vim.lsp.buf.format({async = true})<CR>', opts)
+ vim.keymap.set("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
+ vim.keymap.set("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
+ vim.keymap.set("n", "go", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
+ vim.keymap.set("n", "gs", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
+ vim.keymap.set({ "n", "x" }, "<S-f>", "<cmd>lua vim.lsp.buf.format({async = true})<CR>", opts)
-- u/Blan_11
- vim.keymap.set('n', '<leader>lh', function()
+ vim.keymap.set("n", "<leader>lh", function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end, { silent = true, buffer = event.buf })
end
diff --git a/lua/pml68/lsp.lua b/plugin/30-lspconfig.lua
index 6736e26..d8a9cfc 100644
--- a/lua/pml68/lsp.lua
+++ b/plugin/30-lspconfig.lua
@@ -14,7 +14,6 @@ local servers = {
"lua_ls",
"glsl_analyzer",
"csharp_ls",
- "gopls",
"unocss",
}
@@ -29,8 +28,29 @@ vim.api.nvim_create_autocmd({ "BufEnter" }, {
end,
})
+vim.api.nvim_create_autocmd({ "BufEnter" }, {
+ once = true,
+ pattern = { "Cargo.toml" },
+ callback = function()
+ vim.pack.add({ "https://github.com/saecki/crates.nvim" })
+ require("crates").setup({
+ lsp = {
+ enabled = true,
+ actions = true,
+ completion = true,
+ hover = true,
+ },
+ })
+
+ vim.keymap.set("n", "<leader>rcu", function()
+ require("crates").upgrade_all_crates()
+ end)
+ end,
+})
+
vim.lsp.config('*', {
on_attach = function(client, bufnr)
+ vim.pack.add({ "https://github.com/artemave/workspace-diagnostics.nvim" })
require("workspace-diagnostics").populate_workspace_diagnostics(client, bufnr)
end
})
diff --git a/lua/pml68/configs/mason.lua b/plugin/40-lsp.lua
index 8635109..af95c47 100644
--- a/lua/pml68/configs/mason.lua
+++ b/plugin/40-lsp.lua
@@ -1,6 +1,5 @@
-return {
+local opts = {
ensure_installed = {
- -- "asm-lsp",
"bash-language-server",
"termux-language-server",
"lua-language-server",
@@ -19,9 +18,6 @@ return {
"kotlin-lsp",
"jdtls",
"csharp-language-server",
- "gopls",
- "gofumpt",
- "golines",
"unocss-language-server",
},
PATH = "skip",
@@ -44,3 +40,22 @@ return {
},
max_concurrent_installers = 10,
}
+
+vim.api.nvim_create_user_command("MasonInstallAll", function ()
+ if opts.ensure_installed and #opts.ensure_installed > 0 then
+ vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " "))
+ end
+end, {
+ desc = "Install all required mason packages",
+})
+
+vim.pack.add({
+ "https://github.com/neovim/nvim-lspconfig",
+ "https://github.com/mason-org/mason.nvim",
+})
+
+require("mason").setup(opts)
+
+if not (vim.uv or vim.loop).fs_stat(vim.g.mason_path) then
+ vim.cmd("MasonInstallAll")
+end