aboutsummaryrefslogtreecommitdiff
path: root/plugin
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 /plugin
parentfeat: enable ui2, add back LspLog command (diff)
downloadnvim-8bb513a86e8bea07fdb8cea71d254d46ffc7806b.tar.gz
feat!: migrate to vim.pack
Diffstat (limited to '')
-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/20-colors.lua27
-rw-r--r--plugin/30-lspconfig.lua (renamed from lua/pml68/lsp.lua)22
-rw-r--r--plugin/40-completion.lua36
-rw-r--r--plugin/40-git.lua18
-rw-r--r--plugin/40-guard.lua14
-rw-r--r--plugin/40-lsp.lua (renamed from lua/pml68/configs/mason.lua)25
-rw-r--r--plugin/40-misc.lua17
-rw-r--r--plugin/40-oil.lua24
-rw-r--r--plugin/40-treesitter.lua58
11 files changed, 337 insertions, 52 deletions
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/plugin/20-colors.lua b/plugin/20-colors.lua
new file mode 100644
index 0000000..dcab6d5
--- /dev/null
+++ b/plugin/20-colors.lua
@@ -0,0 +1,27 @@
+vim.pack.add({
+ "https://github.com/uga-rosa/ccc.nvim",
+ {
+ src = "https://github.com/pml68/rosepine-tmuxed",
+ name = "rose-pine",
+ },
+})
+
+require("ccc").setup({
+ highlighter = {
+ auto_enable = true,
+ lsp = true,
+ },
+})
+
+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")
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/plugin/40-completion.lua b/plugin/40-completion.lua
new file mode 100644
index 0000000..597a426
--- /dev/null
+++ b/plugin/40-completion.lua
@@ -0,0 +1,36 @@
+vim.pack.add({
+ {
+ src = "https://github.com/saghen/blink.compat",
+ version = vim.version.range("2.x"),
+ },
+ {
+ src = "https://github.com/saghen/blink.cmp",
+ version = vim.version.range("1.x"),
+ },
+})
+
+require("blink.compat").setup({})
+
+require("blink.cmp").setup({
+ 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/plugin/40-git.lua b/plugin/40-git.lua
new file mode 100644
index 0000000..eaf67b4
--- /dev/null
+++ b/plugin/40-git.lua
@@ -0,0 +1,18 @@
+vim.pack.add({ "https://github.com/lewis6991/gitsigns.nvim" })
+
+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,
+})
diff --git a/plugin/40-guard.lua b/plugin/40-guard.lua
new file mode 100644
index 0000000..ffdd82a
--- /dev/null
+++ b/plugin/40-guard.lua
@@ -0,0 +1,14 @@
+vim.api.nvim_create_autocmd({ "BufEnter" }, {
+ once = true,
+ pattern = { "*.c", "*.cpp", "*.cc", "*.h", "*.hpp", "*.toml", "*.json", "*.lua" },
+ callback = function()
+ vim.pack.add({ "https://github.com/nvimdev/guard-collection" })
+ vim.pack.add({ "https://github.com/nvimdev/guard.nvim" })
+
+ local ft = require("guard.filetype")
+
+ ft("c,cpp,h"):fmt("clang-format")
+ ft("toml"):fmt("taplo")
+ ft("json"):fmt("jq")
+ 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
diff --git a/plugin/40-misc.lua b/plugin/40-misc.lua
new file mode 100644
index 0000000..94e46e0
--- /dev/null
+++ b/plugin/40-misc.lua
@@ -0,0 +1,17 @@
+vim.schedule(function()
+ vim.pack.add({
+ "https://github.com/andweeb/presence.nvim",
+ "https://github.com/NStefan002/screenkey.nvim",
+ "https://github.com/NStefan002/visual-surround.nvim",
+ "https://github.com/christoomey/vim-tmux-navigator",
+ "https://github.com/artemave/workspace-diagnostics.nvim",
+ "https://github.com/lukas-reineke/indent-blankline.nvim",
+ })
+
+ require("presence").setup({
+ main_image = "file",
+ })
+ require("screenkey").setup({})
+ require("visual-surround").setup({})
+ require("ibl").setup()
+end)
diff --git a/plugin/40-oil.lua b/plugin/40-oil.lua
new file mode 100644
index 0000000..34b4a90
--- /dev/null
+++ b/plugin/40-oil.lua
@@ -0,0 +1,24 @@
+vim.pack.add({ "https://github.com/stevearc/oil.nvim" })
+require("oil").setup({
+ keymaps = {
+ ["<C-h>"] = false,
+ },
+ view_options = {
+ show_hidden = true,
+ natural_order = true,
+ is_always_hidden = function(name, _)
+ return 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,
+})
diff --git a/plugin/40-treesitter.lua b/plugin/40-treesitter.lua
new file mode 100644
index 0000000..a9ff45b
--- /dev/null
+++ b/plugin/40-treesitter.lua
@@ -0,0 +1,58 @@
+vim.pack.add({ "https://github.com/nvim-treesitter/nvim-treesitter" })
+
+local ts = require("nvim-treesitter")
+
+local ensure_installed = {
+ "asm",
+ "bash",
+ "c",
+ "c_sharp",
+ "cpp",
+ "css",
+ "git_config",
+ "gitattributes",
+ "gitcommit",
+ "gitignore",
+ "glsl",
+ "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
+})